@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,458 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Storage Namespace - Direct Walrus Storage Operations
|
|
3
|
+
*
|
|
4
|
+
* Simple wrapper around StorageService for direct Walrus access.
|
|
5
|
+
* Delegates to existing storage managers:
|
|
6
|
+
* - WalrusStorageManager (upload/download)
|
|
7
|
+
* - QuiltBatchManager (batch operations)
|
|
8
|
+
* - WalrusMetadataManager (metadata)
|
|
9
|
+
* - BlobAttributesManager (dynamic fields)
|
|
10
|
+
*
|
|
11
|
+
* @module client/namespaces
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import type { ServiceContainer } from '../SimplePDWClient';
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Upload result
|
|
18
|
+
*/
|
|
19
|
+
export interface UploadResult {
|
|
20
|
+
blobId: string;
|
|
21
|
+
size: number;
|
|
22
|
+
contentType?: string;
|
|
23
|
+
metadata?: Record<string, any>;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Quilt result (batch upload)
|
|
28
|
+
*/
|
|
29
|
+
export interface QuiltResult {
|
|
30
|
+
quiltId: string;
|
|
31
|
+
files: Array<{
|
|
32
|
+
name: string;
|
|
33
|
+
blobId: string;
|
|
34
|
+
size: number;
|
|
35
|
+
}>;
|
|
36
|
+
totalSize: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Blob metadata
|
|
41
|
+
*/
|
|
42
|
+
export interface BlobMetadata {
|
|
43
|
+
[key: string]: string | number | boolean;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* File for batch upload
|
|
48
|
+
*/
|
|
49
|
+
export interface FileUpload {
|
|
50
|
+
name: string;
|
|
51
|
+
data: Uint8Array;
|
|
52
|
+
contentType?: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Storage statistics
|
|
57
|
+
*/
|
|
58
|
+
export interface StorageStats {
|
|
59
|
+
totalBlobs: number;
|
|
60
|
+
totalSize: number;
|
|
61
|
+
blobsByCategory: Record<string, number>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Storage Namespace
|
|
66
|
+
*
|
|
67
|
+
* Handles direct Walrus storage operations
|
|
68
|
+
*/
|
|
69
|
+
export class StorageNamespace {
|
|
70
|
+
constructor(private services: ServiceContainer) {}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Upload data to Walrus
|
|
74
|
+
*
|
|
75
|
+
* Delegates to StorageService.uploadBlob() (WalrusStorageManager)
|
|
76
|
+
*
|
|
77
|
+
* @param data - Data bytes to upload
|
|
78
|
+
* @param metadata - Optional metadata
|
|
79
|
+
* @returns Upload result with blob ID
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```typescript
|
|
83
|
+
* const data = new TextEncoder().encode('Hello world');
|
|
84
|
+
* const result = await pdw.storage.upload(data, {
|
|
85
|
+
* contentType: 'text/plain',
|
|
86
|
+
* category: 'document'
|
|
87
|
+
* });
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
async upload(data: Uint8Array, metadata?: BlobMetadata): Promise<UploadResult> {
|
|
91
|
+
try {
|
|
92
|
+
// Delegate to StorageService (uses WalrusStorageManager internally)
|
|
93
|
+
const result = await this.services.storage.uploadBlob(
|
|
94
|
+
data,
|
|
95
|
+
{
|
|
96
|
+
signer: this.services.config.signer.getSigner(),
|
|
97
|
+
epochs: 3,
|
|
98
|
+
deletable: true,
|
|
99
|
+
metadata: metadata as any
|
|
100
|
+
}
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
blobId: result.blobId,
|
|
105
|
+
size: data.length,
|
|
106
|
+
metadata
|
|
107
|
+
};
|
|
108
|
+
} catch (error) {
|
|
109
|
+
throw new Error(`Upload failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Download data from Walrus
|
|
115
|
+
*
|
|
116
|
+
* @param blobId - Blob ID to download
|
|
117
|
+
* @returns Data bytes
|
|
118
|
+
*/
|
|
119
|
+
async download(blobId: string): Promise<Uint8Array> {
|
|
120
|
+
try {
|
|
121
|
+
const result = await this.services.storage.retrieve(blobId);
|
|
122
|
+
|
|
123
|
+
if (result instanceof Uint8Array) {
|
|
124
|
+
return result;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Convert string to Uint8Array if needed
|
|
128
|
+
if (typeof result === 'string') {
|
|
129
|
+
return new TextEncoder().encode(result);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
throw new Error('Unexpected blob format');
|
|
133
|
+
} catch (error) {
|
|
134
|
+
throw new Error(`Download failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Delete a blob (soft delete)
|
|
140
|
+
*
|
|
141
|
+
* Walrus blobs are immutable and cannot be truly deleted.
|
|
142
|
+
* This marks the blob as deleted by setting a `deleted_at` attribute on-chain.
|
|
143
|
+
* The blob data remains on Walrus but will be filtered out in queries.
|
|
144
|
+
*
|
|
145
|
+
* @param blobId - Blob ID to mark as deleted
|
|
146
|
+
*/
|
|
147
|
+
async delete(blobId: string): Promise<void> {
|
|
148
|
+
try {
|
|
149
|
+
if (!blobId) {
|
|
150
|
+
throw new Error('Blob ID is required');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Mark as deleted by setting deleted_at attribute
|
|
154
|
+
// This is a soft delete - the blob remains on Walrus but is marked as deleted
|
|
155
|
+
await this.services.storage.updateBlobAttributes(
|
|
156
|
+
blobId,
|
|
157
|
+
{
|
|
158
|
+
deleted_at: new Date().toISOString(),
|
|
159
|
+
deleted_by: this.services.config.userAddress
|
|
160
|
+
},
|
|
161
|
+
this.services.config.signer.getSigner()
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
console.log(`Blob ${blobId} marked as deleted`);
|
|
165
|
+
} catch (error) {
|
|
166
|
+
throw new Error(`Delete failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Upload multiple files as a Quilt (batch)
|
|
172
|
+
*
|
|
173
|
+
* @param files - Array of files to upload
|
|
174
|
+
* @returns Quilt result with file mappings
|
|
175
|
+
*/
|
|
176
|
+
async uploadBatch(files: FileUpload[]): Promise<QuiltResult> {
|
|
177
|
+
try {
|
|
178
|
+
// Use uploadMemoryBatch (StorageService has this, not uploadQuilt)
|
|
179
|
+
const memories = files.map(f => ({
|
|
180
|
+
content: new TextDecoder().decode(f.data),
|
|
181
|
+
category: 'general',
|
|
182
|
+
importance: 5,
|
|
183
|
+
topic: f.name,
|
|
184
|
+
embedding: [] as number[],
|
|
185
|
+
encryptedContent: f.data, // Use file data as encrypted content
|
|
186
|
+
summary: ''
|
|
187
|
+
}));
|
|
188
|
+
|
|
189
|
+
const result = await this.services.storage.uploadMemoryBatch(
|
|
190
|
+
memories,
|
|
191
|
+
{
|
|
192
|
+
signer: this.services.config.signer.getSigner(),
|
|
193
|
+
epochs: 3,
|
|
194
|
+
userAddress: this.services.config.userAddress
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
|
|
198
|
+
return {
|
|
199
|
+
quiltId: result.quiltId,
|
|
200
|
+
files: result.files.map((f: any) => ({
|
|
201
|
+
name: f.identifier,
|
|
202
|
+
blobId: f.blobId,
|
|
203
|
+
size: 0 // Size not available in result
|
|
204
|
+
})),
|
|
205
|
+
totalSize: files.reduce((sum, f) => sum + f.data.length, 0)
|
|
206
|
+
};
|
|
207
|
+
} catch (error) {
|
|
208
|
+
throw new Error(`Batch upload failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Download multiple files from a Quilt
|
|
214
|
+
*
|
|
215
|
+
* Retrieves all WalrusFiles from a quilt and downloads their content.
|
|
216
|
+
* File names are extracted from identifiers or tags.
|
|
217
|
+
*
|
|
218
|
+
* @param quiltId - Quilt ID
|
|
219
|
+
* @returns Array of files with name and data
|
|
220
|
+
*/
|
|
221
|
+
async downloadBatch(quiltId: string): Promise<Array<{ name: string; data: Uint8Array }>> {
|
|
222
|
+
try {
|
|
223
|
+
if (!quiltId) {
|
|
224
|
+
throw new Error('Quilt ID is required');
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// Get all WalrusFile objects from quilt
|
|
228
|
+
const files = await this.services.storage.getQuiltFiles(quiltId);
|
|
229
|
+
|
|
230
|
+
if (!files || files.length === 0) {
|
|
231
|
+
console.warn(`No files found in quilt ${quiltId}`);
|
|
232
|
+
return [];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
// Download each file in parallel
|
|
236
|
+
const results = await Promise.all(
|
|
237
|
+
files.map(async (file: any, index: number) => {
|
|
238
|
+
try {
|
|
239
|
+
// Extract name from identifier or tags
|
|
240
|
+
let name = `file-${index}`;
|
|
241
|
+
|
|
242
|
+
// Try to get identifier (filename)
|
|
243
|
+
if (typeof file.getIdentifier === 'function') {
|
|
244
|
+
const identifier = file.getIdentifier();
|
|
245
|
+
if (identifier) {
|
|
246
|
+
name = identifier;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Try to get name from tags as fallback
|
|
251
|
+
if (name === `file-${index}` && typeof file.getTags === 'function') {
|
|
252
|
+
const tags = await file.getTags();
|
|
253
|
+
if (tags?.topic) {
|
|
254
|
+
name = tags.topic;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Get blob content - WalrusFile should have blob reference
|
|
259
|
+
let data: Uint8Array;
|
|
260
|
+
|
|
261
|
+
// Try to read content directly from file if available
|
|
262
|
+
if (typeof file.read === 'function') {
|
|
263
|
+
data = await file.read();
|
|
264
|
+
} else if (file.blobId) {
|
|
265
|
+
// Fallback: retrieve via blobId
|
|
266
|
+
const result = await this.services.storage.retrieve(file.blobId);
|
|
267
|
+
data = result instanceof Uint8Array ? result : new TextEncoder().encode(String(result));
|
|
268
|
+
} else if (file.contents) {
|
|
269
|
+
// Direct contents access
|
|
270
|
+
data = file.contents instanceof Uint8Array
|
|
271
|
+
? file.contents
|
|
272
|
+
: new TextEncoder().encode(String(file.contents));
|
|
273
|
+
} else {
|
|
274
|
+
throw new Error(`Cannot extract content from file at index ${index}`);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
return { name, data };
|
|
278
|
+
} catch (fileError) {
|
|
279
|
+
console.warn(`Failed to download file at index ${index}:`, fileError);
|
|
280
|
+
// Return empty data for failed files instead of throwing
|
|
281
|
+
return { name: `file-${index}-error`, data: new Uint8Array(0) };
|
|
282
|
+
}
|
|
283
|
+
})
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
// Filter out failed downloads (empty data)
|
|
287
|
+
return results.filter(r => r.data.length > 0);
|
|
288
|
+
} catch (error) {
|
|
289
|
+
throw new Error(`Batch download failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Set metadata for a blob
|
|
295
|
+
*
|
|
296
|
+
* @param blobId - Blob ID
|
|
297
|
+
* @param metadata - Metadata to attach
|
|
298
|
+
*/
|
|
299
|
+
async setMetadata(blobId: string, metadata: BlobMetadata): Promise<void> {
|
|
300
|
+
try {
|
|
301
|
+
// Use attachMetadataToBlob (correct method name)
|
|
302
|
+
await this.services.storage.attachMetadataToBlob(
|
|
303
|
+
blobId,
|
|
304
|
+
metadata as any,
|
|
305
|
+
this.services.config.signer.getSigner()
|
|
306
|
+
);
|
|
307
|
+
} catch (error) {
|
|
308
|
+
throw new Error(`Set metadata failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Get metadata for a blob
|
|
314
|
+
*
|
|
315
|
+
* @param blobId - Blob ID
|
|
316
|
+
* @returns Blob metadata
|
|
317
|
+
*/
|
|
318
|
+
async getMetadata(blobId: string): Promise<BlobMetadata> {
|
|
319
|
+
try {
|
|
320
|
+
// Use retrieveBlobMetadata (correct method name)
|
|
321
|
+
const metadata = await this.services.storage.retrieveBlobMetadata(blobId);
|
|
322
|
+
return metadata as BlobMetadata;
|
|
323
|
+
} catch (error) {
|
|
324
|
+
throw new Error(`Get metadata failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* List blobs for user
|
|
330
|
+
*
|
|
331
|
+
* @param filter - Optional filter
|
|
332
|
+
* @returns Array of blob info
|
|
333
|
+
*/
|
|
334
|
+
async listBlobs(filter?: { category?: string; limit?: number }): Promise<Array<{ blobId: string; metadata: BlobMetadata }>> {
|
|
335
|
+
try {
|
|
336
|
+
// Use searchByMetadata
|
|
337
|
+
const results = await this.services.storage.searchByMetadata(
|
|
338
|
+
this.services.config.userAddress,
|
|
339
|
+
{} // MetadataSearchQuery - minimal params
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
return results.map((r: any) => ({
|
|
343
|
+
blobId: r.blobId,
|
|
344
|
+
metadata: r.metadata || {}
|
|
345
|
+
}));
|
|
346
|
+
} catch (error) {
|
|
347
|
+
throw new Error(`List blobs failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Get storage statistics
|
|
353
|
+
*
|
|
354
|
+
* Calculates total size from blob metadata (content_size field).
|
|
355
|
+
*
|
|
356
|
+
* @returns Storage stats
|
|
357
|
+
*/
|
|
358
|
+
async getStats(): Promise<StorageStats> {
|
|
359
|
+
try {
|
|
360
|
+
// Get all blobs
|
|
361
|
+
const blobs = await this.listBlobs({ limit: 1000 });
|
|
362
|
+
|
|
363
|
+
const stats: StorageStats = {
|
|
364
|
+
totalBlobs: blobs.length,
|
|
365
|
+
totalSize: 0,
|
|
366
|
+
blobsByCategory: {}
|
|
367
|
+
};
|
|
368
|
+
|
|
369
|
+
// Count by category and accumulate size
|
|
370
|
+
blobs.forEach(b => {
|
|
371
|
+
const category = b.metadata.category as string || 'general';
|
|
372
|
+
stats.blobsByCategory[category] = (stats.blobsByCategory[category] || 0) + 1;
|
|
373
|
+
|
|
374
|
+
// Sum up content sizes from metadata
|
|
375
|
+
const size = Number(b.metadata.content_size || b.metadata.contentSize || b.metadata.size || 0);
|
|
376
|
+
if (!isNaN(size)) {
|
|
377
|
+
stats.totalSize += size;
|
|
378
|
+
}
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
return stats;
|
|
382
|
+
} catch (error) {
|
|
383
|
+
throw new Error(`Get storage stats failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Cleanup old or unused blobs
|
|
389
|
+
*
|
|
390
|
+
* Marks blobs as deleted if they meet cleanup criteria:
|
|
391
|
+
* - Already marked as deleted (removes from active queries)
|
|
392
|
+
* - Low importance and old (optional aggressive cleanup)
|
|
393
|
+
*
|
|
394
|
+
* Note: Walrus blobs cannot be truly deleted. This marks them
|
|
395
|
+
* as deleted via attributes for filtering in queries.
|
|
396
|
+
*
|
|
397
|
+
* @param options - Cleanup options
|
|
398
|
+
* @returns Number of blobs marked for cleanup
|
|
399
|
+
*/
|
|
400
|
+
async cleanup(options?: {
|
|
401
|
+
/** Remove blobs already marked as deleted from listings */
|
|
402
|
+
removeDeleted?: boolean;
|
|
403
|
+
/** Mark old, low-importance blobs as deleted */
|
|
404
|
+
aggressiveCleanup?: boolean;
|
|
405
|
+
/** Max age in days for aggressive cleanup (default: 90) */
|
|
406
|
+
maxAgeDays?: number;
|
|
407
|
+
/** Max importance for aggressive cleanup (default: 3) */
|
|
408
|
+
maxImportance?: number;
|
|
409
|
+
}): Promise<number> {
|
|
410
|
+
try {
|
|
411
|
+
const {
|
|
412
|
+
removeDeleted = true,
|
|
413
|
+
aggressiveCleanup = false,
|
|
414
|
+
maxAgeDays = 90,
|
|
415
|
+
maxImportance = 3
|
|
416
|
+
} = options || {};
|
|
417
|
+
|
|
418
|
+
let cleanedCount = 0;
|
|
419
|
+
const blobs = await this.listBlobs({ limit: 1000 });
|
|
420
|
+
|
|
421
|
+
for (const blob of blobs) {
|
|
422
|
+
try {
|
|
423
|
+
const metadata = blob.metadata;
|
|
424
|
+
|
|
425
|
+
// Skip if already processed
|
|
426
|
+
if (metadata.deleted_at) {
|
|
427
|
+
continue;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
// Aggressive cleanup: mark old, low-importance blobs
|
|
431
|
+
if (aggressiveCleanup) {
|
|
432
|
+
const importance = Number(metadata.importance) || 5;
|
|
433
|
+
const createdAt = metadata.created_at
|
|
434
|
+
? new Date(metadata.created_at as string).getTime()
|
|
435
|
+
: Date.now();
|
|
436
|
+
const ageInDays = (Date.now() - createdAt) / (1000 * 60 * 60 * 24);
|
|
437
|
+
|
|
438
|
+
if (importance <= maxImportance && ageInDays >= maxAgeDays) {
|
|
439
|
+
await this.delete(blob.blobId);
|
|
440
|
+
cleanedCount++;
|
|
441
|
+
console.log(`Cleaned up old blob ${blob.blobId} (age: ${ageInDays.toFixed(0)} days, importance: ${importance})`);
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
} catch (blobError) {
|
|
445
|
+
console.warn(`Failed to process blob ${blob.blobId} during cleanup:`, blobError);
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
if (cleanedCount > 0) {
|
|
450
|
+
console.log(`Storage cleanup completed: ${cleanedCount} blobs marked for cleanup`);
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
return cleanedCount;
|
|
454
|
+
} catch (error) {
|
|
455
|
+
throw new Error(`Cleanup failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tx Namespace - Transaction Utilities
|
|
3
|
+
*
|
|
4
|
+
* Pure delegation to TransactionService for PTB building and execution.
|
|
5
|
+
* Provides convenient methods for common blockchain operations.
|
|
6
|
+
*
|
|
7
|
+
* @module client/namespaces
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ServiceContainer } from '../SimplePDWClient';
|
|
11
|
+
import { Transaction } from '@mysten/sui/transactions';
|
|
12
|
+
import type { TransactionResult } from '../../types';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Memory transaction options
|
|
16
|
+
*/
|
|
17
|
+
export interface MemoryTxOptions {
|
|
18
|
+
category: string;
|
|
19
|
+
vectorId: number;
|
|
20
|
+
blobId: string;
|
|
21
|
+
importance: number;
|
|
22
|
+
gasBudget?: number;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Batch operation types supported by PTB
|
|
27
|
+
*/
|
|
28
|
+
export type BatchOperationType = 'createMemory' | 'updateMemory' | 'deleteMemory' | 'createCap' | 'transferCap' | 'burnCap';
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Batch operation definition
|
|
32
|
+
*/
|
|
33
|
+
export interface BatchOperation {
|
|
34
|
+
type: BatchOperationType;
|
|
35
|
+
options: any;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Tx Namespace
|
|
40
|
+
*
|
|
41
|
+
* Handles transaction building and execution utilities
|
|
42
|
+
*/
|
|
43
|
+
export class TxNamespace {
|
|
44
|
+
constructor(private services: ServiceContainer) {}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Build transaction for creating memory record
|
|
48
|
+
*
|
|
49
|
+
* Delegates to: TransactionService.buildCreateMemoryRecordLightweight()
|
|
50
|
+
*
|
|
51
|
+
* @param options - Memory creation options
|
|
52
|
+
* @returns Transaction object
|
|
53
|
+
*/
|
|
54
|
+
buildCreate(options: MemoryTxOptions): Transaction {
|
|
55
|
+
if (!this.services.tx) {
|
|
56
|
+
throw new Error('Transaction service not configured.');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return this.services.tx.buildCreateMemoryRecordLightweight({
|
|
60
|
+
category: options.category,
|
|
61
|
+
vectorId: options.vectorId,
|
|
62
|
+
blobId: options.blobId,
|
|
63
|
+
importance: options.importance,
|
|
64
|
+
gasBudget: options.gasBudget
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Build transaction for updating memory metadata
|
|
70
|
+
*
|
|
71
|
+
* Delegates to: TransactionService.buildUpdateMemoryMetadata()
|
|
72
|
+
*
|
|
73
|
+
* @param memoryId - Memory ID to update
|
|
74
|
+
* @param metadataBlobId - New metadata blob ID
|
|
75
|
+
* @returns Transaction object
|
|
76
|
+
*/
|
|
77
|
+
buildUpdate(memoryId: string, metadataBlobId: string): Transaction {
|
|
78
|
+
if (!this.services.tx) {
|
|
79
|
+
throw new Error('Transaction service not configured.');
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return this.services.tx.buildUpdateMemoryMetadata({
|
|
83
|
+
memoryId,
|
|
84
|
+
metadataBlobId,
|
|
85
|
+
embeddingDimension: 3072 // Default for Gemini
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Build transaction for deleting memory record
|
|
91
|
+
*
|
|
92
|
+
* Delegates to: TransactionService.buildDeleteMemoryRecord()
|
|
93
|
+
*
|
|
94
|
+
* @param memoryId - Memory ID to delete
|
|
95
|
+
* @returns Transaction object
|
|
96
|
+
*/
|
|
97
|
+
buildDelete(memoryId: string): Transaction {
|
|
98
|
+
if (!this.services.tx) {
|
|
99
|
+
throw new Error('Transaction service not configured.');
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return this.services.tx.buildDeleteMemoryRecord({
|
|
103
|
+
memoryId
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Execute a transaction
|
|
109
|
+
*
|
|
110
|
+
* Delegates to: TransactionService.executeTransaction()
|
|
111
|
+
*
|
|
112
|
+
* @param tx - Transaction to execute
|
|
113
|
+
* @returns Transaction result with digest and status
|
|
114
|
+
*/
|
|
115
|
+
async execute(tx: Transaction): Promise<TransactionResult> {
|
|
116
|
+
if (!this.services.tx) {
|
|
117
|
+
throw new Error('Transaction service not configured.');
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return await this.services.tx.executeTransaction(
|
|
121
|
+
tx,
|
|
122
|
+
this.services.config.signer.getSigner()
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* Build and execute in one call
|
|
128
|
+
*
|
|
129
|
+
* Convenience method combining build + execute
|
|
130
|
+
*
|
|
131
|
+
* @param options - Memory creation options
|
|
132
|
+
* @returns Transaction result
|
|
133
|
+
*/
|
|
134
|
+
async createMemory(options: MemoryTxOptions): Promise<TransactionResult> {
|
|
135
|
+
const tx = this.buildCreate(options);
|
|
136
|
+
return await this.execute(tx);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Build batch transaction (combine multiple operations into single PTB)
|
|
141
|
+
*
|
|
142
|
+
* Delegates to TransactionService.buildBatchTransaction() for proper PTB composition.
|
|
143
|
+
* All operations are executed atomically in a single transaction.
|
|
144
|
+
*
|
|
145
|
+
* @param operations - Array of typed operations to batch
|
|
146
|
+
* @returns Combined transaction with all move calls
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* const tx = pdw.tx.buildBatch([
|
|
151
|
+
* { type: 'createMemory', options: { category: 'note', vectorId: 1, blobId: 'abc', importance: 5 } },
|
|
152
|
+
* { type: 'createMemory', options: { category: 'task', vectorId: 2, blobId: 'def', importance: 7 } },
|
|
153
|
+
* ]);
|
|
154
|
+
* const result = await pdw.tx.execute(tx);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
buildBatch(operations: BatchOperation[]): Transaction {
|
|
158
|
+
if (!this.services.tx) {
|
|
159
|
+
throw new Error('Transaction service not configured.');
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
return this.services.tx.buildBatchTransaction(operations);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Build and execute batch transaction in one call
|
|
167
|
+
*
|
|
168
|
+
* Convenience method combining buildBatch + execute
|
|
169
|
+
*
|
|
170
|
+
* @param operations - Array of typed operations to batch
|
|
171
|
+
* @param gasBudget - Optional gas budget override
|
|
172
|
+
* @returns Transaction result with digest and status
|
|
173
|
+
*
|
|
174
|
+
* @example
|
|
175
|
+
* ```typescript
|
|
176
|
+
* const result = await pdw.tx.executeBatch([
|
|
177
|
+
* { type: 'createMemory', options: { ... } },
|
|
178
|
+
* { type: 'deleteMemory', options: { memoryId: '0x123' } },
|
|
179
|
+
* ]);
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
async executeBatch(operations: BatchOperation[], gasBudget?: number): Promise<TransactionResult> {
|
|
183
|
+
if (!this.services.tx) {
|
|
184
|
+
throw new Error('Transaction service not configured.');
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return await this.services.tx.executeBatch(
|
|
188
|
+
operations,
|
|
189
|
+
this.services.config.signer.getSigner(),
|
|
190
|
+
{ gasBudget }
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Estimate gas cost for transaction
|
|
196
|
+
*
|
|
197
|
+
* Dry-runs transaction to estimate gas
|
|
198
|
+
*
|
|
199
|
+
* @param tx - Transaction to estimate
|
|
200
|
+
* @returns Estimated gas cost
|
|
201
|
+
*/
|
|
202
|
+
async estimateGas(tx: Transaction): Promise<number> {
|
|
203
|
+
if (!this.services.tx) {
|
|
204
|
+
throw new Error('Transaction service not configured.');
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
try {
|
|
208
|
+
// Use Sui client to dry-run
|
|
209
|
+
const dryRun = await this.services.config.sui.client.dryRunTransactionBlock({
|
|
210
|
+
transactionBlock: await tx.build({ client: this.services.config.sui.client })
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
const gasUsed = dryRun.effects.gasUsed;
|
|
214
|
+
const totalGas =
|
|
215
|
+
Number(gasUsed.computationCost) +
|
|
216
|
+
Number(gasUsed.storageCost) -
|
|
217
|
+
Number(gasUsed.storageRebate);
|
|
218
|
+
|
|
219
|
+
return totalGas;
|
|
220
|
+
} catch (error) {
|
|
221
|
+
throw new Error(`Gas estimation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Wait for transaction confirmation
|
|
227
|
+
*
|
|
228
|
+
* Waits for transaction to be confirmed on-chain
|
|
229
|
+
*
|
|
230
|
+
* @param digest - Transaction digest
|
|
231
|
+
* @returns Transaction effects
|
|
232
|
+
*/
|
|
233
|
+
async waitForConfirmation(digest: string): Promise<TransactionResult> {
|
|
234
|
+
if (!this.services.tx) {
|
|
235
|
+
throw new Error('Transaction service not configured.');
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
try {
|
|
239
|
+
const result = await this.services.config.sui.client.waitForTransaction({
|
|
240
|
+
digest,
|
|
241
|
+
options: {
|
|
242
|
+
showEffects: true,
|
|
243
|
+
showObjectChanges: true,
|
|
244
|
+
showEvents: true
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
return {
|
|
249
|
+
digest: result.digest,
|
|
250
|
+
status: result.effects?.status?.status === 'success' ? 'success' : 'failure',
|
|
251
|
+
effects: result.effects,
|
|
252
|
+
gasUsed: result.effects?.gasUsed?.computationCost
|
|
253
|
+
? Number(result.effects.gasUsed.computationCost)
|
|
254
|
+
: undefined
|
|
255
|
+
};
|
|
256
|
+
} catch (error) {
|
|
257
|
+
throw new Error(`Wait for confirmation failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|