@utaba/deep-memory 0.8.1 → 0.9.1

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.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["// Type re-exports — @utaba/deep-memory/types\n\nexport type {\n ProvenanceContext,\n Provenance,\n} from './provenance.js';\n\nexport type {\n PropertyType,\n PropertySchema,\n EntityTypeDefinition,\n RelationshipTypeDefinition,\n MemoryVocabulary,\n GovernanceMode,\n GovernanceConfig,\n VocabularyProposal,\n VocabularyProposalResult,\n VocabularyChangeRecord,\n ResolvedVocabulary,\n EntityTypeInput,\n RelationshipTypeInput,\n VocabularyInput,\n} from './vocabulary.js';\n\nexport type {\n DetailLevel,\n Entity,\n EntitySummary,\n EntityBrief,\n CreateEntityInput,\n UpdateEntityInput,\n StoredEntity,\n StoredEntityUpdate,\n GetEntityOptions,\n GetEntitiesOptions,\n DeleteEntitiesResult,\n} from './entities.js';\n\nexport type {\n RelationshipDirection,\n Relationship,\n EnrichedRelationship,\n CreateRelationshipInput,\n StoredRelationship,\n RelationshipQueryOptions,\n RelationshipSummary,\n RemoveRelationshipsResult,\n} from './relationships.js';\n\nexport type {\n RepositoryConfig,\n RepositoryMetadata,\n RepositoryUpdate,\n RepositorySummary,\n RepositoryStats,\n StoredRepository,\n StoredRepositorySummary,\n RepositoryFilter,\n StorageRepositoryConfig,\n} from './repositories.js';\n\nexport type {\n PaginationOptions,\n FindEntitiesQuery,\n ExploreOptions,\n PathOptions,\n ConceptSearchOptions,\n TimelineOptions,\n StorageFindQuery,\n StorageExploreOptions,\n StoragePathOptions,\n StorageTimelineOptions,\n SearchOptions,\n PropertyFilter,\n ProvenanceFilter,\n} from './queries.js';\n\nexport type {\n PaginatedResult,\n NeighborhoodCenter,\n NeighborhoodGroup,\n NeighborhoodLayer,\n Neighborhood,\n Path,\n PathResult,\n ScoredEntity,\n TimelineEntityRef,\n TimelineRelationshipDetail,\n TimelineEvent,\n TimelineResult,\n GraphResult,\n EntityMap,\n StorageNeighborhoodGroup,\n StorageNeighborhoodLayer,\n StorageNeighborhood,\n StoragePath,\n StoragePathResult,\n StorageTimelineEvent,\n StorageTimelineResult,\n SearchHit,\n BulkImportResult,\n ReembedResult,\n EntityValidationIssue,\n RelationshipValidationIssue,\n EntityValidationPage,\n RelationshipValidationPage,\n ValidateEntitiesOptions,\n ValidateRelationshipsOptions,\n} from './results.js';\n\nexport type {\n DeepMemoryEventType,\n EventPayload,\n DeepMemoryEvent,\n EventHandler,\n Unsubscribe,\n HookResult,\n} from './events.js';\n\nexport type {\n TraversalSpec,\n TraversalStart,\n TraversalStep,\n TraversalProjection,\n TraversalReturnMode,\n TraversalResult,\n TraversalAggregation,\n TraversalRelationship,\n TraversalPath,\n QueryMetadata,\n} from './traversal.js';\n\nexport type {\n ExportManifest,\n ExportLegalMetadata,\n ExportPipelineMetadata,\n ExportOptions,\n ExportArchive,\n ExportChunk,\n ExportStreamItem,\n ImportOptions,\n ImportChunk,\n BulkImportOptions,\n DeleteProgressCallback,\n ImportStreamHeader,\n ImportWarning,\n ImportResult,\n} from './portability.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../src/types/index.ts"],"sourcesContent":["// Type re-exports — @utaba/deep-memory/types\n\nexport type {\n ProvenanceContext,\n Provenance,\n} from './provenance.js';\n\nexport type {\n PropertyType,\n PropertySchema,\n EntityTypeDefinition,\n RelationshipTypeDefinition,\n MemoryVocabulary,\n GovernanceMode,\n GovernanceConfig,\n VocabularyProposal,\n VocabularyProposalResult,\n VocabularyChangeRecord,\n ResolvedVocabulary,\n EntityTypeInput,\n RelationshipTypeInput,\n VocabularyInput,\n} from './vocabulary.js';\n\nexport type {\n DetailLevel,\n Entity,\n EntitySummary,\n EntityBrief,\n CreateEntityInput,\n UpdateEntityInput,\n StoredEntity,\n StoredEntityUpdate,\n GetEntityOptions,\n GetEntitiesOptions,\n DeleteEntitiesResult,\n} from './entities.js';\n\nexport type {\n RelationshipDirection,\n Relationship,\n EnrichedRelationship,\n CreateRelationshipInput,\n StoredRelationship,\n RelationshipQueryOptions,\n RelationshipSummary,\n RemoveRelationshipsResult,\n} from './relationships.js';\n\nexport type {\n RepositoryConfig,\n RepositoryMetadata,\n RepositoryUpdate,\n RepositorySummary,\n RepositoryStats,\n StoredRepository,\n StoredRepositorySummary,\n RepositoryFilter,\n StorageRepositoryConfig,\n} from './repositories.js';\n\nexport type {\n PaginationOptions,\n FindEntitiesQuery,\n ExploreOptions,\n PathOptions,\n ConceptSearchOptions,\n TimelineOptions,\n StorageFindQuery,\n StorageExploreOptions,\n StoragePathOptions,\n StorageTimelineOptions,\n SearchOptions,\n PropertyFilter,\n ProvenanceFilter,\n} from './queries.js';\n\nexport type {\n PaginatedResult,\n NeighborhoodCenter,\n NeighborhoodGroup,\n NeighborhoodLayer,\n Neighborhood,\n Path,\n PathResult,\n ScoredEntity,\n TimelineEntityRef,\n TimelineRelationshipDetail,\n TimelineEvent,\n TimelineResult,\n GraphResult,\n EntityMap,\n StorageNeighborhoodGroup,\n StorageNeighborhoodLayer,\n StorageNeighborhood,\n StoragePath,\n StoragePathResult,\n StorageTimelineEvent,\n StorageTimelineResult,\n SearchHit,\n BulkImportResult,\n ReembedResult,\n EntityValidationIssue,\n RelationshipValidationIssue,\n EntityValidationPage,\n RelationshipValidationPage,\n ValidateEntitiesOptions,\n ValidateRelationshipsOptions,\n} from './results.js';\n\nexport type {\n DeepMemoryEventType,\n EventPayload,\n DeepMemoryEvent,\n EventHandler,\n Unsubscribe,\n HookResult,\n} from './events.js';\n\nexport type {\n TraversalSpec,\n TraversalStart,\n TraversalStep,\n TraversalProjection,\n TraversalReturnMode,\n TraversalResult,\n TraversalAggregation,\n TraversalRelationship,\n TraversalPath,\n QueryMetadata,\n} from './traversal.js';\n\nexport type {\n OperationUsage,\n UsageSink,\n} from './usage.js';\n\nexport type {\n ExportManifest,\n ExportLegalMetadata,\n ExportPipelineMetadata,\n ExportOptions,\n ExportArchive,\n ExportChunk,\n ExportStreamItem,\n ImportOptions,\n ImportChunk,\n BulkImportOptions,\n DeleteProgressCallback,\n ImportStreamHeader,\n ImportWarning,\n ImportResult,\n} from './portability.js';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -143,4 +143,57 @@ interface HookResult {
143
143
  reason?: string;
144
144
  }
