@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.
@@ -812,6 +812,44 @@ interface ExportManifest {
812
812
  dimensions: number;
813
813
  note: string;
814
814
  };
815
+ /** Legal and copyright metadata — set by the publisher of the archive */
816
+ legal?: ExportLegalMetadata;
817
+ /** Indexing pipeline metadata — present when archive was produced by the indexer */
818
+ pipeline?: ExportPipelineMetadata;
819
+ }
820
+ /** Legal and copyright metadata for an export archive */
821
+ interface ExportLegalMetadata {
822
+ /** Copyright holder (e.g. "© 2026 Caterpillar Inc.") */
823
+ copyright: string;
824
+ /** SPDX license identifier or custom license name (e.g. "Apache-2.0", "LicenseRef-Proprietary") */
825
+ license?: string;
826
+ /** Full license text or URL pointing to license terms */
827
+ licenseUrl?: string;
828
+ /** Human-readable usage terms or restrictions summary */
829
+ terms?: string;
830
+ /** Organization that published this archive */
831
+ publisher?: string;
832
+ /** Contact for licensing questions (e.g. email address) */
833
+ contact?: string;
834
+ }
835
+ /** Pipeline metadata describing how the data was produced */
836
+ interface ExportPipelineMetadata {
837
+ /** LLM model used for extraction (e.g. "claude-sonnet-4-20250514") */
838
+ extractionModel: string;
839
+ /** LLM provider name (e.g. "anthropic", "vllm") */
840
+ extractionProvider?: string;
841
+ /** Embeddings model used (e.g. "Qwen/Qwen3-Embedding-8B") */
842
+ embeddingsModel?: string;
843
+ /** Number of source documents processed */
844
+ sourceCount: number;
845
+ /** Source document names or paths */
846
+ sources: string[];
847
+ /** Extraction parameters used */
848
+ parameters?: {
849
+ chunkSize?: number;
850
+ chunkOverlap?: number;
851
+ maxOutputTokens?: number;
852
+ };
815
853
  }
816
854
  /** A complete repository export archive */
