@nebula-ai/sdk 1.1.26 → 1.1.28

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.mjs CHANGED
@@ -469,8 +469,12 @@ var _Nebula = class _Nebula {
469
469
  throw error;
470
470
  }
471
471
  }
472
- /** Store multiple memories using the unified engrams API */
473
- async storeMemories(memories) {
472
+ /** Store multiple memories using the unified engrams API.
473
+ * @param memories - List of Memory objects to store.
474
+ * @param metadata - Optional memory-level metadata for conversation groups.
475
+ * Each Memory's own metadata is used as per-message metadata.
476
+ */
477
+ async storeMemories(memories, metadata) {
474
478
  const results = [];
475
479
  const convGroups = {};
476
480
  const others = [];
@@ -513,7 +517,7 @@ var _Nebula = class _Nebula {
513
517
  collection_id: collectionId,
514
518
  name: "Conversation",
515
519
  messages,
516
- metadata: {}
520
+ metadata: metadata ?? {}
517
521
  };
518
522
  const response = await this._makeRequest("POST", "/v1/memories", data);
519
523
  if (response.results) {
@@ -530,7 +534,7 @@ var _Nebula = class _Nebula {
530
534
  collection_id: collectionId,
531
535
  content: messages,
532
536
  memory_id: convId,
533
- metadata: {}
537
+ metadata: metadata ?? {}
534
538
  };
535
539
  await this._appendToMemory(convId, appendMem);
536
540
  }
@@ -842,16 +846,63 @@ var _Nebula = class _Nebula {
842
846
  facts: memoryResponseData.facts || [],
843
847
  utterances: memoryResponseData.utterances || [],
844
848
  inference_hints: memoryResponseData.inference_hints || [],
845
- fact_to_chunks: memoryResponseData.fact_to_chunks || {},
846
- entity_to_facts: memoryResponseData.entity_to_facts || {},
847
- retrieved_at: memoryResponseData.retrieved_at || (/* @__PURE__ */ new Date()).toISOString(),
848
- focus: memoryResponseData.focus,
849
849
  total_traversal_time_ms: memoryResponseData.total_traversal_time_ms,
850
- query_intent: memoryResponseData.query_intent,
851
850
  token_count: memoryResponseData.token_count
852
851
  };
853
852
  return memoryResponse;
854
853
  }
854
+ // Connector Methods
855
+ /** List available connector providers */
856
+ async listProviders() {
857
+ const response = await this._makeRequest("GET", "/v1/connectors/providers");
858
+ return this._unwrapResultsArray(response);
859
+ }
860
+ /** Start an OAuth connection flow */
861
+ async connectProvider(provider, collectionId, config) {
862
+ const body = { collection_id: collectionId };
863
+ if (config !== void 0) body.config = config;
864
+ const response = await this._makeRequest("POST", `/v1/connectors/${provider}/connect`, body);
865
+ return this._unwrapResults(response);
866
+ }
867
+ /** List active connections for a collection */
868
+ async listConnections(collectionId) {
869
+ const response = await this._makeRequest("GET", "/v1/connectors", void 0, { collection_id: collectionId });
870
+ return this._unwrapResultsArray(response);
871
+ }
872
+ /** Browse Google Drive folders for a connection */
873
+ async listFolders(connectionId, parentId) {
874
+ const params = {};
875
+ if (parentId !== void 0) params.parent_id = parentId;
876
+ const response = await this._makeRequest("GET", `/v1/connectors/${connectionId}/folders`, void 0, Object.keys(params).length ? params : void 0);
877
+ return this._unwrapResultsArray(response);
878
+ }
879
+ /** List Slack channels for a connection */
880
+ async listChannels(connectionId) {
881
+ const response = await this._makeRequest("GET", `/v1/connectors/${connectionId}/channels`);
882
+ return this._unwrapResultsArray(response);
883
+ }
884
+ /** Get a single connection by ID */
885
+ async getConnection(connectionId) {
886
+ const response = await this._makeRequest("GET", `/v1/connectors/${connectionId}`);
887
+ return this._unwrapResults(response);
888
+ }
889
+ /** Manually trigger a sync for a connection */
890
+ async triggerSync(connectionId) {
891
+ const response = await this._makeRequest("POST", `/v1/connectors/${connectionId}/sync`);
892
+ return this._unwrapResults(response);
893
+ }
894
+ /** Update connection config (e.g., folder/channel selection) */
895
+ async updateConnectionConfig(connectionId, config, apply = "full_resync") {
896
+ const response = await this._makeRequest("PATCH", `/v1/connectors/${connectionId}/config`, { config, apply });
897
+ return this._unwrapResults(response);
898
+ }
899
+ /** Disconnect an external data source */
900
+ async disconnect(connectionId, deleteMemories = false) {
901
+ const params = {};
902
+ if (deleteMemories) params.delete_memories = "true";
903
+ const response = await this._makeRequest("DELETE", `/v1/connectors/${connectionId}`, void 0, Object.keys(params).length ? params : void 0);
904
+ return this._unwrapResults(response);
905
+ }
855
906
  // Health Check
856
907
  async healthCheck() {
857
908
  return this._makeRequest("GET", "/v1/health");