145
145
 
146
- export { CreateEntityInput, CreateRelationshipInput, type DeepMemoryEvent, type DeepMemoryEventType, Entity, type EventHandler, type EventPayload, type HookResult, ProvenanceContext, Relationship, type Unsubscribe, UpdateEntityInput, VocabularyChangeRecord };
146
+ /**
147
+ * Cost/usage record for a single public provider operation.
148
+ *
149
+ * Emitted once per top-level call (e.g. `createEntity`, `findEntities`,
150
+ * `traverse`, `embedBatch`, `chatCompletion`). If the operation internally
151
+ * issues multiple database round-trips, the provider aggregates their costs
152
+ * into a single record.
153
+ */
154
+ interface OperationUsage {
155
+ /**
156
+ * Provider identifier. Canonical values used by the built-in providers:
157
+ * `'cosmosdb'`, `'sqlserver'`, `'openai'`, `'anthropic'`.
158
+ * Custom providers should use their own stable identifier.
159
+ */
160
+ provider: string;
161
+ /**
162
+ * Name of the public provider method that produced this usage, e.g.
163
+ * `'createEntity'`, `'findEntities'`, `'traverse'`, `'embedBatch'`,
164
+ * `'chatCompletion'`.
165
+ */
166
+ operation: string;
167
+ /**
168
+ * Unit of the `value` field. Canonical values:
169
+ * `'RU'` — CosmosDB request units
170
+ * `'ms'` — wall-clock execution time (SQL Server, generic)
171
+ * `'tokens'` — total tokens (embeddings, LLM completions)
172
+ */
173
+ unit: string;
174
+ /** Magnitude of the cost in the stated unit. Always non-negative. */
175
+ value: number;
176
+ /**
177
+ * Repository the operation was scoped to, if applicable. Absent for
178
+ * cross-repository operations (e.g. `listRepositories`) and for providers
179
+ * that operate outside a repository context (e.g. the embeddings provider
180
+ * during indexer extraction, before the data is imported into a repo).
181
+ */
182
+ repositoryId?: string;
183
+ /** When the operation completed. */
184
+ timestamp: Date;
185
+ /**
186
+ * Optional provider-specific breakdown. Examples:
187
+ * CosmosDB: `{ calls: 3, retries: 0 }`
188
+ * LLM: `{ inputTokens: 1200, outputTokens: 340, cacheReadTokens: 800 }`
189
+ */
190
+ details?: Record<string, number>;
191
+ }
192
+ /**
193
+ * Callback that receives usage records. Providers invoke this once per public
194
+ * operation when configured. The sink must not throw — providers wrap it
195
+ * defensively, but a well-behaved implementation swallows its own errors.
196
+ */
197
+ type UsageSink = (usage: OperationUsage) => void;
198
+
199
+ export { CreateEntityInput, CreateRelationshipInput, type DeepMemoryEvent, type DeepMemoryEventType, Entity, type EventHandler, type EventPayload, type HookResult, type OperationUsage, ProvenanceContext, Relationship, type Unsubscribe, UpdateEntityInput, type UsageSink, VocabularyChangeRecord };
@@ -143,4 +143,57 @@ interface HookResult {
143
143
  reason?: string;
144
144
  }
