@nebula-ai/sdk 1.1.27 → 1.1.29
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 +44 -23
- package/dist/index.d.ts +44 -23
- package/dist/index.js +62 -6
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -123,12 +123,13 @@ interface ActivatedFacet {
|
|
|
123
123
|
facet_id: string;
|
|
124
124
|
facet_name: string;
|
|
125
125
|
relevance_score: number;
|
|
126
|
-
facts:
|
|
126
|
+
facts: ActivatedKnowledge[];
|
|
127
127
|
coherence_score?: number;
|
|
128
128
|
is_noise: boolean;
|
|
129
129
|
}
|
|
130
|
-
interface
|
|
130
|
+
interface ActivatedKnowledge {
|
|
131
131
|
id?: string;
|
|
132
|
+
category?: string;
|
|
132
133
|
entity_id?: string;
|
|
133
134
|
entity_name?: string;
|
|
134
135
|
facet_name?: string;
|
|
@@ -140,6 +141,9 @@ interface ActivatedFact {
|
|
|
140
141
|
corroboration_count?: number;
|
|
141
142
|
confidence?: number;
|
|
142
143
|
source_chunk_ids?: string[];
|
|
144
|
+
reasoning?: string;
|
|
145
|
+
resolved_at?: string;
|
|
146
|
+
source_nodegroup_ids?: string[];
|
|
143
147
|
}
|
|
144
148
|
interface GroundedUtterance {
|
|
145
149
|
id?: string;
|
|
@@ -154,29 +158,24 @@ interface GroundedUtterance {
|
|
|
154
158
|
supporting_fact_ids?: string[];
|
|
155
159
|
metadata?: Record<string, unknown>;
|
|
156
160
|
}
|
|
157
|
-
interface
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
relationship_id?: string;
|
|
169
|
-
subject_id?: string;
|
|
170
|
-
object_id?: string;
|
|
171
|
-
metadata?: Record<string, unknown>;
|
|
172
|
-
inference_metadata?: Record<string, unknown>;
|
|
161
|
+
interface ActivatedEpisode {
|
|
162
|
+
id?: string;
|
|
163
|
+
name: string;
|
|
164
|
+
activation_score: number;
|
|
165
|
+
status?: string;
|
|
166
|
+
t_start?: number;
|
|
167
|
+
t_last?: number;
|
|
168
|
+
n_facts: number;
|
|
169
|
+
member_knowledge_ids?: string[];
|
|
170
|
+
source_chunk_ids?: string[];
|
|
171
|
+
entity_names?: string[];
|
|
173
172
|
}
|
|
174
173
|
interface MemoryResponse {
|
|
175
174
|
query: string;
|
|
176
175
|
entities: ActivatedEntity[];
|
|
177
|
-
|
|
176
|
+
knowledge: ActivatedKnowledge[];
|
|
177
|
+
episodes?: ActivatedEpisode[];
|
|
178
178
|
utterances: GroundedUtterance[];
|
|
179
|
-
inference_hints?: InferenceHint[];
|
|
180
179
|
total_traversal_time_ms?: number;
|
|
181
180
|
token_count?: number;
|
|
182
181
|
}
|
|
@@ -282,8 +281,12 @@ declare class Nebula {
|
|
|
282
281
|
* @throws NebulaNotFoundException if memory_id doesn't exist
|
|
283
282
|
*/
|
|
284
283
|
private _appendToMemory;
|
|
285
|
-
/** Store multiple memories using the unified engrams API
|
|
286
|
-
|
|
284
|
+
/** Store multiple memories using the unified engrams API.
|
|
285
|
+
* @param memories - List of Memory objects to store.
|
|
286
|
+
* @param metadata - Optional memory-level metadata for conversation groups.
|
|
287
|
+
* Each Memory's own metadata is used as per-message metadata.
|
|
288
|
+
*/
|
|
289
|
+
storeMemories(memories: Memory$1[], metadata?: Record<string, unknown>): Promise<string[]>;
|
|
287
290
|
/** Delete one or more memories */
|
|
288
291
|
delete(memoryIds: string | string[]): Promise<boolean | {
|
|
289
292
|
message: string;
|
|
@@ -476,6 +479,24 @@ declare class Nebula {
|
|
|
476
479
|
filters?: Record<string, unknown>;
|
|
477
480
|
searchSettings?: Record<string, unknown>;
|
|
478
481
|
}): Promise<MemoryResponse>;
|
|
482
|
+
/** List available connector providers */
|
|
483
|
+
listProviders(): Promise<string[]>;
|
|
484
|
+
/** Start an OAuth connection flow */
|
|
485
|
+
connectProvider(provider: string, collectionId: string, config?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
486
|
+
/** List active connections for a collection */
|
|
487
|
+
listConnections(collectionId: string): Promise<Record<string, unknown>[]>;
|
|
488
|
+
/** Browse Google Drive folders for a connection */
|
|
489
|
+
listFolders(connectionId: string, parentId?: string): Promise<Record<string, unknown>[]>;
|
|
490
|
+
/** List Slack channels for a connection */
|
|
491
|
+
listChannels(connectionId: string): Promise<Record<string, unknown>[]>;
|
|
492
|
+
/** Get a single connection by ID */
|
|
493
|
+
getConnection(connectionId: string): Promise<Record<string, unknown>>;
|
|
494
|
+
/** Manually trigger a sync for a connection */
|
|
495
|
+
triggerSync(connectionId: string): Promise<Record<string, unknown>>;
|
|
496
|
+
/** Update connection config (e.g., folder/channel selection) */
|
|
497
|
+
updateConnectionConfig(connectionId: string, config: Record<string, unknown>, apply?: string): Promise<Record<string, unknown>>;
|
|
498
|
+
/** Disconnect an external data source */
|
|
499
|
+
disconnect(connectionId: string, deleteMemories?: boolean): Promise<Record<string, unknown>>;
|
|
479
500
|
healthCheck(): Promise<Record<string, unknown>>;
|
|
480
501
|
private _collectionFromDict;
|
|
481
502
|
private _memoryResponseFromDict;
|
|
@@ -524,4 +545,4 @@ type MemoryFactory = {
|
|
|
524
545
|
declare const Memory: MemoryFactory;
|
|
525
546
|
type Memory = Memory$1;
|
|
526
547
|
|
|
527
|
-
export { type ActivatedEntity, type ActivatedFacet, type
|
|
548
|
+
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedKnowledge, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type GroundedUtterance, Memory, type MemoryResponse, type MultimodalContentPart, Nebula, NebulaAuthenticationException, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaContent, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type S3FileReferencePart, type SearchOptions, type SearchResult, type StructuredChunk, type TextContentPart, Nebula as default };
|
package/dist/index.d.ts
CHANGED
|
@@ -123,12 +123,13 @@ interface ActivatedFacet {
|
|
|
123
123
|
facet_id: string;
|
|
124
124
|
facet_name: string;
|
|
125
125
|
relevance_score: number;
|
|
126
|
-
facts:
|
|
126
|
+
facts: ActivatedKnowledge[];
|
|
127
127
|
coherence_score?: number;
|
|
128
128
|
is_noise: boolean;
|
|
129
129
|
}
|
|
130
|
-
interface
|
|
130
|
+
interface ActivatedKnowledge {
|
|
131
131
|
id?: string;
|
|
132
|
+
category?: string;
|
|
132
133
|
entity_id?: string;
|
|
133
134
|
entity_name?: string;
|
|
134
135
|
facet_name?: string;
|
|
@@ -140,6 +141,9 @@ interface ActivatedFact {
|
|
|
140
141
|
corroboration_count?: number;
|
|
141
142
|
confidence?: number;
|
|
142
143
|
source_chunk_ids?: string[];
|
|
144
|
+
reasoning?: string;
|
|
145
|
+
resolved_at?: string;
|
|
146
|
+
source_nodegroup_ids?: string[];
|
|
143
147
|
}
|
|
144
148
|
interface GroundedUtterance {
|
|
145
149
|
id?: string;
|
|
@@ -154,29 +158,24 @@ interface GroundedUtterance {
|
|
|
154
158
|
supporting_fact_ids?: string[];
|
|
155
159
|
metadata?: Record<string, unknown>;
|
|
156
160
|
}
|
|
157
|
-
interface
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
relationship_id?: string;
|
|
169
|
-
subject_id?: string;
|
|
170
|
-
object_id?: string;
|
|
171
|
-
metadata?: Record<string, unknown>;
|
|
172
|
-
inference_metadata?: Record<string, unknown>;
|
|
161
|
+
interface ActivatedEpisode {
|
|
162
|
+
id?: string;
|
|
163
|
+
name: string;
|
|
164
|
+
activation_score: number;
|
|
165
|
+
status?: string;
|
|
166
|
+
t_start?: number;
|
|
167
|
+
t_last?: number;
|
|
168
|
+
n_facts: number;
|
|
169
|
+
member_knowledge_ids?: string[];
|
|
170
|
+
source_chunk_ids?: string[];
|
|
171
|
+
entity_names?: string[];
|
|
173
172
|
}
|
|
174
173
|
interface MemoryResponse {
|
|
175
174
|
query: string;
|
|
176
175
|
entities: ActivatedEntity[];
|
|
177
|
-
|
|
176
|
+
knowledge: ActivatedKnowledge[];
|
|
177
|
+
episodes?: ActivatedEpisode[];
|
|
178
178
|
utterances: GroundedUtterance[];
|
|
179
|
-
inference_hints?: InferenceHint[];
|
|
180
179
|
total_traversal_time_ms?: number;
|
|
181
180
|
token_count?: number;
|
|
182
181
|
}
|
|
@@ -282,8 +281,12 @@ declare class Nebula {
|
|
|
282
281
|
* @throws NebulaNotFoundException if memory_id doesn't exist
|
|
283
282
|
*/
|
|
284
283
|
private _appendToMemory;
|
|
285
|
-
/** Store multiple memories using the unified engrams API
|
|
286
|
-
|
|
284
|
+
/** Store multiple memories using the unified engrams API.
|
|
285
|
+
* @param memories - List of Memory objects to store.
|
|
286
|
+
* @param metadata - Optional memory-level metadata for conversation groups.
|
|
287
|
+
* Each Memory's own metadata is used as per-message metadata.
|
|
288
|
+
*/
|
|
289
|
+
storeMemories(memories: Memory$1[], metadata?: Record<string, unknown>): Promise<string[]>;
|
|
287
290
|
/** Delete one or more memories */
|
|
288
291
|
delete(memoryIds: string | string[]): Promise<boolean | {
|
|
289
292
|
message: string;
|
|
@@ -476,6 +479,24 @@ declare class Nebula {
|
|
|
476
479
|
filters?: Record<string, unknown>;
|
|
477
480
|
searchSettings?: Record<string, unknown>;
|
|
478
481
|
}): Promise<MemoryResponse>;
|
|
482
|
+
/** List available connector providers */
|
|
483
|
+
listProviders(): Promise<string[]>;
|
|
484
|
+
/** Start an OAuth connection flow */
|
|
485
|
+
connectProvider(provider: string, collectionId: string, config?: Record<string, unknown>): Promise<Record<string, unknown>>;
|
|
486
|
+
/** List active connections for a collection */
|
|
487
|
+
listConnections(collectionId: string): Promise<Record<string, unknown>[]>;
|
|
488
|
+
/** Browse Google Drive folders for a connection */
|
|
489
|
+
listFolders(connectionId: string, parentId?: string): Promise<Record<string, unknown>[]>;
|
|
490
|
+
/** List Slack channels for a connection */
|
|
491
|
+
listChannels(connectionId: string): Promise<Record<string, unknown>[]>;
|
|
492
|
+
/** Get a single connection by ID */
|
|
493
|
+
getConnection(connectionId: string): Promise<Record<string, unknown>>;
|
|
494
|
+
/** Manually trigger a sync for a connection */
|
|
495
|
+
triggerSync(connectionId: string): Promise<Record<string, unknown>>;
|
|
496
|
+
/** Update connection config (e.g., folder/channel selection) */
|
|
497
|
+
updateConnectionConfig(connectionId: string, config: Record<string, unknown>, apply?: string): Promise<Record<string, unknown>>;
|
|
498
|
+
/** Disconnect an external data source */
|
|
499
|
+
disconnect(connectionId: string, deleteMemories?: boolean): Promise<Record<string, unknown>>;
|
|
479
500
|
healthCheck(): Promise<Record<string, unknown>>;
|
|
480
501
|
private _collectionFromDict;
|
|
481
502
|
private _memoryResponseFromDict;
|
|
@@ -524,4 +545,4 @@ type MemoryFactory = {
|
|
|
524
545
|
declare const Memory: MemoryFactory;
|
|
525
546
|
type Memory = Memory$1;
|
|
526
547
|
|
|
527
|
-
export { type ActivatedEntity, type ActivatedFacet, type
|
|
548
|
+
export { type ActivatedEntity, type ActivatedEpisode, type ActivatedFacet, type ActivatedKnowledge, type Chunk, type Collection, type FileContentPart, type GraphCommunityResult, type GraphEntityResult, type GraphRelationshipResult, GraphSearchResultType, type GroundedUtterance, Memory, type MemoryResponse, type MultimodalContentPart, Nebula, NebulaAuthenticationException, type NebulaClientConfig, NebulaClientException, NebulaCollectionNotFoundException, NebulaContent, NebulaException, NebulaNotFoundException, NebulaRateLimitException, NebulaValidationException, type S3FileReferencePart, type SearchOptions, type SearchResult, type StructuredChunk, type TextContentPart, Nebula as default };
|
package/dist/index.js
CHANGED
|
@@ -473,8 +473,12 @@ var _Nebula = class _Nebula {
|
|
|
473
473
|
throw error;
|
|
474
474
|
}
|
|
475
475
|
}
|
|
476
|
-
/** Store multiple memories using the unified engrams API
|
|
477
|
-
|
|
476
|
+
/** Store multiple memories using the unified engrams API.
|
|
477
|
+
* @param memories - List of Memory objects to store.
|
|
478
|
+
* @param metadata - Optional memory-level metadata for conversation groups.
|
|
479
|
+
* Each Memory's own metadata is used as per-message metadata.
|
|
480
|
+
*/
|
|
481
|
+
async storeMemories(memories, metadata) {
|
|
478
482
|
const results = [];
|
|
479
483
|
const convGroups = {};
|
|
480
484
|
const others = [];
|
|
@@ -517,7 +521,7 @@ var _Nebula = class _Nebula {
|
|
|
517
521
|
collection_id: collectionId,
|
|
518
522
|
name: "Conversation",
|
|
519
523
|
messages,
|
|
520
|
-
metadata: {}
|
|
524
|
+
metadata: metadata ?? {}
|
|
521
525
|
};
|
|
522
526
|
const response = await this._makeRequest("POST", "/v1/memories", data);
|
|
523
527
|
if (response.results) {
|
|
@@ -534,7 +538,7 @@ var _Nebula = class _Nebula {
|
|
|
534
538
|
collection_id: collectionId,
|
|
535
539
|
content: messages,
|
|
536
540
|
memory_id: convId,
|
|
537
|
-
metadata: {}
|
|
541
|
+
metadata: metadata ?? {}
|
|
538
542
|
};
|
|
539
543
|
await this._appendToMemory(convId, appendMem);
|
|
540
544
|
}
|
|
@@ -843,14 +847,66 @@ var _Nebula = class _Nebula {
|
|
|
843
847
|
const memoryResponse = {
|
|
844
848
|
query: memoryResponseData.query || options.query,
|
|
845
849
|
entities: memoryResponseData.entities || [],
|
|
846
|
-
|
|
850
|
+
knowledge: memoryResponseData.knowledge ?? memoryResponseData.facts ?? [],
|
|
851
|
+
episodes: memoryResponseData.episodes || [],
|
|
847
852
|
utterances: memoryResponseData.utterances || [],
|
|
848
|
-
inference_hints: memoryResponseData.inference_hints || [],
|
|
849
853
|
total_traversal_time_ms: memoryResponseData.total_traversal_time_ms,
|
|
850
854
|
token_count: memoryResponseData.token_count
|
|
851
855
|
};
|
|
852
856
|
return memoryResponse;
|
|
853
857
|
}
|
|
858
|
+
// Connector Methods
|
|
859
|
+
/** List available connector providers */
|
|
860
|
+
async listProviders() {
|
|
861
|
+
const response = await this._makeRequest("GET", "/v1/connectors/providers");
|
|
862
|
+
return this._unwrapResultsArray(response);
|
|
863
|
+
}
|
|
864
|
+
/** Start an OAuth connection flow */
|
|
865
|
+
async connectProvider(provider, collectionId, config) {
|
|
866
|
+
const body = { collection_id: collectionId };
|
|
867
|
+
if (config !== void 0) body.config = config;
|
|
868
|
+
const response = await this._makeRequest("POST", `/v1/connectors/${provider}/connect`, body);
|
|
869
|
+
return this._unwrapResults(response);
|
|
870
|
+
}
|
|
871
|
+
/** List active connections for a collection */
|
|
872
|
+
async listConnections(collectionId) {
|
|
873
|
+
const response = await this._makeRequest("GET", "/v1/connectors", void 0, { collection_id: collectionId });
|
|
874
|
+
return this._unwrapResultsArray(response);
|
|
875
|
+
}
|
|
876
|
+
/** Browse Google Drive folders for a connection */
|
|
877
|
+
async listFolders(connectionId, parentId) {
|
|
878
|
+
const params = {};
|
|
879
|
+
if (parentId !== void 0) params.parent_id = parentId;
|
|
880
|
+
const response = await this._makeRequest("GET", `/v1/connectors/${connectionId}/folders`, void 0, Object.keys(params).length ? params : void 0);
|
|
881
|
+
return this._unwrapResultsArray(response);
|
|
882
|
+
}
|
|
883
|
+
/** List Slack channels for a connection */
|
|
884
|
+
async listChannels(connectionId) {
|
|
885
|
+
const response = await this._makeRequest("GET", `/v1/connectors/${connectionId}/channels`);
|
|
886
|
+
return this._unwrapResultsArray(response);
|
|
887
|
+
}
|
|
888
|
+
/** Get a single connection by ID */
|
|
889
|
+
async getConnection(connectionId) {
|
|
890
|
+
const response = await this._makeRequest("GET", `/v1/connectors/${connectionId}`);
|
|
891
|
+
return this._unwrapResults(response);
|
|
892
|
+
}
|
|
893
|
+
/** Manually trigger a sync for a connection */
|
|
894
|
+
async triggerSync(connectionId) {
|
|
895
|
+
const response = await this._makeRequest("POST", `/v1/connectors/${connectionId}/sync`);
|
|
896
|
+
return this._unwrapResults(response);
|
|
897
|
+
}
|
|
898
|
+
/** Update connection config (e.g., folder/channel selection) */
|
|
899
|
+
async updateConnectionConfig(connectionId, config, apply = "full_resync") {
|
|
900
|
+
const response = await this._makeRequest("PATCH", `/v1/connectors/${connectionId}/config`, { config, apply });
|
|
901
|
+
return this._unwrapResults(response);
|
|
902
|
+
}
|
|
903
|
+
/** Disconnect an external data source */
|
|
904
|
+
async disconnect(connectionId, deleteMemories = false) {
|
|
905
|
+
const params = {};
|
|
906
|
+
if (deleteMemories) params.delete_memories = "true";
|
|
907
|
+
const response = await this._makeRequest("DELETE", `/v1/connectors/${connectionId}`, void 0, Object.keys(params).length ? params : void 0);
|
|
908
|
+
return this._unwrapResults(response);
|
|
909
|
+
}
|
|
854
910
|
// Health Check
|
|
855
911
|
async healthCheck() {
|
|
856
912
|
return this._makeRequest("GET", "/v1/health");
|