@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.
Files changed (784) hide show
  1. package/ARCHITECTURE.md +463 -0
  2. package/BENCHMARKS.md +238 -0
  3. package/README.md +142 -0
  4. package/dist/access/PermissionService.d.ts +179 -0
  5. package/dist/access/PermissionService.d.ts.map +1 -0
  6. package/dist/access/PermissionService.js +445 -0
  7. package/dist/access/PermissionService.js.map +1 -0
  8. package/dist/access/index.d.ts +8 -0
  9. package/dist/access/index.d.ts.map +1 -0
  10. package/dist/access/index.js +7 -0
  11. package/dist/access/index.js.map +1 -0
  12. package/dist/aggregation/AggregationService.d.ts +132 -0
  13. package/dist/aggregation/AggregationService.d.ts.map +1 -0
  14. package/dist/aggregation/AggregationService.js +225 -0
  15. package/dist/aggregation/AggregationService.js.map +1 -0
  16. package/dist/aggregation/index.d.ts +8 -0
  17. package/dist/aggregation/index.d.ts.map +1 -0
  18. package/dist/aggregation/index.js +7 -0
  19. package/dist/aggregation/index.js.map +1 -0
  20. package/dist/ai-sdk/PDWVectorStore.d.ts +124 -0
  21. package/dist/ai-sdk/PDWVectorStore.d.ts.map +1 -0
  22. package/dist/ai-sdk/PDWVectorStore.js +557 -0
  23. package/dist/ai-sdk/PDWVectorStore.js.map +1 -0
  24. package/dist/ai-sdk/index.d.ts +45 -0
  25. package/dist/ai-sdk/index.d.ts.map +1 -0
  26. package/dist/ai-sdk/index.js +45 -0
  27. package/dist/ai-sdk/index.js.map +1 -0
  28. package/dist/ai-sdk/tools.d.ts +153 -0
  29. package/dist/ai-sdk/tools.d.ts.map +1 -0
  30. package/dist/ai-sdk/tools.js +312 -0
  31. package/dist/ai-sdk/tools.js.map +1 -0
  32. package/dist/ai-sdk/types.d.ts +336 -0
  33. package/dist/ai-sdk/types.d.ts.map +1 -0
  34. package/dist/ai-sdk/types.js +36 -0
  35. package/dist/ai-sdk/types.js.map +1 -0
  36. package/dist/api/client.d.ts +43 -0
  37. package/dist/api/client.d.ts.map +1 -0
  38. package/dist/api/client.js +136 -0
  39. package/dist/api/client.js.map +1 -0
  40. package/dist/batch/BatchManager.d.ts +147 -0
  41. package/dist/batch/BatchManager.d.ts.map +1 -0
  42. package/dist/batch/BatchManager.js +427 -0
  43. package/dist/batch/BatchManager.js.map +1 -0
  44. package/dist/batch/BatchingService.d.ts +122 -0
  45. package/dist/batch/BatchingService.d.ts.map +1 -0
  46. package/dist/batch/BatchingService.js +301 -0
  47. package/dist/batch/BatchingService.js.map +1 -0
  48. package/dist/batch/MemoryProcessingCache.d.ts +147 -0
  49. package/dist/batch/MemoryProcessingCache.d.ts.map +1 -0
  50. package/dist/batch/MemoryProcessingCache.js +349 -0
  51. package/dist/batch/MemoryProcessingCache.js.map +1 -0
  52. package/dist/batch/index.d.ts +13 -0
  53. package/dist/batch/index.d.ts.map +1 -0
  54. package/dist/batch/index.js +10 -0
  55. package/dist/batch/index.js.map +1 -0
  56. package/dist/browser.d.ts +73 -0
  57. package/dist/browser.d.ts.map +1 -0
  58. package/dist/browser.js +66 -0
  59. package/dist/browser.js.map +1 -0
  60. package/dist/chat/index.d.ts +13 -0
  61. package/dist/chat/index.d.ts.map +1 -0
  62. package/dist/chat/index.js +14 -0
  63. package/dist/chat/index.js.map +1 -0
  64. package/dist/client/ClientMemoryManager.d.ts +202 -0
  65. package/dist/client/ClientMemoryManager.d.ts.map +1 -0
  66. package/dist/client/ClientMemoryManager.js +764 -0
  67. package/dist/client/ClientMemoryManager.js.map +1 -0
  68. package/dist/client/PersonalDataWallet.d.ts +406 -0
  69. package/dist/client/PersonalDataWallet.d.ts.map +1 -0
  70. package/dist/client/PersonalDataWallet.js +229 -0
  71. package/dist/client/PersonalDataWallet.js.map +1 -0
  72. package/dist/client/SimplePDWClient.d.ts +534 -0
  73. package/dist/client/SimplePDWClient.d.ts.map +1 -0
  74. package/dist/client/SimplePDWClient.js +876 -0
  75. package/dist/client/SimplePDWClient.js.map +1 -0
  76. package/dist/client/factory.d.ts +99 -0
  77. package/dist/client/factory.d.ts.map +1 -0
  78. package/dist/client/factory.js +126 -0
  79. package/dist/client/factory.js.map +1 -0
  80. package/dist/client/namespaces/AnalyticsNamespace.d.ts +178 -0
  81. package/dist/client/namespaces/AnalyticsNamespace.d.ts.map +1 -0
  82. package/dist/client/namespaces/AnalyticsNamespace.js +261 -0
  83. package/dist/client/namespaces/AnalyticsNamespace.js.map +1 -0
  84. package/dist/client/namespaces/BatchNamespace.d.ts +120 -0
  85. package/dist/client/namespaces/BatchNamespace.d.ts.map +1 -0
  86. package/dist/client/namespaces/BatchNamespace.js +261 -0
  87. package/dist/client/namespaces/BatchNamespace.js.map +1 -0
  88. package/dist/client/namespaces/CacheNamespace.d.ts +80 -0
  89. package/dist/client/namespaces/CacheNamespace.d.ts.map +1 -0
  90. package/dist/client/namespaces/CacheNamespace.js +100 -0
  91. package/dist/client/namespaces/CacheNamespace.js.map +1 -0
  92. package/dist/client/namespaces/CapabilityNamespace.d.ts +145 -0
  93. package/dist/client/namespaces/CapabilityNamespace.d.ts.map +1 -0
  94. package/dist/client/namespaces/CapabilityNamespace.js +181 -0
  95. package/dist/client/namespaces/CapabilityNamespace.js.map +1 -0
  96. package/dist/client/namespaces/ChatNamespace.d.ts +110 -0
  97. package/dist/client/namespaces/ChatNamespace.d.ts.map +1 -0
  98. package/dist/client/namespaces/ChatNamespace.js +123 -0
  99. package/dist/client/namespaces/ChatNamespace.js.map +1 -0
  100. package/dist/client/namespaces/ClassifyNamespace.d.ts +96 -0
  101. package/dist/client/namespaces/ClassifyNamespace.d.ts.map +1 -0
  102. package/dist/client/namespaces/ClassifyNamespace.js +149 -0
  103. package/dist/client/namespaces/ClassifyNamespace.js.map +1 -0
  104. package/dist/client/namespaces/ContextNamespace.d.ts +150 -0
  105. package/dist/client/namespaces/ContextNamespace.d.ts.map +1 -0
  106. package/dist/client/namespaces/ContextNamespace.js +250 -0
  107. package/dist/client/namespaces/ContextNamespace.js.map +1 -0
  108. package/dist/client/namespaces/EmbeddingsNamespace.d.ts +64 -0
  109. package/dist/client/namespaces/EmbeddingsNamespace.d.ts.map +1 -0
  110. package/dist/client/namespaces/EmbeddingsNamespace.js +86 -0
  111. package/dist/client/namespaces/EmbeddingsNamespace.js.map +1 -0
  112. package/dist/client/namespaces/EncryptionNamespace.d.ts +128 -0
  113. package/dist/client/namespaces/EncryptionNamespace.d.ts.map +1 -0
  114. package/dist/client/namespaces/EncryptionNamespace.js +161 -0
  115. package/dist/client/namespaces/EncryptionNamespace.js.map +1 -0
  116. package/dist/client/namespaces/GraphNamespace.d.ts +168 -0
  117. package/dist/client/namespaces/GraphNamespace.d.ts.map +1 -0
  118. package/dist/client/namespaces/GraphNamespace.js +314 -0
  119. package/dist/client/namespaces/GraphNamespace.js.map +1 -0
  120. package/dist/client/namespaces/IndexNamespace.d.ts +141 -0
  121. package/dist/client/namespaces/IndexNamespace.d.ts.map +1 -0
  122. package/dist/client/namespaces/IndexNamespace.js +238 -0
  123. package/dist/client/namespaces/IndexNamespace.js.map +1 -0
  124. package/dist/client/namespaces/MemoryNamespace.d.ts +277 -0
  125. package/dist/client/namespaces/MemoryNamespace.d.ts.map +1 -0
  126. package/dist/client/namespaces/MemoryNamespace.js +907 -0
  127. package/dist/client/namespaces/MemoryNamespace.js.map +1 -0
  128. package/dist/client/namespaces/PermissionsNamespace.d.ts +114 -0
  129. package/dist/client/namespaces/PermissionsNamespace.d.ts.map +1 -0
  130. package/dist/client/namespaces/PermissionsNamespace.js +179 -0
  131. package/dist/client/namespaces/PermissionsNamespace.js.map +1 -0
  132. package/dist/client/namespaces/PipelineNamespace.d.ts +125 -0
  133. package/dist/client/namespaces/PipelineNamespace.d.ts.map +1 -0
  134. package/dist/client/namespaces/PipelineNamespace.js +171 -0
  135. package/dist/client/namespaces/PipelineNamespace.js.map +1 -0
  136. package/dist/client/namespaces/SearchNamespace.d.ts +382 -0
  137. package/dist/client/namespaces/SearchNamespace.d.ts.map +1 -0
  138. package/dist/client/namespaces/SearchNamespace.js +821 -0
  139. package/dist/client/namespaces/SearchNamespace.js.map +1 -0
  140. package/dist/client/namespaces/StorageNamespace.d.ts +180 -0
  141. package/dist/client/namespaces/StorageNamespace.d.ts.map +1 -0
  142. package/dist/client/namespaces/StorageNamespace.js +354 -0
  143. package/dist/client/namespaces/StorageNamespace.js.map +1 -0
  144. package/dist/client/namespaces/TxNamespace.d.ts +143 -0
  145. package/dist/client/namespaces/TxNamespace.d.ts.map +1 -0
  146. package/dist/client/namespaces/TxNamespace.js +208 -0
  147. package/dist/client/namespaces/TxNamespace.js.map +1 -0
  148. package/dist/client/namespaces/WalletNamespace.d.ts +124 -0
  149. package/dist/client/namespaces/WalletNamespace.d.ts.map +1 -0
  150. package/dist/client/namespaces/WalletNamespace.js +197 -0
  151. package/dist/client/namespaces/WalletNamespace.js.map +1 -0
  152. package/dist/client/namespaces/consolidated/AINamespace.d.ts +265 -0
  153. package/dist/client/namespaces/consolidated/AINamespace.d.ts.map +1 -0
  154. package/dist/client/namespaces/consolidated/AINamespace.js +390 -0
  155. package/dist/client/namespaces/consolidated/AINamespace.js.map +1 -0
  156. package/dist/client/namespaces/consolidated/BlockchainNamespace.d.ts +265 -0
  157. package/dist/client/namespaces/consolidated/BlockchainNamespace.d.ts.map +1 -0
  158. package/dist/client/namespaces/consolidated/BlockchainNamespace.js +412 -0
  159. package/dist/client/namespaces/consolidated/BlockchainNamespace.js.map +1 -0
  160. package/dist/client/namespaces/consolidated/SecurityNamespace.d.ts +354 -0
  161. package/dist/client/namespaces/consolidated/SecurityNamespace.d.ts.map +1 -0
  162. package/dist/client/namespaces/consolidated/SecurityNamespace.js +522 -0
  163. package/dist/client/namespaces/consolidated/SecurityNamespace.js.map +1 -0
  164. package/dist/client/namespaces/consolidated/StorageNamespace.d.ts +235 -0
  165. package/dist/client/namespaces/consolidated/StorageNamespace.d.ts.map +1 -0
  166. package/dist/client/namespaces/consolidated/StorageNamespace.js +351 -0
  167. package/dist/client/namespaces/consolidated/StorageNamespace.js.map +1 -0
  168. package/dist/client/namespaces/consolidated/index.d.ts +17 -0
  169. package/dist/client/namespaces/consolidated/index.d.ts.map +1 -0
  170. package/dist/client/namespaces/consolidated/index.js +13 -0
  171. package/dist/client/namespaces/consolidated/index.js.map +1 -0
  172. package/dist/client/signers/KeypairSigner.d.ts +55 -0
  173. package/dist/client/signers/KeypairSigner.d.ts.map +1 -0
  174. package/dist/client/signers/KeypairSigner.js +84 -0
  175. package/dist/client/signers/KeypairSigner.js.map +1 -0
  176. package/dist/client/signers/UnifiedSigner.d.ts +88 -0
  177. package/dist/client/signers/UnifiedSigner.d.ts.map +1 -0
  178. package/dist/client/signers/UnifiedSigner.js +13 -0
  179. package/dist/client/signers/UnifiedSigner.js.map +1 -0
  180. package/dist/client/signers/WalletAdapterSigner.d.ts +94 -0
  181. package/dist/client/signers/WalletAdapterSigner.d.ts.map +1 -0
  182. package/dist/client/signers/WalletAdapterSigner.js +91 -0
  183. package/dist/client/signers/WalletAdapterSigner.js.map +1 -0
  184. package/dist/client/signers/index.d.ts +14 -0
  185. package/dist/client/signers/index.d.ts.map +1 -0
  186. package/dist/client/signers/index.js +12 -0
  187. package/dist/client/signers/index.js.map +1 -0
  188. package/dist/config/ConfigurationHelper.d.ts +167 -0
  189. package/dist/config/ConfigurationHelper.d.ts.map +1 -0
  190. package/dist/config/ConfigurationHelper.js +283 -0
  191. package/dist/config/ConfigurationHelper.js.map +1 -0
  192. package/dist/config/defaults.d.ts +9 -0
  193. package/dist/config/defaults.d.ts.map +1 -0
  194. package/dist/config/defaults.js +49 -0
  195. package/dist/config/defaults.js.map +1 -0
  196. package/dist/config/index.d.ts +9 -0
  197. package/dist/config/index.d.ts.map +1 -0
  198. package/dist/config/index.js +8 -0
  199. package/dist/config/index.js.map +1 -0
  200. package/dist/config/validation.d.ts +12 -0
  201. package/dist/config/validation.d.ts.map +1 -0
  202. package/dist/config/validation.js +61 -0
  203. package/dist/config/validation.js.map +1 -0
  204. package/dist/core/index.d.ts +11 -0
  205. package/dist/core/index.d.ts.map +1 -0
  206. package/dist/core/index.js +13 -0
  207. package/dist/core/index.js.map +1 -0
  208. package/dist/core/interfaces/IService.d.ts +162 -0
  209. package/dist/core/interfaces/IService.d.ts.map +1 -0
  210. package/dist/core/interfaces/IService.js +159 -0
  211. package/dist/core/interfaces/IService.js.map +1 -0
  212. package/dist/core/interfaces/index.d.ts +7 -0
  213. package/dist/core/interfaces/index.d.ts.map +1 -0
  214. package/dist/core/interfaces/index.js +7 -0
  215. package/dist/core/interfaces/index.js.map +1 -0
  216. package/dist/core/types/capability.d.ts +268 -0
  217. package/dist/core/types/capability.d.ts.map +1 -0
  218. package/dist/core/types/capability.js +16 -0
  219. package/dist/core/types/capability.js.map +1 -0
  220. package/dist/core/types/index.d.ts +750 -0
  221. package/dist/core/types/index.d.ts.map +1 -0
  222. package/dist/core/types/index.js +6 -0
  223. package/dist/core/types/index.js.map +1 -0
  224. package/dist/core/types/wallet.d.ts +254 -0
  225. package/dist/core/types/wallet.d.ts.map +1 -0
  226. package/dist/core/types/wallet.js +27 -0
  227. package/dist/core/types/wallet.js.map +1 -0
  228. package/dist/core/types.d.ts +8 -0
  229. package/dist/core/types.d.ts.map +1 -0
  230. package/dist/core/types.js +8 -0
  231. package/dist/core/types.js.map +1 -0
  232. package/dist/core/wallet.d.ts +209 -0
  233. package/dist/core/wallet.d.ts.map +1 -0
  234. package/dist/core/wallet.js +27 -0
  235. package/dist/core/wallet.js.map +1 -0
  236. package/dist/embedding/index.d.ts +9 -0
  237. package/dist/embedding/index.d.ts.map +1 -0
  238. package/dist/embedding/index.js +8 -0
  239. package/dist/embedding/index.js.map +1 -0
  240. package/dist/embedding/types.d.ts +302 -0
  241. package/dist/embedding/types.d.ts.map +1 -0
  242. package/dist/embedding/types.js +9 -0
  243. package/dist/embedding/types.js.map +1 -0
  244. package/dist/encryption/index.d.ts +14 -0
  245. package/dist/encryption/index.d.ts.map +1 -0
  246. package/dist/encryption/index.js +14 -0
  247. package/dist/encryption/index.js.map +1 -0
  248. package/dist/errors/index.d.ts +149 -0
  249. package/dist/errors/index.d.ts.map +1 -0
  250. package/dist/errors/index.js +301 -0
  251. package/dist/errors/index.js.map +1 -0
  252. package/dist/errors/recovery.d.ts +128 -0
  253. package/dist/errors/recovery.d.ts.map +1 -0
  254. package/dist/errors/recovery.js +320 -0
  255. package/dist/errors/recovery.js.map +1 -0
  256. package/dist/errors/validation.d.ts +106 -0
  257. package/dist/errors/validation.d.ts.map +1 -0
  258. package/dist/errors/validation.js +354 -0
  259. package/dist/errors/validation.js.map +1 -0
  260. package/dist/generated/pdw/capability.d.ts +223 -0
  261. package/dist/generated/pdw/capability.d.ts.map +1 -0
  262. package/dist/generated/pdw/capability.js +238 -0
  263. package/dist/generated/pdw/capability.js.map +1 -0
  264. package/dist/generated/pdw/deps/sui/object.d.ts +9 -0
  265. package/dist/generated/pdw/deps/sui/object.d.ts.map +1 -0
  266. package/dist/generated/pdw/deps/sui/object.js +11 -0
  267. package/dist/generated/pdw/deps/sui/object.js.map +1 -0
  268. package/dist/generated/pdw/deps/sui/vec_map.d.ts +37 -0
  269. package/dist/generated/pdw/deps/sui/vec_map.d.ts.map +1 -0
  270. package/dist/generated/pdw/deps/sui/vec_map.js +28 -0
  271. package/dist/generated/pdw/deps/sui/vec_map.js.map +1 -0
  272. package/dist/generated/pdw/memory.d.ts +676 -0
  273. package/dist/generated/pdw/memory.d.ts.map +1 -0
  274. package/dist/generated/pdw/memory.js +681 -0
  275. package/dist/generated/pdw/memory.js.map +1 -0
  276. package/dist/generated/pdw/wallet.d.ts +78 -0
  277. package/dist/generated/pdw/wallet.d.ts.map +1 -0
  278. package/dist/generated/pdw/wallet.js +89 -0
  279. package/dist/generated/pdw/wallet.js.map +1 -0
  280. package/dist/generated/utils/index.d.ts +12 -0
  281. package/dist/generated/utils/index.d.ts.map +1 -0
  282. package/dist/generated/utils/index.js +132 -0
  283. package/dist/generated/utils/index.js.map +1 -0
  284. package/dist/graph/BrowserKnowledgeGraphManager.d.ts +101 -0
  285. package/dist/graph/BrowserKnowledgeGraphManager.d.ts.map +1 -0
  286. package/dist/graph/BrowserKnowledgeGraphManager.js +411 -0
  287. package/dist/graph/BrowserKnowledgeGraphManager.js.map +1 -0
  288. package/dist/graph/GraphService.d.ts +194 -0
  289. package/dist/graph/GraphService.d.ts.map +1 -0
  290. package/dist/graph/GraphService.js +662 -0
  291. package/dist/graph/GraphService.js.map +1 -0
  292. package/dist/graph/KnowledgeGraphManager.d.ts +161 -0
  293. package/dist/graph/KnowledgeGraphManager.d.ts.map +1 -0
  294. package/dist/graph/KnowledgeGraphManager.js +495 -0
  295. package/dist/graph/KnowledgeGraphManager.js.map +1 -0
  296. package/dist/graph/index.d.ts +11 -0
  297. package/dist/graph/index.d.ts.map +1 -0
  298. package/dist/graph/index.js +9 -0
  299. package/dist/graph/index.js.map +1 -0
  300. package/dist/hooks.wip/index.d.ts +55 -0
  301. package/dist/hooks.wip/index.d.ts.map +1 -0
  302. package/dist/hooks.wip/index.js +58 -0
  303. package/dist/hooks.wip/index.js.map +1 -0
  304. package/dist/hooks.wip/useCreateMemory.d.ts +111 -0
  305. package/dist/hooks.wip/useCreateMemory.d.ts.map +1 -0
  306. package/dist/hooks.wip/useCreateMemory.js +149 -0
  307. package/dist/hooks.wip/useCreateMemory.js.map +1 -0
  308. package/dist/hooks.wip/useCreateMemoryBatch.d.ts +122 -0
  309. package/dist/hooks.wip/useCreateMemoryBatch.d.ts.map +1 -0
  310. package/dist/hooks.wip/useCreateMemoryBatch.js +221 -0
  311. package/dist/hooks.wip/useCreateMemoryBatch.js.map +1 -0
  312. package/dist/hooks.wip/useKnowledgeGraph.d.ts +66 -0
  313. package/dist/hooks.wip/useKnowledgeGraph.d.ts.map +1 -0
  314. package/dist/hooks.wip/useKnowledgeGraph.js +229 -0
  315. package/dist/hooks.wip/useKnowledgeGraph.js.map +1 -0
  316. package/dist/hooks.wip/useMemoryChat.d.ts +106 -0
  317. package/dist/hooks.wip/useMemoryChat.d.ts.map +1 -0
  318. package/dist/hooks.wip/useMemoryChat.js +284 -0
  319. package/dist/hooks.wip/useMemoryChat.js.map +1 -0
  320. package/dist/hooks.wip/useMemoryIndex.d.ts +90 -0
  321. package/dist/hooks.wip/useMemoryIndex.d.ts.map +1 -0
  322. package/dist/hooks.wip/useMemoryIndex.js +218 -0
  323. package/dist/hooks.wip/useMemoryIndex.js.map +1 -0
  324. package/dist/hooks.wip/useMemoryManager.d.ts +35 -0
  325. package/dist/hooks.wip/useMemoryManager.d.ts.map +1 -0
  326. package/dist/hooks.wip/useMemoryManager.js +86 -0
  327. package/dist/hooks.wip/useMemoryManager.js.map +1 -0
  328. package/dist/hooks.wip/useMemorySearch.d.ts +100 -0
  329. package/dist/hooks.wip/useMemorySearch.d.ts.map +1 -0
  330. package/dist/hooks.wip/useMemorySearch.js +278 -0
  331. package/dist/hooks.wip/useMemorySearch.js.map +1 -0
  332. package/dist/hooks.wip/useMemoryServices.d.ts +80 -0
  333. package/dist/hooks.wip/useMemoryServices.d.ts.map +1 -0
  334. package/dist/hooks.wip/useMemoryServices.js +264 -0
  335. package/dist/hooks.wip/useMemoryServices.js.map +1 -0
  336. package/dist/hooks.wip/usePDWRAG.d.ts +112 -0
  337. package/dist/hooks.wip/usePDWRAG.d.ts.map +1 -0
  338. package/dist/hooks.wip/usePDWRAG.js +121 -0
  339. package/dist/hooks.wip/usePDWRAG.js.map +1 -0
  340. package/dist/hooks.wip/usePDWVectorStore.d.ts +68 -0
  341. package/dist/hooks.wip/usePDWVectorStore.d.ts.map +1 -0
  342. package/dist/hooks.wip/usePDWVectorStore.js +102 -0
  343. package/dist/hooks.wip/usePDWVectorStore.js.map +1 -0
  344. package/dist/hooks.wip/useRetrieveEmbedding.d.ts +138 -0
  345. package/dist/hooks.wip/useRetrieveEmbedding.d.ts.map +1 -0
  346. package/dist/hooks.wip/useRetrieveEmbedding.js +121 -0
  347. package/dist/hooks.wip/useRetrieveEmbedding.js.map +1 -0
  348. package/dist/hooks.wip/useSearchMemories.d.ts +103 -0
  349. package/dist/hooks.wip/useSearchMemories.d.ts.map +1 -0
  350. package/dist/hooks.wip/useSearchMemories.js +146 -0
  351. package/dist/hooks.wip/useSearchMemories.js.map +1 -0
  352. package/dist/hooks.wip/useStoreEmbedding.d.ts +174 -0
  353. package/dist/hooks.wip/useStoreEmbedding.d.ts.map +1 -0
  354. package/dist/hooks.wip/useStoreEmbedding.js +167 -0
  355. package/dist/hooks.wip/useStoreEmbedding.js.map +1 -0
  356. package/dist/hooks.wip/useWalletMemories.d.ts +119 -0
  357. package/dist/hooks.wip/useWalletMemories.d.ts.map +1 -0
  358. package/dist/hooks.wip/useWalletMemories.js +166 -0
  359. package/dist/hooks.wip/useWalletMemories.js.map +1 -0
  360. package/dist/hooks.wip/utils/cache.d.ts +25 -0
  361. package/dist/hooks.wip/utils/cache.d.ts.map +1 -0
  362. package/dist/hooks.wip/utils/cache.js +38 -0
  363. package/dist/hooks.wip/utils/cache.js.map +1 -0
  364. package/dist/hooks.wip/utils/types.d.ts +138 -0
  365. package/dist/hooks.wip/utils/types.d.ts.map +1 -0
  366. package/dist/hooks.wip/utils/types.js +5 -0
  367. package/dist/hooks.wip/utils/types.js.map +1 -0
  368. package/dist/index.d.ts +190 -0
  369. package/dist/index.d.ts.map +1 -0
  370. package/dist/index.js +298 -0
  371. package/dist/index.js.map +1 -0
  372. package/dist/infrastructure/ai/EmbeddingService.d.ts +101 -0
  373. package/dist/infrastructure/ai/EmbeddingService.d.ts.map +1 -0
  374. package/dist/infrastructure/ai/EmbeddingService.js +242 -0
  375. package/dist/infrastructure/ai/EmbeddingService.js.map +1 -0
  376. package/dist/infrastructure/ai/GeminiAIService.d.ts +84 -0
  377. package/dist/infrastructure/ai/GeminiAIService.d.ts.map +1 -0
  378. package/dist/infrastructure/ai/GeminiAIService.js +300 -0
  379. package/dist/infrastructure/ai/GeminiAIService.js.map +1 -0
  380. package/dist/infrastructure/ai/index.d.ts +8 -0
  381. package/dist/infrastructure/ai/index.d.ts.map +1 -0
  382. package/dist/infrastructure/ai/index.js +8 -0
  383. package/dist/infrastructure/ai/index.js.map +1 -0
  384. package/dist/infrastructure/index.d.ts +16 -0
  385. package/dist/infrastructure/index.d.ts.map +1 -0
  386. package/dist/infrastructure/index.js +19 -0
  387. package/dist/infrastructure/index.js.map +1 -0
  388. package/dist/infrastructure/seal/EncryptionService.d.ts +162 -0
  389. package/dist/infrastructure/seal/EncryptionService.d.ts.map +1 -0
  390. package/dist/infrastructure/seal/EncryptionService.js +466 -0
  391. package/dist/infrastructure/seal/EncryptionService.js.map +1 -0
  392. package/dist/infrastructure/seal/SealService.d.ts +132 -0
  393. package/dist/infrastructure/seal/SealService.d.ts.map +1 -0
  394. package/dist/infrastructure/seal/SealService.js +473 -0
  395. package/dist/infrastructure/seal/SealService.js.map +1 -0
  396. package/dist/infrastructure/seal/index.d.ts +8 -0
  397. package/dist/infrastructure/seal/index.d.ts.map +1 -0
  398. package/dist/infrastructure/seal/index.js +8 -0
  399. package/dist/infrastructure/seal/index.js.map +1 -0
  400. package/dist/infrastructure/sui/BlockchainManager.d.ts +161 -0
  401. package/dist/infrastructure/sui/BlockchainManager.d.ts.map +1 -0
  402. package/dist/infrastructure/sui/BlockchainManager.js +421 -0
  403. package/dist/infrastructure/sui/BlockchainManager.js.map +1 -0
  404. package/dist/infrastructure/sui/SuiService.d.ts +179 -0
  405. package/dist/infrastructure/sui/SuiService.d.ts.map +1 -0
  406. package/dist/infrastructure/sui/SuiService.js +658 -0
  407. package/dist/infrastructure/sui/SuiService.js.map +1 -0
  408. package/dist/infrastructure/sui/index.d.ts +8 -0
  409. package/dist/infrastructure/sui/index.d.ts.map +1 -0
  410. package/dist/infrastructure/sui/index.js +8 -0
  411. package/dist/infrastructure/sui/index.js.map +1 -0
  412. package/dist/infrastructure/walrus/StorageManager.d.ts +207 -0
  413. package/dist/infrastructure/walrus/StorageManager.d.ts.map +1 -0
  414. package/dist/infrastructure/walrus/StorageManager.js +413 -0
  415. package/dist/infrastructure/walrus/StorageManager.js.map +1 -0
  416. package/dist/infrastructure/walrus/WalrusStorageService.d.ts +177 -0
  417. package/dist/infrastructure/walrus/WalrusStorageService.d.ts.map +1 -0
  418. package/dist/infrastructure/walrus/WalrusStorageService.js +403 -0
  419. package/dist/infrastructure/walrus/WalrusStorageService.js.map +1 -0
  420. package/dist/infrastructure/walrus/index.d.ts +8 -0
  421. package/dist/infrastructure/walrus/index.d.ts.map +1 -0
  422. package/dist/infrastructure/walrus/index.js +8 -0
  423. package/dist/infrastructure/walrus/index.js.map +1 -0
  424. package/dist/langchain/PDWEmbeddings.d.ts +77 -0
  425. package/dist/langchain/PDWEmbeddings.d.ts.map +1 -0
  426. package/dist/langchain/PDWEmbeddings.js +96 -0
  427. package/dist/langchain/PDWEmbeddings.js.map +1 -0
  428. package/dist/langchain/PDWVectorStore.d.ts +173 -0
  429. package/dist/langchain/PDWVectorStore.d.ts.map +1 -0
  430. package/dist/langchain/PDWVectorStore.js +304 -0
  431. package/dist/langchain/PDWVectorStore.js.map +1 -0
  432. package/dist/langchain/createPDWRAG.d.ts +115 -0
  433. package/dist/langchain/createPDWRAG.d.ts.map +1 -0
  434. package/dist/langchain/createPDWRAG.js +181 -0
  435. package/dist/langchain/createPDWRAG.js.map +1 -0
  436. package/dist/langchain/index.d.ts +35 -0
  437. package/dist/langchain/index.d.ts.map +1 -0
  438. package/dist/langchain/index.js +35 -0
  439. package/dist/langchain/index.js.map +1 -0
  440. package/dist/memory/index.d.ts +13 -0
  441. package/dist/memory/index.d.ts.map +1 -0
  442. package/dist/memory/index.js +14 -0
  443. package/dist/memory/index.js.map +1 -0
  444. package/dist/permissions/ConsentRepository.d.ts +71 -0
  445. package/dist/permissions/ConsentRepository.d.ts.map +1 -0
  446. package/dist/permissions/ConsentRepository.js +297 -0
  447. package/dist/permissions/ConsentRepository.js.map +1 -0
  448. package/dist/permissions/index.d.ts +9 -0
  449. package/dist/permissions/index.d.ts.map +1 -0
  450. package/dist/permissions/index.js +8 -0
  451. package/dist/permissions/index.js.map +1 -0
  452. package/dist/pipeline/MemoryPipeline.d.ts +191 -0
  453. package/dist/pipeline/MemoryPipeline.d.ts.map +1 -0
  454. package/dist/pipeline/MemoryPipeline.js +588 -0
  455. package/dist/pipeline/MemoryPipeline.js.map +1 -0
  456. package/dist/pipeline/PipelineManager.d.ts +178 -0
  457. package/dist/pipeline/PipelineManager.d.ts.map +1 -0
  458. package/dist/pipeline/PipelineManager.js +485 -0
  459. package/dist/pipeline/PipelineManager.js.map +1 -0
  460. package/dist/pipeline/index.d.ts +13 -0
  461. package/dist/pipeline/index.d.ts.map +1 -0
  462. package/dist/pipeline/index.js +11 -0
  463. package/dist/pipeline/index.js.map +1 -0
  464. package/dist/retrieval/AdvancedSearchService.d.ts +231 -0
  465. package/dist/retrieval/AdvancedSearchService.d.ts.map +1 -0
  466. package/dist/retrieval/AdvancedSearchService.js +384 -0
  467. package/dist/retrieval/AdvancedSearchService.js.map +1 -0
  468. package/dist/retrieval/MemoryAnalyticsService.d.ts +227 -0
  469. package/dist/retrieval/MemoryAnalyticsService.d.ts.map +1 -0
  470. package/dist/retrieval/MemoryAnalyticsService.js +417 -0
  471. package/dist/retrieval/MemoryAnalyticsService.js.map +1 -0
  472. package/dist/retrieval/MemoryDecryptionPipeline.d.ts +191 -0
  473. package/dist/retrieval/MemoryDecryptionPipeline.d.ts.map +1 -0
  474. package/dist/retrieval/MemoryDecryptionPipeline.js +623 -0
  475. package/dist/retrieval/MemoryDecryptionPipeline.js.map +1 -0
  476. package/dist/retrieval/MemoryRetrievalService.d.ts +248 -0
  477. package/dist/retrieval/MemoryRetrievalService.d.ts.map +1 -0
  478. package/dist/retrieval/MemoryRetrievalService.js +519 -0
  479. package/dist/retrieval/MemoryRetrievalService.js.map +1 -0
  480. package/dist/retrieval/index.d.ts +14 -0
  481. package/dist/retrieval/index.d.ts.map +1 -0
  482. package/dist/retrieval/index.js +10 -0
  483. package/dist/retrieval/index.js.map +1 -0
  484. package/dist/services/BatchService.d.ts +109 -0
  485. package/dist/services/BatchService.d.ts.map +1 -0
  486. package/dist/services/BatchService.js +259 -0
  487. package/dist/services/BatchService.js.map +1 -0
  488. package/dist/services/CapabilityService.d.ts +141 -0
  489. package/dist/services/CapabilityService.d.ts.map +1 -0
  490. package/dist/services/CapabilityService.js +361 -0
  491. package/dist/services/CapabilityService.js.map +1 -0
  492. package/dist/services/ChatService.d.ts +89 -0
  493. package/dist/services/ChatService.d.ts.map +1 -0
  494. package/dist/services/ChatService.js +319 -0
  495. package/dist/services/ChatService.js.map +1 -0
  496. package/dist/services/ClassifierService.d.ts +104 -0
  497. package/dist/services/ClassifierService.d.ts.map +1 -0
  498. package/dist/services/ClassifierService.js +374 -0
  499. package/dist/services/ClassifierService.js.map +1 -0
  500. package/dist/services/CrossContextPermissionService.d.ts +149 -0
  501. package/dist/services/CrossContextPermissionService.d.ts.map +1 -0
  502. package/dist/services/CrossContextPermissionService.js +337 -0
  503. package/dist/services/CrossContextPermissionService.js.map +1 -0
  504. package/dist/services/EmbeddingService.d.ts +206 -0
  505. package/dist/services/EmbeddingService.d.ts.map +1 -0
  506. package/dist/services/EmbeddingService.js +504 -0
  507. package/dist/services/EmbeddingService.js.map +1 -0
  508. package/dist/services/EncryptionService.d.ts +201 -0
  509. package/dist/services/EncryptionService.d.ts.map +1 -0
  510. package/dist/services/EncryptionService.js +558 -0
  511. package/dist/services/EncryptionService.js.map +1 -0
  512. package/dist/services/GeminiAIService.d.ts +112 -0
  513. package/dist/services/GeminiAIService.d.ts.map +1 -0
  514. package/dist/services/GeminiAIService.js +389 -0
  515. package/dist/services/GeminiAIService.js.map +1 -0
  516. package/dist/services/IndexManager.d.ts +238 -0
  517. package/dist/services/IndexManager.d.ts.map +1 -0
  518. package/dist/services/IndexManager.js +691 -0
  519. package/dist/services/IndexManager.js.map +1 -0
  520. package/dist/services/MemoryIndexService.d.ts +222 -0
  521. package/dist/services/MemoryIndexService.d.ts.map +1 -0
  522. package/dist/services/MemoryIndexService.js +695 -0
  523. package/dist/services/MemoryIndexService.js.map +1 -0
  524. package/dist/services/MemoryService.d.ts +156 -0
  525. package/dist/services/MemoryService.d.ts.map +1 -0
  526. package/dist/services/MemoryService.js +273 -0
  527. package/dist/services/MemoryService.js.map +1 -0
  528. package/dist/services/QueryService.d.ts +182 -0
  529. package/dist/services/QueryService.d.ts.map +1 -0
  530. package/dist/services/QueryService.js +631 -0
  531. package/dist/services/QueryService.js.map +1 -0
  532. package/dist/services/StorageService.d.ts +523 -0
  533. package/dist/services/StorageService.d.ts.map +1 -0
  534. package/dist/services/StorageService.js +627 -0
  535. package/dist/services/StorageService.js.map +1 -0
  536. package/dist/services/TransactionService.d.ts +179 -0
  537. package/dist/services/TransactionService.d.ts.map +1 -0
  538. package/dist/services/TransactionService.js +639 -0
  539. package/dist/services/TransactionService.js.map +1 -0
  540. package/dist/services/VectorService.d.ts +122 -0
  541. package/dist/services/VectorService.d.ts.map +1 -0
  542. package/dist/services/VectorService.js +371 -0
  543. package/dist/services/VectorService.js.map +1 -0
  544. package/dist/services/ViewService.d.ts +126 -0
  545. package/dist/services/ViewService.d.ts.map +1 -0
  546. package/dist/services/ViewService.js +356 -0
  547. package/dist/services/ViewService.js.map +1 -0
  548. package/dist/services/index.d.ts +12 -0
  549. package/dist/services/index.d.ts.map +1 -0
  550. package/dist/services/index.js +11 -0
  551. package/dist/services/index.js.map +1 -0
  552. package/dist/services/storage/BlobAttributesManager.d.ts +60 -0
  553. package/dist/services/storage/BlobAttributesManager.d.ts.map +1 -0
  554. package/dist/services/storage/BlobAttributesManager.js +265 -0
  555. package/dist/services/storage/BlobAttributesManager.js.map +1 -0
  556. package/dist/services/storage/KnowledgeGraphManager.d.ts +162 -0
  557. package/dist/services/storage/KnowledgeGraphManager.d.ts.map +1 -0
  558. package/dist/services/storage/KnowledgeGraphManager.js +303 -0
  559. package/dist/services/storage/KnowledgeGraphManager.js.map +1 -0
  560. package/dist/services/storage/MemorySearchManager.d.ts +154 -0
  561. package/dist/services/storage/MemorySearchManager.d.ts.map +1 -0
  562. package/dist/services/storage/MemorySearchManager.js +260 -0
  563. package/dist/services/storage/MemorySearchManager.js.map +1 -0
  564. package/dist/services/storage/QuiltBatchManager.d.ts +185 -0
  565. package/dist/services/storage/QuiltBatchManager.d.ts.map +1 -0
  566. package/dist/services/storage/QuiltBatchManager.js +385 -0
  567. package/dist/services/storage/QuiltBatchManager.js.map +1 -0
  568. package/dist/services/storage/WalrusMetadataManager.d.ts +89 -0
  569. package/dist/services/storage/WalrusMetadataManager.d.ts.map +1 -0
  570. package/dist/services/storage/WalrusMetadataManager.js +177 -0
  571. package/dist/services/storage/WalrusMetadataManager.js.map +1 -0
  572. package/dist/services/storage/WalrusStorageManager.d.ts +113 -0
  573. package/dist/services/storage/WalrusStorageManager.d.ts.map +1 -0
  574. package/dist/services/storage/WalrusStorageManager.js +211 -0
  575. package/dist/services/storage/WalrusStorageManager.js.map +1 -0
  576. package/dist/services/storage/index.d.ts +24 -0
  577. package/dist/services/storage/index.d.ts.map +1 -0
  578. package/dist/services/storage/index.js +18 -0
  579. package/dist/services/storage/index.js.map +1 -0
  580. package/dist/transactions/index.d.ts +13 -0
  581. package/dist/transactions/index.d.ts.map +1 -0
  582. package/dist/transactions/index.js +14 -0
  583. package/dist/transactions/index.js.map +1 -0
  584. package/dist/types/index.d.ts +12 -0
  585. package/dist/types/index.d.ts.map +1 -0
  586. package/dist/types/index.js +13 -0
  587. package/dist/types/index.js.map +1 -0
  588. package/dist/types/wallet.d.ts +12 -0
  589. package/dist/types/wallet.d.ts.map +1 -0
  590. package/dist/types/wallet.js +13 -0
  591. package/dist/types/wallet.js.map +1 -0
  592. package/dist/utils/index.d.ts +21 -0
  593. package/dist/utils/index.d.ts.map +1 -0
  594. package/dist/utils/index.js +30 -0
  595. package/dist/utils/index.js.map +1 -0
  596. package/dist/utils/rebuildIndex.d.ts +79 -0
  597. package/dist/utils/rebuildIndex.d.ts.map +1 -0
  598. package/dist/utils/rebuildIndex.js +211 -0
  599. package/dist/utils/rebuildIndex.js.map +1 -0
  600. package/dist/utils/rebuildIndexNode.d.ts +70 -0
  601. package/dist/utils/rebuildIndexNode.d.ts.map +1 -0
  602. package/dist/utils/rebuildIndexNode.js +236 -0
  603. package/dist/utils/rebuildIndexNode.js.map +1 -0
  604. package/dist/vector/BrowserHnswIndexService.d.ts +93 -0
  605. package/dist/vector/BrowserHnswIndexService.d.ts.map +1 -0
  606. package/dist/vector/BrowserHnswIndexService.js +581 -0
  607. package/dist/vector/BrowserHnswIndexService.js.map +1 -0
  608. package/dist/vector/HnswWasmService.d.ts +97 -0
  609. package/dist/vector/HnswWasmService.d.ts.map +1 -0
  610. package/dist/vector/HnswWasmService.js +518 -0
  611. package/dist/vector/HnswWasmService.js.map +1 -0
  612. package/dist/vector/IHnswService.d.ts +179 -0
  613. package/dist/vector/IHnswService.d.ts.map +1 -0
  614. package/dist/vector/IHnswService.js +25 -0
  615. package/dist/vector/IHnswService.js.map +1 -0
  616. package/dist/vector/NodeHnswService.d.ts +80 -0
  617. package/dist/vector/NodeHnswService.d.ts.map +1 -0
  618. package/dist/vector/NodeHnswService.js +589 -0
  619. package/dist/vector/NodeHnswService.js.map +1 -0
  620. package/dist/vector/VectorManager.d.ts +142 -0
  621. package/dist/vector/VectorManager.d.ts.map +1 -0
  622. package/dist/vector/VectorManager.js +339 -0
  623. package/dist/vector/VectorManager.js.map +1 -0
  624. package/dist/vector/createHnswService.d.ts +51 -0
  625. package/dist/vector/createHnswService.d.ts.map +1 -0
  626. package/dist/vector/createHnswService.js +120 -0
  627. package/dist/vector/createHnswService.js.map +1 -0
  628. package/dist/vector/index.d.ts +24 -0
  629. package/dist/vector/index.d.ts.map +1 -0
  630. package/dist/vector/index.js +24 -0
  631. package/dist/vector/index.js.map +1 -0
  632. package/dist/view/ViewService.d.ts +136 -0
  633. package/dist/view/ViewService.d.ts.map +1 -0
  634. package/dist/view/ViewService.js +325 -0
  635. package/dist/view/ViewService.js.map +1 -0
  636. package/dist/view/index.d.ts +7 -0
  637. package/dist/view/index.d.ts.map +1 -0
  638. package/dist/view/index.js +7 -0
  639. package/dist/view/index.js.map +1 -0
  640. package/dist/wallet/ContextWalletService.d.ts +172 -0
  641. package/dist/wallet/ContextWalletService.d.ts.map +1 -0
  642. package/dist/wallet/ContextWalletService.js +510 -0
  643. package/dist/wallet/ContextWalletService.js.map +1 -0
  644. package/dist/wallet/MainWalletService.d.ts +114 -0
  645. package/dist/wallet/MainWalletService.d.ts.map +1 -0
  646. package/dist/wallet/MainWalletService.js +259 -0
  647. package/dist/wallet/MainWalletService.js.map +1 -0
  648. package/dist/wallet/index.d.ts +16 -0
  649. package/dist/wallet/index.d.ts.map +1 -0
  650. package/dist/wallet/index.js +14 -0
  651. package/dist/wallet/index.js.map +1 -0
  652. package/package.json +150 -0
  653. package/src/access/PermissionService.ts +636 -0
  654. package/src/access/index.ts +8 -0
  655. package/src/aggregation/AggregationService.ts +390 -0
  656. package/src/aggregation/index.ts +8 -0
  657. package/src/ai-sdk/PDWVectorStore.ts +712 -0
  658. package/src/ai-sdk/index.ts +65 -0
  659. package/src/ai-sdk/tools.ts +460 -0
  660. package/src/ai-sdk/types.ts +404 -0
  661. package/src/batch/BatchManager.ts +598 -0
  662. package/src/batch/BatchingService.ts +430 -0
  663. package/src/batch/MemoryProcessingCache.ts +493 -0
  664. package/src/batch/index.ts +31 -0
  665. package/src/browser.ts +196 -0
  666. package/src/client/ClientMemoryManager.ts +982 -0
  667. package/src/client/PersonalDataWallet.ts +346 -0
  668. package/src/client/SimplePDWClient.ts +1180 -0
  669. package/src/client/factory.ts +155 -0
  670. package/src/client/namespaces/AnalyticsNamespace.ts +377 -0
  671. package/src/client/namespaces/BatchNamespace.ts +356 -0
  672. package/src/client/namespaces/CacheNamespace.ts +123 -0
  673. package/src/client/namespaces/CapabilityNamespace.ts +217 -0
  674. package/src/client/namespaces/ClassifyNamespace.ts +169 -0
  675. package/src/client/namespaces/ContextNamespace.ts +297 -0
  676. package/src/client/namespaces/EmbeddingsNamespace.ts +99 -0
  677. package/src/client/namespaces/EncryptionNamespace.ts +221 -0
  678. package/src/client/namespaces/GraphNamespace.ts +468 -0
  679. package/src/client/namespaces/IndexNamespace.ts +283 -0
  680. package/src/client/namespaces/MemoryNamespace.ts +1135 -0
  681. package/src/client/namespaces/PermissionsNamespace.ts +254 -0
  682. package/src/client/namespaces/PipelineNamespace.ts +220 -0
  683. package/src/client/namespaces/SearchNamespace.ts +1036 -0
  684. package/src/client/namespaces/StorageNamespace.ts +458 -0
  685. package/src/client/namespaces/TxNamespace.ts +260 -0
  686. package/src/client/namespaces/WalletNamespace.ts +243 -0
  687. package/src/client/namespaces/consolidated/AINamespace.ts +449 -0
  688. package/src/client/namespaces/consolidated/BlockchainNamespace.ts +492 -0
  689. package/src/client/namespaces/consolidated/SecurityNamespace.ts +648 -0
  690. package/src/client/namespaces/consolidated/StorageNamespace.ts +440 -0
  691. package/src/client/namespaces/consolidated/index.ts +39 -0
  692. package/src/client/signers/KeypairSigner.ts +101 -0
  693. package/src/client/signers/UnifiedSigner.ts +99 -0
  694. package/src/client/signers/WalletAdapterSigner.ts +149 -0
  695. package/src/client/signers/index.ts +19 -0
  696. package/src/config/ConfigurationHelper.ts +413 -0
  697. package/src/config/defaults.ts +52 -0
  698. package/src/config/index.ts +9 -0
  699. package/src/config/validation.ts +71 -0
  700. package/src/core/index.ts +14 -0
  701. package/src/core/interfaces/IService.ts +307 -0
  702. package/src/core/interfaces/index.ts +8 -0
  703. package/src/core/types/capability.ts +297 -0
  704. package/src/core/types/index.ts +871 -0
  705. package/src/core/types/wallet.ts +271 -0
  706. package/src/core/types.ts +9 -0
  707. package/src/core/wallet.ts +223 -0
  708. package/src/embedding/index.ts +20 -0
  709. package/src/embedding/types.ts +358 -0
  710. package/src/errors/index.ts +603 -0
  711. package/src/errors/recovery.ts +462 -0
  712. package/src/errors/validation.ts +568 -0
  713. package/src/generated/pdw/capability.ts +319 -0
  714. package/src/generated/pdw/deps/sui/object.ts +13 -0
  715. package/src/generated/pdw/deps/sui/vec_map.ts +33 -0
  716. package/src/generated/pdw/memory.ts +1088 -0
  717. package/src/generated/pdw/wallet.ts +124 -0
  718. package/src/generated/utils/index.ts +159 -0
  719. package/src/graph/GraphService.ts +888 -0
  720. package/src/graph/KnowledgeGraphManager.ts +729 -0
  721. package/src/graph/index.ts +26 -0
  722. package/src/index.ts +458 -0
  723. package/src/infrastructure/index.ts +22 -0
  724. package/src/infrastructure/seal/EncryptionService.ts +604 -0
  725. package/src/infrastructure/seal/SealService.ts +616 -0
  726. package/src/infrastructure/seal/index.ts +9 -0
  727. package/src/infrastructure/sui/BlockchainManager.ts +628 -0
  728. package/src/infrastructure/sui/SuiService.ts +888 -0
  729. package/src/infrastructure/sui/index.ts +9 -0
  730. package/src/infrastructure/walrus/StorageManager.ts +605 -0
  731. package/src/infrastructure/walrus/WalrusStorageService.ts +613 -0
  732. package/src/infrastructure/walrus/index.ts +9 -0
  733. package/src/langchain/PDWEmbeddings.ts +145 -0
  734. package/src/langchain/PDWVectorStore.ts +456 -0
  735. package/src/langchain/README.md +116 -0
  736. package/src/langchain/createPDWRAG.ts +303 -0
  737. package/src/langchain/index.ts +47 -0
  738. package/src/permissions/ConsentRepository.ts +364 -0
  739. package/src/permissions/index.ts +9 -0
  740. package/src/pipeline/MemoryPipeline.ts +863 -0
  741. package/src/pipeline/PipelineManager.ts +684 -0
  742. package/src/pipeline/index.ts +27 -0
  743. package/src/retrieval/AdvancedSearchService.ts +630 -0
  744. package/src/retrieval/MemoryAnalyticsService.ts +712 -0
  745. package/src/retrieval/MemoryDecryptionPipeline.ts +825 -0
  746. package/src/retrieval/MemoryRetrievalService.ts +831 -0
  747. package/src/retrieval/index.ts +43 -0
  748. package/src/services/BatchService.ts +353 -0
  749. package/src/services/CapabilityService.ts +448 -0
  750. package/src/services/ClassifierService.ts +466 -0
  751. package/src/services/CrossContextPermissionService.ts +484 -0
  752. package/src/services/EmbeddingService.ts +706 -0
  753. package/src/services/EncryptionService.ts +712 -0
  754. package/src/services/GeminiAIService.ts +497 -0
  755. package/src/services/IndexManager.ts +1004 -0
  756. package/src/services/MemoryIndexService.ts +922 -0
  757. package/src/services/MemoryService.ts +370 -0
  758. package/src/services/QueryService.ts +891 -0
  759. package/src/services/StorageService.ts +1111 -0
  760. package/src/services/TransactionService.ts +791 -0
  761. package/src/services/VectorService.ts +462 -0
  762. package/src/services/ViewService.ts +485 -0
  763. package/src/services/index.ts +25 -0
  764. package/src/services/storage/BlobAttributesManager.ts +342 -0
  765. package/src/services/storage/KnowledgeGraphManager.ts +425 -0
  766. package/src/services/storage/MemorySearchManager.ts +387 -0
  767. package/src/services/storage/QuiltBatchManager.ts +532 -0
  768. package/src/services/storage/WalrusMetadataManager.ts +271 -0
  769. package/src/services/storage/WalrusStorageManager.ts +290 -0
  770. package/src/services/storage/index.ts +52 -0
  771. package/src/types/index.ts +13 -0
  772. package/src/utils/index.ts +68 -0
  773. package/src/utils/rebuildIndex.ts +290 -0
  774. package/src/utils/rebuildIndexNode.ts +341 -0
  775. package/src/vector/BrowserHnswIndexService.ts +758 -0
  776. package/src/vector/HnswWasmService.ts +679 -0
  777. package/src/vector/IHnswService.ts +224 -0
  778. package/src/vector/NodeHnswService.ts +713 -0
  779. package/src/vector/VectorManager.ts +479 -0
  780. package/src/vector/createHnswService.ts +135 -0
  781. package/src/vector/index.ts +57 -0
  782. package/src/wallet/ContextWalletService.ts +657 -0
  783. package/src/wallet/MainWalletService.ts +318 -0
  784. package/src/wallet/index.ts +17 -0
