@nebula-ai/sdk 1.1.30 → 1.1.31

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
@@ -130,12 +130,13 @@ interface ActivatedFacet {
130
130
  interface ActivatedKnowledge {
131
131
  id?: string;
132
132
  category?: string;
133
+ description?: string;
133
134
  entity_id?: string;
134
135
  entity_name?: string;
135
136
  facet_name?: string;
136
- subject: string;
137
- predicate: string;
138
- value: string;
137
+ subject?: string;
138
+ predicate?: string;
139
+ value?: string;
139
140
  activation_score: number;
140
141
  extraction_confidence?: number;
141
142
  corroboration_count?: number;
@@ -160,12 +161,13 @@ interface GroundedSource {
160
161
  }
161
162
  interface ActivatedEpisode {
162
163
  id?: string;
163
- name: string;
164
+ name?: string;
165
+ description?: string;
164
166
  activation_score: number;
165
167
  status?: string;
166
168
  t_start?: number;
167
169
  t_last?: number;
168
- n_facts: number;
170
+ n_facts?: number;
169
171
  member_knowledge_ids?: string[];
170
172
  source_chunk_ids?: string[];
171
173
  entity_names?: string[];
package/dist/index.d.ts CHANGED
@@ -130,12 +130,13 @@ interface ActivatedFacet {
130
130
  interface ActivatedKnowledge {
131
131
  id?: string;
132
132
  category?: string;
133
+ description?: string;
133
134
  entity_id?: string;
134
135
  entity_name?: string;
135
136
  facet_name?: string;
136
- subject: string;
137
- predicate: string;
138
- value: string;
137
+ subject?: string;
138
+ predicate?: string;
139
+ value?: string;
139
140
  activation_score: number;
140
141
  extraction_confidence?: number;
141
142
  corroboration_count?: number;
@@ -160,12 +161,13 @@ interface GroundedSource {
160
161
  }
161
162
  interface ActivatedEpisode {
162
163
  id?: string;
163
- name: string;
164
+ name?: string;
165
+ description?: string;
164
166
  activation_score: number;
165
167
  status?: string;
166
168
  t_start?: number;
167
169
  t_last?: number;
168
- n_facts: number;
170
+ n_facts?: number;
169
171
  member_knowledge_ids?: string[];
170
172
  source_chunk_ids?: string[];
171
173
  entity_names?: string[];
package/dist/index.js CHANGED
@@ -183,7 +183,7 @@ var _Nebula = class _Nebula {
183
183
  return await this._processContentParts(normalized);
184
184
  }
185
185
  /** Make an HTTP request to the Nebula API */
186
- async _makeRequest(method, endpoint, jsonData, params) {
186
+ async _makeRequest(method, endpoint, jsonData, params, extraHeaders) {
187
187
  const url = new URL(endpoint, this.baseUrl);
188
188
  if (params) {
189
189
  Object.entries(params).forEach(([key, value]) => {
@@ -198,7 +198,7 @@ var _Nebula = class _Nebula {
198
198
  }
199
199
  });
200
200
  }
201
- const headers = this._buildAuthHeaders(true);
201
+ const headers = { ...this._buildAuthHeaders(true), ...extraHeaders };
202
202
  const controller = new AbortController();
203
203
  const timeoutId = setTimeout(() => controller.abort(), this.timeout);
204
204
  try {
@@ -830,8 +830,8 @@ var _Nebula = class _Nebula {
830
830
  data.effort = options.effort;
831
831
  }
832
832
  if (options.collection_ids) {
833
- const collectionIds = Array.isArray(options.collection_ids) ? options.collection_ids : [options.collection_ids];
834
- const validCollectionIds = collectionIds.filter((id) => id && id.trim() !== "");
833
+ const collectionIds2 = Array.isArray(options.collection_ids) ? options.collection_ids : [options.collection_ids];
834
+ const validCollectionIds = collectionIds2.filter((id) => id && id.trim() !== "");
835
835
  if (validCollectionIds.length) {
836
836
  data.collection_ids = validCollectionIds;
837
837
  }
@@ -842,14 +842,16 @@ var _Nebula = class _Nebula {
842
842
  if (options.searchSettings) {
843
843
  data.search_settings = options.searchSettings;
844
844
  }
845
- const response = await this._makeRequest("POST", "/v1/memories/search", data);
845
+ const collectionIds = data.collection_ids;
846
+ const extraHeaders = collectionIds && collectionIds.length === 1 ? { "X-Nebula-Collection-Id": collectionIds[0] } : void 0;
847
+ const response = await this._makeRequest("POST", "/v1/memories/search", data, void 0, extraHeaders);
846
848
  const memoryResponseData = response.results;
847
849
  const memoryResponse = {
848
850
  query: memoryResponseData.query || options.query,
849
851
  entities: memoryResponseData.entities || [],
850
852
  knowledge: memoryResponseData.knowledge ?? [],
851
853
  episodes: memoryResponseData.episodes || [],
852
- sources: memoryResponseData.sources || memoryResponseData.utterances || [],
854
+ sources: memoryResponseData.sources || [],
853
855
  total_traversal_time_ms: memoryResponseData.total_traversal_time_ms,
854
856
  token_count: memoryResponseData.token_count
855
857
  };