@dakera-ai/dakera 0.9.6 → 0.9.8

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
@@ -454,6 +454,13 @@ interface RecalledMemory {
454
454
  /** Creation timestamp */
455
455
  created_at?: string;
456
456
  }
457
+ /** COG-2: Response from the recall endpoint with optional associative memories */
458
+ interface RecallResponse {
459
+ /** Primary recalled memories */
460
+ memories: RecalledMemory[];
461
+ /** COG-2: KG depth-1 associated memories (only present when include_associated was true) */
462
+ associated_memories?: RecalledMemory[];
463
+ }
457
464
  /** Response from storing a memory */
458
465
  interface StoreMemoryResponse {
459
466
  /** Created memory ID */
@@ -1344,6 +1351,43 @@ interface GraphExport {
1344
1351
  /** Total number of edges in the export. */
1345
1352
  edge_count: number;
1346
1353
  }
1354
+ /** Response from `GET /v1/knowledge/query` (KG-2). */
1355
+ interface KgQueryResponse {
1356
+ /** Agent whose graph was queried. */
1357
+ agent_id: string;
1358
+ /** Number of unique memory node IDs referenced by the returned edges. */
1359
+ node_count: number;
1360
+ /** Number of edges returned. */
1361
+ edge_count: number;
1362
+ /** Matching edges, up to `limit`. */
1363
+ edges: GraphEdge[];
1364
+ }
1365
+ /** Response from `GET /v1/knowledge/path` (KG-2). */
1366
+ interface KgPathResponse {
1367
+ /** Agent whose graph was traversed. */
1368
+ agent_id: string;
1369
+ /** Source memory ID. */
1370
+ from_id: string;
1371
+ /** Target memory ID. */
1372
+ to_id: string;
1373
+ /** Number of edges in the shortest path (0 if source === target). */
1374
+ hop_count: number;
1375
+ /** Ordered list of memory IDs from source to target (inclusive). */
1376
+ path: string[];
1377
+ }
1378
+ /** Response from `GET /v1/knowledge/export` with `format=json` (KG-2). */
1379
+ interface KgExportResponse {
1380
+ /** Agent whose graph was exported. */
1381
+ agent_id: string;
1382
+ /** Export format used (`"json"` when this interface is returned). */
1383
+ format: string;
1384
+ /** Total number of unique memory node IDs in the export. */
1385
+ node_count: number;
1386
+ /** Total number of edges in the export. */
1387
+ edge_count: number;
1388
+ /** All graph edges for the agent. */
1389
+ edges: GraphEdge[];
1390
+ }
1347
1391
  /** Options for `client.memories.graph()`. */
1348
1392
  interface MemoryGraphOptions {
1349
1393
  /** Maximum traversal depth (default: 1, max: 3). */
@@ -1582,6 +1626,48 @@ interface ExtractEntitiesResponse {
1582
1626
  /** Wall-clock time taken by the ODE sidecar in milliseconds. */
1583
1627
  processing_time_ms: number;
1584
1628
  }
1629
+ /**
1630
+ * Decay strategy name. The COG-1 variants (power_law, logarithmic, flat) are
1631
+ * only valid inside MemoryPolicy per-type fields; the global DecayConfig
1632
+ * endpoint still accepts only "exponential" | "linear" | "step".
1633
+ */
1634
+ type DecayStrategyName = 'exponential' | 'linear' | 'step' | 'power_law' | 'logarithmic' | 'flat';
1635
+ /**
1636
+ * Per-namespace memory lifecycle policy (COG-1).
1637
+ *
1638
+ * Controls type-specific TTLs, decay curves, and spaced repetition behaviour.
1639
+ * All fields are optional and have sensible server-side defaults; only set the
1640
+ * ones you want to override.
1641
+ *
1642
+ * Used by {@link DakeraClient.getMemoryPolicy} and
1643
+ * {@link DakeraClient.setMemoryPolicy}.
1644
+ */
1645
+ interface MemoryPolicy {
1646
+ /** Default TTL for `working` memories in seconds (default: 14 400 = 4 h). */
1647
+ working_ttl_seconds?: number;
1648
+ /** Default TTL for `episodic` memories in seconds (default: 2 592 000 = 30 d). */
1649
+ episodic_ttl_seconds?: number;
1650
+ /** Default TTL for `semantic` memories in seconds (default: 31 536 000 = 365 d). */
1651
+ semantic_ttl_seconds?: number;
1652
+ /** Default TTL for `procedural` memories in seconds (default: 63 072 000 = 730 d). */
1653
+ procedural_ttl_seconds?: number;
1654
+ /** Decay strategy for `working` memories (default: `"exponential"`). */
1655
+ working_decay?: DecayStrategyName;
1656
+ /** Decay strategy for `episodic` memories (default: `"power_law"`). */
1657
+ episodic_decay?: DecayStrategyName;
1658
+ /** Decay strategy for `semantic` memories (default: `"logarithmic"`). */
1659
+ semantic_decay?: DecayStrategyName;
1660
+ /** Decay strategy for `procedural` memories (default: `"flat"` — no decay). */
1661
+ procedural_decay?: DecayStrategyName;
1662
+ /**
1663
+ * Multiplier for the TTL extension on each recall hit.
1664
+ * Extension = `access_count × sr_factor × sr_base_interval_seconds`.
1665
+ * Set to 0 to disable. Default: 1.0.
1666
+ */
1667
+ spaced_repetition_factor?: number;
1668
+ /** Base interval in seconds for spaced repetition (default: 86 400 = 1 d). */
1669
+ spaced_repetition_base_interval_seconds?: number;
1670
+ }
1585
1671
 
1586
1672
  /**
1587
1673
  * Dakera Client
@@ -2100,12 +2186,27 @@ declare class DakeraClient {
2100
2186
  batchQueryText(namespace: string, queries: string[], options?: BatchTextQueryOptions): Promise<BatchTextQueryResponse>;
2101
2187
  /** Store a memory for an agent */
2102
2188
  storeMemory(agentId: string, request: StoreMemoryRequest): Promise<StoreMemoryResponse>;
2103
- /** Recall memories for an agent */
2189
+ /**
2190
+ * Recall memories for an agent.
2191
+ *
2192
+ * @param agentId - Agent identifier
2193
+ * @param query - Semantic query text
2194
+ * @param options - Optional recall parameters
2195
+ * @param options.top_k - Number of primary results (default: 5)
2196
+ * @param options.memory_type - Filter by memory type
2197
+ * @param options.min_importance - Minimum importance threshold
2198
+ * @param options.include_associated - COG-2: traverse KG depth-1 and include
2199
+ * associatively linked memories in `associated_memories` (default: false)
2200
+ * @param options.associated_memories_cap - COG-2: max associated memories (default: 10, max: 10)
2201
+ * @returns RecallResponse with `memories` and optionally `associated_memories`
2202
+ */
2104
2203
  recall(agentId: string, query: string, options?: {
2105
2204
  top_k?: number;
2106
2205
  memory_type?: string;
2107
2206
  min_importance?: number;
2108
- }): Promise<RecalledMemory[]>;
2207
+ include_associated?: boolean;
2208
+ associated_memories_cap?: number;
2209
+ }): Promise<RecallResponse>;
2109
2210
  /** Get a specific memory */
