@cmdoss/memwal-sdk 0.6.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/ARCHITECTURE.md +463 -0
- package/BENCHMARKS.md +238 -0
- package/README.md +142 -0
- package/dist/access/PermissionService.d.ts +179 -0
- package/dist/access/PermissionService.d.ts.map +1 -0
- package/dist/access/PermissionService.js +445 -0
- package/dist/access/PermissionService.js.map +1 -0
- package/dist/access/index.d.ts +8 -0
- package/dist/access/index.d.ts.map +1 -0
- package/dist/access/index.js +7 -0
- package/dist/access/index.js.map +1 -0
- package/dist/aggregation/AggregationService.d.ts +132 -0
- package/dist/aggregation/AggregationService.d.ts.map +1 -0
- package/dist/aggregation/AggregationService.js +225 -0
- package/dist/aggregation/AggregationService.js.map +1 -0
- package/dist/aggregation/index.d.ts +8 -0
- package/dist/aggregation/index.d.ts.map +1 -0
- package/dist/aggregation/index.js +7 -0
- package/dist/aggregation/index.js.map +1 -0
- package/dist/ai-sdk/PDWVectorStore.d.ts +124 -0
- package/dist/ai-sdk/PDWVectorStore.d.ts.map +1 -0
- package/dist/ai-sdk/PDWVectorStore.js +557 -0
- package/dist/ai-sdk/PDWVectorStore.js.map +1 -0
- package/dist/ai-sdk/index.d.ts +45 -0
- package/dist/ai-sdk/index.d.ts.map +1 -0
- package/dist/ai-sdk/index.js +45 -0
- package/dist/ai-sdk/index.js.map +1 -0
- package/dist/ai-sdk/tools.d.ts +153 -0
- package/dist/ai-sdk/tools.d.ts.map +1 -0
- package/dist/ai-sdk/tools.js +312 -0
- package/dist/ai-sdk/tools.js.map +1 -0
- package/dist/ai-sdk/types.d.ts +336 -0
- package/dist/ai-sdk/types.d.ts.map +1 -0
- package/dist/ai-sdk/types.js +36 -0
- package/dist/ai-sdk/types.js.map +1 -0
- package/dist/api/client.d.ts +43 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +136 -0
- package/dist/api/client.js.map +1 -0
- package/dist/batch/BatchManager.d.ts +147 -0
- package/dist/batch/BatchManager.d.ts.map +1 -0
- package/dist/batch/BatchManager.js +427 -0
- package/dist/batch/BatchManager.js.map +1 -0
- package/dist/batch/BatchingService.d.ts +122 -0
- package/dist/batch/BatchingService.d.ts.map +1 -0
- package/dist/batch/BatchingService.js +301 -0
- package/dist/batch/BatchingService.js.map +1 -0
- package/dist/batch/MemoryProcessingCache.d.ts +147 -0
- package/dist/batch/MemoryProcessingCache.d.ts.map +1 -0
- package/dist/batch/MemoryProcessingCache.js +349 -0
- package/dist/batch/MemoryProcessingCache.js.map +1 -0
- package/dist/batch/index.d.ts +13 -0
- package/dist/batch/index.d.ts.map +1 -0
- package/dist/batch/index.js +10 -0
- package/dist/batch/index.js.map +1 -0
- package/dist/browser.d.ts +73 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +66 -0
- package/dist/browser.js.map +1 -0
- package/dist/chat/index.d.ts +13 -0
- package/dist/chat/index.d.ts.map +1 -0
- package/dist/chat/index.js +14 -0
- package/dist/chat/index.js.map +1 -0
- package/dist/client/ClientMemoryManager.d.ts +202 -0
- package/dist/client/ClientMemoryManager.d.ts.map +1 -0
- package/dist/client/ClientMemoryManager.js +764 -0
- package/dist/client/ClientMemoryManager.js.map +1 -0
- package/dist/client/PersonalDataWallet.d.ts +406 -0
- package/dist/client/PersonalDataWallet.d.ts.map +1 -0
- package/dist/client/PersonalDataWallet.js +229 -0
- package/dist/client/PersonalDataWallet.js.map +1 -0
- package/dist/client/SimplePDWClient.d.ts +534 -0
- package/dist/client/SimplePDWClient.d.ts.map +1 -0
- package/dist/client/SimplePDWClient.js +876 -0
- package/dist/client/SimplePDWClient.js.map +1 -0
- package/dist/client/factory.d.ts +99 -0
- package/dist/client/factory.d.ts.map +1 -0
- package/dist/client/factory.js +126 -0
- package/dist/client/factory.js.map +1 -0
- package/dist/client/namespaces/AnalyticsNamespace.d.ts +178 -0
- package/dist/client/namespaces/AnalyticsNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/AnalyticsNamespace.js +261 -0
- package/dist/client/namespaces/AnalyticsNamespace.js.map +1 -0
- package/dist/client/namespaces/BatchNamespace.d.ts +120 -0
- package/dist/client/namespaces/BatchNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/BatchNamespace.js +261 -0
- package/dist/client/namespaces/BatchNamespace.js.map +1 -0
- package/dist/client/namespaces/CacheNamespace.d.ts +80 -0
- package/dist/client/namespaces/CacheNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/CacheNamespace.js +100 -0
- package/dist/client/namespaces/CacheNamespace.js.map +1 -0
- package/dist/client/namespaces/CapabilityNamespace.d.ts +145 -0
- package/dist/client/namespaces/CapabilityNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/CapabilityNamespace.js +181 -0
- package/dist/client/namespaces/CapabilityNamespace.js.map +1 -0
- package/dist/client/namespaces/ChatNamespace.d.ts +110 -0
- package/dist/client/namespaces/ChatNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/ChatNamespace.js +123 -0
- package/dist/client/namespaces/ChatNamespace.js.map +1 -0
- package/dist/client/namespaces/ClassifyNamespace.d.ts +96 -0
- package/dist/client/namespaces/ClassifyNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/ClassifyNamespace.js +149 -0
- package/dist/client/namespaces/ClassifyNamespace.js.map +1 -0
- package/dist/client/namespaces/ContextNamespace.d.ts +150 -0
- package/dist/client/namespaces/ContextNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/ContextNamespace.js +250 -0
- package/dist/client/namespaces/ContextNamespace.js.map +1 -0
- package/dist/client/namespaces/EmbeddingsNamespace.d.ts +64 -0
- package/dist/client/namespaces/EmbeddingsNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/EmbeddingsNamespace.js +86 -0
- package/dist/client/namespaces/EmbeddingsNamespace.js.map +1 -0
- package/dist/client/namespaces/EncryptionNamespace.d.ts +128 -0
- package/dist/client/namespaces/EncryptionNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/EncryptionNamespace.js +161 -0
- package/dist/client/namespaces/EncryptionNamespace.js.map +1 -0
- package/dist/client/namespaces/GraphNamespace.d.ts +168 -0
- package/dist/client/namespaces/GraphNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/GraphNamespace.js +314 -0
- package/dist/client/namespaces/GraphNamespace.js.map +1 -0
- package/dist/client/namespaces/IndexNamespace.d.ts +141 -0
- package/dist/client/namespaces/IndexNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/IndexNamespace.js +238 -0
- package/dist/client/namespaces/IndexNamespace.js.map +1 -0
- package/dist/client/namespaces/MemoryNamespace.d.ts +277 -0
- package/dist/client/namespaces/MemoryNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/MemoryNamespace.js +907 -0
- package/dist/client/namespaces/MemoryNamespace.js.map +1 -0
- package/dist/client/namespaces/PermissionsNamespace.d.ts +114 -0
- package/dist/client/namespaces/PermissionsNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/PermissionsNamespace.js +179 -0
- package/dist/client/namespaces/PermissionsNamespace.js.map +1 -0
- package/dist/client/namespaces/PipelineNamespace.d.ts +125 -0
- package/dist/client/namespaces/PipelineNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/PipelineNamespace.js +171 -0
- package/dist/client/namespaces/PipelineNamespace.js.map +1 -0
- package/dist/client/namespaces/SearchNamespace.d.ts +382 -0
- package/dist/client/namespaces/SearchNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/SearchNamespace.js +821 -0
- package/dist/client/namespaces/SearchNamespace.js.map +1 -0
- package/dist/client/namespaces/StorageNamespace.d.ts +180 -0
- package/dist/client/namespaces/StorageNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/StorageNamespace.js +354 -0
- package/dist/client/namespaces/StorageNamespace.js.map +1 -0
- package/dist/client/namespaces/TxNamespace.d.ts +143 -0
- package/dist/client/namespaces/TxNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/TxNamespace.js +208 -0
- package/dist/client/namespaces/TxNamespace.js.map +1 -0
- package/dist/client/namespaces/WalletNamespace.d.ts +124 -0
- package/dist/client/namespaces/WalletNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/WalletNamespace.js +197 -0
- package/dist/client/namespaces/WalletNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/AINamespace.d.ts +265 -0
- package/dist/client/namespaces/consolidated/AINamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/AINamespace.js +390 -0
- package/dist/client/namespaces/consolidated/AINamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.d.ts +265 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.js +412 -0
- package/dist/client/namespaces/consolidated/BlockchainNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.d.ts +354 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.js +522 -0
- package/dist/client/namespaces/consolidated/SecurityNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.d.ts +235 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.js +351 -0
- package/dist/client/namespaces/consolidated/StorageNamespace.js.map +1 -0
- package/dist/client/namespaces/consolidated/index.d.ts +17 -0
- package/dist/client/namespaces/consolidated/index.d.ts.map +1 -0
- package/dist/client/namespaces/consolidated/index.js +13 -0
- package/dist/client/namespaces/consolidated/index.js.map +1 -0
- package/dist/client/signers/KeypairSigner.d.ts +55 -0
- package/dist/client/signers/KeypairSigner.d.ts.map +1 -0
- package/dist/client/signers/KeypairSigner.js +84 -0
- package/dist/client/signers/KeypairSigner.js.map +1 -0
- package/dist/client/signers/UnifiedSigner.d.ts +88 -0
- package/dist/client/signers/UnifiedSigner.d.ts.map +1 -0
- package/dist/client/signers/UnifiedSigner.js +13 -0
- package/dist/client/signers/UnifiedSigner.js.map +1 -0
- package/dist/client/signers/WalletAdapterSigner.d.ts +94 -0
- package/dist/client/signers/WalletAdapterSigner.d.ts.map +1 -0
- package/dist/client/signers/WalletAdapterSigner.js +91 -0
- package/dist/client/signers/WalletAdapterSigner.js.map +1 -0
- package/dist/client/signers/index.d.ts +14 -0
- package/dist/client/signers/index.d.ts.map +1 -0
- package/dist/client/signers/index.js +12 -0
- package/dist/client/signers/index.js.map +1 -0
- package/dist/config/ConfigurationHelper.d.ts +167 -0
- package/dist/config/ConfigurationHelper.d.ts.map +1 -0
- package/dist/config/ConfigurationHelper.js +283 -0
- package/dist/config/ConfigurationHelper.js.map +1 -0
- package/dist/config/defaults.d.ts +9 -0
- package/dist/config/defaults.d.ts.map +1 -0
- package/dist/config/defaults.js +49 -0
- package/dist/config/defaults.js.map +1 -0
- package/dist/config/index.d.ts +9 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +8 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/validation.d.ts +12 -0
- package/dist/config/validation.d.ts.map +1 -0
- package/dist/config/validation.js +61 -0
- package/dist/config/validation.js.map +1 -0
- package/dist/core/index.d.ts +11 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +13 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/interfaces/IService.d.ts +162 -0
- package/dist/core/interfaces/IService.d.ts.map +1 -0
- package/dist/core/interfaces/IService.js +159 -0
- package/dist/core/interfaces/IService.js.map +1 -0
- package/dist/core/interfaces/index.d.ts +7 -0
- package/dist/core/interfaces/index.d.ts.map +1 -0
- package/dist/core/interfaces/index.js +7 -0
- package/dist/core/interfaces/index.js.map +1 -0
- package/dist/core/types/capability.d.ts +268 -0
- package/dist/core/types/capability.d.ts.map +1 -0
- package/dist/core/types/capability.js +16 -0
- package/dist/core/types/capability.js.map +1 -0
- package/dist/core/types/index.d.ts +750 -0
- package/dist/core/types/index.d.ts.map +1 -0
- package/dist/core/types/index.js +6 -0
- package/dist/core/types/index.js.map +1 -0
- package/dist/core/types/wallet.d.ts +254 -0
- package/dist/core/types/wallet.d.ts.map +1 -0
- package/dist/core/types/wallet.js +27 -0
- package/dist/core/types/wallet.js.map +1 -0
- package/dist/core/types.d.ts +8 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +8 -0
- package/dist/core/types.js.map +1 -0
- package/dist/core/wallet.d.ts +209 -0
- package/dist/core/wallet.d.ts.map +1 -0
- package/dist/core/wallet.js +27 -0
- package/dist/core/wallet.js.map +1 -0
- package/dist/embedding/index.d.ts +9 -0
- package/dist/embedding/index.d.ts.map +1 -0
- package/dist/embedding/index.js +8 -0
- package/dist/embedding/index.js.map +1 -0
- package/dist/embedding/types.d.ts +302 -0
- package/dist/embedding/types.d.ts.map +1 -0
- package/dist/embedding/types.js +9 -0
- package/dist/embedding/types.js.map +1 -0
- package/dist/encryption/index.d.ts +14 -0
- package/dist/encryption/index.d.ts.map +1 -0
- package/dist/encryption/index.js +14 -0
- package/dist/encryption/index.js.map +1 -0
- package/dist/errors/index.d.ts +149 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +301 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/errors/recovery.d.ts +128 -0
- package/dist/errors/recovery.d.ts.map +1 -0
- package/dist/errors/recovery.js +320 -0
- package/dist/errors/recovery.js.map +1 -0
- package/dist/errors/validation.d.ts +106 -0
- package/dist/errors/validation.d.ts.map +1 -0
- package/dist/errors/validation.js +354 -0
- package/dist/errors/validation.js.map +1 -0
- package/dist/generated/pdw/capability.d.ts +223 -0
- package/dist/generated/pdw/capability.d.ts.map +1 -0
- package/dist/generated/pdw/capability.js +238 -0
- package/dist/generated/pdw/capability.js.map +1 -0
- package/dist/generated/pdw/deps/sui/object.d.ts +9 -0
- package/dist/generated/pdw/deps/sui/object.d.ts.map +1 -0
- package/dist/generated/pdw/deps/sui/object.js +11 -0
- package/dist/generated/pdw/deps/sui/object.js.map +1 -0
- package/dist/generated/pdw/deps/sui/vec_map.d.ts +37 -0
- package/dist/generated/pdw/deps/sui/vec_map.d.ts.map +1 -0
- package/dist/generated/pdw/deps/sui/vec_map.js +28 -0
- package/dist/generated/pdw/deps/sui/vec_map.js.map +1 -0
- package/dist/generated/pdw/memory.d.ts +676 -0
- package/dist/generated/pdw/memory.d.ts.map +1 -0
- package/dist/generated/pdw/memory.js +681 -0
- package/dist/generated/pdw/memory.js.map +1 -0
- package/dist/generated/pdw/wallet.d.ts +78 -0
- package/dist/generated/pdw/wallet.d.ts.map +1 -0
- package/dist/generated/pdw/wallet.js +89 -0
- package/dist/generated/pdw/wallet.js.map +1 -0
- package/dist/generated/utils/index.d.ts +12 -0
- package/dist/generated/utils/index.d.ts.map +1 -0
- package/dist/generated/utils/index.js +132 -0
- package/dist/generated/utils/index.js.map +1 -0
- package/dist/graph/BrowserKnowledgeGraphManager.d.ts +101 -0
- package/dist/graph/BrowserKnowledgeGraphManager.d.ts.map +1 -0
- package/dist/graph/BrowserKnowledgeGraphManager.js +411 -0
- package/dist/graph/BrowserKnowledgeGraphManager.js.map +1 -0
- package/dist/graph/GraphService.d.ts +194 -0
- package/dist/graph/GraphService.d.ts.map +1 -0
- package/dist/graph/GraphService.js +662 -0
- package/dist/graph/GraphService.js.map +1 -0
- package/dist/graph/KnowledgeGraphManager.d.ts +161 -0
- package/dist/graph/KnowledgeGraphManager.d.ts.map +1 -0
- package/dist/graph/KnowledgeGraphManager.js +495 -0
- package/dist/graph/KnowledgeGraphManager.js.map +1 -0
- package/dist/graph/index.d.ts +11 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +9 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/hooks.wip/index.d.ts +55 -0
- package/dist/hooks.wip/index.d.ts.map +1 -0
- package/dist/hooks.wip/index.js +58 -0
- package/dist/hooks.wip/index.js.map +1 -0
- package/dist/hooks.wip/useCreateMemory.d.ts +111 -0
- package/dist/hooks.wip/useCreateMemory.d.ts.map +1 -0
- package/dist/hooks.wip/useCreateMemory.js +149 -0
- package/dist/hooks.wip/useCreateMemory.js.map +1 -0
- package/dist/hooks.wip/useCreateMemoryBatch.d.ts +122 -0
- package/dist/hooks.wip/useCreateMemoryBatch.d.ts.map +1 -0
- package/dist/hooks.wip/useCreateMemoryBatch.js +221 -0
- package/dist/hooks.wip/useCreateMemoryBatch.js.map +1 -0
- package/dist/hooks.wip/useKnowledgeGraph.d.ts +66 -0
- package/dist/hooks.wip/useKnowledgeGraph.d.ts.map +1 -0
- package/dist/hooks.wip/useKnowledgeGraph.js +229 -0
- package/dist/hooks.wip/useKnowledgeGraph.js.map +1 -0
- package/dist/hooks.wip/useMemoryChat.d.ts +106 -0
- package/dist/hooks.wip/useMemoryChat.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryChat.js +284 -0
- package/dist/hooks.wip/useMemoryChat.js.map +1 -0
- package/dist/hooks.wip/useMemoryIndex.d.ts +90 -0
- package/dist/hooks.wip/useMemoryIndex.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryIndex.js +218 -0
- package/dist/hooks.wip/useMemoryIndex.js.map +1 -0
- package/dist/hooks.wip/useMemoryManager.d.ts +35 -0
- package/dist/hooks.wip/useMemoryManager.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryManager.js +86 -0
- package/dist/hooks.wip/useMemoryManager.js.map +1 -0
- package/dist/hooks.wip/useMemorySearch.d.ts +100 -0
- package/dist/hooks.wip/useMemorySearch.d.ts.map +1 -0
- package/dist/hooks.wip/useMemorySearch.js +278 -0
- package/dist/hooks.wip/useMemorySearch.js.map +1 -0
- package/dist/hooks.wip/useMemoryServices.d.ts +80 -0
- package/dist/hooks.wip/useMemoryServices.d.ts.map +1 -0
- package/dist/hooks.wip/useMemoryServices.js +264 -0
- package/dist/hooks.wip/useMemoryServices.js.map +1 -0
- package/dist/hooks.wip/usePDWRAG.d.ts +112 -0
- package/dist/hooks.wip/usePDWRAG.d.ts.map +1 -0
- package/dist/hooks.wip/usePDWRAG.js +121 -0
- package/dist/hooks.wip/usePDWRAG.js.map +1 -0
- package/dist/hooks.wip/usePDWVectorStore.d.ts +68 -0
- package/dist/hooks.wip/usePDWVectorStore.d.ts.map +1 -0
- package/dist/hooks.wip/usePDWVectorStore.js +102 -0
- package/dist/hooks.wip/usePDWVectorStore.js.map +1 -0
- package/dist/hooks.wip/useRetrieveEmbedding.d.ts +138 -0
- package/dist/hooks.wip/useRetrieveEmbedding.d.ts.map +1 -0
- package/dist/hooks.wip/useRetrieveEmbedding.js +121 -0
- package/dist/hooks.wip/useRetrieveEmbedding.js.map +1 -0
- package/dist/hooks.wip/useSearchMemories.d.ts +103 -0
- package/dist/hooks.wip/useSearchMemories.d.ts.map +1 -0
- package/dist/hooks.wip/useSearchMemories.js +146 -0
- package/dist/hooks.wip/useSearchMemories.js.map +1 -0
- package/dist/hooks.wip/useStoreEmbedding.d.ts +174 -0
- package/dist/hooks.wip/useStoreEmbedding.d.ts.map +1 -0
- package/dist/hooks.wip/useStoreEmbedding.js +167 -0
- package/dist/hooks.wip/useStoreEmbedding.js.map +1 -0
- package/dist/hooks.wip/useWalletMemories.d.ts +119 -0
- package/dist/hooks.wip/useWalletMemories.d.ts.map +1 -0
- package/dist/hooks.wip/useWalletMemories.js +166 -0
- package/dist/hooks.wip/useWalletMemories.js.map +1 -0
- package/dist/hooks.wip/utils/cache.d.ts +25 -0
- package/dist/hooks.wip/utils/cache.d.ts.map +1 -0
- package/dist/hooks.wip/utils/cache.js +38 -0
- package/dist/hooks.wip/utils/cache.js.map +1 -0
- package/dist/hooks.wip/utils/types.d.ts +138 -0
- package/dist/hooks.wip/utils/types.d.ts.map +1 -0
- package/dist/hooks.wip/utils/types.js +5 -0
- package/dist/hooks.wip/utils/types.js.map +1 -0
- package/dist/index.d.ts +190 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +298 -0
- package/dist/index.js.map +1 -0
- package/dist/infrastructure/ai/EmbeddingService.d.ts +101 -0
- package/dist/infrastructure/ai/EmbeddingService.d.ts.map +1 -0
- package/dist/infrastructure/ai/EmbeddingService.js +242 -0
- package/dist/infrastructure/ai/EmbeddingService.js.map +1 -0
- package/dist/infrastructure/ai/GeminiAIService.d.ts +84 -0
- package/dist/infrastructure/ai/GeminiAIService.d.ts.map +1 -0
- package/dist/infrastructure/ai/GeminiAIService.js +300 -0
- package/dist/infrastructure/ai/GeminiAIService.js.map +1 -0
- package/dist/infrastructure/ai/index.d.ts +8 -0
- package/dist/infrastructure/ai/index.d.ts.map +1 -0
- package/dist/infrastructure/ai/index.js +8 -0
- package/dist/infrastructure/ai/index.js.map +1 -0
- package/dist/infrastructure/index.d.ts +16 -0
- package/dist/infrastructure/index.d.ts.map +1 -0
- package/dist/infrastructure/index.js +19 -0
- package/dist/infrastructure/index.js.map +1 -0
- package/dist/infrastructure/seal/EncryptionService.d.ts +162 -0
- package/dist/infrastructure/seal/EncryptionService.d.ts.map +1 -0
- package/dist/infrastructure/seal/EncryptionService.js +466 -0
- package/dist/infrastructure/seal/EncryptionService.js.map +1 -0
- package/dist/infrastructure/seal/SealService.d.ts +132 -0
- package/dist/infrastructure/seal/SealService.d.ts.map +1 -0
- package/dist/infrastructure/seal/SealService.js +473 -0
- package/dist/infrastructure/seal/SealService.js.map +1 -0
- package/dist/infrastructure/seal/index.d.ts +8 -0
- package/dist/infrastructure/seal/index.d.ts.map +1 -0
- package/dist/infrastructure/seal/index.js +8 -0
- package/dist/infrastructure/seal/index.js.map +1 -0
- package/dist/infrastructure/sui/BlockchainManager.d.ts +161 -0
- package/dist/infrastructure/sui/BlockchainManager.d.ts.map +1 -0
- package/dist/infrastructure/sui/BlockchainManager.js +421 -0
- package/dist/infrastructure/sui/BlockchainManager.js.map +1 -0
- package/dist/infrastructure/sui/SuiService.d.ts +179 -0
- package/dist/infrastructure/sui/SuiService.d.ts.map +1 -0
- package/dist/infrastructure/sui/SuiService.js +658 -0
- package/dist/infrastructure/sui/SuiService.js.map +1 -0
- package/dist/infrastructure/sui/index.d.ts +8 -0
- package/dist/infrastructure/sui/index.d.ts.map +1 -0
- package/dist/infrastructure/sui/index.js +8 -0
- package/dist/infrastructure/sui/index.js.map +1 -0
- package/dist/infrastructure/walrus/StorageManager.d.ts +207 -0
- package/dist/infrastructure/walrus/StorageManager.d.ts.map +1 -0
- package/dist/infrastructure/walrus/StorageManager.js +413 -0
- package/dist/infrastructure/walrus/StorageManager.js.map +1 -0
- package/dist/infrastructure/walrus/WalrusStorageService.d.ts +177 -0
- package/dist/infrastructure/walrus/WalrusStorageService.d.ts.map +1 -0
- package/dist/infrastructure/walrus/WalrusStorageService.js +403 -0
- package/dist/infrastructure/walrus/WalrusStorageService.js.map +1 -0
- package/dist/infrastructure/walrus/index.d.ts +8 -0
- package/dist/infrastructure/walrus/index.d.ts.map +1 -0
- package/dist/infrastructure/walrus/index.js +8 -0
- package/dist/infrastructure/walrus/index.js.map +1 -0
- package/dist/langchain/PDWEmbeddings.d.ts +77 -0
- package/dist/langchain/PDWEmbeddings.d.ts.map +1 -0
- package/dist/langchain/PDWEmbeddings.js +96 -0
- package/dist/langchain/PDWEmbeddings.js.map +1 -0
- package/dist/langchain/PDWVectorStore.d.ts +173 -0
- package/dist/langchain/PDWVectorStore.d.ts.map +1 -0
- package/dist/langchain/PDWVectorStore.js +304 -0
- package/dist/langchain/PDWVectorStore.js.map +1 -0
- package/dist/langchain/createPDWRAG.d.ts +115 -0
- package/dist/langchain/createPDWRAG.d.ts.map +1 -0
- package/dist/langchain/createPDWRAG.js +181 -0
- package/dist/langchain/createPDWRAG.js.map +1 -0
- package/dist/langchain/index.d.ts +35 -0
- package/dist/langchain/index.d.ts.map +1 -0
- package/dist/langchain/index.js +35 -0
- package/dist/langchain/index.js.map +1 -0
- package/dist/memory/index.d.ts +13 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +14 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/permissions/ConsentRepository.d.ts +71 -0
- package/dist/permissions/ConsentRepository.d.ts.map +1 -0
- package/dist/permissions/ConsentRepository.js +297 -0
- package/dist/permissions/ConsentRepository.js.map +1 -0
- package/dist/permissions/index.d.ts +9 -0
- package/dist/permissions/index.d.ts.map +1 -0
- package/dist/permissions/index.js +8 -0
- package/dist/permissions/index.js.map +1 -0
- package/dist/pipeline/MemoryPipeline.d.ts +191 -0
- package/dist/pipeline/MemoryPipeline.d.ts.map +1 -0
- package/dist/pipeline/MemoryPipeline.js +588 -0
- package/dist/pipeline/MemoryPipeline.js.map +1 -0
- package/dist/pipeline/PipelineManager.d.ts +178 -0
- package/dist/pipeline/PipelineManager.d.ts.map +1 -0
- package/dist/pipeline/PipelineManager.js +485 -0
- package/dist/pipeline/PipelineManager.js.map +1 -0
- package/dist/pipeline/index.d.ts +13 -0
- package/dist/pipeline/index.d.ts.map +1 -0
- package/dist/pipeline/index.js +11 -0
- package/dist/pipeline/index.js.map +1 -0
- package/dist/retrieval/AdvancedSearchService.d.ts +231 -0
- package/dist/retrieval/AdvancedSearchService.d.ts.map +1 -0
- package/dist/retrieval/AdvancedSearchService.js +384 -0
- package/dist/retrieval/AdvancedSearchService.js.map +1 -0
- package/dist/retrieval/MemoryAnalyticsService.d.ts +227 -0
- package/dist/retrieval/MemoryAnalyticsService.d.ts.map +1 -0
- package/dist/retrieval/MemoryAnalyticsService.js +417 -0
- package/dist/retrieval/MemoryAnalyticsService.js.map +1 -0
- package/dist/retrieval/MemoryDecryptionPipeline.d.ts +191 -0
- package/dist/retrieval/MemoryDecryptionPipeline.d.ts.map +1 -0
- package/dist/retrieval/MemoryDecryptionPipeline.js +623 -0
- package/dist/retrieval/MemoryDecryptionPipeline.js.map +1 -0
- package/dist/retrieval/MemoryRetrievalService.d.ts +248 -0
- package/dist/retrieval/MemoryRetrievalService.d.ts.map +1 -0
- package/dist/retrieval/MemoryRetrievalService.js +519 -0
- package/dist/retrieval/MemoryRetrievalService.js.map +1 -0
- package/dist/retrieval/index.d.ts +14 -0
- package/dist/retrieval/index.d.ts.map +1 -0
- package/dist/retrieval/index.js +10 -0
- package/dist/retrieval/index.js.map +1 -0
- package/dist/services/BatchService.d.ts +109 -0
- package/dist/services/BatchService.d.ts.map +1 -0
- package/dist/services/BatchService.js +259 -0
- package/dist/services/BatchService.js.map +1 -0
- package/dist/services/CapabilityService.d.ts +141 -0
- package/dist/services/CapabilityService.d.ts.map +1 -0
- package/dist/services/CapabilityService.js +361 -0
- package/dist/services/CapabilityService.js.map +1 -0
- package/dist/services/ChatService.d.ts +89 -0
- package/dist/services/ChatService.d.ts.map +1 -0
- package/dist/services/ChatService.js +319 -0
- package/dist/services/ChatService.js.map +1 -0
- package/dist/services/ClassifierService.d.ts +104 -0
- package/dist/services/ClassifierService.d.ts.map +1 -0
- package/dist/services/ClassifierService.js +374 -0
- package/dist/services/ClassifierService.js.map +1 -0
- package/dist/services/CrossContextPermissionService.d.ts +149 -0
- package/dist/services/CrossContextPermissionService.d.ts.map +1 -0
- package/dist/services/CrossContextPermissionService.js +337 -0
- package/dist/services/CrossContextPermissionService.js.map +1 -0
- package/dist/services/EmbeddingService.d.ts +206 -0
- package/dist/services/EmbeddingService.d.ts.map +1 -0
- package/dist/services/EmbeddingService.js +504 -0
- package/dist/services/EmbeddingService.js.map +1 -0
- package/dist/services/EncryptionService.d.ts +201 -0
- package/dist/services/EncryptionService.d.ts.map +1 -0
- package/dist/services/EncryptionService.js +558 -0
- package/dist/services/EncryptionService.js.map +1 -0
- package/dist/services/GeminiAIService.d.ts +112 -0
- package/dist/services/GeminiAIService.d.ts.map +1 -0
- package/dist/services/GeminiAIService.js +389 -0
- package/dist/services/GeminiAIService.js.map +1 -0
- package/dist/services/IndexManager.d.ts +238 -0
- package/dist/services/IndexManager.d.ts.map +1 -0
- package/dist/services/IndexManager.js +691 -0
- package/dist/services/IndexManager.js.map +1 -0
- package/dist/services/MemoryIndexService.d.ts +222 -0
- package/dist/services/MemoryIndexService.d.ts.map +1 -0
- package/dist/services/MemoryIndexService.js +695 -0
- package/dist/services/MemoryIndexService.js.map +1 -0
- package/dist/services/MemoryService.d.ts +156 -0
- package/dist/services/MemoryService.d.ts.map +1 -0
- package/dist/services/MemoryService.js +273 -0
- package/dist/services/MemoryService.js.map +1 -0
- package/dist/services/QueryService.d.ts +182 -0
- package/dist/services/QueryService.d.ts.map +1 -0
- package/dist/services/QueryService.js +631 -0
- package/dist/services/QueryService.js.map +1 -0
- package/dist/services/StorageService.d.ts +523 -0
- package/dist/services/StorageService.d.ts.map +1 -0
- package/dist/services/StorageService.js +627 -0
- package/dist/services/StorageService.js.map +1 -0
- package/dist/services/TransactionService.d.ts +179 -0
- package/dist/services/TransactionService.d.ts.map +1 -0
- package/dist/services/TransactionService.js +639 -0
- package/dist/services/TransactionService.js.map +1 -0
- package/dist/services/VectorService.d.ts +122 -0
- package/dist/services/VectorService.d.ts.map +1 -0
- package/dist/services/VectorService.js +371 -0
- package/dist/services/VectorService.js.map +1 -0
- package/dist/services/ViewService.d.ts +126 -0
- package/dist/services/ViewService.d.ts.map +1 -0
- package/dist/services/ViewService.js +356 -0
- package/dist/services/ViewService.js.map +1 -0
- package/dist/services/index.d.ts +12 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +11 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/storage/BlobAttributesManager.d.ts +60 -0
- package/dist/services/storage/BlobAttributesManager.d.ts.map +1 -0
- package/dist/services/storage/BlobAttributesManager.js +265 -0
- package/dist/services/storage/BlobAttributesManager.js.map +1 -0
- package/dist/services/storage/KnowledgeGraphManager.d.ts +162 -0
- package/dist/services/storage/KnowledgeGraphManager.d.ts.map +1 -0
- package/dist/services/storage/KnowledgeGraphManager.js +303 -0
- package/dist/services/storage/KnowledgeGraphManager.js.map +1 -0
- package/dist/services/storage/MemorySearchManager.d.ts +154 -0
- package/dist/services/storage/MemorySearchManager.d.ts.map +1 -0
- package/dist/services/storage/MemorySearchManager.js +260 -0
- package/dist/services/storage/MemorySearchManager.js.map +1 -0
- package/dist/services/storage/QuiltBatchManager.d.ts +185 -0
- package/dist/services/storage/QuiltBatchManager.d.ts.map +1 -0
- package/dist/services/storage/QuiltBatchManager.js +385 -0
- package/dist/services/storage/QuiltBatchManager.js.map +1 -0
- package/dist/services/storage/WalrusMetadataManager.d.ts +89 -0
- package/dist/services/storage/WalrusMetadataManager.d.ts.map +1 -0
- package/dist/services/storage/WalrusMetadataManager.js +177 -0
- package/dist/services/storage/WalrusMetadataManager.js.map +1 -0
- package/dist/services/storage/WalrusStorageManager.d.ts +113 -0
- package/dist/services/storage/WalrusStorageManager.d.ts.map +1 -0
- package/dist/services/storage/WalrusStorageManager.js +211 -0
- package/dist/services/storage/WalrusStorageManager.js.map +1 -0
- package/dist/services/storage/index.d.ts +24 -0
- package/dist/services/storage/index.d.ts.map +1 -0
- package/dist/services/storage/index.js +18 -0
- package/dist/services/storage/index.js.map +1 -0
- package/dist/transactions/index.d.ts +13 -0
- package/dist/transactions/index.d.ts.map +1 -0
- package/dist/transactions/index.js +14 -0
- package/dist/transactions/index.js.map +1 -0
- package/dist/types/index.d.ts +12 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +13 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/wallet.d.ts +12 -0
- package/dist/types/wallet.d.ts.map +1 -0
- package/dist/types/wallet.js +13 -0
- package/dist/types/wallet.js.map +1 -0
- package/dist/utils/index.d.ts +21 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +30 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/rebuildIndex.d.ts +79 -0
- package/dist/utils/rebuildIndex.d.ts.map +1 -0
- package/dist/utils/rebuildIndex.js +211 -0
- package/dist/utils/rebuildIndex.js.map +1 -0
- package/dist/utils/rebuildIndexNode.d.ts +70 -0
- package/dist/utils/rebuildIndexNode.d.ts.map +1 -0
- package/dist/utils/rebuildIndexNode.js +236 -0
- package/dist/utils/rebuildIndexNode.js.map +1 -0
- package/dist/vector/BrowserHnswIndexService.d.ts +93 -0
- package/dist/vector/BrowserHnswIndexService.d.ts.map +1 -0
- package/dist/vector/BrowserHnswIndexService.js +581 -0
- package/dist/vector/BrowserHnswIndexService.js.map +1 -0
- package/dist/vector/HnswWasmService.d.ts +97 -0
- package/dist/vector/HnswWasmService.d.ts.map +1 -0
- package/dist/vector/HnswWasmService.js +518 -0
- package/dist/vector/HnswWasmService.js.map +1 -0
- package/dist/vector/IHnswService.d.ts +179 -0
- package/dist/vector/IHnswService.d.ts.map +1 -0
- package/dist/vector/IHnswService.js +25 -0
- package/dist/vector/IHnswService.js.map +1 -0
- package/dist/vector/NodeHnswService.d.ts +80 -0
- package/dist/vector/NodeHnswService.d.ts.map +1 -0
- package/dist/vector/NodeHnswService.js +589 -0
- package/dist/vector/NodeHnswService.js.map +1 -0
- package/dist/vector/VectorManager.d.ts +142 -0
- package/dist/vector/VectorManager.d.ts.map +1 -0
- package/dist/vector/VectorManager.js +339 -0
- package/dist/vector/VectorManager.js.map +1 -0
- package/dist/vector/createHnswService.d.ts +51 -0
- package/dist/vector/createHnswService.d.ts.map +1 -0
- package/dist/vector/createHnswService.js +120 -0
- package/dist/vector/createHnswService.js.map +1 -0
- package/dist/vector/index.d.ts +24 -0
- package/dist/vector/index.d.ts.map +1 -0
- package/dist/vector/index.js +24 -0
- package/dist/vector/index.js.map +1 -0
- package/dist/view/ViewService.d.ts +136 -0
- package/dist/view/ViewService.d.ts.map +1 -0
- package/dist/view/ViewService.js +325 -0
- package/dist/view/ViewService.js.map +1 -0
- package/dist/view/index.d.ts +7 -0
- package/dist/view/index.d.ts.map +1 -0
- package/dist/view/index.js +7 -0
- package/dist/view/index.js.map +1 -0
- package/dist/wallet/ContextWalletService.d.ts +172 -0
- package/dist/wallet/ContextWalletService.d.ts.map +1 -0
- package/dist/wallet/ContextWalletService.js +510 -0
- package/dist/wallet/ContextWalletService.js.map +1 -0
- package/dist/wallet/MainWalletService.d.ts +114 -0
- package/dist/wallet/MainWalletService.d.ts.map +1 -0
- package/dist/wallet/MainWalletService.js +259 -0
- package/dist/wallet/MainWalletService.js.map +1 -0
- package/dist/wallet/index.d.ts +16 -0
- package/dist/wallet/index.d.ts.map +1 -0
- package/dist/wallet/index.js +14 -0
- package/dist/wallet/index.js.map +1 -0
- package/package.json +150 -0
- package/src/access/PermissionService.ts +636 -0
- package/src/access/index.ts +8 -0
- package/src/aggregation/AggregationService.ts +390 -0
- package/src/aggregation/index.ts +8 -0
- package/src/ai-sdk/PDWVectorStore.ts +712 -0
- package/src/ai-sdk/index.ts +65 -0
- package/src/ai-sdk/tools.ts +460 -0
- package/src/ai-sdk/types.ts +404 -0
- package/src/batch/BatchManager.ts +598 -0
- package/src/batch/BatchingService.ts +430 -0
- package/src/batch/MemoryProcessingCache.ts +493 -0
- package/src/batch/index.ts +31 -0
- package/src/browser.ts +196 -0
- package/src/client/ClientMemoryManager.ts +982 -0
- package/src/client/PersonalDataWallet.ts +346 -0
- package/src/client/SimplePDWClient.ts +1180 -0
- package/src/client/factory.ts +155 -0
- package/src/client/namespaces/AnalyticsNamespace.ts +377 -0
- package/src/client/namespaces/BatchNamespace.ts +356 -0
- package/src/client/namespaces/CacheNamespace.ts +123 -0
- package/src/client/namespaces/CapabilityNamespace.ts +217 -0
- package/src/client/namespaces/ClassifyNamespace.ts +169 -0
- package/src/client/namespaces/ContextNamespace.ts +297 -0
- package/src/client/namespaces/EmbeddingsNamespace.ts +99 -0
- package/src/client/namespaces/EncryptionNamespace.ts +221 -0
- package/src/client/namespaces/GraphNamespace.ts +468 -0
- package/src/client/namespaces/IndexNamespace.ts +283 -0
- package/src/client/namespaces/MemoryNamespace.ts +1135 -0
- package/src/client/namespaces/PermissionsNamespace.ts +254 -0
- package/src/client/namespaces/PipelineNamespace.ts +220 -0
- package/src/client/namespaces/SearchNamespace.ts +1036 -0
- package/src/client/namespaces/StorageNamespace.ts +458 -0
- package/src/client/namespaces/TxNamespace.ts +260 -0
- package/src/client/namespaces/WalletNamespace.ts +243 -0
- package/src/client/namespaces/consolidated/AINamespace.ts +449 -0
- package/src/client/namespaces/consolidated/BlockchainNamespace.ts +492 -0
- package/src/client/namespaces/consolidated/SecurityNamespace.ts +648 -0
- package/src/client/namespaces/consolidated/StorageNamespace.ts +440 -0
- package/src/client/namespaces/consolidated/index.ts +39 -0
- package/src/client/signers/KeypairSigner.ts +101 -0
- package/src/client/signers/UnifiedSigner.ts +99 -0
- package/src/client/signers/WalletAdapterSigner.ts +149 -0
- package/src/client/signers/index.ts +19 -0
- package/src/config/ConfigurationHelper.ts +413 -0
- package/src/config/defaults.ts +52 -0
- package/src/config/index.ts +9 -0
- package/src/config/validation.ts +71 -0
- package/src/core/index.ts +14 -0
- package/src/core/interfaces/IService.ts +307 -0
- package/src/core/interfaces/index.ts +8 -0
- package/src/core/types/capability.ts +297 -0
- package/src/core/types/index.ts +871 -0
- package/src/core/types/wallet.ts +271 -0
- package/src/core/types.ts +9 -0
- package/src/core/wallet.ts +223 -0
- package/src/embedding/index.ts +20 -0
- package/src/embedding/types.ts +358 -0
- package/src/errors/index.ts +603 -0
- package/src/errors/recovery.ts +462 -0
- package/src/errors/validation.ts +568 -0
- package/src/generated/pdw/capability.ts +319 -0
- package/src/generated/pdw/deps/sui/object.ts +13 -0
- package/src/generated/pdw/deps/sui/vec_map.ts +33 -0
- package/src/generated/pdw/memory.ts +1088 -0
- package/src/generated/pdw/wallet.ts +124 -0
- package/src/generated/utils/index.ts +159 -0
- package/src/graph/GraphService.ts +888 -0
- package/src/graph/KnowledgeGraphManager.ts +729 -0
- package/src/graph/index.ts +26 -0
- package/src/index.ts +458 -0
- package/src/infrastructure/index.ts +22 -0
- package/src/infrastructure/seal/EncryptionService.ts +604 -0
- package/src/infrastructure/seal/SealService.ts +616 -0
- package/src/infrastructure/seal/index.ts +9 -0
- package/src/infrastructure/sui/BlockchainManager.ts +628 -0
- package/src/infrastructure/sui/SuiService.ts +888 -0
- package/src/infrastructure/sui/index.ts +9 -0
- package/src/infrastructure/walrus/StorageManager.ts +605 -0
- package/src/infrastructure/walrus/WalrusStorageService.ts +613 -0
- package/src/infrastructure/walrus/index.ts +9 -0
- package/src/langchain/PDWEmbeddings.ts +145 -0
- package/src/langchain/PDWVectorStore.ts +456 -0
- package/src/langchain/README.md +116 -0
- package/src/langchain/createPDWRAG.ts +303 -0
- package/src/langchain/index.ts +47 -0
- package/src/permissions/ConsentRepository.ts +364 -0
- package/src/permissions/index.ts +9 -0
- package/src/pipeline/MemoryPipeline.ts +863 -0
- package/src/pipeline/PipelineManager.ts +684 -0
- package/src/pipeline/index.ts +27 -0
- package/src/retrieval/AdvancedSearchService.ts +630 -0
- package/src/retrieval/MemoryAnalyticsService.ts +712 -0
- package/src/retrieval/MemoryDecryptionPipeline.ts +825 -0
- package/src/retrieval/MemoryRetrievalService.ts +831 -0
- package/src/retrieval/index.ts +43 -0
- package/src/services/BatchService.ts +353 -0
- package/src/services/CapabilityService.ts +448 -0
- package/src/services/ClassifierService.ts +466 -0
- package/src/services/CrossContextPermissionService.ts +484 -0
- package/src/services/EmbeddingService.ts +706 -0
- package/src/services/EncryptionService.ts +712 -0
- package/src/services/GeminiAIService.ts +497 -0
- package/src/services/IndexManager.ts +1004 -0
- package/src/services/MemoryIndexService.ts +922 -0
- package/src/services/MemoryService.ts +370 -0
- package/src/services/QueryService.ts +891 -0
- package/src/services/StorageService.ts +1111 -0
- package/src/services/TransactionService.ts +791 -0
- package/src/services/VectorService.ts +462 -0
- package/src/services/ViewService.ts +485 -0
- package/src/services/index.ts +25 -0
- package/src/services/storage/BlobAttributesManager.ts +342 -0
- package/src/services/storage/KnowledgeGraphManager.ts +425 -0
- package/src/services/storage/MemorySearchManager.ts +387 -0
- package/src/services/storage/QuiltBatchManager.ts +532 -0
- package/src/services/storage/WalrusMetadataManager.ts +271 -0
- package/src/services/storage/WalrusStorageManager.ts +290 -0
- package/src/services/storage/index.ts +52 -0
- package/src/types/index.ts +13 -0
- package/src/utils/index.ts +68 -0
- package/src/utils/rebuildIndex.ts +290 -0
- package/src/utils/rebuildIndexNode.ts +341 -0
- package/src/vector/BrowserHnswIndexService.ts +758 -0
- package/src/vector/HnswWasmService.ts +679 -0
- package/src/vector/IHnswService.ts +224 -0
- package/src/vector/NodeHnswService.ts +713 -0
- package/src/vector/VectorManager.ts +479 -0
- package/src/vector/createHnswService.ts +135 -0
- package/src/vector/index.ts +57 -0
- package/src/wallet/ContextWalletService.ts +657 -0
- package/src/wallet/MainWalletService.ts +318 -0
- package/src/wallet/index.ts +17 -0
|
@@ -0,0 +1,821 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Namespace - All Search Methods
|
|
3
|
+
*
|
|
4
|
+
* Provides comprehensive search capabilities:
|
|
5
|
+
* - Vector similarity search
|
|
6
|
+
* - Semantic search (AI-enhanced)
|
|
7
|
+
* - Keyword search (metadata)
|
|
8
|
+
* - Hybrid search (combined)
|
|
9
|
+
* - Temporal search (date-based)
|
|
10
|
+
* - Category filtering
|
|
11
|
+
*
|
|
12
|
+
* @module client/namespaces
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* Search Namespace
|
|
16
|
+
*
|
|
17
|
+
* Handles all types of search operations
|
|
18
|
+
*/
|
|
19
|
+
export class SearchNamespace {
|
|
20
|
+
constructor(services) {
|
|
21
|
+
this.services = services;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Vector similarity search
|
|
25
|
+
*
|
|
26
|
+
* Searches memories by semantic similarity using embeddings.
|
|
27
|
+
*
|
|
28
|
+
* NOTE: Content is NOT included by default for privacy (content is encrypted on Walrus).
|
|
29
|
+
* Use `fetchContent: true` option or call `pdw.memory.get(blobId)` to get content.
|
|
30
|
+
*
|
|
31
|
+
* @param query - Text query to search for
|
|
32
|
+
* @param options - Search options
|
|
33
|
+
* @returns Sorted array of results by similarity (content empty unless fetchContent=true)
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* // Fast search (no content)
|
|
38
|
+
* const results = await pdw.search.vector('programming');
|
|
39
|
+
*
|
|
40
|
+
* // Search with content (slower - fetches from Walrus)
|
|
41
|
+
* const results = await pdw.search.vector('programming', { fetchContent: true });
|
|
42
|
+
*
|
|
43
|
+
* // Or fetch content for specific result
|
|
44
|
+
* const memory = await pdw.memory.get(results[0].blobId);
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
async vector(query, options = {}) {
|
|
48
|
+
const { limit = 10, threshold = 0.7, category, fetchContent = false } = options;
|
|
49
|
+
try {
|
|
50
|
+
// Generate query embedding
|
|
51
|
+
if (!this.services.embedding) {
|
|
52
|
+
throw new Error('Embedding service not configured. Please provide geminiApiKey in config.');
|
|
53
|
+
}
|
|
54
|
+
const embResult = await this.services.embedding.embedText({
|
|
55
|
+
text: query
|
|
56
|
+
});
|
|
57
|
+
// Search using local HNSW index (VectorService)
|
|
58
|
+
if (!this.services.vector) {
|
|
59
|
+
throw new Error('Vector service not configured. Enable local indexing in config.');
|
|
60
|
+
}
|
|
61
|
+
const spaceId = this.services.config.userAddress;
|
|
62
|
+
// Search in local HNSW index
|
|
63
|
+
const searchResult = await this.services.vector.searchVectors(spaceId, embResult.vector, {
|
|
64
|
+
k: limit
|
|
65
|
+
});
|
|
66
|
+
// Filter by threshold and category
|
|
67
|
+
let results = searchResult.results.filter((r) => r.similarity >= threshold);
|
|
68
|
+
if (category) {
|
|
69
|
+
results = results.filter((r) => r.metadata?.category === category);
|
|
70
|
+
}
|
|
71
|
+
// Convert to SearchResult format
|
|
72
|
+
// Option A+: Content may be available from local index when encryption is OFF
|
|
73
|
+
const searchResults = results.map((r) => ({
|
|
74
|
+
id: r.memoryId || r.vectorId.toString(),
|
|
75
|
+
content: r.metadata?.content || r.content || '', // ✅ Get content from index metadata if available
|
|
76
|
+
score: r.similarity,
|
|
77
|
+
similarity: r.similarity,
|
|
78
|
+
category: r.metadata?.category,
|
|
79
|
+
importance: r.metadata?.importance || 5,
|
|
80
|
+
topic: r.metadata?.topic,
|
|
81
|
+
blobId: r.metadata?.blobId || r.memoryId || r.vectorId.toString(),
|
|
82
|
+
metadata: r.metadata || {},
|
|
83
|
+
timestamp: r.metadata?.timestamp || Date.now()
|
|
84
|
+
}));
|
|
85
|
+
// Optionally fetch content from Walrus
|
|
86
|
+
if (fetchContent) {
|
|
87
|
+
await this.populateContent(searchResults);
|
|
88
|
+
}
|
|
89
|
+
return searchResults;
|
|
90
|
+
}
|
|
91
|
+
catch (error) {
|
|
92
|
+
throw new Error(`Vector search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Semantic search (AI-enhanced)
|
|
97
|
+
*
|
|
98
|
+
* Uses AI to understand query intent and rerank results
|
|
99
|
+
*
|
|
100
|
+
* @param query - Natural language query
|
|
101
|
+
* @param options - Search options
|
|
102
|
+
* @returns Semantically relevant results
|
|
103
|
+
*/
|
|
104
|
+
async semantic(query, options = {}) {
|
|
105
|
+
try {
|
|
106
|
+
if (!this.services.query) {
|
|
107
|
+
throw new Error('Query service not available');
|
|
108
|
+
}
|
|
109
|
+
// Use QueryService for semantic search
|
|
110
|
+
const results = await this.services.query.semanticSearch({
|
|
111
|
+
query,
|
|
112
|
+
userAddress: this.services.config.userAddress,
|
|
113
|
+
queryType: 'semantic',
|
|
114
|
+
k: options.limit || 10,
|
|
115
|
+
threshold: options.threshold || 0.6
|
|
116
|
+
}, {
|
|
117
|
+
expandQuery: options.rerank ?? true // Use expandQuery instead of rerank
|
|
118
|
+
});
|
|
119
|
+
return results.map((r) => ({
|
|
120
|
+
id: r.id,
|
|
121
|
+
content: r.content || '',
|
|
122
|
+
score: r.similarity_score || 0,
|
|
123
|
+
similarity: r.similarity_score || 0,
|
|
124
|
+
category: r.category,
|
|
125
|
+
importance: r.metadata?.importance,
|
|
126
|
+
blobId: r.blobId || r.id,
|
|
127
|
+
metadata: r.metadata || {},
|
|
128
|
+
timestamp: r.timestamp ? new Date(r.timestamp).getTime() : Date.now()
|
|
129
|
+
}));
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
throw new Error(`Semantic search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Keyword search (metadata-based)
|
|
137
|
+
*
|
|
138
|
+
* Searches in metadata fields using keywords
|
|
139
|
+
*
|
|
140
|
+
* @param query - Keyword to search for
|
|
141
|
+
* @param options - Search options
|
|
142
|
+
* @returns Matching memories
|
|
143
|
+
*/
|
|
144
|
+
async keyword(query, options = {}) {
|
|
145
|
+
try {
|
|
146
|
+
const { limit = 10, category, fields = ['content', 'topic'], caseSensitive = false } = options;
|
|
147
|
+
// Use QueryService for keyword search
|
|
148
|
+
const results = await this.services.query.keywordSearch({
|
|
149
|
+
query,
|
|
150
|
+
userAddress: this.services.config.userAddress,
|
|
151
|
+
queryType: 'keyword',
|
|
152
|
+
categories: category ? [category] : undefined,
|
|
153
|
+
limit
|
|
154
|
+
});
|
|
155
|
+
return results.map((r) => ({
|
|
156
|
+
id: r.id,
|
|
157
|
+
content: r.content || '',
|
|
158
|
+
score: 1.0, // Keyword match = binary
|
|
159
|
+
similarity: 1.0,
|
|
160
|
+
category: r.category,
|
|
161
|
+
importance: r.metadata?.importance,
|
|
162
|
+
blobId: r.blobId || r.id,
|
|
163
|
+
metadata: r.metadata || {},
|
|
164
|
+
timestamp: r.timestamp ? new Date(r.timestamp).getTime() : Date.now()
|
|
165
|
+
}));
|
|
166
|
+
}
|
|
167
|
+
catch (error) {
|
|
168
|
+
throw new Error(`Keyword search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Hybrid search (vector + keyword)
|
|
173
|
+
*
|
|
174
|
+
* Combines vector similarity and keyword matching
|
|
175
|
+
*
|
|
176
|
+
* @param query - Search query
|
|
177
|
+
* @param options - Hybrid search options
|
|
178
|
+
* @returns Ranked results from both methods
|
|
179
|
+
*/
|
|
180
|
+
async hybrid(query, options = {}) {
|
|
181
|
+
try {
|
|
182
|
+
const { limit = 10, vectorWeight = 0.7, keywordWeight = 0.3, category } = options;
|
|
183
|
+
// Use QueryService for hybrid search
|
|
184
|
+
const results = await this.services.query.hybridSearch({
|
|
185
|
+
query,
|
|
186
|
+
userAddress: this.services.config.userAddress,
|
|
187
|
+
queryType: 'hybrid',
|
|
188
|
+
limit,
|
|
189
|
+
categories: category ? [category] : undefined
|
|
190
|
+
});
|
|
191
|
+
return results.map((r) => ({
|
|
192
|
+
id: r.id,
|
|
193
|
+
content: r.content || '',
|
|
194
|
+
score: r.similarity_score || 0,
|
|
195
|
+
similarity: r.similarity_score || 0,
|
|
196
|
+
category: r.category,
|
|
197
|
+
importance: r.metadata?.importance,
|
|
198
|
+
blobId: r.blobId || r.id,
|
|
199
|
+
metadata: r.metadata || {},
|
|
200
|
+
timestamp: r.timestamp ? new Date(r.timestamp).getTime() : Date.now()
|
|
201
|
+
}));
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
throw new Error(`Hybrid search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Search by category
|
|
209
|
+
*
|
|
210
|
+
* First tries local vector index (for recently created memories),
|
|
211
|
+
* then queries blockchain for on-chain Memory objects.
|
|
212
|
+
* Combines results and deduplicates by blobId.
|
|
213
|
+
*
|
|
214
|
+
* @param category - Category to filter by
|
|
215
|
+
* @param options - Additional options
|
|
216
|
+
* @returns Memories in category
|
|
217
|
+
*/
|
|
218
|
+
async byCategory(category, options = {}) {
|
|
219
|
+
try {
|
|
220
|
+
const limit = options.limit || 50;
|
|
221
|
+
const results = [];
|
|
222
|
+
const seenIds = new Set();
|
|
223
|
+
// 1. First check local vector index (includes recently created memories)
|
|
224
|
+
// Use VectorService.getVectorsByCategory() method
|
|
225
|
+
if (this.services.vector) {
|
|
226
|
+
try {
|
|
227
|
+
const spaceId = this.services.config.userAddress;
|
|
228
|
+
const localResults = this.services.vector.getVectorsByCategory(spaceId, category);
|
|
229
|
+
for (const { vectorId, metadata } of localResults) {
|
|
230
|
+
const id = metadata?.blobId || metadata?.memoryId || vectorId?.toString();
|
|
231
|
+
if (id && !seenIds.has(id)) {
|
|
232
|
+
seenIds.add(id);
|
|
233
|
+
results.push({
|
|
234
|
+
id,
|
|
235
|
+
content: metadata?.content || '',
|
|
236
|
+
score: 1.0,
|
|
237
|
+
similarity: 1.0,
|
|
238
|
+
category: metadata?.category,
|
|
239
|
+
importance: metadata?.importance || 5,
|
|
240
|
+
topic: metadata?.topic,
|
|
241
|
+
blobId: id,
|
|
242
|
+
metadata: metadata || {},
|
|
243
|
+
timestamp: metadata?.timestamp || Date.now()
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
catch (localError) {
|
|
249
|
+
// Local index access failed, continue with on-chain query
|
|
250
|
+
console.log('Local index search skipped:', localError);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
// 2. Query on-chain Memory objects
|
|
254
|
+
const viewService = this.services.viewService;
|
|
255
|
+
if (viewService) {
|
|
256
|
+
try {
|
|
257
|
+
const response = await viewService.getUserMemories(this.services.config.userAddress, { limit, category });
|
|
258
|
+
for (const m of response.data) {
|
|
259
|
+
const id = m.id || m.blobId;
|
|
260
|
+
if (id && !seenIds.has(id)) {
|
|
261
|
+
seenIds.add(id);
|
|
262
|
+
results.push({
|
|
263
|
+
id,
|
|
264
|
+
content: '',
|
|
265
|
+
score: 1.0,
|
|
266
|
+
similarity: 1.0,
|
|
267
|
+
category: m.category,
|
|
268
|
+
importance: m.importance || 5,
|
|
269
|
+
topic: m.topic,
|
|
270
|
+
blobId: m.blobId || id,
|
|
271
|
+
metadata: {
|
|
272
|
+
category: m.category,
|
|
273
|
+
importance: m.importance,
|
|
274
|
+
topic: m.topic
|
|
275
|
+
},
|
|
276
|
+
timestamp: m.createdAt || Date.now()
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
catch (viewError) {
|
|
282
|
+
console.log('On-chain query failed:', viewError);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
return results.slice(0, limit);
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
throw new Error(`Category search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
/**
|
|
292
|
+
* Search by date range
|
|
293
|
+
*
|
|
294
|
+
* @param dateRange - Start and end dates
|
|
295
|
+
* @param options - Additional options
|
|
296
|
+
* @returns Memories within date range
|
|
297
|
+
*/
|
|
298
|
+
async byDate(dateRange, options = {}) {
|
|
299
|
+
try {
|
|
300
|
+
const start = typeof dateRange.start === 'string'
|
|
301
|
+
? new Date(dateRange.start)
|
|
302
|
+
: dateRange.start;
|
|
303
|
+
const end = dateRange.end
|
|
304
|
+
? (typeof dateRange.end === 'string' ? new Date(dateRange.end) : dateRange.end)
|
|
305
|
+
: new Date();
|
|
306
|
+
// Use QueryService for temporal search
|
|
307
|
+
const results = await this.services.query.temporalSearch({
|
|
308
|
+
userAddress: this.services.config.userAddress,
|
|
309
|
+
queryType: 'temporal',
|
|
310
|
+
dateRange: { start, end },
|
|
311
|
+
limit: options.limit || 50,
|
|
312
|
+
categories: options.category ? [options.category] : undefined
|
|
313
|
+
});
|
|
314
|
+
return results.map((r) => ({
|
|
315
|
+
id: r.id,
|
|
316
|
+
content: r.content || '',
|
|
317
|
+
score: 1.0,
|
|
318
|
+
similarity: 1.0,
|
|
319
|
+
category: r.category,
|
|
320
|
+
importance: r.metadata?.importance,
|
|
321
|
+
blobId: r.blobId || r.id,
|
|
322
|
+
metadata: r.metadata || {},
|
|
323
|
+
timestamp: r.timestamp ? new Date(r.timestamp).getTime() : Date.now()
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
throw new Error(`Temporal search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Search by importance range
|
|
332
|
+
*
|
|
333
|
+
* @param min - Minimum importance (1-10)
|
|
334
|
+
* @param max - Maximum importance (1-10)
|
|
335
|
+
* @param options - Additional options
|
|
336
|
+
* @returns Memories within importance range
|
|
337
|
+
*/
|
|
338
|
+
async byImportance(min, max = 10, options = {}) {
|
|
339
|
+
const memoriesResult = await this.services.viewService?.getUserMemories(this.services.config.userAddress);
|
|
340
|
+
const allMemories = memoriesResult?.data || [];
|
|
341
|
+
const filtered = allMemories.filter((m) => {
|
|
342
|
+
const importance = m.importance || m.metadata?.importance || 5;
|
|
343
|
+
return importance >= min && importance <= max;
|
|
344
|
+
});
|
|
345
|
+
const limit = options.limit || 50;
|
|
346
|
+
return filtered.slice(0, limit).map((m) => ({
|
|
347
|
+
id: m.id || m.blobId,
|
|
348
|
+
content: m.content || '',
|
|
349
|
+
score: 1.0,
|
|
350
|
+
similarity: 1.0,
|
|
351
|
+
category: m.category || m.metadata?.category,
|
|
352
|
+
importance: m.importance || m.metadata?.importance,
|
|
353
|
+
blobId: m.blobId || m.id,
|
|
354
|
+
metadata: m.metadata,
|
|
355
|
+
timestamp: m.timestamp || Date.now()
|
|
356
|
+
}));
|
|
357
|
+
}
|
|
358
|
+
/**
|
|
359
|
+
* Advanced search with complex filters
|
|
360
|
+
*
|
|
361
|
+
* @param query - Search query or filters
|
|
362
|
+
* @returns Filtered and ranked results
|
|
363
|
+
*/
|
|
364
|
+
async advanced(query) {
|
|
365
|
+
try {
|
|
366
|
+
// Combine multiple search strategies
|
|
367
|
+
let results = [];
|
|
368
|
+
// Start with vector search if text provided
|
|
369
|
+
if (query.text) {
|
|
370
|
+
results = await this.vector(query.text, {
|
|
371
|
+
limit: query.limit || 50,
|
|
372
|
+
category: query.category
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
// Get all memories
|
|
377
|
+
const memoriesResult = await this.services.viewService?.getUserMemories(this.services.config.userAddress);
|
|
378
|
+
const memories = memoriesResult?.data || [];
|
|
379
|
+
results = memories.map((m) => ({
|
|
380
|
+
id: m.id || m.blobId,
|
|
381
|
+
content: m.content || '',
|
|
382
|
+
score: 1.0,
|
|
383
|
+
similarity: 1.0,
|
|
384
|
+
category: m.category || m.metadata?.category,
|
|
385
|
+
importance: m.importance || m.metadata?.importance,
|
|
386
|
+
blobId: m.blobId || m.id,
|
|
387
|
+
metadata: m.metadata,
|
|
388
|
+
timestamp: m.timestamp || Date.now()
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
// Apply filters
|
|
392
|
+
if (query.importance) {
|
|
393
|
+
results = results.filter(r => (r.importance || 5) >= query.importance.min &&
|
|
394
|
+
(r.importance || 5) <= query.importance.max);
|
|
395
|
+
}
|
|
396
|
+
if (query.dateRange) {
|
|
397
|
+
const start = typeof query.dateRange.start === 'string'
|
|
398
|
+
? new Date(query.dateRange.start).getTime()
|
|
399
|
+
: query.dateRange.start.getTime();
|
|
400
|
+
const end = query.dateRange.end
|
|
401
|
+
? (typeof query.dateRange.end === 'string'
|
|
402
|
+
? new Date(query.dateRange.end).getTime()
|
|
403
|
+
: query.dateRange.end.getTime())
|
|
404
|
+
: Date.now();
|
|
405
|
+
results = results.filter(r => r.timestamp >= start && r.timestamp <= end);
|
|
406
|
+
}
|
|
407
|
+
return results.slice(0, query.limit || 50);
|
|
408
|
+
}
|
|
409
|
+
catch (error) {
|
|
410
|
+
throw new Error(`Advanced search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Graph-based search
|
|
415
|
+
*
|
|
416
|
+
* Search using knowledge graph relationships
|
|
417
|
+
*
|
|
418
|
+
* @param query - Entity or concept to search
|
|
419
|
+
* @param options - Search options
|
|
420
|
+
* @returns Related memories via graph connections
|
|
421
|
+
*/
|
|
422
|
+
async graph(query, options = {}) {
|
|
423
|
+
try {
|
|
424
|
+
if (!this.services.query) {
|
|
425
|
+
throw new Error('Query service not available');
|
|
426
|
+
}
|
|
427
|
+
// Use QueryService.graphSearch - returns { memories, graphResults }
|
|
428
|
+
const result = await this.services.query.graphSearch({
|
|
429
|
+
query,
|
|
430
|
+
userAddress: this.services.config.userAddress,
|
|
431
|
+
queryType: 'graph',
|
|
432
|
+
limit: options.limit || 10
|
|
433
|
+
});
|
|
434
|
+
// Extract memories array from result
|
|
435
|
+
const memories = result.memories || [];
|
|
436
|
+
return memories.map((r) => ({
|
|
437
|
+
id: r.id,
|
|
438
|
+
content: r.content || '',
|
|
439
|
+
score: r.similarity_score || 0,
|
|
440
|
+
similarity: r.similarity_score || 0,
|
|
441
|
+
category: r.category,
|
|
442
|
+
importance: r.metadata?.importance,
|
|
443
|
+
blobId: r.blobId || r.id,
|
|
444
|
+
metadata: r.metadata || {},
|
|
445
|
+
timestamp: r.timestamp ? new Date(r.timestamp).getTime() : Date.now()
|
|
446
|
+
}));
|
|
447
|
+
}
|
|
448
|
+
catch (error) {
|
|
449
|
+
throw new Error(`Graph search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
/**
|
|
453
|
+
* Search with embedding vectors included
|
|
454
|
+
*
|
|
455
|
+
* Same as vector search but includes embedding vectors in results
|
|
456
|
+
*
|
|
457
|
+
* @param query - Search query
|
|
458
|
+
* @param options - Search options
|
|
459
|
+
* @returns Results with embedding vectors
|
|
460
|
+
*/
|
|
461
|
+
async withEmbeddings(query, options = {}) {
|
|
462
|
+
return this.vector(query, {
|
|
463
|
+
...options,
|
|
464
|
+
includeEmbeddings: true
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
/**
|
|
468
|
+
* Multi-vector search
|
|
469
|
+
*
|
|
470
|
+
* Search using multiple query vectors/texts
|
|
471
|
+
*
|
|
472
|
+
* @param queries - Array of query texts
|
|
473
|
+
* @param options - Search options
|
|
474
|
+
* @returns Combined and deduplicated results
|
|
475
|
+
*/
|
|
476
|
+
async multiVector(queries, options = {}) {
|
|
477
|
+
try {
|
|
478
|
+
const allResults = [];
|
|
479
|
+
const seenIds = new Set();
|
|
480
|
+
// Search for each query
|
|
481
|
+
for (const query of queries) {
|
|
482
|
+
const results = await this.vector(query, {
|
|
483
|
+
...options,
|
|
484
|
+
limit: Math.ceil((options.limit || 10) / queries.length)
|
|
485
|
+
});
|
|
486
|
+
// Deduplicate
|
|
487
|
+
results.forEach(r => {
|
|
488
|
+
if (!seenIds.has(r.id)) {
|
|
489
|
+
allResults.push(r);
|
|
490
|
+
seenIds.add(r.id);
|
|
491
|
+
}
|
|
492
|
+
});
|
|
493
|
+
}
|
|
494
|
+
// Sort by score and limit
|
|
495
|
+
allResults.sort((a, b) => b.score - a.score);
|
|
496
|
+
return allResults.slice(0, options.limit || 10);
|
|
497
|
+
}
|
|
498
|
+
catch (error) {
|
|
499
|
+
throw new Error(`Multi-vector search failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
/**
|
|
503
|
+
* Rerank search results using AI
|
|
504
|
+
*
|
|
505
|
+
* Takes existing results and reranks them using AI for better relevance
|
|
506
|
+
*
|
|
507
|
+
* @param results - Initial search results
|
|
508
|
+
* @param query - Original query for context
|
|
509
|
+
* @param options - Rerank options
|
|
510
|
+
* @returns Reranked results
|
|
511
|
+
*/
|
|
512
|
+
async rerank(results, query, options = {}) {
|
|
513
|
+
try {
|
|
514
|
+
if (!this.services.classifier) {
|
|
515
|
+
throw new Error('Classifier service not configured. Need geminiApiKey for AI reranking.');
|
|
516
|
+
}
|
|
517
|
+
// Simple reranking: boost results by importance and category match
|
|
518
|
+
const queryLower = query.toLowerCase();
|
|
519
|
+
const scored = results.map(r => {
|
|
520
|
+
let boost = 0;
|
|
521
|
+
// Importance boost
|
|
522
|
+
boost += ((r.importance || 5) - 5) * 0.02;
|
|
523
|
+
// Content relevance boost (simple keyword match)
|
|
524
|
+
if (r.content.toLowerCase().includes(queryLower)) {
|
|
525
|
+
boost += 0.1;
|
|
526
|
+
}
|
|
527
|
+
// Topic relevance boost
|
|
528
|
+
if (r.topic?.toLowerCase().includes(queryLower)) {
|
|
529
|
+
boost += 0.05;
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
...r,
|
|
533
|
+
score: Math.min(1.0, r.score + boost)
|
|
534
|
+
};
|
|
535
|
+
});
|
|
536
|
+
// Sort by new score
|
|
537
|
+
scored.sort((a, b) => b.score - a.score);
|
|
538
|
+
return scored.slice(0, options.limit || results.length);
|
|
539
|
+
}
|
|
540
|
+
catch (error) {
|
|
541
|
+
throw new Error(`Rerank failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Populate content for search results by fetching from Walrus
|
|
546
|
+
*
|
|
547
|
+
* Fetches and decrypts content for each result in parallel.
|
|
548
|
+
* Modifies results in-place.
|
|
549
|
+
*
|
|
550
|
+
* @param results - Search results to populate
|
|
551
|
+
*/
|
|
552
|
+
async populateContent(results) {
|
|
553
|
+
// Option A+: Skip Walrus fetch for results that already have content from local index
|
|
554
|
+
const resultsNeedingFetch = results.filter(r => !r.content && r.blobId);
|
|
555
|
+
const resultsWithLocalContent = results.length - resultsNeedingFetch.length;
|
|
556
|
+
if (resultsWithLocalContent > 0) {
|
|
557
|
+
console.log(`📦 ${resultsWithLocalContent}/${results.length} results already have content from local index (skipping Walrus fetch)`);
|
|
558
|
+
}
|
|
559
|
+
if (resultsNeedingFetch.length === 0) {
|
|
560
|
+
console.log('✅ All content available locally - no Walrus fetch needed!');
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
console.log(`🐳 Fetching content from Walrus for ${resultsNeedingFetch.length} results...`);
|
|
564
|
+
const fetchPromises = resultsNeedingFetch.map(async (result) => {
|
|
565
|
+
try {
|
|
566
|
+
if (result.blobId) {
|
|
567
|
+
const memoryPackage = await this.services.storage.retrieveMemoryPackage(result.blobId);
|
|
568
|
+
if (memoryPackage.memoryPackage?.content) {
|
|
569
|
+
result.content = memoryPackage.memoryPackage.content;
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
// Log but don't fail - content fetch is best-effort
|
|
575
|
+
console.warn(`Failed to fetch content for ${result.blobId}:`, error);
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
await Promise.all(fetchPromises);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Search and fetch content in one call
|
|
582
|
+
*
|
|
583
|
+
* Convenience method that combines vector search with content fetching.
|
|
584
|
+
*
|
|
585
|
+
* @param query - Search query
|
|
586
|
+
* @param options - Search options
|
|
587
|
+
* @returns Results with content populated
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```typescript
|
|
591
|
+
* const results = await pdw.search.withContent('programming');
|
|
592
|
+
* console.log(results[0].content); // "I love TypeScript..."
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
async withContent(query, options = {}) {
|
|
596
|
+
return this.vector(query, { ...options, fetchContent: true });
|
|
597
|
+
}
|
|
598
|
+
// ==========================================================================
|
|
599
|
+
// Knowledge Graph Methods (from GraphNamespace)
|
|
600
|
+
// ==========================================================================
|
|
601
|
+
/**
|
|
602
|
+
* Get all entities from knowledge graph
|
|
603
|
+
*
|
|
604
|
+
* @param options - Filter options
|
|
605
|
+
* @returns Array of entities
|
|
606
|
+
*
|
|
607
|
+
* @example
|
|
608
|
+
* ```typescript
|
|
609
|
+
* const entities = await pdw.search.entities({ type: 'PERSON' });
|
|
610
|
+
* ```
|
|
611
|
+
*/
|
|
612
|
+
async entities(options = {}) {
|
|
613
|
+
try {
|
|
614
|
+
const graphData = await this.services.storage.searchKnowledgeGraph(this.services.config.userAddress, { limit: options.limit || 100 });
|
|
615
|
+
let entities = graphData.entities;
|
|
616
|
+
if (options.type) {
|
|
617
|
+
entities = entities.filter((e) => e.type === options.type);
|
|
618
|
+
}
|
|
619
|
+
if (options.minConfidence) {
|
|
620
|
+
entities = entities.filter((e) => (e.confidence || 0) >= options.minConfidence);
|
|
621
|
+
}
|
|
622
|
+
return entities.map((e) => ({
|
|
623
|
+
id: e.id,
|
|
624
|
+
name: e.label || '',
|
|
625
|
+
type: e.type,
|
|
626
|
+
confidence: e.confidence || 0
|
|
627
|
+
}));
|
|
628
|
+
}
|
|
629
|
+
catch (error) {
|
|
630
|
+
throw new Error(`Get entities failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* Get all relationships from knowledge graph
|
|
635
|
+
*
|
|
636
|
+
* @param options - Filter options
|
|
637
|
+
* @returns Array of relationships
|
|
638
|
+
*
|
|
639
|
+
* @example
|
|
640
|
+
* ```typescript
|
|
641
|
+
* const rels = await pdw.search.relationships({ type: 'WORKS_AT' });
|
|
642
|
+
* ```
|
|
643
|
+
*/
|
|
644
|
+
async relationships(options = {}) {
|
|
645
|
+
try {
|
|
646
|
+
const graphData = await this.services.storage.searchKnowledgeGraph(this.services.config.userAddress, {
|
|
647
|
+
searchText: options.sourceId || options.targetId || '',
|
|
648
|
+
limit: options.limit || 100
|
|
649
|
+
});
|
|
650
|
+
let relationships = graphData.relationships;
|
|
651
|
+
if (options.type) {
|
|
652
|
+
relationships = relationships.filter((r) => r.type === options.type);
|
|
653
|
+
}
|
|
654
|
+
if (options.sourceId) {
|
|
655
|
+
relationships = relationships.filter((r) => r.source === options.sourceId);
|
|
656
|
+
}
|
|
657
|
+
if (options.targetId) {
|
|
658
|
+
relationships = relationships.filter((r) => r.target === options.targetId);
|
|
659
|
+
}
|
|
660
|
+
if (options.minConfidence) {
|
|
661
|
+
relationships = relationships.filter((r) => (r.confidence || 0) >= options.minConfidence);
|
|
662
|
+
}
|
|
663
|
+
return relationships.map((r) => ({
|
|
664
|
+
id: `${r.source}-${r.target}`,
|
|
665
|
+
source: r.source,
|
|
666
|
+
target: r.target,
|
|
667
|
+
type: r.type || 'related',
|
|
668
|
+
confidence: r.confidence || 0
|
|
669
|
+
}));
|
|
670
|
+
}
|
|
671
|
+
catch (error) {
|
|
672
|
+
throw new Error(`Get relationships failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
// ==========================================================================
|
|
676
|
+
// Index Management (from IndexNamespace)
|
|
677
|
+
// ==========================================================================
|
|
678
|
+
/**
|
|
679
|
+
* Index management operations
|
|
680
|
+
*
|
|
681
|
+
* Access via pdw.search.index.*
|
|
682
|
+
*/
|
|
683
|
+
get index() {
|
|
684
|
+
if (!this._indexSubNamespace) {
|
|
685
|
+
this._indexSubNamespace = new IndexSubNamespace(this.services);
|
|
686
|
+
}
|
|
687
|
+
return this._indexSubNamespace;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Index sub-namespace for HNSW index management
|
|
692
|
+
*/
|
|
693
|
+
class IndexSubNamespace {
|
|
694
|
+
constructor(services) {
|
|
695
|
+
this.services = services;
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Get the underlying index service
|
|
699
|
+
*/
|
|
700
|
+
getService() {
|
|
701
|
+
if (this.services.memoryIndex) {
|
|
702
|
+
return { type: 'memoryIndex', service: this.services.memoryIndex };
|
|
703
|
+
}
|
|
704
|
+
if (this.services.vector) {
|
|
705
|
+
return { type: 'vector', service: this.services.vector };
|
|
706
|
+
}
|
|
707
|
+
throw new Error('No indexing service configured. Enable local indexing in config.');
|
|
708
|
+
}
|
|
709
|
+
/**
|
|
710
|
+
* Save index to Walrus storage
|
|
711
|
+
*
|
|
712
|
+
* Persists the HNSW index binary to Walrus for durability.
|
|
713
|
+
*
|
|
714
|
+
* @param spaceId - Index space identifier (userAddress)
|
|
715
|
+
* @returns Blob ID of saved index on Walrus, or null if no index exists
|
|
716
|
+
*
|
|
717
|
+
* @example
|
|
718
|
+
* ```typescript
|
|
719
|
+
* const blobId = await pdw.search.index.save(userAddress);
|
|
720
|
+
* console.log('Index saved to Walrus:', blobId);
|
|
721
|
+
* ```
|
|
722
|
+
*/
|
|
723
|
+
async save(spaceId) {
|
|
724
|
+
const { type, service } = this.getService();
|
|
725
|
+
if (type === 'memoryIndex') {
|
|
726
|
+
await service.saveIndex(spaceId);
|
|
727
|
+
console.log(`Index saved for space: ${spaceId}`);
|
|
728
|
+
}
|
|
729
|
+
else {
|
|
730
|
+
await service.saveIndex(spaceId);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Load index from Walrus storage
|
|
735
|
+
*
|
|
736
|
+
* Loads a previously saved HNSW index from Walrus.
|
|
737
|
+
*
|
|
738
|
+
* @param spaceId - Index space identifier (userAddress)
|
|
739
|
+
* @param blobId - Blob ID of the saved index on Walrus
|
|
740
|
+
*
|
|
741
|
+
* @example
|
|
742
|
+
* ```typescript
|
|
743
|
+
* await pdw.search.index.load(userAddress, 'blobId123');
|
|
744
|
+
* ```
|
|
745
|
+
*/
|
|
746
|
+
async load(spaceId, blobId) {
|
|
747
|
+
const { type, service } = this.getService();
|
|
748
|
+
if (type === 'memoryIndex') {
|
|
749
|
+
await service.loadIndex(spaceId, blobId);
|
|
750
|
+
console.log(`Index loaded from Walrus: ${blobId}`);
|
|
751
|
+
}
|
|
752
|
+
else {
|
|
753
|
+
await service.loadIndex(spaceId, blobId);
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
/**
|
|
757
|
+
* Get index statistics
|
|
758
|
+
*
|
|
759
|
+
* @param spaceId - Index space identifier
|
|
760
|
+
* @returns Index statistics
|
|
761
|
+
*
|
|
762
|
+
* @example
|
|
763
|
+
* ```typescript
|
|
764
|
+
* const stats = pdw.search.index.stats(userAddress);
|
|
765
|
+
* console.log('Total vectors:', stats.totalVectors);
|
|
766
|
+
* ```
|
|
767
|
+
*/
|
|
768
|
+
stats(spaceId) {
|
|
769
|
+
const { type, service } = this.getService();
|
|
770
|
+
if (type === 'memoryIndex') {
|
|
771
|
+
const stats = service.getIndexStats(spaceId);
|
|
772
|
+
return {
|
|
773
|
+
totalVectors: stats.totalMemories || 0,
|
|
774
|
+
dimension: 3072,
|
|
775
|
+
spaceType: 'cosine',
|
|
776
|
+
maxElements: 10000,
|
|
777
|
+
currentCount: stats.indexSize || stats.totalMemories || 0
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
const entry = service.indexCache?.get(spaceId);
|
|
782
|
+
if (!entry) {
|
|
783
|
+
throw new Error(`Index ${spaceId} not found`);
|
|
784
|
+
}
|
|
785
|
+
const currentCount = entry.index.getCurrentCount?.() || 0;
|
|
786
|
+
return {
|
|
787
|
+
totalVectors: currentCount,
|
|
788
|
+
dimension: 3072,
|
|
789
|
+
spaceType: 'cosine',
|
|
790
|
+
maxElements: 10000,
|
|
791
|
+
currentCount
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* Clear index and remove all vectors
|
|
797
|
+
*
|
|
798
|
+
* @param spaceId - Index space identifier
|
|
799
|
+
*/
|
|
800
|
+
clear(spaceId) {
|
|
801
|
+
const { type, service } = this.getService();
|
|
802
|
+
if (type === 'memoryIndex') {
|
|
803
|
+
service.clearUserIndex(spaceId);
|
|
804
|
+
}
|
|
805
|
+
else {
|
|
806
|
+
service.indexCache?.delete(spaceId);
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
/**
|
|
810
|
+
* Force flush pending vectors
|
|
811
|
+
*
|
|
812
|
+
* @param spaceId - Index space identifier
|
|
813
|
+
*/
|
|
814
|
+
async flush(spaceId) {
|
|
815
|
+
const { type, service } = this.getService();
|
|
816
|
+
if (type === 'memoryIndex') {
|
|
817
|
+
await service.flush(spaceId);
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
//# sourceMappingURL=SearchNamespace.js.map
|