@hashgraphonline/standards-sdk 0.1.185 → 0.1.187

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 (431) hide show
  1. package/README.md +3 -0
  2. package/dist/browser/hcs-25/adapters/acp.d.ts +20 -0
  3. package/dist/browser/hcs-25/adapters/acp.d.ts.map +1 -0
  4. package/dist/browser/hcs-25/adapters/agentverse.d.ts +34 -0
  5. package/dist/browser/hcs-25/adapters/agentverse.d.ts.map +1 -0
  6. package/dist/browser/hcs-25/adapters/availability.d.ts +22 -0
  7. package/dist/browser/hcs-25/adapters/availability.d.ts.map +1 -0
  8. package/dist/browser/hcs-25/adapters/connectivity.d.ts +25 -0
  9. package/dist/browser/hcs-25/adapters/connectivity.d.ts.map +1 -0
  10. package/dist/browser/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
  11. package/dist/browser/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
  12. package/dist/browser/hcs-25/adapters/ethos.d.ts +21 -0
  13. package/dist/browser/hcs-25/adapters/ethos.d.ts.map +1 -0
  14. package/dist/browser/hcs-25/adapters/index.d.ts +21 -0
  15. package/dist/browser/hcs-25/adapters/index.d.ts.map +1 -0
  16. package/dist/browser/hcs-25/adapters/model-evals.d.ts +61 -0
  17. package/dist/browser/hcs-25/adapters/model-evals.d.ts.map +1 -0
  18. package/dist/browser/hcs-25/adapters/normalization.d.ts +20 -0
  19. package/dist/browser/hcs-25/adapters/normalization.d.ts.map +1 -0
  20. package/dist/browser/hcs-25/adapters/oss-popularity.d.ts +22 -0
  21. package/dist/browser/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
  22. package/dist/browser/hcs-25/adapters/output-verification.d.ts +27 -0
  23. package/dist/browser/hcs-25/adapters/output-verification.d.ts.map +1 -0
  24. package/dist/browser/hcs-25/adapters/simple-evals.d.ts +14 -0
  25. package/dist/browser/hcs-25/adapters/simple-evals.d.ts.map +1 -0
  26. package/dist/browser/hcs-25/adapters/x402.d.ts +18 -0
  27. package/dist/browser/hcs-25/adapters/x402.d.ts.map +1 -0
  28. package/dist/browser/hcs-25/identifiers.d.ts +2 -2
  29. package/dist/browser/hcs-25/identifiers.d.ts.map +1 -1
  30. package/dist/browser/hcs-25/index.d.ts +2 -0
  31. package/dist/browser/hcs-25/index.d.ts.map +1 -1
  32. package/dist/browser/hcs-25/scoring.d.ts.map +1 -1
  33. package/dist/browser/hcs-25/signals/index.d.ts +20 -0
  34. package/dist/browser/hcs-25/signals/index.d.ts.map +1 -0
  35. package/dist/browser/hcs-25/signals/marketplace.d.ts +296 -0
  36. package/dist/browser/hcs-25/signals/marketplace.d.ts.map +1 -0
  37. package/dist/browser/hcs-25/signals/metadata.d.ts +40 -0
  38. package/dist/browser/hcs-25/signals/metadata.d.ts.map +1 -0
  39. package/dist/browser/hcs-25/signals/model-evals.d.ts +127 -0
  40. package/dist/browser/hcs-25/signals/model-evals.d.ts.map +1 -0
  41. package/dist/browser/hcs-25/signals/operational.d.ts +757 -0
  42. package/dist/browser/hcs-25/signals/operational.d.ts.map +1 -0
  43. package/dist/browser/hcs-25/signals/simple-evals.d.ts +156 -0
  44. package/dist/browser/hcs-25/signals/simple-evals.d.ts.map +1 -0
  45. package/dist/browser-root/hcs-25/adapters/acp.d.ts +20 -0
  46. package/dist/browser-root/hcs-25/adapters/acp.d.ts.map +1 -0
  47. package/dist/browser-root/hcs-25/adapters/agentverse.d.ts +34 -0
  48. package/dist/browser-root/hcs-25/adapters/agentverse.d.ts.map +1 -0
  49. package/dist/browser-root/hcs-25/adapters/availability.d.ts +22 -0
  50. package/dist/browser-root/hcs-25/adapters/availability.d.ts.map +1 -0
  51. package/dist/browser-root/hcs-25/adapters/connectivity.d.ts +25 -0
  52. package/dist/browser-root/hcs-25/adapters/connectivity.d.ts.map +1 -0
  53. package/dist/browser-root/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
  54. package/dist/browser-root/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
  55. package/dist/browser-root/hcs-25/adapters/ethos.d.ts +21 -0
  56. package/dist/browser-root/hcs-25/adapters/ethos.d.ts.map +1 -0
  57. package/dist/browser-root/hcs-25/adapters/index.d.ts +21 -0
  58. package/dist/browser-root/hcs-25/adapters/index.d.ts.map +1 -0
  59. package/dist/browser-root/hcs-25/adapters/model-evals.d.ts +61 -0
  60. package/dist/browser-root/hcs-25/adapters/model-evals.d.ts.map +1 -0
  61. package/dist/browser-root/hcs-25/adapters/normalization.d.ts +20 -0
  62. package/dist/browser-root/hcs-25/adapters/normalization.d.ts.map +1 -0
  63. package/dist/browser-root/hcs-25/adapters/oss-popularity.d.ts +22 -0
  64. package/dist/browser-root/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
  65. package/dist/browser-root/hcs-25/adapters/output-verification.d.ts +27 -0
  66. package/dist/browser-root/hcs-25/adapters/output-verification.d.ts.map +1 -0
  67. package/dist/browser-root/hcs-25/adapters/simple-evals.d.ts +14 -0
  68. package/dist/browser-root/hcs-25/adapters/simple-evals.d.ts.map +1 -0
  69. package/dist/browser-root/hcs-25/adapters/x402.d.ts +18 -0
  70. package/dist/browser-root/hcs-25/adapters/x402.d.ts.map +1 -0
  71. package/dist/browser-root/hcs-25/identifiers.d.ts +2 -2
  72. package/dist/browser-root/hcs-25/identifiers.d.ts.map +1 -1
  73. package/dist/browser-root/hcs-25/index.d.ts +2 -0
  74. package/dist/browser-root/hcs-25/index.d.ts.map +1 -1
  75. package/dist/browser-root/hcs-25/scoring.d.ts.map +1 -1
  76. package/dist/browser-root/hcs-25/signals/index.d.ts +20 -0
  77. package/dist/browser-root/hcs-25/signals/index.d.ts.map +1 -0
  78. package/dist/browser-root/hcs-25/signals/marketplace.d.ts +296 -0
  79. package/dist/browser-root/hcs-25/signals/marketplace.d.ts.map +1 -0
  80. package/dist/browser-root/hcs-25/signals/metadata.d.ts +40 -0
  81. package/dist/browser-root/hcs-25/signals/metadata.d.ts.map +1 -0
  82. package/dist/browser-root/hcs-25/signals/model-evals.d.ts +127 -0
  83. package/dist/browser-root/hcs-25/signals/model-evals.d.ts.map +1 -0
  84. package/dist/browser-root/hcs-25/signals/operational.d.ts +757 -0
  85. package/dist/browser-root/hcs-25/signals/operational.d.ts.map +1 -0
  86. package/dist/browser-root/hcs-25/signals/simple-evals.d.ts +156 -0
  87. package/dist/browser-root/hcs-25/signals/simple-evals.d.ts.map +1 -0
  88. package/dist/cjs/hcs-25/adapters/acp.d.ts +20 -0
  89. package/dist/cjs/hcs-25/adapters/acp.d.ts.map +1 -0
  90. package/dist/cjs/hcs-25/adapters/agentverse.d.ts +34 -0
  91. package/dist/cjs/hcs-25/adapters/agentverse.d.ts.map +1 -0
  92. package/dist/cjs/hcs-25/adapters/availability.d.ts +22 -0
  93. package/dist/cjs/hcs-25/adapters/availability.d.ts.map +1 -0
  94. package/dist/cjs/hcs-25/adapters/connectivity.d.ts +25 -0
  95. package/dist/cjs/hcs-25/adapters/connectivity.d.ts.map +1 -0
  96. package/dist/cjs/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
  97. package/dist/cjs/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
  98. package/dist/cjs/hcs-25/adapters/ethos.d.ts +21 -0
  99. package/dist/cjs/hcs-25/adapters/ethos.d.ts.map +1 -0
  100. package/dist/cjs/hcs-25/adapters/index.d.ts +21 -0
  101. package/dist/cjs/hcs-25/adapters/index.d.ts.map +1 -0
  102. package/dist/cjs/hcs-25/adapters/model-evals.d.ts +61 -0
  103. package/dist/cjs/hcs-25/adapters/model-evals.d.ts.map +1 -0
  104. package/dist/cjs/hcs-25/adapters/normalization.d.ts +20 -0
  105. package/dist/cjs/hcs-25/adapters/normalization.d.ts.map +1 -0
  106. package/dist/cjs/hcs-25/adapters/oss-popularity.d.ts +22 -0
  107. package/dist/cjs/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
  108. package/dist/cjs/hcs-25/adapters/output-verification.d.ts +27 -0
  109. package/dist/cjs/hcs-25/adapters/output-verification.d.ts.map +1 -0
  110. package/dist/cjs/hcs-25/adapters/simple-evals.d.ts +14 -0
  111. package/dist/cjs/hcs-25/adapters/simple-evals.d.ts.map +1 -0
  112. package/dist/cjs/hcs-25/adapters/x402.d.ts +18 -0
  113. package/dist/cjs/hcs-25/adapters/x402.d.ts.map +1 -0
  114. package/dist/cjs/hcs-25/identifiers.d.ts +2 -2
  115. package/dist/cjs/hcs-25/identifiers.d.ts.map +1 -1
  116. package/dist/cjs/hcs-25/index.d.ts +2 -0
  117. package/dist/cjs/hcs-25/index.d.ts.map +1 -1
  118. package/dist/cjs/hcs-25/scoring.d.ts.map +1 -1
  119. package/dist/cjs/hcs-25/signals/index.d.ts +20 -0
  120. package/dist/cjs/hcs-25/signals/index.d.ts.map +1 -0
  121. package/dist/cjs/hcs-25/signals/marketplace.d.ts +296 -0
  122. package/dist/cjs/hcs-25/signals/marketplace.d.ts.map +1 -0
  123. package/dist/cjs/hcs-25/signals/metadata.d.ts +40 -0
  124. package/dist/cjs/hcs-25/signals/metadata.d.ts.map +1 -0
  125. package/dist/cjs/hcs-25/signals/model-evals.d.ts +127 -0
  126. package/dist/cjs/hcs-25/signals/model-evals.d.ts.map +1 -0
  127. package/dist/cjs/hcs-25/signals/operational.d.ts +757 -0
  128. package/dist/cjs/hcs-25/signals/operational.d.ts.map +1 -0
  129. package/dist/cjs/hcs-25/signals/simple-evals.d.ts +156 -0
  130. package/dist/cjs/hcs-25/signals/simple-evals.d.ts.map +1 -0
  131. package/dist/cjs/standards-sdk.cjs +2 -2
  132. package/dist/cjs/standards-sdk.cjs.map +1 -1
  133. package/dist/es/hcs-25/adapters/acp.d.ts +20 -0
  134. package/dist/es/hcs-25/adapters/acp.d.ts.map +1 -0
  135. package/dist/es/hcs-25/adapters/agentverse.d.ts +34 -0
  136. package/dist/es/hcs-25/adapters/agentverse.d.ts.map +1 -0
  137. package/dist/es/hcs-25/adapters/availability.d.ts +22 -0
  138. package/dist/es/hcs-25/adapters/availability.d.ts.map +1 -0
  139. package/dist/es/hcs-25/adapters/connectivity.d.ts +25 -0
  140. package/dist/es/hcs-25/adapters/connectivity.d.ts.map +1 -0
  141. package/dist/es/hcs-25/adapters/erc8004-feedback.d.ts +19 -0
  142. package/dist/es/hcs-25/adapters/erc8004-feedback.d.ts.map +1 -0
  143. package/dist/es/hcs-25/adapters/ethos.d.ts +21 -0
  144. package/dist/es/hcs-25/adapters/ethos.d.ts.map +1 -0
  145. package/dist/es/hcs-25/adapters/index.d.ts +21 -0
  146. package/dist/es/hcs-25/adapters/index.d.ts.map +1 -0
  147. package/dist/es/hcs-25/adapters/model-evals.d.ts +61 -0
  148. package/dist/es/hcs-25/adapters/model-evals.d.ts.map +1 -0
  149. package/dist/es/hcs-25/adapters/normalization.d.ts +20 -0
  150. package/dist/es/hcs-25/adapters/normalization.d.ts.map +1 -0
  151. package/dist/es/hcs-25/adapters/oss-popularity.d.ts +22 -0
  152. package/dist/es/hcs-25/adapters/oss-popularity.d.ts.map +1 -0
  153. package/dist/es/hcs-25/adapters/output-verification.d.ts +27 -0
  154. package/dist/es/hcs-25/adapters/output-verification.d.ts.map +1 -0
  155. package/dist/es/hcs-25/adapters/simple-evals.d.ts +14 -0
  156. package/dist/es/hcs-25/adapters/simple-evals.d.ts.map +1 -0
  157. package/dist/es/hcs-25/adapters/x402.d.ts +18 -0
  158. package/dist/es/hcs-25/adapters/x402.d.ts.map +1 -0
  159. package/dist/es/hcs-25/identifiers.d.ts +2 -2
  160. package/dist/es/hcs-25/identifiers.d.ts.map +1 -1
  161. package/dist/es/hcs-25/index.d.ts +2 -0
  162. package/dist/es/hcs-25/index.d.ts.map +1 -1
  163. package/dist/es/hcs-25/scoring.d.ts.map +1 -1
  164. package/dist/es/hcs-25/signals/index.d.ts +20 -0
  165. package/dist/es/hcs-25/signals/index.d.ts.map +1 -0
  166. package/dist/es/hcs-25/signals/marketplace.d.ts +296 -0
  167. package/dist/es/hcs-25/signals/marketplace.d.ts.map +1 -0
  168. package/dist/es/hcs-25/signals/metadata.d.ts +40 -0
  169. package/dist/es/hcs-25/signals/metadata.d.ts.map +1 -0
  170. package/dist/es/hcs-25/signals/model-evals.d.ts +127 -0
  171. package/dist/es/hcs-25/signals/model-evals.d.ts.map +1 -0
  172. package/dist/es/hcs-25/signals/operational.d.ts +757 -0
  173. package/dist/es/hcs-25/signals/operational.d.ts.map +1 -0
  174. package/dist/es/hcs-25/signals/simple-evals.d.ts +156 -0
  175. package/dist/es/hcs-25/signals/simple-evals.d.ts.map +1 -0
  176. package/dist/es/standards-sdk.es.js +109 -40
  177. package/dist/es/standards-sdk.es.js.map +1 -1
  178. package/dist/es/standards-sdk.es101.js +2 -2
  179. package/dist/es/standards-sdk.es103.js +2 -2
  180. package/dist/es/standards-sdk.es104.js +1 -1
  181. package/dist/es/standards-sdk.es106.js +1 -1
  182. package/dist/es/standards-sdk.es108.js +2 -2
  183. package/dist/es/standards-sdk.es11.js +1 -1
  184. package/dist/es/standards-sdk.es110.js +1 -1
  185. package/dist/es/standards-sdk.es111.js +2 -2
  186. package/dist/es/standards-sdk.es115.js +3 -3
  187. package/dist/es/standards-sdk.es116.js +4 -4
  188. package/dist/es/standards-sdk.es117.js +1 -1
  189. package/dist/es/standards-sdk.es117.js.map +1 -1
  190. package/dist/es/standards-sdk.es119.js +10 -9
  191. package/dist/es/standards-sdk.es119.js.map +1 -1
  192. package/dist/es/standards-sdk.es12.js +1 -1
  193. package/dist/es/standards-sdk.es120.js +225 -251
  194. package/dist/es/standards-sdk.es120.js.map +1 -1
  195. package/dist/es/standards-sdk.es121.js +50 -477
  196. package/dist/es/standards-sdk.es121.js.map +1 -1
  197. package/dist/es/standards-sdk.es122.js +244 -97
  198. package/dist/es/standards-sdk.es122.js.map +1 -1
  199. package/dist/es/standards-sdk.es123.js +451 -133
  200. package/dist/es/standards-sdk.es123.js.map +1 -1
  201. package/dist/es/standards-sdk.es124.js +98 -27
  202. package/dist/es/standards-sdk.es124.js.map +1 -1
  203. package/dist/es/standards-sdk.es125.js +156 -8
  204. package/dist/es/standards-sdk.es125.js.map +1 -1
  205. package/dist/es/standards-sdk.es126.js +29 -177
  206. package/dist/es/standards-sdk.es126.js.map +1 -1
  207. package/dist/es/standards-sdk.es127.js +10 -27
  208. package/dist/es/standards-sdk.es127.js.map +1 -1
  209. package/dist/es/standards-sdk.es128.js +179 -19
  210. package/dist/es/standards-sdk.es128.js.map +1 -1
  211. package/dist/es/standards-sdk.es129.js +27 -158
  212. package/dist/es/standards-sdk.es129.js.map +1 -1
  213. package/dist/es/standards-sdk.es13.js +1 -1
  214. package/dist/es/standards-sdk.es130.js +16 -195
  215. package/dist/es/standards-sdk.es130.js.map +1 -1
  216. package/dist/es/standards-sdk.es131.js +133 -763
  217. package/dist/es/standards-sdk.es131.js.map +1 -1
  218. package/dist/es/standards-sdk.es132.js +198 -10
  219. package/dist/es/standards-sdk.es132.js.map +1 -1
  220. package/dist/es/standards-sdk.es133.js +762 -539
  221. package/dist/es/standards-sdk.es133.js.map +1 -1
  222. package/dist/es/standards-sdk.es134.js +10 -623
  223. package/dist/es/standards-sdk.es134.js.map +1 -1
  224. package/dist/es/standards-sdk.es135.js +567 -13
  225. package/dist/es/standards-sdk.es135.js.map +1 -1
  226. package/dist/es/standards-sdk.es136.js +626 -2
  227. package/dist/es/standards-sdk.es136.js.map +1 -1
  228. package/dist/es/standards-sdk.es137.js +12 -86
  229. package/dist/es/standards-sdk.es137.js.map +1 -1
  230. package/dist/es/standards-sdk.es138.js +2 -40
  231. package/dist/es/standards-sdk.es138.js.map +1 -1
  232. package/dist/es/standards-sdk.es139.js +87 -2
  233. package/dist/es/standards-sdk.es139.js.map +1 -1
  234. package/dist/es/standards-sdk.es14.js +1 -1
  235. package/dist/es/standards-sdk.es140.js +37 -232
  236. package/dist/es/standards-sdk.es140.js.map +1 -1
  237. package/dist/es/standards-sdk.es141.js +2 -1140
  238. package/dist/es/standards-sdk.es141.js.map +1 -1
  239. package/dist/es/standards-sdk.es142.js +213 -284
  240. package/dist/es/standards-sdk.es142.js.map +1 -1
  241. package/dist/es/standards-sdk.es143.js +1138 -420
  242. package/dist/es/standards-sdk.es143.js.map +1 -1
  243. package/dist/es/standards-sdk.es144.js +301 -350
  244. package/dist/es/standards-sdk.es144.js.map +1 -1
  245. package/dist/es/standards-sdk.es145.js +417 -1117
  246. package/dist/es/standards-sdk.es145.js.map +1 -1
  247. package/dist/es/standards-sdk.es146.js +348 -201
  248. package/dist/es/standards-sdk.es146.js.map +1 -1
  249. package/dist/es/standards-sdk.es147.js +1035 -1480
  250. package/dist/es/standards-sdk.es147.js.map +1 -1
  251. package/dist/es/standards-sdk.es148.js +181 -1130
  252. package/dist/es/standards-sdk.es148.js.map +1 -1
  253. package/dist/es/standards-sdk.es149.js +1564 -14
  254. package/dist/es/standards-sdk.es149.js.map +1 -1
  255. package/dist/es/standards-sdk.es15.js +1 -1
  256. package/dist/es/standards-sdk.es150.js +1122 -224
  257. package/dist/es/standards-sdk.es150.js.map +1 -1
  258. package/dist/es/standards-sdk.es151.js +17 -4
  259. package/dist/es/standards-sdk.es151.js.map +1 -1
  260. package/dist/es/standards-sdk.es152.js +252 -74
  261. package/dist/es/standards-sdk.es152.js.map +1 -1
  262. package/dist/es/standards-sdk.es153.js +4 -87
  263. package/dist/es/standards-sdk.es153.js.map +1 -1
  264. package/dist/es/standards-sdk.es154.js +73 -52
  265. package/dist/es/standards-sdk.es154.js.map +1 -1
  266. package/dist/es/standards-sdk.es155.js +86 -2546
  267. package/dist/es/standards-sdk.es155.js.map +1 -1
  268. package/dist/es/standards-sdk.es156.js +53 -152
  269. package/dist/es/standards-sdk.es156.js.map +1 -1
  270. package/dist/es/standards-sdk.es157.js +2547 -7
  271. package/dist/es/standards-sdk.es157.js.map +1 -1
  272. package/dist/es/standards-sdk.es158.js +138 -65
  273. package/dist/es/standards-sdk.es158.js.map +1 -1
  274. package/dist/es/standards-sdk.es159.js +7 -65
  275. package/dist/es/standards-sdk.es159.js.map +1 -1
  276. package/dist/es/standards-sdk.es16.js +4 -4
  277. package/dist/es/standards-sdk.es160.js +86 -30
  278. package/dist/es/standards-sdk.es160.js.map +1 -1
  279. package/dist/es/standards-sdk.es161.js +65 -34
  280. package/dist/es/standards-sdk.es161.js.map +1 -1
  281. package/dist/es/standards-sdk.es162.js +194 -48
  282. package/dist/es/standards-sdk.es162.js.map +1 -1
  283. package/dist/es/standards-sdk.es163.js +17 -12473
  284. package/dist/es/standards-sdk.es163.js.map +1 -1
  285. package/dist/es/standards-sdk.es164.js +53 -133
  286. package/dist/es/standards-sdk.es164.js.map +1 -1
  287. package/dist/es/standards-sdk.es165.js +91 -38
  288. package/dist/es/standards-sdk.es165.js.map +1 -1
  289. package/dist/es/standards-sdk.es166.js +47 -15
  290. package/dist/es/standards-sdk.es166.js.map +1 -1
  291. package/dist/es/standards-sdk.es167.js +201 -53
  292. package/dist/es/standards-sdk.es167.js.map +1 -1
  293. package/dist/es/standards-sdk.es168.js +53 -108
  294. package/dist/es/standards-sdk.es168.js.map +1 -1
  295. package/dist/es/standards-sdk.es169.js +47 -79
  296. package/dist/es/standards-sdk.es169.js.map +1 -1
  297. package/dist/es/standards-sdk.es170.js +48 -192
  298. package/dist/es/standards-sdk.es170.js.map +1 -1
  299. package/dist/es/standards-sdk.es171.js +47 -670
  300. package/dist/es/standards-sdk.es171.js.map +1 -1
  301. package/dist/es/standards-sdk.es172.js +110 -61
  302. package/dist/es/standards-sdk.es172.js.map +1 -1
  303. package/dist/es/standards-sdk.es173.js +51 -169
  304. package/dist/es/standards-sdk.es173.js.map +1 -1
  305. package/dist/es/standards-sdk.es174.js +39 -317
  306. package/dist/es/standards-sdk.es174.js.map +1 -1
  307. package/dist/es/standards-sdk.es175.js +72 -346
  308. package/dist/es/standards-sdk.es175.js.map +1 -1
  309. package/dist/es/standards-sdk.es176.js +68 -453
  310. package/dist/es/standards-sdk.es176.js.map +1 -1
  311. package/dist/es/standards-sdk.es177.js +44 -331
  312. package/dist/es/standards-sdk.es177.js.map +1 -1
  313. package/dist/es/standards-sdk.es178.js +31 -71
  314. package/dist/es/standards-sdk.es178.js.map +1 -1
  315. package/dist/es/standards-sdk.es179.js +30 -139
  316. package/dist/es/standards-sdk.es179.js.map +1 -1
  317. package/dist/es/standards-sdk.es18.js +11 -11
  318. package/dist/es/standards-sdk.es180.js +34 -517
  319. package/dist/es/standards-sdk.es180.js.map +1 -1
  320. package/dist/es/standards-sdk.es181.js +48 -259
  321. package/dist/es/standards-sdk.es181.js.map +1 -1
  322. package/dist/es/standards-sdk.es182.js +127 -185
  323. package/dist/es/standards-sdk.es182.js.map +1 -1
  324. package/dist/es/standards-sdk.es183.js +36 -113
  325. package/dist/es/standards-sdk.es183.js.map +1 -1
  326. package/dist/es/standards-sdk.es184.js +12464 -134
  327. package/dist/es/standards-sdk.es184.js.map +1 -1
  328. package/dist/es/standards-sdk.es185.js +629 -141
  329. package/dist/es/standards-sdk.es185.js.map +1 -1
  330. package/dist/es/standards-sdk.es186.js +83 -656
  331. package/dist/es/standards-sdk.es186.js.map +1 -1
  332. package/dist/es/standards-sdk.es187.js +61 -173
  333. package/dist/es/standards-sdk.es187.js.map +1 -1
  334. package/dist/es/standards-sdk.es188.js +49 -228
  335. package/dist/es/standards-sdk.es188.js.map +1 -1
  336. package/dist/es/standards-sdk.es189.js +68 -226
  337. package/dist/es/standards-sdk.es189.js.map +1 -1
  338. package/dist/es/standards-sdk.es19.js +8 -8
  339. package/dist/es/standards-sdk.es190.js +203 -0
  340. package/dist/es/standards-sdk.es190.js.map +1 -0
  341. package/dist/es/standards-sdk.es191.js +175 -0
  342. package/dist/es/standards-sdk.es191.js.map +1 -0
  343. package/dist/es/standards-sdk.es192.js +325 -0
  344. package/dist/es/standards-sdk.es192.js.map +1 -0
  345. package/dist/es/standards-sdk.es193.js +349 -0
  346. package/dist/es/standards-sdk.es193.js.map +1 -0
  347. package/dist/es/standards-sdk.es194.js +456 -0
  348. package/dist/es/standards-sdk.es194.js.map +1 -0
  349. package/dist/es/standards-sdk.es195.js +334 -0
  350. package/dist/es/standards-sdk.es195.js.map +1 -0
  351. package/dist/es/standards-sdk.es196.js +79 -0
  352. package/dist/es/standards-sdk.es196.js.map +1 -0
  353. package/dist/es/standards-sdk.es197.js +20 -0
  354. package/dist/es/standards-sdk.es197.js.map +1 -0
  355. package/dist/es/standards-sdk.es198.js +142 -0
  356. package/dist/es/standards-sdk.es198.js.map +1 -0
  357. package/dist/es/standards-sdk.es199.js +520 -0
  358. package/dist/es/standards-sdk.es199.js.map +1 -0
  359. package/dist/es/standards-sdk.es2.js +2 -2
  360. package/dist/es/standards-sdk.es20.js +1 -1
  361. package/dist/es/standards-sdk.es200.js +262 -0
  362. package/dist/es/standards-sdk.es200.js.map +1 -0
  363. package/dist/es/standards-sdk.es201.js +199 -0
  364. package/dist/es/standards-sdk.es201.js.map +1 -0
  365. package/dist/es/standards-sdk.es202.js +122 -0
  366. package/dist/es/standards-sdk.es202.js.map +1 -0
  367. package/dist/es/standards-sdk.es203.js +155 -0
  368. package/dist/es/standards-sdk.es203.js.map +1 -0
  369. package/dist/es/standards-sdk.es204.js +187 -0
  370. package/dist/es/standards-sdk.es204.js.map +1 -0
  371. package/dist/es/standards-sdk.es205.js +687 -0
  372. package/dist/es/standards-sdk.es205.js.map +1 -0
  373. package/dist/es/standards-sdk.es206.js +188 -0
  374. package/dist/es/standards-sdk.es206.js.map +1 -0
  375. package/dist/es/standards-sdk.es207.js +238 -0
  376. package/dist/es/standards-sdk.es207.js.map +1 -0
  377. package/dist/es/standards-sdk.es208.js +242 -0
  378. package/dist/es/standards-sdk.es208.js.map +1 -0
  379. package/dist/es/standards-sdk.es21.js +1 -1
  380. package/dist/es/standards-sdk.es22.js +1 -1
  381. package/dist/es/standards-sdk.es23.js +1 -1
  382. package/dist/es/standards-sdk.es24.js +1 -1
  383. package/dist/es/standards-sdk.es25.js +1 -1
  384. package/dist/es/standards-sdk.es26.js +1 -1
  385. package/dist/es/standards-sdk.es27.js +11 -11
  386. package/dist/es/standards-sdk.es30.js +2 -2
  387. package/dist/es/standards-sdk.es31.js +4 -4
  388. package/dist/es/standards-sdk.es32.js +1 -1
  389. package/dist/es/standards-sdk.es35.js +5 -5
  390. package/dist/es/standards-sdk.es36.js +4 -4
  391. package/dist/es/standards-sdk.es37.js +2 -2
  392. package/dist/es/standards-sdk.es38.js +2 -2
  393. package/dist/es/standards-sdk.es39.js +1 -1
  394. package/dist/es/standards-sdk.es4.js +2 -2
  395. package/dist/es/standards-sdk.es40.js +1 -1
  396. package/dist/es/standards-sdk.es41.js +2 -2
  397. package/dist/es/standards-sdk.es46.js +1 -1
  398. package/dist/es/standards-sdk.es5.js +2 -2
  399. package/dist/es/standards-sdk.es51.js +1 -1
  400. package/dist/es/standards-sdk.es53.js +1 -1
  401. package/dist/es/standards-sdk.es56.js +2 -2
  402. package/dist/es/standards-sdk.es59.js +1 -1
  403. package/dist/es/standards-sdk.es6.js +2 -2
  404. package/dist/es/standards-sdk.es60.js +1 -1
  405. package/dist/es/standards-sdk.es62.js +1 -1
  406. package/dist/es/standards-sdk.es63.js +2 -2
  407. package/dist/es/standards-sdk.es64.js +1 -1
  408. package/dist/es/standards-sdk.es65.js +1 -1
  409. package/dist/es/standards-sdk.es66.js +1 -1
  410. package/dist/es/standards-sdk.es67.js +6 -6
  411. package/dist/es/standards-sdk.es69.js +1 -1
  412. package/dist/es/standards-sdk.es7.js +1 -1
  413. package/dist/es/standards-sdk.es71.js +2 -2
  414. package/dist/es/standards-sdk.es72.js +3 -3
  415. package/dist/es/standards-sdk.es75.js +5 -5
  416. package/dist/es/standards-sdk.es76.js +3 -3
  417. package/dist/es/standards-sdk.es77.js +2 -2
  418. package/dist/es/standards-sdk.es78.js +1 -1
  419. package/dist/es/standards-sdk.es81.js +2 -2
  420. package/dist/es/standards-sdk.es83.js +2 -2
  421. package/dist/es/standards-sdk.es84.js +3 -3
  422. package/dist/es/standards-sdk.es85.js +1 -1
  423. package/dist/es/standards-sdk.es88.js +1 -1
  424. package/dist/es/standards-sdk.es89.js +2 -2
  425. package/dist/es/standards-sdk.es9.js +2 -2
  426. package/dist/es/standards-sdk.es90.js +4 -4
  427. package/dist/es/standards-sdk.es94.js +3 -3
  428. package/dist/es/standards-sdk.es96.js +2 -2
  429. package/dist/es/standards-sdk.es98.js +1 -1
  430. package/dist/es/standards-sdk.es99.js +3 -3
  431. package/package.json +1 -1