2110
2211
  getMemory(agentId: string, memoryId: string): Promise<Memory>;
2111
2212
  /** Update an existing memory */
@@ -2305,6 +2406,46 @@ declare class DakeraClient {
2305
2406
  summarize(request: SummarizeRequest): Promise<SummarizeResponse>;
2306
2407
  /** Deduplicate memories */
2307
2408
  deduplicate(request: DeduplicateRequest): Promise<DeduplicateResponse>;
2409
+ /**
2410
+ * Query the memory knowledge graph using a filter DSL (KG-2).
2411
+ *
2412
+ * Calls `GET /v1/knowledge/query`.
2413
+ *
2414
+ * @param agentId - Agent whose graph to query.
2415
+ * @param options - Optional filters: `rootId`, `edgeType`, `minWeight`,
2416
+ * `maxDepth` (default 3), `limit` (default 100, max 1000).
2417
+ */
2418
+ knowledgeQuery(agentId: string, options?: {
2419
+ rootId?: string;
2420
+ edgeType?: string;
2421
+ minWeight?: number;
2422
+ maxDepth?: number;
2423
+ limit?: number;
2424
+ }): Promise<KgQueryResponse>;
2425
+ /**
2426
+ * Find the BFS shortest path between two memory IDs (KG-2).
2427
+ *
2428
+ * Calls `GET /v1/knowledge/path`.
2429
+ *
2430
+ * @param agentId - Agent whose graph to traverse.
2431
+ * @param fromId - Source memory ID.
2432
+ * @param toId - Target memory ID.
2433
+ * @throws {@link NotFoundError} if no path exists between the two memories.
2434
+ */
2435
+ knowledgePath(agentId: string, fromId: string, toId: string): Promise<KgPathResponse>;
2436
+ /**
2437
+ * Export the memory knowledge graph as JSON or GraphML (KG-2).
2438
+ *
2439
+ * Calls `GET /v1/knowledge/export`.
2440
+ *
2441
+ * @param agentId - Agent whose graph to export.
2442
+ * @param format - `"json"` (default) or `"graphml"`.
2443
+ *
2444
+ * @returns `KgExportResponse` for `format="json"`. For `format="graphml"`
2445
+ * the server returns `application/xml` — use the raw fetch API if you
2446
+ * need the GraphML XML string.
2447
+ */
2448
+ knowledgeExport(agentId: string, format?: string): Promise<KgExportResponse>;
2308
2449
  /**
2309
2450
  * Build a cross-agent memory network graph (DASH-A).
2310
2451
  *
@@ -2672,6 +2813,32 @@ declare class DakeraClient {
2672
2813
  * @throws {Error} If `odeUrl` is not configured.
2673
2814
  */
2674
2815
  odeExtractEntities(content: string, agentId: string, memoryId?: string, entityTypes?: string[]): Promise<ExtractEntitiesResponse>;
2816
+ /**
2817
+ * Return the memory lifecycle policy for a namespace (COG-1).
2818
+ *
2819
+ * `GET /v1/namespaces/{namespace}/memory_policy`
2820
+ *
2821
+ * When no explicit policy has been configured the server returns COG-1
2822
+ * defaults: working=4 h, episodic=30 d, semantic=365 d, procedural=730 d;
2823
+ * exponential / power_law / logarithmic / flat decay; SR factor 1.0.
2824
+ *
2825
+ * @param namespace Namespace to inspect.
2826
+ */
2827
+ getMemoryPolicy(namespace: string): Promise<MemoryPolicy>;
2828
+ /**
2829
+ * Set the memory lifecycle policy for a namespace (COG-1).
2830
+ *
2831
+ * `PUT /v1/namespaces/{namespace}/memory_policy`
2832
+ *
2833
+ * The policy is persisted in namespace config and applied immediately to
2834
+ * the decay engine background task. Only populate the fields you want to
2835
+ * override — all fields have safe server-side defaults.
2836
+ *
2837
+ * @param namespace Namespace to configure.
2838
+ * @param policy {@link MemoryPolicy} with the desired settings.
2839
+ * @returns The updated policy as confirmed by the server.
2840
+ */
2841
+ setMemoryPolicy(namespace: string, policy: MemoryPolicy): Promise<MemoryPolicy>;
2675
2842
  }
