@utaba/deep-memory 0.16.0 → 0.18.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/LICENSE CHANGED
@@ -175,7 +175,7 @@
175
175
 
176
176
  END OF TERMS AND CONDITIONS
177
177
 
178
- Copyright 2024 Utaba AI Ltd
178
+ Copyright 2024 Tim Wheeler
179
179
 
180
180
  Licensed under the Apache License, Version 2.0 (the "License");
181
181
  you may not use this file except in compliance with the License.
@@ -1,4 +1,4 @@
1
- import { S as StorageRepositoryConfig, c as StoredRepository, d as RepositoryFilter, e as PaginatedResult, f as StoredRepositorySummary, g as RepositoryUpdate, h as DeleteProgressCallback, i as RepositoryStats, M as MemoryVocabulary, j as PaginationOptions, V as VocabularyChangeRecord, k as StoredEntity, l as StoredEntityUpdate, m as StorageFindQuery, n as StoredRelationship, o as RelationshipQueryOptions, p as StorageExploreOptions, q as StorageNeighborhood, r as StoragePathOptions, s as StoragePathResult, t as StorageTimelineOptions, u as StorageTimelineResult, v as ExportChunk, I as ImportChunk, B as BulkImportOptions, w as BulkImportResult } from './portability-P1hL-bOa.cjs';
1
+ import { au as StorageRepositoryConfig, aB as StoredRepository, ad as RepositoryFilter, T as PaginatedResult, aC as StoredRepositorySummary, ah as RepositoryUpdate, g as DeleteProgressCallback, af as RepositoryStats, O as MemoryVocabulary, U as PaginationOptions, aM as VocabularyChangeRecord, ay as StoredEntity, az as StoredEntityUpdate, an as StorageFindQuery, aA as StoredRelationship, a5 as RelationshipQueryOptions, am as StorageExploreOptions, ao as StorageNeighborhood, as as StoragePathOptions, at as StoragePathResult, aw as StorageTimelineOptions, ax as StorageTimelineResult, s as ExportChunk, J as ImportChunk, B as BulkImportOptions, d as BulkImportResult } from './portability-CAeyzSCx.js';
2
2
 
3
3
  /** Result returned by ensureSchema describing what actions were taken. */
