@dakera-ai/dakera 0.8.5 → 0.9.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/dist/index.d.mts CHANGED
@@ -1016,6 +1016,7 @@ interface OpsStats {
1016
1016
  namespace_count: number;
1017
1017
  uptime_seconds: number;
1018
1018
  timestamp: number;
1019
+ state: string;
1019
1020
  }
1020
1021
  /** Cluster status response */
1021
1022
  interface ClusterStatus {
@@ -1259,6 +1260,110 @@ interface BatchForgetRequest {
1259
1260
  interface BatchForgetResponse {
1260
1261
  deleted_count: number;
1261
1262
  }
1263
+ /**
1264
+ * Edge type for memory knowledge graph relationships (CE-5).
1265
+ *
1266
+ * - `related_to`: Cosine similarity ≥ 0.85 between two memories.
1267
+ * - `shares_entity`: Both memories reference the same named entity (CE-4).
1268
+ * - `precedes`: Temporal ordering — source was created before target.
1269
+ * - `linked_by`: Explicit user/agent-created link.
1270
+ */
1271
+ type EdgeType = 'related_to' | 'shares_entity' | 'precedes' | 'linked_by';
1272
+ /** A directed edge in the memory knowledge graph. */
1273
+ interface GraphEdge {
1274
+ /** Unique edge identifier. */
1275
+ id: string;
1276
+ /** Source memory ID. */
1277
+ source_id: string;
1278
+ /** Target memory ID. */
1279
+ target_id: string;
1280
+ /** Relationship type between the two memories. */
1281
+ edge_type: EdgeType;
1282
+ /** Edge weight (0.0–1.0). For `related_to` this is the cosine similarity score. */
1283
+ weight: number;
1284
+ /** Unix timestamp of edge creation. */
1285
+ created_at: number;
1286
+ }
1287
+ /** A node (memory) in the knowledge graph traversal result. */
1288
+ interface GraphNode {
1289
+ /** Memory identifier. */
1290
+ memory_id: string;
1291
+ /** First 200 characters of memory content. */
1292
+ content_preview: string;
1293
+ /** Memory importance score. */
1294
+ importance: number;
1295
+ /** Traversal depth from the root node (root = 0). */
1296
+ depth: number;
1297
+ }
1298
+ /** Graph traversal result from `GET /v1/memories/{id}/graph`. */
1299
+ interface MemoryGraph {
1300
+ /** The root memory ID from which traversal started. */
1301
+ root_id: string;
1302
+ /** Maximum traversal depth used. */
1303
+ depth: number;
1304
+ /** All memory nodes reachable within the requested depth. */
1305
+ nodes: GraphNode[];
1306
+ /** All edges connecting the returned nodes. */
1307
+ edges: GraphEdge[];
1308
+ }
1309
+ /** Shortest path result from `GET /v1/memories/{id}/path`. */
1310
+ interface GraphPath {
1311
+ /** Starting memory ID. */
1312
+ source_id: string;
1313
+ /** Destination memory ID. */
1314
+ target_id: string;
1315
+ /** Ordered list of memory IDs from source to target (inclusive). */
1316
+ path: string[];
1317
+ /** Number of edges traversed (`path.length - 1`). -1 if no path exists. */
1318
+ hops: number;
1319
+ /** Edges along the path, in traversal order. */
1320
+ edges: GraphEdge[];
1321
+ }
1322
+ /** Response from `POST /v1/memories/{id}/links`. */
1323
+ interface GraphLinkResponse {
1324
+ /** The newly created edge. */
1325
+ edge: GraphEdge;
1326
+ }
1327
+ /** Agent graph export from `GET /v1/agents/{id}/graph/export`. */
1328
+ interface GraphExport {
1329
+ /** Agent whose graph was exported. */
1330
+ agent_id: string;
1331
+ /** Export format: `json`, `graphml`, or `csv`. */
1332
+ format: 'json' | 'graphml' | 'csv';
1333
+ /** Serialised graph in the requested format. */
1334
+ data: string;
1335
+ /** Total number of memory nodes in the export. */
1336
+ node_count: number;
1337
+ /** Total number of edges in the export. */
1338
+ edge_count: number;
1339
+ }
1340
+ /** Options for `client.memories.graph()`. */
1341
+ interface MemoryGraphOptions {
1342
+ /** Maximum traversal depth (default: 1, max: 3). */
1343
+ depth?: number;
1344
+ /** Filter by edge types. `undefined` returns all types. */
1345
+ types?: EdgeType[];
1346
+ }
1347
+ /** Configuration for namespace-level entity extraction (CE-4). */
1348
+ interface NamespaceNerConfig {
1349
+ extract_entities: boolean;
1350
+ entity_types?: string[];
1351
+ }
1352
+ /** A single extracted entity from GLiNER or rule-based pipeline. */
1353
+ interface ExtractedEntity {
1354
+ entity_type: string;
1355
+ value: string;
1356
+ score: number;
1357
+ }
1358
+ /** Response from POST /v1/memories/extract */
1359
+ interface EntityExtractionResponse {
1360
+ entities: ExtractedEntity[];
1361
+ }
1362
+ /** Response from GET /v1/memory/entities/:id */
1363
+ interface MemoryEntitiesResponse {
1364
+ memory_id: string;
1365
+ entities: ExtractedEntity[];
1366
+ }
1262
1367
 
1263
1368
  /**
1264
1369
  * Dakera Client
@@ -1835,6 +1940,76 @@ declare class DakeraClient {
1835
1940
  consolidate(agentId: string, request?: ConsolidateRequest): Promise<ConsolidateResponse>;
1836
1941
  /** Submit feedback on a memory recall */
1837
1942
  memoryFeedback(agentId: string, request: MemoryFeedbackRequest): Promise<MemoryFeedbackResponse>;
1943
+ /**
1944
+ * Traverse the knowledge graph from a memory node.
1945
+ *
1946
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1947
+ *
1948
+ * @param memoryId Root memory ID to start traversal from.
1949
+ * @param options `depth` (default 1, max 3) and optional `types` filter.
1950
+ *
1951
+ * @example
1952
+ * const graph = await client.memories.graph(memoryId, { depth: 2 });
1953
+ * console.log(`${graph.nodes.length} nodes, ${graph.edges.length} edges`);
1954
+ */
1955
+ memoryGraph(memoryId: string, options?: MemoryGraphOptions): Promise<MemoryGraph>;
1956
+ /**
1957
+ * Find the shortest path between two memories in the knowledge graph.
1958
+ *
1959
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1960
+ *
1961
+ * @param sourceId Starting memory ID.
1962
+ * @param targetId Destination memory ID.
1963
+ */
1964
+ memoryPath(sourceId: string, targetId: string): Promise<GraphPath>;
1965
+ /**
1966
+ * Create an explicit edge between two memories.
1967
+ *
1968
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1969
+ *
1970
+ * @param sourceId Source memory ID.
1971
+ * @param targetId Target memory ID.
1972
+ * @param edgeType Edge type — must be `"linked_by"` for explicit links.
1973
+ */
1974
+ memoryLink(sourceId: string, targetId: string, edgeType?: EdgeType): Promise<GraphLinkResponse>;
1975
+ /**
1976
+ * Export the full knowledge graph for an agent.
1977
+ *
1978
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1979
+ *
1980
+ * @param agentId Agent whose graph to export.
1981
+ * @param format Export format — `"json"` (default), `"graphml"`, or `"csv"`.
1982
+ */
1983
+ agentGraphExport(agentId: string, format?: 'json' | 'graphml' | 'csv'): Promise<GraphExport>;
1984
+ /**
1985
+ * Configure entity extraction for a namespace.
1986
+ *
1987
+ * @param namespace - Target namespace
1988
+ * @param config - NER configuration (extract_entities flag + entity_types)
1989
+ * @returns Updated namespace config
1990
+ *
1991
+ * @note Requires CE-4 (GLiNER) on the server.
1992
+ */
1993
+ configureNamespaceNer(namespace: string, config: NamespaceNerConfig): Promise<Record<string, unknown>>;
1994
+ /**
1995
+ * Extract entities from arbitrary text without storing a memory.
1996
+ *
1997
+ * @param text - Text to extract entities from
1998
+ * @param entityTypes - Entity types to extract (defaults to server defaults)
1999
+ * @returns EntityExtractionResponse with extracted entities
2000
+ *
2001
+ * @note Requires CE-4 (GLiNER) on the server.
2002
+ */
2003
+ extractEntities(text: string, entityTypes?: string[]): Promise<EntityExtractionResponse>;
2004
+ /**
2005
+ * Get entity tags attached to a stored memory.
2006
+ *
2007
+ * @param memoryId - Memory ID to fetch entities for
2008
+ * @returns MemoryEntitiesResponse with entity list
2009
+ *
2010
+ * @note Requires CE-4 (GLiNER) on the server.
2011
+ */
2012
+ memoryEntities(memoryId: string): Promise<MemoryEntitiesResponse>;
1838
2013
  /** Start a new session */
1839
2014
  startSession(agentId: string, metadata?: Record<string, unknown>): Promise<Session>;
1840
2015
  /** End a session */
@@ -2029,6 +2204,34 @@ declare class DakeraClient {
2029
2204
  * ```
2030
2205
  */
2031
2206
  streamMemoryEvents(): AsyncGenerator<MemoryEvent>;
2207
+ /**
2208
+ * Subscribe to real-time memory lifecycle events for a specific agent.
2209
+ *
2210
+ * Wraps `GET /v1/events/stream`, filtering events by `agentId` and
2211
+ * optional `tags`. Reconnects automatically on connection drop when
2212
+ * `reconnect` is `true`.
2213
+ *
2214
+ * Requires a Read-scoped API key.
2215
+ *
2216
+ * @param agentId - Agent whose events to receive.
2217
+ * @param options.tags - Optional tag filter: only events whose tags overlap
2218
+ * this array are yielded.
2219
+ * @param options.reconnect - Auto-reconnect on connection drop. Default `true`.
2220
+ * @param options.reconnectDelay - Milliseconds to wait between reconnection
2221
+ * attempts. Default `1000`.
2222
+ *
2223
+ * @example
2224
+ * ```ts
2225
+ * for await (const event of client.subscribeAgentMemories('my-bot', { tags: ['important'] })) {
2226
+ * console.log(event.event_type, event.memory_id);
2227
+ * }
2228
+ * ```
2229
+ */
2230
+ subscribeAgentMemories(agentId: string, options?: {
2231
+ tags?: string[];
2232
+ reconnect?: boolean;
2233
+ reconnectDelay?: number;
2234
+ }): AsyncGenerator<MemoryEvent>;
2032
2235
  /**
2033
2236
  * Return a URL with `?api_key=<key>` appended for use with browser-native
2034
2237
  * `EventSource`, which cannot send custom request headers.
@@ -2117,4 +2320,4 @@ declare class TimeoutError extends DakeraError {
2117
2320
  constructor(message: string);
2118
2321
  }
2119
2322
 
2120
- export { type AccessPatternHint, type AgentId, type AgentNetworkEdge, type AgentNetworkInfo, type AgentNetworkNode, type AgentNetworkStats, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, AuthorizationError, type AutoPilotConfig, type AutoPilotConfigRequest, type AutoPilotConfigResponse, type AutoPilotConsolidationResult, type AutoPilotDedupResult, type AutoPilotStatusResponse, type AutoPilotTriggerAction, type AutoPilotTriggerResponse, type BackupInfo, type BatchForgetRequest, type BatchForgetResponse, type BatchMemoryFilter, type BatchQuerySpec, type BatchRecallRequest, type BatchRecallResponse, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, type ConfigureNamespaceRequest, type ConfigureNamespaceResponse, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type ConsolidationResultSnapshot, type CreateKeyRequest, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DecayConfigResponse, type DecayConfigUpdateRequest, type DecayConfigUpdateResponse, type DecayStatsResponse, type DedupResultSnapshot, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, ErrorCode, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LastDecayCycleStats, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryEvent, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, NotFoundError, type OpStatus, type OperationProgressEvent, type OpsStats, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type RateLimitHeaders, type ReadConsistency, type RecallRequest, type RecalledMemory, type RetryConfig, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type StreamLaggedEvent, 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 VectorMutationOp, type VectorsMutatedEvent, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier, agentId, memoryId, sessionId, vectorId };
2323
+ export { type AccessPatternHint, type AgentId, type AgentNetworkEdge, type AgentNetworkInfo, type AgentNetworkNode, type AgentNetworkStats, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, AuthorizationError, type AutoPilotConfig, type AutoPilotConfigRequest, type AutoPilotConfigResponse, type AutoPilotConsolidationResult, type AutoPilotDedupResult, type AutoPilotStatusResponse, type AutoPilotTriggerAction, type AutoPilotTriggerResponse, type BackupInfo, type BatchForgetRequest, type BatchForgetResponse, type BatchMemoryFilter, type BatchQuerySpec, type BatchRecallRequest, type BatchRecallResponse, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, type ConfigureNamespaceRequest, type ConfigureNamespaceResponse, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type ConsolidationResultSnapshot, type CreateKeyRequest, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DecayConfigResponse, type DecayConfigUpdateRequest, type DecayConfigUpdateResponse, type DecayStatsResponse, type DedupResultSnapshot, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EdgeType, type EmbeddingModel, type EntityExtractionResponse, ErrorCode, type ExportRequest, type ExportResponse, type ExportedVector, type ExtractedEntity, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type GraphEdge, type GraphExport, type GraphLinkResponse, type GraphNode, type GraphPath, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LastDecayCycleStats, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryEntitiesResponse, type MemoryEvent, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryGraph, type MemoryGraphOptions, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, type NamespaceNerConfig, NotFoundError, type OpStatus, type OperationProgressEvent, type OpsStats, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type RateLimitHeaders, type ReadConsistency, type RecallRequest, type RecalledMemory, type RetryConfig, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type StreamLaggedEvent, 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 VectorMutationOp, type VectorsMutatedEvent, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier, agentId, memoryId, sessionId, vectorId };
package/dist/index.d.ts CHANGED
@@ -1016,6 +1016,7 @@ interface OpsStats {
1016
1016
  namespace_count: number;
1017
1017
  uptime_seconds: number;
1018
1018
  timestamp: number;
1019
+ state: string;
1019
1020
  }
1020
1021
  /** Cluster status response */
1021
1022
  interface ClusterStatus {
@@ -1259,6 +1260,110 @@ interface BatchForgetRequest {
1259
1260
  interface BatchForgetResponse {
1260
1261
  deleted_count: number;
1261
1262
  }
1263
+ /**
1264
+ * Edge type for memory knowledge graph relationships (CE-5).
1265
+ *
1266
+ * - `related_to`: Cosine similarity ≥ 0.85 between two memories.
1267
+ * - `shares_entity`: Both memories reference the same named entity (CE-4).
1268
+ * - `precedes`: Temporal ordering — source was created before target.
1269
+ * - `linked_by`: Explicit user/agent-created link.
1270
+ */
1271
+ type EdgeType = 'related_to' | 'shares_entity' | 'precedes' | 'linked_by';
1272
+ /** A directed edge in the memory knowledge graph. */
1273
+ interface GraphEdge {
1274
+ /** Unique edge identifier. */
1275
+ id: string;
1276
+ /** Source memory ID. */
1277
+ source_id: string;
1278
+ /** Target memory ID. */
1279
+ target_id: string;
1280
+ /** Relationship type between the two memories. */
1281
+ edge_type: EdgeType;
1282
+ /** Edge weight (0.0–1.0). For `related_to` this is the cosine similarity score. */
1283
+ weight: number;
1284
+ /** Unix timestamp of edge creation. */
1285
+ created_at: number;
1286
+ }
1287
+ /** A node (memory) in the knowledge graph traversal result. */
1288
+ interface GraphNode {
1289
+ /** Memory identifier. */
1290
+ memory_id: string;
1291
+ /** First 200 characters of memory content. */
1292
+ content_preview: string;
1293
+ /** Memory importance score. */
1294
+ importance: number;
1295
+ /** Traversal depth from the root node (root = 0). */
1296
+ depth: number;
1297
+ }
1298
+ /** Graph traversal result from `GET /v1/memories/{id}/graph`. */
1299
+ interface MemoryGraph {
1300
+ /** The root memory ID from which traversal started. */
1301
+ root_id: string;
1302
+ /** Maximum traversal depth used. */
1303
+ depth: number;
1304
+ /** All memory nodes reachable within the requested depth. */
1305
+ nodes: GraphNode[];
1306
+ /** All edges connecting the returned nodes. */
1307
+ edges: GraphEdge[];
1308
+ }
1309
+ /** Shortest path result from `GET /v1/memories/{id}/path`. */
1310
+ interface GraphPath {
1311
+ /** Starting memory ID. */
1312
+ source_id: string;
1313
+ /** Destination memory ID. */
1314
+ target_id: string;
1315
+ /** Ordered list of memory IDs from source to target (inclusive). */
1316
+ path: string[];
1317
+ /** Number of edges traversed (`path.length - 1`). -1 if no path exists. */
1318
+ hops: number;
1319
+ /** Edges along the path, in traversal order. */
1320
+ edges: GraphEdge[];
1321
+ }
1322
+ /** Response from `POST /v1/memories/{id}/links`. */
1323
+ interface GraphLinkResponse {
1324
+ /** The newly created edge. */
1325
+ edge: GraphEdge;
1326
+ }
1327
+ /** Agent graph export from `GET /v1/agents/{id}/graph/export`. */
1328
+ interface GraphExport {
1329
+ /** Agent whose graph was exported. */
1330
+ agent_id: string;
1331
+ /** Export format: `json`, `graphml`, or `csv`. */
1332
+ format: 'json' | 'graphml' | 'csv';
1333
+ /** Serialised graph in the requested format. */
1334
+ data: string;
1335
+ /** Total number of memory nodes in the export. */
1336
+ node_count: number;
1337
+ /** Total number of edges in the export. */
1338
+ edge_count: number;
1339
+ }
1340
+ /** Options for `client.memories.graph()`. */
1341
+ interface MemoryGraphOptions {
1342
+ /** Maximum traversal depth (default: 1, max: 3). */
1343
+ depth?: number;
1344
+ /** Filter by edge types. `undefined` returns all types. */
1345
+ types?: EdgeType[];
1346
+ }
1347
+ /** Configuration for namespace-level entity extraction (CE-4). */
1348
+ interface NamespaceNerConfig {
1349
+ extract_entities: boolean;
1350
+ entity_types?: string[];
1351
+ }
1352
+ /** A single extracted entity from GLiNER or rule-based pipeline. */
1353
+ interface ExtractedEntity {
1354
+ entity_type: string;
1355
+ value: string;
1356
+ score: number;
1357
+ }
1358
+ /** Response from POST /v1/memories/extract */
1359
+ interface EntityExtractionResponse {
1360
+ entities: ExtractedEntity[];
1361
+ }
1362
+ /** Response from GET /v1/memory/entities/:id */
1363
+ interface MemoryEntitiesResponse {
1364
+ memory_id: string;
1365
+ entities: ExtractedEntity[];
1366
+ }
1262
1367
 
1263
1368
  /**
1264
1369
  * Dakera Client
@@ -1835,6 +1940,76 @@ declare class DakeraClient {
1835
1940
  consolidate(agentId: string, request?: ConsolidateRequest): Promise<ConsolidateResponse>;
1836
1941
  /** Submit feedback on a memory recall */
1837
1942
  memoryFeedback(agentId: string, request: MemoryFeedbackRequest): Promise<MemoryFeedbackResponse>;
1943
+ /**
1944
+ * Traverse the knowledge graph from a memory node.
1945
+ *
1946
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1947
+ *
1948
+ * @param memoryId Root memory ID to start traversal from.
1949
+ * @param options `depth` (default 1, max 3) and optional `types` filter.
1950
+ *
1951
+ * @example
1952
+ * const graph = await client.memories.graph(memoryId, { depth: 2 });
1953
+ * console.log(`${graph.nodes.length} nodes, ${graph.edges.length} edges`);
1954
+ */
1955
+ memoryGraph(memoryId: string, options?: MemoryGraphOptions): Promise<MemoryGraph>;
1956
+ /**
1957
+ * Find the shortest path between two memories in the knowledge graph.
1958
+ *
1959
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1960
+ *
1961
+ * @param sourceId Starting memory ID.
1962
+ * @param targetId Destination memory ID.
1963
+ */
1964
+ memoryPath(sourceId: string, targetId: string): Promise<GraphPath>;
1965
+ /**
1966
+ * Create an explicit edge between two memories.
1967
+ *
1968
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1969
+ *
1970
+ * @param sourceId Source memory ID.
1971
+ * @param targetId Target memory ID.
1972
+ * @param edgeType Edge type — must be `"linked_by"` for explicit links.
1973
+ */
1974
+ memoryLink(sourceId: string, targetId: string, edgeType?: EdgeType): Promise<GraphLinkResponse>;
1975
+ /**
1976
+ * Export the full knowledge graph for an agent.
1977
+ *
1978
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1979
+ *
1980
+ * @param agentId Agent whose graph to export.
1981
+ * @param format Export format — `"json"` (default), `"graphml"`, or `"csv"`.
1982
+ */
1983
+ agentGraphExport(agentId: string, format?: 'json' | 'graphml' | 'csv'): Promise<GraphExport>;
1984
+ /**
1985
+ * Configure entity extraction for a namespace.
1986
+ *
1987
+ * @param namespace - Target namespace
1988
+ * @param config - NER configuration (extract_entities flag + entity_types)
1989
+ * @returns Updated namespace config
1990
+ *
1991
+ * @note Requires CE-4 (GLiNER) on the server.
1992
+ */
1993
+ configureNamespaceNer(namespace: string, config: NamespaceNerConfig): Promise<Record<string, unknown>>;
1994
+ /**
1995
+ * Extract entities from arbitrary text without storing a memory.
1996
+ *
1997
+ * @param text - Text to extract entities from
1998
+ * @param entityTypes - Entity types to extract (defaults to server defaults)
1999
+ * @returns EntityExtractionResponse with extracted entities
2000
+ *
2001
+ * @note Requires CE-4 (GLiNER) on the server.
2002
+ */
2003
+ extractEntities(text: string, entityTypes?: string[]): Promise<EntityExtractionResponse>;
2004
+ /**
2005
+ * Get entity tags attached to a stored memory.
2006
+ *
2007
+ * @param memoryId - Memory ID to fetch entities for
2008
+ * @returns MemoryEntitiesResponse with entity list
2009
+ *
2010
+ * @note Requires CE-4 (GLiNER) on the server.
2011
+ */
2012
+ memoryEntities(memoryId: string): Promise<MemoryEntitiesResponse>;
1838
2013
  /** Start a new session */
1839
2014
  startSession(agentId: string, metadata?: Record<string, unknown>): Promise<Session>;
1840
2015
  /** End a session */
@@ -2029,6 +2204,34 @@ declare class DakeraClient {
2029
2204
  * ```
2030
2205
  */
2031
2206
  streamMemoryEvents(): AsyncGenerator<MemoryEvent>;
2207
+ /**
2208
+ * Subscribe to real-time memory lifecycle events for a specific agent.
2209
+ *
2210
+ * Wraps `GET /v1/events/stream`, filtering events by `agentId` and
2211
+ * optional `tags`. Reconnects automatically on connection drop when
2212
+ * `reconnect` is `true`.
2213
+ *
2214
+ * Requires a Read-scoped API key.
2215
+ *
2216
+ * @param agentId - Agent whose events to receive.
2217
+ * @param options.tags - Optional tag filter: only events whose tags overlap
2218
+ * this array are yielded.
2219
+ * @param options.reconnect - Auto-reconnect on connection drop. Default `true`.
2220
+ * @param options.reconnectDelay - Milliseconds to wait between reconnection
2221
+ * attempts. Default `1000`.
2222
+ *
2223
+ * @example
2224
+ * ```ts
2225
+ * for await (const event of client.subscribeAgentMemories('my-bot', { tags: ['important'] })) {
2226
+ * console.log(event.event_type, event.memory_id);
2227
+ * }
2228
+ * ```
2229
+ */
2230
+ subscribeAgentMemories(agentId: string, options?: {
2231
+ tags?: string[];
2232
+ reconnect?: boolean;
2233
+ reconnectDelay?: number;
2234
+ }): AsyncGenerator<MemoryEvent>;
2032
2235
  /**
2033
2236
  * Return a URL with `?api_key=<key>` appended for use with browser-native
2034
2237
  * `EventSource`, which cannot send custom request headers.
@@ -2117,4 +2320,4 @@ declare class TimeoutError extends DakeraError {
2117
2320
  constructor(message: string);
2118
2321
  }
2119
2322
 
2120
- export { type AccessPatternHint, type AgentId, type AgentNetworkEdge, type AgentNetworkInfo, type AgentNetworkNode, type AgentNetworkStats, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, AuthorizationError, type AutoPilotConfig, type AutoPilotConfigRequest, type AutoPilotConfigResponse, type AutoPilotConsolidationResult, type AutoPilotDedupResult, type AutoPilotStatusResponse, type AutoPilotTriggerAction, type AutoPilotTriggerResponse, type BackupInfo, type BatchForgetRequest, type BatchForgetResponse, type BatchMemoryFilter, type BatchQuerySpec, type BatchRecallRequest, type BatchRecallResponse, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, type ConfigureNamespaceRequest, type ConfigureNamespaceResponse, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type ConsolidationResultSnapshot, type CreateKeyRequest, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DecayConfigResponse, type DecayConfigUpdateRequest, type DecayConfigUpdateResponse, type DecayStatsResponse, type DedupResultSnapshot, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, ErrorCode, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LastDecayCycleStats, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryEvent, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, NotFoundError, type OpStatus, type OperationProgressEvent, type OpsStats, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type RateLimitHeaders, type ReadConsistency, type RecallRequest, type RecalledMemory, type RetryConfig, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type StreamLaggedEvent, 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 VectorMutationOp, type VectorsMutatedEvent, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier, agentId, memoryId, sessionId, vectorId };
2323
+ export { type AccessPatternHint, type AgentId, type AgentNetworkEdge, type AgentNetworkInfo, type AgentNetworkNode, type AgentNetworkStats, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, AuthorizationError, type AutoPilotConfig, type AutoPilotConfigRequest, type AutoPilotConfigResponse, type AutoPilotConsolidationResult, type AutoPilotDedupResult, type AutoPilotStatusResponse, type AutoPilotTriggerAction, type AutoPilotTriggerResponse, type BackupInfo, type BatchForgetRequest, type BatchForgetResponse, type BatchMemoryFilter, type BatchQuerySpec, type BatchRecallRequest, type BatchRecallResponse, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, type ConfigureNamespaceRequest, type ConfigureNamespaceResponse, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type ConsolidationResultSnapshot, type CreateKeyRequest, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DecayConfigResponse, type DecayConfigUpdateRequest, type DecayConfigUpdateResponse, type DecayStatsResponse, type DedupResultSnapshot, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EdgeType, type EmbeddingModel, type EntityExtractionResponse, ErrorCode, type ExportRequest, type ExportResponse, type ExportedVector, type ExtractedEntity, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type GraphEdge, type GraphExport, type GraphLinkResponse, type GraphNode, type GraphPath, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LastDecayCycleStats, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryEntitiesResponse, type MemoryEvent, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryGraph, type MemoryGraphOptions, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, type NamespaceNerConfig, NotFoundError, type OpStatus, type OperationProgressEvent, type OpsStats, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type RateLimitHeaders, type ReadConsistency, type RecallRequest, type RecalledMemory, type RetryConfig, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type StreamLaggedEvent, 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 VectorMutationOp, type VectorsMutatedEvent, type WarmCacheRequest, type WarmCacheResponse, type WarmingPriority, type WarmingTargetTier, agentId, memoryId, sessionId, vectorId };
package/dist/index.js CHANGED
@@ -1136,6 +1136,112 @@ var DakeraClient = class {
1136
1136
  return this.request("POST", `/v1/agents/${agentId2}/memories/feedback`, request);
1137
1137
  }
1138
1138
  // ===========================================================================
1139
+ // Memory Knowledge Graph Operations (CE-5 / SDK-9)
1140
+ // ===========================================================================
1141
+ /**
1142
+ * Traverse the knowledge graph from a memory node.
1143
+ *
1144
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1145
+ *
1146
+ * @param memoryId Root memory ID to start traversal from.
1147
+ * @param options `depth` (default 1, max 3) and optional `types` filter.
1148
+ *
1149
+ * @example
1150
+ * const graph = await client.memories.graph(memoryId, { depth: 2 });
1151
+ * console.log(`${graph.nodes.length} nodes, ${graph.edges.length} edges`);
1152
+ */
1153
+ async memoryGraph(memoryId2, options) {
1154
+ const params = new URLSearchParams();
1155
+ params.set("depth", String(options?.depth ?? 1));
1156
+ if (options?.types?.length) {
1157
+ params.set("types", options.types.join(","));
1158
+ }
1159
+ return this.request("GET", `/v1/memories/${memoryId2}/graph?${params}`);
1160
+ }
1161
+ /**
1162
+ * Find the shortest path between two memories in the knowledge graph.
1163
+ *
1164
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1165
+ *
1166
+ * @param sourceId Starting memory ID.
1167
+ * @param targetId Destination memory ID.
1168
+ */
1169
+ async memoryPath(sourceId, targetId) {
1170
+ return this.request("GET", `/v1/memories/${sourceId}/path?target=${encodeURIComponent(targetId)}`);
1171
+ }
1172
+ /**
1173
+ * Create an explicit edge between two memories.
1174
+ *
1175
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1176
+ *
1177
+ * @param sourceId Source memory ID.
1178
+ * @param targetId Target memory ID.
1179
+ * @param edgeType Edge type — must be `"linked_by"` for explicit links.
1180
+ */
1181
+ async memoryLink(sourceId, targetId, edgeType = "linked_by") {
1182
+ return this.request("POST", `/v1/memories/${sourceId}/links`, {
1183
+ target_id: targetId,
1184
+ edge_type: edgeType
1185
+ });
1186
+ }
1187
+ /**
1188
+ * Export the full knowledge graph for an agent.
1189
+ *
1190
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1191
+ *
1192
+ * @param agentId Agent whose graph to export.
1193
+ * @param format Export format — `"json"` (default), `"graphml"`, or `"csv"`.
1194
+ */
1195
+ async agentGraphExport(agentId2, format = "json") {
1196
+ return this.request("GET", `/v1/agents/${agentId2}/graph/export?format=${format}`);
1197
+ }
1198
+ // =========================================================================
1199
+ // Entity Extraction Operations (CE-4)
1200
+ // =========================================================================
1201
+ /**
1202
+ * Configure entity extraction for a namespace.
1203
+ *
1204
+ * @param namespace - Target namespace
1205
+ * @param config - NER configuration (extract_entities flag + entity_types)
1206
+ * @returns Updated namespace config
1207
+ *
1208
+ * @note Requires CE-4 (GLiNER) on the server.
1209
+ */
1210
+ async configureNamespaceNer(namespace, config) {
1211
+ return this.request(
1212
+ "PATCH",
1213
+ `/v1/namespaces/${namespace}/config`,
1214
+ config
1215
+ );
1216
+ }
1217
+ /**
1218
+ * Extract entities from arbitrary text without storing a memory.
1219
+ *
1220
+ * @param text - Text to extract entities from
1221
+ * @param entityTypes - Entity types to extract (defaults to server defaults)
1222
+ * @returns EntityExtractionResponse with extracted entities
1223
+ *
1224
+ * @note Requires CE-4 (GLiNER) on the server.
1225
+ */
1226
+ async extractEntities(text, entityTypes) {
1227
+ const body = { text };
1228
+ if (entityTypes !== void 0) {
1229
+ body["entity_types"] = entityTypes;
1230
+ }
1231
+ return this.request("POST", "/v1/memories/extract", body);
1232
+ }
1233
+ /**
1234
+ * Get entity tags attached to a stored memory.
1235
+ *
1236
+ * @param memoryId - Memory ID to fetch entities for
1237
+ * @returns MemoryEntitiesResponse with entity list
1238
+ *
1239
+ * @note Requires CE-4 (GLiNER) on the server.
1240
+ */
1241
+ async memoryEntities(memoryId2) {
1242
+ return this.request("GET", `/v1/memory/entities/${memoryId2}`);
1243
+ }
1244
+ // ===========================================================================
1139
1245
  // Session Operations
1140
1246
  // ===========================================================================
1141
1247
  /** Start a new session */
@@ -1474,6 +1580,49 @@ var DakeraClient = class {
1474
1580
  const url = `${this.baseUrl}/v1/events/stream`;
1475
1581
  yield* this._streamSseMemory(url);
1476
1582
  }
1583
+ /**
1584
+ * Subscribe to real-time memory lifecycle events for a specific agent.
1585
+ *
1586
+ * Wraps `GET /v1/events/stream`, filtering events by `agentId` and
1587
+ * optional `tags`. Reconnects automatically on connection drop when
1588
+ * `reconnect` is `true`.
1589
+ *
1590
+ * Requires a Read-scoped API key.
1591
+ *
1592
+ * @param agentId - Agent whose events to receive.
1593
+ * @param options.tags - Optional tag filter: only events whose tags overlap
1594
+ * this array are yielded.
1595
+ * @param options.reconnect - Auto-reconnect on connection drop. Default `true`.
1596
+ * @param options.reconnectDelay - Milliseconds to wait between reconnection
1597
+ * attempts. Default `1000`.
1598
+ *
1599
+ * @example
1600
+ * ```ts
1601
+ * for await (const event of client.subscribeAgentMemories('my-bot', { tags: ['important'] })) {
1602
+ * console.log(event.event_type, event.memory_id);
1603
+ * }
1604
+ * ```
1605
+ */
1606
+ async *subscribeAgentMemories(agentId2, options = {}) {
1607
+ const { tags, reconnect = true, reconnectDelay = 1e3 } = options;
1608
+ while (true) {
1609
+ try {
1610
+ for await (const event of this.streamMemoryEvents()) {
1611
+ if (event.event_type === "connected") continue;
1612
+ if (event.agent_id !== agentId2) continue;
1613
+ if (tags && tags.length > 0) {
1614
+ const eventTags = event.tags ?? [];
1615
+ if (!tags.some((t) => eventTags.includes(t))) continue;
1616
+ }
1617
+ yield event;
1618
+ }
1619
+ if (!reconnect) return;
1620
+ } catch (err) {
1621
+ if (!reconnect) throw err;
1622
+ }
1623
+ await new Promise((r) => setTimeout(r, reconnectDelay));
1624
+ }
1625
+ }
1477
1626
  /**
1478
1627
  * Return a URL with `?api_key=<key>` appended for use with browser-native
1479
1628
  * `EventSource`, which cannot send custom request headers.
package/dist/index.mjs CHANGED
@@ -1096,6 +1096,112 @@ var DakeraClient = class {
1096
1096
  return this.request("POST", `/v1/agents/${agentId2}/memories/feedback`, request);
1097
1097
  }
1098
1098
  // ===========================================================================
1099
+ // Memory Knowledge Graph Operations (CE-5 / SDK-9)
1100
+ // ===========================================================================
1101
+ /**
1102
+ * Traverse the knowledge graph from a memory node.
1103
+ *
1104
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1105
+ *
1106
+ * @param memoryId Root memory ID to start traversal from.
1107
+ * @param options `depth` (default 1, max 3) and optional `types` filter.
1108
+ *
1109
+ * @example
1110
+ * const graph = await client.memories.graph(memoryId, { depth: 2 });
1111
+ * console.log(`${graph.nodes.length} nodes, ${graph.edges.length} edges`);
1112
+ */
1113
+ async memoryGraph(memoryId2, options) {
1114
+ const params = new URLSearchParams();
1115
+ params.set("depth", String(options?.depth ?? 1));
1116
+ if (options?.types?.length) {
1117
+ params.set("types", options.types.join(","));
1118
+ }
1119
+ return this.request("GET", `/v1/memories/${memoryId2}/graph?${params}`);
1120
+ }
1121
+ /**
1122
+ * Find the shortest path between two memories in the knowledge graph.
1123
+ *
1124
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1125
+ *
1126
+ * @param sourceId Starting memory ID.
1127
+ * @param targetId Destination memory ID.
1128
+ */
1129
+ async memoryPath(sourceId, targetId) {
1130
+ return this.request("GET", `/v1/memories/${sourceId}/path?target=${encodeURIComponent(targetId)}`);
1131
+ }
1132
+ /**
1133
+ * Create an explicit edge between two memories.
1134
+ *
1135
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1136
+ *
1137
+ * @param sourceId Source memory ID.
1138
+ * @param targetId Target memory ID.
1139
+ * @param edgeType Edge type — must be `"linked_by"` for explicit links.
1140
+ */
1141
+ async memoryLink(sourceId, targetId, edgeType = "linked_by") {
1142
+ return this.request("POST", `/v1/memories/${sourceId}/links`, {
1143
+ target_id: targetId,
1144
+ edge_type: edgeType
1145
+ });
1146
+ }
1147
+ /**
1148
+ * Export the full knowledge graph for an agent.
1149
+ *
1150
+ * Requires CE-5 (Memory Knowledge Graph) on the server.
1151
+ *
1152
+ * @param agentId Agent whose graph to export.
1153
+ * @param format Export format — `"json"` (default), `"graphml"`, or `"csv"`.
1154
+ */
1155
+ async agentGraphExport(agentId2, format = "json") {
1156
+ return this.request("GET", `/v1/agents/${agentId2}/graph/export?format=${format}`);
1157
+ }
1158
+ // =========================================================================
1159
+ // Entity Extraction Operations (CE-4)
1160
+ // =========================================================================
1161
+ /**
1162
+ * Configure entity extraction for a namespace.
1163
+ *
1164
+ * @param namespace - Target namespace
1165
+ * @param config - NER configuration (extract_entities flag + entity_types)
1166
+ * @returns Updated namespace config
1167
+ *
1168
+ * @note Requires CE-4 (GLiNER) on the server.
1169
+ */
1170
+ async configureNamespaceNer(namespace, config) {
1171
+ return this.request(
1172
+ "PATCH",
1173
+ `/v1/namespaces/${namespace}/config`,
1174
+ config
1175
+ );
1176
+ }
1177
+ /**
1178
+ * Extract entities from arbitrary text without storing a memory.
1179
+ *
1180
+ * @param text - Text to extract entities from
1181
+ * @param entityTypes - Entity types to extract (defaults to server defaults)
1182
+ * @returns EntityExtractionResponse with extracted entities
1183
+ *
1184
+ * @note Requires CE-4 (GLiNER) on the server.
1185
+ */
1186
+ async extractEntities(text, entityTypes) {
1187
+ const body = { text };
1188
+ if (entityTypes !== void 0) {
1189
+ body["entity_types"] = entityTypes;
1190
+ }
1191
+ return this.request("POST", "/v1/memories/extract", body);
1192
+ }
1193
+ /**
1194
+ * Get entity tags attached to a stored memory.
1195
+ *
1196
+ * @param memoryId - Memory ID to fetch entities for
1197
+ * @returns MemoryEntitiesResponse with entity list
1198
+ *
1199
+ * @note Requires CE-4 (GLiNER) on the server.
1200
+ */
1201
+ async memoryEntities(memoryId2) {
1202
+ return this.request("GET", `/v1/memory/entities/${memoryId2}`);
1203
+ }
1204
+ // ===========================================================================
1099
1205
  // Session Operations
1100
1206
  // ===========================================================================
1101
1207
  /** Start a new session */
@@ -1434,6 +1540,49 @@ var DakeraClient = class {
1434
1540
  const url = `${this.baseUrl}/v1/events/stream`;
1435
1541
  yield* this._streamSseMemory(url);
1436
1542
  }
1543
+ /**
1544
+ * Subscribe to real-time memory lifecycle events for a specific agent.
1545
+ *
1546
+ * Wraps `GET /v1/events/stream`, filtering events by `agentId` and
1547
+ * optional `tags`. Reconnects automatically on connection drop when
1548
+ * `reconnect` is `true`.
1549
+ *
1550
+ * Requires a Read-scoped API key.
1551
+ *
1552
+ * @param agentId - Agent whose events to receive.
1553
+ * @param options.tags - Optional tag filter: only events whose tags overlap
1554
+ * this array are yielded.
1555
+ * @param options.reconnect - Auto-reconnect on connection drop. Default `true`.
1556
+ * @param options.reconnectDelay - Milliseconds to wait between reconnection
1557
+ * attempts. Default `1000`.
1558
+ *
1559
+ * @example
1560
+ * ```ts
1561
+ * for await (const event of client.subscribeAgentMemories('my-bot', { tags: ['important'] })) {
1562
+ * console.log(event.event_type, event.memory_id);
1563
+ * }
1564
+ * ```
1565
+ */
1566
+ async *subscribeAgentMemories(agentId2, options = {}) {
1567
+ const { tags, reconnect = true, reconnectDelay = 1e3 } = options;
1568
+ while (true) {
1569
+ try {
1570
+ for await (const event of this.streamMemoryEvents()) {
1571
+ if (event.event_type === "connected") continue;
1572
+ if (event.agent_id !== agentId2) continue;
1573
+ if (tags && tags.length > 0) {
1574
+ const eventTags = event.tags ?? [];
1575
+ if (!tags.some((t) => eventTags.includes(t))) continue;
1576
+ }
1577
+ yield event;
1578
+ }
1579
+ if (!reconnect) return;
1580
+ } catch (err) {
1581
+ if (!reconnect) throw err;
1582
+ }
1583
+ await new Promise((r) => setTimeout(r, reconnectDelay));
1584
+ }
1585
+ }
1437
1586
  /**
1438
1587
  * Return a URL with `?api_key=<key>` appended for use with browser-native
1439
1588
  * `EventSource`, which cannot send custom request headers.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakera-ai/dakera",
3
- "version": "0.8.5",
3
+ "version": "0.9.0",
4
4
  "description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",