mcard-js 2.1.12 → 2.1.13

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 (362) hide show
  1. package/README.md +14 -0
  2. package/dist/hash/HashValidator.d.ts +14 -0
  3. package/dist/hash/HashValidator.d.ts.map +1 -0
  4. package/dist/hash/HashValidator.js +57 -0
  5. package/dist/hash/HashValidator.js.map +1 -0
  6. package/dist/index.d.ts +29 -0
  7. package/dist/index.d.ts.map +1 -0
  8. package/dist/index.js +38 -0
  9. package/dist/index.js.map +1 -0
  10. package/dist/model/CardCollection.d.ts +92 -0
  11. package/dist/model/CardCollection.d.ts.map +1 -0
  12. package/dist/model/CardCollection.js +217 -0
  13. package/dist/model/CardCollection.js.map +1 -0
  14. package/dist/model/ContentTypeInterpreter.d.ts +23 -0
  15. package/dist/model/ContentTypeInterpreter.d.ts.map +1 -0
  16. package/dist/model/ContentTypeInterpreter.js +140 -0
  17. package/dist/model/ContentTypeInterpreter.js.map +1 -0
  18. package/dist/model/EventProducer.d.ts +10 -0
  19. package/dist/model/EventProducer.d.ts.map +1 -0
  20. package/dist/model/EventProducer.js +46 -0
  21. package/dist/model/EventProducer.js.map +1 -0
  22. package/dist/model/GTime.d.ts +44 -0
  23. package/dist/model/GTime.d.ts.map +1 -0
  24. package/dist/model/GTime.js +91 -0
  25. package/dist/model/GTime.js.map +1 -0
  26. package/dist/model/Handle.d.ts +37 -0
  27. package/dist/model/Handle.d.ts.map +1 -0
  28. package/dist/model/Handle.js +90 -0
  29. package/dist/model/Handle.js.map +1 -0
  30. package/dist/model/MCard.d.ts +43 -0
  31. package/dist/model/MCard.d.ts.map +1 -0
  32. package/dist/model/MCard.js +76 -0
  33. package/dist/model/MCard.js.map +1 -0
  34. package/dist/model/constants.d.ts +45 -0
  35. package/dist/model/constants.d.ts.map +1 -0
  36. package/dist/model/constants.js +27 -0
  37. package/dist/model/constants.js.map +1 -0
  38. package/dist/model/detectors/BaseDetector.d.ts +26 -0
  39. package/dist/model/detectors/BaseDetector.d.ts.map +1 -0
  40. package/dist/model/detectors/BaseDetector.js +5 -0
  41. package/dist/model/detectors/BaseDetector.js.map +1 -0
  42. package/dist/model/detectors/BinaryDetector.d.ts +12 -0
  43. package/dist/model/detectors/BinaryDetector.d.ts.map +1 -0
  44. package/dist/model/detectors/BinaryDetector.js +82 -0
  45. package/dist/model/detectors/BinaryDetector.js.map +1 -0
  46. package/dist/model/detectors/ContentTypeInterpreter.d.ts +11 -0
  47. package/dist/model/detectors/ContentTypeInterpreter.d.ts.map +1 -0
  48. package/dist/model/detectors/ContentTypeInterpreter.js +51 -0
  49. package/dist/model/detectors/ContentTypeInterpreter.js.map +1 -0
  50. package/dist/model/detectors/DataFormatDetectors.d.ts +29 -0
  51. package/dist/model/detectors/DataFormatDetectors.d.ts.map +1 -0
  52. package/dist/model/detectors/DataFormatDetectors.js +223 -0
  53. package/dist/model/detectors/DataFormatDetectors.js.map +1 -0
  54. package/dist/model/detectors/LanguageDetector.d.ts +11 -0
  55. package/dist/model/detectors/LanguageDetector.d.ts.map +1 -0
  56. package/dist/model/detectors/LanguageDetector.js +148 -0
  57. package/dist/model/detectors/LanguageDetector.js.map +1 -0
  58. package/dist/model/detectors/MarkupDetectors.d.ts +22 -0
  59. package/dist/model/detectors/MarkupDetectors.d.ts.map +1 -0
  60. package/dist/model/detectors/MarkupDetectors.js +132 -0
  61. package/dist/model/detectors/MarkupDetectors.js.map +1 -0
  62. package/dist/model/detectors/OBJDetector.d.ts +8 -0
  63. package/dist/model/detectors/OBJDetector.d.ts.map +1 -0
  64. package/dist/model/detectors/OBJDetector.js +48 -0
  65. package/dist/model/detectors/OBJDetector.js.map +1 -0
  66. package/dist/model/detectors/registry.d.ts +13 -0
  67. package/dist/model/detectors/registry.d.ts.map +1 -0
  68. package/dist/model/detectors/registry.js +67 -0
  69. package/dist/model/detectors/registry.js.map +1 -0
  70. package/dist/monads/Either.d.ts +51 -0
  71. package/dist/monads/Either.d.ts.map +1 -0
  72. package/dist/monads/Either.js +82 -0
  73. package/dist/monads/Either.js.map +1 -0
  74. package/dist/monads/IO.d.ts +38 -0
  75. package/dist/monads/IO.d.ts.map +1 -0
  76. package/dist/monads/IO.js +66 -0
  77. package/dist/monads/IO.js.map +1 -0
  78. package/dist/monads/Maybe.d.ts +45 -0
  79. package/dist/monads/Maybe.d.ts.map +1 -0
  80. package/dist/monads/Maybe.js +73 -0
  81. package/dist/monads/Maybe.js.map +1 -0
  82. package/dist/monads/Reader.d.ts +29 -0
  83. package/dist/monads/Reader.d.ts.map +1 -0
  84. package/dist/monads/Reader.js +44 -0
  85. package/dist/monads/Reader.js.map +1 -0
  86. package/dist/monads/State.d.ts +33 -0
  87. package/dist/monads/State.d.ts.map +1 -0
  88. package/dist/monads/State.js +50 -0
  89. package/dist/monads/State.js.map +1 -0
  90. package/dist/monads/Writer.d.ts +29 -0
  91. package/dist/monads/Writer.d.ts.map +1 -0
  92. package/dist/monads/Writer.js +46 -0
  93. package/dist/monads/Writer.js.map +1 -0
  94. package/dist/ptr/FaroSidecar.d.ts +56 -0
  95. package/dist/ptr/FaroSidecar.d.ts.map +1 -0
  96. package/dist/ptr/FaroSidecar.js +102 -0
  97. package/dist/ptr/FaroSidecar.js.map +1 -0
  98. package/dist/ptr/LensProtocol.d.ts +84 -0
  99. package/dist/ptr/LensProtocol.d.ts.map +1 -0
  100. package/dist/ptr/LensProtocol.js +98 -0
  101. package/dist/ptr/LensProtocol.js.map +1 -0
  102. package/dist/ptr/SandboxWorker.d.ts +54 -0
  103. package/dist/ptr/SandboxWorker.d.ts.map +1 -0
  104. package/dist/ptr/SandboxWorker.js +172 -0
  105. package/dist/ptr/SandboxWorker.js.map +1 -0
  106. package/dist/ptr/common_types.d.ts +39 -0
  107. package/dist/ptr/common_types.d.ts.map +1 -0
  108. package/dist/ptr/common_types.js +12 -0
  109. package/dist/ptr/common_types.js.map +1 -0
  110. package/dist/ptr/lambda/AlphaConversion.d.ts +42 -0
  111. package/dist/ptr/lambda/AlphaConversion.d.ts.map +1 -0
  112. package/dist/ptr/lambda/AlphaConversion.js +244 -0
  113. package/dist/ptr/lambda/AlphaConversion.js.map +1 -0
  114. package/dist/ptr/lambda/BetaReduction.d.ts +73 -0
  115. package/dist/ptr/lambda/BetaReduction.d.ts.map +1 -0
  116. package/dist/ptr/lambda/BetaReduction.js +322 -0
  117. package/dist/ptr/lambda/BetaReduction.js.map +1 -0
  118. package/dist/ptr/lambda/EtaConversion.d.ts +65 -0
  119. package/dist/ptr/lambda/EtaConversion.d.ts.map +1 -0
  120. package/dist/ptr/lambda/EtaConversion.js +228 -0
  121. package/dist/ptr/lambda/EtaConversion.js.map +1 -0
  122. package/dist/ptr/lambda/FreeVariables.d.ts +44 -0
  123. package/dist/ptr/lambda/FreeVariables.d.ts.map +1 -0
  124. package/dist/ptr/lambda/FreeVariables.js +207 -0
  125. package/dist/ptr/lambda/FreeVariables.js.map +1 -0
  126. package/dist/ptr/lambda/LambdaRuntime.d.ts +80 -0
  127. package/dist/ptr/lambda/LambdaRuntime.d.ts.map +1 -0
  128. package/dist/ptr/lambda/LambdaRuntime.js +433 -0
  129. package/dist/ptr/lambda/LambdaRuntime.js.map +1 -0
  130. package/dist/ptr/lambda/LambdaTerm.d.ts +95 -0
  131. package/dist/ptr/lambda/LambdaTerm.d.ts.map +1 -0
  132. package/dist/ptr/lambda/LambdaTerm.js +159 -0
  133. package/dist/ptr/lambda/LambdaTerm.js.map +1 -0
  134. package/dist/ptr/lambda/index.d.ts +24 -0
  135. package/dist/ptr/lambda/index.d.ts.map +1 -0
  136. package/dist/ptr/lambda/index.js +34 -0
  137. package/dist/ptr/lambda/index.js.map +1 -0
  138. package/dist/ptr/llm/Config.d.ts +57 -0
  139. package/dist/ptr/llm/Config.d.ts.map +1 -0
  140. package/dist/ptr/llm/Config.js +183 -0
  141. package/dist/ptr/llm/Config.js.map +1 -0
  142. package/dist/ptr/llm/LLMRuntime.d.ts +35 -0
  143. package/dist/ptr/llm/LLMRuntime.d.ts.map +1 -0
  144. package/dist/ptr/llm/LLMRuntime.js +176 -0
  145. package/dist/ptr/llm/LLMRuntime.js.map +1 -0
  146. package/dist/ptr/llm/providers/LLMProvider.d.ts +43 -0
  147. package/dist/ptr/llm/providers/LLMProvider.d.ts.map +1 -0
  148. package/dist/ptr/llm/providers/LLMProvider.js +31 -0
  149. package/dist/ptr/llm/providers/LLMProvider.js.map +1 -0
  150. package/dist/ptr/llm/providers/MLCLLMProvider.d.ts +22 -0
  151. package/dist/ptr/llm/providers/MLCLLMProvider.d.ts.map +1 -0
  152. package/dist/ptr/llm/providers/MLCLLMProvider.js +155 -0
  153. package/dist/ptr/llm/providers/MLCLLMProvider.js.map +1 -0
  154. package/dist/ptr/llm/providers/OllamaEmbeddingProvider.d.ts +20 -0
  155. package/dist/ptr/llm/providers/OllamaEmbeddingProvider.d.ts.map +1 -0
  156. package/dist/ptr/llm/providers/OllamaEmbeddingProvider.js +42 -0
  157. package/dist/ptr/llm/providers/OllamaEmbeddingProvider.js.map +1 -0
  158. package/dist/ptr/llm/providers/OllamaProvider.d.ts +21 -0
  159. package/dist/ptr/llm/providers/OllamaProvider.d.ts.map +1 -0
  160. package/dist/ptr/llm/providers/OllamaProvider.js +158 -0
  161. package/dist/ptr/llm/providers/OllamaProvider.js.map +1 -0
  162. package/dist/ptr/llm/providers/WebLLMProvider.d.ts +22 -0
  163. package/dist/ptr/llm/providers/WebLLMProvider.d.ts.map +1 -0
  164. package/dist/ptr/llm/providers/WebLLMProvider.js +151 -0
  165. package/dist/ptr/llm/providers/WebLLMProvider.js.map +1 -0
  166. package/dist/ptr/node/Action.d.ts +426 -0
  167. package/dist/ptr/node/Action.d.ts.map +1 -0
  168. package/dist/ptr/node/Action.js +711 -0
  169. package/dist/ptr/node/Action.js.map +1 -0
  170. package/dist/ptr/node/CLMLoader.d.ts +18 -0
  171. package/dist/ptr/node/CLMLoader.d.ts.map +1 -0
  172. package/dist/ptr/node/CLMLoader.js +18 -0
  173. package/dist/ptr/node/CLMLoader.js.map +1 -0
  174. package/dist/ptr/node/CLMRunner.d.ts +34 -0
  175. package/dist/ptr/node/CLMRunner.d.ts.map +1 -0
  176. package/dist/ptr/node/CLMRunner.js +36 -0
  177. package/dist/ptr/node/CLMRunner.js.map +1 -0
  178. package/dist/ptr/node/FileSystemUtils.d.ts +40 -0
  179. package/dist/ptr/node/FileSystemUtils.d.ts.map +1 -0
  180. package/dist/ptr/node/FileSystemUtils.js +170 -0
  181. package/dist/ptr/node/FileSystemUtils.js.map +1 -0
  182. package/dist/ptr/node/NetworkConfig.d.ts +191 -0
  183. package/dist/ptr/node/NetworkConfig.d.ts.map +1 -0
  184. package/dist/ptr/node/NetworkConfig.js +8 -0
  185. package/dist/ptr/node/NetworkConfig.js.map +1 -0
  186. package/dist/ptr/node/NetworkRuntime.d.ts +38 -0
  187. package/dist/ptr/node/NetworkRuntime.d.ts.map +1 -0
  188. package/dist/ptr/node/NetworkRuntime.js +871 -0
  189. package/dist/ptr/node/NetworkRuntime.js.map +1 -0
  190. package/dist/ptr/node/P2PChatSession.d.ts +53 -0
  191. package/dist/ptr/node/P2PChatSession.d.ts.map +1 -0
  192. package/dist/ptr/node/P2PChatSession.js +154 -0
  193. package/dist/ptr/node/P2PChatSession.js.map +1 -0
  194. package/dist/ptr/node/RuntimeInterface.d.ts +4 -0
  195. package/dist/ptr/node/RuntimeInterface.d.ts.map +1 -0
  196. package/dist/ptr/node/RuntimeInterface.js +2 -0
  197. package/dist/ptr/node/RuntimeInterface.js.map +1 -0
  198. package/dist/ptr/node/Runtimes.d.ts +34 -0
  199. package/dist/ptr/node/Runtimes.d.ts.map +1 -0
  200. package/dist/ptr/node/Runtimes.js +38 -0
  201. package/dist/ptr/node/Runtimes.js.map +1 -0
  202. package/dist/ptr/node/SignalingServer.d.ts +37 -0
  203. package/dist/ptr/node/SignalingServer.d.ts.map +1 -0
  204. package/dist/ptr/node/SignalingServer.js +218 -0
  205. package/dist/ptr/node/SignalingServer.js.map +1 -0
  206. package/dist/ptr/node/cli.d.ts +3 -0
  207. package/dist/ptr/node/cli.d.ts.map +1 -0
  208. package/dist/ptr/node/cli.js +266 -0
  209. package/dist/ptr/node/cli.js.map +1 -0
  210. package/dist/ptr/node/clm/builtins/handle.d.ts +14 -0
  211. package/dist/ptr/node/clm/builtins/handle.d.ts.map +1 -0
  212. package/dist/ptr/node/clm/builtins/handle.js +177 -0
  213. package/dist/ptr/node/clm/builtins/handle.js.map +1 -0
  214. package/dist/ptr/node/clm/builtins/index.d.ts +20 -0
  215. package/dist/ptr/node/clm/builtins/index.d.ts.map +1 -0
  216. package/dist/ptr/node/clm/builtins/index.js +60 -0
  217. package/dist/ptr/node/clm/builtins/index.js.map +1 -0
  218. package/dist/ptr/node/clm/index.d.ts +25 -0
  219. package/dist/ptr/node/clm/index.d.ts.map +1 -0
  220. package/dist/ptr/node/clm/index.js +28 -0
  221. package/dist/ptr/node/clm/index.js.map +1 -0
  222. package/dist/ptr/node/clm/loader.d.ts +25 -0
  223. package/dist/ptr/node/clm/loader.d.ts.map +1 -0
  224. package/dist/ptr/node/clm/loader.js +146 -0
  225. package/dist/ptr/node/clm/loader.js.map +1 -0
  226. package/dist/ptr/node/clm/multiruntime.d.ts +9 -0
  227. package/dist/ptr/node/clm/multiruntime.d.ts.map +1 -0
  228. package/dist/ptr/node/clm/multiruntime.js +121 -0
  229. package/dist/ptr/node/clm/multiruntime.js.map +1 -0
  230. package/dist/ptr/node/clm/runner.d.ts +70 -0
  231. package/dist/ptr/node/clm/runner.d.ts.map +1 -0
  232. package/dist/ptr/node/clm/runner.js +324 -0
  233. package/dist/ptr/node/clm/runner.js.map +1 -0
  234. package/dist/ptr/node/clm/types.d.ts +166 -0
  235. package/dist/ptr/node/clm/types.d.ts.map +1 -0
  236. package/dist/ptr/node/clm/types.js +5 -0
  237. package/dist/ptr/node/clm/types.js.map +1 -0
  238. package/dist/ptr/node/clm/utils.d.ts +29 -0
  239. package/dist/ptr/node/clm/utils.d.ts.map +1 -0
  240. package/dist/ptr/node/clm/utils.js +88 -0
  241. package/dist/ptr/node/clm/utils.js.map +1 -0
  242. package/dist/ptr/node/network/HttpClient.d.ts +14 -0
  243. package/dist/ptr/node/network/HttpClient.d.ts.map +1 -0
  244. package/dist/ptr/node/network/HttpClient.js +139 -0
  245. package/dist/ptr/node/network/HttpClient.js.map +1 -0
  246. package/dist/ptr/node/network/MCardSerialization.d.ts +19 -0
  247. package/dist/ptr/node/network/MCardSerialization.d.ts.map +1 -0
  248. package/dist/ptr/node/network/MCardSerialization.js +41 -0
  249. package/dist/ptr/node/network/MCardSerialization.js.map +1 -0
  250. package/dist/ptr/node/network/NetworkInfrastructure.d.ts +37 -0
  251. package/dist/ptr/node/network/NetworkInfrastructure.d.ts.map +1 -0
  252. package/dist/ptr/node/network/NetworkInfrastructure.js +121 -0
  253. package/dist/ptr/node/network/NetworkInfrastructure.js.map +1 -0
  254. package/dist/ptr/node/network/NetworkSecurity.d.ts +24 -0
  255. package/dist/ptr/node/network/NetworkSecurity.d.ts.map +1 -0
  256. package/dist/ptr/node/network/NetworkSecurity.js +104 -0
  257. package/dist/ptr/node/network/NetworkSecurity.js.map +1 -0
  258. package/dist/ptr/node/runtimes/base.d.ts +31 -0
  259. package/dist/ptr/node/runtimes/base.d.ts.map +1 -0
  260. package/dist/ptr/node/runtimes/base.js +33 -0
  261. package/dist/ptr/node/runtimes/base.js.map +1 -0
  262. package/dist/ptr/node/runtimes/binary.d.ts +10 -0
  263. package/dist/ptr/node/runtimes/binary.d.ts.map +1 -0
  264. package/dist/ptr/node/runtimes/binary.js +16 -0
  265. package/dist/ptr/node/runtimes/binary.js.map +1 -0
  266. package/dist/ptr/node/runtimes/factory.d.ts +22 -0
  267. package/dist/ptr/node/runtimes/factory.d.ts.map +1 -0
  268. package/dist/ptr/node/runtimes/factory.js +152 -0
  269. package/dist/ptr/node/runtimes/factory.js.map +1 -0
  270. package/dist/ptr/node/runtimes/index.d.ts +28 -0
  271. package/dist/ptr/node/runtimes/index.d.ts.map +1 -0
  272. package/dist/ptr/node/runtimes/index.js +30 -0
  273. package/dist/ptr/node/runtimes/index.js.map +1 -0
  274. package/dist/ptr/node/runtimes/javascript.d.ts +22 -0
  275. package/dist/ptr/node/runtimes/javascript.d.ts.map +1 -0
  276. package/dist/ptr/node/runtimes/javascript.js +125 -0
  277. package/dist/ptr/node/runtimes/javascript.js.map +1 -0
  278. package/dist/ptr/node/runtimes/lean.d.ts +10 -0
  279. package/dist/ptr/node/runtimes/lean.d.ts.map +1 -0
  280. package/dist/ptr/node/runtimes/lean.js +60 -0
  281. package/dist/ptr/node/runtimes/lean.js.map +1 -0
  282. package/dist/ptr/node/runtimes/loader.d.ts +21 -0
  283. package/dist/ptr/node/runtimes/loader.d.ts.map +1 -0
  284. package/dist/ptr/node/runtimes/loader.js +126 -0
  285. package/dist/ptr/node/runtimes/loader.js.map +1 -0
  286. package/dist/ptr/node/runtimes/python.d.ts +14 -0
  287. package/dist/ptr/node/runtimes/python.d.ts.map +1 -0
  288. package/dist/ptr/node/runtimes/python.js +100 -0
  289. package/dist/ptr/node/runtimes/python.js.map +1 -0
  290. package/dist/ptr/node/runtimes/wasm.d.ts +10 -0
  291. package/dist/ptr/node/runtimes/wasm.d.ts.map +1 -0
  292. package/dist/ptr/node/runtimes/wasm.js +55 -0
  293. package/dist/ptr/node/runtimes/wasm.js.map +1 -0
  294. package/dist/rag/GraphRAGEngine.d.ts +26 -0
  295. package/dist/rag/GraphRAGEngine.d.ts.map +1 -0
  296. package/dist/rag/GraphRAGEngine.js +166 -0
  297. package/dist/rag/GraphRAGEngine.js.map +1 -0
  298. package/dist/rag/HandleVectorStore.d.ts +201 -0
  299. package/dist/rag/HandleVectorStore.d.ts.map +1 -0
  300. package/dist/rag/HandleVectorStore.js +527 -0
  301. package/dist/rag/HandleVectorStore.js.map +1 -0
  302. package/dist/rag/PersistentIndexer.d.ts +148 -0
  303. package/dist/rag/PersistentIndexer.d.ts.map +1 -0
  304. package/dist/rag/PersistentIndexer.js +302 -0
  305. package/dist/rag/PersistentIndexer.js.map +1 -0
  306. package/dist/rag/embeddings/VisionEmbeddingProvider.d.ts +87 -0
  307. package/dist/rag/embeddings/VisionEmbeddingProvider.d.ts.map +1 -0
  308. package/dist/rag/embeddings/VisionEmbeddingProvider.js +164 -0
  309. package/dist/rag/embeddings/VisionEmbeddingProvider.js.map +1 -0
  310. package/dist/rag/graph/community.d.ts +56 -0
  311. package/dist/rag/graph/community.d.ts.map +1 -0
  312. package/dist/rag/graph/community.js +247 -0
  313. package/dist/rag/graph/community.js.map +1 -0
  314. package/dist/rag/graph/extractor.d.ts +99 -0
  315. package/dist/rag/graph/extractor.d.ts.map +1 -0
  316. package/dist/rag/graph/extractor.js +210 -0
  317. package/dist/rag/graph/extractor.js.map +1 -0
  318. package/dist/rag/graph/store.d.ts +176 -0
  319. package/dist/rag/graph/store.d.ts.map +1 -0
  320. package/dist/rag/graph/store.js +504 -0
  321. package/dist/rag/graph/store.js.map +1 -0
  322. package/dist/rag/index.d.ts +20 -0
  323. package/dist/rag/index.d.ts.map +1 -0
  324. package/dist/rag/index.js +26 -0
  325. package/dist/rag/index.js.map +1 -0
  326. package/dist/rag/semanticVersioning.d.ts +187 -0
  327. package/dist/rag/semanticVersioning.d.ts.map +1 -0
  328. package/dist/rag/semanticVersioning.js +253 -0
  329. package/dist/rag/semanticVersioning.js.map +1 -0
  330. package/dist/storage/IndexedDBEngine.d.ts +33 -0
  331. package/dist/storage/IndexedDBEngine.d.ts.map +1 -0
  332. package/dist/storage/IndexedDBEngine.js +198 -0
  333. package/dist/storage/IndexedDBEngine.js.map +1 -0
  334. package/dist/storage/SqliteNodeEngine.d.ts +123 -0
  335. package/dist/storage/SqliteNodeEngine.d.ts.map +1 -0
  336. package/dist/storage/SqliteNodeEngine.js +385 -0
  337. package/dist/storage/SqliteNodeEngine.js.map +1 -0
  338. package/dist/storage/SqliteWasmEngine.d.ts +60 -0
  339. package/dist/storage/SqliteWasmEngine.d.ts.map +1 -0
  340. package/dist/storage/SqliteWasmEngine.js +193 -0
  341. package/dist/storage/SqliteWasmEngine.js.map +1 -0
  342. package/dist/storage/StorageAdapter.d.ts +42 -0
  343. package/dist/storage/StorageAdapter.d.ts.map +1 -0
  344. package/dist/storage/StorageAdapter.js +2 -0
  345. package/dist/storage/StorageAdapter.js.map +1 -0
  346. package/dist/storage/VectorStore.d.ts +202 -0
  347. package/dist/storage/VectorStore.d.ts.map +1 -0
  348. package/dist/storage/VectorStore.js +557 -0
  349. package/dist/storage/VectorStore.js.map +1 -0
  350. package/dist/storage/schema.d.ts +162 -0
  351. package/dist/storage/schema.d.ts.map +1 -0
  352. package/dist/storage/schema.js +373 -0
  353. package/dist/storage/schema.js.map +1 -0
  354. package/dist/util/FileIO.d.ts +44 -0
  355. package/dist/util/FileIO.d.ts.map +1 -0
  356. package/dist/util/FileIO.js +203 -0
  357. package/dist/util/FileIO.js.map +1 -0
  358. package/dist/util/Loader.d.ts +34 -0
  359. package/dist/util/Loader.d.ts.map +1 -0
  360. package/dist/util/Loader.js +168 -0
  361. package/dist/util/Loader.js.map +1 -0
  362. package/package.json +2 -1