4
4
  interface EnsureSchemaResult {
@@ -11,6 +11,22 @@ interface EnsureSchemaResult {
11
11
  /** Schema version after the operation */
12
12
  schemaVersion: number;
13
13
  }
14
+ /**
15
+ * Internal entity-read options shared by `getEntity`, `getEntityBySlug`,
16
+ * `getEntities`, and `findEntities`.
17
+ *
18
+ * `loadEmbeddings` defaults to `false`. When `false`, providers must not ship
19
+ * the stored embedding over the wire — this is the AI-agent hot-path
20
+ * contract. When `true`, providers populate `StoredEntity.embedding` from the
21
+ * underlying store. The only legitimate caller is the vector-search path in
22
+ * `SearchOrchestrator.searchByConcept`.
23
+ *
24
+ * Providers that do not separate light/full reads (e.g. the in-memory
25
+ * provider, which always carries the full entity) may ignore this option.
26
+ */
27
+ interface EntityReadOptions {
28
+ loadEmbeddings?: boolean;
29
+ }
14
30
  /**
15
31
  * StorageProvider — the primary persistence interface.
16
32
  *
@@ -43,9 +59,9 @@ interface StorageProvider {
43
59
  saveVocabulary(repositoryId: string, vocabulary: MemoryVocabulary): Promise<void>;
44
60
  getVocabularyChangeLog(repositoryId: string, options?: PaginationOptions): Promise<PaginatedResult<VocabularyChangeRecord>>;
45
61
  createEntity(repositoryId: string, entity: StoredEntity): Promise<StoredEntity>;
46
- getEntity(repositoryId: string, entityId: string): Promise<StoredEntity | null>;
47
- getEntityBySlug(repositoryId: string, slug: string): Promise<StoredEntity | null>;
48
- getEntities(repositoryId: string, entityIds: string[]): Promise<Map<string, StoredEntity>>;
62
+ getEntity(repositoryId: string, entityId: string, options?: EntityReadOptions): Promise<StoredEntity | null>;
63
+ getEntityBySlug(repositoryId: string, slug: string, options?: EntityReadOptions): Promise<StoredEntity | null>;
64
+ getEntities(repositoryId: string, entityIds: string[], options?: EntityReadOptions): Promise<Map<string, StoredEntity>>;
49
65
  updateEntity(repositoryId: string, entityId: string, updates: StoredEntityUpdate): Promise<StoredEntity>;
50
66
  deleteEntity(repositoryId: string, entityId: string): Promise<void>;
51
67
  /** Delete multiple entities and their associated relationships in a single batch operation */
@@ -53,12 +69,20 @@ interface StorageProvider {
53
69
  deleted: string[];
54
70
  notFound: string[];
55
71
  }>;
56
- /** Delete all entities of a given type and their associated relationships */
72
+ /**
73
+ * Delete all entities of a given type and their associated relationships.
74
+ *
75
+ * `deletedRelationships` may be `undefined` when the provider does not count
76
+ * cascaded edges. The CosmosDB provider skips the edge-count fan-out
77
+ * (a `bothE()` walk across every partition the type touches) because the
78
+ * count itself is rarely consumed — vocabulary cascade-delete discards it.
79
+ * SQL Server and in-memory providers continue to return the exact number.
80
+ */
57
81
  deleteEntitiesByType(repositoryId: string, entityType: string): Promise<{
58
82
  deletedEntities: number;
59
- deletedRelationships: number;
83
+ deletedRelationships: number | undefined;
60
84
  }>;
61
- findEntities(repositoryId: string, query: StorageFindQuery): Promise<PaginatedResult<StoredEntity>>;
85
+ findEntities(repositoryId: string, query: StorageFindQuery, options?: EntityReadOptions): Promise<PaginatedResult<StoredEntity>>;
62
86
  createRelationship(repositoryId: string, relationship: StoredRelationship): Promise<StoredRelationship>;
63
87
  getRelationship(repositoryId: string, relationshipId: string): Promise<StoredRelationship | null>;
64
88
  getEntityRelationships(repositoryId: string, entityId: string, options?: RelationshipQueryOptions): Promise<PaginatedResult<StoredRelationship>>;
@@ -79,4 +103,4 @@ interface StorageProvider {
79
103
  importBulk(repositoryId: string, data: ImportChunk[], options?: BulkImportOptions): Promise<BulkImportResult>;
80
104
  }
81
105
 
82
- export type { EnsureSchemaResult as E, StorageProvider as S };
106
+ export type { EnsureSchemaResult as E, StorageProvider as S, EntityReadOptions as a };
@@ -1,4 +1,4 @@
1
- import { S as StorageRepositoryConfig, c as StoredRepository, d as RepositoryFilter, e as PaginatedResult, f as StoredRepositorySummary, g as RepositoryUpdate, h as DeleteProgressCallback, i as RepositoryStats, M as MemoryVocabulary, j as PaginationOptions, V as VocabularyChangeRecord, k as StoredEntity, l as StoredEntityUpdate, m as StorageFindQuery, n as StoredRelationship, o as RelationshipQueryOptions, p as StorageExploreOptions, q as StorageNeighborhood, r as StoragePathOptions, s as StoragePathResult, t as StorageTimelineOptions, u as StorageTimelineResult, v as ExportChunk, I as ImportChunk, B as BulkImportOptions, w as BulkImportResult } from './portability-P1hL-bOa.js';
1
+ import { au as StorageRepositoryConfig, aB as StoredRepository, ad as RepositoryFilter, T as PaginatedResult, aC as StoredRepositorySummary, ah as RepositoryUpdate, g as DeleteProgressCallback, af as RepositoryStats, O as MemoryVocabulary, U as PaginationOptions, aM as VocabularyChangeRecord, ay as StoredEntity, az as StoredEntityUpdate, an as StorageFindQuery, aA as StoredRelationship, a5 as RelationshipQueryOptions, am as StorageExploreOptions, ao as StorageNeighborhood, as as StoragePathOptions, at as StoragePathResult, aw as StorageTimelineOptions, ax as StorageTimelineResult, s as ExportChunk, J as ImportChunk, B as BulkImportOptions, d as BulkImportResult } from './portability-CAeyzSCx.cjs';
2
2
 
3
3
  /** Result returned by ensureSchema describing what actions were taken. */
4
4
  interface EnsureSchemaResult {
@@ -11,6 +11,22 @@ interface EnsureSchemaResult {
11
11
  /** Schema version after the operation */
12
12
  schemaVersion: number;
13
13
  }
14
+ /**
15
+ * Internal entity-read options shared by `getEntity`, `getEntityBySlug`,
16
+ * `getEntities`, and `findEntities`.
17
+ *
18
+ * `loadEmbeddings` defaults to `false`. When `false`, providers must not ship
19
+ * the stored embedding over the wire — this is the AI-agent hot-path
20
+ * contract. When `true`, providers populate `StoredEntity.embedding` from the
21
+ * underlying store. The only legitimate caller is the vector-search path in
22
+ * `SearchOrchestrator.searchByConcept`.
23
+ *
24
+ * Providers that do not separate light/full reads (e.g. the in-memory
25
+ * provider, which always carries the full entity) may ignore this option.
26
+ */
27
+ interface EntityReadOptions {
28
+ loadEmbeddings?: boolean;
29
+ }
14
30
  /**
15
31
  * StorageProvider — the primary persistence interface.
16
32
  *
@@ -43,9 +59,9 @@ interface StorageProvider {
43
59
  saveVocabulary(repositoryId: string, vocabulary: MemoryVocabulary): Promise<void>;
44
60
  getVocabularyChangeLog(repositoryId: string, options?: PaginationOptions): Promise<PaginatedResult<VocabularyChangeRecord>>;
45
61
  createEntity(repositoryId: string, entity: StoredEntity): Promise<StoredEntity>;
46
- getEntity(repositoryId: string, entityId: string): Promise<StoredEntity | null>;
47
- getEntityBySlug(repositoryId: string, slug: string): Promise<StoredEntity | null>;
48
- getEntities(repositoryId: string, entityIds: string[]): Promise<Map<string, StoredEntity>>;
62
+ getEntity(repositoryId: string, entityId: string, options?: EntityReadOptions): Promise<StoredEntity | null>;
63
+ getEntityBySlug(repositoryId: string, slug: string, options?: EntityReadOptions): Promise<StoredEntity | null>;
64
+ getEntities(repositoryId: string, entityIds: string[], options?: EntityReadOptions): Promise<Map<string, StoredEntity>>;
49
65
  updateEntity(repositoryId: string, entityId: string, updates: StoredEntityUpdate): Promise<StoredEntity>;
50
66
  deleteEntity(repositoryId: string, entityId: string): Promise<void>;
51
67
  /** Delete multiple entities and their associated relationships in a single batch operation */
@@ -53,12 +69,20 @@ interface StorageProvider {
53
69
  deleted: string[];
54
70
  notFound: string[];
55
71
  }>;
56
- /** Delete all entities of a given type and their associated relationships */
72
+ /**
73
+ * Delete all entities of a given type and their associated relationships.
74
+ *
75
+ * `deletedRelationships` may be `undefined` when the provider does not count
76
+ * cascaded edges. The CosmosDB provider skips the edge-count fan-out
77
+ * (a `bothE()` walk across every partition the type touches) because the
78
+ * count itself is rarely consumed — vocabulary cascade-delete discards it.
79
+ * SQL Server and in-memory providers continue to return the exact number.
80
+ */
57
81
  deleteEntitiesByType(repositoryId: string, entityType: string): Promise<{
58
82
  deletedEntities: number;
59
- deletedRelationships: number;
83
+ deletedRelationships: number | undefined;
60
84
  }>;
61
- findEntities(repositoryId: string, query: StorageFindQuery): Promise<PaginatedResult<StoredEntity>>;
85
+ findEntities(repositoryId: string, query: StorageFindQuery, options?: EntityReadOptions): Promise<PaginatedResult<StoredEntity>>;
62
86
  createRelationship(repositoryId: string, relationship: StoredRelationship): Promise<StoredRelationship>;
63
87
  getRelationship(repositoryId: string, relationshipId: string): Promise<StoredRelationship | null>;
64
88
  getEntityRelationships(repositoryId: string, entityId: string, options?: RelationshipQueryOptions): Promise<PaginatedResult<StoredRelationship>>;
@@ -79,4 +103,4 @@ interface StorageProvider {
79
103
  importBulk(repositoryId: string, data: ImportChunk[], options?: BulkImportOptions): Promise<BulkImportResult>;
80
104
  }
81
105
 
82
- export type { EnsureSchemaResult as E, StorageProvider as S };
106
+ export type { EnsureSchemaResult as E, StorageProvider as S, EntityReadOptions as a };