2676
2843
 
2677
2844
  /**
@@ -2736,4 +2903,4 @@ declare class TimeoutError extends DakeraError {
2736
2903
  constructor(message: string);
2737
2904
  }
2738
2905
 
2739
- export { type AccessPatternHint, type AgentFeedbackSummary, 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, type AuditEvent, type AuditExportResponse, type AuditListResponse, 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 ConsolidationConfig, type ConsolidationLogEntry, type ConsolidationResultSnapshot, type CreateKeyRequest, type CreateNamespaceKeyResponse, 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 ExtractEntitiesRequest, type ExtractEntitiesResponse, type ExtractedEntity, type ExtractionProviderInfo, type ExtractionResult, type FeedbackHealthResponse, type FeedbackHistoryEntry, type FeedbackHistoryResponse, type FeedbackResponse, type FeedbackSignal, 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 ListNamespaceKeysResponse, type ListSessionsOptions, type Memory, type MemoryEntitiesResponse, type MemoryEvent, type MemoryExportResponse, type MemoryFeedbackBodyRequest, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryGraph, type MemoryGraphOptions, type MemoryId, type MemoryImportResponse, type MemoryImportancePatchRequest, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, type NamespaceKeyInfo, type NamespaceKeyUsageResponse, type NamespaceNerConfig, NotFoundError, type OdeEntity, 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 RotateEncryptionKeyRequest, type RotateEncryptionKeyResponse, 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 };
2906
+ export { type AccessPatternHint, type AgentFeedbackSummary, 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, type AuditEvent, type AuditExportResponse, type AuditListResponse, 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 ConsolidationConfig, type ConsolidationLogEntry, type ConsolidationResultSnapshot, type CreateKeyRequest, type CreateNamespaceKeyResponse, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DecayConfigResponse, type DecayConfigUpdateRequest, type DecayConfigUpdateResponse, type DecayStatsResponse, type DecayStrategyName, 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 ExtractEntitiesRequest, type ExtractEntitiesResponse, type ExtractedEntity, type ExtractionProviderInfo, type ExtractionResult, type FeedbackHealthResponse, type FeedbackHistoryEntry, type FeedbackHistoryResponse, type FeedbackResponse, type FeedbackSignal, 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 KgExportResponse, type KgPathResponse, type KgQueryResponse, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LastDecayCycleStats, type LatencyAnalytics, type ListNamespaceKeysResponse, type ListSessionsOptions, type Memory, type MemoryEntitiesResponse, type MemoryEvent, type MemoryExportResponse, type MemoryFeedbackBodyRequest, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryGraph, type MemoryGraphOptions, type MemoryId, type MemoryImportResponse, type MemoryImportancePatchRequest, type MemoryPolicy, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, type NamespaceKeyInfo, type NamespaceKeyUsageResponse, type NamespaceNerConfig, NotFoundError, type OdeEntity, type OpStatus, type OperationProgressEvent, type OpsStats, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type RateLimitHeaders, type ReadConsistency, type RecallRequest, type RecallResponse, type RecalledMemory, type RetryConfig, type RotateEncryptionKeyRequest, type RotateEncryptionKeyResponse, 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
@@ -454,6 +454,13 @@ interface RecalledMemory {
454
454
  /** Creation timestamp */
455
455
  created_at?: string;
456
456
  }
457
+ /** COG-2: Response from the recall endpoint with optional associative memories */
458
+ interface RecallResponse {
459
+ /** Primary recalled memories */
460
+ memories: RecalledMemory[];
461
+ /** COG-2: KG depth-1 associated memories (only present when include_associated was true) */
462
+ associated_memories?: RecalledMemory[];
463
+ }
457
464
  /** Response from storing a memory */