@@ -0,0 +1,791 @@
1
+ import { Transaction, SerialTransactionExecutor } from '@mysten/sui/transactions';
2
+ import { SuiClient } from '@mysten/sui/client';
3
+ import {
4
+ PDWConfig,
5
+ TransactionOptions,
6
+ TransactionResult,
7
+ CreateMemoryRecordTxOptions,
8
+ CreateMemoryRecordLightweightTxOptions,
9
+ UpdateMemoryMetadataTxOptions,
10
+ UpdateMemoryRecordTxOptions,
11
+ DeleteMemoryRecordTxOptions,
12
+ CreateMemoryIndexTxOptions,
13
+ UpdateMemoryIndexTxOptions,
14
+ GrantAccessTxOptions,
15
+ RevokeAccessTxOptions,
16
+ RegisterContentTxOptions,
17
+ } from '../types';
18
+
19
+ // Import generated Move contract functions
20
+ import * as MemoryModule from '../generated/pdw/memory';
21
+ import * as CapabilityModule from '../generated/pdw/capability';
22
+
23
+ /**
24
+ * TransactionService provides high-level transaction building and execution
25
+ * for Personal Data Wallet Move contracts with proper error handling and gas management.
26
+ *
27
+ * Uses SerialTransactionExecutor to prevent gas coin version conflicts and equivocation
28
+ * when multiple transactions are executed in sequence. The executor caches object versions
29
+ * and manages gas coins automatically.
30
+ *
31
+ * @see https://sdk.mystenlabs.com/typescript/executors
32
+ */
33
+ export class TransactionService {
34
+ private executor: SerialTransactionExecutor | null = null;
35
+ private currentSigner: any = null;
36
+
37
+ constructor(
38
+ private client: SuiClient,
39
+ private config: PDWConfig
40
+ ) {}
41
+
42
+ /**
43
+ * Get or create SerialTransactionExecutor for the given signer.
44
+ * The executor caches object versions and prevents equivocation.
45
+ */
46
+ private getExecutor(signer: any): SerialTransactionExecutor {
47
+ // Create new executor if signer changed or doesn't exist
48
+ if (!this.executor || this.currentSigner !== signer) {
49
+ this.executor = new SerialTransactionExecutor({
50
+ client: this.client,
51
+ signer,
52
+ });
53
+ this.currentSigner = signer;
54
+ }
55
+ return this.executor;
56
+ }
57
+
58
+ /**
59
+ * Reset the executor (useful when gas coin is exhausted or for cleanup)
60
+ */
61
+ resetExecutor(): void {
62
+ this.executor = null;
63
+ this.currentSigner = null;
64
+ }
65
+
66
+ // ==================== MEMORY TRANSACTIONS ====================
67
+
68
+ /**
69
+ * Build transaction to create a new memory record
70
+ */
71
+ buildCreateMemoryRecord(options: CreateMemoryRecordTxOptions): Transaction {
72
+ const tx = new Transaction();
73
+
74
+ // Set gas budget if provided
75
+ if (options.gasBudget) {
76
+ tx.setGasBudget(options.gasBudget);
77
+ }
78
+
79
+ // Set gas price if provided
80
+ if (options.gasPrice) {
81
+ tx.setGasPrice(options.gasPrice);
82
+ }
83
+
84
+ // Call the memory contract function with Clock for real-time timestamp
85
+ tx.moveCall({
86
+ target: `${this.config.packageId}::memory::create_memory_record`,
87
+ arguments: [
88
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.category))),
89
+ tx.pure.u64(options.vectorId),
90
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.blobId))),
91
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.contentType))),
92
+ tx.pure.u64(options.contentSize),
93
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.contentHash))),
94
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.topic))),
95
+ tx.pure.u8(options.importance),
96
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.embeddingBlobId))),
97
+ tx.object('0x6'), // Sui Clock object for real-time timestamp
98
+ ],
99
+ });
100
+
101
+ return tx;
102
+ }
103
+
104
+ /**
105
+ * Build transaction to create a lightweight memory record
106
+ *
107
+ * This creates a minimal on-chain Memory struct with only essential queryable fields.
108
+ * Rich metadata should be stored as Walrus blob metadata for gas efficiency.
109
+ *
110
+ * Use this when:
111
+ * - Gas costs are a concern (saves ~50% gas vs full metadata)
112
+ * - Rich metadata is stored on Walrus blob
113
+ * - Only need basic filtering (category, vector_id, importance)
114
+ *
115
+ * @param options - Lightweight memory creation options
116
+ * @returns Transaction to create lightweight memory record
117
+ */
118
+ buildCreateMemoryRecordLightweight(options: CreateMemoryRecordLightweightTxOptions): Transaction {
119
+ const tx = new Transaction();
120
+
121
+ // Set gas budget if provided
122
+ if (options.gasBudget) {
123
+ tx.setGasBudget(options.gasBudget);
124
+ }
125
+
126
+ // Set gas price if provided
127
+ if (options.gasPrice) {
128
+ tx.setGasPrice(options.gasPrice);
129
+ }
130
+
131
+ // Call the lightweight memory creation function
132
+ // Note: Walrus blob_id is a base64 string (URL-safe, no padding)
133
+ // Example: "E7_nNXvFU_3qZVu3OH1yycRG7LZlyn1-UxEDCDDqGGU"
134
+ // We encode the string to vector<u8> for the Move function parameter
135
+ // Clock object (0x6) is required for real-time timestamp
136
+ tx.moveCall({
137
+ target: `${this.config.packageId}::memory::create_memory_record_lightweight`,
138
+ arguments: [
139
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.category))),
140
+ tx.pure.u64(options.vectorId),
141
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.blobId))),
142
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.blobObjectId || ''))),
143
+ tx.pure.u8(options.importance),
144
+ tx.object('0x6'), // Sui Clock object for real-time timestamp
145
+ ],
146
+ });
147
+
148
+ return tx;
149
+ }
150
+
151
+ /**
152
+ * Build transaction to update memory metadata
153
+ */
154
+ buildUpdateMemoryMetadata(options: UpdateMemoryMetadataTxOptions): Transaction {
155
+ const tx = new Transaction();
156
+
157
+ if (options.gasBudget) {
158
+ tx.setGasBudget(options.gasBudget);
159
+ }
160
+
161
+ if (options.gasPrice) {
162
+ tx.setGasPrice(options.gasPrice);
163
+ }
164
+
165
+ // Note: Using tx.moveCall with Clock for real-time timestamp
166
+ tx.moveCall({
167
+ target: `${this.config.packageId}::memory::update_memory_metadata`,
168
+ arguments: [
169
+ tx.object(options.memoryId),
170
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.metadataBlobId))),
171
+ tx.pure.u8(options.embeddingDimension || 5),
172
+ tx.object('0x6'), // Sui Clock object for real-time timestamp
173
+ ]
174
+ });
175
+
176
+ return tx;
177
+ }
178
+
179
+ /**
180
+ * Build transaction for comprehensive memory record update
181
+ *
182
+ * Updates multiple fields of a Memory object in a single transaction.
183
+ * Only non-empty/non-zero values will be updated on-chain.
184
+ *
185
+ * @param options - Update options with memoryId and fields to update
186
+ * @returns Transaction to update memory record
187
+ */
188
+ buildUpdateMemoryRecord(options: UpdateMemoryRecordTxOptions): Transaction {
189
+ const tx = new Transaction();
190
+
191
+ if (options.gasBudget) {
192
+ tx.setGasBudget(options.gasBudget);
193
+ }
194
+
195
+ if (options.gasPrice) {
196
+ tx.setGasPrice(options.gasPrice);
197
+ }
198
+
199
+ // Use direct moveCall with Clock object for real-time timestamp
200
+ tx.moveCall({
201
+ target: `${this.config.packageId}::memory::update_memory_record`,
202
+ arguments: [
203
+ tx.object(options.memoryId),
204
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newBlobId || ''))),
205
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newCategory || ''))),
206
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newTopic || ''))),
207
+ tx.pure.u8(options.newImportance || 0),
208
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newEmbeddingBlobId || ''))),
209
+ tx.pure.vector('u8', Array.from(new TextEncoder().encode(options.newContentHash || ''))),
210
+ tx.pure.u64(options.newContentSize || 0),
211
+ tx.object('0x6'), // Sui Clock object for real-time timestamp
212
+ ],
213
+ });
214
+
215
+ return tx;
216
+ }
217
+
218
+ /**
219
+ * Build transaction to delete a memory record
220
+ */
221
+ buildDeleteMemoryRecord(options: DeleteMemoryRecordTxOptions): Transaction {
222
+ const tx = new Transaction();
223
+
224
+ if (options.gasBudget) {
225
+ tx.setGasBudget(options.gasBudget);
226
+ }
227
+
228
+ if (options.gasPrice) {
229
+ tx.setGasPrice(options.gasPrice);
230
+ }
231
+
232
+ // Note: Using tx.moveCall for actual implementation
233
+ tx.moveCall({
234
+ target: `${this.config.packageId}::memory::delete_memory_record`,
235
+ arguments: [tx.pure.string(options.memoryId)]
236
+ });
237
+
238
+ return tx;
239
+ }
240
+
241
+ /**
242
+ * Build transaction to create a memory index
243
+ *
244
+ * Smart contract signature:
245
+ * ```move
246
+ * public entry fun create_memory_index(
247
+ * index_blob_id: vector<u8>,
248
+ * graph_blob_id: vector<u8>,
249
+ * ctx: &mut tx_context::TxContext
250
+ * )
251
+ * ```
252
+ */
253
+ buildCreateMemoryIndex(options: CreateMemoryIndexTxOptions): Transaction {
254
+ const tx = new Transaction();
255
+
256
+ if (options.gasBudget) {
257
+ tx.setGasBudget(options.gasBudget);
258
+ }
259
+
260
+ if (options.gasPrice) {
261
+ tx.setGasPrice(options.gasPrice);
262
+ }
263
+
264
+ // Convert strings to vector<u8> for Move
265
+ const indexBlobIdBytes = Array.from(new TextEncoder().encode(options.indexBlobId));
266
+ const graphBlobIdBytes = Array.from(new TextEncoder().encode(options.graphBlobId));
267
+
268
+ tx.moveCall({
269
+ target: `${this.config.packageId}::memory::create_memory_index`,
270
+ arguments: [
271
+ tx.pure.vector('u8', indexBlobIdBytes),
272
+ tx.pure.vector('u8', graphBlobIdBytes)
273
+ ]
274
+ });
275
+
276
+ return tx;
277
+ }
278
+
279
+ /**
280
+ * Build transaction to update a memory index
281
+ *
282
+ * Smart contract signature:
283
+ * ```move
284
+ * public entry fun update_memory_index(
285
+ * memory_index: &mut MemoryIndex,
286
+ * expected_version: u64,
287
+ * new_index_blob_id: vector<u8>,
288
+ * new_graph_blob_id: vector<u8>,
289
+ * ctx: &tx_context::TxContext
290
+ * )
291
+ * ```
292
+ *
293
+ * @param options - Update options including indexId (object ID), expectedVersion, and new blob IDs
294
+ */
295
+ buildUpdateMemoryIndex(options: UpdateMemoryIndexTxOptions): Transaction {
296
+ const tx = new Transaction();
297
+
298
+ if (options.gasBudget) {
299
+ tx.setGasBudget(options.gasBudget);
300
+ }
301
+
302
+ if (options.gasPrice) {
303
+ tx.setGasPrice(options.gasPrice);
304
+ }
305
+
306
+ // Convert strings to vector<u8> for Move
307
+ const newIndexBlobIdBytes = Array.from(new TextEncoder().encode(options.newIndexBlobId));
308
+ const newGraphBlobIdBytes = Array.from(new TextEncoder().encode(options.newGraphBlobId));
309
+
310
+ tx.moveCall({
311
+ target: `${this.config.packageId}::memory::update_memory_index`,
312
+ arguments: [
313
+ tx.object(options.indexId), // &mut MemoryIndex (object reference)
314
+ tx.pure.u64(options.expectedVersion), // expected_version: u64
315
+ tx.pure.vector('u8', newIndexBlobIdBytes), // new_index_blob_id: vector<u8>
316
+ tx.pure.vector('u8', newGraphBlobIdBytes) // new_graph_blob_id: vector<u8>
317
+ ]
318
+ });
319
+
320
+ return tx;
321
+ }
322
+
323
+ // ==================== ACCESS CONTROL TRANSACTIONS ====================
324
+
325
+ /**
326
+ * Build transaction to grant access to content
327
+ */
328
+ buildGrantAccess(options: GrantAccessTxOptions): Transaction {
329
+ const tx = new Transaction();
330
+
331
+ if (options.gasBudget) {
332
+ tx.setGasBudget(options.gasBudget);
333
+ }
334
+
335
+ if (options.gasPrice) {
336
+ tx.setGasPrice(options.gasPrice);
337
+ }
338
+
339
+ // Note: Using tx.moveCall for actual implementation
340
+ tx.moveCall({
341
+ target: `${this.config.packageId}::access::grant_access`,
342
+ arguments: [
343
+ tx.pure.string(options.contentId),
344
+ tx.pure.address(options.recipient),
345
+ tx.pure.u8(Array.isArray(options.permissions) ? options.permissions[0] : options.permissions),
346
+ tx.pure.u64(options.expirationTime || 0)
347
+ ]
348
+ });
349
+
350
+ return tx;
351
+ }
352
+
353
+ /**
354
+ * Build transaction to revoke access from content
355
+ */
356
+ buildRevokeAccess(options: RevokeAccessTxOptions): Transaction {
357
+ const tx = new Transaction();
358
+
359
+ if (options.gasBudget) {
360
+ tx.setGasBudget(options.gasBudget);
361
+ }
362
+
363
+ if (options.gasPrice) {
364
+ tx.setGasPrice(options.gasPrice);
365
+ }
366
+
367
+ // Note: Using tx.moveCall for actual implementation
368
+ tx.moveCall({
369
+ target: `${this.config.packageId}::access::revoke_access`,
370
+ arguments: [
371
+ tx.pure.string(options.contentId),
372
+ tx.pure.address(options.recipient)
373
+ ]
374
+ });
375
+
376
+ return tx;
377
+ }
378
+
379
+ /**
380
+ * Build transaction to register content for access control
381
+ */
382
+ buildRegisterContent(options: RegisterContentTxOptions): Transaction {
383
+ const tx = new Transaction();
384
+
385
+ if (options.gasBudget) {
386
+ tx.setGasBudget(options.gasBudget);
387
+ }
388
+
389
+ if (options.gasPrice) {
390
+ tx.setGasPrice(options.gasPrice);
391
+ }
392
+
393
+ // Note: Using tx.moveCall for actual implementation
394
+ tx.moveCall({
395
+ target: `${this.config.packageId}::access::register_content`,
396
+ arguments: [
397
+ tx.pure.string(options.contentHash),
398
+ tx.pure.string(options.encryptionKey),
399
+ tx.pure.string(Array.isArray(options.accessPolicy) ? JSON.stringify(options.accessPolicy) : options.accessPolicy)
400
+ ]
401
+ });
402
+
403
+ return tx;
404
+ }
405
+
406
+ // ==================== EXECUTION METHODS ====================
407
+
408
+ /**
409
+ * Execute a transaction using SerialTransactionExecutor with automatic retry.
410
+ *
411
+ * The executor automatically:
412
+ * - Caches object versions to prevent version conflicts within same session
413
+ * - Manages gas coins to prevent equivocation (24h lock)
414
+ * - Queues transactions sequentially for safe execution
415
+ *
416
+ * When version conflict occurs (external modification), the executor cache
417
+ * is reset and transaction is retried with fresh object references.
418
+ *
419
+ * @see https://sdk.mystenlabs.com/typescript/executors
420
+ * @see https://docs.sui.io/concepts/sui-architecture/epochs#equivocation
421
+ */
422
+ async executeTransaction(
423
+ tx: Transaction,
424
+ signer: any,
425
+ options: TransactionOptions = {}
426
+ ): Promise<TransactionResult> {
427
+ const maxRetries = 3;
428
+
429
+ for (let attempt = 1; attempt <= maxRetries; attempt++) {
430
+ try {
431
+ // Set sender if provided
432
+ if (options.sender) {
433
+ tx.setSender(options.sender);
434
+ }
435
+
436
+ // Use SerialTransactionExecutor to prevent equivocation and version conflicts
437
+ const executor = this.getExecutor(signer);
438
+ // Pass options to get full response data including objectChanges
439
+ const executorResult = await executor.executeTransaction(tx, {
440
+ showEffects: true,
441
+ showObjectChanges: true,
442
+ showEvents: true,
443
+ });
444
+
445
+ // SerialTransactionExecutor returns { digest, effects (string), data (SuiTransactionBlockResponse) }
446
+ // The actual response data is in executorResult.data
447
+ const result = executorResult.data;
448
+
449
+ // Parse the result
450
+ const transactionResult: TransactionResult = {
451
+ digest: executorResult.digest,
452
+ effects: result.effects,
453
+ status: result.effects?.status?.status === 'success' ? 'success' : 'failure',
454
+ gasUsed: result.effects?.gasUsed?.computationCost
455
+ ? Number(result.effects.gasUsed.computationCost)
456
+ : undefined,
457
+ };
458
+
459
+ // Extract created objects
460
+ if (result.objectChanges) {
461
+ transactionResult.createdObjects = result.objectChanges
462
+ .filter((change: any) => change.type === 'created')
463
+ .map((change: any) => ({
464
+ objectId: change.objectId,
465
+ objectType: change.objectType || 'unknown',
466
+ }));
467
+
468
+ transactionResult.mutatedObjects = result.objectChanges
469
+ .filter((change: any) => change.type === 'mutated')
470
+ .map((change: any) => ({
471
+ objectId: change.objectId,
472
+ objectType: change.objectType || 'unknown',
473
+ }));
474
+
475
+ transactionResult.deletedObjects = result.objectChanges
476
+ .filter((change: any) => change.type === 'deleted')
477
+ .map((change: any) => change.objectId);
478
+ }
479
+
480
+ // Add error if transaction failed
481
+ if (transactionResult.status === 'failure') {
482
+ transactionResult.error = result.effects?.status?.error || 'Unknown transaction error';
483
+ }
484
+
485
+ return transactionResult;
486
+ } catch (error: any) {
487
+ const errorMsg = error instanceof Error ? error.message : String(error);
488
+
489
+ // Check if it's a version conflict error (external modification)
490
+ const isVersionConflict =
491
+ errorMsg.includes('is not available for consumption') ||
492
+ errorMsg.includes('current version') ||
493
+ errorMsg.includes('ObjectVersionTooOld') ||
494
+ errorMsg.includes('EquivocationError');
495
+
496
+ if (isVersionConflict && attempt < maxRetries) {
497
+ // Reset executor cache to get fresh object versions
498
+ console.log(`⚠️ Version conflict detected (attempt ${attempt}/${maxRetries}), resetting cache...`);
499
+ await this.executor?.resetCache();
500
+
501
+ // Exponential backoff: 500ms, 1000ms, 2000ms
502
+ const delay = 500 * Math.pow(2, attempt - 1);
503
+ console.log(` Retrying in ${delay}ms with fresh object references...`);
504
+ await new Promise(resolve => setTimeout(resolve, delay));
505
+ continue;
506
+ }
507
+
508
+ console.error('Transaction execution failed:', error);
509
+ // Reset executor on final failure to get fresh state for next call
510
+ this.resetExecutor();
511
+ return {
512
+ digest: '',
513
+ status: 'failure',
514
+ error: errorMsg,
515
+ };
516
+ }
517
+ }
518
+
519
+ // Should never reach here, but TypeScript needs a return
520
+ return {
521
+ digest: '',
522
+ status: 'failure',
523
+ error: 'Max retries exceeded',
524
+ };
525
+ }
526
+
527
+ /**
528
+ * Execute a transaction directly without the executor (legacy method).
529
+ * Use this only when you need direct control over execution or for one-off transactions.
530
+ *
531
+ * WARNING: This method does not protect against equivocation.
532
+ * For sequential transactions, use executeTransaction() instead.
533
+ */
534
+ async executeTransactionDirect(
535
+ tx: Transaction,
536
+ signer: any,
537
+ options: TransactionOptions = {}
538
+ ): Promise<TransactionResult> {
539
+ try {
540
+ // Set sender if provided
541
+ if (options.sender) {
542
+ tx.setSender(options.sender);
543
+ }
544
+
545
+ // Execute the transaction directly
546
+ const result = await this.client.signAndExecuteTransaction({
547
+ transaction: tx,
548
+ signer,
549
+ options: {
550
+ showEffects: true,
551
+ showObjectChanges: true,
552
+ showEvents: true,
553
+ },
554
+ });
555
+
556
+ // Wait for transaction to be finalized on-chain
557
+ if (result.digest) {
558
+ try {
559
+ await this.client.waitForTransaction({
560
+ digest: result.digest,
561
+ options: { showEffects: true },
562
+ });
563
+ } catch (waitError) {
564
+ console.warn('waitForTransaction warning:', waitError);
565
+ }
566
+ }
567
+
568
+ // Parse the result
569
+ const transactionResult: TransactionResult = {
570
+ digest: result.digest,
571
+ effects: result.effects,
572
+ status: result.effects?.status?.status === 'success' ? 'success' : 'failure',
573
+ gasUsed: result.effects?.gasUsed?.computationCost
574
+ ? Number(result.effects.gasUsed.computationCost)
575
+ : undefined,
576
+ };
577
+
578
+ // Extract created objects
579
+ if (result.objectChanges) {
580
+ transactionResult.createdObjects = result.objectChanges
581
+ .filter(change => change.type === 'created')
582
+ .map(change => ({
583
+ objectId: change.objectId,
584
+ objectType: change.objectType || 'unknown',
585
+ }));
586
+
587
+ transactionResult.mutatedObjects = result.objectChanges
588
+ .filter(change => change.type === 'mutated')
589
+ .map(change => ({
590
+ objectId: change.objectId,
591
+ objectType: change.objectType || 'unknown',
592
+ }));
593
+
594
+ transactionResult.deletedObjects = result.objectChanges
595
+ .filter(change => change.type === 'deleted')
596
+ .map(change => change.objectId);
597
+ }
598
+
599
+ // Add error if transaction failed
600
+ if (transactionResult.status === 'failure') {
601
+ transactionResult.error = result.effects?.status?.error || 'Unknown transaction error';
602
+ }
603
+
604
+ return transactionResult;
605
+ } catch (error) {
606
+ console.error('Transaction execution failed:', error);
607
+ return {
608
+ digest: '',
609
+ status: 'failure',
610
+ error: error instanceof Error ? error.message : String(error),
611
+ };
612
+ }
613
+ }
614
+
615
+ // ==================== CONVENIENCE METHODS ====================
616
+
617
+ /**
618
+ * Create and execute a memory record transaction
619
+ */
620
+ async createMemoryRecord(
621
+ options: CreateMemoryRecordTxOptions,
622
+ signer: any
623
+ ): Promise<TransactionResult> {
624
+ const tx = this.buildCreateMemoryRecord(options);
625
+ return this.executeTransaction(tx, signer, options);
626
+ }
627
+
628
+ /**
629
+ * Create and execute an update memory metadata transaction
630
+ */
631
+ async updateMemoryMetadata(
632
+ options: UpdateMemoryMetadataTxOptions,
633
+ signer: any
634
+ ): Promise<TransactionResult> {
635
+ const tx = this.buildUpdateMemoryMetadata(options);
636
+ return this.executeTransaction(tx, signer, options);
637
+ }
638
+
639
+ /**
640
+ * Create and execute a delete memory record transaction
641
+ */
642
+ async deleteMemoryRecord(
643
+ options: DeleteMemoryRecordTxOptions,
644
+ signer: any
645
+ ): Promise<TransactionResult> {
646
+ const tx = this.buildDeleteMemoryRecord(options);
647
+ return this.executeTransaction(tx, signer, options);
648
+ }
649
+
650
+ /**
651
+ * Create and execute a grant access transaction
652
+ */
653
+ async grantAccess(
654
+ options: GrantAccessTxOptions,
655
+ signer: any
656
+ ): Promise<TransactionResult> {
657
+ const tx = this.buildGrantAccess(options);
658
+ return this.executeTransaction(tx, signer, options);
659
+ }
660
+
661
+ /**
662
+ * Create and execute a revoke access transaction
663
+ */
664
+ async revokeAccess(
665
+ options: RevokeAccessTxOptions,
666
+ signer: any
667
+ ): Promise<TransactionResult> {
668
+ const tx = this.buildRevokeAccess(options);
669
+ return this.executeTransaction(tx, signer, options);
670
+ }
671
+
672
+ // ==================== BATCH OPERATIONS ====================
673
+
674
+ /**
675
+ * Build a batch transaction combining multiple operations
676
+ *
677
+ * Access control uses capability-based pattern:
678
+ * - createCap: Create a new MemoryCap for an app context
679
+ * - transferCap: Transfer capability to recipient (grants access)
680
+ * - burnCap: Burn capability (revokes access permanently)
681
+ */
682
+ buildBatchTransaction(operations: Array<{
683
+ type: 'createMemory' | 'updateMemory' | 'deleteMemory' | 'createCap' | 'transferCap' | 'burnCap';
684
+ options: any;
685
+ }>): Transaction {
686
+ const tx = new Transaction();
687
+
688
+ for (const operation of operations) {
689
+ switch (operation.type) {
690
+ case 'createMemory':
691
+ MemoryModule.createMemoryRecord({
692
+ package: this.config.packageId,
693
+ arguments: operation.options,
694
+ })(tx);
695
+ break;
696
+
697
+ case 'updateMemory':
698
+ MemoryModule.updateMemoryMetadata({
699
+ package: this.config.packageId,
700
+ arguments: operation.options,
701
+ })(tx);
702
+ break;
703
+
704
+ case 'deleteMemory':
705
+ MemoryModule.deleteMemoryRecord({
706
+ package: this.config.packageId,
707
+ arguments: operation.options,
708
+ })(tx);
709
+ break;
710
+
711
+ case 'createCap':
712
+ // Create a new MemoryCap for an app context
713
+ CapabilityModule.createMemoryCap({
714
+ package: this.config.packageId,
715
+ arguments: operation.options,
716
+ })(tx);
717
+ break;
718
+
719
+ case 'transferCap':
720
+ // Transfer capability to recipient (grants access)
721
+ CapabilityModule.transferCap({
722
+ package: this.config.packageId,
723
+ arguments: operation.options,
724
+ })(tx);
725
+ break;
726
+
727
+ case 'burnCap':
728
+ // Burn capability (revokes access permanently)
729
+ CapabilityModule.burnCap({
730
+ package: this.config.packageId,
731
+ arguments: operation.options,
732
+ })(tx);
733
+ break;
734
+
735
+ default:
736
+ console.warn(`Unknown operation type: ${operation.type}`);
737
+ }
738
+ }
739
+
740
+ return tx;
741
+ }
742
+
743
+ /**
744
+ * Execute a batch transaction
745
+ */
746
+ async executeBatch(
747
+ operations: Array<{
748
+ type: 'createMemory' | 'updateMemory' | 'deleteMemory' | 'createCap' | 'transferCap' | 'burnCap';
749
+ options: any;
750
+ }>,
751
+ signer: any,
752
+ txOptions: TransactionOptions = {}
753
+ ): Promise<TransactionResult> {
754
+ const tx = this.buildBatchTransaction(operations);
755
+
756
+ if (txOptions.gasBudget) {
757
+ tx.setGasBudget(txOptions.gasBudget);
758
+ }
759
+
760
+ return this.executeTransaction(tx, signer, txOptions);
761
+ }
762
+
763
+ // ==================== UTILITY METHODS ====================
764
+
765
+ /**
766
+ * Estimate gas cost for a transaction
767
+ */
768
+ async estimateGas(tx: Transaction, signer: any): Promise<number> {
769
+ try {
770
+ const dryRunResult = await this.client.dryRunTransactionBlock({
771
+ transactionBlock: await tx.build({ client: this.client }),
772
+ });
773
+
774
+ return dryRunResult.effects.gasUsed?.computationCost
775
+ ? Number(dryRunResult.effects.gasUsed.computationCost)
776
+ : 0;
777
+ } catch (error) {
778
+ console.error('Gas estimation failed:', error);
779
+ return 0;
780
+ }
781
+ }
782
+
783
+ /**
784
+ * Get recommended gas budget based on transaction complexity
785
+ */
786
+ getRecommendedGasBudget(operationCount: number = 1): number {
787
+ const baseGas = 1000000; // 1M MIST base
788
+ const perOperationGas = 500000; // 500K MIST per operation
789
+ return baseGas + (operationCount * perOperationGas);
790
+ }
791
+ }