@dakera-ai/dakera 0.4.0 → 0.5.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
@@ -878,6 +878,83 @@ interface StreamLaggedEvent {
878
878
  }
879
879
  /** Union of all Dakera SSE event types. */
880
880
  type DakeraEvent = NamespaceCreatedEvent | NamespaceDeletedEvent | OperationProgressEvent | JobProgressEvent | VectorsMutatedEvent | StreamLaggedEvent;
881
+ /**
882
+ * A memory lifecycle event emitted on the agent memory SSE stream.
883
+ *
884
+ * event_type values:
885
+ * stored | recalled | forgotten | consolidated |
886
+ * importance_updated | session_started | session_ended
887
+ */
888
+ interface MemoryEvent {
889
+ /** Memory lifecycle event type */
890
+ event_type: string;
891
+ /** Agent that owns the memory */
892
+ agent_id: string;
893
+ /** Unix milliseconds */
894
+ timestamp: number;
895
+ /** Memory ID (present for most event types) */
896
+ memory_id?: string;
897
+ /** Memory content snapshot */
898
+ content?: string;
899
+ /** Importance score at the time of the event */
900
+ importance?: number;
901
+ /** Tags associated with the memory */
902
+ tags?: string[];
903
+ /** Session ID (present for session_started / session_ended events) */
904
+ session_id?: string;
905
+ }
906
+ /** Summary info for one agent in the cross-agent network */
907
+ interface AgentNetworkInfo {
908
+ agent_id: string;
909
+ memory_count: number;
910
+ avg_importance: number;
911
+ }
912
+ /** A node in the cross-agent memory network graph */
913
+ interface AgentNetworkNode {
914
+ id: string;
915
+ agent_id: string;
916
+ content: string;
917
+ importance: number;
918
+ tags: string[];
919
+ memory_type: string;
920
+ /** Unix milliseconds */
921
+ created_at: number;
922
+ }
923
+ /** A cross-agent similarity edge */
924
+ interface AgentNetworkEdge {
925
+ source: string;
926
+ target: string;
927
+ source_agent: string;
928
+ target_agent: string;
929
+ similarity: number;
930
+ }
931
+ /** Aggregate statistics for the cross-agent network */
932
+ interface AgentNetworkStats {
933
+ total_agents: number;
934
+ total_nodes: number;
935
+ total_cross_edges: number;
936
+ density: number;
937
+ }
938
+ /** Response from the cross-agent network endpoint */
939
+ interface CrossAgentNetworkResponse {
940
+ agents: AgentNetworkInfo[];
941
+ nodes: AgentNetworkNode[];
942
+ edges: AgentNetworkEdge[];
943
+ stats: AgentNetworkStats;
944
+ }
945
+ /** Request body for POST /v1/knowledge/network/cross-agent */
946
+ interface CrossAgentNetworkRequest {
947
+ /** Agent IDs to include — undefined means all agents */
948
+ agent_ids?: string[];
949
+ /** Minimum similarity threshold for edges (default 0.3) */
950
+ min_similarity?: number;
951
+ /** Maximum nodes to include per agent (default 50) */
952
+ max_nodes_per_agent?: number;
953
+ /** Minimum importance for a node to be included (default 0.0) */
954
+ min_importance?: number;
955
+ /** Maximum cross-agent edges to return (default 200) */
956
+ max_cross_edges?: number;
957
+ }
881
958
  /** Cluster status response */
