@hashgraphonline/standards-sdk 0.1.190 → 0.1.191

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 (350) hide show
  1. package/dist/browser/hcs-25/adapters/ans-trust-discovery.d.ts +22 -0
  2. package/dist/browser/hcs-25/adapters/ans-trust-discovery.d.ts.map +1 -0
  3. package/dist/browser/hcs-25/adapters/index.d.ts +1 -0
  4. package/dist/browser/hcs-25/adapters/index.d.ts.map +1 -1
  5. package/dist/browser/hcs-25/collectors/ans-trust-discovery.d.ts +32 -0
  6. package/dist/browser/hcs-25/collectors/ans-trust-discovery.d.ts.map +1 -0
  7. package/dist/browser/hcs-25/collectors/catalog.d.ts +9 -2
  8. package/dist/browser/hcs-25/collectors/catalog.d.ts.map +1 -1
  9. package/dist/browser/hcs-25/collectors/index.d.ts +1 -0
  10. package/dist/browser/hcs-25/collectors/index.d.ts.map +1 -1
  11. package/dist/browser/hcs-25/signals/ans-trust-discovery.d.ts +50 -0
  12. package/dist/browser/hcs-25/signals/ans-trust-discovery.d.ts.map +1 -0
  13. package/dist/browser/hcs-25/signals/index.d.ts +1 -0
  14. package/dist/browser/hcs-25/signals/index.d.ts.map +1 -1
  15. package/dist/browser-root/hcs-25/adapters/ans-trust-discovery.d.ts +22 -0
  16. package/dist/browser-root/hcs-25/adapters/ans-trust-discovery.d.ts.map +1 -0
  17. package/dist/browser-root/hcs-25/adapters/index.d.ts +1 -0
  18. package/dist/browser-root/hcs-25/adapters/index.d.ts.map +1 -1
  19. package/dist/browser-root/hcs-25/collectors/ans-trust-discovery.d.ts +32 -0
  20. package/dist/browser-root/hcs-25/collectors/ans-trust-discovery.d.ts.map +1 -0
  21. package/dist/browser-root/hcs-25/collectors/catalog.d.ts +9 -2
  22. package/dist/browser-root/hcs-25/collectors/catalog.d.ts.map +1 -1
  23. package/dist/browser-root/hcs-25/collectors/index.d.ts +1 -0
  24. package/dist/browser-root/hcs-25/collectors/index.d.ts.map +1 -1
  25. package/dist/browser-root/hcs-25/signals/ans-trust-discovery.d.ts +50 -0
  26. package/dist/browser-root/hcs-25/signals/ans-trust-discovery.d.ts.map +1 -0
  27. package/dist/browser-root/hcs-25/signals/index.d.ts +1 -0
  28. package/dist/browser-root/hcs-25/signals/index.d.ts.map +1 -1
  29. package/dist/cjs/hcs-25/adapters/ans-trust-discovery.d.ts +22 -0
  30. package/dist/cjs/hcs-25/adapters/ans-trust-discovery.d.ts.map +1 -0
  31. package/dist/cjs/hcs-25/adapters/index.d.ts +1 -0
  32. package/dist/cjs/hcs-25/adapters/index.d.ts.map +1 -1
  33. package/dist/cjs/hcs-25/collectors/ans-trust-discovery.d.ts +32 -0
  34. package/dist/cjs/hcs-25/collectors/ans-trust-discovery.d.ts.map +1 -0
  35. package/dist/cjs/hcs-25/collectors/catalog.d.ts +9 -2
  36. package/dist/cjs/hcs-25/collectors/catalog.d.ts.map +1 -1
  37. package/dist/cjs/hcs-25/collectors/index.d.ts +1 -0
  38. package/dist/cjs/hcs-25/collectors/index.d.ts.map +1 -1
  39. package/dist/cjs/hcs-25/signals/ans-trust-discovery.d.ts +50 -0
  40. package/dist/cjs/hcs-25/signals/ans-trust-discovery.d.ts.map +1 -0
  41. package/dist/cjs/hcs-25/signals/index.d.ts +1 -0
  42. package/dist/cjs/hcs-25/signals/index.d.ts.map +1 -1
  43. package/dist/cjs/standards-sdk.cjs +1 -1
  44. package/dist/cjs/standards-sdk.cjs.map +1 -1
  45. package/dist/es/hcs-25/adapters/ans-trust-discovery.d.ts +22 -0
  46. package/dist/es/hcs-25/adapters/ans-trust-discovery.d.ts.map +1 -0
  47. package/dist/es/hcs-25/adapters/index.d.ts +1 -0
  48. package/dist/es/hcs-25/adapters/index.d.ts.map +1 -1
  49. package/dist/es/hcs-25/collectors/ans-trust-discovery.d.ts +32 -0
  50. package/dist/es/hcs-25/collectors/ans-trust-discovery.d.ts.map +1 -0
  51. package/dist/es/hcs-25/collectors/catalog.d.ts +9 -2
  52. package/dist/es/hcs-25/collectors/catalog.d.ts.map +1 -1
  53. package/dist/es/hcs-25/collectors/index.d.ts +1 -0
  54. package/dist/es/hcs-25/collectors/index.d.ts.map +1 -1
  55. package/dist/es/hcs-25/signals/ans-trust-discovery.d.ts +50 -0
  56. package/dist/es/hcs-25/signals/ans-trust-discovery.d.ts.map +1 -0
  57. package/dist/es/hcs-25/signals/index.d.ts +1 -0
  58. package/dist/es/hcs-25/signals/index.d.ts.map +1 -1
  59. package/dist/es/standards-sdk.es.js +78 -71
  60. package/dist/es/standards-sdk.es.js.map +1 -1
  61. package/dist/es/standards-sdk.es101.js +2 -2
  62. package/dist/es/standards-sdk.es103.js +2 -2
  63. package/dist/es/standards-sdk.es104.js +1 -1
  64. package/dist/es/standards-sdk.es106.js +1 -1
  65. package/dist/es/standards-sdk.es108.js +2 -2
  66. package/dist/es/standards-sdk.es11.js +1 -1
  67. package/dist/es/standards-sdk.es110.js +1 -1
  68. package/dist/es/standards-sdk.es111.js +2 -2
  69. package/dist/es/standards-sdk.es115.js +3 -3
  70. package/dist/es/standards-sdk.es116.js +4 -4
  71. package/dist/es/standards-sdk.es12.js +1 -1
  72. package/dist/es/standards-sdk.es120.js +22 -4
  73. package/dist/es/standards-sdk.es120.js.map +1 -1
  74. package/dist/es/standards-sdk.es121.js +15 -12
  75. package/dist/es/standards-sdk.es121.js.map +1 -1
  76. package/dist/es/standards-sdk.es123.js +6 -5
  77. package/dist/es/standards-sdk.es123.js.map +1 -1
  78. package/dist/es/standards-sdk.es124.js +6 -5
  79. package/dist/es/standards-sdk.es124.js.map +1 -1
  80. package/dist/es/standards-sdk.es127.js +6 -5
  81. package/dist/es/standards-sdk.es127.js.map +1 -1
  82. package/dist/es/standards-sdk.es128.js +110 -136
  83. package/dist/es/standards-sdk.es128.js.map +1 -1
  84. package/dist/es/standards-sdk.es129.js +133 -141
  85. package/dist/es/standards-sdk.es129.js.map +1 -1
  86. package/dist/es/standards-sdk.es13.js +1 -1
  87. package/dist/es/standards-sdk.es130.js +135 -345
  88. package/dist/es/standards-sdk.es130.js.map +1 -1
  89. package/dist/es/standards-sdk.es131.js +332 -344
  90. package/dist/es/standards-sdk.es131.js.map +1 -1
  91. package/dist/es/standards-sdk.es132.js +338 -178
  92. package/dist/es/standards-sdk.es132.js.map +1 -1
  93. package/dist/es/standards-sdk.es133.js +200 -196
  94. package/dist/es/standards-sdk.es133.js.map +1 -1
  95. package/dist/es/standards-sdk.es134.js +216 -364
  96. package/dist/es/standards-sdk.es134.js.map +1 -1
  97. package/dist/es/standards-sdk.es135.js +358 -100
  98. package/dist/es/standards-sdk.es135.js.map +1 -1
  99. package/dist/es/standards-sdk.es136.js +91 -220
  100. package/dist/es/standards-sdk.es136.js.map +1 -1
  101. package/dist/es/standards-sdk.es137.js +173 -1250
  102. package/dist/es/standards-sdk.es137.js.map +1 -1
  103. package/dist/es/standards-sdk.es138.js +1295 -98
  104. package/dist/es/standards-sdk.es138.js.map +1 -1
  105. package/dist/es/standards-sdk.es139.js +109 -246
  106. package/dist/es/standards-sdk.es139.js.map +1 -1
  107. package/dist/es/standards-sdk.es14.js +1 -1
  108. package/dist/es/standards-sdk.es140.js +263 -97
  109. package/dist/es/standards-sdk.es140.js.map +1 -1
  110. package/dist/es/standards-sdk.es141.js +107 -248
  111. package/dist/es/standards-sdk.es141.js.map +1 -1
  112. package/dist/es/standards-sdk.es142.js +246 -472
  113. package/dist/es/standards-sdk.es142.js.map +1 -1
  114. package/dist/es/standards-sdk.es143.js +458 -85
  115. package/dist/es/standards-sdk.es143.js.map +1 -1
  116. package/dist/es/standards-sdk.es144.js +96 -151
  117. package/dist/es/standards-sdk.es144.js.map +1 -1
  118. package/dist/es/standards-sdk.es145.js +155 -29
  119. package/dist/es/standards-sdk.es145.js.map +1 -1
  120. package/dist/es/standards-sdk.es146.js +26 -4
  121. package/dist/es/standards-sdk.es146.js.map +1 -1
  122. package/dist/es/standards-sdk.es147.js +10 -180
  123. package/dist/es/standards-sdk.es147.js.map +1 -1
  124. package/dist/es/standards-sdk.es148.js +179 -26
  125. package/dist/es/standards-sdk.es148.js.map +1 -1
  126. package/dist/es/standards-sdk.es149.js +27 -20
  127. package/dist/es/standards-sdk.es149.js.map +1 -1
  128. package/dist/es/standards-sdk.es15.js +1 -1
  129. package/dist/es/standards-sdk.es150.js +18 -156
  130. package/dist/es/standards-sdk.es150.js.map +1 -1
  131. package/dist/es/standards-sdk.es151.js +148 -190
  132. package/dist/es/standards-sdk.es151.js.map +1 -1
  133. package/dist/es/standards-sdk.es152.js +159 -747
  134. package/dist/es/standards-sdk.es152.js.map +1 -1
  135. package/dist/es/standards-sdk.es153.js +786 -9
  136. package/dist/es/standards-sdk.es153.js.map +1 -1
  137. package/dist/es/standards-sdk.es154.js +13 -567
  138. package/dist/es/standards-sdk.es154.js.map +1 -1
  139. package/dist/es/standards-sdk.es155.js +541 -600
  140. package/dist/es/standards-sdk.es155.js.map +1 -1
  141. package/dist/es/standards-sdk.es156.js +625 -12
  142. package/dist/es/standards-sdk.es156.js.map +1 -1
  143. package/dist/es/standards-sdk.es157.js +13 -2
  144. package/dist/es/standards-sdk.es157.js.map +1 -1
  145. package/dist/es/standards-sdk.es158.js +2 -87
  146. package/dist/es/standards-sdk.es158.js.map +1 -1
  147. package/dist/es/standards-sdk.es159.js +84 -37
  148. package/dist/es/standards-sdk.es159.js.map +1 -1
  149. package/dist/es/standards-sdk.es16.js +6 -6
  150. package/dist/es/standards-sdk.es160.js +40 -2
  151. package/dist/es/standards-sdk.es160.js.map +1 -1
  152. package/dist/es/standards-sdk.es161.js +2 -235
  153. package/dist/es/standards-sdk.es161.js.map +1 -1
  154. package/dist/es/standards-sdk.es162.js +204 -1109
  155. package/dist/es/standards-sdk.es162.js.map +1 -1
  156. package/dist/es/standards-sdk.es163.js +1059 -225
  157. package/dist/es/standards-sdk.es163.js.map +1 -1
  158. package/dist/es/standards-sdk.es164.js +303 -419
  159. package/dist/es/standards-sdk.es164.js.map +1 -1
  160. package/dist/es/standards-sdk.es165.js +418 -351
  161. package/dist/es/standards-sdk.es165.js.map +1 -1
  162. package/dist/es/standards-sdk.es166.js +347 -1114
  163. package/dist/es/standards-sdk.es166.js.map +1 -1
  164. package/dist/es/standards-sdk.es167.js +1094 -180
  165. package/dist/es/standards-sdk.es167.js.map +1 -1
  166. package/dist/es/standards-sdk.es168.js +153 -1512
  167. package/dist/es/standards-sdk.es168.js.map +1 -1
  168. package/dist/es/standards-sdk.es169.js +1457 -1056
  169. package/dist/es/standards-sdk.es169.js.map +1 -1
  170. package/dist/es/standards-sdk.es170.js +1163 -14
  171. package/dist/es/standards-sdk.es170.js.map +1 -1
  172. package/dist/es/standards-sdk.es171.js +15 -449
  173. package/dist/es/standards-sdk.es171.js.map +1 -1
  174. package/dist/es/standards-sdk.es172.js +440 -248
  175. package/dist/es/standards-sdk.es172.js.map +1 -1
  176. package/dist/es/standards-sdk.es173.js +259 -4
  177. package/dist/es/standards-sdk.es173.js.map +1 -1
  178. package/dist/es/standards-sdk.es174.js +4 -81
  179. package/dist/es/standards-sdk.es174.js.map +1 -1
  180. package/dist/es/standards-sdk.es175.js +71 -77
  181. package/dist/es/standards-sdk.es175.js.map +1 -1
  182. package/dist/es/standards-sdk.es176.js +80 -53
  183. package/dist/es/standards-sdk.es176.js.map +1 -1
  184. package/dist/es/standards-sdk.es177.js +59 -2546
  185. package/dist/es/standards-sdk.es177.js.map +1 -1
  186. package/dist/es/standards-sdk.es178.js +2547 -159
  187. package/dist/es/standards-sdk.es178.js.map +1 -1
  188. package/dist/es/standards-sdk.es179.js +159 -7
  189. package/dist/es/standards-sdk.es179.js.map +1 -1
  190. package/dist/es/standards-sdk.es18.js +13 -13
  191. package/dist/es/standards-sdk.es180.js +7 -86
  192. package/dist/es/standards-sdk.es180.js.map +1 -1
  193. package/dist/es/standards-sdk.es181.js +65 -44
  194. package/dist/es/standards-sdk.es181.js.map +1 -1
  195. package/dist/es/standards-sdk.es182.js +57 -188
  196. package/dist/es/standards-sdk.es182.js.map +1 -1
  197. package/dist/es/standards-sdk.es183.js +27 -26
  198. package/dist/es/standards-sdk.es183.js.map +1 -1
  199. package/dist/es/standards-sdk.es184.js +191 -53
  200. package/dist/es/standards-sdk.es184.js.map +1 -1
  201. package/dist/es/standards-sdk.es185.js +21 -109
  202. package/dist/es/standards-sdk.es185.js.map +1 -1
  203. package/dist/es/standards-sdk.es186.js +49 -47
  204. package/dist/es/standards-sdk.es186.js.map +1 -1
  205. package/dist/es/standards-sdk.es187.js +89 -205
  206. package/dist/es/standards-sdk.es187.js.map +1 -1
  207. package/dist/es/standards-sdk.es188.js +35 -58
  208. package/dist/es/standards-sdk.es188.js.map +1 -1
  209. package/dist/es/standards-sdk.es189.js +48 -39
  210. package/dist/es/standards-sdk.es189.js.map +1 -1
  211. package/dist/es/standards-sdk.es19.js +10 -10
  212. package/dist/es/standards-sdk.es190.js +218 -48
  213. package/dist/es/standards-sdk.es190.js.map +1 -1
  214. package/dist/es/standards-sdk.es191.js +66 -42
  215. package/dist/es/standards-sdk.es191.js.map +1 -1
  216. package/dist/es/standards-sdk.es192.js +33 -105
  217. package/dist/es/standards-sdk.es192.js.map +1 -1
  218. package/dist/es/standards-sdk.es193.js +49 -43
  219. package/dist/es/standards-sdk.es193.js.map +1 -1
  220. package/dist/es/standards-sdk.es194.js +33 -42
  221. package/dist/es/standards-sdk.es194.js.map +1 -1
  222. package/dist/es/standards-sdk.es195.js +123 -72
  223. package/dist/es/standards-sdk.es195.js.map +1 -1
  224. package/dist/es/standards-sdk.es196.js +58 -75
  225. package/dist/es/standards-sdk.es196.js.map +1 -1
  226. package/dist/es/standards-sdk.es197.js +60 -44
  227. package/dist/es/standards-sdk.es197.js.map +1 -1
  228. package/dist/es/standards-sdk.es198.js +72 -36
  229. package/dist/es/standards-sdk.es198.js.map +1 -1
  230. package/dist/es/standards-sdk.es199.js +75 -30
  231. package/dist/es/standards-sdk.es199.js.map +1 -1
  232. package/dist/es/standards-sdk.es2.js +2 -2
  233. package/dist/es/standards-sdk.es20.js +1 -1
  234. package/dist/es/standards-sdk.es200.js +44 -34
  235. package/dist/es/standards-sdk.es200.js.map +1 -1
  236. package/dist/es/standards-sdk.es201.js +36 -48
  237. package/dist/es/standards-sdk.es201.js.map +1 -1
  238. package/dist/es/standards-sdk.es202.js +30 -138
  239. package/dist/es/standards-sdk.es202.js.map +1 -1
  240. package/dist/es/standards-sdk.es203.js +34 -42
  241. package/dist/es/standards-sdk.es203.js.map +1 -1
  242. package/dist/es/standards-sdk.es204.js +48 -12482
  243. package/dist/es/standards-sdk.es204.js.map +1 -1
  244. package/dist/es/standards-sdk.es205.js +134 -13
  245. package/dist/es/standards-sdk.es205.js.map +1 -1
  246. package/dist/es/standards-sdk.es206.js +36 -50
  247. package/dist/es/standards-sdk.es206.js.map +1 -1
  248. package/dist/es/standards-sdk.es207.js +12449 -78
  249. package/dist/es/standards-sdk.es207.js.map +1 -1
  250. package/dist/es/standards-sdk.es208.js +15 -79
  251. package/dist/es/standards-sdk.es208.js.map +1 -1
  252. package/dist/es/standards-sdk.es209.js +48 -192
  253. package/dist/es/standards-sdk.es209.js.map +1 -1
  254. package/dist/es/standards-sdk.es21.js +1 -1
  255. package/dist/es/standards-sdk.es210.js +90 -651
  256. package/dist/es/standards-sdk.es210.js.map +1 -1
  257. package/dist/es/standards-sdk.es211.js +71 -63
  258. package/dist/es/standards-sdk.es211.js.map +1 -1
  259. package/dist/es/standards-sdk.es212.js +188 -160
  260. package/dist/es/standards-sdk.es212.js.map +1 -1
  261. package/dist/es/standards-sdk.es213.js +65 -314
  262. package/dist/es/standards-sdk.es213.js.map +1 -1
  263. package/dist/es/standards-sdk.es214.js +661 -335
  264. package/dist/es/standards-sdk.es214.js.map +1 -1
  265. package/dist/es/standards-sdk.es215.js +129 -410
  266. package/dist/es/standards-sdk.es215.js.map +1 -1
  267. package/dist/es/standards-sdk.es216.js +200 -209
  268. package/dist/es/standards-sdk.es216.js.map +1 -1
  269. package/dist/es/standards-sdk.es217.js +334 -64
  270. package/dist/es/standards-sdk.es217.js.map +1 -1
  271. package/dist/es/standards-sdk.es218.js +438 -124
  272. package/dist/es/standards-sdk.es218.js.map +1 -1
  273. package/dist/es/standards-sdk.es219.js +310 -496
  274. package/dist/es/standards-sdk.es219.js.map +1 -1
  275. package/dist/es/standards-sdk.es22.js +1 -1
  276. package/dist/es/standards-sdk.es220.js +60 -243
  277. package/dist/es/standards-sdk.es220.js.map +1 -1
  278. package/dist/es/standards-sdk.es221.js +118 -175
  279. package/dist/es/standards-sdk.es221.js.map +1 -1
  280. package/dist/es/standards-sdk.es222.js +465 -67
  281. package/dist/es/standards-sdk.es222.js.map +1 -1
  282. package/dist/es/standards-sdk.es223.js +250 -143
  283. package/dist/es/standards-sdk.es223.js.map +1 -1
  284. package/dist/es/standards-sdk.es224.js +172 -160
  285. package/dist/es/standards-sdk.es224.js.map +1 -1
  286. package/dist/es/standards-sdk.es225.js +65 -630
  287. package/dist/es/standards-sdk.es225.js.map +1 -1
  288. package/dist/es/standards-sdk.es226.js +128 -161
  289. package/dist/es/standards-sdk.es226.js.map +1 -1
  290. package/dist/es/standards-sdk.es227.js +144 -195
  291. package/dist/es/standards-sdk.es227.js.map +1 -1
  292. package/dist/es/standards-sdk.es228.js +668 -223
  293. package/dist/es/standards-sdk.es228.js.map +1 -1
  294. package/dist/es/standards-sdk.es229.js +188 -0
  295. package/dist/es/standards-sdk.es229.js.map +1 -0
  296. package/dist/es/standards-sdk.es23.js +1 -1
  297. package/dist/es/standards-sdk.es230.js +238 -0
  298. package/dist/es/standards-sdk.es230.js.map +1 -0
  299. package/dist/es/standards-sdk.es231.js +242 -0
  300. package/dist/es/standards-sdk.es231.js.map +1 -0
  301. package/dist/es/standards-sdk.es24.js +1 -1
  302. package/dist/es/standards-sdk.es25.js +1 -1
  303. package/dist/es/standards-sdk.es26.js +1 -1
  304. package/dist/es/standards-sdk.es27.js +13 -13
  305. package/dist/es/standards-sdk.es30.js +2 -2
  306. package/dist/es/standards-sdk.es31.js +4 -4
  307. package/dist/es/standards-sdk.es32.js +1 -1
  308. package/dist/es/standards-sdk.es35.js +7 -7
  309. package/dist/es/standards-sdk.es36.js +4 -4
  310. package/dist/es/standards-sdk.es37.js +2 -2
  311. package/dist/es/standards-sdk.es38.js +2 -2
  312. package/dist/es/standards-sdk.es39.js +1 -1
  313. package/dist/es/standards-sdk.es4.js +2 -2
  314. package/dist/es/standards-sdk.es40.js +1 -1
  315. package/dist/es/standards-sdk.es41.js +2 -2
  316. package/dist/es/standards-sdk.es46.js +1 -1
  317. package/dist/es/standards-sdk.es5.js +2 -2
  318. package/dist/es/standards-sdk.es51.js +1 -1
  319. package/dist/es/standards-sdk.es53.js +1 -1
  320. package/dist/es/standards-sdk.es56.js +2 -2
  321. package/dist/es/standards-sdk.es59.js +1 -1
  322. package/dist/es/standards-sdk.es6.js +2 -2
  323. package/dist/es/standards-sdk.es60.js +1 -1
  324. package/dist/es/standards-sdk.es62.js +1 -1
  325. package/dist/es/standards-sdk.es63.js +2 -2
  326. package/dist/es/standards-sdk.es64.js +1 -1
  327. package/dist/es/standards-sdk.es65.js +1 -1
  328. package/dist/es/standards-sdk.es66.js +1 -1
  329. package/dist/es/standards-sdk.es67.js +8 -8
  330. package/dist/es/standards-sdk.es69.js +1 -1
  331. package/dist/es/standards-sdk.es7.js +1 -1
  332. package/dist/es/standards-sdk.es71.js +2 -2
  333. package/dist/es/standards-sdk.es72.js +3 -3
  334. package/dist/es/standards-sdk.es75.js +5 -5
  335. package/dist/es/standards-sdk.es76.js +3 -3
  336. package/dist/es/standards-sdk.es77.js +2 -2
  337. package/dist/es/standards-sdk.es78.js +1 -1
  338. package/dist/es/standards-sdk.es81.js +2 -2
  339. package/dist/es/standards-sdk.es83.js +2 -2
  340. package/dist/es/standards-sdk.es84.js +5 -5
  341. package/dist/es/standards-sdk.es85.js +1 -1
  342. package/dist/es/standards-sdk.es88.js +1 -1
  343. package/dist/es/standards-sdk.es89.js +2 -2
  344. package/dist/es/standards-sdk.es9.js +2 -2
  345. package/dist/es/standards-sdk.es90.js +4 -4
  346. package/dist/es/standards-sdk.es94.js +3 -3
  347. package/dist/es/standards-sdk.es96.js +2 -2
  348. package/dist/es/standards-sdk.es98.js +1 -1
  349. package/dist/es/standards-sdk.es99.js +3 -3
  350. package/package.json +1 -1