@@ -1,1160 +1,211 @@
1
- import { Buffer } from "buffer";
2
- import { secp256k1 } from "@noble/curves/secp256k1.js";
3
- import { ZodError } from "zod";
4
- import { agentFeedbackResponseSchema, agentFeedbackIndexResponseSchema, agentFeedbackEntriesIndexResponseSchema, agentFeedbackEligibilityResponseSchema, agentFeedbackSubmissionResponseSchema, registerAgentResponseSchema } from "./standards-sdk.es155.js";
5
- import { fetchHistorySnapshot, attachDecryptedHistory, registerConversationContextForEncryption, resolveDecryptionContext, decryptHistoryEntryFromContext } from "./standards-sdk.es179.js";
6
- import { createChatApi, createSession, resumeSession, checkChatReadiness, startChat, startConversation, acceptConversation, compactHistory, fetchEncryptionStatus, postEncryptionHandshake, sendMessage, retryMessage, cancelSession, endSession, createPlaintextConversationHandle } from "./standards-sdk.es180.js";
7
- import { EncryptedChatManager } from "./standards-sdk.es181.js";
8
- import { generateEncryptionKeyPair, bootstrapEncryptionOptions, createEncryptionApi } from "./standards-sdk.es182.js";
9
- import { adapters, adaptersDetailed, adapterRegistryCategories, adapterRegistryAdapters, createAdapterRegistryCategory, submitAdapterRegistryAdapter, adapterRegistrySubmissionStatus } from "./standards-sdk.es183.js";
10
- import { resolveUaid, getRegistrationQuote, updateAgent, getRegistrationProgress, waitForRegistrationCompletion, validateUaid, getUaidConnectionStatus, closeUaidConnection, dashboardStats } from "./standards-sdk.es150.js";
11
- import { getRegisterStatus, registerOwnedMoltbookAgent, getVerificationStatus, createVerificationChallenge, getVerificationChallenge, verifyVerificationChallenge, getVerificationOwnership, verifySenderOwnership, verifyUaidDnsTxt, getVerificationDnsStatus } from "./standards-sdk.es184.js";
12
- import { getCreditsBalance, getCreditProviders, createHbarPurchaseIntent, purchaseCreditsWithHbar, getX402Minimums, purchaseCreditsWithX402, buyCreditsWithX402 } from "./standards-sdk.es185.js";
13
- import { getGuardSession, getGuardEntitlements, getGuardBillingBalance, getGuardFeed, getGuardOverview, getGuardTrustByHash, resolveGuardTrust, getGuardRevocations, fetchGuardAdvisories, fetchGuardPolicy, getGuardInventory, getGuardReceiptHistory, getGuardArtifactTimeline, getGuardInventoryDiff, exportGuardAbom, exportGuardArtifactAbom, exportGuardReceipts, getGuardDevices, getGuardAlertPreferences, updateGuardAlertPreferences, getGuardExceptions, getGuardWatchlist, lookupGuardWatchlist, getGuardPainSignals, getGuardAggregatedPainSignals, getGuardPreInstallVerdict, getGuardPreExecutionVerdict, addGuardWatchlistItem, removeGuardWatchlistItem, addGuardException, requestGuardException, removeGuardException, ingestGuardPainSignals, syncGuardReceipts, syncGuardInventory, submitGuardReceipts, getGuardTeamPolicyPack, updateGuardTeamPolicyPack } from "./standards-sdk.es186.js";
14
- import { createLedgerChallenge, verifyLedgerChallenge, authenticateWithLedger, authenticateWithLedgerCredentials } from "./standards-sdk.es187.js";
15
- import { search, delegate, stats, registries, getAdditionalRegistries, popularSearches, listProtocols, detectProtocol, registrySearchByNamespace, vectorSearch, searchStatus, websocketStats, metricsSummary, facets } from "./standards-sdk.es188.js";
16
- import { skillsConfig, listSkills, getSkillsCatalog, listSkillVersions, listMySkills, getMySkillsList, quoteSkillPublish, quoteSkillPublishPreview, publishSkill, getSkillPublishJob, getSkillOwnership, getRecommendedSkillVersion, setRecommendedSkillVersion, getSkillDeprecations, setSkillDeprecation, getSkillBadge, getSkillStatus, getSkillSecurityBreakdown, getSkillStatusByRepo, getSkillConversionSignalsByRepo, uploadSkillPreviewFromGithubOidc, getSkillPreview, getSkillPreviewByRepo, getSkillPreviewById, getSkillInstall, recordSkillInstallCopy, listSkillTags, listSkillCategories, resolveSkillMarkdown, resolveSkillManifest, getSkillVoteStatus, setSkillVote, requestSkillVerification, getSkillVerificationStatus, createSkillDomainProofChallenge, verifySkillDomainProof } from "./standards-sdk.es171.js";
17
- import { DEFAULT_BASE_URL, normaliseBaseUrl, normaliseHeaderName, isBrowserRuntime, DEFAULT_USER_AGENT, JSON_CONTENT_TYPE, serialiseAgentRegistrationRequest, MINIMUM_REGISTRATION_AUTO_TOP_UP_CREDITS, createAbortError, isJsonObject, DEFAULT_HISTORY_TOP_UP_HBAR } from "./standards-sdk.es189.js";
18
- import { RegistryBrokerError, RegistryBrokerParseError } from "./standards-sdk.es149.js";
19
- import { optionalImportSync } from "./standards-sdk.es168.js";
20
- class RegistryBrokerClient {
21
- constructor(options = {}) {
22
- this.encryptionBootstrapPromise = null;
23
- this.chatApi = null;
24
- this.encryptedChatManager = null;
25
- this.encryptionApi = null;
26
- this.conversationContexts = /* @__PURE__ */ new Map();
27
- const {
28
- baseUrl = DEFAULT_BASE_URL,
29
- fetchImplementation,
30
- defaultHeaders,
31
- apiKey,
32
- accountId,
33
- ledgerApiKey,
34
- registrationAutoTopUp,
35
- historyAutoTopUp,
36
- encryption
37
- } = options;
38
- this.baseUrl = normaliseBaseUrl(baseUrl);
39
- const resolvedFetch = fetchImplementation ?? (typeof globalThis.fetch === "function" ? globalThis.fetch : null);
40
- if (!resolvedFetch) {
41
- throw new Error(
42
- "A fetch implementation is required for RegistryBrokerClient"
43
- );
44
- }
45
- this.fetchImpl = resolvedFetch;
46
- this.defaultHeaders = {
47
- ...defaultHeaders ?? {}
1
+ import { InscriptionSDK } from "./standards-sdk.es184.js";
2
+ class QuoteCache {
3
+ constructor() {
4
+ this.cache = /* @__PURE__ */ new Map();
5
+ this.maxSize = 100;
6
+ this.defaultTtlMs = 5 * 60 * 1e3;
7
+ }
8
+ // 5 minutes
9
+ /**
10
+ * Generate cache key from input parameters
11
+ */
12
+ generateKey(key) {
13
+ return `${key.inputHash}-${key.clientConfigHash}-${key.optionsHash}`;
14
+ }
15
+ /**
16
+ * Hash object to string for cache key
17
+ */
18
+ hashObject(obj) {
19
+ return Buffer.from(JSON.stringify(obj)).toString("base64").slice(0, 16);
20
+ }
21
+ /**
22
+ * Create cache key from parameters
23
+ */
24
+ createCacheKey(input, clientConfig, options) {
25
+ return {
26
+ inputHash: this.hashObject(input),
27
+ clientConfigHash: this.hashObject({
28
+ accountId: clientConfig.accountId,
29
+ network: clientConfig.network
30
+ }),
31
+ optionsHash: this.hashObject({
32
+ mode: options.mode,
33
+ apiKey: options.apiKey ? "present" : "absent",
34
+ network: options.network,
35
+ metadata: options.metadata
36
+ })
48
37
  };
49
- Object.entries(this.defaultHeaders).forEach(([key, value]) => {
50
- const headerName = normaliseHeaderName(key);
51
- if (headerName !== key) {
52
- delete this.defaultHeaders[key];
53
- this.defaultHeaders[headerName] = value;
54
- }
55
- });
56
- const existingLedgerHeader = this.defaultHeaders["x-ledger-api-key"]?.trim();
57
- if (!this.defaultHeaders["x-api-key"] && existingLedgerHeader) {
58
- this.defaultHeaders["x-api-key"] = existingLedgerHeader;
59
- }
60
- if (apiKey) {
61
- this.defaultHeaders["x-api-key"] = apiKey;
62
- }
63
- if (typeof accountId === "string" && accountId.trim().length > 0) {
64
- this.defaultHeaders["x-account-id"] = accountId.trim();
65
- }
66
- if (ledgerApiKey) {
67
- if (!this.defaultHeaders["x-api-key"]) {
68
- this.defaultHeaders["x-api-key"] = ledgerApiKey;
69
- }
70
- }
71
- this.registrationAutoTopUp = registrationAutoTopUp;
72
- this.historyAutoTopUp = historyAutoTopUp;
73
- this.encryptionOptions = encryption;
74
- if (this.encryptionOptions) {
75
- this.encryptionBootstrapPromise = this.initializeEncryptionBootstrap(
76
- this.encryptionOptions
77
- );
78
- }
79
- }
80
- static async initializeAgent(options) {
81
- const { uaid, ensureEncryptionKey = true, ...clientOptions } = options;
82
- const client = new RegistryBrokerClient(clientOptions);
83
- let encryption = null;
84
- if (ensureEncryptionKey) {
85
- const ensureOptions = typeof ensureEncryptionKey === "object" ? ensureEncryptionKey : { generateIfMissing: true };
86
- encryption = await client.encryption.ensureAgentKey({
87
- uaid,
88
- ...ensureOptions
89
- });
90
- }
91
- return { client, encryption };
92
- }
93
- get chat() {
94
- if (this.chatApi) {
95
- return this.chatApi;
96
- }
97
- const api = createChatApi(this, this.getEncryptedChatManager());
98
- this.chatApi = api;
99
- return api;
100
- }
101
- get encryption() {
102
- if (this.encryptionApi) {
103
- return this.encryptionApi;
104
- }
105
- const api = createEncryptionApi(this);
106
- this.encryptionApi = api;
107
- return api;
108
38
  }
109
- setApiKey(apiKey) {
110
- this.setDefaultHeader("x-api-key", apiKey);
111
- }
112
- setLedgerApiKey(apiKey) {
113
- this.setDefaultHeader("x-api-key", apiKey);
114
- delete this.defaultHeaders["x-ledger-api-key"];
115
- }
116
- setDefaultHeader(name, value) {
117
- if (!name || name.trim().length === 0) {
118
- return;
119
- }
120
- const headerName = normaliseHeaderName(name);
121
- if (!value || value.trim().length === 0) {
122
- delete this.defaultHeaders[headerName];
123
- return;
124
- }
125
- this.defaultHeaders[headerName] = value.trim();
126
- }
127
- getDefaultHeaders() {
128
- return { ...this.defaultHeaders };
129
- }
130
- async encryptionReady() {
131
- if (!this.encryptionBootstrapPromise) {
132
- return;
133
- }
134
- await this.encryptionBootstrapPromise;
135
- }
136
- buildUrl(path) {
137
- const normalisedPath = path.startsWith("/") ? path : `/${path}`;
138
- return `${this.baseUrl}${normalisedPath}`;
139
- }
140
- buildRequestInit(config) {
141
- const headers = new Headers();
142
- Object.entries(this.defaultHeaders).forEach(([key, value]) => {
143
- headers.set(key, value);
144
- });
145
- if (config.headers) {
146
- Object.entries(config.headers).forEach(([key, value]) => {
147
- headers.set(key, value);
148
- });
149
- }
150
- if (!headers.has("accept")) {
151
- headers.set("accept", "application/json");
39
+ /**
40
+ * Get cached quote if available and not expired
41
+ */
42
+ get(key) {
43
+ const cacheKey = this.generateKey(key);
44
+ const entry = this.cache.get(cacheKey);
45
+ if (!entry) {
46
+ return null;
152
47
  }
153
- if (!headers.has("user-agent") && !isBrowserRuntime()) {
154
- headers.set("user-agent", DEFAULT_USER_AGENT);
48
+ const now = Date.now();
49
+ if (now - entry.timestamp > entry.ttlMs) {
50
+ this.cache.delete(cacheKey);
51
+ return null;
155
52
  }
156
- const init = {
157
- method: config.method ?? "GET",
158
- headers
159
- };
160
- if (config.body !== void 0) {
161
- init.body = JSON.stringify(config.body);
162
- if (!headers.has("content-type")) {
163
- headers.set("content-type", "application/json");
53
+ this.cache.delete(cacheKey);
54
+ this.cache.set(cacheKey, entry);
55
+ return entry.quote;
56
+ }
57
+ /**
58
+ * Store quote in cache
59
+ */
60
+ set(key, quote, ttlMs = this.defaultTtlMs) {
61
+ const cacheKey = this.generateKey(key);
62
+ if (this.cache.size >= this.maxSize) {
63
+ const firstKey = this.cache.keys().next().value;
64
+ if (firstKey) {
65
+ this.cache.delete(firstKey);
164
66
  }
165
67
  }
166
- return init;
167
- }
168
- async request(path, config) {
169
- const init = this.buildRequestInit(config);
170
- const response = await this.fetchImpl(this.buildUrl(path), init);
171
- if (response.ok) {
172
- return response;
173
- }
174
- const errorBody = await this.extractErrorBody(response);
175
- throw new RegistryBrokerError("Registry broker request failed", {
176
- status: response.status,
177
- statusText: response.statusText,
178
- body: errorBody
179
- });
180
- }
181
- async requestAbsolute(url, config) {
182
- const init = this.buildRequestInit(config);
183
- const response = await this.fetchImpl(url, init);
184
- if (response.ok) {
185
- return response;
186
- }
187
- const errorBody = await this.extractErrorBody(response);
188
- throw new RegistryBrokerError("Registry broker request failed", {
189
- status: response.status,
190
- statusText: response.statusText,
191
- body: errorBody
68
+ this.cache.set(cacheKey, {
69
+ quote,
70
+ timestamp: Date.now(),
71
+ ttlMs
192
72
  });
193
73
  }
194
- async requestJson(path, config) {
195
- const response = await this.request(path, config);
196
- const contentType = response.headers?.get("content-type") ?? "";
197
- if (!JSON_CONTENT_TYPE.test(contentType)) {
198
- const body = await response.text();
199
- throw new RegistryBrokerParseError(
200
- "Expected JSON response from registry broker",
201
- body
202
- );
203
- }
204
- return await response.json();
205
- }
206
- async requestAbsoluteJson(url, config) {
207
- const response = await this.requestAbsolute(url, config);
208
- const contentType = response.headers?.get("content-type") ?? "";
209
- if (!JSON_CONTENT_TYPE.test(contentType)) {
210
- const body = await response.text();
211
- throw new RegistryBrokerParseError(
212
- "Expected JSON response from registry broker",
213
- body
214
- );
215
- }
216
- return await response.json();
217
- }
218
- async getAgentFeedback(uaid, options = {}) {
219
- const normalized = uaid.trim();
220
- if (!normalized) {
221
- throw new Error("uaid is required");
222
- }
223
- const query = options.includeRevoked === true ? "?includeRevoked=true" : "";
224
- const raw = await this.requestJson(
225
- `/agents/${encodeURIComponent(normalized)}/feedback${query}`,
226
- { method: "GET" }
227
- );
228
- return this.parseWithSchema(
229
- raw,
230
- agentFeedbackResponseSchema,
231
- "agent feedback response"
232
- );
233
- }
234
- async listAgentFeedbackIndex(options = {}) {
235
- const params = new URLSearchParams();
236
- if (typeof options.page === "number" && Number.isFinite(options.page)) {
237
- params.set("page", String(Math.trunc(options.page)));
238
- }
239
- if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
240
- params.set("limit", String(Math.trunc(options.limit)));
241
- }
242
- if (options.registries?.length) {
243
- params.set("registry", options.registries.join(","));
244
- }
245
- const suffix = params.size > 0 ? `?${params.toString()}` : "";
246
- const raw = await this.requestJson(`/agents/feedback${suffix}`, {
247
- method: "GET"
248
- });
249
- return this.parseWithSchema(
250
- raw,
251
- agentFeedbackIndexResponseSchema,
252
- "agent feedback index response"
253
- );
254
- }
255
- async listAgentFeedbackEntriesIndex(options = {}) {
256
- const params = new URLSearchParams();
257
- if (typeof options.page === "number" && Number.isFinite(options.page)) {
258
- params.set("page", String(Math.trunc(options.page)));
259
- }
260
- if (typeof options.limit === "number" && Number.isFinite(options.limit)) {
261
- params.set("limit", String(Math.trunc(options.limit)));
262
- }
263
- if (options.registries?.length) {
264
- params.set("registry", options.registries.join(","));
265
- }
266
- const suffix = params.size > 0 ? `?${params.toString()}` : "";
267
- const raw = await this.requestJson(
268
- `/agents/feedback/entries${suffix}`,
269
- { method: "GET" }
270
- );
271
- return this.parseWithSchema(
272
- raw,
273
- agentFeedbackEntriesIndexResponseSchema,
274
- "agent feedback entries index response"
275
- );
74
+ /**
75
+ * Clear all cached entries
76
+ */
77
+ clear() {
78
+ this.cache.clear();
276
79
  }
277
- async checkAgentFeedbackEligibility(uaid, payload) {
278
- const normalized = uaid.trim();
279
- if (!normalized) {
280
- throw new Error("uaid is required");
80
+ }
81
+ class SDKCache {
82
+ constructor() {
83
+ this.cache = /* @__PURE__ */ new Map();
84
+ this.maxSize = 10;
85
+ this.defaultTtlMs = 30 * 60 * 1e3;
86
+ }
87
+ // 30 minutes
88
+ /**
89
+ * Generate config key for SDK instance
90
+ */
91
+ generateConfigKey(config) {
92
+ return Buffer.from(JSON.stringify(config)).toString("base64");
93
+ }
94
+ /**
95
+ * Get cached SDK instance
96
+ */
97
+ get(config) {
98
+ const configKey = this.generateConfigKey(config);
99
+ const entry = this.cache.get(configKey);
100
+ if (!entry) {
101
+ return null;
281
102
  }
282
- const raw = await this.requestJson(
283
- `/agents/${encodeURIComponent(normalized)}/feedback/eligibility`,
284
- {
285
- method: "POST",
286
- body: payload,
287
- headers: { "content-type": "application/json" }
288
- }
289
- );
290
- return this.parseWithSchema(
291
- raw,
292
- agentFeedbackEligibilityResponseSchema,
293
- "agent feedback eligibility response"
294
- );
295
- }
296
- async submitAgentFeedback(uaid, payload) {
297
- const normalized = uaid.trim();
298
- if (!normalized) {
299
- throw new Error("uaid is required");
103
+ const now = Date.now();
104
+ if (now - entry.timestamp > this.defaultTtlMs) {
105
+ this.cache.delete(configKey);
106
+ return null;
300
107
  }
301
- const raw = await this.requestJson(
302
- `/agents/${encodeURIComponent(normalized)}/feedback`,
303
- {
304
- method: "POST",
305
- body: payload,
306
- headers: { "content-type": "application/json" }
108
+ return entry.sdk;
109
+ }
110
+ /**
111
+ * Store SDK instance in cache
112
+ */
113
+ set(config, sdk) {
114
+ const configKey = this.generateConfigKey(config);
115
+ if (this.cache.size >= this.maxSize) {
116
+ const firstKey = this.cache.keys().next().value;
117
+ if (firstKey) {
118
+ this.cache.delete(firstKey);
307
119
  }
308
- );
309
- return this.parseWithSchema(
310
- raw,
311
- agentFeedbackSubmissionResponseSchema,
312
- "agent feedback submission response"
313
- );
314
- }
315
- async search(params = {}) {
316
- return search(this, params);
317
- }
318
- async delegate(request) {
319
- return delegate(this, request);
320
- }
321
- async searchErc8004ByAgentId(params) {
322
- const chainId = Math.floor(params.chainId);
323
- if (!Number.isFinite(chainId) || chainId <= 0) {
324
- throw new Error("chainId must be a positive integer");
325
- }
326
- const rawAgentId = typeof params.agentId === "bigint" ? params.agentId.toString() : String(params.agentId);
327
- const agentId = rawAgentId.trim();
328
- if (!agentId) {
329
- throw new Error("agentId is required");
330
120
  }
331
- const nativeId = `${chainId}:${agentId}`;
332
- return search(this, {
333
- registries: ["erc-8004"],
334
- limit: params.limit ?? 1,
335
- ...typeof params.page === "number" ? { page: params.page } : {},
336
- ...typeof params.sortBy === "string" ? { sortBy: params.sortBy } : {},
337
- ...typeof params.sortOrder === "string" ? { sortOrder: params.sortOrder } : {},
338
- metadata: {
339
- nativeId: [nativeId],
340
- networkKey: [`eip155:${chainId}`]
341
- }
121
+ this.cache.set(configKey, {
122
+ sdk,
123
+ timestamp: Date.now(),
124
+ config: configKey
342
125
  });
343
126
  }
344
- async stats() {
345
- return stats(this);
346
- }
347
- async registries() {
348
- return registries(this);
349
- }
350
- async getAdditionalRegistries() {
351
- return getAdditionalRegistries(this);
352
- }
353
- async popularSearches() {
354
- return popularSearches(this);
127
+ /**
128
+ * Clear all cached SDK instances
129
+ */
130
+ clear() {
131
+ this.cache.clear();
355
132
  }
356
- async listProtocols() {
357
- return listProtocols(this);
358
- }
359
- async detectProtocol(message) {
360
- return detectProtocol(this, message);
361
- }
362
- async registrySearchByNamespace(registry, query) {
363
- return registrySearchByNamespace(this, registry, query);
364
- }
365
- async vectorSearch(request) {
366
- return vectorSearch(this, request);
367
- }
368
- async searchStatus() {
369
- return searchStatus(this);
370
- }
371
- async websocketStats() {
372
- return websocketStats(this);
373
- }
374
- async metricsSummary() {
375
- return metricsSummary(this);
376
- }
377
- async facets(adapter) {
378
- return facets(this, adapter);
379
- }
380
- async adapters() {
381
- return adapters(this);
382
- }
383
- async skillsConfig() {
384
- return skillsConfig(this);
385
- }
386
- async listSkills(options) {
387
- return listSkills(this, options);
388
- }
389
- async getSkillsCatalog(options) {
390
- return getSkillsCatalog(this, options);
391
- }
392
- async listSkillVersions(params) {
393
- return listSkillVersions(this, params);
394
- }
395
- async listMySkills(params) {
396
- return listMySkills(this, params);
397
- }
398
- async getMySkillsList(params) {
399
- return getMySkillsList(this, params);
400
- }
401
- async quoteSkillPublish(payload) {
402
- return quoteSkillPublish(this, payload);
403
- }
404
- async quoteSkillPublishPreview(payload) {
405
- return quoteSkillPublishPreview(this, payload);
406
- }
407
- async publishSkill(payload) {
408
- return publishSkill(this, payload);
409
- }
410
- async getSkillPublishJob(jobId, params) {
411
- return getSkillPublishJob(this, jobId, params);
412
- }
413
- async getSkillOwnership(params) {
414
- return getSkillOwnership(this, params);
415
- }
416
- async getRecommendedSkillVersion(params) {
417
- return getRecommendedSkillVersion(this, params);
418
- }
419
- async setRecommendedSkillVersion(payload) {
420
- return setRecommendedSkillVersion(this, payload);
421
- }
422
- async getSkillDeprecations(params) {
423
- return getSkillDeprecations(this, params);
424
- }
425
- async setSkillDeprecation(payload) {
426
- return setSkillDeprecation(this, payload);
427
- }
428
- async getSkillBadge(params) {
429
- return getSkillBadge(this, params);
430
- }
431
- async getSkillStatus(params) {
432
- return getSkillStatus(this, params);
433
- }
434
- async getSkillSecurityBreakdown(params) {
435
- return getSkillSecurityBreakdown(this, params);
436
- }
437
- async getSkillStatusByRepo(params) {
438
- return getSkillStatusByRepo(this, params);
439
- }
440
- async getSkillConversionSignalsByRepo(params) {
441
- return getSkillConversionSignalsByRepo(this, params);
442
- }
443
- async uploadSkillPreviewFromGithubOidc(payload) {
444
- return uploadSkillPreviewFromGithubOidc(this, payload);
445
- }
446
- async getSkillPreview(params) {
447
- return getSkillPreview(this, params);
448
- }
449
- async getSkillPreviewByRepo(params) {
450
- return getSkillPreviewByRepo(this, params);
451
- }
452
- async getSkillPreviewById(previewId) {
453
- return getSkillPreviewById(this, previewId);
454
- }
455
- async getSkillInstall(skillRef) {
456
- return getSkillInstall(this, skillRef);
457
- }
458
- async recordSkillInstallCopy(skillRef, payload) {
459
- return recordSkillInstallCopy(this, skillRef, payload);
460
- }
461
- async listSkillTags() {
462
- return listSkillTags(this);
463
- }
464
- async listSkillCategories() {
465
- return listSkillCategories(this);
466
- }
467
- async resolveSkillMarkdown(skillRef) {
468
- return resolveSkillMarkdown(this, skillRef);
469
- }
470
- async resolveSkillManifest(skillRef) {
471
- return resolveSkillManifest(this, skillRef);
472
- }
473
- async getSkillVoteStatus(params) {
474
- return getSkillVoteStatus(this, params);
475
- }
476
- async setSkillVote(payload) {
477
- return setSkillVote(this, payload);
478
- }
479
- async requestSkillVerification(payload) {
480
- return requestSkillVerification(this, payload);
481
- }
482
- async getSkillVerificationStatus(params) {
483
- return getSkillVerificationStatus(this, params);
484
- }
485
- async createSkillDomainProofChallenge(payload) {
486
- return createSkillDomainProofChallenge(this, payload);
487
- }
488
- async verifySkillDomainProof(payload) {
489
- return verifySkillDomainProof(this, payload);
490
- }
491
- async adaptersDetailed() {
492
- return adaptersDetailed(this);
493
- }
494
- async adapterRegistryCategories() {
495
- return adapterRegistryCategories(this);
496
- }
497
- async adapterRegistryAdapters(filters) {
498
- return adapterRegistryAdapters(this, filters);
499
- }
500
- async createAdapterRegistryCategory(payload) {
501
- return createAdapterRegistryCategory(this, payload);
502
- }
503
- async submitAdapterRegistryAdapter(payload) {
504
- return submitAdapterRegistryAdapter(this, payload);
505
- }
506
- async adapterRegistrySubmissionStatus(submissionId) {
507
- return adapterRegistrySubmissionStatus(this, submissionId);
508
- }
509
- async resolveUaid(uaid) {
510
- return resolveUaid(this, uaid);
511
- }
512
- async performRegisterAgent(payload) {
513
- const raw = await this.requestJson("/register", {
514
- method: "POST",
515
- body: serialiseAgentRegistrationRequest(payload),
516
- headers: { "content-type": "application/json" }
133
+ }
134
+ const quoteCache = new QuoteCache();
135
+ const sdkCache = new SDKCache();
136
+ async function getOrCreateSDK(clientConfig, options, existingSDK) {
137
+ if (existingSDK) {
138
+ return existingSDK;
139
+ }
140
+ const connectionMode = options.connectionMode ?? "websocket";
141
+ const cacheConfig = {
142
+ apiKey: options.apiKey,
143
+ accountId: clientConfig.accountId,
144
+ network: clientConfig.network || "mainnet",
145
+ authType: options.apiKey ? "api" : "server",
146
+ connectionMode
147
+ };
148
+ const cachedSDK = sdkCache.get(cacheConfig);
149
+ if (cachedSDK) {
150
+ return cachedSDK;
151
+ }
152
+ let sdk;
153
+ if (options.apiKey) {
154
+ sdk = new InscriptionSDK({
155
+ apiKey: options.apiKey,
156
+ network: clientConfig.network || "mainnet",
157
+ connectionMode
158
+ });
159
+ } else {
160
+ sdk = await InscriptionSDK.createWithAuth({
161
+ type: "server",
162
+ accountId: clientConfig.accountId,
163
+ privateKey: typeof clientConfig.privateKey === "string" ? clientConfig.privateKey : clientConfig.privateKey.toString(),
164
+ network: clientConfig.network || "mainnet",
165
+ connectionMode
517
166
  });
518
- return this.parseWithSchema(
519
- raw,
520
- registerAgentResponseSchema,
521
- "register agent response"
522
- );
523
167
  }
524
- calculateHbarAmount(creditsToPurchase, creditsPerHbar) {
525
- if (creditsPerHbar <= 0) {
526
- throw new Error("creditsPerHbar must be positive");
527
- }
528
- if (creditsToPurchase <= 0) {
529
- throw new Error("creditsToPurchase must be positive");
530
- }
531
- const rawHbar = creditsToPurchase / creditsPerHbar;
532
- const tinybars = Math.ceil(rawHbar * 1e8);
533
- return tinybars / 1e8;
168
+ sdkCache.set(cacheConfig, sdk);
169
+ return sdk;
170
+ }
171
+ function getCachedQuote(input, clientConfig, options) {
172
+ const cacheKey = quoteCache.createCacheKey(input, clientConfig, options);
173
+ return quoteCache.get(cacheKey);
174
+ }
175
+ function cacheQuote(input, clientConfig, options, quote) {
176
+ const cacheKey = quoteCache.createCacheKey(input, clientConfig, options);
177
+ const quoteTtlMs = 10 * 60 * 1e3;
178
+ quoteCache.set(cacheKey, quote, quoteTtlMs);
179
+ }
180
+ function validateQuoteParameters(input, clientConfig, options) {
181
+ if (!input || typeof input !== "object" || !("type" in input)) {
182
+ throw new Error("Invalid inscription input: type is required");
534
183
  }
535
- resolveCreditsToPurchase(shortfallCredits) {
536
- if (!Number.isFinite(shortfallCredits) || shortfallCredits <= 0) {
537
- return 0;
538
- }
539
- return Math.max(
540
- Math.ceil(shortfallCredits),
541
- MINIMUM_REGISTRATION_AUTO_TOP_UP_CREDITS
542
- );
184
+ if (!clientConfig || !clientConfig.accountId) {
185
+ throw new Error("Invalid client config: accountId is required");
543
186
  }
544
- async ensureCreditsForRegistration(payload, autoTopUp) {
545
- const details = autoTopUp ?? null;
546
- if (!details) {
547
- return;
548
- }
549
- if (!details.accountId || !details.accountId.trim()) {
550
- throw new Error("autoTopUp.accountId is required");
551
- }
552
- if (!details.privateKey || !details.privateKey.trim()) {
553
- throw new Error("autoTopUp.privateKey is required");
554
- }
555
- for (let attempt = 0; attempt < 3; attempt += 1) {
556
- const quote = await this.getRegistrationQuote(payload);
557
- const shortfall = quote.shortfallCredits ?? 0;
558
- if (shortfall <= 0) {
559
- return;
560
- }
561
- const creditsToPurchase = this.resolveCreditsToPurchase(shortfall);
562
- if (creditsToPurchase <= 0) {
563
- return;
564
- }
565
- const creditsPerHbar = quote.creditsPerHbar ?? null;
566
- if (!creditsPerHbar || creditsPerHbar <= 0) {
567
- throw new Error("Unable to determine credits per HBAR for auto top-up");
568
- }
569
- const hbarAmount = this.calculateHbarAmount(
570
- creditsToPurchase,
571
- creditsPerHbar
572
- );
573
- await this.purchaseCreditsWithHbar({
574
- accountId: details.accountId.trim(),
575
- privateKey: details.privateKey.trim(),
576
- hbarAmount,
577
- memo: details.memo ?? "Registry Broker auto top-up",
578
- metadata: {
579
- shortfallCredits: shortfall,
580
- requiredCredits: quote.requiredCredits,
581
- purchasedCredits: creditsToPurchase
582
- }
583
- });
584
- }
585
- const finalQuote = await this.getRegistrationQuote(payload);
586
- if ((finalQuote.shortfallCredits ?? 0) > 0) {
587
- throw new Error("Unable to purchase sufficient credits for registration");
588
- }
187
+ if (!options) {
188
+ throw new Error("Options are required");
589
189
  }
590
- async registerAgent(payload, options) {
591
- const autoTopUp = options?.autoTopUp ?? this.registrationAutoTopUp;
592
- if (!autoTopUp) {
593
- return this.performRegisterAgent(payload);
190
+ if (options.mode === "hashinal") {
191
+ if (!options.metadata) {
192
+ throw new Error("Hashinal mode requires metadata");
594
193
  }
595
- await this.ensureCreditsForRegistration(payload, autoTopUp);
596
- let retried = false;
597
- while (true) {
598
- try {
599
- return await this.performRegisterAgent(payload);
600
- } catch (error) {
601
- const shortfall = this.extractInsufficientCreditsDetails(error);
602
- if (shortfall && !retried) {
603
- await this.ensureCreditsForRegistration(payload, autoTopUp);
604
- retried = true;
605
- continue;
606
- }
607
- throw error;
608
- }
609
- }
610
- }
611
- async getRegistrationQuote(payload) {
612
- return getRegistrationQuote(this, payload);
613
- }
614
- async updateAgent(uaid, payload) {
615
- return updateAgent(this, uaid, payload);
616
- }
617
- async getRegisterStatus(uaid) {
618
- return getRegisterStatus(this, uaid);
619
- }
620
- async registerOwnedMoltbookAgent(uaid, payload) {
621
- return registerOwnedMoltbookAgent(this, uaid, payload);
622
- }
623
- async getRegistrationProgress(attemptId) {
624
- return getRegistrationProgress(this, attemptId);
625
- }
626
- async waitForRegistrationCompletion(attemptId, options) {
627
- return waitForRegistrationCompletion(this, attemptId, options);
628
- }
629
- async validateUaid(uaid) {
630
- return validateUaid(this, uaid);
631
- }
632
- async getUaidConnectionStatus(uaid) {
633
- return getUaidConnectionStatus(this, uaid);
634
- }
635
- async closeUaidConnection(uaid) {
636
- return closeUaidConnection(this, uaid);
637
- }
638
- async dashboardStats() {
639
- return dashboardStats(this);
640
- }
641
- async getCreditsBalance(params = {}) {
642
- return getCreditsBalance(this, params);
643
- }
644
- async getCreditProviders() {
645
- return getCreditProviders(this);
646
- }
647
- async getGuardSession() {
648
- return getGuardSession(this);
649
- }
650
- async getGuardEntitlements() {
651
- return getGuardEntitlements(this);
652
- }
653
- async getGuardBillingBalance() {
654
- return getGuardBillingBalance(this);
655
- }
656
- async getGuardFeed(limit) {
657
- return getGuardFeed(this, limit);
658
- }
659
- async getGuardOverview() {
660
- return getGuardOverview(this);
661
- }
662
- async getGuardTrustByHash(sha256) {
663
- return getGuardTrustByHash(this, sha256);
664
- }
665
- async resolveGuardTrust(query) {
666
- return resolveGuardTrust(this, query);
667
- }
668
- async getGuardRevocations() {
669
- return getGuardRevocations(this);
670
- }
671
- async fetchGuardAdvisories() {
672
- return fetchGuardAdvisories(this);
673
- }
674
- async fetchGuardPolicy() {
675
- return fetchGuardPolicy(this);
676
- }
677
- async getGuardInventory() {
678
- return getGuardInventory(this);
679
- }
680
- async getGuardReceiptHistory() {
681
- return getGuardReceiptHistory(this);
682
- }
683
- async getGuardArtifactTimeline(artifactId) {
684
- return getGuardArtifactTimeline(this, artifactId);
685
- }
686
- async getGuardInventoryDiff() {
687
- return getGuardInventoryDiff(this);
688
- }
689
- async exportGuardAbom() {
690
- return exportGuardAbom(this);
691
- }
692
- async exportGuardArtifactAbom(artifactId) {
693
- return exportGuardArtifactAbom(this, artifactId);
694
- }
695
- async exportGuardReceipts() {
696
- return exportGuardReceipts(this);
697
- }
698
- async getGuardDevices() {
699
- return getGuardDevices(this);
700
- }
701
- async getGuardAlertPreferences() {
702
- return getGuardAlertPreferences(this);
703
- }
704
- async updateGuardAlertPreferences(payload) {
705
- return updateGuardAlertPreferences(this, payload);
706
- }
707
- async getGuardExceptions() {
708
- return getGuardExceptions(this);
709
- }
710
- async getGuardWatchlist() {
711
- return getGuardWatchlist(this);
712
- }
713
- async lookupGuardWatchlist(payload) {
714
- return lookupGuardWatchlist(this, payload);
715
- }
716
- async getGuardPainSignals() {
717
- return getGuardPainSignals(this);
718
- }
719
- async getGuardAggregatedPainSignals() {
720
- return getGuardAggregatedPainSignals(this);
721
- }
722
- async getGuardPreInstallVerdict(payload) {
723
- return getGuardPreInstallVerdict(this, payload);
724
- }
725
- async getGuardPreExecutionVerdict(payload) {
726
- return getGuardPreExecutionVerdict(this, payload);
727
- }
728
- async addGuardWatchlistItem(payload) {
729
- return addGuardWatchlistItem(this, payload);
730
- }
731
- async removeGuardWatchlistItem(artifactId) {
732
- return removeGuardWatchlistItem(this, artifactId);
733
- }
734
- async addGuardException(payload) {
735
- return addGuardException(this, payload);
736
- }
737
- async requestGuardException(payload) {
738
- return requestGuardException(this, payload);
739
- }
740
- async removeGuardException(exceptionId) {
741
- return removeGuardException(this, exceptionId);
742
- }
743
- async ingestGuardPainSignals(items) {
744
- return ingestGuardPainSignals(this, items);
745
- }
746
- async syncGuardReceipts(payload) {
747
- return syncGuardReceipts(this, payload);
748
- }
749
- async syncGuardInventory(payload) {
750
- return syncGuardInventory(this, payload);
751
- }
752
- async submitGuardReceipts(payload) {
753
- return submitGuardReceipts(this, payload);
754
- }
755
- async getGuardTeamPolicyPack() {
756
- return getGuardTeamPolicyPack(this);
757
- }
758
- async updateGuardTeamPolicyPack(payload) {
759
- return updateGuardTeamPolicyPack(this, payload);
760
- }
761
- async createHbarPurchaseIntent(payload) {
762
- return createHbarPurchaseIntent(this, payload);
763
- }
764
- async purchaseCreditsWithHbar(params) {
765
- return purchaseCreditsWithHbar(this, params);
766
- }
767
- async getX402Minimums() {
768
- return getX402Minimums(this);
769
- }
770
- async purchaseCreditsWithX402(params) {
771
- return purchaseCreditsWithX402(this, params);
772
- }
773
- async buyCreditsWithX402(params) {
774
- return buyCreditsWithX402(this, params);
775
- }
776
- async generateEncryptionKeyPair(options = {}) {
777
- return generateEncryptionKeyPair(this, options);
778
- }
779
- async createLedgerChallenge(payload) {
780
- return createLedgerChallenge(this, payload);
781
- }
782
- async verifyLedgerChallenge(payload) {
783
- return verifyLedgerChallenge(this, payload);
784
- }
785
- async authenticateWithLedger(options) {
786
- return authenticateWithLedger(this, options);
787
- }
788
- async authenticateWithLedgerCredentials(options) {
789
- return authenticateWithLedgerCredentials(this, options);
790
- }
791
- async getVerificationStatus(uaid) {
792
- return getVerificationStatus(this, uaid);
793
- }
794
- async createVerificationChallenge(uaid) {
795
- return createVerificationChallenge(this, uaid);
796
- }
797
- async getVerificationChallenge(challengeId) {
798
- return getVerificationChallenge(this, challengeId);
799
- }
800
- async verifyVerificationChallenge(params) {
801
- return verifyVerificationChallenge(this, params);
802
- }
803
- async getVerificationOwnership(uaid) {
804
- return getVerificationOwnership(this, uaid);
805
- }
806
- async verifySenderOwnership(uaid) {
807
- return verifySenderOwnership(this, uaid);
808
- }
809
- async verifyUaidDnsTxt(payload) {
810
- return verifyUaidDnsTxt(this, payload);
811
- }
812
- async getVerificationDnsStatus(uaid, query) {
813
- return getVerificationDnsStatus(this, uaid, query);
814
- }
815
- async fetchHistorySnapshot(sessionId, options) {
816
- return fetchHistorySnapshot(
817
- this.conversationContexts,
818
- this,
819
- sessionId,
820
- options
194
+ const requiredFields = ["name", "creator", "description", "type"];
195
+ const missingFields = requiredFields.filter(
196
+ (field) => !options.metadata || !options.metadata[field]
821
197
  );
822
- }
823
- attachDecryptedHistory(sessionId, snapshot, options) {
824
- return attachDecryptedHistory(
825
- this.conversationContexts,
826
- this,
827
- sessionId,
828
- snapshot,
829
- options
830
- );
831
- }
832
- registerConversationContextForEncryption(context) {
833
- registerConversationContextForEncryption(
834
- this.conversationContexts,
835
- context
836
- );
837
- }
838
- resolveDecryptionContext(sessionId, options) {
839
- return resolveDecryptionContext(
840
- this.conversationContexts,
841
- this,
842
- sessionId,
843
- options
844
- );
845
- }
846
- decryptHistoryEntryFromContext(_sessionId, entry, context) {
847
- return decryptHistoryEntryFromContext(this, entry, context);
848
- }
849
- async createSession(payload, allowHistoryAutoTopUp = true) {
850
- return createSession(this, payload, allowHistoryAutoTopUp);
851
- }
852
- async resumeSession(sessionId) {
853
- return resumeSession(this, sessionId);
854
- }
855
- async checkChatReadiness(payload) {
856
- return checkChatReadiness(this, payload);
857
- }
858
- async startChat(options) {
859
- return startChat(this, this.getEncryptedChatManager(), options);
860
- }
861
- async startConversation(options) {
862
- return startConversation(this, this.getEncryptedChatManager(), options);
863
- }
864
- async acceptConversation(options) {
865
- return acceptConversation(
866
- this,
867
- this.getEncryptedChatManager(),
868
- options
869
- );
870
- }
871
- compactHistory(payload) {
872
- return compactHistory(this, payload);
873
- }
874
- fetchEncryptionStatus(sessionId) {
875
- return fetchEncryptionStatus(this, sessionId);
876
- }
877
- postEncryptionHandshake(sessionId, payload) {
878
- return postEncryptionHandshake(this, sessionId, payload);
879
- }
880
- sendMessage(payload) {
881
- return sendMessage(this, payload);
882
- }
883
- retryMessage(messageId, payload) {
884
- return retryMessage(this, messageId, payload);
885
- }
886
- cancelSession(sessionId) {
887
- return cancelSession(this, sessionId);
888
- }
889
- endSession(sessionId) {
890
- return endSession(this, sessionId);
891
- }
892
- createPlaintextConversationHandle(sessionId, summary, defaultAuth, context) {
893
- return createPlaintextConversationHandle(
894
- this,
895
- sessionId,
896
- summary,
897
- defaultAuth,
898
- context
899
- );
900
- }
901
- getEncryptedChatManager() {
902
- if (this.encryptedChatManager) {
903
- return this.encryptedChatManager;
904
- }
905
- const manager = new EncryptedChatManager(this);
906
- this.encryptedChatManager = manager;
907
- return manager;
908
- }
909
- async extractErrorBody(response) {
910
- const contentType = response.headers?.get("content-type") ?? "";
911
- if (JSON_CONTENT_TYPE.test(contentType)) {
912
- try {
913
- return await response.json();
914
- } catch (error) {
915
- return { parseError: String(error) };
916
- }
917
- }
918
- try {
919
- return await response.text();
920
- } catch (error) {
921
- return { parseError: String(error) };
922
- }
923
- }
924
- parseWithSchema(value, schema, context) {
925
- try {
926
- return schema.parse(value);
927
- } catch (error) {
928
- throw new RegistryBrokerParseError(
929
- `Failed to parse ${context}`,
930
- error instanceof ZodError || error instanceof Error ? error : String(error),
931
- value
198
+ if (missingFields.length > 0) {
199
+ throw new Error(
200
+ `Missing required Hashinal metadata fields: ${missingFields.join(", ")}`
932
201
  );
933
202
  }
934
203
  }
935
- async delay(ms, signal) {
936
- if (ms <= 0) {
937
- if (signal?.aborted) {
938
- throw createAbortError();
939
- }
940
- return;
941
- }
942
- await new Promise((resolve, reject) => {
943
- const timer = setTimeout(() => {
944
- if (signal) {
945
- signal.removeEventListener("abort", onAbort);
946
- }
947
- resolve();
948
- }, ms);
949
- const onAbort = () => {
950
- clearTimeout(timer);
951
- signal?.removeEventListener("abort", onAbort);
952
- reject(createAbortError());
953
- };
954
- if (signal) {
955
- if (signal.aborted) {
956
- clearTimeout(timer);
957
- reject(createAbortError());
958
- return;
959
- }
960
- signal.addEventListener("abort", onAbort, { once: true });
961
- }
962
- });
963
- }
964
- assertNodeRuntime(feature) {
965
- if (typeof process === "undefined" || !process.versions?.node) {
966
- throw new Error(`${feature} is only available in Node.js environments`);
967
- }
968
- }
969
- getNodeCrypto(feature) {
970
- this.assertNodeRuntime(feature);
971
- const nodeCrypto = optionalImportSync("node:crypto") ?? optionalImportSync("crypto");
972
- if (!nodeCrypto) {
973
- throw new Error(`${feature} requires the Node.js crypto module`);
974
- }
975
- return nodeCrypto;
976
- }
977
- getSecureRandomBytes(size, feature) {
978
- const webCrypto = globalThis.crypto;
979
- if (webCrypto && typeof webCrypto.getRandomValues === "function") {
980
- const bytes = new Uint8Array(size);
981
- webCrypto.getRandomValues(bytes);
982
- return bytes;
983
- }
984
- return this.getNodeCrypto(feature).randomBytes(size);
985
- }
986
- createEphemeralKeyPair() {
987
- const privateKeyBytes = this.getSecureRandomBytes(
988
- 32,
989
- "generateEphemeralKeyPair"
990
- );
991
- const publicKey = secp256k1.getPublicKey(privateKeyBytes, true);
992
- return {
993
- privateKey: Buffer.from(privateKeyBytes).toString("hex"),
994
- publicKey: Buffer.from(publicKey).toString("hex")
995
- };
996
- }
997
- deriveSharedSecret(options) {
998
- const { createHash } = this.getNodeCrypto("deriveSharedSecret");
999
- const privateKey = this.hexToBuffer(options.privateKey);
1000
- const peerPublicKey = this.hexToBuffer(options.peerPublicKey);
1001
- const shared = secp256k1.getSharedSecret(privateKey, peerPublicKey, true);
1002
- return createHash("sha256").update(Buffer.from(shared)).digest();
1003
- }
1004
- buildCipherEnvelope(options) {
1005
- const { createCipheriv, randomBytes } = this.getNodeCrypto(
1006
- "encryptCipherEnvelope"
1007
- );
1008
- const sharedSecret = this.normalizeSharedSecret(options.sharedSecret);
1009
- const iv = randomBytes(12);
1010
- const cipher = createCipheriv("aes-256-gcm", sharedSecret, iv);
1011
- const aadSource = options.associatedData ?? options.sessionId;
1012
- const associatedDataEncoded = aadSource ? Buffer.from(aadSource, "utf8").toString("base64") : void 0;
1013
- if (aadSource) {
1014
- cipher.setAAD(Buffer.from(aadSource, "utf8"));
1015
- }
1016
- const ciphertext = Buffer.concat([
1017
- cipher.update(Buffer.from(options.plaintext, "utf8")),
1018
- cipher.final()
1019
- ]);
1020
- const tag = cipher.getAuthTag();
1021
- const payload = Buffer.concat([ciphertext, tag]);
1022
- return {
1023
- algorithm: "aes-256-gcm",
1024
- ciphertext: payload.toString("base64"),
1025
- nonce: iv.toString("base64"),
1026
- associatedData: associatedDataEncoded,
1027
- keyLocator: {
1028
- sessionId: options.sessionId,
1029
- revision: options.revision ?? 1
1030
- },
1031
- recipients: options.recipients.map((recipient) => ({
1032
- ...recipient,
1033
- encryptedShare: ""
1034
- }))
1035
- };
1036
- }
1037
- openCipherEnvelope(options) {
1038
- const { createDecipheriv } = this.getNodeCrypto("decryptCipherEnvelope");
1039
- const sharedSecret = this.normalizeSharedSecret(options.sharedSecret);
1040
- const payload = Buffer.from(options.envelope.ciphertext, "base64");
1041
- const nonce = Buffer.from(options.envelope.nonce, "base64");
1042
- const ciphertext = payload.slice(0, payload.length - 16);
1043
- const tag = payload.slice(payload.length - 16);
1044
- const decipher = createDecipheriv("aes-256-gcm", sharedSecret, nonce);
1045
- if (options.envelope.associatedData) {
1046
- decipher.setAAD(Buffer.from(options.envelope.associatedData, "base64"));
1047
- }
1048
- decipher.setAuthTag(tag);
1049
- const plaintext = Buffer.concat([
1050
- decipher.update(ciphertext),
1051
- decipher.final()
1052
- ]);
1053
- return plaintext.toString(options.encoding ?? "utf8");
1054
- }
1055
- normalizeSharedSecret(input) {
1056
- if (Buffer.isBuffer(input)) {
1057
- return Buffer.from(input);
1058
- }
1059
- if (input instanceof Uint8Array) {
1060
- return Buffer.from(input);
1061
- }
1062
- if (typeof input === "string") {
1063
- return this.bufferFromString(input);
1064
- }
1065
- throw new Error("Unsupported shared secret input");
1066
- }
1067
- bufferFromString(value) {
1068
- const trimmed = value.trim();
1069
- if (!trimmed) {
1070
- throw new Error("sharedSecret string cannot be empty");
1071
- }
1072
- const normalized = trimmed.startsWith("0x") ? trimmed.slice(2) : trimmed;
1073
- if (/^[0-9a-fA-F]+$/.test(normalized) && normalized.length % 2 === 0) {
1074
- return Buffer.from(normalized, "hex");
1075
- }
1076
- return Buffer.from(trimmed, "base64");
1077
- }
1078
- hexToBuffer(value) {
1079
- const normalized = value.startsWith("0x") ? value.slice(2) : value;
1080
- if (!/^[0-9a-fA-F]+$/.test(normalized) || normalized.length % 2 !== 0) {
1081
- throw new Error("Expected hex-encoded value");
1082
- }
1083
- return Buffer.from(normalized, "hex");
1084
- }
1085
- extractInsufficientCreditsDetails(error) {
1086
- if (!(error instanceof RegistryBrokerError) || error.status !== 402) {
1087
- return null;
1088
- }
1089
- const body = error.body;
1090
- if (!body || typeof body !== "object" || Array.isArray(body)) {
1091
- return null;
1092
- }
1093
- const maybeShortfall = body["shortfallCredits"];
1094
- if (typeof maybeShortfall !== "number" || maybeShortfall <= 0) {
1095
- return null;
1096
- }
1097
- return { shortfallCredits: maybeShortfall };
1098
- }
1099
- extractErrorMessage(body) {
1100
- if (typeof body === "string") {
1101
- return body;
1102
- }
1103
- if (isJsonObject(body) && typeof body.error === "string") {
1104
- return body.error;
1105
- }
1106
- if (isJsonObject(body) && typeof body.message === "string") {
1107
- return body.message;
1108
- }
1109
- return void 0;
1110
- }
1111
- shouldAutoTopUpHistory(payload, error) {
1112
- if (!this.historyAutoTopUp || payload.historyTtlSeconds === void 0) {
1113
- return false;
1114
- }
1115
- if (!(error instanceof RegistryBrokerError)) {
1116
- return false;
1117
- }
1118
- if (error.status !== 402) {
1119
- return false;
1120
- }
1121
- const message = this.extractErrorMessage(error.body);
1122
- if (!message) {
1123
- return true;
1124
- }
1125
- const normalised = message.toLowerCase();
1126
- return normalised.includes("history") || normalised.includes("chat history");
1127
- }
1128
- async executeHistoryAutoTopUp(reason) {
1129
- if (!this.historyAutoTopUp) {
1130
- return;
1131
- }
1132
- const hbarAmount = this.historyAutoTopUp.hbarAmount && this.historyAutoTopUp.hbarAmount > 0 ? this.historyAutoTopUp.hbarAmount : DEFAULT_HISTORY_TOP_UP_HBAR;
1133
- await this.purchaseCreditsWithHbar({
1134
- accountId: this.historyAutoTopUp.accountId,
1135
- privateKey: this.historyAutoTopUp.privateKey,
1136
- hbarAmount,
1137
- memo: this.historyAutoTopUp.memo ?? "registry-broker-client:chat-history-topup",
1138
- metadata: {
1139
- purpose: "chat-history",
1140
- reason
1141
- }
1142
- });
1143
- }
1144
- initializeEncryptionBootstrap(options) {
1145
- return this.bootstrapEncryptionOptions(options).then(() => void 0);
1146
- }
1147
- bootstrapEncryptionOptions(options) {
1148
- return bootstrapEncryptionOptions(this, options);
1149
- }
1150
204
  }
1151
- const isPendingRegisterAgentResponse = (response) => response.status === "pending";
1152
- const isPartialRegisterAgentResponse = (response) => response.status === "partial" && response.success === false;
1153
- const isSuccessRegisterAgentResponse = (response) => response.success === true && response.status !== "pending";
1154
205
  export {
1155
- RegistryBrokerClient,
1156
- isPartialRegisterAgentResponse,
1157
- isPendingRegisterAgentResponse,
1158
- isSuccessRegisterAgentResponse
206
+ cacheQuote,
207
+ getCachedQuote,
208
+ getOrCreateSDK,
209
+ validateQuoteParameters
1159
210
  };
1160
211
  //# sourceMappingURL=standards-sdk.es148.js.map