458
465
  interface StoreMemoryResponse {
459
466
  /** Created memory ID */
@@ -1344,6 +1351,43 @@ interface GraphExport {
1344
1351
  /** Total number of edges in the export. */
1345
1352
  edge_count: number;
1346
1353
  }
1354
+ /** Response from `GET /v1/knowledge/query` (KG-2). */
1355
+ interface KgQueryResponse {
1356
+ /** Agent whose graph was queried. */
1357
+ agent_id: string;
1358
+ /** Number of unique memory node IDs referenced by the returned edges. */
1359
+ node_count: number;
1360
+ /** Number of edges returned. */
1361
+ edge_count: number;
1362
+ /** Matching edges, up to `limit`. */
1363
+ edges: GraphEdge[];
1364
+ }
1365
+ /** Response from `GET /v1/knowledge/path` (KG-2). */
1366
+ interface KgPathResponse {
1367
+ /** Agent whose graph was traversed. */
1368
+ agent_id: string;
1369
+ /** Source memory ID. */
1370
+ from_id: string;
1371
+ /** Target memory ID. */
1372
+ to_id: string;
1373
+ /** Number of edges in the shortest path (0 if source === target). */
1374
+ hop_count: number;
1375
+ /** Ordered list of memory IDs from source to target (inclusive). */
1376
+ path: string[];
1377
+ }
1378
+ /** Response from `GET /v1/knowledge/export` with `format=json` (KG-2). */
1379
+ interface KgExportResponse {
1380
+ /** Agent whose graph was exported. */
1381
+ agent_id: string;
1382
+ /** Export format used (`"json"` when this interface is returned). */
1383
+ format: string;
1384
+ /** Total number of unique memory node IDs in the export. */
1385
+ node_count: number;
1386
+ /** Total number of edges in the export. */
1387
+ edge_count: number;
1388
+ /** All graph edges for the agent. */
1389
+ edges: GraphEdge[];
1390
+ }
1347
1391
  /** Options for `client.memories.graph()`. */
1348
1392
  interface MemoryGraphOptions {
1349
1393
  /** Maximum traversal depth (default: 1, max: 3). */
@@ -1582,6 +1626,48 @@ interface ExtractEntitiesResponse {
1582
1626
  /** Wall-clock time taken by the ODE sidecar in milliseconds. */
1583
1627
  processing_time_ms: number;
1584
1628
  }
1629
+ /**
1630
+ * Decay strategy name. The COG-1 variants (power_law, logarithmic, flat) are
1631
+ * only valid inside MemoryPolicy per-type fields; the global DecayConfig
1632
+ * endpoint still accepts only "exponential" | "linear" | "step".
1633
+ */
1634
+ type DecayStrategyName = 'exponential' | 'linear' | 'step' | 'power_law' | 'logarithmic' | 'flat';
1635
+ /**
1636
+ * Per-namespace memory lifecycle policy (COG-1).
1637
+ *
1638
+ * Controls type-specific TTLs, decay curves, and spaced repetition behaviour.
1639
+ * All fields are optional and have sensible server-side defaults; only set the
1640
+ * ones you want to override.
1641
+ *
1642
+ * Used by {@link DakeraClient.getMemoryPolicy} and
1643
+ * {@link DakeraClient.setMemoryPolicy}.
1644
+ */
1645
+ interface MemoryPolicy {
1646
+ /** Default TTL for `working` memories in seconds (default: 14 400 = 4 h). */
1647
+ working_ttl_seconds?: number;
1648
+ /** Default TTL for `episodic` memories in seconds (default: 2 592 000 = 30 d). */
1649
+ episodic_ttl_seconds?: number;
1650
+ /** Default TTL for `semantic` memories in seconds (default: 31 536 000 = 365 d). */
1651
+ semantic_ttl_seconds?: number;
1652
+ /** Default TTL for `procedural` memories in seconds (default: 63 072 000 = 730 d). */
1653
+ procedural_ttl_seconds?: number;
1654
+ /** Decay strategy for `working` memories (default: `"exponential"`). */
1655
+ working_decay?: DecayStrategyName;
1656
+ /** Decay strategy for `episodic` memories (default: `"power_law"`). */
1657
+ episodic_decay?: DecayStrategyName;
1658
+ /** Decay strategy for `semantic` memories (default: `"logarithmic"`). */
1659
+ semantic_decay?: DecayStrategyName;
1660
+ /** Decay strategy for `procedural` memories (default: `"flat"` — no decay). */
1661
+ procedural_decay?: DecayStrategyName;
1662
+ /**
1663
+ * Multiplier for the TTL extension on each recall hit.
1664
+ * Extension = `access_count × sr_factor × sr_base_interval_seconds`.
1665
+ * Set to 0 to disable. Default: 1.0.
1666
+ */
1667
+ spaced_repetition_factor?: number;
1668
+ /** Base interval in seconds for spaced repetition (default: 86 400 = 1 d). */
1669
+ spaced_repetition_base_interval_seconds?: number;
1670
+ }
1585
1671
 
1586
1672
  /**
1587
1673
  * Dakera Client
@@ -2100,12 +2186,27 @@ declare class DakeraClient {
2100
2186
  batchQueryText(namespace: string, queries: string[], options?: BatchTextQueryOptions): Promise<BatchTextQueryResponse>;
2101
2187
  /** Store a memory for an agent */
2102
2188
  storeMemory(agentId: string, request: StoreMemoryRequest): Promise<StoreMemoryResponse>;
2103
- /** Recall memories for an agent */
2189
+ /**
2190
+ * Recall memories for an agent.
2191
+ *
2192
+ * @param agentId - Agent identifier
2193
+ * @param query - Semantic query text
2194
+ * @param options - Optional recall parameters
2195
+ * @param options.top_k - Number of primary results (default: 5)
2196
+ * @param options.memory_type - Filter by memory type
2197
+ * @param options.min_importance - Minimum importance threshold
2198
+ * @param options.include_associated - COG-2: traverse KG depth-1 and include
2199
+ * associatively linked memories in `associated_memories` (default: false)
2200
+ * @param options.associated_memories_cap - COG-2: max associated memories (default: 10, max: 10)
2201
+ * @returns RecallResponse with `memories` and optionally `associated_memories`
2202
+ */
2104
2203
  recall(agentId: string, query: string, options?: {
2105
2204
  top_k?: number;
2106
2205
  memory_type?: string;
2107
2206
  min_importance?: number;
2108
- }): Promise<RecalledMemory[]>;
2207
+ include_associated?: boolean;
2208
+ associated_memories_cap?: number;
2209
+ }): Promise<RecallResponse>;
2109
2210
  /** Get a specific memory */