@@ -1,136 +1,1333 @@
1
- import { readString } from "./standards-sdk.es198.js";
2
- import "./standards-sdk.es182.js";
3
- import "./standards-sdk.es195.js";
4
- import "./standards-sdk.es196.js";
5
- import "./standards-sdk.es197.js";
6
- import { requestJson, Hcs25CollectorHttpError } from "./standards-sdk.es122.js";
7
- function clamp01(value) {
8
- if (typeof value !== "number" || !Number.isFinite(value)) {
1
+ import { readString, readSubjectAdditional, isJsonObject } from "./standards-sdk.es201.js";
2
+ import "./standards-sdk.es184.js";
3
+ import "./standards-sdk.es198.js";
4
+ import "./standards-sdk.es199.js";
5
+ import "./standards-sdk.es200.js";
6
+ import "./standards-sdk.es183.js";
7
+ import { stripTrailingSlashes, requestJson, requestText, Hcs25CollectorHttpError, isTimeoutError } from "./standards-sdk.es122.js";
8
+ const HF_API_BASE = "https://huggingface.co/api";
9
+ const HF_DATASETS_BASE = "https://huggingface.co/datasets";
10
+ const OPENROUTER_API_BASE = "https://openrouter.ai/api/v1";
11
+ const OPENROUTER_FRONTEND_BASE = "https://openrouter.ai/api/frontend";
12
+ const OPENLM_ARENA_URL = "https://openlm.ai/chatbot-arena/";
13
+ const OPENLLM_DATASET_ID = "open-llm-leaderboard/results";
14
+ const OPENLLM_DATASET_BRANCH = "main";
15
+ const DEFAULT_MODEL_REGISTRIES = ["openrouter", "near-ai"];
16
+ const OPENROUTER_CATEGORY_SOURCE = "openrouter:category-rankings";
17
+ const HUGGINGFACE_MODEL_INDEX_SOURCE = "huggingface:model-index";
18
+ const HUGGINGFACE_POPULARITY_SOURCE = "huggingface:popularity";
19
+ const CHATBOT_ARENA_SOURCE = "chatbot-arena:leaderboard";
20
+ const OPENLLM_EVAL_SOURCES = ["openllm-leaderboard"];
21
+ const MODEL_ID_KEYS = [
22
+ "openrouterModelId",
23
+ "huggingFaceModelId",
24
+ "openrouterHuggingFaceId",
25
+ "modelId",
26
+ "model",
27
+ "name"
28
+ ];
29
+ function resolveModelId(subject) {
30
+ const additional = readSubjectAdditional(subject);
31
+ for (const key of MODEL_ID_KEYS) {
32
+ const value = readString(additional, key);
33
+ if (value) {
34
+ return value;
35
+ }
36
+ }
37
+ const metadata = subject.metadata ?? {};
38
+ for (const key of MODEL_ID_KEYS) {
39
+ const value = readString(metadata, key);
40
+ if (value) {
41
+ return value;
42
+ }
43
+ }
44
+ return subject.id || null;
45
+ }
46
+ function modelIdMatches(candidate, wanted) {
47
+ const a = candidate.trim().toLowerCase();
48
+ const b = wanted.trim().toLowerCase();
49
+ if (a === b) {
50
+ return true;
51
+ }
52
+ const stripOrg = (id) => id.includes("/") ? id.slice(id.lastIndexOf("/") + 1) : id;
53
+ return stripOrg(a) === stripOrg(b);
54
+ }
55
+ function statusFromError(error) {
56
+ return isTimeoutError(error) ? "timeout" : "error";
57
+ }
58
+ function asRecord(value) {
59
+ return isJsonObject(value) ? value : void 0;
60
+ }
61
+ function parseNumber(value) {
62
+ if (typeof value === "number" && Number.isFinite(value)) {
63
+ return value;
64
+ }
65
+ if (typeof value === "string" && value.trim()) {
66
+ const parsed = Number(value.trim());
67
+ return Number.isFinite(parsed) ? parsed : null;
68
+ }
69
+ return null;
70
+ }
71
+ const encodeModelIdForPath = (modelId) => modelId.split("/").map((segment) => encodeURIComponent(segment)).join("/");
72
+ const METRIC_EXCLUDE_TOKENS = [
73
+ "loss",
74
+ "perplexity",
75
+ "ppl",
76
+ "error",
77
+ "rmse",
78
+ "mae",
79
+ "wer",
80
+ "cer",
81
+ "bits"
82
+ ];
83
+ const METRIC_INCLUDE_TOKENS = [
84
+ "accuracy",
85
+ "acc",
86
+ "exact",
87
+ "em",
88
+ "f1",
89
+ "precision",
90
+ "recall",
91
+ "score",
92
+ "pass",
93
+ "win",
94
+ "bleu",
95
+ "rouge",
96
+ "mmlu",
97
+ "gsm",
98
+ "arc",
99
+ "hellaswag",
100
+ "truthfulqa",
101
+ "gpqa",
102
+ "humaneval",
103
+ "mbpp",
104
+ "swe",
105
+ "math",
106
+ "bbh",
107
+ "ceval"
108
+ ];
109
+ const hasToken = (input, tokens) => tokens.some((token) => input.includes(token));
110
+ function shouldIncludeMetric(name) {
111
+ const normalized = name.trim().toLowerCase();
112
+ if (!normalized) {
113
+ return false;
114
+ }
115
+ if (hasToken(normalized, METRIC_EXCLUDE_TOKENS)) {
116
+ return false;
117
+ }
118
+ return hasToken(normalized, METRIC_INCLUDE_TOKENS);
119
+ }
120
+ function normalizeMetricValue(raw) {
121
+ if (!Number.isFinite(raw)) {
9
122
  return null;
10
123
  }
11
- return Math.min(1, Math.max(0, value));
124
+ if (raw <= 1) {
125
+ return Math.min(100, Math.max(0, raw * 100));
126
+ }
127
+ if (raw <= 100) {
128
+ return Math.min(100, Math.max(0, raw));
129
+ }
130
+ return null;
12
131
  }
13
- function defaultResolveAgentId(subject) {
14
- const metadata = subject.metadata ?? {};
15
- return readString(metadata, "verificationAgentId") ?? readString(metadata, "nativeId") ?? subject.id ?? null;
132
+ function normalizeLogScore(value, max) {
133
+ if (!Number.isFinite(value) || value <= 0 || !Number.isFinite(max) || max <= 0) {
134
+ return null;
135
+ }
136
+ const numerator = Math.log10(value + 1);
137
+ const denominator = Math.log10(max + 1);
138
+ if (!Number.isFinite(numerator) || !Number.isFinite(denominator) || denominator <= 0) {
139
+ return null;
140
+ }
141
+ return Math.min(100, Math.max(0, numerator / denominator * 100));
142
+ }
143
+ function computePopularityScore(downloads, likes, downloadsCap = 1e7, likesCap = 1e5) {
144
+ const downloadsScore = downloads !== null ? normalizeLogScore(downloads, downloadsCap) : null;
145
+ const likesScore = likes !== null ? normalizeLogScore(likes, likesCap) : null;
146
+ if (downloadsScore === null) {
147
+ return likesScore;
148
+ }
149
+ if (likesScore === null) {
150
+ return downloadsScore;
151
+ }
152
+ return downloadsScore * 0.7 + likesScore * 0.3;
153
+ }
154
+ function extractModelIndexMetrics(payload, maxMetrics = 60) {
155
+ const modelIndex = payload?.["model-index"] ?? payload?.model_index ?? payload?.modelIndex ?? payload?.cardData?.["model-index"];
156
+ if (!Array.isArray(modelIndex)) {
157
+ return [];
158
+ }
159
+ const metrics = [];
160
+ for (const entry of modelIndex) {
161
+ const results = asRecord(entry)?.results;
162
+ if (!Array.isArray(results)) {
163
+ continue;
164
+ }
165
+ for (const result of results) {
166
+ const block = asRecord(result)?.metrics;
167
+ const push = (name, rawValue) => {
168
+ const rawName = typeof name === "string" && name.trim() ? name.trim() : null;
169
+ const parsed = parseNumber(rawValue);
170
+ if (!rawName || parsed === null || !shouldIncludeMetric(rawName)) {
171
+ return;
172
+ }
173
+ const normalized = normalizeMetricValue(parsed);
174
+ if (normalized === null) {
175
+ return;
176
+ }
177
+ metrics.push({ name: rawName, value: normalized });
178
+ };
179
+ if (Array.isArray(block)) {
180
+ for (const metric of block) {
181
+ const record = asRecord(metric);
182
+ if (!record) {
183
+ continue;
184
+ }
185
+ const name = record.name ?? record.metric ?? record.type ?? null;
186
+ push(name, record.value);
187
+ if (metrics.length >= maxMetrics) {
188
+ return metrics;
189
+ }
190
+ }
191
+ } else if (block && typeof block === "object") {
192
+ for (const [name, value] of Object.entries(
193
+ block
194
+ )) {
195
+ push(name, value);
196
+ if (metrics.length >= maxMetrics) {
197
+ return metrics;
198
+ }
199
+ }
200
+ }
201
+ }
202
+ }
203
+ return metrics;
204
+ }
205
+ async function resolveHuggingFaceModelId(modelId, context, options = {}) {
206
+ const normalized = modelId.trim().toLowerCase();
207
+ if (!normalized) {
208
+ return null;
209
+ }
210
+ try {
211
+ const payload = await requestJson(`${options.openrouterApiBase ?? OPENROUTER_API_BASE}/models`, {
212
+ fetch: context.fetch,
213
+ timeoutMs: context.timeoutMs,
214
+ signal: context.signal
215
+ });
216
+ if (Array.isArray(payload.data)) {
217
+ const match = payload.data.find((entry) => {
218
+ const id = typeof entry.id === "string" ? entry.id.trim() : "";
219
+ return id.toLowerCase() === normalized;
220
+ });
221
+ const hfId = match && typeof match.hugging_face_id === "string" ? match.hugging_face_id.trim() : "";
222
+ if (hfId) {
223
+ return hfId;
224
+ }
225
+ }
226
+ } catch {
227
+ }
228
+ try {
229
+ const headers = options.token ? { authorization: `Bearer ${options.token}` } : {};
230
+ const payload = await requestJson(
231
+ `${options.huggingFaceApiBase ?? HF_API_BASE}/models?search=${encodeURIComponent(normalized)}`,
232
+ {
233
+ fetch: context.fetch,
234
+ headers,
235
+ timeoutMs: context.timeoutMs,
236
+ signal: context.signal
237
+ }
238
+ );
239
+ if (Array.isArray(payload)) {
240
+ const match = payload.find((entry) => {
241
+ const id2 = asRecord(entry)?.id;
242
+ return typeof id2 === "string" && modelIdMatches(id2, normalized);
243
+ });
244
+ const id = asRecord(match)?.id;
245
+ if (typeof id === "string" && id.trim()) {
246
+ return id.trim();
247
+ }
248
+ }
249
+ } catch {
250
+ }
251
+ return null;
252
+ }
253
+ function createOpenRouterEvalsHttpSource(options) {
254
+ return async (subject, context) => {
255
+ const url = typeof options.url === "function" ? options.url(subject) : options.url;
256
+ if (!url) {
257
+ return null;
258
+ }
259
+ const data = await requestJson(url, {
260
+ fetch: context.fetch,
261
+ timeoutMs: context.timeoutMs,
262
+ signal: context.signal
263
+ });
264
+ if (!data || !Array.isArray(data.rows)) {
265
+ return null;
266
+ }
267
+ return data;
268
+ };
269
+ }
270
+ const stripDateSuffix = (value) => {
271
+ const trimmed = value.trim().toLowerCase();
272
+ const match = trimmed.match(/^(.*?)-(\d{8}|\d{4}-\d{2}-\d{2}|\d{2}-\d{4})$/);
273
+ return match?.[1]?.trim() || null;
274
+ };
275
+ const buildBenchmarkCandidates = (normalizedId) => {
276
+ const candidates = /* @__PURE__ */ new Set([normalizedId, `${normalizedId}:free`]);
277
+ if (normalizedId.endsWith(":free")) {
278
+ candidates.add(normalizedId.slice(0, -":free".length));
279
+ }
280
+ return [...candidates];
281
+ };
282
+ function createOpenRouterBenchmarksSource(options = {}) {
283
+ const frontendBase = stripTrailingSlashes(
284
+ options.openrouterFrontendBaseUrl ?? OPENROUTER_FRONTEND_BASE
285
+ );
286
+ const apiBase = stripTrailingSlashes(
287
+ options.openrouterApiBaseUrl ?? OPENROUTER_API_BASE
288
+ );
289
+ const hfBase = stripTrailingSlashes(
290
+ options.huggingFaceApiBase ?? HF_API_BASE
291
+ );
292
+ const cacheTtlMs = options.cacheTtlMs ?? 24 * 60 * 60 * 1e3;
293
+ const preferHuggingFace = options.preferHuggingFace ?? true;
294
+ let cache = null;
295
+ const loadBenchmarks = async (context) => {
296
+ if (cache && Date.now() - cache.fetchedAt < cacheTtlMs) {
297
+ return cache;
298
+ }
299
+ const payload = await requestJson(`${frontendBase}/models/find?q=benchmarks`, {
300
+ fetch: context.fetch,
301
+ timeoutMs: context.timeoutMs,
302
+ signal: context.signal
303
+ });
304
+ const categories = payload.data?.categories;
305
+ if (!categories || typeof categories !== "object") {
306
+ return null;
307
+ }
308
+ const byModel = /* @__PURE__ */ new Map();
309
+ const categoryMaxRank = /* @__PURE__ */ new Map();
310
+ for (const [model, entries] of Object.entries(categories)) {
311
+ if (!Array.isArray(entries) || entries.length === 0) {
312
+ continue;
313
+ }
314
+ const normalizedModel = model.trim().toLowerCase();
315
+ if (!normalizedModel) {
316
+ continue;
317
+ }
318
+ const registerAlias = (alias) => {
319
+ const candidate = alias?.trim().toLowerCase() ?? "";
320
+ if (candidate && !byModel.has(candidate)) {
321
+ byModel.set(candidate, entries);
322
+ }
323
+ };
324
+ byModel.set(normalizedModel, entries);
325
+ const noFree = normalizedModel.endsWith(":free") ? normalizedModel.slice(0, -":free".length) : null;
326
+ registerAlias(noFree);
327
+ registerAlias(stripDateSuffix(normalizedModel));
328
+ registerAlias(noFree ? stripDateSuffix(noFree) : null);
329
+ for (const entry of entries) {
330
+ const category = typeof entry.category === "string" ? entry.category.trim().toLowerCase() : null;
331
+ const rank = parseNumber(entry.rank);
332
+ if (!category || rank === null) {
333
+ continue;
334
+ }
335
+ const currentMax = categoryMaxRank.get(category) ?? 0;
336
+ if (rank > currentMax) {
337
+ categoryMaxRank.set(category, rank);
338
+ }
339
+ }
340
+ }
341
+ cache = { fetchedAt: Date.now(), byModel, categoryMaxRank };
342
+ return cache;
343
+ };
344
+ return async (subject, context) => {
345
+ const modelId = resolveModelId(subject);
346
+ if (!modelId) {
347
+ return null;
348
+ }
349
+ const normalizedId = modelId.trim().toLowerCase();
350
+ let huggingFaceId = null;
351
+ if (preferHuggingFace) {
352
+ huggingFaceId = await resolveHuggingFaceModelId(modelId, context, {
353
+ openrouterApiBase: apiBase,
354
+ huggingFaceApiBase: hfBase
355
+ }).catch(() => null);
356
+ if (huggingFaceId) {
357
+ try {
358
+ const payload = await requestJson(
359
+ `${hfBase}/models/${encodeModelIdForPath(huggingFaceId)}`,
360
+ {
361
+ fetch: context.fetch,
362
+ timeoutMs: context.timeoutMs,
363
+ signal: context.signal
364
+ }
365
+ );
366
+ const metrics = extractModelIndexMetrics(payload);
367
+ if (metrics.length > 0) {
368
+ const score = metrics.reduce((sum, m) => sum + m.value, 0) / metrics.length;
369
+ return {
370
+ rows: [
371
+ {
372
+ model: modelId,
373
+ score,
374
+ weight: metrics.length
375
+ }
376
+ ],
377
+ coverageWeight: metrics.length,
378
+ sources: [HUGGINGFACE_MODEL_INDEX_SOURCE],
379
+ huggingFaceId
380
+ };
381
+ }
382
+ } catch {
383
+ }
384
+ }
385
+ }
386
+ const snapshot = await loadBenchmarks(context);
387
+ if (!snapshot) {
388
+ return null;
389
+ }
390
+ let entries;
391
+ for (const candidate of buildBenchmarkCandidates(normalizedId)) {
392
+ entries = snapshot.byModel.get(candidate);
393
+ if (entries?.length) {
394
+ break;
395
+ }
396
+ }
397
+ if (!entries?.length) {
398
+ return null;
399
+ }
400
+ const rows = [];
401
+ for (const entry of entries) {
402
+ const category = typeof entry.category === "string" ? entry.category.trim().toLowerCase() : void 0;
403
+ const rank = parseNumber(entry.rank);
404
+ if (!category || rank === null) {
405
+ continue;
406
+ }
407
+ const maxRank = snapshot.categoryMaxRank.get(category);
408
+ if (!maxRank || maxRank <= 0) {
409
+ continue;
410
+ }
411
+ const volume = parseNumber(entry.volume);
412
+ const count = parseNumber(entry.count);
413
+ rows.push({
414
+ model: modelId,
415
+ category,
416
+ rank,
417
+ outOf: maxRank,
418
+ score: (maxRank - rank + 1) / maxRank * 100,
419
+ weight: volume && volume > 0 ? volume : count && count > 0 ? count : 1
420
+ });
421
+ }
422
+ if (rows.length === 0) {
423
+ return null;
424
+ }
425
+ return {
426
+ rows,
427
+ coverageWeight: rows.reduce((sum, row) => sum + (row.weight ?? 1), 0),
428
+ sources: [OPENROUTER_CATEGORY_SOURCE],
429
+ huggingFaceId: huggingFaceId ?? void 0
430
+ };
431
+ };
16
432
  }
17
- function createOutputVerificationSignalAdapter(options) {
18
- const windowDays = options.windowDays ?? 7;
19
- const resolveAgentId = options.resolveAgentId ?? defaultResolveAgentId;
433
+ function createOpenRouterEvalsSignalAdapter(options = {}) {
434
+ const lowCoverageThreshold = options.lowCoverageThreshold ?? 5;
435
+ const minCategoryCount = options.minCategoryCount ?? 1;
436
+ const source = options.source ?? createOpenRouterBenchmarksSource();
20
437
  const collect = async (subject, context) => {
21
438
  const now = context.now.toISOString();
22
- const agentId = resolveAgentId(subject);
23
- if (!agentId || options.providers.length === 0) {
24
- return [{ signalId: "verification.summary", status: "missing" }];
25
- }
26
- const perProvider = [];
27
- let sawError = false;
28
- for (const provider of options.providers) {
29
- const url = `${provider.baseUrl.replace(/\/$/, "")}/v1/stats/${encodeURIComponent(agentId)}?window=${windowDays}d`;
30
- try {
31
- const stats = await requestJson(url, {
439
+ const modelId = resolveModelId(subject);
440
+ let data = null;
441
+ try {
442
+ data = await source(subject, context);
443
+ } catch (error) {
444
+ if (error instanceof Hcs25CollectorHttpError && error.status === 404) {
445
+ data = null;
446
+ } else {
447
+ return [
448
+ {
449
+ signalId: "openrouter.evals",
450
+ status: statusFromError(error),
451
+ fields: [
452
+ {
453
+ scope: "additional",
454
+ values: {
455
+ openrouterEvalStatus: "error",
456
+ openrouterEvalUpdatedAt: now
457
+ }
458
+ }
459
+ ]
460
+ }
461
+ ];
462
+ }
463
+ }
464
+ const rows = data && modelId ? data.rows.filter((row) => modelIdMatches(row.model, modelId)) : [];
465
+ if (!data || rows.length === 0) {
466
+ return [
467
+ {
468
+ signalId: "openrouter.evals",
469
+ status: "missing",
470
+ fields: [
471
+ {
472
+ scope: "additional",
473
+ values: {
474
+ openrouterEvalStatus: "missing",
475
+ openrouterEvalUpdatedAt: now,
476
+ openrouterEvalMetricsCount: 0
477
+ }
478
+ }
479
+ ]
480
+ }
481
+ ];
482
+ }
483
+ let weightedSum = 0;
484
+ let totalWeight = 0;
485
+ const categoryStats = /* @__PURE__ */ new Map();
486
+ for (const row of rows) {
487
+ const score2 = typeof row.score === "number" ? row.score : typeof row.rank === "number" && typeof row.outOf === "number" && row.outOf > 0 ? (row.outOf - row.rank + 1) / row.outOf * 100 : null;
488
+ if (score2 === null) {
489
+ continue;
490
+ }
491
+ const weight = row.weight ?? 1;
492
+ weightedSum += score2 * weight;
493
+ totalWeight += weight;
494
+ if (row.category) {
495
+ const existing = categoryStats.get(row.category) ?? {
496
+ scoreSum: 0,
497
+ weightSum: 0
498
+ };
499
+ existing.scoreSum += score2 * weight;
500
+ existing.weightSum += weight;
501
+ categoryStats.set(row.category, existing);
502
+ }
503
+ }
504
+ if (totalWeight <= 0) {
505
+ return [
506
+ {
507
+ signalId: "openrouter.evals",
508
+ status: "missing",
509
+ fields: [
510
+ {
511
+ scope: "additional",
512
+ values: {
513
+ openrouterEvalStatus: "missing",
514
+ openrouterEvalUpdatedAt: now
515
+ }
516
+ }
517
+ ]
518
+ }
519
+ ];
520
+ }
521
+ const score = Math.min(100, Math.max(0, weightedSum / totalWeight));
522
+ const coverageWeight = data.coverageWeight ?? (data.totalCategories && data.totalCategories > 0 ? categoryStats.size / data.totalCategories : totalWeight);
523
+ const status = categoryStats.size < minCategoryCount || coverageWeight < lowCoverageThreshold ? "low-coverage" : "ok";
524
+ const topCategories = [...categoryStats.entries()].map(([category, stats]) => ({
525
+ category,
526
+ score: (stats.weightSum > 0 ? Math.min(100, Math.max(0, stats.scoreSum / stats.weightSum)) : 0) * Math.min(1, Math.max(0, stats.weightSum / lowCoverageThreshold)),
527
+ weight: stats.weightSum
528
+ })).sort((a, b) => b.score - a.score || b.weight - a.weight).slice(0, 5).map((entry) => entry.category);
529
+ return [
530
+ {
531
+ signalId: "openrouter.evals",
532
+ status: "ok",
533
+ value: score,
534
+ fields: [
535
+ {
536
+ scope: "additional",
537
+ values: {
538
+ openrouterEvalScore: Math.round(score * 100) / 100,
539
+ openrouterEvalStatus: status,
540
+ openrouterEvalUpdatedAt: now,
541
+ openrouterEvalSources: data.sources && data.sources.length > 0 ? [...data.sources] : [OPENROUTER_CATEGORY_SOURCE],
542
+ openrouterEvalMetricsCount: rows.length,
543
+ openrouterEvalCategoryCount: categoryStats.size,
544
+ openrouterEvalCoverageWeight: Math.round(coverageWeight * 1e3) / 1e3,
545
+ ...topCategories.length > 0 ? { openrouterEvalCategories: topCategories } : {},
546
+ ...data.huggingFaceId ? { openrouterHuggingFaceId: data.huggingFaceId } : {}
547
+ }
548
+ }
549
+ ],
550
+ provenance: {
551
+ source: "openrouter",
552
+ subjectId: modelId,
553
+ fetchedAt: now
554
+ }
555
+ }
556
+ ];
557
+ };
558
+ return {
559
+ id: "openrouter-evals",
560
+ produces: ["openrouter.evals"],
561
+ timeoutMs: options.timeoutMs,
562
+ includeRegistries: options.includeRegistries ?? DEFAULT_MODEL_REGISTRIES,
563
+ appliesTo: options.appliesTo,
564
+ collect
565
+ };
566
+ }
567
+ function createJsonLeaderboardSource(options) {
568
+ const modelKey = options.modelKey ?? "model";
569
+ const scoreKey = options.scoreKey ?? "score";
570
+ const votesKey = options.votesKey ?? "votes";
571
+ return async (_subject, context) => {
572
+ const data = await requestJson(options.url, {
573
+ fetch: context.fetch,
574
+ timeoutMs: context.timeoutMs,
575
+ signal: context.signal
576
+ });
577
+ const record = asRecord(data);
578
+ const rows = Array.isArray(data) ? data : record?.entries ?? record?.rows ?? record?.leaderboard;
579
+ if (!Array.isArray(rows)) {
580
+ return null;
581
+ }
582
+ const entries = [];
583
+ for (const row of rows) {
584
+ const rowRecord = asRecord(row);
585
+ if (!rowRecord) {
586
+ continue;
587
+ }
588
+ const model = readString(rowRecord, modelKey);
589
+ const score = rowRecord[scoreKey];
590
+ const votes = rowRecord[votesKey];
591
+ if (!model || typeof score !== "number" || !Number.isFinite(score)) {
592
+ continue;
593
+ }
594
+ entries.push({
595
+ model,
596
+ score,
597
+ votes: typeof votes === "number" ? votes : void 0
598
+ });
599
+ }
600
+ return entries;
601
+ };
602
+ }
603
+ const stripHtmlTags = (html) => {
604
+ let current = html;
605
+ for (; ; ) {
606
+ const next = current.replace(/<[^<>]*>/g, "");
607
+ if (next === current) {
608
+ return next;
609
+ }
610
+ current = next;
611
+ }
612
+ };
613
+ const decodeHtmlEntities = (html) => html.replace(/&nbsp;/gi, " ").replace(/&lt;/gi, "<").replace(/&gt;/gi, ">").replace(/&quot;/gi, '"').replace(/&#39;/g, "'").replace(/&#(\d+);/g, (_match, codepoint) => {
614
+ const parsed = Number(codepoint);
615
+ if (!Number.isFinite(parsed) || parsed <= 0) {
616
+ return "";
617
+ }
618
+ try {
619
+ return String.fromCodePoint(parsed);
620
+ } catch {
621
+ return "";
622
+ }
623
+ }).replace(/&amp;/gi, "&");
624
+ const normalizeArenaLabel = (value) => {
625
+ const trimmed = value.trim();
626
+ const open = trimmed.lastIndexOf("(");
627
+ const base = open > 0 && trimmed.endsWith(")") ? trimmed.slice(0, open).trim() : trimmed;
628
+ const suffix = open > 0 && trimmed.endsWith(")") ? trimmed.slice(open + 1, -1).trim() : null;
629
+ const compactSuffix = suffix?.split(/\s+/).join("") ?? "";
630
+ const isDate = suffix !== null && (/^20\d{2}-\d{2}-\d{2}$/.test(suffix) || /^20\d{2}\d{2}\d{2}$/.test(compactSuffix));
631
+ const combined = !isDate && suffix ? `${base} ${suffix}` : base;
632
+ const slugged = combined.toLowerCase().replace(/[^a-z0-9]+/g, "-");
633
+ let start = 0;
634
+ let end = slugged.length;
635
+ while (start < end && slugged.charCodeAt(start) === 45) {
636
+ start += 1;
637
+ }
638
+ while (end > start && slugged.charCodeAt(end - 1) === 45) {
639
+ end -= 1;
640
+ }
641
+ return slugged.slice(start, end);
642
+ };
643
+ const normalizeAlphaNum = (value) => value.toLowerCase().replace(/[^a-z0-9]+/g, "");
644
+ const stripTrailingDateSuffix = (value) => {
645
+ const match = value.trim().toLowerCase().match(/^(.*?)-(20\d{2}-\d{2}-\d{2})$/) ?? value.trim().toLowerCase().match(/^(.*?)-(20\d{2}\d{2})$/);
646
+ return match?.[1]?.trim() || null;
647
+ };
648
+ function buildArenaMatchKeys(label, organization) {
649
+ const normalized = normalizeArenaLabel(label);
650
+ const keys = /* @__PURE__ */ new Set();
651
+ if (!normalized) {
652
+ return [];
653
+ }
654
+ const pushKey = (value) => {
655
+ const candidate = value?.trim() ?? "";
656
+ if (!candidate) {
657
+ return;
658
+ }
659
+ keys.add(candidate);
660
+ keys.add(normalizeAlphaNum(candidate));
661
+ };
662
+ const expandChatGptAliases = (value) => {
663
+ if (value.startsWith("chatgpt-")) {
664
+ pushKey(`gpt-${value.slice("chatgpt-".length)}`);
665
+ }
666
+ if (value.startsWith("gpt-")) {
667
+ const rest = value.slice("gpt-".length);
668
+ pushKey(`chatgpt-${rest}`);
669
+ pushKey(`chatgpt-${rest}-latest`);
670
+ }
671
+ };
672
+ const expandDateAliases = (value) => {
673
+ const stripped = stripTrailingDateSuffix(value);
674
+ if (stripped) {
675
+ pushKey(stripped);
676
+ expandChatGptAliases(stripped);
677
+ }
678
+ };
679
+ pushKey(normalized);
680
+ const org = normalizeArenaLabel(organization ?? "");
681
+ if (org) {
682
+ pushKey(`${org}-${normalized}`);
683
+ pushKey(`${org}/${normalized}`);
684
+ }
685
+ expandChatGptAliases(normalized);
686
+ expandDateAliases(normalized);
687
+ if (normalized.endsWith("-latest")) {
688
+ const without = normalized.slice(0, -"-latest".length);
689
+ pushKey(without);
690
+ expandChatGptAliases(without);
691
+ expandDateAliases(without);
692
+ }
693
+ return [...keys].filter(Boolean);
694
+ }
695
+ const arenaCandidateKeys = (modelId) => {
696
+ const base = modelId.trim().toLowerCase().replace(/:free$/i, "");
697
+ const candidates = /* @__PURE__ */ new Set();
698
+ const add = (value) => {
699
+ const trimmed = value.trim();
700
+ if (trimmed) {
701
+ candidates.add(normalizeArenaLabel(trimmed));
702
+ candidates.add(normalizeAlphaNum(trimmed));
703
+ }
704
+ };
705
+ add(base);
706
+ add(base.replace(/\//g, "-"));
707
+ const withoutFast = base.replace(/-fast$/i, "");
708
+ if (withoutFast !== base) {
709
+ add(withoutFast);
710
+ }
711
+ const stripped = stripTrailingDateSuffix(base);
712
+ if (stripped) {
713
+ add(stripped);
714
+ }
715
+ if (base.startsWith("gpt-")) {
716
+ add(`chatgpt-${base.slice(4)}`);
717
+ }
718
+ if (base.startsWith("chatgpt-")) {
719
+ add(`gpt-${base.slice(8)}`);
720
+ }
721
+ if (base.endsWith("-latest")) {
722
+ add(base.slice(0, -"-latest".length));
723
+ }
724
+ const orgPrefix = base.includes("/") ? base.split("/")[0] : null;
725
+ if (orgPrefix) {
726
+ const model = base.slice(orgPrefix.length + 1);
727
+ add(`${orgPrefix}-${model}`);
728
+ add(`${orgPrefix}/${model}`);
729
+ }
730
+ return [...candidates].filter(Boolean);
731
+ };
732
+ function createOpenLmArenaSource(options = {}) {
733
+ const url = options.url ?? OPENLM_ARENA_URL;
734
+ const cacheTtlMs = options.cacheTtlMs ?? 24 * 60 * 60 * 1e3;
735
+ let cache = null;
736
+ return async (_subject, context) => {
737
+ if (cache && Date.now() - cache.fetchedAt < cacheTtlMs) {
738
+ return cache.entries;
739
+ }
740
+ const html = await requestText(url, {
741
+ fetch: context.fetch,
742
+ timeoutMs: context.timeoutMs,
743
+ signal: context.signal,
744
+ headers: { accept: "text/html" }
745
+ });
746
+ const tableMatch = html.match(
747
+ /<table[^>]*class=sortable[^>]*>.*?<\/table>/is
748
+ );
749
+ if (!tableMatch) {
750
+ return null;
751
+ }
752
+ const tbodyMatch = tableMatch[0].match(/<tbody[^>]*>(.*?)<\/tbody>/is);
753
+ const tbody = tbodyMatch?.[1];
754
+ if (!tbody) {
755
+ return null;
756
+ }
757
+ const entries = [];
758
+ for (const rowMatch of tbody.matchAll(/<tr[^>]*>(.*?)<\/tr>/gis)) {
759
+ const rowHtml = rowMatch[1] ?? "";
760
+ if (!rowHtml) {
761
+ continue;
762
+ }
763
+ const cells = Array.from(rowHtml.matchAll(/<td[^>]*>(.*?)<\/td>/gis)).map(
764
+ (match) => match[1] ?? ""
765
+ );
766
+ const rawLabelCell = cells[1];
767
+ const rawScoreCell = cells[2];
768
+ const rawOrgCell = cells[8];
769
+ const modelLabel = decodeHtmlEntities(
770
+ stripHtmlTags(rawLabelCell ?? "")
771
+ ).trim();
772
+ if (!modelLabel) {
773
+ continue;
774
+ }
775
+ const score = parseNumber(
776
+ decodeHtmlEntities(stripHtmlTags(rawScoreCell ?? "")).trim()
777
+ );
778
+ if (score === null) {
779
+ continue;
780
+ }
781
+ const organization = decodeHtmlEntities(stripHtmlTags(rawOrgCell ?? "")).trim() || void 0;
782
+ entries.push({ model: modelLabel, score, organization });
783
+ }
784
+ if (entries.length === 0) {
785
+ return null;
786
+ }
787
+ cache = { fetchedAt: Date.now(), entries };
788
+ return entries;
789
+ };
790
+ }
791
+ function createChatbotArenaSignalAdapter(options = {}) {
792
+ const source = options.source ?? createOpenLmArenaSource();
793
+ const collect = async (subject, context) => {
794
+ const now = context.now.toISOString();
795
+ const modelId = resolveModelId(subject);
796
+ const wanted = /* @__PURE__ */ new Set();
797
+ for (const id of [modelId, ...options.aliases ?? []]) {
798
+ if (!id) {
799
+ continue;
800
+ }
801
+ for (const key of arenaCandidateKeys(id)) {
802
+ wanted.add(key);
803
+ }
804
+ wanted.add(id.trim().toLowerCase());
805
+ }
806
+ let entries = null;
807
+ try {
808
+ entries = await source(subject, context);
809
+ } catch (error) {
810
+ return [
811
+ {
812
+ signalId: "chatbot-arena.eval",
813
+ status: statusFromError(error)
814
+ }
815
+ ];
816
+ }
817
+ const entry = entries?.find((candidate) => {
818
+ if (wanted.has(candidate.model.trim().toLowerCase()) || [...wanted].some((id) => modelIdMatches(candidate.model, id))) {
819
+ return true;
820
+ }
821
+ const keys = buildArenaMatchKeys(
822
+ candidate.model,
823
+ candidate.organization
824
+ );
825
+ return keys.some((key) => wanted.has(key));
826
+ }) ?? null;
827
+ if (!entries || entries.length === 0 || !entry) {
828
+ return [
829
+ {
830
+ signalId: "chatbot-arena.eval",
831
+ status: "missing",
832
+ fields: [
833
+ {
834
+ scope: "additional",
835
+ values: {
836
+ chatbotArenaEvalStatus: "missing",
837
+ chatbotArenaEvalUpdatedAt: now
838
+ }
839
+ }
840
+ ]
841
+ }
842
+ ];
843
+ }
844
+ const scores = entries.map((e) => e.score);
845
+ const min = Math.min(...scores);
846
+ const max = Math.max(...scores);
847
+ const normalized = max > min ? 100 * (entry.score - min) / (max - min) : 50;
848
+ return [
849
+ {
850
+ signalId: "chatbot-arena.eval",
851
+ status: "ok",
852
+ value: Math.round(normalized * 100) / 100,
853
+ fields: [
854
+ {
855
+ scope: "additional",
856
+ values: {
857
+ chatbotArenaEvalScore: Math.round(normalized * 100) / 100,
858
+ chatbotArenaEvalElo: entry.score,
859
+ chatbotArenaEvalVotes: entry.votes ?? null,
860
+ chatbotArenaEvalStatus: "ok",
861
+ chatbotArenaEvalUpdatedAt: now,
862
+ chatbotArenaEvalSources: [CHATBOT_ARENA_SOURCE]
863
+ }
864
+ }
865
+ ],
866
+ provenance: {
867
+ source: "chatbot-arena",
868
+ subjectId: entry.model,
869
+ fetchedAt: now
870
+ }
871
+ }
872
+ ];
873
+ };
874
+ return {
875
+ id: "chatbot-arena",
876
+ produces: ["chatbot-arena.eval"],
877
+ timeoutMs: options.timeoutMs,
878
+ includeRegistries: options.includeRegistries ?? DEFAULT_MODEL_REGISTRIES,
879
+ appliesTo: options.appliesTo,
880
+ collect
881
+ };
882
+ }
883
+ function createHuggingFaceSignalAdapter(options = {}) {
884
+ const apiBase = stripTrailingSlashes(options.apiBase ?? HF_API_BASE);
885
+ const collect = async (subject, context) => {
886
+ const now = context.now.toISOString();
887
+ const additional = readSubjectAdditional(subject);
888
+ const storedHfId = readString(additional, "huggingFaceModelId") ?? readString(additional, "openrouterHuggingFaceId");
889
+ const modelId = resolveModelId(subject);
890
+ if (!modelId && !storedHfId) {
891
+ return [
892
+ {
893
+ signalId: "huggingface.model_index",
894
+ status: "missing",
895
+ fields: [
896
+ {
897
+ scope: "additional",
898
+ values: {
899
+ huggingFaceEvalStatus: "missing",
900
+ huggingFaceEvalUpdatedAt: now
901
+ }
902
+ }
903
+ ]
904
+ }
905
+ ];
906
+ }
907
+ try {
908
+ const headers = options.token ? { authorization: `Bearer ${options.token}` } : {};
909
+ let huggingFaceId = storedHfId ?? modelId;
910
+ let resolvedViaOpenRouter = false;
911
+ if (!storedHfId && options.resolveHuggingFaceId !== false && modelId) {
912
+ const resolved = await resolveHuggingFaceModelId(modelId, context, {
913
+ huggingFaceApiBase: apiBase,
914
+ openrouterApiBase: options.openrouterApiBase,
915
+ token: options.token
916
+ }).catch(() => null);
917
+ if (resolved) {
918
+ huggingFaceId = resolved;
919
+ resolvedViaOpenRouter = true;
920
+ }
921
+ }
922
+ const data = await requestJson(
923
+ `${apiBase}/models/${encodeModelIdForPath(huggingFaceId)}`,
924
+ {
32
925
  fetch: context.fetch,
926
+ headers,
33
927
  timeoutMs: context.timeoutMs,
34
928
  signal: context.signal
35
- });
36
- perProvider.push({ provider, stats });
37
- } catch (error) {
38
- if (!(error instanceof Hcs25CollectorHttpError && error.status === 404)) {
39
- sawError = true;
40
929
  }
930
+ );
931
+ const metrics = extractModelIndexMetrics(data, options.maxMetrics ?? 60);
932
+ const modelIndexScore = metrics.length > 0 ? metrics.reduce((sum, m) => sum + m.value, 0) / metrics.length : null;
933
+ const downloads = parseNumber(data.downloads);
934
+ const likes = parseNumber(data.likes);
935
+ const popularityScore = computePopularityScore(
936
+ downloads,
937
+ likes,
938
+ options.downloadsCap ?? 1e7,
939
+ options.likesCap ?? 1e5
940
+ );
941
+ let score = null;
942
+ let mode;
943
+ if (modelIndexScore !== null && popularityScore !== null) {
944
+ score = modelIndexScore * 0.8 + popularityScore * 0.2;
945
+ mode = "mixed";
946
+ } else if (modelIndexScore !== null) {
947
+ score = modelIndexScore;
948
+ mode = "model-index";
949
+ } else if (popularityScore !== null) {
950
+ score = popularityScore;
951
+ mode = "popularity";
952
+ } else {
953
+ mode = "missing";
41
954
  }
42
- }
43
- if (perProvider.length === 0) {
955
+ const normalized = score === null ? null : Math.round(Math.min(100, Math.max(0, score)) * 100) / 100;
956
+ const sources = [];
957
+ if (modelIndexScore !== null) {
958
+ sources.push(HUGGINGFACE_MODEL_INDEX_SOURCE);
959
+ }
960
+ if (popularityScore !== null) {
961
+ sources.push(HUGGINGFACE_POPULARITY_SOURCE);
962
+ }
963
+ return [
964
+ {
965
+ signalId: "huggingface.model_index",
966
+ status: normalized === null ? "missing" : "ok",
967
+ value: normalized,
968
+ fields: [
969
+ {
970
+ scope: "additional",
971
+ values: {
972
+ huggingFaceModelId: typeof data.id === "string" && data.id.trim() ? data.id : huggingFaceId,
973
+ huggingFaceEvalScore: normalized,
974
+ huggingFaceSignalScore: normalized,
975
+ huggingFaceEvalMetricsCount: metrics.length,
976
+ huggingFaceDownloads: downloads,
977
+ huggingFaceLikes: likes,
978
+ huggingFaceEvalMode: mode,
979
+ huggingFaceEvalStatus: normalized === null ? "missing" : "ok",
980
+ huggingFaceEvalUpdatedAt: now,
981
+ huggingFaceEvalSources: sources,
982
+ ...resolvedViaOpenRouter ? { openrouterHuggingFaceId: huggingFaceId } : {}
983
+ }
984
+ }
985
+ ],
986
+ provenance: {
987
+ source: "huggingface",
988
+ sourceUrl: `${apiBase}/models/${encodeModelIdForPath(huggingFaceId)}`,
989
+ subjectId: huggingFaceId,
990
+ fetchedAt: now
991
+ }
992
+ }
993
+ ];
994
+ } catch (error) {
995
+ const missing = error instanceof Hcs25CollectorHttpError && error.status === 404;
44
996
  return [
45
997
  {
46
- signalId: "verification.summary",
47
- status: sawError ? "error" : "missing"
998
+ signalId: "huggingface.model_index",
999
+ status: missing ? "missing" : statusFromError(error),
1000
+ fields: [
1001
+ {
1002
+ scope: "additional",
1003
+ values: {
1004
+ huggingFaceEvalStatus: missing ? "missing" : "error",
1005
+ huggingFaceEvalUpdatedAt: now
1006
+ }
1007
+ }
1008
+ ]
48
1009
  }
49
1010
  ];
50
1011
  }
51
- let totalChecks = 0;
52
- let allowSum = 0;
53
- let blockSum = 0;
54
- let uncertainSum = 0;
55
- let confidenceSum = 0;
56
- const stakeTotals = {};
57
- const providersOut = [];
58
- for (const { provider, stats } of perProvider) {
59
- const checks = Math.max(0, Math.floor(stats.totalChecks ?? 0));
60
- totalChecks += checks;
61
- const weight = checks > 0 ? checks : 1;
62
- allowSum += (stats.allowRate ?? 0) * weight;
63
- blockSum += (stats.blockRate ?? 0) * weight;
64
- uncertainSum += (stats.uncertainRate ?? 0) * weight;
65
- confidenceSum += (stats.avgConfidence ?? 0) * weight;
66
- for (const [level, levelStats] of Object.entries(
67
- stats.stakeDistribution ?? {}
1012
+ };
1013
+ return {
1014
+ id: "huggingface-model-index",
1015
+ produces: ["huggingface.model_index"],
1016
+ timeoutMs: options.timeoutMs,
1017
+ includeRegistries: options.includeRegistries ?? DEFAULT_MODEL_REGISTRIES,
1018
+ appliesTo: options.appliesTo,
1019
+ collect
1020
+ };
1021
+ }
1022
+ function createOpenLlmJsonSource(options) {
1023
+ const modelKey = options.modelKey ?? "model";
1024
+ return async (_subject, context) => {
1025
+ const data = await requestJson(options.url, {
1026
+ fetch: context.fetch,
1027
+ timeoutMs: context.timeoutMs,
1028
+ signal: context.signal
1029
+ });
1030
+ const record = asRecord(data);
1031
+ const rows = Array.isArray(data) ? data : record?.rows;
1032
+ if (!Array.isArray(rows)) {
1033
+ return null;
1034
+ }
1035
+ const out = [];
1036
+ for (const row of rows) {
1037
+ const rowRecord = asRecord(row);
1038
+ if (!rowRecord) {
1039
+ continue;
1040
+ }
1041
+ const model = readString(rowRecord, modelKey);
1042
+ if (!model) {
1043
+ continue;
1044
+ }
1045
+ const metrics = {};
1046
+ for (const [key, value] of Object.entries(rowRecord)) {
1047
+ const parsed = parseNumber(value);
1048
+ if (key !== modelKey && parsed !== null) {
1049
+ metrics[key] = parsed;
1050
+ }
1051
+ }
1052
+ out.push({ model, metrics });
1053
+ }
1054
+ return out;
1055
+ };
1056
+ }
1057
+ const tokenizeForSimilarity = (value) => new Set(
1058
+ value.toLowerCase().split(/[^a-z0-9]+/).filter((token) => token.length > 1)
1059
+ );
1060
+ const jaccardSimilarity = (a, b) => {
1061
+ if (a.size === 0 || b.size === 0) {
1062
+ return 0;
1063
+ }
1064
+ let intersection = 0;
1065
+ for (const token of a) {
1066
+ if (b.has(token)) {
1067
+ intersection += 1;
1068
+ }
1069
+ }
1070
+ return intersection / (a.size + b.size - intersection);
1071
+ };
1072
+ function createOpenLlmHuggingFaceSource(options = {}) {
1073
+ const apiBase = stripTrailingSlashes(
1074
+ options.huggingFaceApiBase ?? HF_API_BASE
1075
+ );
1076
+ const datasetsBase = stripTrailingSlashes(
1077
+ options.huggingFaceDatasetsBase ?? HF_DATASETS_BASE
1078
+ );
1079
+ const datasetId = options.datasetId ?? OPENLLM_DATASET_ID;
1080
+ const branch = options.datasetBranch ?? OPENLLM_DATASET_BRANCH;
1081
+ const cacheTtlMs = options.cacheTtlMs ?? 24 * 60 * 60 * 1e3;
1082
+ const minSimilarity = options.minSimilarity ?? 0.6;
1083
+ const pathCache = /* @__PURE__ */ new Map();
1084
+ const orgCache = /* @__PURE__ */ new Map();
1085
+ const listTree = async (context, path) => {
1086
+ const url = `${apiBase}/datasets/${datasetId}/tree/${branch}/${encodeModelIdForPath(path)}`;
1087
+ const payload = await requestJson(url, {
1088
+ fetch: context.fetch,
1089
+ timeoutMs: context.timeoutMs,
1090
+ signal: context.signal
1091
+ });
1092
+ return Array.isArray(payload) ? payload : [];
1093
+ };
1094
+ const latestResultsPath = async (context, dir) => {
1095
+ const candidates = (await listTree(context, dir)).map((entry) => typeof entry.path === "string" ? entry.path : "").filter((path) => path.includes("results_") && path.endsWith(".json"));
1096
+ return candidates.length > 0 ? candidates.sort().at(-1) ?? null : null;
1097
+ };
1098
+ const resolveViaOrg = async (context, huggingFaceId) => {
1099
+ const slashIndex = huggingFaceId.indexOf("/");
1100
+ if (slashIndex <= 0 || slashIndex === huggingFaceId.length - 1) {
1101
+ return null;
1102
+ }
1103
+ const org = huggingFaceId.slice(0, slashIndex);
1104
+ const repo = huggingFaceId.slice(slashIndex + 1);
1105
+ if (!org || !repo) {
1106
+ return null;
1107
+ }
1108
+ const orgKey = org.toLowerCase();
1109
+ let paths;
1110
+ const cached = orgCache.get(orgKey);
1111
+ if (cached && Date.now() - cached.fetchedAt < cacheTtlMs) {
1112
+ paths = cached.paths;
1113
+ } else {
1114
+ try {
1115
+ paths = (await listTree(context, org)).map((entry) => typeof entry.path === "string" ? entry.path : "").filter(
1116
+ (path) => path.startsWith(`${org}/`) && !path.slice(org.length + 1).includes("/") && path.slice(org.length + 1).length > 0
1117
+ );
1118
+ } catch {
1119
+ return null;
1120
+ }
1121
+ orgCache.set(orgKey, { paths, fetchedAt: Date.now() });
1122
+ }
1123
+ if (paths.length === 0) {
1124
+ return null;
1125
+ }
1126
+ const targetTokens = tokenizeForSimilarity(repo);
1127
+ let bestPath = null;
1128
+ let bestSimilarity = 0;
1129
+ for (const path of paths) {
1130
+ const candidateRepo = path.slice(org.length + 1);
1131
+ const similarity = jaccardSimilarity(
1132
+ targetTokens,
1133
+ tokenizeForSimilarity(candidateRepo)
1134
+ );
1135
+ if (similarity > bestSimilarity) {
1136
+ bestSimilarity = similarity;
1137
+ bestPath = path;
1138
+ }
1139
+ }
1140
+ if (!bestPath || bestSimilarity < minSimilarity) {
1141
+ return null;
1142
+ }
1143
+ try {
1144
+ return await latestResultsPath(context, bestPath);
1145
+ } catch {
1146
+ return null;
1147
+ }
1148
+ };
1149
+ const resolveResultsPath = async (context, huggingFaceId) => {
1150
+ const key = huggingFaceId.toLowerCase();
1151
+ const cached = pathCache.get(key);
1152
+ if (cached && Date.now() - cached.fetchedAt < cacheTtlMs) {
1153
+ return cached.path;
1154
+ }
1155
+ let path = null;
1156
+ try {
1157
+ path = await latestResultsPath(context, huggingFaceId);
1158
+ } catch {
1159
+ path = null;
1160
+ }
1161
+ if (!path) {
1162
+ path = await resolveViaOrg(context, huggingFaceId);
1163
+ }
1164
+ pathCache.set(key, { path, fetchedAt: Date.now() });
1165
+ return path;
1166
+ };
1167
+ return async (subject, context) => {
1168
+ const additional = readSubjectAdditional(subject);
1169
+ const huggingFaceId = readString(additional, "huggingFaceModelId") ?? readString(additional, "openrouterHuggingFaceId") ?? resolveModelId(subject);
1170
+ if (!huggingFaceId) {
1171
+ return null;
1172
+ }
1173
+ const resultPath = await resolveResultsPath(context, huggingFaceId);
1174
+ if (!resultPath) {
1175
+ return null;
1176
+ }
1177
+ const url = `${datasetsBase}/${datasetId}/resolve/${branch}/${resultPath}`;
1178
+ const payload = await requestJson(url, {
1179
+ fetch: context.fetch,
1180
+ timeoutMs: context.timeoutMs,
1181
+ signal: context.signal
1182
+ });
1183
+ const results = asRecord(payload)?.results;
1184
+ if (!isJsonObject(results)) {
1185
+ return null;
1186
+ }
1187
+ const metrics = {};
1188
+ for (const groupValue of Object.values(
1189
+ results
1190
+ )) {
1191
+ if (!isJsonObject(groupValue)) {
1192
+ continue;
1193
+ }
1194
+ for (const [name, rawValue] of Object.entries(
1195
+ groupValue
68
1196
  )) {
69
- const levelChecks = Math.max(0, Math.floor(levelStats.checks ?? 0));
70
- if (levelChecks <= 0) {
1197
+ const normalizedName = name.trim().toLowerCase();
1198
+ if (!normalizedName || normalizedName.includes("stderr") || normalizedName === "alias") {
71
1199
  continue;
72
1200
  }
73
- const bucket = stakeTotals[level] ?? (stakeTotals[level] = { checks: 0, allowRate: 0, confidence: 0 });
74
- bucket.checks += levelChecks;
75
- bucket.allowRate += (levelStats.allowRate ?? 0) * levelChecks;
76
- bucket.confidence += (levelStats.avgConfidence ?? 0) * levelChecks;
1201
+ const value = parseNumber(rawValue);
1202
+ if (value === null || !shouldIncludeMetric(normalizedName)) {
1203
+ continue;
1204
+ }
1205
+ metrics[name] = value;
77
1206
  }
78
- providersOut.push({
79
- id: provider.id,
80
- signerAddress: provider.signerAddress ?? null,
81
- methodologyUrl: provider.methodologyUrl ?? null,
82
- checksContributed: checks
83
- });
84
1207
  }
85
- const divisor = perProvider.reduce(
86
- (sum, { stats }) => sum + Math.max(0, Math.floor(stats.totalChecks ?? 0) || 1),
87
- 0
88
- );
89
- const stakeDistribution = {};
90
- for (const [level, bucket] of Object.entries(stakeTotals)) {
91
- stakeDistribution[level] = {
92
- checks: bucket.checks,
93
- allowRate: bucket.allowRate / bucket.checks,
94
- avgConfidence: bucket.confidence / bucket.checks
95
- };
1208
+ if (Object.keys(metrics).length === 0) {
1209
+ return null;
96
1210
  }
97
- const summary = {
98
- allowRate: clamp01(allowSum / divisor) ?? 0,
99
- blockRate: clamp01(blockSum / divisor) ?? 0,
100
- uncertainRate: clamp01(uncertainSum / divisor),
101
- avgConfidence: clamp01(confidenceSum / divisor) ?? 0,
102
- totalChecks,
103
- stakeDistribution: Object.keys(stakeDistribution).length > 0 ? stakeDistribution : null,
104
- windowDays,
105
- providers: providersOut,
106
- updatedAt: now
107
- };
1211
+ return [{ model: huggingFaceId, metrics }];
1212
+ };
1213
+ }
1214
+ function createOpenLlmSignalAdapter(options = {}) {
1215
+ const source = options.source ?? createOpenLlmHuggingFaceSource();
1216
+ const collect = async (subject, context) => {
1217
+ const now = context.now.toISOString();
1218
+ const modelId = resolveModelId(subject);
1219
+ if (!modelId) {
1220
+ return [
1221
+ {
1222
+ signalId: "openllm.leaderboard",
1223
+ status: "missing",
1224
+ fields: [
1225
+ {
1226
+ scope: "additional",
1227
+ values: {
1228
+ openLlmEvalStatus: "missing",
1229
+ openLlmEvalUpdatedAt: now
1230
+ }
1231
+ }
1232
+ ]
1233
+ }
1234
+ ];
1235
+ }
1236
+ let rows = null;
1237
+ try {
1238
+ rows = await source(subject, context);
1239
+ } catch (error) {
1240
+ return [
1241
+ {
1242
+ signalId: "openllm.leaderboard",
1243
+ status: statusFromError(error),
1244
+ fields: [
1245
+ {
1246
+ scope: "additional",
1247
+ values: {
1248
+ openLlmEvalStatus: "error",
1249
+ openLlmEvalUpdatedAt: now
1250
+ }
1251
+ }
1252
+ ]
1253
+ }
1254
+ ];
1255
+ }
1256
+ const row = rows?.find((candidate) => modelIdMatches(candidate.model, modelId)) ?? (rows?.length === 1 ? rows[0] : null);
1257
+ if (!row) {
1258
+ return [
1259
+ {
1260
+ signalId: "openllm.leaderboard",
1261
+ status: "missing",
1262
+ fields: [
1263
+ {
1264
+ scope: "additional",
1265
+ values: {
1266
+ openLlmEvalStatus: "missing",
1267
+ openLlmEvalUpdatedAt: now
1268
+ }
1269
+ }
1270
+ ]
1271
+ }
1272
+ ];
1273
+ }
1274
+ const values = Object.values(row.metrics).map(normalizeMetricValue).filter((value) => value !== null);
1275
+ const score = values.length > 0 ? Math.round(
1276
+ values.reduce((sum, v) => sum + v, 0) / values.length * 100
1277
+ ) / 100 : null;
108
1278
  return [
109
1279
  {
110
- signalId: "verification.summary",
111
- status: "ok",
112
- value: summary.allowRate,
113
- fields: [{ scope: "outputVerificationSummary", values: summary }],
1280
+ signalId: "openllm.leaderboard",
1281
+ status: score === null ? "missing" : "ok",
1282
+ value: score,
1283
+ fields: [
1284
+ {
1285
+ scope: "additional",
1286
+ values: {
1287
+ openLlmEvalScore: score,
1288
+ openLlmEvalMetricsCount: values.length,
1289
+ openLlmEvalStatus: score === null ? "missing" : "ok",
1290
+ openLlmEvalUpdatedAt: now,
1291
+ openLlmEvalSources: [...OPENLLM_EVAL_SOURCES]
1292
+ }
1293
+ }
1294
+ ],
114
1295
  provenance: {
115
- source: "output-verification",
116
- subjectId: agentId,
117
- fetchedAt: now,
118
- params: { windowDays, providers: options.providers.map((p) => p.id) }
1296
+ source: "openllm-leaderboard",
1297
+ subjectId: row.model,
1298
+ fetchedAt: now
119
1299
  }
120
1300
  }
121
1301
  ];
122
1302
  };
123
1303
  return {
124
- id: "output-verification",
125
- produces: ["verification.summary"],
1304
+ id: "openllm-leaderboard",
1305
+ produces: ["openllm.leaderboard"],
126
1306
  timeoutMs: options.timeoutMs,
127
- includeRegistries: options.includeRegistries,
128
- excludeRegistries: options.excludeRegistries,
1307
+ includeRegistries: options.includeRegistries ?? DEFAULT_MODEL_REGISTRIES,
129
1308
  appliesTo: options.appliesTo,
130
1309
  collect
131
1310
  };
132
1311
  }
133
1312
  export {
134
- createOutputVerificationSignalAdapter
1313
+ buildArenaMatchKeys,
1314
+ computePopularityScore,
1315
+ createChatbotArenaSignalAdapter,
1316
+ createHuggingFaceSignalAdapter,
1317
+ createJsonLeaderboardSource,
1318
+ createOpenLlmHuggingFaceSource,
1319
+ createOpenLlmJsonSource,
1320
+ createOpenLlmSignalAdapter,
1321
+ createOpenLmArenaSource,
1322
+ createOpenRouterBenchmarksSource,
1323
+ createOpenRouterEvalsHttpSource,
1324
+ createOpenRouterEvalsSignalAdapter,
1325
+ extractModelIndexMetrics,
1326
+ modelIdMatches,
1327
+ normalizeLogScore,
1328
+ normalizeMetricValue,
1329
+ resolveHuggingFaceModelId,
1330
+ resolveModelId,
1331
+ shouldIncludeMetric
135
1332
  };
136
1333
  //# sourceMappingURL=standards-sdk.es138.js.map