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,84 @@
1
+ /**
2
+ * LensProtocol - JSON-RPC 2.0 communication for PTR
3
+ *
4
+ * Provides standardized message format for PCard execution
5
+ */
6
+ export interface JsonRpcRequest {
7
+ jsonrpc: '2.0';
8
+ id: string | number;
9
+ method: string;
10
+ params?: unknown;
11
+ }
12
+ export interface JsonRpcResponse {
13
+ jsonrpc: '2.0';
14
+ id: string | number;
15
+ result?: unknown;
16
+ error?: {
17
+ code: number;
18
+ message: string;
19
+ data?: unknown;
20
+ };
21
+ }
22
+ export interface ExecuteParams {
23
+ pcard_hash: string;
24
+ target_hash: string;
25
+ context?: Record<string, unknown>;
26
+ }
27
+ export interface VerifyParams {
28
+ pcard_hash: string;
29
+ target_hash: string;
30
+ context?: Record<string, unknown>;
31
+ }
32
+ export interface RevealParams {
33
+ card_hash: string;
34
+ aspect: string;
35
+ }
36
+ /**
37
+ * LensProtocol - Create and parse JSON-RPC messages
38
+ */
39
+ export declare class LensProtocol {
40
+ private static idCounter;
41
+ /**
42
+ * Create an execute request
43
+ */
44
+ static createExecuteRequest(pcard_hash: string, target_hash: string, context?: Record<string, unknown>): JsonRpcRequest;
45
+ /**
46
+ * Create a verify request
47
+ */
48
+ static createVerifyRequest(pcard_hash: string, target_hash: string, context?: Record<string, unknown>): JsonRpcRequest;
49
+ /**
50
+ * Create a reveal request
51
+ */
52
+ static createRevealRequest(card_hash: string, aspect: string): JsonRpcRequest;
53
+ /**
54
+ * Create a system status request
55
+ */
56
+ static createStatusRequest(): JsonRpcRequest;
57
+ /**
58
+ * Create a system health request
59
+ */
60
+ static createHealthRequest(): JsonRpcRequest;
61
+ /**
62
+ * Create a success response
63
+ */
64
+ static createSuccessResponse(id: string | number, result: unknown): JsonRpcResponse;
65
+ /**
66
+ * Create an error response
67
+ */
68
+ static createErrorResponse(id: string | number, code: number, message: string, data?: unknown): JsonRpcResponse;
69
+ /**
70
+ * Parse a JSON-RPC response
71
+ */
72
+ static parseResponse<T>(response: JsonRpcResponse): T;
73
+ }
74
+ export declare const ErrorCodes: {
75
+ readonly PARSE_ERROR: -32700;
76
+ readonly INVALID_REQUEST: -32600;
77
+ readonly METHOD_NOT_FOUND: -32601;
78
+ readonly INVALID_PARAMS: -32602;
79
+ readonly INTERNAL_ERROR: -32603;
80
+ readonly EXECUTION_ERROR: -32000;
81
+ readonly VERIFICATION_FAILED: -32001;
82
+ readonly TIMEOUT: -32002;
83
+ };
84
+ //# sourceMappingURL=LensProtocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LensProtocol.d.ts","sourceRoot":"","sources":["../../src/ptr/LensProtocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,cAAc;IAC3B,OAAO,EAAE,KAAK,CAAC;IACf,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;IACpB,MAAM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IACH,MAAM,CAAC,mBAAmB,IAAI,cAAc;IAQ5C;;OAEG;IACH,MAAM,CAAC,mBAAmB,IAAI,cAAc;IAQ5C;;OAEG;IACH,MAAM,CAAC,qBAAqB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,eAAe;IAInF;;OAEG;IACH,MAAM,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,eAAe;IAI/G;;OAEG;IACH,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,eAAe,GAAG,CAAC;CAMxD;AAGD,eAAO,MAAM,UAAU;;;;;;;;;CAUb,CAAC"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * LensProtocol - JSON-RPC 2.0 communication for PTR
3
+ *
4
+ * Provides standardized message format for PCard execution
5
+ */
6
+ /**
7
+ * LensProtocol - Create and parse JSON-RPC messages
8
+ */
9
+ export class LensProtocol {
10
+ static idCounter = 0;
11
+ /**
12
+ * Create an execute request
13
+ */
14
+ static createExecuteRequest(pcard_hash, target_hash, context) {
15
+ return {
16
+ jsonrpc: '2.0',
17
+ id: ++this.idCounter,
18
+ method: 'pcard.execute',
19
+ params: { pcard_hash, target_hash, context }
20
+ };
21
+ }
22
+ /**
23
+ * Create a verify request
24
+ */
25
+ static createVerifyRequest(pcard_hash, target_hash, context) {
26
+ return {
27
+ jsonrpc: '2.0',
28
+ id: ++this.idCounter,
29
+ method: 'pcard.verify',
30
+ params: { pcard_hash, target_hash, context }
31
+ };
32
+ }
33
+ /**
34
+ * Create a reveal request
35
+ */
36
+ static createRevealRequest(card_hash, aspect) {
37
+ return {
38
+ jsonrpc: '2.0',
39
+ id: ++this.idCounter,
40
+ method: 'lens.reveal',
41
+ params: { card_hash, aspect }
42
+ };
43
+ }
44
+ /**
45
+ * Create a system status request
46
+ */
47
+ static createStatusRequest() {
48
+ return {
49
+ jsonrpc: '2.0',
50
+ id: ++this.idCounter,
51
+ method: 'system.status'
52
+ };
53
+ }
54
+ /**
55
+ * Create a system health request
56
+ */
57
+ static createHealthRequest() {
58
+ return {
59
+ jsonrpc: '2.0',
60
+ id: ++this.idCounter,
61
+ method: 'system.health'
62
+ };
63
+ }
64
+ /**
65
+ * Create a success response
66
+ */
67
+ static createSuccessResponse(id, result) {
68
+ return { jsonrpc: '2.0', id, result };
69
+ }
70
+ /**
71
+ * Create an error response
72
+ */
73
+ static createErrorResponse(id, code, message, data) {
74
+ return { jsonrpc: '2.0', id, error: { code, message, data } };
75
+ }
76
+ /**
77
+ * Parse a JSON-RPC response
78
+ */
79
+ static parseResponse(response) {
80
+ if (response.error) {
81
+ throw new Error(`JSON-RPC Error ${response.error.code}: ${response.error.message}`);
82
+ }
83
+ return response.result;
84
+ }
85
+ }
86
+ // Standard JSON-RPC error codes
87
+ export const ErrorCodes = {
88
+ PARSE_ERROR: -32700,
89
+ INVALID_REQUEST: -32600,
90
+ METHOD_NOT_FOUND: -32601,
91
+ INVALID_PARAMS: -32602,
92
+ INTERNAL_ERROR: -32603,
93
+ // Custom PTR errors
94
+ EXECUTION_ERROR: -32000,
95
+ VERIFICATION_FAILED: -32001,
96
+ TIMEOUT: -32002
97
+ };
98
+ //# sourceMappingURL=LensProtocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LensProtocol.js","sourceRoot":"","sources":["../../src/ptr/LensProtocol.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAqCH;;GAEG;AACH,MAAM,OAAO,YAAY;IACb,MAAM,CAAC,SAAS,GAAG,CAAC,CAAC;IAE7B;;OAEG;IACH,MAAM,CAAC,oBAAoB,CAAC,UAAkB,EAAE,WAAmB,EAAE,OAAiC;QAClG,OAAO;YACH,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,EAAE,IAAI,CAAC,SAAS;YACpB,MAAM,EAAE,eAAe;YAC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,IAAI,EAAE,EAAE,CAAC;IAClE,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa,CAAI,QAAyB;QAC7C,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,kBAAkB,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QACxF,CAAC;QACD,OAAO,QAAQ,CAAC,MAAW,CAAC;IAChC,CAAC;;AAGL,gCAAgC;AAChC,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,WAAW,EAAE,CAAC,KAAK;IACnB,eAAe,EAAE,CAAC,KAAK;IACvB,gBAAgB,EAAE,CAAC,KAAK;IACxB,cAAc,EAAE,CAAC,KAAK;IACtB,cAAc,EAAE,CAAC,KAAK;IACtB,oBAAoB;IACpB,eAAe,EAAE,CAAC,KAAK;IACvB,mBAAmB,EAAE,CAAC,KAAK;IAC3B,OAAO,EAAE,CAAC,KAAK;CACT,CAAC"}
@@ -0,0 +1,54 @@
1
+ /**
2
+ * SandboxWorker - Execute code in isolated Web Worker
3
+ *
4
+ * Provides safe execution environment for PCard logic
5
+ */
6
+ /**
7
+ * SandboxWorker - Manages Web Worker for isolated execution
8
+ */
9
+ export declare class SandboxWorker {
10
+ private worker;
11
+ private pendingRequests;
12
+ private defaultTimeout;
13
+ /**
14
+ * Initialize the sandbox worker
15
+ */
16
+ init(): Promise<void>;
17
+ /**
18
+ * Execute code in sandbox
19
+ */
20
+ private requestCounter;
21
+ /**
22
+ * Execute code in sandbox
23
+ * Note: Uses internal JSON-RPC format with direct code, not LensProtocol Standard (hashes)
24
+ */
25
+ execute(code: string, input: unknown, context?: Record<string, unknown>): Promise<unknown>;
26
+ /**
27
+ * Verify output matches expected
28
+ * Note: Uses internal JSON-RPC format with direct values
29
+ */
30
+ verify(hash: string, expectedOutput: unknown, actualOutput: unknown): Promise<{
31
+ verified: boolean;
32
+ }>;
33
+ /**
34
+ * Send request and wait for response
35
+ */
36
+ private sendRequest;
37
+ /**
38
+ * Handle worker message
39
+ */
40
+ private handleMessage;
41
+ /**
42
+ * Handle worker error
43
+ */
44
+ private handleError;
45
+ /**
46
+ * Terminate the worker
47
+ */
48
+ terminate(): void;
49
+ /**
50
+ * Set timeout for requests
51
+ */
52
+ setTimeout(ms: number): void;
53
+ }
54
+ //# sourceMappingURL=SandboxWorker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxWorker.d.ts","sourceRoot":"","sources":["../../src/ptr/SandboxWorker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoDH;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,eAAe,CAIlB;IACL,OAAO,CAAC,cAAc,CAAQ;IAE9B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B;;OAEG;IACH,OAAO,CAAC,cAAc,CAAK;IAE3B;;;OAGG;IACG,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC;IAchG;;;OAGG;IACG,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAc1G;;OAEG;IACH,OAAO,CAAC,WAAW;IAYnB;;OAEG;IACH,OAAO,CAAC,aAAa;IAgBrB;;OAEG;IACH,OAAO,CAAC,WAAW;IAUnB;;OAEG;IACH,SAAS,IAAI,IAAI;IAcjB;;OAEG;IACH,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;CAG7B"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * SandboxWorker - Execute code in isolated Web Worker
3
+ *
4
+ * Provides safe execution environment for PCard logic
5
+ */
6
+ /**
7
+ * Worker code as inline string (will be converted to Blob URL)
8
+ */
9
+ const WORKER_CODE = `
10
+ // Sandboxed execution environment
11
+ self.onmessage = async function(e) {
12
+ const request = e.data;
13
+
14
+ try {
15
+ if (request.method === 'pcard.execute') {
16
+ const { pcard, context } = request.params;
17
+ const result = await executeCode(pcard.code, pcard.input, context);
18
+ self.postMessage({
19
+ jsonrpc: '2.0',
20
+ id: request.id,
21
+ result
22
+ });
23
+ } else if (request.method === 'pcard.verify') {
24
+ const { expectedOutput, actualOutput } = request.params;
25
+ const matches = JSON.stringify(expectedOutput) === JSON.stringify(actualOutput);
26
+ self.postMessage({
27
+ jsonrpc: '2.0',
28
+ id: request.id,
29
+ result: { verified: matches }
30
+ });
31
+ } else {
32
+ throw new Error('Method not found: ' + request.method);
33
+ }
34
+ } catch (error) {
35
+ self.postMessage({
36
+ jsonrpc: '2.0',
37
+ id: request.id,
38
+ error: {
39
+ code: -32000,
40
+ message: error.message || 'Execution error'
41
+ }
42
+ });
43
+ }
44
+ };
45
+
46
+ // Execute JavaScript code in sandbox
47
+ async function executeCode(code, input, context) {
48
+ // Create a sandboxed function
49
+ const fn = new Function('input', 'context', code);
50
+ return fn(input, context || {});
51
+ }
52
+ `;
53
+ /**
54
+ * SandboxWorker - Manages Web Worker for isolated execution
55
+ */
56
+ export class SandboxWorker {
57
+ worker = null;
58
+ pendingRequests = new Map();
59
+ defaultTimeout = 5000; // 5 seconds
60
+ /**
61
+ * Initialize the sandbox worker
62
+ */
63
+ async init() {
64
+ const blob = new Blob([WORKER_CODE], { type: 'application/javascript' });
65
+ const workerUrl = URL.createObjectURL(blob);
66
+ this.worker = new Worker(workerUrl);
67
+ this.worker.onmessage = this.handleMessage.bind(this);
68
+ this.worker.onerror = this.handleError.bind(this);
69
+ // Clean up blob URL
70
+ URL.revokeObjectURL(workerUrl);
71
+ }
72
+ /**
73
+ * Execute code in sandbox
74
+ */
75
+ requestCounter = 0;
76
+ /**
77
+ * Execute code in sandbox
78
+ * Note: Uses internal JSON-RPC format with direct code, not LensProtocol Standard (hashes)
79
+ */
80
+ async execute(code, input, context) {
81
+ if (!this.worker) {
82
+ throw new Error('Worker not initialized. Call init() first.');
83
+ }
84
+ const request = {
85
+ jsonrpc: '2.0',
86
+ id: ++this.requestCounter,
87
+ method: 'pcard.execute',
88
+ params: { pcard: { code, input }, context }
89
+ };
90
+ return this.sendRequest(request);
91
+ }
92
+ /**
93
+ * Verify output matches expected
94
+ * Note: Uses internal JSON-RPC format with direct values
95
+ */
96
+ async verify(hash, expectedOutput, actualOutput) {
97
+ if (!this.worker) {
98
+ throw new Error('Worker not initialized. Call init() first.');
99
+ }
100
+ const request = {
101
+ jsonrpc: '2.0',
102
+ id: ++this.requestCounter,
103
+ method: 'pcard.verify',
104
+ params: { hash, expectedOutput, actualOutput }
105
+ };
106
+ return this.sendRequest(request);
107
+ }
108
+ /**
109
+ * Send request and wait for response
110
+ */
111
+ sendRequest(request) {
112
+ return new Promise((resolve, reject) => {
113
+ const timeout = setTimeout(() => {
114
+ this.pendingRequests.delete(request.id);
115
+ reject(new Error(`Request ${request.id} timed out`));
116
+ }, this.defaultTimeout);
117
+ this.pendingRequests.set(request.id, { resolve, reject, timeout });
118
+ this.worker.postMessage(request);
119
+ });
120
+ }
121
+ /**
122
+ * Handle worker message
123
+ */
124
+ handleMessage(event) {
125
+ const response = event.data;
126
+ const pending = this.pendingRequests.get(response.id);
127
+ if (pending) {
128
+ clearTimeout(pending.timeout);
129
+ this.pendingRequests.delete(response.id);
130
+ if (response.error) {
131
+ pending.reject(new Error(`Error ${response.error.code}: ${response.error.message}`));
132
+ }
133
+ else {
134
+ pending.resolve(response.result);
135
+ }
136
+ }
137
+ }
138
+ /**
139
+ * Handle worker error
140
+ */
141
+ handleError(event) {
142
+ console.error('Worker error:', event.message);
143
+ // Reject all pending requests
144
+ for (const [id, pending] of this.pendingRequests) {
145
+ clearTimeout(pending.timeout);
146
+ pending.reject(new Error(`Worker error: ${event.message}`));
147
+ }
148
+ this.pendingRequests.clear();
149
+ }
150
+ /**
151
+ * Terminate the worker
152
+ */
153
+ terminate() {
154
+ if (this.worker) {
155
+ // Reject pending requests
156
+ for (const [id, pending] of this.pendingRequests) {
157
+ clearTimeout(pending.timeout);
158
+ pending.reject(new Error('Worker terminated'));
159
+ }
160
+ this.pendingRequests.clear();
161
+ this.worker.terminate();
162
+ this.worker = null;
163
+ }
164
+ }
165
+ /**
166
+ * Set timeout for requests
167
+ */
168
+ setTimeout(ms) {
169
+ this.defaultTimeout = ms;
170
+ }
171
+ }
172
+ //# sourceMappingURL=SandboxWorker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SandboxWorker.js","sourceRoot":"","sources":["../../src/ptr/SandboxWorker.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2CnB,CAAC;AAEF;;GAEG;AACH,MAAM,OAAO,aAAa;IAChB,MAAM,GAAkB,IAAI,CAAC;IAC7B,eAAe,GAAG,IAAI,GAAG,EAI7B,CAAC;IACG,cAAc,GAAG,IAAI,CAAC,CAAC,YAAY;IAE3C;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE,CAAC,CAAC;QACzE,MAAM,SAAS,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;QAE5C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC,SAAS,CAAC,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACtD,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CA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AAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,iBAAiB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAC/B,CAAC;IAED;;OAEG;IACH,SAAS;QACP,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YAChB,0BAA0B;YAC1B,KAAK,MAAM,CAAC,EAAE,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBACjD,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC9B,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;YACjD,CAAC;YACD,IAAI,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;YAE7B,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;YACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACrB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,UAAU,CAAC,EAAU;QACnB,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;IAC3B,CAAC;CACF"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Common types for PTR system
3
+ * Matches python mcard.ptr.core.common_types
4
+ */
5
+ export type PrimeHash = string;
6
+ export interface PolynomialTerm {
7
+ coefficient: PrimeHash;
8
+ exponent: PrimeHash;
9
+ weight: number;
10
+ }
11
+ export interface SafetyViolation {
12
+ property: string;
13
+ violation_type: string;
14
+ details: string;
15
+ timestamp: string;
16
+ }
17
+ export interface LivenessMetric {
18
+ goal: string;
19
+ progress: number;
20
+ timestamp: string;
21
+ }
22
+ export declare enum VerificationStatus {
23
+ PENDING = "pending",
24
+ VERIFIED = "verified",
25
+ FAILED = "failed",
26
+ SKIPPED = "skipped"
27
+ }
28
+ export interface ExecutionResult {
29
+ success: boolean;
30
+ output: unknown;
31
+ verification_vcard: string | null;
32
+ execution_time_ms: number;
33
+ alignment_score?: number;
34
+ invariants_preserved: boolean;
35
+ safety_violations: SafetyViolation[];
36
+ liveness_metrics: LivenessMetric[];
37
+ error_message?: string;
38
+ }
39
+ //# sourceMappingURL=common_types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common_types.d.ts","sourceRoot":"","sources":["../../src/ptr/common_types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC3B,WAAW,EAAE,SAAS,CAAC;IACvB,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,oBAAY,kBAAkB;IAC1B,OAAO,YAAY;IACnB,QAAQ,aAAa;IACrB,MAAM,WAAW;IACjB,OAAO,YAAY;CACtB;AAED,MAAM,WAAW,eAAe;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,iBAAiB,EAAE,MAAM,CAAC;IAG1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,EAAE,OAAO,CAAC;IAG9B,iBAAiB,EAAE,eAAe,EAAE,CAAC;IACrC,gBAAgB,EAAE,cAAc,EAAE,CAAC;IAEnC,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Common types for PTR system
3
+ * Matches python mcard.ptr.core.common_types
4
+ */
5
+ export var VerificationStatus;
6
+ (function (VerificationStatus) {
7
+ VerificationStatus["PENDING"] = "pending";
8
+ VerificationStatus["VERIFIED"] = "verified";
9
+ VerificationStatus["FAILED"] = "failed";
10
+ VerificationStatus["SKIPPED"] = "skipped";
11
+ })(VerificationStatus || (VerificationStatus = {}));
12
+ //# sourceMappingURL=common_types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common_types.js","sourceRoot":"","sources":["../../src/ptr/common_types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAwBH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC1B,yCAAmB,CAAA;IACnB,2CAAqB,CAAA;IACrB,uCAAiB,CAAA;IACjB,yCAAmB,CAAA;AACvB,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Alpha Conversion (α-conversion)
3
+ *
4
+ * Renames bound variables in Lambda terms while preserving meaning.
5
+ *
6
+ * Rule: λx.M ≡α λy.M[x:=y] (where y is fresh)
7
+ *
8
+ * Alpha conversion is the basis of variable renaming and is essential
9
+ * for avoiding variable capture during beta reduction.
10
+ *
11
+ * @module mcard-js/ptr/lambda/AlphaConversion
12
+ */
13
+ import { CardCollection } from '../../model/CardCollection';
14
+ import { IO } from '../../monads/IO';
15
+ import { Either } from '../../monads/Either';
16
+ /**
17
+ * Alpha-rename: Rename the bound variable of an abstraction
18
+ *
19
+ * λx.M → λy.M[x:=y]
20
+ *
21
+ * @param collection - Card collection for term storage
22
+ * @param absHash - Hash of the abstraction term
23
+ * @param newParam - New name for the bound variable
24
+ * @returns IO<Either<error, newHash>>
25
+ */
26
+ export declare function alphaRename(collection: CardCollection, absHash: string, newParam: string): IO<Either<string, string>>;
27
+ /**
28
+ * Check if two terms are alpha-equivalent
29
+ *
30
+ * Two terms are α-equivalent if they differ only in the names of bound variables.
31
+ *
32
+ * Note: If hashes are equal, terms are definitionally identical (stronger than α-equiv).
33
+ */
34
+ export declare function alphaEquivalent(collection: CardCollection, hash1: string, hash2: string): IO<Either<string, boolean>>;
35
+ /**
36
+ * Alpha-normalize a term using canonical variable names
37
+ *
38
+ * All bound variables are renamed to a₀, a₁, a₂... based on binding depth.
39
+ * This produces a canonical representative of the α-equivalence class.
40
+ */
41
+ export declare function alphaNormalize(collection: CardCollection, termHash: string): IO<Either<string, string>>;
42
+ //# sourceMappingURL=AlphaConversion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AlphaConversion.d.ts","sourceRoot":"","sources":["../../../src/ptr/lambda/AlphaConversion.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAa5D,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAM7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACvB,UAAU,EAAE,cAAc,EAC1B,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACjB,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAwC5B;AA+DD;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC3B,UAAU,EAAE,cAAc,EAC1B,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACd,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAgB7B;AA6ED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC1B,UAAU,EAAE,cAAc,EAC1B,QAAQ,EAAE,MAAM,GACjB,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAQ5B"}