817
855
  interface ExportArchive {
@@ -845,6 +883,11 @@ type ExportStreamItem = {
845
883
  sequence: number;
846
884
  isLast: boolean;
847
885
  };
886
+ /** Options for exporting a repository */
887
+ interface ExportOptions {
888
+ /** Legal/copyright metadata to embed in the export manifest */
889
+ legal?: ExportLegalMetadata;
890
+ }
848
891
  /** Options for importing a repository archive */
849
892
  interface ImportOptions {
850
893
  /** How to handle the target repository */
@@ -894,4 +937,4 @@ interface ImportResult {
894
937
  warnings: ImportWarning[];
895
938
  }
896
939
 
897
- export type { RepositorySummary as $, ReembedResult as A, BulkImportResult as B, CreateEntityInput as C, DetailLevel as D, ExportChunk as E, FindEntitiesQuery as F, GovernanceConfig as G, Relationship as H, ImportChunk as I, PropertyFilter as J, RelationshipSummary as K, GraphResult as L, MemoryVocabulary as M, ExploreOptions as N, Neighbourhood as O, PaginatedResult as P, PathOptions as Q, RepositoryFilter as R, StorageRepositoryConfig as S, PathResult as T, UpdateEntityInput as U, VocabularyChangeRecord as V, ConceptSearchOptions as W, ScoredEntity as X, TimelineOptions as Y, TimelineResult as Z, RepositoryConfig as _, StoredRepository as a, ExportArchive as a0, ImportOptions as a1, ImportResult as a2, ExportStreamItem as a3, ImportStreamHeader as a4, SearchOptions as a5, SearchHit as a6, EnrichedRelationship as a7, EntityMap as a8, EntityTypeInput as a9, ExportManifest as aa, GetEntitiesOptions as ab, GetEntityOptions as ac, GovernanceMode as ad, ImportWarning as ae, NeighbourhoodCentre as af, NeighbourhoodGroup as ag, NeighbourhoodLayer as ah, Path as ai, PropertySchema as aj, PropertyType as ak, ProvenanceFilter as al, RelationshipDirection as am, RelationshipTypeDefinition as an, RelationshipTypeInput as ao, RepositoryMetadata as ap, StorageNeighbourhoodGroup as aq, StorageNeighbourhoodLayer as ar, StoragePath as as, StorageTimelineEvent as at, TimelineEntityRef as au, TimelineEvent as av, TimelineRelationshipDetail as aw, VocabularyInput as ax, StoredRepositorySummary as b, RepositoryUpdate as c, RepositoryStats as d, PaginationOptions as e, StoredEntity as f, StoredEntityUpdate as g, StorageFindQuery as h, StoredRelationship as i, RelationshipQueryOptions as j, StorageExploreOptions as k, StorageNeighbourhood as l, StoragePathOptions as m, StoragePathResult as n, StorageTimelineOptions as o, StorageTimelineResult as p, ResolvedVocabulary as q, CreateRelationshipInput as r, EntityTypeDefinition as s, VocabularyProposal as t, VocabularyProposalResult as u, ProvenanceContext as v, Provenance as w, Entity as x, EntitySummary as y, EntityBrief as z };
940
+ export type { RepositorySummary as $, Provenance as A, BulkImportResult as B, CreateEntityInput as C, DetailLevel as D, Entity as E, FindEntitiesQuery as F, GovernanceConfig as G, ReembedResult as H, ImportChunk as I, Relationship as J, RelationshipSummary as K, GraphResult as L, MemoryVocabulary as M, ExploreOptions as N, Neighbourhood as O, PropertyFilter as P, PathOptions as Q, RepositoryFilter as R, StorageRepositoryConfig as S, PathResult as T, UpdateEntityInput as U, VocabularyChangeRecord as V, ConceptSearchOptions as W, ScoredEntity as X, TimelineOptions as Y, TimelineResult as Z, RepositoryConfig as _, EntitySummary as a, ExportOptions as a0, ExportArchive as a1, ImportOptions as a2, ImportResult as a3, ExportStreamItem as a4, ImportStreamHeader as a5, SearchOptions as a6, SearchHit as a7, EnrichedRelationship as a8, EntityMap as a9, VocabularyInput as aA, EntityTypeInput as aa, ExportLegalMetadata as ab, ExportManifest as ac, ExportPipelineMetadata as ad, GetEntitiesOptions as ae, GetEntityOptions as af, GovernanceMode as ag, ImportWarning as ah, NeighbourhoodCentre as ai, NeighbourhoodGroup as aj, NeighbourhoodLayer as ak, Path as al, PropertySchema as am, PropertyType as an, ProvenanceFilter as ao, RelationshipDirection as ap, RelationshipTypeDefinition as aq, RelationshipTypeInput as ar, RepositoryMetadata as as, StorageNeighbourhoodGroup as at, StorageNeighbourhoodLayer as au, StoragePath as av, StorageTimelineEvent as aw, TimelineEntityRef as ax, TimelineEvent as ay, TimelineRelationshipDetail as az, EntityBrief as b, StoredRepository as c, PaginatedResult as d, StoredRepositorySummary as e, RepositoryUpdate as f, RepositoryStats as g, PaginationOptions as h, StoredEntity as i, StoredEntityUpdate as j, StorageFindQuery as k, StoredRelationship as l, RelationshipQueryOptions as m, StorageExploreOptions as n, StorageNeighbourhood as o, StoragePathOptions as p, StoragePathResult as q, StorageTimelineOptions as r, StorageTimelineResult as s, ExportChunk as t, ResolvedVocabulary as u, CreateRelationshipInput as v, EntityTypeDefinition as w, VocabularyProposal as x, VocabularyProposalResult as y, ProvenanceContext as z };
@@ -812,6 +812,44 @@ interface ExportManifest {
812
812
  dimensions: number;
813
813
  note: string;
814
814
  };
815
+ /** Legal and copyright metadata — set by the publisher of the archive */
816
+ legal?: ExportLegalMetadata;
817
+ /** Indexing pipeline metadata — present when archive was produced by the indexer */
818
+ pipeline?: ExportPipelineMetadata;
819
+ }
820
+ /** Legal and copyright metadata for an export archive */
821
+ interface ExportLegalMetadata {
822
+ /** Copyright holder (e.g. "© 2026 Caterpillar Inc.") */
823
+ copyright: string;
824
+ /** SPDX license identifier or custom license name (e.g. "Apache-2.0", "LicenseRef-Proprietary") */
825
+ license?: string;
826
+ /** Full license text or URL pointing to license terms */
827
+ licenseUrl?: string;
828
+ /** Human-readable usage terms or restrictions summary */
829
+ terms?: string;
830
+ /** Organization that published this archive */
831
+ publisher?: string;
832
+ /** Contact for licensing questions (e.g. email address) */
833
+ contact?: string;
834
+ }
835
+ /** Pipeline metadata describing how the data was produced */
836
+ interface ExportPipelineMetadata {
837
+ /** LLM model used for extraction (e.g. "claude-sonnet-4-20250514") */
838
+ extractionModel: string;
839
+ /** LLM provider name (e.g. "anthropic", "vllm") */
840
+ extractionProvider?: string;
841
+ /** Embeddings model used (e.g. "Qwen/Qwen3-Embedding-8B") */
842
+ embeddingsModel?: string;
843
+ /** Number of source documents processed */
844
+ sourceCount: number;
845
+ /** Source document names or paths */
846
+ sources: string[];
847
+ /** Extraction parameters used */
848
+ parameters?: {
849
+ chunkSize?: number;
850
+ chunkOverlap?: number;
851
+ maxOutputTokens?: number;
852
+ };
815
853
  }
816
854
  /** A complete repository export archive */
817
855
  interface ExportArchive {
@@ -845,6 +883,11 @@ type ExportStreamItem = {
845
883
  sequence: number;
846
884
  isLast: boolean;
847
885
  };
886
+ /** Options for exporting a repository */
887
+ interface ExportOptions {
888
+ /** Legal/copyright metadata to embed in the export manifest */
889
+ legal?: ExportLegalMetadata;
890
+ }
848
891
  /** Options for importing a repository archive */
849
892
  interface ImportOptions {
850
893
  /** How to handle the target repository */
@@ -894,4 +937,4 @@ interface ImportResult {
894
937
  warnings: ImportWarning[];
895
938
  }
896
939
 
897
- export type { RepositorySummary as $, ReembedResult as A, BulkImportResult as B, CreateEntityInput as C, DetailLevel as D, ExportChunk as E, FindEntitiesQuery as F, GovernanceConfig as G, Relationship as H, ImportChunk as I, PropertyFilter as J, RelationshipSummary as K, GraphResult as L, MemoryVocabulary as M, ExploreOptions as N, Neighbourhood as O, PaginatedResult as P, PathOptions as Q, RepositoryFilter as R, StorageRepositoryConfig as S, PathResult as T, UpdateEntityInput as U, VocabularyChangeRecord as V, ConceptSearchOptions as W, ScoredEntity as X, TimelineOptions as Y, TimelineResult as Z, RepositoryConfig as _, StoredRepository as a, ExportArchive as a0, ImportOptions as a1, ImportResult as a2, ExportStreamItem as a3, ImportStreamHeader as a4, SearchOptions as a5, SearchHit as a6, EnrichedRelationship as a7, EntityMap as a8, EntityTypeInput as a9, ExportManifest as aa, GetEntitiesOptions as ab, GetEntityOptions as ac, GovernanceMode as ad, ImportWarning as ae, NeighbourhoodCentre as af, NeighbourhoodGroup as ag, NeighbourhoodLayer as ah, Path as ai, PropertySchema as aj, PropertyType as ak, ProvenanceFilter as al, RelationshipDirection as am, RelationshipTypeDefinition as an, RelationshipTypeInput as ao, RepositoryMetadata as ap, StorageNeighbourhoodGroup as aq, StorageNeighbourhoodLayer as ar, StoragePath as as, StorageTimelineEvent as at, TimelineEntityRef as au, TimelineEvent as av, TimelineRelationshipDetail as aw, VocabularyInput as ax, StoredRepositorySummary as b, RepositoryUpdate as c, RepositoryStats as d, PaginationOptions as e, StoredEntity as f, StoredEntityUpdate as g, StorageFindQuery as h, StoredRelationship as i, RelationshipQueryOptions as j, StorageExploreOptions as k, StorageNeighbourhood as l, StoragePathOptions as m, StoragePathResult as n, StorageTimelineOptions as o, StorageTimelineResult as p, ResolvedVocabulary as q, CreateRelationshipInput as r, EntityTypeDefinition as s, VocabularyProposal as t, VocabularyProposalResult as u, ProvenanceContext as v, Provenance as w, Entity as x, EntitySummary as y, EntityBrief as z };
940
+ export type { RepositorySummary as $, Provenance as A, BulkImportResult as B, CreateEntityInput as C, DetailLevel as D, Entity as E, FindEntitiesQuery as F, GovernanceConfig as G, ReembedResult as H, ImportChunk as I, Relationship as J, RelationshipSummary as K, GraphResult as L, MemoryVocabulary as M, ExploreOptions as N, Neighbourhood as O, PropertyFilter as P, PathOptions as Q, RepositoryFilter as R, StorageRepositoryConfig as S, PathResult as T, UpdateEntityInput as U, VocabularyChangeRecord as V, ConceptSearchOptions as W, ScoredEntity as X, TimelineOptions as Y, TimelineResult as Z, RepositoryConfig as _, EntitySummary as a, ExportOptions as a0, ExportArchive as a1, ImportOptions as a2, ImportResult as a3, ExportStreamItem as a4, ImportStreamHeader as a5, SearchOptions as a6, SearchHit as a7, EnrichedRelationship as a8, EntityMap as a9, VocabularyInput as aA, EntityTypeInput as aa, ExportLegalMetadata as ab, ExportManifest as ac, ExportPipelineMetadata as ad, GetEntitiesOptions as ae, GetEntityOptions as af, GovernanceMode as ag, ImportWarning as ah, NeighbourhoodCentre as ai, NeighbourhoodGroup as aj, NeighbourhoodLayer as ak, Path as al, PropertySchema as am, PropertyType as an, ProvenanceFilter as ao, RelationshipDirection as ap, RelationshipTypeDefinition as aq, RelationshipTypeInput as ar, RepositoryMetadata as as, StorageNeighbourhoodGroup as at, StorageNeighbourhoodLayer as au, StoragePath as av, StorageTimelineEvent as aw, TimelineEntityRef as ax, TimelineEvent as ay, TimelineRelationshipDetail as az, EntityBrief as b, StoredRepository as c, PaginatedResult as d, StoredRepositorySummary as e, RepositoryUpdate as f, RepositoryStats as g, PaginationOptions as h, StoredEntity as i, StoredEntityUpdate as j, StorageFindQuery as k, StoredRelationship as l, RelationshipQueryOptions as m, StorageExploreOptions as n, StorageNeighbourhood as o, StoragePathOptions as p, StoragePathResult as q, StorageTimelineOptions as r, StorageTimelineResult as s, ExportChunk as t, ResolvedVocabulary as u, CreateRelationshipInput as v, EntityTypeDefinition as w, VocabularyProposal as x, VocabularyProposalResult as y, ProvenanceContext as z };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/providers/index.ts"],"sourcesContent":["// Provider interface re-exports — @utaba/deep-memory/providers\n\nexport type { StorageProvider } from './StorageProvider.js';\nexport type { EmbeddingProvider } from './EmbeddingProvider.js';\nexport type {\n SearchProvider,\n SearchableEntity,\n} from './SearchProvider.js';\nexport type {\n LockProvider,\n LockOptions,\n LockHandle,\n} from './LockProvider.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/providers/index.ts"],"sourcesContent":["// Provider interface re-exports — @utaba/deep-memory/providers\n\nexport type { StorageProvider, EnsureSchemaResult } from './StorageProvider.js';\nexport type { EmbeddingProvider } from './EmbeddingProvider.js';\nexport type {\n SearchProvider,\n SearchableEntity,\n} from './SearchProvider.js';\nexport type {\n LockProvider,\n LockOptions,\n LockHandle,\n} from './LockProvider.js';\nexport type {\n GraphTraversalProvider,\n GraphTraversalCapabilities,\n} from './GraphTraversalProvider.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,5 +1,6 @@
1
- export { S as StorageProvider } from '../StorageProvider-CkFjdboX.cjs';
2
- import { a5 as SearchOptions, P as PaginatedResult, a6 as SearchHit } from '../portability-DdlNYXGX.cjs';
1
+ export { E as EnsureSchemaResult, S as StorageProvider } from '../StorageProvider-C3tKhfuw.cjs';
2
+ import { a6 as SearchOptions, d as PaginatedResult, a7 as SearchHit } from '../portability-DdjsCB07.cjs';
3
+ import { T as TraversalSpec, a as TraversalResult } from '../traversal-BB_yERbf.cjs';
3
4
 
4
5
  /**
5
6
  * EmbeddingProvider — enables semantic search and vocabulary deduplication.
@@ -72,4 +73,56 @@ interface LockHandle {
72
73
  extend(additionalMs: number): Promise<void>;
73
74
  }
74
75
 
75
- export type { EmbeddingProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
76
+ /**
77
+ * Optional provider for native graph traversal.
78
+ * When registered, enables multi-hop traversal queries and native graph
79
+ * query pass-through. When absent, the library falls back to application-level
80
+ * BFS over StorageProvider for structured traversals.
81
+ */
82
+ interface GraphTraversalProvider {
83
+ /**
84
+ * Execute a structured traversal compiled from a TraversalSpec.
85
+ * The library may pass both the spec and a pre-compiled query string.
86
+ * The provider can use either — the compiled query is a suggestion,
87
+ * not a requirement.
88
+ */
89
+ traverse(repositoryId: string, spec: TraversalSpec, compiledQuery?: string): Promise<TraversalResult>;
90
+ /**
91
+ * Execute a native graph query (Gremlin, Cypher, etc.).
92
+ * The library passes the query string through without modification.
93
+ * The provider is responsible for execution and result mapping.
94
+ *
95
+ * Implementers decide whether to expose this to agents.
96
+ * The library does not add safety guards — that is the implementer's
97
+ * responsibility.
98
+ */
99
+ executeNativeQuery(repositoryId: string, query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
100
+ /**
101
+ * Report provider capabilities so the library can adapt
102
+ * DSL compilation and validate traversal specs accordingly.
103
+ */
104
+ getCapabilities(): GraphTraversalCapabilities;
105
+ /** Optional lifecycle hooks, matching StorageProvider pattern. */
106
+ initialise?(): Promise<void>;
107
+ dispose?(): Promise<void>;
108
+ }
109
+ interface GraphTraversalCapabilities {
110
+ /** Whether executeNativeQuery() is implemented. */
111
+ supportsNativeQuery: boolean;
112
+ /** The native query language, for DSL compilation targeting. */
113
+ nativeQueryLanguage: 'gremlin' | 'cypher' | 'sql' | 'other';
114
+ /** Maximum traversal depth the provider supports. */
115
+ maxTraversalDepth: number;
116
+ /** Whether the provider supports property filters on relationships during traversal. */
117
+ supportsRelationshipPropertyFilters: boolean;
118
+ /** Whether the provider supports property filters on entities during traversal. */
119
+ supportsEntityPropertyFilters: boolean;
120
+ /** Whether the provider supports aggregation (count, sum, avg) on terminal results. */
121
+ supportsAggregation: boolean;
122
+ /** Whether the provider supports repeat/loop traversal steps. */
123
+ supportsRepeat: boolean;
124
+ /** Whether the provider supports dedup across traversal results. */
125
+ supportsDedup: boolean;
126
+ }
127
+
128
+ export type { EmbeddingProvider, GraphTraversalCapabilities, GraphTraversalProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
@@ -1,5 +1,6 @@
1
- export { S as StorageProvider } from '../StorageProvider-CJjz8uBY.js';
2
- import { a5 as SearchOptions, P as PaginatedResult, a6 as SearchHit } from '../portability-DdlNYXGX.js';
1
+ export { E as EnsureSchemaResult, S as StorageProvider } from '../StorageProvider-DR9HLYHJ.js';
2
+ import { a6 as SearchOptions, d as PaginatedResult, a7 as SearchHit } from '../portability-DdjsCB07.js';
3
+ import { T as TraversalSpec, a as TraversalResult } from '../traversal-9JdiqjZ9.js';
3
4
 
4
5
  /**
5
6
  * EmbeddingProvider — enables semantic search and vocabulary deduplication.
@@ -72,4 +73,56 @@ interface LockHandle {
72
73
  extend(additionalMs: number): Promise<void>;
73
74
  }
74
75
 
75
- export type { EmbeddingProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
76
+ /**
77
+ * Optional provider for native graph traversal.
78
+ * When registered, enables multi-hop traversal queries and native graph
79
+ * query pass-through. When absent, the library falls back to application-level
80
+ * BFS over StorageProvider for structured traversals.
81
+ */
82
+ interface GraphTraversalProvider {
83
+ /**
84
+ * Execute a structured traversal compiled from a TraversalSpec.
85
+ * The library may pass both the spec and a pre-compiled query string.
86
+ * The provider can use either — the compiled query is a suggestion,
87
+ * not a requirement.
88
+ */
89
+ traverse(repositoryId: string, spec: TraversalSpec, compiledQuery?: string): Promise<TraversalResult>;
90
+ /**
91
+ * Execute a native graph query (Gremlin, Cypher, etc.).
92
+ * The library passes the query string through without modification.
93
+ * The provider is responsible for execution and result mapping.
94
+ *
95
+ * Implementers decide whether to expose this to agents.
96
+ * The library does not add safety guards — that is the implementer's
97
+ * responsibility.
98
+ */
99
+ executeNativeQuery(repositoryId: string, query: string, params?: Record<string, unknown>): Promise<TraversalResult>;
100
+ /**
101
+ * Report provider capabilities so the library can adapt
102
+ * DSL compilation and validate traversal specs accordingly.
103
+ */
104
+ getCapabilities(): GraphTraversalCapabilities;
105
+ /** Optional lifecycle hooks, matching StorageProvider pattern. */
106
+ initialise?(): Promise<void>;
107
+ dispose?(): Promise<void>;
108
+ }
109
+ interface GraphTraversalCapabilities {
110
+ /** Whether executeNativeQuery() is implemented. */
111
+ supportsNativeQuery: boolean;
112
+ /** The native query language, for DSL compilation targeting. */
113
+ nativeQueryLanguage: 'gremlin' | 'cypher' | 'sql' | 'other';
114
+ /** Maximum traversal depth the provider supports. */
115
+ maxTraversalDepth: number;
116
+ /** Whether the provider supports property filters on relationships during traversal. */
117
+ supportsRelationshipPropertyFilters: boolean;
118
+ /** Whether the provider supports property filters on entities during traversal. */
119
+ supportsEntityPropertyFilters: boolean;
120
+ /** Whether the provider supports aggregation (count, sum, avg) on terminal results. */
121
+ supportsAggregation: boolean;
122
+ /** Whether the provider supports repeat/loop traversal steps. */
123
+ supportsRepeat: boolean;
124
+ /** Whether the provider supports dedup across traversal results. */
125
+ supportsDedup: boolean;
126
+ }
127
+
128
+ export type { EmbeddingProvider, GraphTraversalCapabilities, GraphTraversalProvider, LockHandle, LockOptions, LockProvider, SearchProvider, SearchableEntity };
@@ -1,5 +1,5 @@
1
- import { S as StorageProvider } from '../StorageProvider-CkFjdboX.cjs';
2
- import '../portability-DdlNYXGX.cjs';
1
+ import { S as StorageProvider } from '../StorageProvider-C3tKhfuw.cjs';
2
+ import '../portability-DdjsCB07.cjs';
3
3
 
4
4
  /**
5
5
  * Run the full StorageProvider conformance test suite.
@@ -1,5 +1,5 @@
1
- import { S as StorageProvider } from '../StorageProvider-CJjz8uBY.js';
2
- import '../portability-DdlNYXGX.js';
1
+ import { S as StorageProvider } from '../StorageProvider-DR9HLYHJ.js';
2
+ import '../portability-DdjsCB07.js';
3
3
 
4
4
  /**
5
5
  * Run the full StorageProvider conformance test suite.
@@ -0,0 +1,177 @@
1
+ import { P as PropertyFilter, D as DetailLevel, E as Entity, a as EntitySummary, b as EntityBrief } from './portability-DdjsCB07.js';
2
+
3
+ /**
4
+ * A structured traversal specification that can be compiled to
5
+ * Gremlin, Cypher, or executed via application-level BFS.
6
+ *
7
+ * Designed to be expressible by AI agents without raw query
8
+ * language knowledge, while covering the common multi-hop
9
+ * traversal patterns needed for knowledge graph exploration.
10
+ */
11
+ interface TraversalSpec {
12
+ /** Starting point for the traversal. */
13
+ start: TraversalStart;
14
+ /** Ordered sequence of traversal steps. */
15
+ steps: TraversalStep[];
16
+ /** What to return from the traversal. */
17
+ returnMode: TraversalReturnMode;
18
+ /**
19
+ * Maximum number of results to return.
20
+ * Default: 50. Max: 200.
21
+ * Applied to the final result set after traversal.
22
+ */
23
+ limit?: number;
24
+ /**
25
+ * Pagination offset for the final result set.
26
+ * Default: 0.
27
+ */
28
+ offset?: number;
29
+ /** Detail level for returned entities. Default: 'summary'. */
30
+ detailLevel?: DetailLevel;
31
+ /** Whether to deduplicate entities in the result set. Default: true. */
32
+ dedup?: boolean;
33
+ }
34
+ /** Where the traversal begins. */
35
+ interface TraversalStart {
36
+ /** Start from a specific entity by ID (GUID) or slug. */
37
+ entityId?: string;
38
+ /** Start from all entities of a given type. Requires limit on the spec. */
39
+ entityType?: string;
40
+ /** Filter starting entities by property values. */
41
+ filter?: PropertyFilter[];
42
+ }
43
+ /**
44
+ * A single step in the traversal — one hop along a relationship edge.
45
+ */
46
+ interface TraversalStep {
47
+ /** Direction to traverse. */
48
+ direction: 'out' | 'in' | 'both';
49
+ /**
50
+ * Relationship types to follow in this step.
51
+ * Validated against the repository vocabulary.
52
+ * If omitted, follows all relationship types.
53
+ */
54
+ relationshipTypes?: string[];
55
+ /**
56
+ * Filter target entities by type.
57
+ * If omitted, accepts all entity types.
58
+ */
59
+ entityTypes?: string[];
60
+ /** Filter relationships by property values during traversal. */
61
+ relationshipFilter?: PropertyFilter[];
62
+ /** Filter target entities by property values during traversal. */
63
+ entityFilter?: PropertyFilter[];
64
+ /**
65
+ * Repeat this step up to maxDepth times.
66
+ * Useful for variable-depth traversals like "find all sub-components
67
+ * at any depth" via repeated CONTAINS hops.
68
+ *
69
+ * When present, this step becomes a loop. The step's direction,
70
+ * relationshipTypes, and filters apply to each iteration.
71
+ */
72
+ repeat?: {
73
+ /**
74
+ * Maximum number of times to repeat this step.
75
+ * Mandatory — no unbounded recursion.
76
+ * Capped by provider's maxTraversalDepth.
77
+ */
78
+ maxDepth: number;
79
+ /**
80
+ * Stop condition: stop expanding a path when the current entity
81
+ * matches these filters. The matching entity IS included in results.
82
+ */
83
+ until?: PropertyFilter[];
84
+ /** Whether to include intermediate entities or only terminal ones. Default: true. */
85
+ emitIntermediates?: boolean;
86
+ };
87
+ }
88
+ /** What the traversal returns. */
89
+ type TraversalReturnMode =
90
+ /** Return only entities at the final step (most common). */
91
+ 'terminal'
92
+ /** Return full paths (all entities and relationships from start to end). */
93
+ | 'path'
94
+ /** Return all entities encountered during traversal (every step). */
95
+ | 'all';
96
+ /**
97
+ * Result of a graph traversal, including query metadata for
98
+ * implementers to use in audit, billing, and circuit breaker logic.
99
+ */
100
+ interface TraversalResult {
101
+ /** Entities in the result set, projected to the requested detail level. */
102
+ entities: Array<Entity | EntitySummary | EntityBrief>;
103
+ /**
104
+ * Relationships in the result set.
105
+ * Present when returnMode is 'path' or 'all'.
106
+ */
107
+ relationships?: TraversalRelationship[];
108
+ /**
109
+ * Full paths from start to terminal entities.
110
+ * Present only when returnMode is 'path'.
111
+ */
112
+ paths?: TraversalPath[];
113
+ /** Total number of results matching the traversal (before limit/offset). */
114
+ total: number;
115
+ /** Number of results returned in this response. */
116
+ returned: number;
117
+ /** Whether more results exist beyond offset + limit. */
118
+ hasMore: boolean;
119
+ /** Query execution metadata. */
120
+ queryMetadata: QueryMetadata;
121
+ }
122
+ interface TraversalRelationship {
123
+ id: string;
124
+ type: string;
125
+ sourceEntityId: string;
126
+ targetEntityId: string;
127
+ direction: 'outbound' | 'inbound';
128
+ properties: Record<string, unknown>;
129
+ }
130
+ interface TraversalPath {
131
+ /** Number of hops in this path. */
132
+ length: number;
133
+ /** Ordered sequence of entities from start to end. */
134
+ entities: Array<Entity | EntitySummary | EntityBrief>;
135
+ /** Ordered sequence of relationships connecting the entities. */
136
+ relationships: TraversalRelationship[];
137
+ }
138
+ /**
139
+ * Metadata about query execution.
140
+ * Providers populate this from database response headers/metrics.
141
+ * Implementers use this for audit, billing, and circuit breaker logic.
142
+ */
143
+ interface QueryMetadata {
144
+ /** Wall-clock execution time in milliseconds. */
145
+ executionTimeMs: number;
146
+ /**
147
+ * Provider-specific resource cost.
148
+ * CosmosDB: { units: 'RU', value: 42.3 }
149
+ * Neo4j: { units: 'db_hits', value: 1250 }
150
+ * SQL Server: { units: 'logical_reads', value: 340 }
151
+ */
152
+ resourceCost?: {
153
+ units: string;
154
+ value: number;
155
+ };
156
+ /**
157
+ * The native query that was actually executed.
158
+ * Useful for debugging DSL compilation and for implementers
159
+ * building query audit logs.
160
+ * Only populated when the traversal was compiled from a spec.
161
+ */
162
+ compiledQuery?: string;
163
+ /** The native query language of the compiled query. */
164
+ compiledQueryLanguage?: 'gremlin' | 'cypher' | 'sql';
165
+ /** Limits that were applied during execution. */
166
+ appliedLimits: {
167
+ timeoutMs?: number;
168
+ maxResults: number;
169
+ maxDepth?: number;
170
+ };
171
+ /** Whether the result was truncated by any limit. */
172
+ truncated: boolean;
173
+ /** Reason for truncation, if truncated. */
174
+ truncationReason?: 'result_limit' | 'timeout' | 'cost_limit' | 'depth_limit';
175
+ }
176
+
177
+ export type { QueryMetadata as Q, TraversalSpec as T, TraversalResult as a, TraversalPath as b, TraversalRelationship as c, TraversalReturnMode as d, TraversalStart as e, TraversalStep as f };
@@ -0,0 +1,177 @@
1
+ import { P as PropertyFilter, D as DetailLevel, E as Entity, a as EntitySummary, b as EntityBrief } from './portability-DdjsCB07.cjs';
2
+
3
+ /**
4
+ * A structured traversal specification that can be compiled to
5
+ * Gremlin, Cypher, or executed via application-level BFS.
6
+ *
7
+ * Designed to be expressible by AI agents without raw query
8
+ * language knowledge, while covering the common multi-hop
9
+ * traversal patterns needed for knowledge graph exploration.
10
+ */
11
+ interface TraversalSpec {
12
+ /** Starting point for the traversal. */
13
+ start: TraversalStart;
14
+ /** Ordered sequence of traversal steps. */
15
+ steps: TraversalStep[];
16
+ /** What to return from the traversal. */
17
+ returnMode: TraversalReturnMode;
18
+ /**
19
+ * Maximum number of results to return.
20
+ * Default: 50. Max: 200.
21
+ * Applied to the final result set after traversal.
22
+ */
23
+ limit?: number;
24
+ /**
25
+ * Pagination offset for the final result set.
26
+ * Default: 0.
27
+ */
28
+ offset?: number;
29
+ /** Detail level for returned entities. Default: 'summary'. */
30
+ detailLevel?: DetailLevel;
31
+ /** Whether to deduplicate entities in the result set. Default: true. */
32
+ dedup?: boolean;
33
+ }
34
+ /** Where the traversal begins. */
35
+ interface TraversalStart {
36
+ /** Start from a specific entity by ID (GUID) or slug. */
37
+ entityId?: string;
38
+ /** Start from all entities of a given type. Requires limit on the spec. */
39
+ entityType?: string;
40
+ /** Filter starting entities by property values. */
41
+ filter?: PropertyFilter[];
42
+ }
43
+ /**
44
+ * A single step in the traversal — one hop along a relationship edge.
45
+ */
46
+ interface TraversalStep {
47
+ /** Direction to traverse. */
48
+ direction: 'out' | 'in' | 'both';
49
+ /**
50
+ * Relationship types to follow in this step.
51
+ * Validated against the repository vocabulary.
52
+ * If omitted, follows all relationship types.
53
+ */
54
+ relationshipTypes?: string[];
55
+ /**
56
+ * Filter target entities by type.
57
+ * If omitted, accepts all entity types.
58
+ */
59
+ entityTypes?: string[];
60
+ /** Filter relationships by property values during traversal. */
61
+ relationshipFilter?: PropertyFilter[];
62
+ /** Filter target entities by property values during traversal. */
63
+ entityFilter?: PropertyFilter[];
64
+ /**
65
+ * Repeat this step up to maxDepth times.
66
+ * Useful for variable-depth traversals like "find all sub-components
67
+ * at any depth" via repeated CONTAINS hops.
68
+ *
69
+ * When present, this step becomes a loop. The step's direction,
70
+ * relationshipTypes, and filters apply to each iteration.
71
+ */
72
+ repeat?: {
73
+ /**
74
+ * Maximum number of times to repeat this step.
75
+ * Mandatory — no unbounded recursion.
76
+ * Capped by provider's maxTraversalDepth.
77
+ */
78
+ maxDepth: number;
79
+ /**
80
+ * Stop condition: stop expanding a path when the current entity
81
+ * matches these filters. The matching entity IS included in results.
82
+ */
83
+ until?: PropertyFilter[];
84
+ /** Whether to include intermediate entities or only terminal ones. Default: true. */
85
+ emitIntermediates?: boolean;
86
+ };
87
+ }
88
+ /** What the traversal returns. */
89
+ type TraversalReturnMode =
90
+ /** Return only entities at the final step (most common). */
91
+ 'terminal'
92
+ /** Return full paths (all entities and relationships from start to end). */
93
+ | 'path'
94
+ /** Return all entities encountered during traversal (every step). */
95
+ | 'all';
96
+ /**
97
+ * Result of a graph traversal, including query metadata for
98
+ * implementers to use in audit, billing, and circuit breaker logic.
99
+ */
100
+ interface TraversalResult {
101
+ /** Entities in the result set, projected to the requested detail level. */
102
+ entities: Array<Entity | EntitySummary | EntityBrief>;
103
+ /**
104
+ * Relationships in the result set.
105
+ * Present when returnMode is 'path' or 'all'.
106
+ */
107
+ relationships?: TraversalRelationship[];
108
+ /**
109
+ * Full paths from start to terminal entities.
110
+ * Present only when returnMode is 'path'.
111
+ */
112
+ paths?: TraversalPath[];
113
+ /** Total number of results matching the traversal (before limit/offset). */
114
+ total: number;
115
+ /** Number of results returned in this response. */
116
+ returned: number;
117
+ /** Whether more results exist beyond offset + limit. */
118
+ hasMore: boolean;
119
+ /** Query execution metadata. */
120
+ queryMetadata: QueryMetadata;
121
+ }
122
+ interface TraversalRelationship {
123
+ id: string;
124
+ type: string;
125
+ sourceEntityId: string;
126
+ targetEntityId: string;
127
+ direction: 'outbound' | 'inbound';
128
+ properties: Record<string, unknown>;
129
+ }
130
+ interface TraversalPath {
131
+ /** Number of hops in this path. */
132
+ length: number;
133
+ /** Ordered sequence of entities from start to end. */
134
+ entities: Array<Entity | EntitySummary | EntityBrief>;
135
+ /** Ordered sequence of relationships connecting the entities. */
136
+ relationships: TraversalRelationship[];
137
+ }
138
+ /**
139
+ * Metadata about query execution.
140
+ * Providers populate this from database response headers/metrics.
141
+ * Implementers use this for audit, billing, and circuit breaker logic.
142
+ */
143
+ interface QueryMetadata {
144
+ /** Wall-clock execution time in milliseconds. */
145
+ executionTimeMs: number;
146
+ /**
147
+ * Provider-specific resource cost.
148
+ * CosmosDB: { units: 'RU', value: 42.3 }
149
+ * Neo4j: { units: 'db_hits', value: 1250 }
150
+ * SQL Server: { units: 'logical_reads', value: 340 }
151
+ */
152
+ resourceCost?: {
153
+ units: string;
154
+ value: number;
155
+ };
156
+ /**
157
+ * The native query that was actually executed.
158
+ * Useful for debugging DSL compilation and for implementers
159
+ * building query audit logs.
160
+ * Only populated when the traversal was compiled from a spec.
161
+ */
162
+ compiledQuery?: string;
163
+ /** The native query language of the compiled query. */
164
+ compiledQueryLanguage?: 'gremlin' | 'cypher' | 'sql';
165
+ /** Limits that were applied during execution. */
166
+ appliedLimits: {
167
+ timeoutMs?: number;
168
+ maxResults: number;
169
+ maxDepth?: number;
170
+ };
171
+ /** Whether the result was truncated by any limit. */
172
+ truncated: boolean;
173
+ /** Reason for truncation, if truncated. */
174
+ truncationReason?: 'result_limit' | 'timeout' | 'cost_limit' | 'depth_limit';
175
+ }
176
+
177
+ export type { QueryMetadata as Q, TraversalSpec as T, TraversalResult as a, TraversalPath as b, TraversalRelationship as c, TraversalReturnMode as d, TraversalStart as e, TraversalStep as f };