@@ -0,0 +1,711 @@
1
+ /**
2
+ * CLM Action Monad - Composable Actions following Monad Laws.
3
+ *
4
+ * This module implements the Action monad for CLM, enabling composable
5
+ * agent actions that follow the three Monad Laws:
6
+ *
7
+ * 1. Left Identity: return a >>= f ≡ f a
8
+ * 2. Right Identity: m >>= return ≡ m
9
+ * 3. Associativity: (m >>= f) >>= g ≡ m >>= (λx. f x >>= g)
10
+ *
11
+ * Actions are the atomic units of computation in CLM workflows.
12
+ * Each action transforms context and produces a result while
13
+ * accumulating effects (memory updates, tool calls, logs).
14
+ *
15
+ * Aligned with the Lambda Calculus interpretation:
16
+ * - α-conversion: Action renaming (identity preservation)
17
+ * - β-reduction: Action execution (input substitution)
18
+ * - η-conversion: Behavioral equivalence (same I/O behavior)
19
+ */
20
+ // ============ Types ============
21
+ /**
22
+ * Status of an action execution.
23
+ */
24
+ export var ActionStatus;
25
+ (function (ActionStatus) {
26
+ ActionStatus["PENDING"] = "pending";
27
+ ActionStatus["RUNNING"] = "running";
28
+ ActionStatus["SUCCESS"] = "success";
29
+ ActionStatus["FAILURE"] = "failure";
30
+ ActionStatus["CANCELLED"] = "cancelled";
31
+ })(ActionStatus || (ActionStatus = {}));
32
+ /**
33
+ * Create a default ActionContext.
34
+ */
35
+ export function createActionContext(partial = {}) {
36
+ return {
37
+ sessionId: partial.sessionId ?? '',
38
+ agentId: partial.agentId ?? '',
39
+ config: partial.config ?? {},
40
+ secrets: partial.secrets ?? {},
41
+ params: partial.params ?? {},
42
+ timestamp: partial.timestamp ?? Date.now(),
43
+ traceId: partial.traceId ?? ''
44
+ };
45
+ }
46
+ /**
47
+ * Create a new context with updated params.
48
+ */
49
+ export function withParams(ctx, params) {
50
+ return {
51
+ ...ctx,
52
+ params: { ...ctx.params, ...params }
53
+ };
54
+ }
55
+ /**
56
+ * Create an empty effect (monoid identity).
57
+ */
58
+ export function emptyEffect() {
59
+ return {
60
+ memoryUpdates: [],
61
+ toolCalls: [],
62
+ logs: [],
63
+ tokens: { prompt: 0, completion: 0 },
64
+ executionTime: 0
65
+ };
66
+ }
67
+ /**
68
+ * Combine two effects (monoid append).
69
+ */
70
+ export function combineEffects(a, b) {
71
+ return {
72
+ memoryUpdates: [...a.memoryUpdates, ...b.memoryUpdates],
73
+ toolCalls: [...a.toolCalls, ...b.toolCalls],
74
+ logs: [...a.logs, ...b.logs],
75
+ tokens: {
76
+ prompt: a.tokens.prompt + b.tokens.prompt,
77
+ completion: a.tokens.completion + b.tokens.completion
78
+ },
79
+ executionTime: a.executionTime + b.executionTime
80
+ };
81
+ }
82
+ /**
83
+ * Create a successful result with a value.
84
+ */
85
+ export function pureResult(value) {
86
+ return {
87
+ success: true,
88
+ value,
89
+ effects: emptyEffect()
90
+ };
91
+ }
92
+ /**
93
+ * Create a failed result with an error.
94
+ */
95
+ export function failResult(error) {
96
+ return {
97
+ success: false,
98
+ error,
99
+ effects: emptyEffect()
100
+ };
101
+ }
102
+ /**
103
+ * Functor map: Apply function to value if successful.
104
+ */
105
+ export function mapResult(result, f) {
106
+ if (result.success && result.value !== undefined) {
107
+ try {
108
+ return {
109
+ success: true,
110
+ value: f(result.value),
111
+ effects: result.effects
112
+ };
113
+ }
114
+ catch (e) {
115
+ return {
116
+ success: false,
117
+ error: String(e),
118
+ effects: result.effects
119
+ };
120
+ }
121
+ }
122
+ return {
123
+ success: false,
124
+ error: result.error,
125
+ effects: result.effects
126
+ };
127
+ }
128
+ /**
129
+ * The Action Monad - A composable unit of computation.
130
+ *
131
+ * An Action encapsulates:
132
+ * - An async function from context to result
133
+ * - The ability to compose with other actions (bind/flatMap)
134
+ * - Effects accumulated during execution (Writer)
135
+ * - Context propagation (Reader)
136
+ * - Error handling (Either)
137
+ *
138
+ * Satisfies the Monad Laws:
139
+ *
140
+ * 1. Left Identity: Action.pure(a).bind(f) == f(a)
141
+ * 2. Right Identity: m.bind(Action.pure) == m
142
+ * 3. Associativity: m.bind(f).bind(g) == m.bind(x => f(x).bind(g))
143
+ */
144
+ export class Action {
145
+ _run;
146
+ /**
147
+ * Create an action from a function.
148
+ *
149
+ * @param run - Async function (ActionContext -> ActionResult<A>)
150
+ */
151
+ constructor(run) {
152
+ this._run = run;
153
+ }
154
+ /**
155
+ * Execute this action with the given context.
156
+ *
157
+ * @param ctx - The execution context
158
+ * @returns The result of the action
159
+ */
160
+ async execute(ctx) {
161
+ const startTime = Date.now();
162
+ try {
163
+ const result = await this._run(ctx);
164
+ // Add execution time to effects
165
+ result.effects.executionTime += Date.now() - startTime;
166
+ return result;
167
+ }
168
+ catch (e) {
169
+ const elapsed = Date.now() - startTime;
170
+ return {
171
+ success: false,
172
+ error: String(e),
173
+ effects: {
174
+ ...emptyEffect(),
175
+ executionTime: elapsed,
176
+ logs: [`Exception: ${e}`]
177
+ }
178
+ };
179
+ }
180
+ }
181
+ /**
182
+ * Monadic bind (>>=, flatMap).
183
+ *
184
+ * Sequences this action with a function that produces
185
+ * another action based on this action's result.
186
+ *
187
+ * This is the KEY operation that makes Action a monad.
188
+ *
189
+ * @param f - Function from A to Action<B>
190
+ * @returns A new action that chains the computations
191
+ */
192
+ bind(f) {
193
+ const self = this;
194
+ const boundRun = async (ctx) => {
195
+ // Execute this action
196
+ const resultA = await self.execute(ctx);
197
+ if (!resultA.success) {
198
+ // Propagate failure with accumulated effects
199
+ return {
200
+ success: false,
201
+ error: resultA.error,
202
+ effects: resultA.effects
203
+ };
204
+ }
205
+ // Apply f to get the next action
206
+ const actionB = f(resultA.value);
207
+ // Execute the next action
208
+ const resultB = await actionB.execute(ctx);
209
+ // Combine effects from both actions
210
+ const combinedEffects = combineEffects(resultA.effects, resultB.effects);
211
+ return {
212
+ success: resultB.success,
213
+ value: resultB.value,
214
+ error: resultB.error,
215
+ effects: combinedEffects
216
+ };
217
+ };
218
+ return new Action(boundRun);
219
+ }
220
+ /**
221
+ * Functor map.
222
+ *
223
+ * Apply a pure function to the action's result.
224
+ *
225
+ * @param f - Pure function from A to B
226
+ * @returns A new action with the transformed result
227
+ */
228
+ map(f) {
229
+ return this.bind(a => Action.pure(f(a)));
230
+ }
231
+ /**
232
+ * Sequence with another action, ignoring this result.
233
+ *
234
+ * Useful for side-effect-only actions.
235
+ *
236
+ * @param nextAction - The action to execute after this one
237
+ * @returns The result of nextAction
238
+ */
239
+ then(nextAction) {
240
+ return this.bind(_ => nextAction);
241
+ }
242
+ // ============ Static Constructors ============
243
+ /**
244
+ * Lift a pure value into Action (return/unit).
245
+ *
246
+ * This is the 'return' operation of the monad.
247
+ *
248
+ * Satisfies Left Identity: pure(a).bind(f) == f(a)
249
+ * Satisfies Right Identity: m.bind(pure) == m
250
+ *
251
+ * @param value - The value to lift
252
+ * @returns An action that immediately succeeds with the value
253
+ */
254
+ static pure(value) {
255
+ return new Action(async (_ctx) => pureResult(value));
256
+ }
257
+ /**
258
+ * Create a failing action.
259
+ *
260
+ * @param error - The error message
261
+ * @returns An action that immediately fails
262
+ */
263
+ static fail(error) {
264
+ return new Action(async (_ctx) => failResult(error));
265
+ }
266
+ /**
267
+ * Reader monad operation: Get the current context.
268
+ *
269
+ * @returns An action that returns the context
270
+ */
271
+ static ask() {
272
+ return new Action(async (ctx) => pureResult(ctx));
273
+ }
274
+ /**
275
+ * Reader monad operation: Apply function to context.
276
+ *
277
+ * @param f - Function to apply to context
278
+ * @returns An action that returns f(context)
279
+ */
280
+ static asks(f) {
281
+ return Action.ask().map(f);
282
+ }
283
+ /**
284
+ * Writer monad operation: Emit an effect.
285
+ *
286
+ * @param effect - The effect to emit
287
+ * @returns An action that emits the effect
288
+ */
289
+ static tell(effect) {
290
+ return new Action(async (_ctx) => ({
291
+ success: true,
292
+ value: undefined,
293
+ effects: effect
294
+ }));
295
+ }
296
+ /**
297
+ * Convenience: Log a message.
298
+ *
299
+ * @param message - The log message
300
+ * @returns An action that logs the message
301
+ */
302
+ static log(message) {
303
+ return Action.tell({ ...emptyEffect(), logs: [message] });
304
+ }
305
+ /**
306
+ * Create an action from an async function.
307
+ *
308
+ * @param f - Async function (ctx -> A)
309
+ * @returns An action wrapping the function
310
+ */
311
+ static fromAsync(f) {
312
+ return new Action(async (ctx) => {
313
+ try {
314
+ const result = await f(ctx);
315
+ return pureResult(result);
316
+ }
317
+ catch (e) {
318
+ return failResult(String(e));
319
+ }
320
+ });
321
+ }
322
+ /**
323
+ * Create an action from a synchronous function.
324
+ *
325
+ * @param f - Sync function (ctx -> A)
326
+ * @returns An action wrapping the function
327
+ */
328
+ static fromSync(f) {
329
+ return new Action(async (ctx) => {
330
+ try {
331
+ const result = f(ctx);
332
+ return pureResult(result);
333
+ }
334
+ catch (e) {
335
+ return failResult(String(e));
336
+ }
337
+ });
338
+ }
339
+ }
340
+ // ============ Action Composition Utilities ============
341
+ /**
342
+ * Sequence a list of actions, collecting results.
343
+ *
344
+ * @param actions - List of actions to sequence
345
+ * @returns An action that produces a list of results
346
+ */
347
+ export function sequence(actions) {
348
+ if (actions.length === 0) {
349
+ return Action.pure([]);
350
+ }
351
+ return new Action(async (ctx) => {
352
+ const results = [];
353
+ let combinedEffects = emptyEffect();
354
+ for (const action of actions) {
355
+ const result = await action.execute(ctx);
356
+ combinedEffects = combineEffects(combinedEffects, result.effects);
357
+ if (!result.success) {
358
+ return {
359
+ success: false,
360
+ error: result.error,
361
+ effects: combinedEffects
362
+ };
363
+ }
364
+ results.push(result.value);
365
+ }
366
+ return {
367
+ success: true,
368
+ value: results,
369
+ effects: combinedEffects
370
+ };
371
+ });
372
+ }
373
+ /**
374
+ * Execute actions in parallel, collecting results.
375
+ *
376
+ * @param actions - List of actions to execute in parallel
377
+ * @returns An action that produces a list of results
378
+ */
379
+ export function parallel(actions) {
380
+ if (actions.length === 0) {
381
+ return Action.pure([]);
382
+ }
383
+ return new Action(async (ctx) => {
384
+ // Execute all actions concurrently
385
+ const resultPromises = actions.map(action => action.execute(ctx));
386
+ const results = await Promise.all(resultPromises);
387
+ // Combine effects and check for failures
388
+ let combinedEffects = emptyEffect();
389
+ const values = [];
390
+ for (const result of results) {
391
+ combinedEffects = combineEffects(combinedEffects, result.effects);
392
+ if (!result.success) {
393
+ return {
394
+ success: false,
395
+ error: result.error,
396
+ effects: combinedEffects
397
+ };
398
+ }
399
+ values.push(result.value);
400
+ }
401
+ return {
402
+ success: true,
403
+ value: values,
404
+ effects: combinedEffects
405
+ };
406
+ });
407
+ }
408
+ /**
409
+ * Kleisli composition: Compose two monadic functions.
410
+ *
411
+ * (g <=< f)(a) = f(a).bind(g)
412
+ *
413
+ * This is the categorical composition in the Kleisli category.
414
+ *
415
+ * @param f - First Kleisli arrow (A -> Action<B>)
416
+ * @param g - Second Kleisli arrow (B -> Action<C>)
417
+ * @returns Composed Kleisli arrow (A -> Action<C>)
418
+ */
419
+ export function kleisliCompose(f, g) {
420
+ return (a) => f(a).bind(g);
421
+ }
422
+ /**
423
+ * The identity Kleisli arrow.
424
+ *
425
+ * This is Action.pure, serving as the identity for Kleisli composition.
426
+ *
427
+ * @returns The identity function in the Kleisli category
428
+ */
429
+ export function identityAction() {
430
+ return Action.pure;
431
+ }
432
+ // ============ Monad Law Verification ============
433
+ /**
434
+ * Verify Left Identity law: pure(a).bind(f) == f(a)
435
+ *
436
+ * @param a - A value
437
+ * @param f - A Kleisli arrow
438
+ * @param ctx - Execution context
439
+ * @returns True if the law holds
440
+ */
441
+ export async function verifyLeftIdentity(a, f, ctx) {
442
+ const left = await Action.pure(a).bind(f).execute(ctx);
443
+ const right = await f(a).execute(ctx);
444
+ return (left.success === right.success &&
445
+ JSON.stringify(left.value) === JSON.stringify(right.value) &&
446
+ left.error === right.error);
447
+ }
448
+ /**
449
+ * Verify Right Identity law: m.bind(pure) == m
450
+ *
451
+ * @param m - An action
452
+ * @param ctx - Execution context
453
+ * @returns True if the law holds
454
+ */
455
+ export async function verifyRightIdentity(m, ctx) {
456
+ const left = await m.bind(Action.pure).execute(ctx);
457
+ const right = await m.execute(ctx);
458
+ return (left.success === right.success &&
459
+ JSON.stringify(left.value) === JSON.stringify(right.value) &&
460
+ left.error === right.error);
461
+ }
462
+ /**
463
+ * Verify Associativity law: (m.bind(f)).bind(g) == m.bind(x => f(x).bind(g))
464
+ *
465
+ * @param m - An action
466
+ * @param f - First Kleisli arrow
467
+ * @param g - Second Kleisli arrow
468
+ * @param ctx - Execution context
469
+ * @returns True if the law holds
470
+ */
471
+ export async function verifyAssociativity(m, f, g, ctx) {
472
+ const left = await m.bind(f).bind(g).execute(ctx);
473
+ const right = await m.bind(x => f(x).bind(g)).execute(ctx);
474
+ return (left.success === right.success &&
475
+ JSON.stringify(left.value) === JSON.stringify(right.value) &&
476
+ left.error === right.error);
477
+ }
478
+ /**
479
+ * Contract-aware Action that produces VCard pairs.
480
+ *
481
+ * Extends the base Action monad with Hoare Logic contracts:
482
+ * - Verifies preconditions before execution
483
+ * - Verifies postconditions after execution
484
+ * - Produces VCard pair as verification evidence
485
+ */
486
+ export class ContractAction extends Action {
487
+ contract;
488
+ constructor(run, contract) {
489
+ super(run);
490
+ this.contract = contract;
491
+ }
492
+ /**
493
+ * Get the contract for this action.
494
+ */
495
+ getContract() {
496
+ return this.contract;
497
+ }
498
+ /**
499
+ * Verify preconditions against the context.
500
+ */
501
+ verifyPreconditions(ctx) {
502
+ const conditions = this.contract.preconditions.map(cond => {
503
+ try {
504
+ const satisfied = cond.check(ctx);
505
+ return { name: cond.name, expression: cond.expression, satisfied };
506
+ }
507
+ catch (e) {
508
+ return { name: cond.name, expression: cond.expression, satisfied: false, error: String(e) };
509
+ }
510
+ });
511
+ return {
512
+ phase: 'pre',
513
+ conditions,
514
+ allSatisfied: conditions.every(c => c.satisfied),
515
+ timestamp: Date.now()
516
+ };
517
+ }
518
+ /**
519
+ * Verify postconditions against the result.
520
+ */
521
+ verifyPostconditions(result) {
522
+ const conditions = this.contract.postconditions.map(cond => {
523
+ try {
524
+ const satisfied = cond.check(result);
525
+ return { name: cond.name, expression: cond.expression, satisfied };
526
+ }
527
+ catch (e) {
528
+ return { name: cond.name, expression: cond.expression, satisfied: false, error: String(e) };
529
+ }
530
+ });
531
+ return {
532
+ phase: 'post',
533
+ conditions,
534
+ allSatisfied: conditions.every(c => c.satisfied),
535
+ timestamp: Date.now()
536
+ };
537
+ }
538
+ /**
539
+ * Create a PreCondition VCard from verification result.
540
+ * Returns a hash representing the VCard (in production, would store in MCard collection).
541
+ */
542
+ createPreConditionVCard(verification, actionHash) {
543
+ const vcard = {
544
+ type: 'PreConditionVCard',
545
+ actionHash,
546
+ timestamp: new Date(verification.timestamp).toISOString(),
547
+ preconditions: verification.conditions,
548
+ certification: {
549
+ allSatisfied: verification.allSatisfied,
550
+ checkedAt: new Date(verification.timestamp).toISOString(),
551
+ certifier: 'ptr_engine_v0.2.0'
552
+ }
553
+ };
554
+ // In production: store as MCard and return hash
555
+ // For now: return a deterministic hash representation
556
+ return `vcard:pre:${actionHash}:${verification.timestamp}`;
557
+ }
558
+ /**
559
+ * Create a PostCondition VCard from verification result.
560
+ * Links back to the PreCondition VCard.
561
+ */
562
+ createPostConditionVCard(verification, actionHash, preVCardHash, result) {
563
+ const vcard = {
564
+ type: 'PostConditionVCard',
565
+ actionHash,
566
+ timestamp: new Date(verification.timestamp).toISOString(),
567
+ preConditionVCardHash: preVCardHash,
568
+ postconditions: verification.conditions,
569
+ executionSummary: {
570
+ success: result.success,
571
+ executionTimeMs: result.effects.executionTime,
572
+ effectsAccumulated: {
573
+ logCount: result.effects.logs.length,
574
+ memoryUpdates: result.effects.memoryUpdates.length,
575
+ toolCalls: result.effects.toolCalls.length
576
+ }
577
+ },
578
+ certification: {
579
+ allSatisfied: verification.allSatisfied,
580
+ checkedAt: new Date(verification.timestamp).toISOString(),
581
+ certifier: 'ptr_engine_v0.2.0'
582
+ }
583
+ };
584
+ // In production: store as MCard and return hash
585
+ return `vcard:post:${actionHash}:${verification.timestamp}`;
586
+ }
587
+ /**
588
+ * Generate a hash for this action (based on contract).
589
+ */
590
+ getActionHash() {
591
+ const contractSummary = {
592
+ preConditions: this.contract.preconditions.map(c => c.name),
593
+ postConditions: this.contract.postconditions.map(c => c.name)
594
+ };
595
+ return `action:${JSON.stringify(contractSummary)}`.substring(0, 64);
596
+ }
597
+ /**
598
+ * Execute with full contract verification, producing VCard pair.
599
+ *
600
+ * This is the primary method for contract-aware execution:
601
+ * 1. Verify preconditions → create PreCondition VCard
602
+ * 2. Execute action (only if preconditions pass)
603
+ * 3. Verify postconditions → create PostCondition VCard
604
+ * 4. Return result with VCard pair
605
+ */
606
+ async executeWithContract(ctx) {
607
+ const actionHash = this.getActionHash();
608
+ // Phase 1: Verify preconditions
609
+ const preVerification = this.verifyPreconditions(ctx);
610
+ const preVCard = this.createPreConditionVCard(preVerification, actionHash);
611
+ // If preconditions fail, return early with failure
612
+ if (!preVerification.allSatisfied) {
613
+ const failedConditions = preVerification.conditions
614
+ .filter(c => !c.satisfied)
615
+ .map(c => c.name)
616
+ .join(', ');
617
+ const failedResult = failResult(`Precondition failed: ${failedConditions}`);
618
+ const postVerification = {
619
+ phase: 'post',
620
+ conditions: [],
621
+ allSatisfied: false,
622
+ timestamp: Date.now()
623
+ };
624
+ return {
625
+ result: failedResult,
626
+ vCardPair: {
627
+ preConditionVCard: preVCard,
628
+ postConditionVCard: '',
629
+ actionHash,
630
+ linkedAt: Date.now()
631
+ },
632
+ preVerification,
633
+ postVerification
634
+ };
635
+ }
636
+ // Phase 2: Execute action
637
+ const result = await this.execute(ctx);
638
+ // Phase 3: Verify postconditions
639
+ const postVerification = result.success
640
+ ? this.verifyPostconditions(result)
641
+ : { phase: 'post', conditions: [], allSatisfied: false, timestamp: Date.now() };
642
+ const postVCard = this.createPostConditionVCard(postVerification, actionHash, preVCard, result);
643
+ return {
644
+ result,
645
+ vCardPair: {
646
+ preConditionVCard: preVCard,
647
+ postConditionVCard: postVCard,
648
+ actionHash,
649
+ linkedAt: Date.now()
650
+ },
651
+ preVerification,
652
+ postVerification
653
+ };
654
+ }
655
+ /**
656
+ * Compose contract-aware actions, chaining VCard pairs.
657
+ */
658
+ bindWithContract(f) {
659
+ const self = this;
660
+ // Merged contract: preconditions from self, postconditions from f's result
661
+ const mergedContract = {
662
+ preconditions: this.contract.preconditions,
663
+ postconditions: [] // Will be filled by the bound action
664
+ };
665
+ const boundRun = async (ctx) => {
666
+ const resultA = await self.execute(ctx);
667
+ if (!resultA.success) {
668
+ return {
669
+ success: false,
670
+ error: resultA.error,
671
+ effects: resultA.effects
672
+ };
673
+ }
674
+ const actionB = f(resultA.value);
675
+ const resultB = await actionB.execute(ctx);
676
+ return {
677
+ success: resultB.success,
678
+ value: resultB.value,
679
+ error: resultB.error,
680
+ effects: combineEffects(resultA.effects, resultB.effects)
681
+ };
682
+ };
683
+ return new ContractAction(boundRun, mergedContract);
684
+ }
685
+ // ============ Static Constructors ============
686
+ /**
687
+ * Create a contract-aware action from a pure value.
688
+ */
689
+ static pureWithContract(value, contract) {
690
+ const defaultContract = contract ?? {
691
+ preconditions: [],
692
+ postconditions: [{ name: 'has_value', expression: 'result.value !== undefined', check: r => r.value !== undefined }]
693
+ };
694
+ return new ContractAction(async (_ctx) => pureResult(value), defaultContract);
695
+ }
696
+ /**
697
+ * Create a contract-aware action from an async function.
698
+ */
699
+ static fromAsyncWithContract(f, contract) {
700
+ return new ContractAction(async (ctx) => {
701
+ try {
702
+ const result = await f(ctx);
703
+ return pureResult(result);
704
+ }
705
+ catch (e) {
706
+ return failResult(String(e));
707
+ }
708
+ }, contract);
709
+ }
710
+ }
711
+ //# sourceMappingURL=Action.js.map