882
959
  interface ClusterStatus {
883
960
  status: string;
@@ -1490,6 +1567,22 @@ declare class DakeraClient {
1490
1567
  summarize(request: SummarizeRequest): Promise<SummarizeResponse>;
1491
1568
  /** Deduplicate memories */
1492
1569
  deduplicate(request: DeduplicateRequest): Promise<DeduplicateResponse>;
1570
+ /**
1571
+ * Build a cross-agent memory network graph (DASH-A).
1572
+ *
1573
+ * Calls `POST /v1/knowledge/network/cross-agent` and returns a graph
1574
+ * containing every agent's nodes and the cross-agent similarity edges that
1575
+ * connect them.
1576
+ *
1577
+ * Requires an Admin-scoped API key.
1578
+ *
1579
+ * @example
1580
+ * ```ts
1581
+ * const network = await client.crossAgentNetwork({ min_similarity: 0.5 });
1582
+ * console.log(`${network.stats.total_cross_edges} cross-agent edges`);
1583
+ * ```
1584
+ */
1585
+ crossAgentNetwork(req?: CrossAgentNetworkRequest): Promise<CrossAgentNetworkResponse>;
1493
1586
  /** Get analytics overview */
1494
1587
  analyticsOverview(options?: AnalyticsOptions): Promise<AnalyticsOverview>;
1495
1588
  /** Get latency analytics */
@@ -1596,10 +1689,39 @@ declare class DakeraClient {
1596
1689
  * ```
1597
1690
  */
1598
1691
  streamGlobalEvents(): AsyncGenerator<DakeraEvent>;
1692
+ /**
1693
+ * Stream memory lifecycle events for all agents (DASH-B).
1694
+ *
1695
+ * Opens a long-lived connection to `GET /v1/events/stream` and yields
1696
+ * {@link MemoryEvent} objects as they arrive. Each SSE frame uses the
1697
+ * `event:` field for the event_type and a JSON `data:` payload.
1698
+ *
1699
+ * Requires a Read-scoped API key.
1700
+ *
1701
+ * @example
1702
+ * ```ts
1703
+ * for await (const ev of client.streamMemoryEvents()) {
1704
+ * if (ev.event_type === 'stored') {
1705
+ * console.log(`Memory stored for agent ${ev.agent_id}: ${ev.content}`);
1706
+ * }
1707
+ * }
1708
+ * ```
1709
+ */
1710
+ streamMemoryEvents(): AsyncGenerator<MemoryEvent>;
1599
1711
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1600
1712
  private _streamSse;
1601
1713
  /** Parse a single SSE event block into a {@link DakeraEvent}. */
1602
1714
  private _parseSseBlock;
1715
+ /**
1716
+ * Low-level SSE streaming helper for the memory event stream.
1717
+ *
1718
+ * The memory event stream sets the SSE `event:` field to the event_type
1719
+ * and the `data:` field to the JSON payload. This helper merges the two
1720
+ * so callers receive a fully-populated {@link MemoryEvent}.
1721
+ */
1722
+ private _streamSseMemory;
1723
+ /** Parse a single SSE event block into a {@link MemoryEvent}. */
1724
+ private _parseSseMemoryBlock;
1603
1725
  }
1604
1726
 
1605
1727
  /**
@@ -1641,4 +1763,4 @@ declare class TimeoutError extends DakeraError {
1641
1763
  constructor(message: string);
1642
1764
  }
1643
1765
 
1644
- export { type AccessPatternHint, type AgentId, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, DakeraClient, DakeraError, type DakeraEvent, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, NotFoundError, type OpStatus, type OperationProgressEvent, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type 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 };
1766
+ 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, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, 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 QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type 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
@@ -878,6 +878,83 @@ interface StreamLaggedEvent {
878
878
  }
879
879
  /** Union of all Dakera SSE event types. */
880
880
  type DakeraEvent = NamespaceCreatedEvent | NamespaceDeletedEvent | OperationProgressEvent | JobProgressEvent | VectorsMutatedEvent | StreamLaggedEvent;
881
+ /**
882
+ * A memory lifecycle event emitted on the agent memory SSE stream.
883
+ *
884
+ * event_type values:
885
+ * stored | recalled | forgotten | consolidated |
886
+ * importance_updated | session_started | session_ended
887
+ */
888
+ interface MemoryEvent {
889
+ /** Memory lifecycle event type */
890
+ event_type: string;
891
+ /** Agent that owns the memory */
892
+ agent_id: string;
893
+ /** Unix milliseconds */
894
+ timestamp: number;
895
+ /** Memory ID (present for most event types) */
896
+ memory_id?: string;
897
+ /** Memory content snapshot */
898
+ content?: string;
899
+ /** Importance score at the time of the event */
900
+ importance?: number;
901
+ /** Tags associated with the memory */
902
+ tags?: string[];
903
+ /** Session ID (present for session_started / session_ended events) */
904
+ session_id?: string;
905
+ }
906
+ /** Summary info for one agent in the cross-agent network */
907
+ interface AgentNetworkInfo {
908
+ agent_id: string;
909
+ memory_count: number;
910
+ avg_importance: number;
911
+ }
912
+ /** A node in the cross-agent memory network graph */
913
+ interface AgentNetworkNode {
914
+ id: string;
915
+ agent_id: string;
916
+ content: string;
917
+ importance: number;
918
+ tags: string[];
919
+ memory_type: string;
920
+ /** Unix milliseconds */
921
+ created_at: number;
922
+ }
923
+ /** A cross-agent similarity edge */
924
+ interface AgentNetworkEdge {
925
+ source: string;
926
+ target: string;
927
+ source_agent: string;
928
+ target_agent: string;
929
+ similarity: number;
930
+ }
931
+ /** Aggregate statistics for the cross-agent network */
932
+ interface AgentNetworkStats {
933
+ total_agents: number;
934
+ total_nodes: number;
935
+ total_cross_edges: number;
936
+ density: number;
937
+ }
938
+ /** Response from the cross-agent network endpoint */
939
+ interface CrossAgentNetworkResponse {
940
+ agents: AgentNetworkInfo[];
941
+ nodes: AgentNetworkNode[];
942
+ edges: AgentNetworkEdge[];
943
+ stats: AgentNetworkStats;
944
+ }
945
+ /** Request body for POST /v1/knowledge/network/cross-agent */
946
+ interface CrossAgentNetworkRequest {
947
+ /** Agent IDs to include — undefined means all agents */
948
+ agent_ids?: string[];
949
+ /** Minimum similarity threshold for edges (default 0.3) */
950
+ min_similarity?: number;
951
+ /** Maximum nodes to include per agent (default 50) */
952
+ max_nodes_per_agent?: number;
953
+ /** Minimum importance for a node to be included (default 0.0) */
954
+ min_importance?: number;
955
+ /** Maximum cross-agent edges to return (default 200) */
956
+ max_cross_edges?: number;
957
+ }
881
958
  /** Cluster status response */
882
959
  interface ClusterStatus {
883
960
  status: string;
@@ -1490,6 +1567,22 @@ declare class DakeraClient {
1490
1567
  summarize(request: SummarizeRequest): Promise<SummarizeResponse>;
1491
1568
  /** Deduplicate memories */
1492
1569
  deduplicate(request: DeduplicateRequest): Promise<DeduplicateResponse>;
1570
+ /**
1571
+ * Build a cross-agent memory network graph (DASH-A).
1572
+ *
1573
+ * Calls `POST /v1/knowledge/network/cross-agent` and returns a graph
1574
+ * containing every agent's nodes and the cross-agent similarity edges that
1575
+ * connect them.
1576
+ *
1577
+ * Requires an Admin-scoped API key.
1578
+ *
1579
+ * @example
1580
+ * ```ts
1581
+ * const network = await client.crossAgentNetwork({ min_similarity: 0.5 });
1582
+ * console.log(`${network.stats.total_cross_edges} cross-agent edges`);
1583
+ * ```
1584
+ */
1585
+ crossAgentNetwork(req?: CrossAgentNetworkRequest): Promise<CrossAgentNetworkResponse>;
1493
1586
  /** Get analytics overview */
1494
1587
  analyticsOverview(options?: AnalyticsOptions): Promise<AnalyticsOverview>;
1495
1588
  /** Get latency analytics */
@@ -1596,10 +1689,39 @@ declare class DakeraClient {
1596
1689
  * ```
1597
1690
  */
1598
1691
  streamGlobalEvents(): AsyncGenerator<DakeraEvent>;
1692
+ /**
1693
+ * Stream memory lifecycle events for all agents (DASH-B).
1694
+ *
1695
+ * Opens a long-lived connection to `GET /v1/events/stream` and yields
1696
+ * {@link MemoryEvent} objects as they arrive. Each SSE frame uses the
1697
+ * `event:` field for the event_type and a JSON `data:` payload.
1698
+ *
1699
+ * Requires a Read-scoped API key.
1700
+ *
1701
+ * @example
1702
+ * ```ts
1703
+ * for await (const ev of client.streamMemoryEvents()) {
1704
+ * if (ev.event_type === 'stored') {
1705
+ * console.log(`Memory stored for agent ${ev.agent_id}: ${ev.content}`);
1706
+ * }
1707
+ * }
1708
+ * ```
1709
+ */
1710
+ streamMemoryEvents(): AsyncGenerator<MemoryEvent>;
1599
1711
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1600
1712
  private _streamSse;
1601
1713
  /** Parse a single SSE event block into a {@link DakeraEvent}. */
1602
1714
  private _parseSseBlock;
1715
+ /**
1716
+ * Low-level SSE streaming helper for the memory event stream.
1717
+ *
1718
+ * The memory event stream sets the SSE `event:` field to the event_type
1719
+ * and the `data:` field to the JSON payload. This helper merges the two
1720
+ * so callers receive a fully-populated {@link MemoryEvent}.
1721
+ */
1722
+ private _streamSseMemory;
1723
+ /** Parse a single SSE event block into a {@link MemoryEvent}. */
1724
+ private _parseSseMemoryBlock;
1603
1725
  }
1604
1726
 
1605
1727
  /**
@@ -1641,4 +1763,4 @@ declare class TimeoutError extends DakeraError {
1641
1763
  constructor(message: string);
1642
1764
  }
1643
1765
 
1644
- export { type AccessPatternHint, type AgentId, type AgentStats, type AgentSummary, type AggregationGroup, type AggregationRequest, type AggregationResponse, type AnalyticsOptions, type AnalyticsOverview, type ApiKey, AuthenticationError, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, DakeraClient, DakeraError, type DakeraEvent, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, type LatencyAnalytics, type ListSessionsOptions, type Memory, type MemoryFeedbackRequest, type MemoryFeedbackResponse, type MemoryId, type MemoryType, type MultiVectorSearchRequest, type MultiVectorSearchResponse, type MultiVectorSearchResult, type NamespaceCreatedEvent, type NamespaceDeletedEvent, type NamespaceInfo, NotFoundError, type OpStatus, type OperationProgressEvent, type QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type 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 };
1766
+ 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, type BackupInfo, type BatchQuerySpec, type BatchTextQueryOptions, type BatchTextQueryResponse, type Branded, type CacheStats, type ClientOptions, type ClusterNode, type ClusterStatus, type ColumnUpsertRequest, ConnectionError, type ConsolidateRequest, type ConsolidateResponse, type CreateKeyRequest, type CrossAgentNetworkRequest, type CrossAgentNetworkResponse, DakeraClient, DakeraError, type DakeraEvent, type DeduplicateRequest, type DeduplicateResponse, type DeleteOptions, type DeleteResponse, type DistanceMetric, type Document, type DocumentInput, type EmbeddingModel, type ExportRequest, type ExportResponse, type ExportedVector, type FilterExpression, type FilterOperators, type FullKnowledgeGraphRequest, type FullTextSearchResult, type HealthResponse, type HybridSearchResult, type IndexStats, type JobProgressEvent, type KeyUsage, type KnowledgeEdge, type KnowledgeGraphRequest, type KnowledgeGraphResponse, type KnowledgeNode, 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 QueryExplainRequest, type QueryExplainResponse, type QueryOptions, type QueryResult, RateLimitError, type ReadConsistency, type RecallRequest, type RecalledMemory, type SearchResult, ServerError, type Session, type SessionId, type SlowQuery, type StalenessConfig, type StartSessionRequest, type StorageAnalytics, type StoreMemoryRequest, type StoreMemoryResponse, type 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
@@ -1056,6 +1056,28 @@ var DakeraClient = class {
1056
1056
  async deduplicate(request) {
1057
1057
  return this.request("POST", "/v1/knowledge/deduplicate", request);
1058
1058
  }
1059
+ /**
1060
+ * Build a cross-agent memory network graph (DASH-A).
1061
+ *
1062
+ * Calls `POST /v1/knowledge/network/cross-agent` and returns a graph
1063
+ * containing every agent's nodes and the cross-agent similarity edges that
1064
+ * connect them.
1065
+ *
1066
+ * Requires an Admin-scoped API key.
1067
+ *
1068
+ * @example
1069
+ * ```ts
1070
+ * const network = await client.crossAgentNetwork({ min_similarity: 0.5 });
1071
+ * console.log(`${network.stats.total_cross_edges} cross-agent edges`);
1072
+ * ```
1073
+ */
1074
+ async crossAgentNetwork(req) {
1075
+ return this.request(
1076
+ "POST",
1077
+ "/v1/knowledge/network/cross-agent",
1078
+ req ?? {}
1079
+ );
1080
+ }
1059
1081
  // ===========================================================================
1060
1082
  // Analytics Operations
1061
1083
  // ===========================================================================
@@ -1243,6 +1265,28 @@ var DakeraClient = class {
1243
1265
  const url = `${this.baseUrl}/ops/events`;
1244
1266
  yield* this._streamSse(url);
1245
1267
  }
1268
+ /**
1269
+ * Stream memory lifecycle events for all agents (DASH-B).
1270
+ *
1271
+ * Opens a long-lived connection to `GET /v1/events/stream` and yields
1272
+ * {@link MemoryEvent} objects as they arrive. Each SSE frame uses the
1273
+ * `event:` field for the event_type and a JSON `data:` payload.
1274
+ *
1275
+ * Requires a Read-scoped API key.
1276
+ *
1277
+ * @example
1278
+ * ```ts
1279
+ * for await (const ev of client.streamMemoryEvents()) {
1280
+ * if (ev.event_type === 'stored') {
1281
+ * console.log(`Memory stored for agent ${ev.agent_id}: ${ev.content}`);
1282
+ * }
1283
+ * }
1284
+ * ```
1285
+ */
1286
+ async *streamMemoryEvents() {
1287
+ const url = `${this.baseUrl}/v1/events/stream`;
1288
+ yield* this._streamSseMemory(url);
1289
+ }
1246
1290
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1247
1291
  async *_streamSse(url) {
1248
1292
  const headers = {
@@ -1289,6 +1333,66 @@ var DakeraClient = class {
1289
1333
  return null;
1290
1334
  }
1291
1335
  }
1336
+ /**
1337
+ * Low-level SSE streaming helper for the memory event stream.
1338
+ *
1339
+ * The memory event stream sets the SSE `event:` field to the event_type
1340
+ * and the `data:` field to the JSON payload. This helper merges the two
1341
+ * so callers receive a fully-populated {@link MemoryEvent}.
1342
+ */
1343
+ async *_streamSseMemory(url) {
1344
+ const headers = {
1345
+ ...this.headers,
1346
+ Accept: "text/event-stream",
1347
+ "Cache-Control": "no-cache"
1348
+ };
1349
+ const response = await fetch(url, { headers });
1350
+ if (!response.ok || !response.body) {
1351
+ throw new Error(`SSE connection failed: ${response.status} ${response.statusText}`);
1352
+ }
1353
+ const reader = response.body.getReader();
1354
+ const decoder = new TextDecoder();
1355
+ let buffer = "";
1356
+ try {
1357
+ while (true) {
1358
+ const { done, value } = await reader.read();
1359
+ if (done) break;
1360
+ buffer += decoder.decode(value, { stream: true });
1361
+ let boundary;
1362
+ while ((boundary = buffer.indexOf("\n\n")) !== -1) {
1363
+ const block = buffer.slice(0, boundary);
1364
+ buffer = buffer.slice(boundary + 2);
1365
+ const event = this._parseSseMemoryBlock(block);
1366
+ if (event !== null) yield event;
1367
+ }
1368
+ }
1369
+ } finally {
1370
+ reader.releaseLock();
1371
+ }
1372
+ }
1373
+ /** Parse a single SSE event block into a {@link MemoryEvent}. */
1374
+ _parseSseMemoryBlock(block) {
1375
+ let eventType;
1376
+ const dataLines = [];
1377
+ for (const line of block.split("\n")) {
1378
+ if (line.startsWith(":")) continue;
1379
+ if (line.startsWith("event:")) {
1380
+ eventType = line.slice(6).trim();
1381
+ } else if (line.startsWith("data:")) {
1382
+ dataLines.push(line.slice(5).trimStart());
1383
+ }
1384
+ }
1385
+ if (dataLines.length === 0) return null;
1386
+ try {
1387
+ const parsed = JSON.parse(dataLines.join("\n"));
1388
+ if (eventType && !parsed.event_type) {
1389
+ parsed.event_type = eventType;
1390
+ }
1391
+ return parsed;
1392
+ } catch {
1393
+ return null;
1394
+ }
1395
+ }
1292
1396
  };
1293
1397
 
1294
1398
  // src/types.ts
package/dist/index.mjs CHANGED
@@ -1018,6 +1018,28 @@ var DakeraClient = class {
1018
1018
  async deduplicate(request) {
1019
1019
  return this.request("POST", "/v1/knowledge/deduplicate", request);
1020
1020
  }
1021
+ /**
1022
+ * Build a cross-agent memory network graph (DASH-A).
1023
+ *
1024
+ * Calls `POST /v1/knowledge/network/cross-agent` and returns a graph
1025
+ * containing every agent's nodes and the cross-agent similarity edges that
1026
+ * connect them.
1027
+ *
1028
+ * Requires an Admin-scoped API key.
1029
+ *
1030
+ * @example
1031
+ * ```ts
1032
+ * const network = await client.crossAgentNetwork({ min_similarity: 0.5 });
1033
+ * console.log(`${network.stats.total_cross_edges} cross-agent edges`);
1034
+ * ```
1035
+ */
1036
+ async crossAgentNetwork(req) {
1037
+ return this.request(
1038
+ "POST",
1039
+ "/v1/knowledge/network/cross-agent",
1040
+ req ?? {}
1041
+ );
1042
+ }
1021
1043
  // ===========================================================================
1022
1044
  // Analytics Operations
1023
1045
  // ===========================================================================
@@ -1205,6 +1227,28 @@ var DakeraClient = class {
1205
1227
  const url = `${this.baseUrl}/ops/events`;
1206
1228
  yield* this._streamSse(url);
1207
1229
  }
1230
+ /**
1231
+ * Stream memory lifecycle events for all agents (DASH-B).
1232
+ *
1233
+ * Opens a long-lived connection to `GET /v1/events/stream` and yields
1234
+ * {@link MemoryEvent} objects as they arrive. Each SSE frame uses the
1235
+ * `event:` field for the event_type and a JSON `data:` payload.
1236
+ *
1237
+ * Requires a Read-scoped API key.
1238
+ *
1239
+ * @example
1240
+ * ```ts
1241
+ * for await (const ev of client.streamMemoryEvents()) {
1242
+ * if (ev.event_type === 'stored') {
1243
+ * console.log(`Memory stored for agent ${ev.agent_id}: ${ev.content}`);
1244
+ * }
1245
+ * }
1246
+ * ```
1247
+ */
1248
+ async *streamMemoryEvents() {
1249
+ const url = `${this.baseUrl}/v1/events/stream`;
1250
+ yield* this._streamSseMemory(url);
1251
+ }
1208
1252
  /** Low-level SSE streaming helper — parses the SSE wire format. */
1209
1253
  async *_streamSse(url) {
1210
1254
  const headers = {
@@ -1251,6 +1295,66 @@ var DakeraClient = class {
1251
1295
  return null;
1252
1296
  }
1253
1297
  }
1298
+ /**
1299
+ * Low-level SSE streaming helper for the memory event stream.
1300
+ *
1301
+ * The memory event stream sets the SSE `event:` field to the event_type
1302
+ * and the `data:` field to the JSON payload. This helper merges the two
1303
+ * so callers receive a fully-populated {@link MemoryEvent}.
1304
+ */
1305
+ async *_streamSseMemory(url) {
1306
+ const headers = {
1307
+ ...this.headers,
1308
+ Accept: "text/event-stream",
1309
+ "Cache-Control": "no-cache"
1310
+ };
1311
+ const response = await fetch(url, { headers });
1312
+ if (!response.ok || !response.body) {
1313
+ throw new Error(`SSE connection failed: ${response.status} ${response.statusText}`);
1314
+ }
1315
+ const reader = response.body.getReader();
1316
+ const decoder = new TextDecoder();
1317
+ let buffer = "";
1318
+ try {
1319
+ while (true) {
1320
+ const { done, value } = await reader.read();
1321
+ if (done) break;
1322
+ buffer += decoder.decode(value, { stream: true });
1323
+ let boundary;
1324
+ while ((boundary = buffer.indexOf("\n\n")) !== -1) {
1325
+ const block = buffer.slice(0, boundary);
1326
+ buffer = buffer.slice(boundary + 2);
1327
+ const event = this._parseSseMemoryBlock(block);
1328
+ if (event !== null) yield event;
1329
+ }
1330
+ }
1331
+ } finally {
1332
+ reader.releaseLock();
1333
+ }
1334
+ }
1335
+ /** Parse a single SSE event block into a {@link MemoryEvent}. */
1336
+ _parseSseMemoryBlock(block) {
1337
+ let eventType;
1338
+ const dataLines = [];
1339
+ for (const line of block.split("\n")) {
1340
+ if (line.startsWith(":")) continue;
1341
+ if (line.startsWith("event:")) {
1342
+ eventType = line.slice(6).trim();
1343
+ } else if (line.startsWith("data:")) {
1344
+ dataLines.push(line.slice(5).trimStart());
1345
+ }
1346
+ }
1347
+ if (dataLines.length === 0) return null;
1348
+ try {
1349
+ const parsed = JSON.parse(dataLines.join("\n"));
1350
+ if (eventType && !parsed.event_type) {
1351
+ parsed.event_type = eventType;
1352
+ }
1353
+ return parsed;
1354
+ } catch {
1355
+ return null;
1356
+ }
1357
+ }
1254
1358
  };
1255
1359
 
1256
1360
  // src/types.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakera-ai/dakera",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",