2110
2211
  getMemory(agentId: string, memoryId: string): Promise<Memory>;
2111
2212
  /** Update an existing memory */
@@ -2305,6 +2406,46 @@ declare class DakeraClient {
2305
2406
  summarize(request: SummarizeRequest): Promise<SummarizeResponse>;
2306
2407
  /** Deduplicate memories */
2307
2408
  deduplicate(request: DeduplicateRequest): Promise<DeduplicateResponse>;
2409
+ /**
2410
+ * Query the memory knowledge graph using a filter DSL (KG-2).
2411
+ *
2412
+ * Calls `GET /v1/knowledge/query`.
2413
+ *
2414
+ * @param agentId - Agent whose graph to query.
2415
+ * @param options - Optional filters: `rootId`, `edgeType`, `minWeight`,
2416
+ * `maxDepth` (default 3), `limit` (default 100, max 1000).
2417
+ */
2418
+ knowledgeQuery(agentId: string, options?: {
2419
+ rootId?: string;
2420
+ edgeType?: string;
2421
+ minWeight?: number;
2422
+ maxDepth?: number;
2423
+ limit?: number;
2424
+ }): Promise<KgQueryResponse>;
2425
+ /**
2426
+ * Find the BFS shortest path between two memory IDs (KG-2).
2427
+ *
2428
+ * Calls `GET /v1/knowledge/path`.
2429
+ *
2430
+ * @param agentId - Agent whose graph to traverse.
2431
+ * @param fromId - Source memory ID.
2432
+ * @param toId - Target memory ID.
2433
+ * @throws {@link NotFoundError} if no path exists between the two memories.
2434
+ */
2435
+ knowledgePath(agentId: string, fromId: string, toId: string): Promise<KgPathResponse>;
2436
+ /**
2437
+ * Export the memory knowledge graph as JSON or GraphML (KG-2).
2438
+ *
2439
+ * Calls `GET /v1/knowledge/export`.
2440
+ *
2441
+ * @param agentId - Agent whose graph to export.
2442
+ * @param format - `"json"` (default) or `"graphml"`.
2443
+ *
2444
+ * @returns `KgExportResponse` for `format="json"`. For `format="graphml"`
2445
+ * the server returns `application/xml` — use the raw fetch API if you
2446
+ * need the GraphML XML string.
2447
+ */
2448
+ knowledgeExport(agentId: string, format?: string): Promise<KgExportResponse>;
2308
2449
  /**
2309
2450
  * Build a cross-agent memory network graph (DASH-A).
2310
2451
  *
@@ -2672,6 +2813,32 @@ declare class DakeraClient {
2672
2813
  * @throws {Error} If `odeUrl` is not configured.
2673
2814
  */
2674
2815
  odeExtractEntities(content: string, agentId: string, memoryId?: string, entityTypes?: string[]): Promise<ExtractEntitiesResponse>;
2816
+ /**
2817
+ * Return the memory lifecycle policy for a namespace (COG-1).
2818
+ *
2819
+ * `GET /v1/namespaces/{namespace}/memory_policy`
2820
+ *
2821
+ * When no explicit policy has been configured the server returns COG-1
2822
+ * defaults: working=4 h, episodic=30 d, semantic=365 d, procedural=730 d;
2823
+ * exponential / power_law / logarithmic / flat decay; SR factor 1.0.
2824
+ *
2825
+ * @param namespace Namespace to inspect.
2826
+ */
2827
+ getMemoryPolicy(namespace: string): Promise<MemoryPolicy>;
2828
+ /**
2829
+ * Set the memory lifecycle policy for a namespace (COG-1).
2830
+ *
2831
+ * `PUT /v1/namespaces/{namespace}/memory_policy`
2832
+ *
2833
+ * The policy is persisted in namespace config and applied immediately to
2834
+ * the decay engine background task. Only populate the fields you want to
2835
+ * override — all fields have safe server-side defaults.
2836
+ *
2837
+ * @param namespace Namespace to configure.
2838
+ * @param policy {@link MemoryPolicy} with the desired settings.
2839
+ * @returns The updated policy as confirmed by the server.
2840
+ */
2841
+ setMemoryPolicy(namespace: string, policy: MemoryPolicy): Promise<MemoryPolicy>;
2675
2842
  }
2676
2843
 
