@utaba/deep-memory 0.1.0 → 0.2.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/{StorageProvider-CkFjdboX.d.cts → StorageProvider-C3tKhfuw.d.cts} +14 -3
- package/dist/{StorageProvider-CJjz8uBY.d.ts → StorageProvider-DR9HLYHJ.d.ts} +14 -3
- package/dist/index.cjs +960 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +65 -13
- package/dist/index.d.ts +65 -13
- package/dist/index.js +954 -143
- package/dist/index.js.map +1 -1
- package/dist/{portability-DdlNYXGX.d.cts → portability-DdjsCB07.d.cts} +44 -1
- package/dist/{portability-DdlNYXGX.d.ts → portability-DdjsCB07.d.ts} +44 -1
- package/dist/providers/index.cjs.map +1 -1
- package/dist/providers/index.d.cts +56 -3
- package/dist/providers/index.d.ts +56 -3
- package/dist/testing/conformance.d.cts +2 -2
- package/dist/testing/conformance.d.ts +2 -2
- package/dist/traversal-9JdiqjZ9.d.ts +177 -0
- package/dist/traversal-BB_yERbf.d.cts +177 -0
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +3 -2
- package/dist/types/index.d.ts +3 -2
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { G as GovernanceConfig, M as MemoryVocabulary,
|
|
2
|
-
export {
|
|
1
|
+
import { G as GovernanceConfig, M as MemoryVocabulary, u as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, v as CreateRelationshipInput, w as EntityTypeDefinition, x as VocabularyProposal, y as VocabularyProposalResult, z as ProvenanceContext, A as Provenance, E as Entity, D as DetailLevel, a as EntitySummary, b as EntityBrief, F as FindEntitiesQuery, d as PaginatedResult, H as ReembedResult, J as Relationship, P as PropertyFilter, K as RelationshipSummary, L as GraphResult, N as ExploreOptions, O as Neighbourhood, Q as PathOptions, T as PathResult, W as ConceptSearchOptions, X as ScoredEntity, Y as TimelineOptions, Z as TimelineResult, g as RepositoryStats, _ as RepositoryConfig, R as RepositoryFilter, $ as RepositorySummary, f as RepositoryUpdate, c as StoredRepository, a0 as ExportOptions, a1 as ExportArchive, a2 as ImportOptions, a3 as ImportResult, a4 as ExportStreamItem, a5 as ImportStreamHeader, I as ImportChunk, S as StorageRepositoryConfig, e as StoredRepositorySummary, h as PaginationOptions, V as VocabularyChangeRecord, i as StoredEntity, j as StoredEntityUpdate, k as StorageFindQuery, l as StoredRelationship, m as RelationshipQueryOptions, n as StorageExploreOptions, o as StorageNeighbourhood, p as StoragePathOptions, q as StoragePathResult, r as StorageTimelineOptions, s as StorageTimelineResult, t as ExportChunk, B as BulkImportResult, a6 as SearchOptions, a7 as SearchHit } from './portability-DdjsCB07.cjs';
|
|
2
|
+
export { a8 as EnrichedRelationship, a9 as EntityMap, aa as EntityTypeInput, ab as ExportLegalMetadata, ac as ExportManifest, ad as ExportPipelineMetadata, ae as GetEntitiesOptions, af as GetEntityOptions, ag as GovernanceMode, ah as ImportWarning, ai as NeighbourhoodCentre, aj as NeighbourhoodGroup, ak as NeighbourhoodLayer, al as Path, am as PropertySchema, an as PropertyType, ao as ProvenanceFilter, ap as RelationshipDirection, aq as RelationshipTypeDefinition, ar as RelationshipTypeInput, as as RepositoryMetadata, at as StorageNeighbourhoodGroup, au as StorageNeighbourhoodLayer, av as StoragePath, aw as StorageTimelineEvent, ax as TimelineEntityRef, ay as TimelineEvent, az as TimelineRelationshipDetail, aA as VocabularyInput } from './portability-DdjsCB07.cjs';
|
|
3
3
|
import { DeepMemoryEventType, EventHandler, Unsubscribe, DeepMemoryEvent, HookResult, EventPayload } from './types/index.cjs';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { T as TraversalSpec, a as TraversalResult } from './traversal-BB_yERbf.cjs';
|
|
5
|
+
export { Q as QueryMetadata, b as TraversalPath, c as TraversalRelationship, d as TraversalReturnMode, e as TraversalStart, f as TraversalStep } from './traversal-BB_yERbf.cjs';
|
|
6
|
+
import { S as StorageProvider, E as EnsureSchemaResult } from './StorageProvider-C3tKhfuw.cjs';
|
|
7
|
+
import { EmbeddingProvider, SearchProvider, GraphTraversalProvider, LockProvider, SearchableEntity } from './providers/index.cjs';
|
|
8
|
+
export { GraphTraversalCapabilities, LockHandle, LockOptions } from './providers/index.cjs';
|
|
7
9
|
|
|
8
10
|
/** Error codes for all Deep Memory errors */
|
|
9
|
-
type DeepMemoryErrorCode = 'INVALID_INPUT' | 'ENTITY_NOT_FOUND' | 'ENTITY_ALREADY_EXISTS' | 'RELATIONSHIP_NOT_FOUND' | 'RELATIONSHIP_ALREADY_EXISTS' | 'REPOSITORY_NOT_FOUND' | 'REPOSITORY_ALREADY_EXISTS' | 'VOCABULARY_VALIDATION_FAILED' | 'RELATIONSHIP_CONSTRAINT_FAILED' | 'GOVERNANCE_DENIED' | 'OPERATION_CANCELLED' | 'EMBEDDING_PROVIDER_REQUIRED' | 'IMPORT_ERROR' | 'EXPORT_ERROR' | 'PROVIDER_ERROR';
|
|
11
|
+
type DeepMemoryErrorCode = 'INVALID_INPUT' | 'ENTITY_NOT_FOUND' | 'ENTITY_ALREADY_EXISTS' | 'RELATIONSHIP_NOT_FOUND' | 'RELATIONSHIP_ALREADY_EXISTS' | 'REPOSITORY_NOT_FOUND' | 'REPOSITORY_ALREADY_EXISTS' | 'VOCABULARY_VALIDATION_FAILED' | 'RELATIONSHIP_CONSTRAINT_FAILED' | 'GOVERNANCE_DENIED' | 'OPERATION_CANCELLED' | 'EMBEDDING_PROVIDER_REQUIRED' | 'IMPORT_ERROR' | 'EXPORT_ERROR' | 'PROVIDER_ERROR' | 'GRAPH_TRAVERSAL_PROVIDER_REQUIRED' | 'TRAVERSAL_VALIDATION_FAILED' | 'TRAVERSAL_VOCABULARY_ERROR' | 'TRAVERSAL_TIMEOUT';
|
|
10
12
|
/** Base error class for all Deep Memory errors */
|
|
11
13
|
declare class DeepMemoryError extends Error {
|
|
12
14
|
readonly code: DeepMemoryErrorCode;
|
|
@@ -96,6 +98,25 @@ declare class ExportError extends DeepMemoryError {
|
|
|
96
98
|
declare class ProviderError extends DeepMemoryError {
|
|
97
99
|
constructor(message: string, suggestion?: string);
|
|
98
100
|
}
|
|
101
|
+
/** Thrown when executeNativeQuery() is called but no GraphTraversalProvider is registered. */
|
|
102
|
+
declare class GraphTraversalProviderRequiredError extends DeepMemoryError {
|
|
103
|
+
constructor();
|
|
104
|
+
}
|
|
105
|
+
/** Thrown when a TraversalSpec is structurally invalid. */
|
|
106
|
+
declare class TraversalValidationError extends DeepMemoryError {
|
|
107
|
+
readonly errors: string[];
|
|
108
|
+
constructor(errors: string[]);
|
|
109
|
+
}
|
|
110
|
+
/** Thrown when a TraversalSpec references relationship/entity types not in the vocabulary. */
|
|
111
|
+
declare class TraversalVocabularyError extends DeepMemoryError {
|
|
112
|
+
readonly unknownTypes: string[];
|
|
113
|
+
constructor(unknownTypes: string[]);
|
|
114
|
+
}
|
|
115
|
+
/** Thrown when a native query times out. */
|
|
116
|
+
declare class TraversalTimeoutError extends DeepMemoryError {
|
|
117
|
+
readonly timeoutMs: number;
|
|
118
|
+
constructor(timeoutMs: number);
|
|
119
|
+
}
|
|
99
120
|
|
|
100
121
|
/** A single validation error with optional suggestion */
|
|
101
122
|
interface ValidationError {
|
|
@@ -210,6 +231,7 @@ interface MemoryRepositoryConfig {
|
|
|
210
231
|
storage: StorageProvider;
|
|
211
232
|
search?: SearchProvider;
|
|
212
233
|
embedding?: EmbeddingProvider;
|
|
234
|
+
graphTraversal?: GraphTraversalProvider;
|
|
213
235
|
vocabularyEngine: VocabularyEngine;
|
|
214
236
|
provenanceTracker: ProvenanceTracker;
|
|
215
237
|
eventBus: EventBus;
|
|
@@ -230,7 +252,7 @@ declare class MemoryRepository {
|
|
|
230
252
|
proposeVocabularyChange(proposal: VocabularyProposal): Promise<VocabularyProposalResult>;
|
|
231
253
|
/** @deprecated Use proposeVocabularyChange instead */
|
|
232
254
|
proposeVocabularyExtension(proposal: VocabularyProposal): Promise<VocabularyProposalResult>;
|
|
233
|
-
|
|
255
|
+
createEntities(inputs: CreateEntityInput[]): Promise<Entity[]>;
|
|
234
256
|
updateEntity(entityId: string, updates: UpdateEntityInput): Promise<Entity>;
|
|
235
257
|
getEntity(entityId: string, detailLevel?: DetailLevel): Promise<Entity | EntitySummary | EntityBrief | null>;
|
|
236
258
|
getBySlug(slug: string, detailLevel?: DetailLevel): Promise<Entity | EntitySummary | EntityBrief | null>;
|
|
@@ -253,7 +275,7 @@ declare class MemoryRepository {
|
|
|
253
275
|
/** Milliseconds to wait between batches for rate limiting (default 0) */
|
|
254
276
|
delayBetweenBatchesMs?: number;
|
|
255
277
|
}): Promise<ReembedResult>;
|
|
256
|
-
|
|
278
|
+
createRelationships(inputs: CreateRelationshipInput[]): Promise<Relationship[]>;
|
|
257
279
|
removeRelationship(relationshipId: string): Promise<void>;
|
|
258
280
|
getRelationships(entityId: string, options?: {
|
|
259
281
|
relationshipTypes?: string[];
|
|
@@ -272,6 +294,8 @@ declare class MemoryRepository {
|
|
|
272
294
|
}): Promise<GraphResult>;
|
|
273
295
|
exploreNeighbourhood(entityId: string, options?: ExploreOptions): Promise<Neighbourhood>;
|
|
274
296
|
findPaths(sourceId: string, targetId: string, options?: PathOptions): Promise<PathResult>;
|
|
297
|
+
traverse(spec: TraversalSpec): Promise<TraversalResult>;
|
|
298
|
+
executeNativeQuery(query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
|
|
275
299
|
searchByConcept(query: string, options?: ConceptSearchOptions): Promise<PaginatedResult<ScoredEntity>>;
|
|
276
300
|
getTimeline(entityId: string, options?: TimelineOptions): Promise<TimelineResult>;
|
|
277
301
|
getStats(): Promise<RepositoryStats>;
|
|
@@ -293,6 +317,8 @@ interface DeepMemoryConfig {
|
|
|
293
317
|
embedding?: EmbeddingProvider;
|
|
294
318
|
/** Optional: lock provider for distributed locking */
|
|
295
319
|
lock?: LockProvider;
|
|
320
|
+
/** Optional: graph traversal provider for native multi-hop queries */
|
|
321
|
+
graphTraversal?: GraphTraversalProvider;
|
|
296
322
|
/** Required: provenance context identifying the actor */
|
|
297
323
|
provenance: ProvenanceContext;
|
|
298
324
|
}
|
|
@@ -302,14 +328,15 @@ declare class DeepMemory {
|
|
|
302
328
|
private readonly embedding?;
|
|
303
329
|
/** Reserved for future distributed locking support */
|
|
304
330
|
readonly lock?: LockProvider;
|
|
331
|
+
private readonly graphTraversalProvider?;
|
|
305
332
|
private readonly provenance;
|
|
306
333
|
private readonly globalEventBus;
|
|
307
334
|
private initialised;
|
|
308
335
|
constructor(config: DeepMemoryConfig);
|
|
309
|
-
/** Initialise the storage provider (call once before use) */
|
|
336
|
+
/** Initialise the storage provider and optional providers (call once before use) */
|
|
310
337
|
private ensureInitialised;
|
|
311
338
|
/** Create or migrate the storage schema. Call once at deployment / startup, not per-request. */
|
|
312
|
-
ensureSchema(): Promise<
|
|
339
|
+
ensureSchema(): Promise<EnsureSchemaResult>;
|
|
313
340
|
private validateRepositoryId;
|
|
314
341
|
/** Create a new memory repository */
|
|
315
342
|
createRepository(config: RepositoryConfig): Promise<MemoryRepository>;
|
|
@@ -322,7 +349,7 @@ declare class DeepMemory {
|
|
|
322
349
|
/** Delete a repository */
|
|
323
350
|
deleteRepository(repositoryId: string): Promise<void>;
|
|
324
351
|
/** Export a repository to a portable archive */
|
|
325
|
-
exportRepository(repositoryId: string): Promise<ExportArchive>;
|
|
352
|
+
exportRepository(repositoryId: string, options?: ExportOptions): Promise<ExportArchive>;
|
|
326
353
|
/** Import a repository from a portable archive */
|
|
327
354
|
importRepository(archive: ExportArchive, options: ImportOptions): Promise<ImportResult>;
|
|
328
355
|
/**
|
|
@@ -330,7 +357,7 @@ declare class DeepMemory {
|
|
|
330
357
|
* Yields: manifest → vocabulary → entity chunks → relationship chunks.
|
|
331
358
|
* Use for large repositories to avoid loading everything into memory.
|
|
332
359
|
*/
|
|
333
|
-
exportRepositoryStream(repositoryId: string): AsyncGenerator<ExportStreamItem>;
|
|
360
|
+
exportRepositoryStream(repositoryId: string, options?: ExportOptions): AsyncGenerator<ExportStreamItem>;
|
|
334
361
|
/**
|
|
335
362
|
* Import a repository from a stream of chunks.
|
|
336
363
|
* Use for large repositories to avoid loading everything into memory.
|
|
@@ -350,6 +377,31 @@ declare class DeepMemory {
|
|
|
350
377
|
*/
|
|
351
378
|
declare function matchesPropertyFilters(properties: Record<string, unknown>, filters: PropertyFilter[]): boolean;
|
|
352
379
|
|
|
380
|
+
interface TraversalCompiler {
|
|
381
|
+
/** The query language this compiler targets. */
|
|
382
|
+
readonly language: 'gremlin' | 'cypher' | 'sql';
|
|
383
|
+
/** Compile a validated TraversalSpec into a native query string. */
|
|
384
|
+
compile(spec: TraversalSpec, vocabulary: MemoryVocabulary): CompiledQuery;
|
|
385
|
+
}
|
|
386
|
+
interface CompiledQuery {
|
|
387
|
+
/** The native query string. */
|
|
388
|
+
query: string;
|
|
389
|
+
/** Parameter bindings (for parameterized queries). */
|
|
390
|
+
params: Record<string, unknown>;
|
|
391
|
+
/** Estimated cost heuristic (fan-out estimation). Provider may override. */
|
|
392
|
+
estimatedFanOut: number;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
declare class GremlinCompiler implements TraversalCompiler {
|
|
396
|
+
readonly language: "gremlin";
|
|
397
|
+
compile(spec: TraversalSpec, _vocabulary: MemoryVocabulary): CompiledQuery;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
declare class CypherCompiler implements TraversalCompiler {
|
|
401
|
+
readonly language: "cypher";
|
|
402
|
+
compile(spec: TraversalSpec, _vocabulary: MemoryVocabulary): CompiledQuery;
|
|
403
|
+
}
|
|
404
|
+
|
|
353
405
|
declare class InMemoryStorageProvider implements StorageProvider {
|
|
354
406
|
private stores;
|
|
355
407
|
private getStore;
|
|
@@ -405,4 +457,4 @@ declare class NoOpEmbeddingProvider implements EmbeddingProvider {
|
|
|
405
457
|
modelId(): string;
|
|
406
458
|
}
|
|
407
459
|
|
|
408
|
-
export { BulkImportResult, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary, Neighbourhood, NoOpEmbeddingProvider, OperationCancelledError, PaginatedResult, PaginationOptions, PathOptions, PathResult, PropertyFilter, Provenance, ProvenanceContext, ProviderError, ReembedResult, Relationship, RelationshipConstraintError, RelationshipNotFoundError, RelationshipQueryOptions, RelationshipSummary, RepositoryConfig, RepositoryFilter, RepositoryNotFoundError, RepositoryStats, RepositorySummary, RepositoryUpdate, ResolvedVocabulary, ScoredEntity, SearchHit, SearchOptions, SearchProvider, SearchableEntity, StorageExploreOptions, StorageFindQuery, StorageNeighbourhood, StoragePathOptions, StoragePathResult, StorageProvider, StorageRepositoryConfig, StorageTimelineOptions, StorageTimelineResult, StoredEntity, StoredEntityUpdate, StoredRelationship, StoredRepository, StoredRepositorySummary, TimelineOptions, TimelineResult, Unsubscribe, UpdateEntityInput, VocabularyChangeRecord, VocabularyProposal, VocabularyProposalResult, VocabularyValidationError, generateId, isValidUuid, matchesPropertyFilters };
|
|
460
|
+
export { BulkImportResult, type CompiledQuery, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, CypherCompiler, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, EnsureSchemaResult, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportOptions, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, GraphTraversalProvider, GraphTraversalProviderRequiredError, GremlinCompiler, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary, Neighbourhood, NoOpEmbeddingProvider, OperationCancelledError, PaginatedResult, PaginationOptions, PathOptions, PathResult, PropertyFilter, Provenance, ProvenanceContext, ProviderError, ReembedResult, Relationship, RelationshipConstraintError, RelationshipNotFoundError, RelationshipQueryOptions, RelationshipSummary, RepositoryConfig, RepositoryFilter, RepositoryNotFoundError, RepositoryStats, RepositorySummary, RepositoryUpdate, ResolvedVocabulary, ScoredEntity, SearchHit, SearchOptions, SearchProvider, SearchableEntity, StorageExploreOptions, StorageFindQuery, StorageNeighbourhood, StoragePathOptions, StoragePathResult, StorageProvider, StorageRepositoryConfig, StorageTimelineOptions, StorageTimelineResult, StoredEntity, StoredEntityUpdate, StoredRelationship, StoredRepository, StoredRepositorySummary, TimelineOptions, TimelineResult, type TraversalCompiler, TraversalResult, TraversalSpec, TraversalTimeoutError, TraversalValidationError, TraversalVocabularyError, Unsubscribe, UpdateEntityInput, VocabularyChangeRecord, VocabularyProposal, VocabularyProposalResult, VocabularyValidationError, generateId, isValidUuid, matchesPropertyFilters };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { G as GovernanceConfig, M as MemoryVocabulary,
|
|
2
|
-
export {
|
|
1
|
+
import { G as GovernanceConfig, M as MemoryVocabulary, u as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, v as CreateRelationshipInput, w as EntityTypeDefinition, x as VocabularyProposal, y as VocabularyProposalResult, z as ProvenanceContext, A as Provenance, E as Entity, D as DetailLevel, a as EntitySummary, b as EntityBrief, F as FindEntitiesQuery, d as PaginatedResult, H as ReembedResult, J as Relationship, P as PropertyFilter, K as RelationshipSummary, L as GraphResult, N as ExploreOptions, O as Neighbourhood, Q as PathOptions, T as PathResult, W as ConceptSearchOptions, X as ScoredEntity, Y as TimelineOptions, Z as TimelineResult, g as RepositoryStats, _ as RepositoryConfig, R as RepositoryFilter, $ as RepositorySummary, f as RepositoryUpdate, c as StoredRepository, a0 as ExportOptions, a1 as ExportArchive, a2 as ImportOptions, a3 as ImportResult, a4 as ExportStreamItem, a5 as ImportStreamHeader, I as ImportChunk, S as StorageRepositoryConfig, e as StoredRepositorySummary, h as PaginationOptions, V as VocabularyChangeRecord, i as StoredEntity, j as StoredEntityUpdate, k as StorageFindQuery, l as StoredRelationship, m as RelationshipQueryOptions, n as StorageExploreOptions, o as StorageNeighbourhood, p as StoragePathOptions, q as StoragePathResult, r as StorageTimelineOptions, s as StorageTimelineResult, t as ExportChunk, B as BulkImportResult, a6 as SearchOptions, a7 as SearchHit } from './portability-DdjsCB07.js';
|
|
2
|
+
export { a8 as EnrichedRelationship, a9 as EntityMap, aa as EntityTypeInput, ab as ExportLegalMetadata, ac as ExportManifest, ad as ExportPipelineMetadata, ae as GetEntitiesOptions, af as GetEntityOptions, ag as GovernanceMode, ah as ImportWarning, ai as NeighbourhoodCentre, aj as NeighbourhoodGroup, ak as NeighbourhoodLayer, al as Path, am as PropertySchema, an as PropertyType, ao as ProvenanceFilter, ap as RelationshipDirection, aq as RelationshipTypeDefinition, ar as RelationshipTypeInput, as as RepositoryMetadata, at as StorageNeighbourhoodGroup, au as StorageNeighbourhoodLayer, av as StoragePath, aw as StorageTimelineEvent, ax as TimelineEntityRef, ay as TimelineEvent, az as TimelineRelationshipDetail, aA as VocabularyInput } from './portability-DdjsCB07.js';
|
|
3
3
|
import { DeepMemoryEventType, EventHandler, Unsubscribe, DeepMemoryEvent, HookResult, EventPayload } from './types/index.js';
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { T as TraversalSpec, a as TraversalResult } from './traversal-9JdiqjZ9.js';
|
|
5
|
+
export { Q as QueryMetadata, b as TraversalPath, c as TraversalRelationship, d as TraversalReturnMode, e as TraversalStart, f as TraversalStep } from './traversal-9JdiqjZ9.js';
|
|
6
|
+
import { S as StorageProvider, E as EnsureSchemaResult } from './StorageProvider-DR9HLYHJ.js';
|
|
7
|
+
import { EmbeddingProvider, SearchProvider, GraphTraversalProvider, LockProvider, SearchableEntity } from './providers/index.js';
|
|
8
|
+
export { GraphTraversalCapabilities, LockHandle, LockOptions } from './providers/index.js';
|
|
7
9
|
|
|
8
10
|
/** Error codes for all Deep Memory errors */
|
|
9
|
-
type DeepMemoryErrorCode = 'INVALID_INPUT' | 'ENTITY_NOT_FOUND' | 'ENTITY_ALREADY_EXISTS' | 'RELATIONSHIP_NOT_FOUND' | 'RELATIONSHIP_ALREADY_EXISTS' | 'REPOSITORY_NOT_FOUND' | 'REPOSITORY_ALREADY_EXISTS' | 'VOCABULARY_VALIDATION_FAILED' | 'RELATIONSHIP_CONSTRAINT_FAILED' | 'GOVERNANCE_DENIED' | 'OPERATION_CANCELLED' | 'EMBEDDING_PROVIDER_REQUIRED' | 'IMPORT_ERROR' | 'EXPORT_ERROR' | 'PROVIDER_ERROR';
|
|
11
|
+
type DeepMemoryErrorCode = 'INVALID_INPUT' | 'ENTITY_NOT_FOUND' | 'ENTITY_ALREADY_EXISTS' | 'RELATIONSHIP_NOT_FOUND' | 'RELATIONSHIP_ALREADY_EXISTS' | 'REPOSITORY_NOT_FOUND' | 'REPOSITORY_ALREADY_EXISTS' | 'VOCABULARY_VALIDATION_FAILED' | 'RELATIONSHIP_CONSTRAINT_FAILED' | 'GOVERNANCE_DENIED' | 'OPERATION_CANCELLED' | 'EMBEDDING_PROVIDER_REQUIRED' | 'IMPORT_ERROR' | 'EXPORT_ERROR' | 'PROVIDER_ERROR' | 'GRAPH_TRAVERSAL_PROVIDER_REQUIRED' | 'TRAVERSAL_VALIDATION_FAILED' | 'TRAVERSAL_VOCABULARY_ERROR' | 'TRAVERSAL_TIMEOUT';
|
|
10
12
|
/** Base error class for all Deep Memory errors */
|
|
11
13
|
declare class DeepMemoryError extends Error {
|
|
12
14
|
readonly code: DeepMemoryErrorCode;
|
|
@@ -96,6 +98,25 @@ declare class ExportError extends DeepMemoryError {
|
|
|
96
98
|
declare class ProviderError extends DeepMemoryError {
|
|
97
99
|
constructor(message: string, suggestion?: string);
|
|
98
100
|
}
|
|
101
|
+
/** Thrown when executeNativeQuery() is called but no GraphTraversalProvider is registered. */
|
|
102
|
+
declare class GraphTraversalProviderRequiredError extends DeepMemoryError {
|
|
103
|
+
constructor();
|
|
104
|
+
}
|
|
105
|
+
/** Thrown when a TraversalSpec is structurally invalid. */
|
|
106
|
+
declare class TraversalValidationError extends DeepMemoryError {
|
|
107
|
+
readonly errors: string[];
|
|
108
|
+
constructor(errors: string[]);
|
|
109
|
+
}
|
|
110
|
+
/** Thrown when a TraversalSpec references relationship/entity types not in the vocabulary. */
|
|
111
|
+
declare class TraversalVocabularyError extends DeepMemoryError {
|
|
112
|
+
readonly unknownTypes: string[];
|
|
113
|
+
constructor(unknownTypes: string[]);
|
|
114
|
+
}
|
|
115
|
+
/** Thrown when a native query times out. */
|
|
116
|
+
declare class TraversalTimeoutError extends DeepMemoryError {
|
|
117
|
+
readonly timeoutMs: number;
|
|
118
|
+
constructor(timeoutMs: number);
|
|
119
|
+
}
|
|
99
120
|
|
|
100
121
|
/** A single validation error with optional suggestion */
|
|
101
122
|
interface ValidationError {
|
|
@@ -210,6 +231,7 @@ interface MemoryRepositoryConfig {
|
|
|
210
231
|
storage: StorageProvider;
|
|
211
232
|
search?: SearchProvider;
|
|
212
233
|
embedding?: EmbeddingProvider;
|
|
234
|
+
graphTraversal?: GraphTraversalProvider;
|
|
213
235
|
vocabularyEngine: VocabularyEngine;
|
|
214
236
|
provenanceTracker: ProvenanceTracker;
|
|
215
237
|
eventBus: EventBus;
|
|
@@ -230,7 +252,7 @@ declare class MemoryRepository {
|
|
|
230
252
|
proposeVocabularyChange(proposal: VocabularyProposal): Promise<VocabularyProposalResult>;
|
|
231
253
|
/** @deprecated Use proposeVocabularyChange instead */
|
|
232
254
|
proposeVocabularyExtension(proposal: VocabularyProposal): Promise<VocabularyProposalResult>;
|
|
233
|
-
|
|
255
|
+
createEntities(inputs: CreateEntityInput[]): Promise<Entity[]>;
|
|
234
256
|
updateEntity(entityId: string, updates: UpdateEntityInput): Promise<Entity>;
|
|
235
257
|
getEntity(entityId: string, detailLevel?: DetailLevel): Promise<Entity | EntitySummary | EntityBrief | null>;
|
|
236
258
|
getBySlug(slug: string, detailLevel?: DetailLevel): Promise<Entity | EntitySummary | EntityBrief | null>;
|
|
@@ -253,7 +275,7 @@ declare class MemoryRepository {
|
|
|
253
275
|
/** Milliseconds to wait between batches for rate limiting (default 0) */
|
|
254
276
|
delayBetweenBatchesMs?: number;
|
|
255
277
|
}): Promise<ReembedResult>;
|
|
256
|
-
|
|
278
|
+
createRelationships(inputs: CreateRelationshipInput[]): Promise<Relationship[]>;
|
|
257
279
|
removeRelationship(relationshipId: string): Promise<void>;
|
|
258
280
|
getRelationships(entityId: string, options?: {
|
|
259
281
|
relationshipTypes?: string[];
|
|
@@ -272,6 +294,8 @@ declare class MemoryRepository {
|
|
|
272
294
|
}): Promise<GraphResult>;
|
|
273
295
|
exploreNeighbourhood(entityId: string, options?: ExploreOptions): Promise<Neighbourhood>;
|
|
274
296
|
findPaths(sourceId: string, targetId: string, options?: PathOptions): Promise<PathResult>;
|
|
297
|
+
traverse(spec: TraversalSpec): Promise<TraversalResult>;
|
|
298
|
+
executeNativeQuery(query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
|
|
275
299
|
searchByConcept(query: string, options?: ConceptSearchOptions): Promise<PaginatedResult<ScoredEntity>>;
|
|
276
300
|
getTimeline(entityId: string, options?: TimelineOptions): Promise<TimelineResult>;
|
|
277
301
|
getStats(): Promise<RepositoryStats>;
|
|
@@ -293,6 +317,8 @@ interface DeepMemoryConfig {
|
|
|
293
317
|
embedding?: EmbeddingProvider;
|
|
294
318
|
/** Optional: lock provider for distributed locking */
|
|
295
319
|
lock?: LockProvider;
|
|
320
|
+
/** Optional: graph traversal provider for native multi-hop queries */
|
|
321
|
+
graphTraversal?: GraphTraversalProvider;
|
|
296
322
|
/** Required: provenance context identifying the actor */
|
|
297
323
|
provenance: ProvenanceContext;
|
|
298
324
|
}
|
|
@@ -302,14 +328,15 @@ declare class DeepMemory {
|
|
|
302
328
|
private readonly embedding?;
|
|
303
329
|
/** Reserved for future distributed locking support */
|
|
304
330
|
readonly lock?: LockProvider;
|
|
331
|
+
private readonly graphTraversalProvider?;
|
|
305
332
|
private readonly provenance;
|
|
306
333
|
private readonly globalEventBus;
|
|
307
334
|
private initialised;
|
|
308
335
|
constructor(config: DeepMemoryConfig);
|
|
309
|
-
/** Initialise the storage provider (call once before use) */
|
|
336
|
+
/** Initialise the storage provider and optional providers (call once before use) */
|
|
310
337
|
private ensureInitialised;
|
|
311
338
|
/** Create or migrate the storage schema. Call once at deployment / startup, not per-request. */
|
|
312
|
-
ensureSchema(): Promise<
|
|
339
|
+
ensureSchema(): Promise<EnsureSchemaResult>;
|
|
313
340
|
private validateRepositoryId;
|
|
314
341
|
/** Create a new memory repository */
|
|
315
342
|
createRepository(config: RepositoryConfig): Promise<MemoryRepository>;
|
|
@@ -322,7 +349,7 @@ declare class DeepMemory {
|
|
|
322
349
|
/** Delete a repository */
|
|
323
350
|
deleteRepository(repositoryId: string): Promise<void>;
|
|
324
351
|
/** Export a repository to a portable archive */
|
|
325
|
-
exportRepository(repositoryId: string): Promise<ExportArchive>;
|
|
352
|
+
exportRepository(repositoryId: string, options?: ExportOptions): Promise<ExportArchive>;
|
|
326
353
|
/** Import a repository from a portable archive */
|
|
327
354
|
importRepository(archive: ExportArchive, options: ImportOptions): Promise<ImportResult>;
|
|
328
355
|
/**
|
|
@@ -330,7 +357,7 @@ declare class DeepMemory {
|
|
|
330
357
|
* Yields: manifest → vocabulary → entity chunks → relationship chunks.
|
|
331
358
|
* Use for large repositories to avoid loading everything into memory.
|
|
332
359
|
*/
|
|
333
|
-
exportRepositoryStream(repositoryId: string): AsyncGenerator<ExportStreamItem>;
|
|
360
|
+
exportRepositoryStream(repositoryId: string, options?: ExportOptions): AsyncGenerator<ExportStreamItem>;
|
|
334
361
|
/**
|
|
335
362
|
* Import a repository from a stream of chunks.
|
|
336
363
|
* Use for large repositories to avoid loading everything into memory.
|
|
@@ -350,6 +377,31 @@ declare class DeepMemory {
|
|
|
350
377
|
*/
|
|
351
378
|
declare function matchesPropertyFilters(properties: Record<string, unknown>, filters: PropertyFilter[]): boolean;
|
|
352
379
|
|
|
380
|
+
interface TraversalCompiler {
|
|
381
|
+
/** The query language this compiler targets. */
|
|
382
|
+
readonly language: 'gremlin' | 'cypher' | 'sql';
|
|
383
|
+
/** Compile a validated TraversalSpec into a native query string. */
|
|
384
|
+
compile(spec: TraversalSpec, vocabulary: MemoryVocabulary): CompiledQuery;
|
|
385
|
+
}
|
|
386
|
+
interface CompiledQuery {
|
|
387
|
+
/** The native query string. */
|
|
388
|
+
query: string;
|
|
389
|
+
/** Parameter bindings (for parameterized queries). */
|
|
390
|
+
params: Record<string, unknown>;
|
|
391
|
+
/** Estimated cost heuristic (fan-out estimation). Provider may override. */
|
|
392
|
+
estimatedFanOut: number;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
declare class GremlinCompiler implements TraversalCompiler {
|
|
396
|
+
readonly language: "gremlin";
|
|
397
|
+
compile(spec: TraversalSpec, _vocabulary: MemoryVocabulary): CompiledQuery;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
declare class CypherCompiler implements TraversalCompiler {
|
|
401
|
+
readonly language: "cypher";
|
|
402
|
+
compile(spec: TraversalSpec, _vocabulary: MemoryVocabulary): CompiledQuery;
|
|
403
|
+
}
|
|
404
|
+
|
|
353
405
|
declare class InMemoryStorageProvider implements StorageProvider {
|
|
354
406
|
private stores;
|
|
355
407
|
private getStore;
|
|
@@ -405,4 +457,4 @@ declare class NoOpEmbeddingProvider implements EmbeddingProvider {
|
|
|
405
457
|
modelId(): string;
|
|
406
458
|
}
|
|
407
459
|
|
|
408
|
-
export { BulkImportResult, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary, Neighbourhood, NoOpEmbeddingProvider, OperationCancelledError, PaginatedResult, PaginationOptions, PathOptions, PathResult, PropertyFilter, Provenance, ProvenanceContext, ProviderError, ReembedResult, Relationship, RelationshipConstraintError, RelationshipNotFoundError, RelationshipQueryOptions, RelationshipSummary, RepositoryConfig, RepositoryFilter, RepositoryNotFoundError, RepositoryStats, RepositorySummary, RepositoryUpdate, ResolvedVocabulary, ScoredEntity, SearchHit, SearchOptions, SearchProvider, SearchableEntity, StorageExploreOptions, StorageFindQuery, StorageNeighbourhood, StoragePathOptions, StoragePathResult, StorageProvider, StorageRepositoryConfig, StorageTimelineOptions, StorageTimelineResult, StoredEntity, StoredEntityUpdate, StoredRelationship, StoredRepository, StoredRepositorySummary, TimelineOptions, TimelineResult, Unsubscribe, UpdateEntityInput, VocabularyChangeRecord, VocabularyProposal, VocabularyProposalResult, VocabularyValidationError, generateId, isValidUuid, matchesPropertyFilters };
|
|
460
|
+
export { BulkImportResult, type CompiledQuery, ConceptSearchOptions, CreateEntityInput, CreateRelationshipInput, CypherCompiler, DeepMemory, type DeepMemoryConfig, DeepMemoryError, type DeepMemoryErrorCode, DeepMemoryEvent, DeepMemoryEventType, DetailLevel, DuplicateEntityError, DuplicateRelationshipError, DuplicateRepositoryError, EmbeddingProvider, EmbeddingProviderRequiredError, EnsureSchemaResult, Entity, EntityBrief, EntityNotFoundError, EntitySummary, EntityTypeDefinition, EventHandler, EventPayload, ExploreOptions, ExportArchive, ExportChunk, ExportError, ExportOptions, ExportStreamItem, FindEntitiesQuery, GovernanceConfig, GovernanceDeniedError, GraphResult, GraphTraversalProvider, GraphTraversalProviderRequiredError, GremlinCompiler, HookResult, ImportChunk, ImportError, ImportOptions, ImportResult, ImportStreamHeader, InMemorySearchProvider, InMemoryStorageProvider, InvalidInputError, LockProvider, MemoryRepository, MemoryVocabulary, Neighbourhood, NoOpEmbeddingProvider, OperationCancelledError, PaginatedResult, PaginationOptions, PathOptions, PathResult, PropertyFilter, Provenance, ProvenanceContext, ProviderError, ReembedResult, Relationship, RelationshipConstraintError, RelationshipNotFoundError, RelationshipQueryOptions, RelationshipSummary, RepositoryConfig, RepositoryFilter, RepositoryNotFoundError, RepositoryStats, RepositorySummary, RepositoryUpdate, ResolvedVocabulary, ScoredEntity, SearchHit, SearchOptions, SearchProvider, SearchableEntity, StorageExploreOptions, StorageFindQuery, StorageNeighbourhood, StoragePathOptions, StoragePathResult, StorageProvider, StorageRepositoryConfig, StorageTimelineOptions, StorageTimelineResult, StoredEntity, StoredEntityUpdate, StoredRelationship, StoredRepository, StoredRepositorySummary, TimelineOptions, TimelineResult, type TraversalCompiler, TraversalResult, TraversalSpec, TraversalTimeoutError, TraversalValidationError, TraversalVocabularyError, Unsubscribe, UpdateEntityInput, VocabularyChangeRecord, VocabularyProposal, VocabularyProposalResult, VocabularyValidationError, generateId, isValidUuid, matchesPropertyFilters };
|