@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/index.d.cts CHANGED
@@ -1,12 +1,14 @@
1
- import { G as GovernanceConfig, M as MemoryVocabulary, q as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, r as CreateRelationshipInput, s as EntityTypeDefinition, t as VocabularyProposal, u as VocabularyProposalResult, v as ProvenanceContext, w as Provenance, x as Entity, D as DetailLevel, y as EntitySummary, z as EntityBrief, F as FindEntitiesQuery, P as PaginatedResult, A as ReembedResult, H as Relationship, J 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, d as RepositoryStats, _ as RepositoryConfig, R as RepositoryFilter, $ as RepositorySummary, c as RepositoryUpdate, a as StoredRepository, a0 as ExportArchive, a1 as ImportOptions, a2 as ImportResult, a3 as ExportStreamItem, a4 as ImportStreamHeader, I as ImportChunk, S as StorageRepositoryConfig, b as StoredRepositorySummary, e as PaginationOptions, V as VocabularyChangeRecord, f as StoredEntity, g as StoredEntityUpdate, h as StorageFindQuery, i as StoredRelationship, j as RelationshipQueryOptions, k as StorageExploreOptions, l as StorageNeighbourhood, m as StoragePathOptions, n as StoragePathResult, o as StorageTimelineOptions, p as StorageTimelineResult, E as ExportChunk, B as BulkImportResult, a5 as SearchOptions, a6 as SearchHit } from './portability-DdlNYXGX.cjs';
2
- export { a7 as EnrichedRelationship, a8 as EntityMap, a9 as EntityTypeInput, aa as ExportManifest, ab as GetEntitiesOptions, ac as GetEntityOptions, ad as GovernanceMode, ae as ImportWarning, af as NeighbourhoodCentre, ag as NeighbourhoodGroup, ah as NeighbourhoodLayer, ai as Path, aj as PropertySchema, ak as PropertyType, al as ProvenanceFilter, am as RelationshipDirection, an as RelationshipTypeDefinition, ao as RelationshipTypeInput, ap as RepositoryMetadata, aq as StorageNeighbourhoodGroup, ar as StorageNeighbourhoodLayer, as as StoragePath, at as StorageTimelineEvent, au as TimelineEntityRef, av as TimelineEvent, aw as TimelineRelationshipDetail, ax as VocabularyInput } from './portability-DdlNYXGX.cjs';
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 { S as StorageProvider } from './StorageProvider-CkFjdboX.cjs';
5
- import { EmbeddingProvider, SearchProvider, LockProvider, SearchableEntity } from './providers/index.cjs';
6
- export { LockHandle, LockOptions } from './providers/index.cjs';
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
- createEntity(input: CreateEntityInput): Promise<Entity>;
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
- createRelationship(input: CreateRelationshipInput): Promise<Relationship>;
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<void>;
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, q as ResolvedVocabulary, C as CreateEntityInput, U as UpdateEntityInput, r as CreateRelationshipInput, s as EntityTypeDefinition, t as VocabularyProposal, u as VocabularyProposalResult, v as ProvenanceContext, w as Provenance, x as Entity, D as DetailLevel, y as EntitySummary, z as EntityBrief, F as FindEntitiesQuery, P as PaginatedResult, A as ReembedResult, H as Relationship, J 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, d as RepositoryStats, _ as RepositoryConfig, R as RepositoryFilter, $ as RepositorySummary, c as RepositoryUpdate, a as StoredRepository, a0 as ExportArchive, a1 as ImportOptions, a2 as ImportResult, a3 as ExportStreamItem, a4 as ImportStreamHeader, I as ImportChunk, S as StorageRepositoryConfig, b as StoredRepositorySummary, e as PaginationOptions, V as VocabularyChangeRecord, f as StoredEntity, g as StoredEntityUpdate, h as StorageFindQuery, i as StoredRelationship, j as RelationshipQueryOptions, k as StorageExploreOptions, l as StorageNeighbourhood, m as StoragePathOptions, n as StoragePathResult, o as StorageTimelineOptions, p as StorageTimelineResult, E as ExportChunk, B as BulkImportResult, a5 as SearchOptions, a6 as SearchHit } from './portability-DdlNYXGX.js';
2
- export { a7 as EnrichedRelationship, a8 as EntityMap, a9 as EntityTypeInput, aa as ExportManifest, ab as GetEntitiesOptions, ac as GetEntityOptions, ad as GovernanceMode, ae as ImportWarning, af as NeighbourhoodCentre, ag as NeighbourhoodGroup, ah as NeighbourhoodLayer, ai as Path, aj as PropertySchema, ak as PropertyType, al as ProvenanceFilter, am as RelationshipDirection, an as RelationshipTypeDefinition, ao as RelationshipTypeInput, ap as RepositoryMetadata, aq as StorageNeighbourhoodGroup, ar as StorageNeighbourhoodLayer, as as StoragePath, at as StorageTimelineEvent, au as TimelineEntityRef, av as TimelineEvent, aw as TimelineRelationshipDetail, ax as VocabularyInput } from './portability-DdlNYXGX.js';
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 { S as StorageProvider } from './StorageProvider-CJjz8uBY.js';
5
- import { EmbeddingProvider, SearchProvider, LockProvider, SearchableEntity } from './providers/index.js';
6
- export { LockHandle, LockOptions } from './providers/index.js';
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
- createEntity(input: CreateEntityInput): Promise<Entity>;
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
- createRelationship(input: CreateRelationshipInput): Promise<Relationship>;
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<void>;
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 };