2677
2844
  /**
@@ -2736,4 +2903,4 @@ declare class TimeoutError extends DakeraError {
2736
2903
  constructor(message: string);
2737
2904
  }
2738
2905
 
2739
- export { type AccessPatternHint, type AgentFeedbackSummary, 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, type AuditEvent, type AuditExportResponse, type AuditListResponse, 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 ConsolidationConfig, type ConsolidationLogEntry, type ConsolidationResultSnapshot, type CreateKeyRequest, type CreateNamespaceKeyResponse, 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 ExtractEntitiesRequest, type ExtractEntitiesResponse, type ExtractedEntity, type ExtractionProviderInfo, type ExtractionResult, type FeedbackHealthResponse, type FeedbackHistoryEntry, type FeedbackHistoryResponse, type FeedbackResponse, type FeedbackSignal, 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 ListNamespaceKeysResponse, type ListSessionsOptions, type Memory, type MemoryEntitiesResponse, type MemoryEvent, type MemoryExportResponse, type MemoryFeedbackBodyRequest, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryGraph, type MemoryGraphOptions, type MemoryId, type MemoryImportResponse, type MemoryImportancePatchRequest, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, type NamespaceKeyInfo, type NamespaceKeyUsageResponse, type NamespaceNerConfig, NotFoundError, type OdeEntity, 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 RotateEncryptionKeyRequest, type RotateEncryptionKeyResponse, 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 };
2906
+ export { type AccessPatternHint, type AgentFeedbackSummary, 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, type AuditEvent, type AuditExportResponse, type AuditListResponse, 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 ConsolidationConfig, type ConsolidationLogEntry, type ConsolidationResultSnapshot, type CreateKeyRequest, type CreateNamespaceKeyResponse, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DecayConfigResponse, type DecayConfigUpdateRequest, type DecayConfigUpdateResponse, type DecayStatsResponse, type DecayStrategyName, 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 ExtractEntitiesRequest, type ExtractEntitiesResponse, type ExtractedEntity, type ExtractionProviderInfo, type ExtractionResult, type FeedbackHealthResponse, type FeedbackHistoryEntry, type FeedbackHistoryResponse, type FeedbackResponse, type FeedbackSignal, 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 KgExportResponse, type KgPathResponse, type KgQueryResponse, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LastDecayCycleStats, type LatencyAnalytics, type ListNamespaceKeysResponse, type ListSessionsOptions, type Memory, type MemoryEntitiesResponse, type MemoryEvent, type MemoryExportResponse, type MemoryFeedbackBodyRequest, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryGraph, type MemoryGraphOptions, type MemoryId, type MemoryImportResponse, type MemoryImportancePatchRequest, type MemoryPolicy, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, type NamespaceKeyInfo, type NamespaceKeyUsageResponse, type NamespaceNerConfig, NotFoundError, type OdeEntity, type OpStatus, type OperationProgressEvent, type OpsStats, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type RateLimitHeaders, type ReadConsistency, type RecallRequest, type RecallResponse, type RecalledMemory, type RetryConfig, type RotateEncryptionKeyRequest, type RotateEncryptionKeyResponse, 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
@@ -1066,11 +1066,28 @@ var DakeraClient = class {
1066
1066
  async storeMemory(agentId2, request) {
1067
1067
  return this.request("POST", `/v1/agents/${agentId2}/memories`, request);
1068
1068
  }
1069
- /** Recall memories for an agent */
1069
+ /**
1070
+ * Recall memories for an agent.
1071
+ *
1072
+ * @param agentId - Agent identifier
1073
+ * @param query - Semantic query text
1074
+ * @param options - Optional recall parameters
1075
+ * @param options.top_k - Number of primary results (default: 5)
1076
+ * @param options.memory_type - Filter by memory type
1077
+ * @param options.min_importance - Minimum importance threshold
1078
+ * @param options.include_associated - COG-2: traverse KG depth-1 and include
1079
+ * associatively linked memories in `associated_memories` (default: false)
1080
+ * @param options.associated_memories_cap - COG-2: max associated memories (default: 10, max: 10)
1081
+ * @returns RecallResponse with `memories` and optionally `associated_memories`
1082
+ */
1070
1083
  async recall(agentId2, query, options) {
1071
- const body = { query, ...options };
1072
- const result = await this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
1073
- return result.memories ?? result;
1084
+ const body = { query };
1085
+ if (options?.top_k !== void 0) body["top_k"] = options.top_k;
1086
+ if (options?.memory_type !== void 0) body["memory_type"] = options.memory_type;
1087
+ if (options?.min_importance !== void 0) body["min_importance"] = options.min_importance;
1088
+ if (options?.include_associated) body["include_associated"] = true;
1089
+ if (options?.associated_memories_cap !== void 0) body["associated_memories_cap"] = options.associated_memories_cap;
1090
+ return this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
1074
1091
  }
1075
1092
  /** Get a specific memory */