145
145
 
146
- export { CreateEntityInput, CreateRelationshipInput, type DeepMemoryEvent, type DeepMemoryEventType, Entity, type EventHandler, type EventPayload, type HookResult, ProvenanceContext, Relationship, type Unsubscribe, UpdateEntityInput, VocabularyChangeRecord };
146
+ /**
147
+ * Cost/usage record for a single public provider operation.
148
+ *
149
+ * Emitted once per top-level call (e.g. `createEntity`, `findEntities`,
150
+ * `traverse`, `embedBatch`, `chatCompletion`). If the operation internally
151
+ * issues multiple database round-trips, the provider aggregates their costs
152
+ * into a single record.
153
+ */
154
+ interface OperationUsage {
155
+ /**
156
+ * Provider identifier. Canonical values used by the built-in providers:
157
+ * `'cosmosdb'`, `'sqlserver'`, `'openai'`, `'anthropic'`.
158
+ * Custom providers should use their own stable identifier.
159
+ */
160
+ provider: string;
161
+ /**
162
+ * Name of the public provider method that produced this usage, e.g.
163
+ * `'createEntity'`, `'findEntities'`, `'traverse'`, `'embedBatch'`,
164
+ * `'chatCompletion'`.
165
+ */
166
+ operation: string;
167
+ /**
168
+ * Unit of the `value` field. Canonical values:
169
+ * `'RU'` — CosmosDB request units
170
+ * `'ms'` — wall-clock execution time (SQL Server, generic)
171
+ * `'tokens'` — total tokens (embeddings, LLM completions)
172
+ */
173
+ unit: string;
174
+ /** Magnitude of the cost in the stated unit. Always non-negative. */
175
+ value: number;
176
+ /**
177
+ * Repository the operation was scoped to, if applicable. Absent for
178
+ * cross-repository operations (e.g. `listRepositories`) and for providers
179
+ * that operate outside a repository context (e.g. the embeddings provider
180
+ * during indexer extraction, before the data is imported into a repo).
181
+ */
182
+ repositoryId?: string;
183
+ /** When the operation completed. */
184
+ timestamp: Date;
185
+ /**
186
+ * Optional provider-specific breakdown. Examples:
187
+ * CosmosDB: `{ calls: 3, retries: 0 }`
188
+ * LLM: `{ inputTokens: 1200, outputTokens: 340, cacheReadTokens: 800 }`
189
+ */
190
+ details?: Record<string, number>;
191
+ }
192
+ /**
193
+ * Callback that receives usage records. Providers invoke this once per public
194
+ * operation when configured. The sink must not throw — providers wrap it
195
+ * defensively, but a well-behaved implementation swallows its own errors.
196
+ */
197
+ type UsageSink = (usage: OperationUsage) => void;
198
+
199
+ export { CreateEntityInput, CreateRelationshipInput, type DeepMemoryEvent, type DeepMemoryEventType, Entity, type EventHandler, type EventPayload, type HookResult, type OperationUsage, ProvenanceContext, Relationship, type Unsubscribe, UpdateEntityInput, type UsageSink, VocabularyChangeRecord };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@utaba/deep-memory",
3
- "version": "0.8.1",
3
+ "version": "0.9.1",
4
4
  "description": "Vocabulary-driven graph memory for AI agents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",