1076
1093
  async getMemory(agentId2, memoryId2) {
@@ -1374,6 +1391,61 @@ var DakeraClient = class {
1374
1391
  async deduplicate(request) {
1375
1392
  return this.request("POST", "/v1/knowledge/deduplicate", request);
1376
1393
  }
1394
+ // -------------------------------------------------------------------------
1395
+ // KG-2: Graph Query & Export
1396
+ // -------------------------------------------------------------------------
1397
+ /**
1398
+ * Query the memory knowledge graph using a filter DSL (KG-2).
1399
+ *
1400
+ * Calls `GET /v1/knowledge/query`.
1401
+ *
1402
+ * @param agentId - Agent whose graph to query.
1403
+ * @param options - Optional filters: `rootId`, `edgeType`, `minWeight`,
1404
+ * `maxDepth` (default 3), `limit` (default 100, max 1000).
1405
+ */
1406
+ async knowledgeQuery(agentId2, options) {
1407
+ const params = new URLSearchParams({ agent_id: agentId2 });
1408
+ if (options?.rootId != null) params.set("root_id", options.rootId);
1409
+ if (options?.edgeType != null) params.set("edge_type", options.edgeType);
1410
+ if (options?.minWeight != null) params.set("min_weight", String(options.minWeight));
1411
+ if (options?.maxDepth != null) params.set("max_depth", String(options.maxDepth));
1412
+ if (options?.limit != null) params.set("limit", String(options.limit));
1413
+ return this.request("GET", `/v1/knowledge/query?${params}`);
1414
+ }
1415
+ /**
1416
+ * Find the BFS shortest path between two memory IDs (KG-2).
1417
+ *
1418
+ * Calls `GET /v1/knowledge/path`.
1419
+ *
1420
+ * @param agentId - Agent whose graph to traverse.
1421
+ * @param fromId - Source memory ID.
1422
+ * @param toId - Target memory ID.
1423
+ * @throws {@link NotFoundError} if no path exists between the two memories.
1424
+ */
1425
+ async knowledgePath(agentId2, fromId, toId) {
1426
+ const params = new URLSearchParams({
1427
+ agent_id: agentId2,
1428
+ from: fromId,
1429
+ to: toId
1430
+ });
1431
+ return this.request("GET", `/v1/knowledge/path?${params}`);
1432
+ }
1433
+ /**
1434
+ * Export the memory knowledge graph as JSON or GraphML (KG-2).
1435
+ *
1436
+ * Calls `GET /v1/knowledge/export`.
1437
+ *
1438
+ * @param agentId - Agent whose graph to export.
1439
+ * @param format - `"json"` (default) or `"graphml"`.
1440
+ *
1441
+ * @returns `KgExportResponse` for `format="json"`. For `format="graphml"`
1442
+ * the server returns `application/xml` — use the raw fetch API if you
1443
+ * need the GraphML XML string.
1444
+ */
1445
+ async knowledgeExport(agentId2, format = "json") {
1446
+ const params = new URLSearchParams({ agent_id: agentId2, format });
1447
+ return this.request("GET", `/v1/knowledge/export?${params}`);
1448
+ }
1377
1449
  /**
1378
1450
  * Build a cross-agent memory network graph (DASH-A).
1379
1451
  *
@@ -2057,6 +2129,46 @@ var DakeraClient = class {
2057
2129
  clearTimeout(timer);
2058
2130
  }
2059
2131
  }
2132
+ // =========================================================================
2133
+ // COG-1: Per-namespace Memory Lifecycle Policy
2134
+ // =========================================================================
2135
+ /**
2136
+ * Return the memory lifecycle policy for a namespace (COG-1).
2137
+ *
2138
+ * `GET /v1/namespaces/{namespace}/memory_policy`
2139
+ *
2140
+ * When no explicit policy has been configured the server returns COG-1
2141
+ * defaults: working=4 h, episodic=30 d, semantic=365 d, procedural=730 d;
2142
+ * exponential / power_law / logarithmic / flat decay; SR factor 1.0.
2143
+ *
2144
+ * @param namespace Namespace to inspect.
2145
+ */
2146
+ async getMemoryPolicy(namespace) {
2147
+ return this.request(
2148
+ "GET",
2149
+ `/v1/namespaces/${encodeURIComponent(namespace)}/memory_policy`
2150
+ );
2151
+ }
2152
+ /**
2153
+ * Set the memory lifecycle policy for a namespace (COG-1).
2154
+ *
2155
+ * `PUT /v1/namespaces/{namespace}/memory_policy`
2156
+ *
2157
+ * The policy is persisted in namespace config and applied immediately to
2158
+ * the decay engine background task. Only populate the fields you want to
2159
+ * override — all fields have safe server-side defaults.
2160
+ *
2161
+ * @param namespace Namespace to configure.
2162
+ * @param policy {@link MemoryPolicy} with the desired settings.
2163
+ * @returns The updated policy as confirmed by the server.
2164
+ */
2165
+ async setMemoryPolicy(namespace, policy) {
2166
+ return this.request(
2167
+ "PUT",
2168
+ `/v1/namespaces/${encodeURIComponent(namespace)}/memory_policy`,
2169
+ policy
2170
+ );
2171
+ }
2060
2172
  };
2061
2173
 
2062
2174
  // src/types.ts
package/dist/index.mjs CHANGED
@@ -1026,11 +1026,28 @@ var DakeraClient = class {
1026
1026
  async storeMemory(agentId2, request) {
1027
1027
  return this.request("POST", `/v1/agents/${agentId2}/memories`, request);
1028
1028
  }
1029
- /** Recall memories for an agent */
1029
+ /**
1030
+ * Recall memories for an agent.
1031
+ *
1032
+ * @param agentId - Agent identifier
1033
+ * @param query - Semantic query text
1034
+ * @param options - Optional recall parameters
1035
+ * @param options.top_k - Number of primary results (default: 5)
1036
+ * @param options.memory_type - Filter by memory type
1037
+ * @param options.min_importance - Minimum importance threshold
1038
+ * @param options.include_associated - COG-2: traverse KG depth-1 and include
1039
+ * associatively linked memories in `associated_memories` (default: false)
1040
+ * @param options.associated_memories_cap - COG-2: max associated memories (default: 10, max: 10)
1041
+ * @returns RecallResponse with `memories` and optionally `associated_memories`
1042
+ */
1030
1043
  async recall(agentId2, query, options) {
1031
- const body = { query, ...options };
1032
- const result = await this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
1033
- return result.memories ?? result;
1044
+ const body = { query };
1045
+ if (options?.top_k !== void 0) body["top_k"] = options.top_k;
1046
+ if (options?.memory_type !== void 0) body["memory_type"] = options.memory_type;
1047
+ if (options?.min_importance !== void 0) body["min_importance"] = options.min_importance;
1048
+ if (options?.include_associated) body["include_associated"] = true;
1049
+ if (options?.associated_memories_cap !== void 0) body["associated_memories_cap"] = options.associated_memories_cap;
1050
+ return this.request("POST", `/v1/agents/${agentId2}/memories/recall`, body);
1034
1051
  }
1035
1052
  /** Get a specific memory */
1036
1053
  async getMemory(agentId2, memoryId2) {
@@ -1334,6 +1351,61 @@ var DakeraClient = class {
1334
1351
  async deduplicate(request) {
1335
1352
  return this.request("POST", "/v1/knowledge/deduplicate", request);
1336
1353
  }
1354
+ // -------------------------------------------------------------------------
1355
+ // KG-2: Graph Query & Export
1356
+ // -------------------------------------------------------------------------
1357
+ /**
1358
+ * Query the memory knowledge graph using a filter DSL (KG-2).
1359
+ *
1360
+ * Calls `GET /v1/knowledge/query`.
1361
+ *
1362
+ * @param agentId - Agent whose graph to query.
1363
+ * @param options - Optional filters: `rootId`, `edgeType`, `minWeight`,
1364
+ * `maxDepth` (default 3), `limit` (default 100, max 1000).
1365
+ */
1366
+ async knowledgeQuery(agentId2, options) {
1367
+ const params = new URLSearchParams({ agent_id: agentId2 });
1368
+ if (options?.rootId != null) params.set("root_id", options.rootId);
1369
+ if (options?.edgeType != null) params.set("edge_type", options.edgeType);
1370
+ if (options?.minWeight != null) params.set("min_weight", String(options.minWeight));
1371
+ if (options?.maxDepth != null) params.set("max_depth", String(options.maxDepth));
1372
+ if (options?.limit != null) params.set("limit", String(options.limit));
1373
+ return this.request("GET", `/v1/knowledge/query?${params}`);
1374
+ }
1375
+ /**
1376
+ * Find the BFS shortest path between two memory IDs (KG-2).
1377
+ *
1378
+ * Calls `GET /v1/knowledge/path`.
1379
+ *
1380
+ * @param agentId - Agent whose graph to traverse.
1381
+ * @param fromId - Source memory ID.
1382
+ * @param toId - Target memory ID.
1383
+ * @throws {@link NotFoundError} if no path exists between the two memories.
1384
+ */
1385
+ async knowledgePath(agentId2, fromId, toId) {
1386
+ const params = new URLSearchParams({
1387
+ agent_id: agentId2,
1388
+ from: fromId,
1389
+ to: toId
1390
+ });
1391
+ return this.request("GET", `/v1/knowledge/path?${params}`);
1392
+ }
1393
+ /**
1394
+ * Export the memory knowledge graph as JSON or GraphML (KG-2).
1395
+ *
1396
+ * Calls `GET /v1/knowledge/export`.
1397
+ *
1398
+ * @param agentId - Agent whose graph to export.
1399
+ * @param format - `"json"` (default) or `"graphml"`.
1400
+ *
1401
+ * @returns `KgExportResponse` for `format="json"`. For `format="graphml"`
1402
+ * the server returns `application/xml` — use the raw fetch API if you
1403
+ * need the GraphML XML string.
1404
+ */
1405
+ async knowledgeExport(agentId2, format = "json") {
1406
+ const params = new URLSearchParams({ agent_id: agentId2, format });
1407
+ return this.request("GET", `/v1/knowledge/export?${params}`);
1408
+ }
1337
1409
  /**
1338
1410
  * Build a cross-agent memory network graph (DASH-A).
1339
1411
  *
@@ -2017,6 +2089,46 @@ var DakeraClient = class {
2017
2089
  clearTimeout(timer);
2018
2090
  }
2019
2091
  }
2092
+ // =========================================================================
2093
+ // COG-1: Per-namespace Memory Lifecycle Policy
2094
+ // =========================================================================
2095
+ /**
2096
+ * Return the memory lifecycle policy for a namespace (COG-1).
2097
+ *
2098
+ * `GET /v1/namespaces/{namespace}/memory_policy`
2099
+ *
2100
+ * When no explicit policy has been configured the server returns COG-1
2101
+ * defaults: working=4 h, episodic=30 d, semantic=365 d, procedural=730 d;
2102
+ * exponential / power_law / logarithmic / flat decay; SR factor 1.0.
2103
+ *
2104
+ * @param namespace Namespace to inspect.
2105
+ */
2106
+ async getMemoryPolicy(namespace) {
2107
+ return this.request(
2108
+ "GET",
2109
+ `/v1/namespaces/${encodeURIComponent(namespace)}/memory_policy`
2110
+ );
2111
+ }
2112
+ /**
2113
+ * Set the memory lifecycle policy for a namespace (COG-1).
2114
+ *
2115
+ * `PUT /v1/namespaces/{namespace}/memory_policy`
2116
+ *
2117
+ * The policy is persisted in namespace config and applied immediately to
2118
+ * the decay engine background task. Only populate the fields you want to
2119
+ * override — all fields have safe server-side defaults.
2120
+ *
2121
+ * @param namespace Namespace to configure.
2122
+ * @param policy {@link MemoryPolicy} with the desired settings.
2123
+ * @returns The updated policy as confirmed by the server.
2124
+ */
2125
+ async setMemoryPolicy(namespace, policy) {
2126
+ return this.request(
2127
+ "PUT",
2128
+ `/v1/namespaces/${encodeURIComponent(namespace)}/memory_policy`,
2129
+ policy
2130
+ );
2131
+ }
2020
2132
  };
2021
2133
 
2022
2134
  // src/types.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakera-ai/dakera",
3
- "version": "0.9.6",
3
+ "version": "0.9.8",
4
4
  "description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",