@burdenoff/be-sdk 2026.1110.2 → 2026.1110.3

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 (469) hide show
  1. package/configs/eslint/index.js +1 -1
  2. package/configs/tsconfig/tsconfig.json +1 -1
  3. package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
  4. package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
  5. package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
  6. package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
  7. package/dist/ai-credits/index.d.ts +2 -3
  8. package/dist/ai-credits/index.js +3 -4
  9. package/dist/ai-credits/index.js.map +1 -1
  10. package/dist/ai-credits-Ca-NNcVx.js +546 -0
  11. package/dist/ai-credits-Ca-NNcVx.js.map +1 -0
  12. package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
  13. package/dist/auth/index.d.ts +2 -77
  14. package/dist/auth/index.js +3 -7
  15. package/dist/auth/index.js.map +1 -1
  16. package/dist/auth-CEuBEBQN.js +228 -0
  17. package/dist/auth-CEuBEBQN.js.map +1 -0
  18. package/dist/cache/index.d.ts +2 -3
  19. package/dist/cache/index.js +3 -7
  20. package/dist/cache/index.js.map +1 -1
  21. package/dist/cache-CU0uLwcS.js +1837 -0
  22. package/dist/cache-CU0uLwcS.js.map +1 -0
  23. package/dist/captcha/index.d.ts +2 -1
  24. package/dist/captcha/index.js +3 -3
  25. package/dist/captcha/index.js.map +1 -1
  26. package/dist/captcha-BT7yh1YS.js +77 -0
  27. package/dist/captcha-BT7yh1YS.js.map +1 -0
  28. package/dist/client/internal-client.d.ts +4 -7
  29. package/dist/client/internal-client.js +172 -4
  30. package/dist/client/internal-client.js.map +1 -1
  31. package/dist/client-BgAEvDC2.d.ts +86 -0
  32. package/dist/client-DcZ3iGES.js +565 -0
  33. package/dist/client-DcZ3iGES.js.map +1 -0
  34. package/dist/collector-endpoint-iyQYeI50.js +50 -0
  35. package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
  36. package/dist/context-CZnXf2yb.js +247 -0
  37. package/dist/context-CZnXf2yb.js.map +1 -0
  38. package/dist/crypto/index.d.ts +2 -1
  39. package/dist/crypto/index.js +3 -3
  40. package/dist/crypto/index.js.map +1 -1
  41. package/dist/crypto-DO9fM0FO.js +145 -0
  42. package/dist/crypto-DO9fM0FO.js.map +1 -0
  43. package/dist/database/index.d.ts +104 -108
  44. package/dist/database/index.js +468 -6
  45. package/dist/database/index.js.map +1 -1
  46. package/dist/dataloader/index.d.ts +2 -1
  47. package/dist/dataloader/index.js +3 -3
  48. package/dist/dataloader/index.js.map +1 -1
  49. package/dist/dataloader-DwpT3YoS.js +294 -0
  50. package/dist/dataloader-DwpT3YoS.js.map +1 -0
  51. package/dist/deployed-environment-p_Tdl3sT.js +38 -0
  52. package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
  53. package/dist/dist-BGKdXVy3.js +1718 -0
  54. package/dist/dist-BGKdXVy3.js.map +1 -0
  55. package/dist/env-DdaoGjIt.js +74 -0
  56. package/dist/env-DdaoGjIt.js.map +1 -0
  57. package/dist/event-queue/index.d.ts +2 -7
  58. package/dist/event-queue/index.js +7 -9
  59. package/dist/event-queue/index.js.map +1 -1
  60. package/dist/event-queue-Cw-YJPY_.js +1384 -0
  61. package/dist/event-queue-Cw-YJPY_.js.map +1 -0
  62. package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
  63. package/dist/export/index.d.ts +2 -2
  64. package/dist/export/index.js +3 -14
  65. package/dist/export/index.js.map +1 -1
  66. package/dist/export-B6fphx8a.js +642 -0
  67. package/dist/export-B6fphx8a.js.map +1 -0
  68. package/dist/feature-flags/index.d.ts +2 -10
  69. package/dist/feature-flags/index.js +3 -6
  70. package/dist/feature-flags/index.js.map +1 -1
  71. package/dist/feature-flags-71oDkrUe.js +422 -0
  72. package/dist/feature-flags-71oDkrUe.js.map +1 -0
  73. package/dist/files/index.d.ts +2 -3
  74. package/dist/files/index.js +3 -4
  75. package/dist/files/index.js.map +1 -1
  76. package/dist/files-DjH0099H.js +830 -0
  77. package/dist/files-DjH0099H.js.map +1 -0
  78. package/dist/gateway/index.d.ts +4 -6
  79. package/dist/gateway/index.js +7 -13
  80. package/dist/gateway/index.js.map +1 -1
  81. package/dist/gateway/security/index.d.ts +2 -2
  82. package/dist/gateway/security/index.js +3 -5
  83. package/dist/gateway/security/index.js.map +1 -1
  84. package/dist/gateway-DBFmxWks.js +50 -0
  85. package/dist/gateway-DBFmxWks.js.map +1 -0
  86. package/dist/graph/index.d.ts +3 -10
  87. package/dist/graph/index.js +4 -13
  88. package/dist/graph/index.js.map +1 -1
  89. package/dist/graph-DDYgIryR.js +2152 -0
  90. package/dist/graph-DDYgIryR.js.map +1 -0
  91. package/dist/graph-emitter-CdOXP7Tn.js +621 -0
  92. package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
  93. package/dist/graphql/index.d.ts +3 -2
  94. package/dist/graphql/index.js +4 -6
  95. package/dist/graphql/index.js.map +1 -1
  96. package/dist/graphql/services/index.d.ts +2 -24
  97. package/dist/graphql/services/index.js +3 -4
  98. package/dist/graphql/services/index.js.map +1 -1
  99. package/dist/graphql-DHAHHcww.js +161 -0
  100. package/dist/graphql-DHAHHcww.js.map +1 -0
  101. package/dist/graphql-DNkMkGBZ.d.ts +21 -0
  102. package/dist/i18n/index.d.ts +3 -3
  103. package/dist/i18n/index.js +3 -4
  104. package/dist/i18n/index.js.map +1 -1
  105. package/dist/i18n-BBMYFd0P.js +860 -0
  106. package/dist/i18n-BBMYFd0P.js.map +1 -0
  107. package/dist/import-optional-peer-B82VYxeX.js +18 -0
  108. package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
  109. package/dist/index-3KOZ1zN9.d.ts +233 -0
  110. package/dist/index-BBqooJ52.d.ts +45 -0
  111. package/dist/index-BGzMYJsm.d.ts +209 -0
  112. package/dist/index-BKwHQtHQ.d.ts +63 -0
  113. package/dist/index-BMIMnp6T.d.ts +8 -0
  114. package/dist/index-BQDsNAMR.d.ts +81 -0
  115. package/dist/index-BVOL7458.d.ts +10 -0
  116. package/dist/index-BcqQs-Uq.d.ts +69 -0
  117. package/dist/index-BeVtqGO-.d.ts +208 -0
  118. package/dist/index-BiTzGUZP.d.ts +114 -0
  119. package/dist/index-BqYfCQSP.d.ts +500 -0
  120. package/dist/index-C0qLquY0.d.ts +150 -0
  121. package/dist/index-C5uEKchX.d.ts +60 -0
  122. package/dist/index-CDOqxSIi.d.ts +37 -0
  123. package/dist/index-CG6wj66Y.d.ts +148 -0
  124. package/dist/index-CIgoeobA.d.ts +145 -0
  125. package/dist/index-CPQDMSFS.d.ts +103 -0
  126. package/dist/index-CSRcgkVi.d.ts +23 -0
  127. package/dist/index-CZTnQIRU.d.ts +341 -0
  128. package/dist/index-CaM9JUcc.d.ts +144 -0
  129. package/dist/index-CkT2aUr3.d.ts +704 -0
  130. package/dist/index-CliOgq6L.d.ts +203 -0
  131. package/dist/index-CnzbJZP7.d.ts +999 -0
  132. package/dist/index-D6UeLAye.d.ts +63 -0
  133. package/dist/index-DGgh9DWn.d.ts +59 -0
  134. package/dist/index-DY3dNhMN.d.ts +420 -0
  135. package/dist/index-DZC-2o9R.d.ts +207 -0
  136. package/dist/index-DqbGqfAy.d.ts +127 -0
  137. package/dist/index-Dt1HJPTX.d.ts +12 -0
  138. package/dist/index-DtI6aBtB.d.ts +22 -0
  139. package/dist/index-FKohsiex.d.ts +38 -0
  140. package/dist/index-FbXPfen7.d.ts +132 -0
  141. package/dist/index-MArCb8Aq.d.ts +306 -0
  142. package/dist/index-N-huORcj.d.ts +303 -0
  143. package/dist/index-YOShAwkq.d.ts +45 -0
  144. package/dist/index-bZKZUvBu.d.ts +646 -0
  145. package/dist/index-yBSjMY32.d.ts +24 -0
  146. package/dist/index.d.ts +501 -544
  147. package/dist/index.js +1820 -2171
  148. package/dist/index.js.map +1 -1
  149. package/dist/init/index.d.ts +2 -2
  150. package/dist/init/index.js +3 -16
  151. package/dist/init/index.js.map +1 -1
  152. package/dist/init-Dy3KhT6Y.js +325 -0
  153. package/dist/init-Dy3KhT6Y.js.map +1 -0
  154. package/dist/instrumentation/index.d.ts +3 -4
  155. package/dist/instrumentation/index.js +5 -5
  156. package/dist/instrumentation/index.js.map +1 -1
  157. package/dist/instrumentation-xkkmDgJ0.js +1678 -0
  158. package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
  159. package/dist/lake/index.d.ts +50 -54
  160. package/dist/lake/index.js +169 -193
  161. package/dist/lake/index.js.map +1 -1
  162. package/dist/layer/index.d.ts +3 -2
  163. package/dist/layer/index.js +4 -5
  164. package/dist/layer/index.js.map +1 -1
  165. package/dist/layer-BZBZZWeV.d.ts +69 -0
  166. package/dist/layer-Bcix-WCl.js +105 -0
  167. package/dist/layer-Bcix-WCl.js.map +1 -0
  168. package/dist/layer-CEKy6cm8.js +252 -0
  169. package/dist/layer-CEKy6cm8.js.map +1 -0
  170. package/dist/lifecycle/index.d.ts +2 -1
  171. package/dist/lifecycle/index.js +3 -4
  172. package/dist/lifecycle/index.js.map +1 -1
  173. package/dist/lifecycle-DeoLSX0U.js +76 -0
  174. package/dist/lifecycle-DeoLSX0U.js.map +1 -0
  175. package/dist/logger/index.d.ts +2 -3
  176. package/dist/logger/index.js +3 -3
  177. package/dist/logger/index.js.map +1 -1
  178. package/dist/logger-B6rCpb7D.js +290 -0
  179. package/dist/logger-B6rCpb7D.js.map +1 -0
  180. package/dist/metrics/index.d.ts +13 -14
  181. package/dist/metrics/index.js +3 -4
  182. package/dist/metrics/index.js.map +1 -1
  183. package/dist/metrics-BrLwNUrb.js +52 -0
  184. package/dist/metrics-BrLwNUrb.js.map +1 -0
  185. package/dist/metrics-collector-C2eShrlW.js +922 -0
  186. package/dist/metrics-collector-C2eShrlW.js.map +1 -0
  187. package/dist/middleware/index.d.ts +3 -3
  188. package/dist/middleware/index.js +3 -4
  189. package/dist/middleware/index.js.map +1 -1
  190. package/dist/middleware-CUxJVUpD.js +1243 -0
  191. package/dist/middleware-CUxJVUpD.js.map +1 -0
  192. package/dist/middleware-Cq0zFMGp.js +253 -0
  193. package/dist/middleware-Cq0zFMGp.js.map +1 -0
  194. package/dist/notifications/index.d.ts +2 -5
  195. package/dist/notifications/index.js +3 -6
  196. package/dist/notifications/index.js.map +1 -1
  197. package/dist/notifications-CdETrtFK.js +869 -0
  198. package/dist/notifications-CdETrtFK.js.map +1 -0
  199. package/dist/observability/index.d.ts +2 -3
  200. package/dist/observability/index.js +3 -4
  201. package/dist/observability/index.js.map +1 -1
  202. package/dist/observability-DBDXipTU.js +272 -0
  203. package/dist/observability-DBDXipTU.js.map +1 -0
  204. package/dist/platform/index.d.ts +2 -1
  205. package/dist/platform/index.js +3 -5
  206. package/dist/platform/index.js.map +1 -1
  207. package/dist/platform-DZwczW7v.js +1510 -0
  208. package/dist/platform-DZwczW7v.js.map +1 -0
  209. package/dist/prisma/generator/index.d.ts +1 -1
  210. package/dist/prisma/generator/index.js +97 -84
  211. package/dist/prisma/generator/index.js.map +1 -1
  212. package/dist/prisma/index.d.ts +4 -7
  213. package/dist/prisma/index.js +5 -12
  214. package/dist/prisma/index.js.map +1 -1
  215. package/dist/prisma-BzOOdt79.js +863 -0
  216. package/dist/prisma-BzOOdt79.js.map +1 -0
  217. package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
  218. package/dist/product-alias/index.d.ts +2 -1
  219. package/dist/product-alias/index.js +3 -3
  220. package/dist/product-alias/index.js.map +1 -1
  221. package/dist/product-alias-BPqtskMq.js +273 -0
  222. package/dist/product-alias-BPqtskMq.js.map +1 -0
  223. package/dist/rbac/index.d.ts +2 -122
  224. package/dist/rbac/index.js +3 -6
  225. package/dist/rbac/index.js.map +1 -1
  226. package/dist/rbac-BB9l9Xph.js +1486 -0
  227. package/dist/rbac-BB9l9Xph.js.map +1 -0
  228. package/dist/resource-caps/index.d.ts +66 -72
  229. package/dist/resource-caps/index.js +430 -5
  230. package/dist/resource-caps/index.js.map +1 -1
  231. package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
  232. package/dist/sdk-Dju9o-sq.js +124 -0
  233. package/dist/sdk-Dju9o-sq.js.map +1 -0
  234. package/dist/security-DIG-95Ic.js +1647 -0
  235. package/dist/security-DIG-95Ic.js.map +1 -0
  236. package/dist/server/index.d.ts +7 -164
  237. package/dist/server/index.js +2000 -1507
  238. package/dist/server/index.js.map +1 -1
  239. package/dist/service-jwt-Bu-WNA_-.js +80 -0
  240. package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
  241. package/dist/services-BWzfz7vG.js +102 -0
  242. package/dist/services-BWzfz7vG.js.map +1 -0
  243. package/dist/sharding/index.d.ts +41 -44
  244. package/dist/sharding/index.js +156 -137
  245. package/dist/sharding/index.js.map +1 -1
  246. package/dist/sharing/index.d.ts +2 -1
  247. package/dist/sharing/index.js +3 -4
  248. package/dist/sharing/index.js.map +1 -1
  249. package/dist/sharing-CflDsSJ-.js +911 -0
  250. package/dist/sharing-CflDsSJ-.js.map +1 -0
  251. package/dist/stub-BqwKn4eh.js +630 -0
  252. package/dist/stub-BqwKn4eh.js.map +1 -0
  253. package/dist/tags/index.d.ts +2 -3
  254. package/dist/tags/index.js +3 -4
  255. package/dist/tags/index.js.map +1 -1
  256. package/dist/tags-B5xpbgsk.js +868 -0
  257. package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.js.map} +1 -1
  258. package/dist/telemetry/index.d.ts +64 -76
  259. package/dist/telemetry/index.js +369 -201
  260. package/dist/telemetry/index.js.map +1 -1
  261. package/dist/temporal/index.d.ts +2 -148
  262. package/dist/temporal/index.js +3 -5
  263. package/dist/temporal/index.js.map +1 -1
  264. package/dist/temporal-B534uYK8.js +706 -0
  265. package/dist/temporal-B534uYK8.js.map +1 -0
  266. package/dist/tracker/index.d.ts +5 -11
  267. package/dist/tracker/index.js +5 -20
  268. package/dist/tracker/index.js.map +1 -1
  269. package/dist/tracker-BQVoEFUo.js +839 -0
  270. package/dist/tracker-BQVoEFUo.js.map +1 -0
  271. package/dist/types-BYMYND1L.js +44 -0
  272. package/dist/types-BYMYND1L.js.map +1 -0
  273. package/dist/types-C6EKaS3V.d.ts +106 -0
  274. package/dist/types-CWybW61E.d.ts +323 -0
  275. package/dist/types-C_yfu3XK.d.ts +34 -0
  276. package/dist/types-Cj2RWXbz.js +90 -0
  277. package/dist/types-Cj2RWXbz.js.map +1 -0
  278. package/dist/types-DgaQqvxo.d.ts +70 -0
  279. package/dist/usage/index.d.ts +2 -213
  280. package/dist/usage/index.js +3 -15
  281. package/dist/usage/index.js.map +1 -1
  282. package/dist/usage-BKFZiWQn.js +682 -0
  283. package/dist/usage-BKFZiWQn.js.map +1 -0
  284. package/dist/utils/index.d.ts +2 -1
  285. package/dist/utils/index.js +3 -3
  286. package/dist/utils/index.js.map +1 -1
  287. package/dist/utils-DL85Tnbn.js +500 -0
  288. package/dist/utils-DL85Tnbn.js.map +1 -0
  289. package/dist/validation/index.d.ts +2 -2
  290. package/dist/validation/index.js +3 -3
  291. package/dist/validation/index.js.map +1 -1
  292. package/dist/validation-CPUITdMk.js +762 -0
  293. package/dist/validation-CPUITdMk.js.map +1 -0
  294. package/dist/workspace-extension-COrC0dYi.js +979 -0
  295. package/dist/workspace-extension-COrC0dYi.js.map +1 -0
  296. package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
  297. package/package.json +7 -10
  298. package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
  299. package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
  300. package/dist/chunk-4XIBXZ6J.js +0 -276
  301. package/dist/chunk-4XIBXZ6J.js.map +0 -1
  302. package/dist/chunk-554Z4C2K.js +0 -1006
  303. package/dist/chunk-554Z4C2K.js.map +0 -1
  304. package/dist/chunk-5CAFHK2Z.js +0 -107
  305. package/dist/chunk-5CAFHK2Z.js.map +0 -1
  306. package/dist/chunk-63ZXJ42X.js +0 -451
  307. package/dist/chunk-63ZXJ42X.js.map +0 -1
  308. package/dist/chunk-6XEXJATV.js +0 -304
  309. package/dist/chunk-6XEXJATV.js.map +0 -1
  310. package/dist/chunk-726AR6Q7.js +0 -1532
  311. package/dist/chunk-726AR6Q7.js.map +0 -1
  312. package/dist/chunk-A5F6Z5UE.js +0 -21
  313. package/dist/chunk-A5F6Z5UE.js.map +0 -1
  314. package/dist/chunk-A6DE32ZS.js +0 -1507
  315. package/dist/chunk-A6DE32ZS.js.map +0 -1
  316. package/dist/chunk-AXJDGQPE.js +0 -690
  317. package/dist/chunk-AXJDGQPE.js.map +0 -1
  318. package/dist/chunk-BJQOGOVW.js +0 -602
  319. package/dist/chunk-BJQOGOVW.js.map +0 -1
  320. package/dist/chunk-CFXWH2IS.js +0 -52
  321. package/dist/chunk-CFXWH2IS.js.map +0 -1
  322. package/dist/chunk-DRWH5XCJ.js +0 -876
  323. package/dist/chunk-DRWH5XCJ.js.map +0 -1
  324. package/dist/chunk-E4QNLVY4.js +0 -909
  325. package/dist/chunk-E4QNLVY4.js.map +0 -1
  326. package/dist/chunk-EBDHIL7V.js +0 -774
  327. package/dist/chunk-EBDHIL7V.js.map +0 -1
  328. package/dist/chunk-ELU7VL3E.js +0 -245
  329. package/dist/chunk-ELU7VL3E.js.map +0 -1
  330. package/dist/chunk-FZRODKIN.js +0 -31
  331. package/dist/chunk-FZRODKIN.js.map +0 -1
  332. package/dist/chunk-GCIB76AJ.js +0 -882
  333. package/dist/chunk-GCIB76AJ.js.map +0 -1
  334. package/dist/chunk-HC6MPUIH.js +0 -1571
  335. package/dist/chunk-HC6MPUIH.js.map +0 -1
  336. package/dist/chunk-HNMHPSAM.js +0 -272
  337. package/dist/chunk-HNMHPSAM.js.map +0 -1
  338. package/dist/chunk-HTLEGD3Q.js +0 -1480
  339. package/dist/chunk-HTLEGD3Q.js.map +0 -1
  340. package/dist/chunk-I3KOWRT3.js +0 -89
  341. package/dist/chunk-I3KOWRT3.js.map +0 -1
  342. package/dist/chunk-ID3WR4JS.js +0 -509
  343. package/dist/chunk-ID3WR4JS.js.map +0 -1
  344. package/dist/chunk-JS52ZHTK.js +0 -1346
  345. package/dist/chunk-JS52ZHTK.js.map +0 -1
  346. package/dist/chunk-JVMAQOA3.js +0 -521
  347. package/dist/chunk-JVMAQOA3.js.map +0 -1
  348. package/dist/chunk-KH4TRQCO.js +0 -1063
  349. package/dist/chunk-KH4TRQCO.js.map +0 -1
  350. package/dist/chunk-KJOSPVB2.js +0 -57
  351. package/dist/chunk-KJOSPVB2.js.map +0 -1
  352. package/dist/chunk-KO2ZXZ7W.js +0 -61
  353. package/dist/chunk-KO2ZXZ7W.js.map +0 -1
  354. package/dist/chunk-KS2HQCJR.js +0 -56
  355. package/dist/chunk-KS2HQCJR.js.map +0 -1
  356. package/dist/chunk-LA5KPWZ2.js +0 -413
  357. package/dist/chunk-LA5KPWZ2.js.map +0 -1
  358. package/dist/chunk-MESLAC5W.js +0 -574
  359. package/dist/chunk-MESLAC5W.js.map +0 -1
  360. package/dist/chunk-MWPYA2HD.js +0 -94
  361. package/dist/chunk-MWPYA2HD.js.map +0 -1
  362. package/dist/chunk-NUB5GQTU.js +0 -270
  363. package/dist/chunk-NUB5GQTU.js.map +0 -1
  364. package/dist/chunk-OBBCR6WY.js +0 -277
  365. package/dist/chunk-OBBCR6WY.js.map +0 -1
  366. package/dist/chunk-OQDSAOG3.js +0 -1908
  367. package/dist/chunk-OQDSAOG3.js.map +0 -1
  368. package/dist/chunk-OXNCBE7P.js +0 -971
  369. package/dist/chunk-OXNCBE7P.js.map +0 -1
  370. package/dist/chunk-PBZFAAOM.js +0 -941
  371. package/dist/chunk-PN6GIF3R.js +0 -1185
  372. package/dist/chunk-PN6GIF3R.js.map +0 -1
  373. package/dist/chunk-PYD44IHJ.js +0 -728
  374. package/dist/chunk-PYD44IHJ.js.map +0 -1
  375. package/dist/chunk-QVPIACWD.js +0 -679
  376. package/dist/chunk-QVPIACWD.js.map +0 -1
  377. package/dist/chunk-QWNNFE4P.js +0 -41
  378. package/dist/chunk-QWNNFE4P.js.map +0 -1
  379. package/dist/chunk-RU266375.js +0 -327
  380. package/dist/chunk-RU266375.js.map +0 -1
  381. package/dist/chunk-RYTSVGGA.js +0 -1624
  382. package/dist/chunk-RYTSVGGA.js.map +0 -1
  383. package/dist/chunk-RZOFS2BQ.js +0 -225
  384. package/dist/chunk-RZOFS2BQ.js.map +0 -1
  385. package/dist/chunk-SBS4S2PJ.js +0 -100
  386. package/dist/chunk-SBS4S2PJ.js.map +0 -1
  387. package/dist/chunk-SPRG6G6G.js +0 -530
  388. package/dist/chunk-SPRG6G6G.js.map +0 -1
  389. package/dist/chunk-STWFX5E2.js +0 -233
  390. package/dist/chunk-STWFX5E2.js.map +0 -1
  391. package/dist/chunk-UNASM5VJ.js +0 -419
  392. package/dist/chunk-UNASM5VJ.js.map +0 -1
  393. package/dist/chunk-VAT66FJA.js +0 -245
  394. package/dist/chunk-VAT66FJA.js.map +0 -1
  395. package/dist/chunk-VFCMR5GX.js +0 -49
  396. package/dist/chunk-VFCMR5GX.js.map +0 -1
  397. package/dist/chunk-VGAHZKNJ.js +0 -66
  398. package/dist/chunk-VGAHZKNJ.js.map +0 -1
  399. package/dist/chunk-VTJTAAXC.js +0 -627
  400. package/dist/chunk-VTJTAAXC.js.map +0 -1
  401. package/dist/chunk-VXVLKRU6.js +0 -758
  402. package/dist/chunk-VXVLKRU6.js.map +0 -1
  403. package/dist/chunk-WWUU5ETI.js +0 -163
  404. package/dist/chunk-WWUU5ETI.js.map +0 -1
  405. package/dist/chunk-XE4OXN2W.js +0 -10
  406. package/dist/chunk-XE4OXN2W.js.map +0 -1
  407. package/dist/chunk-XOJORS75.js +0 -1853
  408. package/dist/chunk-XOJORS75.js.map +0 -1
  409. package/dist/chunk-YMZEUTD2.js +0 -110
  410. package/dist/chunk-YMZEUTD2.js.map +0 -1
  411. package/dist/chunk-Z77BTSOK.js +0 -617
  412. package/dist/chunk-Z77BTSOK.js.map +0 -1
  413. package/dist/chunk-ZZK3WEDI.js +0 -181
  414. package/dist/chunk-ZZK3WEDI.js.map +0 -1
  415. package/dist/client-CCXpAZ2r.d.ts +0 -89
  416. package/dist/client-DSI_760t.d.ts +0 -36
  417. package/dist/client-JU6T3UPB.js +0 -11
  418. package/dist/client-JU6T3UPB.js.map +0 -1
  419. package/dist/dist-2X4Q7PJA.js +0 -1491
  420. package/dist/dist-2X4Q7PJA.js.map +0 -1
  421. package/dist/env-4UWSUS64.js +0 -4
  422. package/dist/env-4UWSUS64.js.map +0 -1
  423. package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
  424. package/dist/graphql-CMHMQjvd.d.ts +0 -23
  425. package/dist/i18n-Qm2AkPC-.d.ts +0 -33
  426. package/dist/index--yvpa6ay.d.ts +0 -83
  427. package/dist/index-4gKQKZ2B.d.ts +0 -71
  428. package/dist/index-5x0XMKXN.d.ts +0 -149
  429. package/dist/index-B70b5mYS.d.ts +0 -33
  430. package/dist/index-B8KrxO4j.d.ts +0 -755
  431. package/dist/index-BOuDKnqD.d.ts +0 -201
  432. package/dist/index-BTMt4OjA.d.ts +0 -201
  433. package/dist/index-BejbszA7.d.ts +0 -39
  434. package/dist/index-BkeOYZye.d.ts +0 -198
  435. package/dist/index-BuAj5nXg.d.ts +0 -83
  436. package/dist/index-BvkVcW8I.d.ts +0 -349
  437. package/dist/index-CWmH_-RZ.d.ts +0 -247
  438. package/dist/index-CbgWNcus.d.ts +0 -258
  439. package/dist/index-CmfPeQza.d.ts +0 -166
  440. package/dist/index-CmpG-zak.d.ts +0 -607
  441. package/dist/index-CoMKgL-p.d.ts +0 -12
  442. package/dist/index-D8HGwglK.d.ts +0 -541
  443. package/dist/index-DCaVm66D.d.ts +0 -1101
  444. package/dist/index-DE2w7E0d.d.ts +0 -83
  445. package/dist/index-DSOpj8DI.d.ts +0 -17
  446. package/dist/index-DW9q22GH.d.ts +0 -75
  447. package/dist/index-DnjJ9CwI.d.ts +0 -347
  448. package/dist/index-DwMJZ8PP.d.ts +0 -317
  449. package/dist/index-PaojfSdd.d.ts +0 -71
  450. package/dist/index-aHtYvc3i.d.ts +0 -284
  451. package/dist/index-e_18DzAg.d.ts +0 -18
  452. package/dist/index-ffmipXSA.d.ts +0 -55
  453. package/dist/index-joONjwLt.d.ts +0 -33
  454. package/dist/index-kssw5ziY.d.ts +0 -250
  455. package/dist/index-lFffh5-G.d.ts +0 -125
  456. package/dist/index-pxYge_6k.d.ts +0 -79
  457. package/dist/layer-Cv9vSwBx.d.ts +0 -70
  458. package/dist/pino-logger-H4HPW5P6.js +0 -5
  459. package/dist/pino-logger-H4HPW5P6.js.map +0 -1
  460. package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
  461. package/dist/sdk-L75WWUP3.js +0 -156
  462. package/dist/sdk-L75WWUP3.js.map +0 -1
  463. package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
  464. package/dist/types-Bo2wkjSP.d.ts +0 -35
  465. package/dist/types-DVpvrAhd.d.ts +0 -71
  466. package/dist/types-DgJ4lDYA.d.ts +0 -108
  467. package/dist/types-USOv09qy.d.ts +0 -327
  468. package/dist/workspace-guard-NXVYYBVJ.js +0 -5
  469. package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
@@ -1,1571 +0,0 @@
1
- import { productSlugVariants, emitProductSlug } from './chunk-OBBCR6WY.js';
2
- import { logger } from './chunk-RU266375.js';
3
- import { __export, __name } from './chunk-XE4OXN2W.js';
4
-
5
- // src/platform/index.ts
6
- var platform_exports = {};
7
- __export(platform_exports, {
8
- CircuitBreakerOpenError: () => CircuitBreakerOpenError,
9
- DEFAULT_GRAPHQL_PAGE_LIMIT: () => DEFAULT_GRAPHQL_PAGE_LIMIT,
10
- InvocationAccountingCoordinator: () => InvocationAccountingCoordinator,
11
- InvocationAccountingValidationError: () => InvocationAccountingValidationError,
12
- LLMRouter: () => LLMRouter,
13
- MAX_GRAPHQL_PAGE_LIMIT: () => MAX_GRAPHQL_PAGE_LIMIT,
14
- PROMPTS_V2_DOCUMENTS: () => PROMPTS_V2_DOCUMENTS,
15
- __resetHttpClientBreakers: () => __resetHttpClientBreakers,
16
- buildCacheKey: () => buildCacheKey,
17
- buildConnection: () => buildConnection,
18
- buildLoaders: () => buildLoaders,
19
- buildOffsetPage: () => buildOffsetPage,
20
- clampGraphqlLimit: () => clampGraphqlLimit,
21
- clampLimit: () => clampLimit,
22
- clampOffset: () => clampOffset,
23
- createClaudeUsageAccumulator: () => createClaudeUsageAccumulator,
24
- createHttpClient: () => createHttpClient,
25
- createLeaderLease: () => createLeaderLease,
26
- decodeCursor: () => decodeCursor,
27
- dropOldPartitions: () => dropOldPartitions,
28
- encodeCursor: () => encodeCursor,
29
- ensureMonthlyPartitions: () => ensureMonthlyPartitions,
30
- getNamespaceVersion: () => getNamespaceVersion,
31
- httpClient: () => httpClient,
32
- invalidateNamespace: () => invalidateNamespace,
33
- monthlyPartitionName: () => monthlyPartitionName,
34
- normalizeClaudeUsage: () => normalizeClaudeUsage,
35
- normalizeCursorPagination: () => normalizeCursorPagination,
36
- normalizeOffsetPagination: () => normalizeOffsetPagination,
37
- normalizeOpenAIUsage: () => normalizeOpenAIUsage,
38
- normalizeRedisUrl: () => normalizeRedisUrl,
39
- paginate: () => paginate,
40
- rateLimitIncr: () => rateLimitIncr,
41
- resolveReferenceLoader: () => resolveReferenceLoader,
42
- toPrismaPage: () => toPrismaPage,
43
- validateInvocationAttemptInput: () => validateInvocationAttemptInput,
44
- validateInvocationAttemptReceipt: () => validateInvocationAttemptReceipt,
45
- validateInvocationDelivery: () => validateInvocationDelivery,
46
- validateInvocationIdentity: () => validateInvocationIdentity,
47
- validateInvocationUsageInput: () => validateInvocationUsageInput,
48
- validateInvocationUsageReceipt: () => validateInvocationUsageReceipt,
49
- validateInvocationUsageSummary: () => validateInvocationUsageSummary,
50
- withLeaderLock: () => withLeaderLock
51
- });
52
-
53
- // src/platform/httpClient.ts
54
- var breakers = /* @__PURE__ */ new Map();
55
- function hostOf(url) {
56
- try {
57
- return new URL(url).host;
58
- } catch {
59
- return url;
60
- }
61
- }
62
- __name(hostOf, "hostOf");
63
- function getBreaker(host) {
64
- let b = breakers.get(host);
65
- if (!b) {
66
- b = {
67
- failures: 0,
68
- openedAt: null,
69
- state: "CLOSED"
70
- };
71
- breakers.set(host, b);
72
- }
73
- return b;
74
- }
75
- __name(getBreaker, "getBreaker");
76
- function defaultRetryOn(status) {
77
- return status === 408 || status === 425 || status === 429 || status >= 500 && status <= 599;
78
- }
79
- __name(defaultRetryOn, "defaultRetryOn");
80
- function jitter(delay) {
81
- return Math.floor(Math.random() * delay);
82
- }
83
- __name(jitter, "jitter");
84
- function sleep(ms) {
85
- return new Promise((r) => setTimeout(r, ms));
86
- }
87
- __name(sleep, "sleep");
88
- var CircuitBreakerOpenError = class extends Error {
89
- static {
90
- __name(this, "CircuitBreakerOpenError");
91
- }
92
- constructor(host) {
93
- super(`circuit breaker OPEN for host=${host}`);
94
- this.name = "CircuitBreakerOpenError";
95
- }
96
- };
97
- function __resetHttpClientBreakers() {
98
- breakers.clear();
99
- }
100
- __name(__resetHttpClientBreakers, "__resetHttpClientBreakers");
101
- async function executeOnce(url, init, timeoutMs) {
102
- const signal = init.signal ?? AbortSignal.timeout(timeoutMs);
103
- return fetch(url, {
104
- ...init,
105
- signal
106
- });
107
- }
108
- __name(executeOnce, "executeOnce");
109
- async function httpClient(url, init = {}, config = {}) {
110
- const fullUrl = config.baseUrl && !/^https?:\/\//i.test(url) ? `${config.baseUrl.replace(/\/$/, "")}/${url.replace(/^\//, "")}` : url;
111
- const host = hostOf(fullUrl);
112
- const breaker = getBreaker(host);
113
- const breakerThreshold = config.breaker?.threshold ?? 5;
114
- const cooldownMs = config.breaker?.cooldownMs ?? 3e4;
115
- if (breaker.state === "OPEN") {
116
- if (breaker.openedAt && Date.now() - breaker.openedAt >= cooldownMs) {
117
- breaker.state = "HALF_OPEN";
118
- logger.info("httpClient.breaker.halfOpen", {
119
- host
120
- });
121
- } else {
122
- throw new CircuitBreakerOpenError(host);
123
- }
124
- }
125
- const attempts = init.retry?.attempts ?? config.retry?.attempts ?? 3;
126
- const initialDelay = init.retry?.initialDelayMs ?? config.retry?.initialDelayMs ?? 100;
127
- const maxDelay = init.retry?.maxDelayMs ?? config.retry?.maxDelayMs ?? 2e3;
128
- const retryOn = init.retry?.retryOn ?? config.retry?.retryOn ?? defaultRetryOn;
129
- const timeoutMs = init.timeoutMs ?? config.defaultTimeoutMs ?? 5e3;
130
- const headers = {
131
- ...config.defaultHeaders ?? {},
132
- ...init.headers ?? {}
133
- };
134
- let lastErr;
135
- for (let attempt = 1; attempt <= attempts; attempt++) {
136
- try {
137
- const response = await executeOnce(fullUrl, {
138
- ...init,
139
- headers
140
- }, timeoutMs);
141
- if (response.status >= 500) {
142
- breaker.failures += 1;
143
- if (breaker.failures >= breakerThreshold) {
144
- breaker.state = "OPEN";
145
- breaker.openedAt = Date.now();
146
- logger.warn("httpClient.breaker.open", {
147
- host,
148
- failures: breaker.failures
149
- });
150
- }
151
- if (attempt < attempts && retryOn(response.status)) {
152
- const delay = Math.min(initialDelay * 2 ** (attempt - 1), maxDelay);
153
- await sleep(jitter(delay));
154
- continue;
155
- }
156
- return response;
157
- }
158
- breaker.failures = 0;
159
- if (breaker.state === "HALF_OPEN") {
160
- breaker.state = "CLOSED";
161
- breaker.openedAt = null;
162
- logger.info("httpClient.breaker.closed", {
163
- host
164
- });
165
- }
166
- if (attempt < attempts && retryOn(response.status)) {
167
- const delay = Math.min(initialDelay * 2 ** (attempt - 1), maxDelay);
168
- await sleep(jitter(delay));
169
- continue;
170
- }
171
- return response;
172
- } catch (err) {
173
- lastErr = err;
174
- breaker.failures += 1;
175
- if (breaker.failures >= breakerThreshold) {
176
- breaker.state = "OPEN";
177
- breaker.openedAt = Date.now();
178
- logger.warn("httpClient.breaker.open", {
179
- host,
180
- failures: breaker.failures
181
- });
182
- }
183
- if (attempt >= attempts) break;
184
- const delay = Math.min(initialDelay * 2 ** (attempt - 1), maxDelay);
185
- await sleep(jitter(delay));
186
- }
187
- }
188
- logger.error("httpClient.exhausted", {
189
- url: fullUrl,
190
- attempts,
191
- host
192
- });
193
- throw lastErr instanceof Error ? lastErr : new Error(`httpClient failed: ${String(lastErr)}`);
194
- }
195
- __name(httpClient, "httpClient");
196
- function createHttpClient(config = {}) {
197
- return (url, init = {}) => httpClient(url, init, config);
198
- }
199
- __name(createHttpClient, "createHttpClient");
200
-
201
- // src/platform/leaderLock.ts
202
- var RELEASE_LUA = `
203
- if redis.call("get", KEYS[1]) == ARGV[1] then
204
- return redis.call("del", KEYS[1])
205
- else
206
- return 0
207
- end
208
- `;
209
- var RENEW_LUA = `
210
- if redis.call("get", KEYS[1]) == ARGV[1] then
211
- return redis.call("pexpire", KEYS[1], ARGV[2])
212
- else
213
- return 0
214
- end
215
- `;
216
- function leaderKey(name) {
217
- return `besdk:leader:${name}`;
218
- }
219
- __name(leaderKey, "leaderKey");
220
- function generateToken() {
221
- return `${Date.now()}-${Math.random().toString(36).slice(2)}-${process.pid}`;
222
- }
223
- __name(generateToken, "generateToken");
224
- function defaultRenewMs(ttlMs) {
225
- return Math.max(1e3, Math.floor(ttlMs / 3));
226
- }
227
- __name(defaultRenewMs, "defaultRenewMs");
228
- async function acquireLease(redis, key2, token, ttlMs) {
229
- const ttlSeconds = Math.max(1, Math.ceil(ttlMs / 1e3));
230
- return await redis.set(key2, token, "EX", ttlSeconds, "NX") === "OK";
231
- }
232
- __name(acquireLease, "acquireLease");
233
- async function renewLease(redis, key2, token, ttlMs) {
234
- return await redis.eval(RENEW_LUA, 1, key2, token, String(ttlMs)) === 1;
235
- }
236
- __name(renewLease, "renewLease");
237
- async function releaseLease(redis, key2, token) {
238
- await redis.eval(RELEASE_LUA, 1, key2, token);
239
- }
240
- __name(releaseLease, "releaseLease");
241
- function normalizeRedisUrl(url) {
242
- if (url.startsWith("valkeys://")) return url.replace(/^valkeys:\/\//, "rediss://");
243
- if (url.startsWith("valkey://")) return url.replace(/^valkey:\/\//, "redis://");
244
- return url;
245
- }
246
- __name(normalizeRedisUrl, "normalizeRedisUrl");
247
- async function withLeaderLock(redis, name, fn, options) {
248
- const key2 = leaderKey(name);
249
- const token = generateToken();
250
- const ttlMs = options.ttlMs;
251
- const renewMs = options.renewMs ?? defaultRenewMs(ttlMs);
252
- const acquired = await acquireLease(redis, key2, token, ttlMs);
253
- if (!acquired) {
254
- return {
255
- acquired: false
256
- };
257
- }
258
- logger.info("leaderLock.acquired", {
259
- name,
260
- token,
261
- ttlMs
262
- });
263
- let stopped = false;
264
- const renewTimer = setInterval(() => {
265
- if (stopped) return;
266
- renewLease(redis, key2, token, ttlMs).catch((err) => {
267
- logger.warn("leaderLock.renew.failed", {
268
- name,
269
- err: String(err)
270
- });
271
- });
272
- }, renewMs);
273
- if (typeof renewTimer.unref === "function") {
274
- renewTimer.unref();
275
- }
276
- try {
277
- const result = await fn();
278
- return {
279
- acquired: true,
280
- result
281
- };
282
- } finally {
283
- stopped = true;
284
- clearInterval(renewTimer);
285
- try {
286
- await releaseLease(redis, key2, token);
287
- logger.info("leaderLock.released", {
288
- name,
289
- token
290
- });
291
- } catch (err) {
292
- logger.warn("leaderLock.release.failed", {
293
- name,
294
- err: String(err)
295
- });
296
- }
297
- }
298
- }
299
- __name(withLeaderLock, "withLeaderLock");
300
- function createLeaderLease(options) {
301
- const { name, ttlMs, redis } = options;
302
- const key2 = leaderKey(name);
303
- const token = generateToken();
304
- const renewMs = options.renewMs ?? defaultRenewMs(ttlMs);
305
- let held = false;
306
- let released = false;
307
- let inFlight = null;
308
- const acquireOrRenew = /* @__PURE__ */ __name(async () => {
309
- if (released) return false;
310
- try {
311
- if (held) {
312
- if (await renewLease(redis, key2, token, ttlMs)) {
313
- return true;
314
- }
315
- held = false;
316
- }
317
- const acquired = await acquireLease(redis, key2, token, ttlMs);
318
- if (acquired && !held) {
319
- logger.info("leaderLease.acquired", {
320
- name,
321
- token,
322
- ttlMs
323
- });
324
- }
325
- held = acquired;
326
- return held;
327
- } catch (err) {
328
- logger.warn("leaderLease.renew.failed", {
329
- name,
330
- err: String(err)
331
- });
332
- return held;
333
- }
334
- }, "acquireOrRenew");
335
- const runAttempt = /* @__PURE__ */ __name(() => {
336
- if (inFlight) return inFlight;
337
- const attempt = acquireOrRenew().finally(() => {
338
- if (inFlight === attempt) inFlight = null;
339
- });
340
- inFlight = attempt;
341
- return attempt;
342
- }, "runAttempt");
343
- const timer = setInterval(() => {
344
- if (released) return;
345
- void runAttempt();
346
- }, renewMs);
347
- if (typeof timer.unref === "function") {
348
- timer.unref();
349
- }
350
- return {
351
- renew() {
352
- return runAttempt();
353
- },
354
- async release() {
355
- if (released) return;
356
- released = true;
357
- clearInterval(timer);
358
- if (inFlight) {
359
- try {
360
- await inFlight;
361
- } catch {
362
- }
363
- }
364
- if (!held) return;
365
- held = false;
366
- try {
367
- await releaseLease(redis, key2, token);
368
- logger.info("leaderLease.released", {
369
- name,
370
- token
371
- });
372
- } catch (err) {
373
- logger.warn("leaderLease.release.failed", {
374
- name,
375
- err: String(err)
376
- });
377
- }
378
- },
379
- isHeld() {
380
- return held && !released;
381
- }
382
- };
383
- }
384
- __name(createLeaderLease, "createLeaderLease");
385
-
386
- // src/platform/rateLimit.ts
387
- async function rateLimitIncr(redis, input) {
388
- const fullKey = `besdk:rl:${input.key}`;
389
- const count = await redis.incr(fullKey);
390
- if (count === 1) {
391
- await redis.pexpire(fullKey, input.windowMs);
392
- }
393
- let ttl = -1;
394
- try {
395
- ttl = await redis.pttl(fullKey);
396
- } catch {
397
- ttl = input.windowMs;
398
- }
399
- const resetAt = Date.now() + (ttl > 0 ? ttl : input.windowMs);
400
- const remaining = Math.max(0, input.limit - count);
401
- return {
402
- allowed: count <= input.limit,
403
- count,
404
- remaining,
405
- resetAt
406
- };
407
- }
408
- __name(rateLimitIncr, "rateLimitIncr");
409
-
410
- // src/platform/paginator.ts
411
- var DEFAULT_GRAPHQL_PAGE_LIMIT = 50;
412
- var MAX_GRAPHQL_PAGE_LIMIT = 100;
413
- function clampLimit(input, opts = {}) {
414
- const def = opts.defaultLimit ?? 50;
415
- const max = opts.maxLimit ?? 200;
416
- const min = opts.minLimit ?? 1;
417
- if (input == null || Number.isNaN(input)) return def;
418
- return Math.min(Math.max(Math.floor(input), min), max);
419
- }
420
- __name(clampLimit, "clampLimit");
421
- function clampOffset(input) {
422
- if (input == null || Number.isNaN(input)) return 0;
423
- return Math.max(0, Math.floor(input));
424
- }
425
- __name(clampOffset, "clampOffset");
426
- function clampGraphqlLimit(input, opts = {}) {
427
- return clampLimit(input, {
428
- defaultLimit: opts.defaultLimit ?? DEFAULT_GRAPHQL_PAGE_LIMIT,
429
- maxLimit: opts.maxLimit ?? MAX_GRAPHQL_PAGE_LIMIT,
430
- minLimit: opts.minLimit ?? 1
431
- });
432
- }
433
- __name(clampGraphqlLimit, "clampGraphqlLimit");
434
- function normalizeOffsetPagination(input, opts = {}) {
435
- return {
436
- limit: clampGraphqlLimit(input?.limit, opts),
437
- offset: clampOffset(input?.offset)
438
- };
439
- }
440
- __name(normalizeOffsetPagination, "normalizeOffsetPagination");
441
- function normalizeCursorPagination(input, opts = {}) {
442
- const first = clampGraphqlLimit(input?.first, opts);
443
- const after = typeof input?.after === "string" && input.after.trim().length > 0 ? input.after : null;
444
- return {
445
- first,
446
- after,
447
- take: first + 1
448
- };
449
- }
450
- __name(normalizeCursorPagination, "normalizeCursorPagination");
451
- function encodeCursor(payload) {
452
- return Buffer.from(JSON.stringify(payload), "utf8").toString("base64url");
453
- }
454
- __name(encodeCursor, "encodeCursor");
455
- function decodeCursor(cursor) {
456
- if (typeof cursor !== "string" || cursor.trim().length === 0) return null;
457
- try {
458
- const decoded = JSON.parse(Buffer.from(cursor, "base64url").toString("utf8"));
459
- if (decoded == null || typeof decoded !== "object" || Array.isArray(decoded)) return null;
460
- const payload = {};
461
- for (const [key2, value] of Object.entries(decoded)) {
462
- if (typeof value === "string" || typeof value === "number" || typeof value === "boolean" || value == null) {
463
- payload[key2] = value;
464
- }
465
- }
466
- return Object.keys(payload).length > 0 ? payload : null;
467
- } catch {
468
- return null;
469
- }
470
- }
471
- __name(decodeCursor, "decodeCursor");
472
- function buildConnection(items, opts) {
473
- const nodes = items.length > opts.limit ? items.slice(0, opts.limit) : items;
474
- const edges = nodes.map((node) => ({
475
- node,
476
- cursor: opts.cursorForNode(node)
477
- }));
478
- const firstEdge = edges[0];
479
- const lastEdge = edges.at(-1);
480
- return {
481
- edges,
482
- nodes,
483
- pageInfo: {
484
- hasNextPage: items.length > opts.limit,
485
- hasPreviousPage: opts.hasPreviousPage ?? false,
486
- startCursor: firstEdge?.cursor ?? null,
487
- endCursor: lastEdge?.cursor ?? null
488
- },
489
- totalCount: opts.totalCount
490
- };
491
- }
492
- __name(buildConnection, "buildConnection");
493
- function buildOffsetPage(items, total, pagination) {
494
- const nextOffset = pagination.offset + items.length;
495
- const hasMore = nextOffset < total;
496
- return {
497
- items,
498
- total,
499
- limit: pagination.limit,
500
- offset: pagination.offset,
501
- hasMore,
502
- nextOffset: hasMore ? nextOffset : null
503
- };
504
- }
505
- __name(buildOffsetPage, "buildOffsetPage");
506
- function toPrismaPage(pagination) {
507
- return {
508
- take: pagination.limit,
509
- skip: pagination.offset
510
- };
511
- }
512
- __name(toPrismaPage, "toPrismaPage");
513
- async function paginate(model2, input, opts = {}) {
514
- const take = clampGraphqlLimit(input.take ?? void 0, opts);
515
- const items = await model2.findMany({
516
- take: take + 1,
517
- skip: input.cursor ? 1 : 0,
518
- cursor: input.cursor ? {
519
- id: input.cursor
520
- } : void 0,
521
- where: input.where,
522
- orderBy: input.orderBy
523
- });
524
- const hasMore = items.length > take;
525
- const trimmed = hasMore ? items.slice(0, take) : items;
526
- const nextCursor = hasMore && trimmed.length > 0 ? trimmed[trimmed.length - 1].id : null;
527
- return {
528
- items: trimmed,
529
- hasMore,
530
- nextCursor
531
- };
532
- }
533
- __name(paginate, "paginate");
534
-
535
- // src/platform/dataLoaderFactory.ts
536
- function buildLoaders(ctx, builder) {
537
- return builder(ctx);
538
- }
539
- __name(buildLoaders, "buildLoaders");
540
- function resolveReferenceLoader(loaderName, keyField = "id") {
541
- return async (reference, ctx) => {
542
- const loader = ctx.loaders[loaderName];
543
- if (!loader) {
544
- throw new Error(`resolveReferenceLoader: loader "${loaderName}" not found on ctx.loaders`);
545
- }
546
- const key2 = reference[keyField];
547
- if (typeof key2 !== "string") {
548
- return null;
549
- }
550
- return loader.load(key2);
551
- };
552
- }
553
- __name(resolveReferenceLoader, "resolveReferenceLoader");
554
-
555
- // src/platform/cacheInvalidation.ts
556
- var VERSION_PREFIX = "besdk:cv:";
557
- async function getNamespaceVersion(redis, namespace) {
558
- const v = await redis.get(`${VERSION_PREFIX}${namespace}`);
559
- if (!v) return 1;
560
- const n = Number.parseInt(v, 10);
561
- return Number.isFinite(n) && n > 0 ? n : 1;
562
- }
563
- __name(getNamespaceVersion, "getNamespaceVersion");
564
- async function buildCacheKey(redis, namespace, ...parts) {
565
- const ver = await getNamespaceVersion(redis, namespace);
566
- return `${namespace}:v${ver}:${parts.join(":")}`;
567
- }
568
- __name(buildCacheKey, "buildCacheKey");
569
- async function invalidateNamespace(redis, namespace) {
570
- return redis.incr(`${VERSION_PREFIX}${namespace}`);
571
- }
572
- __name(invalidateNamespace, "invalidateNamespace");
573
-
574
- // src/platform/pgPartition.ts
575
- function pad2(n) {
576
- return n < 10 ? `0${n}` : `${n}`;
577
- }
578
- __name(pad2, "pad2");
579
- function monthlyPartitionName(table, year, month) {
580
- return `${table}_y${year}m${pad2(month)}`;
581
- }
582
- __name(monthlyPartitionName, "monthlyPartitionName");
583
- async function ensureMonthlyPartitions(prisma, opts) {
584
- const created = [];
585
- const cur = new Date(Date.UTC(opts.from.getUTCFullYear(), opts.from.getUTCMonth(), 1));
586
- const end = new Date(Date.UTC(opts.to.getUTCFullYear(), opts.to.getUTCMonth(), 1));
587
- while (cur <= end) {
588
- const y = cur.getUTCFullYear();
589
- const m = cur.getUTCMonth() + 1;
590
- const next = new Date(Date.UTC(y, m, 1));
591
- const partition = monthlyPartitionName(opts.table, y, m);
592
- const lower = `${y}-${pad2(m)}-01`;
593
- const upper = `${next.getUTCFullYear()}-${pad2(next.getUTCMonth() + 1)}-01`;
594
- await prisma.$executeRawUnsafe(`CREATE TABLE IF NOT EXISTS "${partition}" PARTITION OF "${opts.table}" FOR VALUES FROM ('${lower}') TO ('${upper}');`);
595
- created.push(partition);
596
- cur.setUTCMonth(cur.getUTCMonth() + 1);
597
- }
598
- return created;
599
- }
600
- __name(ensureMonthlyPartitions, "ensureMonthlyPartitions");
601
- async function dropOldPartitions(prisma, opts) {
602
- const rows = await prisma.$queryRawUnsafe(`SELECT child.relname AS partition_name
603
- FROM pg_inherits
604
- JOIN pg_class parent ON pg_inherits.inhparent = parent.oid
605
- JOIN pg_class child ON pg_inherits.inhrelid = child.oid
606
- WHERE parent.relname = $1`, opts.table);
607
- const dropped = [];
608
- const cutoffYear = opts.beforeDate.getUTCFullYear();
609
- const cutoffMonth = opts.beforeDate.getUTCMonth() + 1;
610
- for (const row of rows) {
611
- const partitionRe = /_y(\d{4})m(\d{2})$/;
612
- const m = partitionRe.exec(row.partition_name);
613
- if (!m) continue;
614
- const y = Number(m[1]);
615
- const mo = Number(m[2]);
616
- if (y < cutoffYear || y === cutoffYear && mo < cutoffMonth) {
617
- await prisma.$executeRawUnsafe(`DROP TABLE IF EXISTS "${row.partition_name}";`);
618
- dropped.push(row.partition_name);
619
- }
620
- }
621
- return dropped;
622
- }
623
- __name(dropOldPartitions, "dropOldPartitions");
624
-
625
- // src/platform/llmClient.ts
626
- var DEFAULTS = {
627
- timeoutMs: 3e4,
628
- maxAttempts: 3,
629
- initialDelayMs: 500,
630
- maxOutputTokensCap: 4096
631
- };
632
- function jitter2(n) {
633
- return Math.floor(Math.random() * n);
634
- }
635
- __name(jitter2, "jitter");
636
- function sleep2(ms) {
637
- return new Promise((r) => setTimeout(r, ms));
638
- }
639
- __name(sleep2, "sleep");
640
- var LLMRouter = class {
641
- static {
642
- __name(this, "LLMRouter");
643
- }
644
- adapters = /* @__PURE__ */ new Map();
645
- opts;
646
- constructor(opts = {}) {
647
- this.opts = {
648
- ...DEFAULTS,
649
- ...opts
650
- };
651
- }
652
- register(adapter) {
653
- this.adapters.set(adapter.name, adapter);
654
- }
655
- resolveChain() {
656
- const envChain = process.env["LLM_PROVIDER_CHAIN"]?.trim();
657
- if (envChain) {
658
- return envChain.split(",").map((s) => s.trim()).filter(Boolean);
659
- }
660
- return Array.from(this.adapters.keys());
661
- }
662
- async complete(req) {
663
- const cappedReq = {
664
- ...req,
665
- maxTokens: Math.min(req.maxTokens ?? this.opts.maxOutputTokensCap, this.opts.maxOutputTokensCap)
666
- };
667
- const chain = this.resolveChain();
668
- if (chain.length === 0) {
669
- throw new Error("LLMRouter: no providers registered");
670
- }
671
- let lastErr = null;
672
- for (let attempt = 0; attempt < this.opts.maxAttempts; attempt++) {
673
- const providerName = chain[attempt % chain.length];
674
- const adapter = providerName ? this.adapters.get(providerName) : void 0;
675
- if (!adapter) {
676
- logger.warn("llmRouter.provider.notRegistered", {
677
- providerName
678
- });
679
- continue;
680
- }
681
- const timeoutMs = req.timeoutMs ?? this.opts.timeoutMs;
682
- const ctrl = new AbortController();
683
- const t = setTimeout(() => ctrl.abort(), timeoutMs);
684
- try {
685
- const response = await adapter.complete(cappedReq, ctrl.signal);
686
- return response;
687
- } catch (err) {
688
- lastErr = err;
689
- logger.warn("llmRouter.attempt.failed", {
690
- provider: adapter.name,
691
- attempt,
692
- err: String(err)
693
- });
694
- if (attempt < this.opts.maxAttempts - 1) {
695
- const delay = this.opts.initialDelayMs * 2 ** attempt;
696
- await sleep2(jitter2(delay));
697
- }
698
- } finally {
699
- clearTimeout(t);
700
- }
701
- }
702
- throw lastErr instanceof Error ? lastErr : new Error(`LLMRouter exhausted ${this.opts.maxAttempts} attempts`);
703
- }
704
- };
705
-
706
- // src/platform/invocation-accounting/documents.ts
707
- var PROMPTS_V2_DOCUMENTS = Object.freeze({
708
- begin: "mutation SdkBeginInvocationAttemptV2($input:PromptBeginInvocationAttemptV2Input!){promptBeginInvocationAttemptV2(input:$input){id workspaceId attemptKey operationKey productKey providerKey modelKey startedAt trigger subjectType subjectId subjectPartId sequence createdBy origin fingerprint createdAt revisions{id attemptId revision predecessorId eventKey fingerprint outcome inputTokens outputTokens totalTokens cachedInputTokens costMicroUsd currency costKind pricingReference origin finishedAt createdAt} hasMoreRevisions}}",
709
- record: "mutation SdkRecordInvocationUsageV2($input:PromptRecordInvocationUsageV2Input!){promptRecordInvocationUsageV2(input:$input){id attemptId revision predecessorId eventKey fingerprint outcome inputTokens outputTokens totalTokens cachedInputTokens costMicroUsd currency costKind pricingReference origin finishedAt createdAt}}",
710
- read: "query SdkInvocationAttemptV2($key:String!,$offset:Int){promptInvocationAttemptV2(attemptKey:$key,revisionOffset:$offset){id workspaceId attemptKey operationKey productKey providerKey modelKey startedAt trigger subjectType subjectId subjectPartId sequence createdBy origin fingerprint createdAt revisions{id attemptId revision predecessorId eventKey fingerprint outcome inputTokens outputTokens totalTokens cachedInputTokens costMicroUsd currency costKind pricingReference origin finishedAt createdAt} hasMoreRevisions}}",
711
- summary: "query SdkUsageSummaryV2($from:DateTime!,$to:DateTime!,$product:String,$operation:String){promptUsageSummaryV2(from:$from,to:$to,productKey:$product,operationKey:$operation){workspaceId from to scope productKey operationKey origin currency costKind operations attempts pendingAttempts knownAttempts partialAttempts unknownAttempts inputTokens{knownSubtotal knownAttempts missingAttempts} outputTokens{knownSubtotal knownAttempts missingAttempts} totalTokens{knownSubtotal knownAttempts missingAttempts} costMicroUsd{knownSubtotal knownAttempts missingAttempts}}}",
712
- breakdown: "query SdkUsageBreakdownV2($from:DateTime!,$to:DateTime!,$groupBy:[PromptUsageDimensionV2!]!,$product:String,$operation:String,$subjectType:String,$subjectId:String,$trigger:String){promptUsageBreakdownV2(from:$from,to:$to,groupBy:$groupBy,productKey:$product,operationKey:$operation,subjectType:$subjectType,subjectId:$subjectId,trigger:$trigger){workspaceId from to scope groupBy productKey operationKey subjectType subjectId trigger origin currency costKind truncated rows{productKey providerKey modelKey operationKey trigger subjectType subjectId subjectPartId attempts pendingAttempts inputTokens{knownSubtotal knownAttempts missingAttempts} outputTokens{knownSubtotal knownAttempts missingAttempts} totalTokens{knownSubtotal knownAttempts missingAttempts} costMicroUsd{knownSubtotal knownAttempts missingAttempts}}}}"
713
- });
714
-
715
- // src/platform/invocation-accounting/contracts.ts
716
- var InvocationAccountingValidationError = class extends Error {
717
- static {
718
- __name(this, "InvocationAccountingValidationError");
719
- }
720
- constructor() {
721
- super("Invalid invocation accounting contract");
722
- this.name = "InvocationAccountingValidationError";
723
- }
724
- };
725
- function requireContract(value) {
726
- if (!value) throw new InvocationAccountingValidationError();
727
- }
728
- __name(requireContract, "requireContract");
729
- function isRecord(value) {
730
- return value !== null && typeof value === "object" && !Array.isArray(value);
731
- }
732
- __name(isRecord, "isRecord");
733
- function fields(value, names) {
734
- requireContract(isRecord(value));
735
- requireContract(Object.keys(value).length === names.length && names.every((name) => Object.hasOwn(value, name)));
736
- return value;
737
- }
738
- __name(fields, "fields");
739
- function fieldsAllowing(value, required, optional) {
740
- requireContract(isRecord(value));
741
- requireContract(required.every((name) => Object.hasOwn(value, name)));
742
- requireContract(Object.keys(value).every((name) => required.includes(name) || optional.includes(name)));
743
- return value;
744
- }
745
- __name(fieldsAllowing, "fieldsAllowing");
746
- function uuid(value) {
747
- requireContract(typeof value === "string" && value === value.trim() && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value));
748
- return value.toLowerCase();
749
- }
750
- __name(uuid, "uuid");
751
- function key(value, maximum = 128) {
752
- requireContract(typeof value === "string" && value.length <= maximum && value === value.trim() && /^[a-zA-Z0-9][a-zA-Z0-9._:-]*$/.test(value));
753
- return value;
754
- }
755
- __name(key, "key");
756
- function date(value) {
757
- requireContract(typeof value === "string" && value.length === 24);
758
- const parsed = new Date(value);
759
- requireContract(Number.isFinite(parsed.getTime()) && parsed.getUTCFullYear() >= 1 && value === parsed.toISOString());
760
- return value;
761
- }
762
- __name(date, "date");
763
- function fingerprint(value) {
764
- requireContract(typeof value === "string" && value.length === 64 && /^[0-9a-f]+$/.test(value));
765
- return value;
766
- }
767
- __name(fingerprint, "fingerprint");
768
- function decimal(value, maximumDigits = 19) {
769
- requireContract(typeof value === "string" && value.length <= maximumDigits && value === value.trim() && /^(?:0|[1-9]\d*)$/.test(value));
770
- return value;
771
- }
772
- __name(decimal, "decimal");
773
- function nullableCounter(value) {
774
- if (value === null) return null;
775
- const text = decimal(value);
776
- requireContract(BigInt(text) <= 9223372036854775807n);
777
- return text;
778
- }
779
- __name(nullableCounter, "nullableCounter");
780
- function validateInvocationIdentity(value) {
781
- const row = fields(value, [
782
- "workspaceId",
783
- "actorId",
784
- "actorType",
785
- "onBehalfOf"
786
- ]);
787
- const actorType = row["actorType"];
788
- requireContract(actorType === "user" || actorType === "app" || actorType === "service" || actorType === "super_admin");
789
- return Object.freeze({
790
- workspaceId: uuid(row["workspaceId"]),
791
- actorId: uuid(row["actorId"]),
792
- actorType,
793
- onBehalfOf: row["onBehalfOf"] === null ? null : uuid(row["onBehalfOf"])
794
- });
795
- }
796
- __name(validateInvocationIdentity, "validateInvocationIdentity");
797
- function sameIdentity(a, b) {
798
- return a.workspaceId === b.workspaceId && a.actorId === b.actorId && a.actorType === b.actorType && a.onBehalfOf === b.onBehalfOf;
799
- }
800
- __name(sameIdentity, "sameIdentity");
801
- var ATTEMPT_FIELDS = [
802
- "attemptKey",
803
- "operationKey",
804
- "productKey",
805
- "providerKey",
806
- "modelKey",
807
- "startedAt"
808
- ];
809
- var DIMENSION_FIELDS = [
810
- "trigger",
811
- "subjectType",
812
- "subjectId",
813
- "subjectPartId",
814
- "sequence"
815
- ];
816
- var TRIGGERS = [
817
- "interactive",
818
- "scheduled",
819
- "event",
820
- "api",
821
- "webhook",
822
- "test"
823
- ];
824
- function isTrigger(value) {
825
- return typeof value === "string" && TRIGGERS.includes(value);
826
- }
827
- __name(isTrigger, "isTrigger");
828
- function attemptDimensions(row) {
829
- const present = /* @__PURE__ */ __name((name) => row[name] !== void 0 && row[name] !== null, "present");
830
- const trigger = row["trigger"];
831
- const sequence = row["sequence"];
832
- if (present("trigger")) requireContract(isTrigger(trigger));
833
- if (present("sequence")) requireContract(typeof sequence === "number" && Number.isInteger(sequence) && sequence >= 0 && sequence <= 2147483647);
834
- requireContract(!present("subjectId") || present("subjectType"));
835
- requireContract(!present("subjectPartId") || present("subjectId"));
836
- return {
837
- ...isTrigger(trigger) ? {
838
- trigger
839
- } : {},
840
- ...present("subjectType") ? {
841
- subjectType: key(row["subjectType"], 64)
842
- } : {},
843
- ...present("subjectId") ? {
844
- subjectId: key(row["subjectId"])
845
- } : {},
846
- ...present("subjectPartId") ? {
847
- subjectPartId: key(row["subjectPartId"])
848
- } : {},
849
- ...typeof sequence === "number" ? {
850
- sequence
851
- } : {}
852
- };
853
- }
854
- __name(attemptDimensions, "attemptDimensions");
855
- function validateInvocationAttemptInput(value) {
856
- const row = fieldsAllowing(value, ATTEMPT_FIELDS, DIMENSION_FIELDS);
857
- const modelKey = row["modelKey"];
858
- requireContract(typeof modelKey === "string" && modelKey.length <= 128 && modelKey.split("/").every((segment) => {
859
- key(segment);
860
- return true;
861
- }));
862
- const product = key(row["productKey"], 64);
863
- return Object.freeze({
864
- attemptKey: key(row["attemptKey"]),
865
- operationKey: key(row["operationKey"]),
866
- productKey: productSlugVariants(product).length > 1 ? emitProductSlug(product) : product,
867
- providerKey: key(row["providerKey"], 64),
868
- modelKey,
869
- startedAt: date(row["startedAt"]),
870
- ...attemptDimensions(row)
871
- });
872
- }
873
- __name(validateInvocationAttemptInput, "validateInvocationAttemptInput");
874
- function validateInvocationUsageInput(value) {
875
- const row = fields(value, [
876
- "attemptKey",
877
- "eventKey",
878
- "revision",
879
- "predecessorId",
880
- "outcome",
881
- "inputTokens",
882
- "outputTokens",
883
- "cachedInputTokens",
884
- "costMicroUsd",
885
- "finishedAt"
886
- ]);
887
- const revision = row["revision"];
888
- const outcome = row["outcome"];
889
- requireContract(typeof revision === "number" && Number.isInteger(revision) && revision >= 1 && revision <= 2147483647);
890
- requireContract(outcome === "succeeded" || outcome === "failed" || outcome === "blocked" || outcome === "timed_out");
891
- const predecessorId = row["predecessorId"] === null ? null : uuid(row["predecessorId"]);
892
- requireContract(revision === 1 === (predecessorId === null) && row["costMicroUsd"] === null);
893
- const inputTokens = nullableCounter(row["inputTokens"]);
894
- const outputTokens = nullableCounter(row["outputTokens"]);
895
- const cachedInputTokens = nullableCounter(row["cachedInputTokens"]);
896
- requireContract(cachedInputTokens === null || inputTokens !== null && BigInt(cachedInputTokens) <= BigInt(inputTokens));
897
- return Object.freeze({
898
- attemptKey: key(row["attemptKey"]),
899
- eventKey: key(row["eventKey"]),
900
- revision,
901
- predecessorId,
902
- outcome,
903
- inputTokens,
904
- outputTokens,
905
- cachedInputTokens,
906
- costMicroUsd: null,
907
- finishedAt: date(row["finishedAt"])
908
- });
909
- }
910
- __name(validateInvocationUsageInput, "validateInvocationUsageInput");
911
- var usageFields = [
912
- "id",
913
- "attemptId",
914
- "revision",
915
- "predecessorId",
916
- "eventKey",
917
- "fingerprint",
918
- "outcome",
919
- "inputTokens",
920
- "outputTokens",
921
- "totalTokens",
922
- "cachedInputTokens",
923
- "costMicroUsd",
924
- "currency",
925
- "costKind",
926
- "pricingReference",
927
- "origin",
928
- "finishedAt",
929
- "createdAt"
930
- ];
931
- function historyReceipt(value, attemptKey, attemptId) {
932
- const row = fields(value, usageFields);
933
- const input = validateInvocationUsageInput({
934
- attemptKey,
935
- eventKey: row["eventKey"],
936
- revision: row["revision"],
937
- predecessorId: row["predecessorId"],
938
- outcome: row["outcome"],
939
- inputTokens: row["inputTokens"],
940
- outputTokens: row["outputTokens"],
941
- cachedInputTokens: row["cachedInputTokens"],
942
- costMicroUsd: null,
943
- finishedAt: row["finishedAt"]
944
- });
945
- const costMicroUsd = nullableCounter(row["costMicroUsd"]);
946
- const pricingReference = row["pricingReference"] === null ? null : key(row["pricingReference"], 255);
947
- requireContract(costMicroUsd === null || pricingReference !== null);
948
- const totalTokens = input.inputTokens === null || input.outputTokens === null ? null : (BigInt(input.inputTokens) + BigInt(input.outputTokens)).toString();
949
- requireContract(row["totalTokens"] === totalTokens && row["attemptId"] === attemptId && row["origin"] === "CALLER_REPORTED" && row["currency"] === "USD" && row["costKind"] === "ESTIMATE");
950
- return Object.freeze({
951
- id: uuid(row["id"]),
952
- attemptId,
953
- revision: input.revision,
954
- predecessorId: input.predecessorId,
955
- eventKey: input.eventKey,
956
- fingerprint: fingerprint(row["fingerprint"]),
957
- outcome: input.outcome,
958
- inputTokens: input.inputTokens,
959
- outputTokens: input.outputTokens,
960
- totalTokens,
961
- cachedInputTokens: input.cachedInputTokens,
962
- costMicroUsd,
963
- currency: "USD",
964
- costKind: "ESTIMATE",
965
- pricingReference,
966
- origin: "CALLER_REPORTED",
967
- finishedAt: input.finishedAt,
968
- createdAt: date(row["createdAt"])
969
- });
970
- }
971
- __name(historyReceipt, "historyReceipt");
972
- function validateInvocationUsageReceipt(value, expected, attemptId) {
973
- const input = validateInvocationUsageInput(expected);
974
- const known = historyReceipt(value, input.attemptKey, uuid(attemptId));
975
- requireContract(known.costMicroUsd === null === (known.pricingReference === null));
976
- for (const [field, actual] of Object.entries(known)) {
977
- if (field === "costMicroUsd") continue;
978
- const entry = Object.entries(input).find(([name]) => name === field);
979
- if (entry !== void 0) requireContract(entry[1] === actual);
980
- }
981
- return known;
982
- }
983
- __name(validateInvocationUsageReceipt, "validateInvocationUsageReceipt");
984
- function sameValues(a, b) {
985
- const left = Object.entries(a);
986
- const right = Object.entries(b);
987
- return left.length === right.length && left.every(([name, value]) => right.some(([other, item]) => other === name && item === value));
988
- }
989
- __name(sameValues, "sameValues");
990
- function envelope(value, field) {
991
- requireContract(isRecord(value));
992
- requireContract(value["errors"] === void 0 || Array.isArray(value["errors"]) && value["errors"].length === 0);
993
- const data = fields(value["data"], [
994
- field
995
- ]);
996
- return data[field];
997
- }
998
- __name(envelope, "envelope");
999
- function validateInvocationAttemptReceipt(value, expected, identity) {
1000
- const context = validateInvocationIdentity(identity);
1001
- const selected = validateInvocationAttemptInput(expected);
1002
- const row = fieldsAllowing(value, [
1003
- "id",
1004
- "workspaceId",
1005
- "attemptKey",
1006
- "operationKey",
1007
- "productKey",
1008
- "providerKey",
1009
- "modelKey",
1010
- "startedAt",
1011
- "createdBy",
1012
- "origin",
1013
- "fingerprint",
1014
- "createdAt",
1015
- "revisions",
1016
- "hasMoreRevisions"
1017
- ], DIMENSION_FIELDS);
1018
- const input = validateInvocationAttemptInput({
1019
- attemptKey: row["attemptKey"],
1020
- operationKey: row["operationKey"],
1021
- productKey: row["productKey"],
1022
- providerKey: row["providerKey"],
1023
- modelKey: row["modelKey"],
1024
- startedAt: row["startedAt"],
1025
- ...Object.fromEntries(DIMENSION_FIELDS.filter((name) => Object.hasOwn(row, name)).map((name) => [
1026
- name,
1027
- row[name]
1028
- ]))
1029
- });
1030
- requireContract(sameValues(input, selected) && row["workspaceId"] === context.workspaceId && row["createdBy"] === context.actorId && row["origin"] === "CALLER_REPORTED");
1031
- requireContract(Array.isArray(row["revisions"]) && row["revisions"].length <= 50 && typeof row["hasMoreRevisions"] === "boolean");
1032
- const entries = row["revisions"];
1033
- const id = uuid(row["id"]);
1034
- const revisions = entries.map((entry) => historyReceipt(entry, selected.attemptKey, id));
1035
- requireContract(new Set(revisions.map((revision) => revision.id)).size === revisions.length);
1036
- requireContract(new Set(revisions.map((revision) => revision.eventKey)).size === revisions.length);
1037
- requireContract(revisions.every((revision, index) => index === 0 || revision.revision < (revisions[index - 1]?.revision ?? 0)));
1038
- return Object.freeze({
1039
- ...input,
1040
- id,
1041
- workspaceId: context.workspaceId,
1042
- createdBy: context.actorId,
1043
- origin: "CALLER_REPORTED",
1044
- fingerprint: fingerprint(row["fingerprint"]),
1045
- createdAt: date(row["createdAt"]),
1046
- revisions: Object.freeze(revisions),
1047
- hasMoreRevisions: row["hasMoreRevisions"]
1048
- });
1049
- }
1050
- __name(validateInvocationAttemptReceipt, "validateInvocationAttemptReceipt");
1051
-
1052
- // src/platform/invocation-accounting/coordinator.ts
1053
- function parseIntent(value) {
1054
- requireContract(isRecord(value));
1055
- const kind = value["kind"];
1056
- const row = fields(value, kind === "begin" ? [
1057
- "kind",
1058
- "identity",
1059
- "key",
1060
- "input"
1061
- ] : [
1062
- "kind",
1063
- "identity",
1064
- "key",
1065
- "input",
1066
- "attempt",
1067
- "attemptId"
1068
- ]);
1069
- const identity = validateInvocationIdentity(row["identity"]);
1070
- const key2 = uuid(row["key"]);
1071
- if (kind === "begin") return Object.freeze({
1072
- kind,
1073
- identity,
1074
- key: key2,
1075
- input: validateInvocationAttemptInput(row["input"])
1076
- });
1077
- requireContract(kind === "record");
1078
- const input = validateInvocationUsageInput(row["input"]);
1079
- const attempt = validateInvocationAttemptInput(row["attempt"]);
1080
- requireContract(input.attemptKey === attempt.attemptKey && input.finishedAt >= attempt.startedAt);
1081
- return Object.freeze({
1082
- kind,
1083
- identity,
1084
- key: key2,
1085
- input,
1086
- attempt,
1087
- attemptId: uuid(row["attemptId"])
1088
- });
1089
- }
1090
- __name(parseIntent, "parseIntent");
1091
- function receipt(value, intent) {
1092
- return intent.kind === "begin" ? validateInvocationAttemptReceipt(value, intent.input, intent.identity) : validateInvocationUsageReceipt(value, intent.input, intent.attemptId);
1093
- }
1094
- __name(receipt, "receipt");
1095
- function validateInvocationDelivery(value) {
1096
- const row = fields(value, [
1097
- "intent",
1098
- "version",
1099
- "state",
1100
- "receipt",
1101
- "observedIds"
1102
- ]);
1103
- const intent = parseIntent(row["intent"]);
1104
- const version = row["version"];
1105
- const state = row["state"];
1106
- requireContract(typeof version === "number" && Number.isSafeInteger(version) && version >= 0);
1107
- requireContract(state === "UNSENT" || state === "DISPATCHED" || state === "UNKNOWN" || state === "ACKNOWLEDGED");
1108
- requireContract(Array.isArray(row["observedIds"]) && row["observedIds"].length <= 3);
1109
- const values = row["observedIds"];
1110
- const observedIds = Object.freeze(values.map(uuid));
1111
- requireContract(new Set(observedIds).size === observedIds.length);
1112
- const known = row["receipt"] === null ? null : receipt(row["receipt"], intent);
1113
- requireContract(state === "ACKNOWLEDGED" === (known !== null));
1114
- requireContract(known === null || observedIds.every((id) => ids(known).includes(id)));
1115
- return Object.freeze({
1116
- intent,
1117
- version,
1118
- state,
1119
- receipt: known,
1120
- observedIds
1121
- });
1122
- }
1123
- __name(validateInvocationDelivery, "validateInvocationDelivery");
1124
- function sameIntent(a, b) {
1125
- return a.kind === b.kind && a.key === b.key && sameIdentity(a.identity, b.identity) && sameValues(a.input, b.input) && (a.kind !== "record" || b.kind === "record" && a.attemptId === b.attemptId && sameValues(a.attempt, b.attempt));
1126
- }
1127
- __name(sameIntent, "sameIntent");
1128
- function ids(value) {
1129
- if (!isRecord(value)) return [];
1130
- const found = [];
1131
- for (const name of [
1132
- "id",
1133
- "attemptId",
1134
- "predecessorId"
1135
- ]) {
1136
- try {
1137
- const id = uuid(value[name]);
1138
- if (!found.includes(id)) found.push(id);
1139
- } catch {
1140
- }
1141
- }
1142
- return Object.freeze(found);
1143
- }
1144
- __name(ids, "ids");
1145
- var hold = /* @__PURE__ */ __name((reason, observedIds = [], knownReceipt) => knownReceipt ? {
1146
- status: "HOLD",
1147
- reason,
1148
- observedIds,
1149
- knownReceipt
1150
- } : {
1151
- status: "HOLD",
1152
- reason,
1153
- observedIds
1154
- }, "hold");
1155
- var InvocationAccountingCoordinator = class {
1156
- static {
1157
- __name(this, "InvocationAccountingCoordinator");
1158
- }
1159
- options;
1160
- now;
1161
- constructor(options) {
1162
- this.options = options;
1163
- this.now = options.now ?? Date.now;
1164
- }
1165
- async admitted(identity) {
1166
- try {
1167
- const admission = await this.options.admit();
1168
- const now = this.now();
1169
- return admission !== null && sameIdentity(validateInvocationIdentity(admission.identity), identity) && Number.isFinite(admission.expiresAt) && Number.isFinite(now) && now < admission.expiresAt;
1170
- } catch {
1171
- return false;
1172
- }
1173
- }
1174
- async load(identity, key2) {
1175
- const row = await this.options.store.load(identity, key2);
1176
- if (row === null) return null;
1177
- const parsed = validateInvocationDelivery(row);
1178
- requireContract(parsed.intent.key === key2 && sameIdentity(parsed.intent.identity, identity));
1179
- return parsed;
1180
- }
1181
- async unknown(previous, observedIds) {
1182
- try {
1183
- await this.options.store.compareAndSet(previous, Object.freeze({
1184
- ...previous,
1185
- version: previous.version + 1,
1186
- state: "UNKNOWN",
1187
- observedIds
1188
- }));
1189
- } catch {
1190
- }
1191
- }
1192
- async acknowledge(previous, known, observedIds) {
1193
- if (!previous.observedIds.every((id) => ids(known).includes(id))) return hold("RECEIPT", observedIds, known);
1194
- try {
1195
- const saved = await this.options.store.compareAndSet(previous, Object.freeze({
1196
- ...previous,
1197
- version: previous.version + 1,
1198
- state: "ACKNOWLEDGED",
1199
- receipt: known,
1200
- observedIds
1201
- }));
1202
- if (!saved) return hold("STORE", observedIds, known);
1203
- } catch {
1204
- return hold("STORE", observedIds, known);
1205
- }
1206
- if (!await this.admitted(previous.intent.identity)) return hold("CONTEXT", observedIds, known);
1207
- return {
1208
- status: "ACKNOWLEDGED",
1209
- receipt: known,
1210
- observedIds
1211
- };
1212
- }
1213
- async deliver(intent) {
1214
- if (!await this.admitted(intent.identity)) return hold("CONTEXT");
1215
- let previous;
1216
- try {
1217
- let existing = await this.load(intent.identity, intent.key);
1218
- if (existing === null) {
1219
- const initial = Object.freeze({
1220
- intent,
1221
- version: 0,
1222
- state: "UNSENT",
1223
- receipt: null,
1224
- observedIds: Object.freeze([])
1225
- });
1226
- await this.options.store.create(initial);
1227
- existing = await this.load(intent.identity, intent.key);
1228
- }
1229
- if (existing === null) return hold("STORE");
1230
- if (!sameIntent(existing.intent, intent)) return hold("OCCUPIED", existing.observedIds);
1231
- if (existing.state === "ACKNOWLEDGED" && existing.receipt !== null) {
1232
- return await this.admitted(intent.identity) ? {
1233
- status: "ACKNOWLEDGED",
1234
- receipt: existing.receipt,
1235
- observedIds: existing.observedIds
1236
- } : hold("CONTEXT", existing.observedIds);
1237
- }
1238
- if (existing.state !== "UNSENT") return hold("UNKNOWN", existing.observedIds);
1239
- previous = Object.freeze({
1240
- ...existing,
1241
- version: existing.version + 1,
1242
- state: "DISPATCHED"
1243
- });
1244
- if (!await this.options.store.compareAndSet(existing, previous)) return hold("OCCUPIED", existing.observedIds);
1245
- } catch {
1246
- return hold("STORE");
1247
- }
1248
- if (!await this.admitted(intent.identity)) {
1249
- await this.unknown(previous, []);
1250
- return hold("CONTEXT");
1251
- }
1252
- let raw;
1253
- try {
1254
- const input = intent.kind === "record" ? Object.freeze({
1255
- ...intent.input,
1256
- serverPricing: true
1257
- }) : intent.input;
1258
- raw = await this.options.transport(PROMPTS_V2_DOCUMENTS[intent.kind], Object.freeze({
1259
- input
1260
- }));
1261
- } catch {
1262
- await this.unknown(previous, []);
1263
- return hold("UNKNOWN");
1264
- }
1265
- const field = intent.kind === "begin" ? "promptBeginInvocationAttemptV2" : "promptRecordInvocationUsageV2";
1266
- const data = isRecord(raw) && isRecord(raw["data"]) ? raw["data"][field] : null;
1267
- const observedIds = ids(data);
1268
- let known;
1269
- try {
1270
- known = receipt(envelope(raw, field), intent);
1271
- } catch {
1272
- await this.unknown(previous, observedIds);
1273
- return hold("RECEIPT", observedIds);
1274
- }
1275
- return this.acknowledge(previous, known, observedIds);
1276
- }
1277
- async begin(identity, key2, input) {
1278
- return this.deliver(parseIntent({
1279
- kind: "begin",
1280
- identity,
1281
- key: key2,
1282
- input
1283
- }));
1284
- }
1285
- async record(identity, key2, beginKey, input, predecessorKey = null) {
1286
- const context = validateInvocationIdentity(identity);
1287
- const observation = validateInvocationUsageInput(input);
1288
- if (!await this.admitted(context)) return hold("CONTEXT");
1289
- try {
1290
- const begin = await this.load(context, uuid(beginKey));
1291
- if (begin?.state !== "ACKNOWLEDGED" || begin.intent.kind !== "begin") return hold("UNKNOWN");
1292
- const attempt = validateInvocationAttemptReceipt(begin.receipt, begin.intent.input, context);
1293
- if (observation.revision > 1) {
1294
- const previous = predecessorKey === null ? null : await this.load(context, uuid(predecessorKey));
1295
- if (previous?.state !== "ACKNOWLEDGED" || previous.intent.kind !== "record" || previous.intent.attemptId !== attempt.id) return hold("UNKNOWN");
1296
- const known = validateInvocationUsageReceipt(previous.receipt, previous.intent.input, attempt.id);
1297
- if (observation.predecessorId !== known.id || observation.revision !== known.revision + 1 || observation.eventKey === known.eventKey) return hold("RECEIPT");
1298
- } else if (predecessorKey !== null) return hold("RECEIPT");
1299
- return await this.deliver(parseIntent({
1300
- kind: "record",
1301
- identity: context,
1302
- key: key2,
1303
- input: observation,
1304
- attempt: begin.intent.input,
1305
- attemptId: attempt.id
1306
- }));
1307
- } catch {
1308
- return hold("STORE");
1309
- }
1310
- }
1311
- /** Explicit read-only reconciliation; no mutation retransmit, no absence proof. At most four pages. */
1312
- async reconcile(identity, key2) {
1313
- const context = validateInvocationIdentity(identity);
1314
- if (!await this.admitted(context)) return hold("CONTEXT");
1315
- let previous;
1316
- try {
1317
- const existing = await this.load(context, uuid(key2));
1318
- if (existing === null) return hold("UNKNOWN");
1319
- previous = existing;
1320
- } catch {
1321
- return hold("STORE");
1322
- }
1323
- if (!await this.admitted(context)) return hold("CONTEXT", previous.observedIds);
1324
- if (previous.state === "ACKNOWLEDGED" && previous.receipt !== null) return {
1325
- status: "ACKNOWLEDGED",
1326
- receipt: previous.receipt,
1327
- observedIds: previous.observedIds
1328
- };
1329
- if (previous.state === "UNSENT") return hold("UNKNOWN");
1330
- const intent = previous.intent;
1331
- if (intent.kind === "begin") return hold("HISTORY", previous.observedIds);
1332
- const expected = intent.attempt;
1333
- for (let page = 0; page < 4; page++) {
1334
- if (!await this.admitted(context)) return hold("CONTEXT", previous.observedIds);
1335
- try {
1336
- const response = await this.options.transport(PROMPTS_V2_DOCUMENTS.read, {
1337
- key: expected.attemptKey,
1338
- offset: page * 50
1339
- });
1340
- const row = envelope(response, "promptInvocationAttemptV2");
1341
- if (row === null) return hold("HISTORY", previous.observedIds);
1342
- const attempt = validateInvocationAttemptReceipt(row, expected, context);
1343
- const matches = attempt.revisions.filter((revision) => revision.eventKey === intent.input.eventKey);
1344
- const match = matches[0];
1345
- if (matches.length === 1 && match !== void 0) {
1346
- const known = validateInvocationUsageReceipt(match, intent.input, intent.attemptId);
1347
- return await this.acknowledge(previous, known, ids(known));
1348
- }
1349
- if (matches.length > 1 || !attempt.hasMoreRevisions) return hold("HISTORY", previous.observedIds);
1350
- } catch {
1351
- return hold("HISTORY", previous.observedIds);
1352
- }
1353
- }
1354
- return hold("HISTORY", previous.observedIds);
1355
- }
1356
- };
1357
-
1358
- // src/platform/invocation-accounting/normalizers.ts
1359
- var MAX_COUNTER = 9223372036854775807n;
1360
- function isObject(value) {
1361
- return value !== null && typeof value === "object" && !Array.isArray(value);
1362
- }
1363
- __name(isObject, "isObject");
1364
- function object(value) {
1365
- return isObject(value) ? value : {};
1366
- }
1367
- __name(object, "object");
1368
- function counter(value, issue, issues) {
1369
- if (value == null) return null;
1370
- const text = typeof value === "number" && Number.isSafeInteger(value) && value >= 0 ? String(value) : value;
1371
- if (typeof text !== "string" || text.length > 19 || !/^(?:0|[1-9]\d*)$/.test(text) || text !== text.trim() || BigInt(text) > MAX_COUNTER) {
1372
- issues.push(issue);
1373
- return null;
1374
- }
1375
- return text;
1376
- }
1377
- __name(counter, "counter");
1378
- function model(value) {
1379
- return typeof value === "string" && value.length > 0 && value.length <= 255 && value === value.trim() && !/[\u0000-\u001f\u007f]/.test(value) ? value : null;
1380
- }
1381
- __name(model, "model");
1382
- function normalizeOpenAIUsage(response) {
1383
- const row = object(response);
1384
- const usage = object(row["usage"]);
1385
- const issues = [];
1386
- const inputTokens = counter(usage["prompt_tokens"], "INPUT", issues);
1387
- const outputTokens = counter(usage["completion_tokens"], "OUTPUT", issues);
1388
- let cachedInputTokens = counter(object(usage["prompt_tokens_details"])["cached_tokens"], "CACHE_READ", issues);
1389
- if (cachedInputTokens !== null && (inputTokens === null || BigInt(cachedInputTokens) > BigInt(inputTokens))) {
1390
- issues.push("CACHE_SUBSET");
1391
- cachedInputTokens = null;
1392
- }
1393
- return {
1394
- inputTokens,
1395
- outputTokens,
1396
- cachedInputTokens,
1397
- costMicroUsd: null,
1398
- reportedModel: model(row["model"]),
1399
- issues
1400
- };
1401
- }
1402
- __name(normalizeOpenAIUsage, "normalizeOpenAIUsage");
1403
- function normalizeClaudeUsage(response) {
1404
- const row = object(response);
1405
- const usage = object(row["usage"]);
1406
- const issues = [];
1407
- const uncachedInputTokens = counter(usage["input_tokens"], "INPUT", issues);
1408
- const outputTokens = counter(usage["output_tokens"], "OUTPUT", issues);
1409
- const cacheCreationInputTokens = counter(usage["cache_creation_input_tokens"], "CACHE_WRITE", issues);
1410
- const cacheReadInputTokens = counter(usage["cache_read_input_tokens"], "CACHE_READ", issues);
1411
- let inputTokens = null;
1412
- if (uncachedInputTokens !== null && cacheCreationInputTokens !== null && cacheReadInputTokens !== null) {
1413
- const total = BigInt(uncachedInputTokens) + BigInt(cacheCreationInputTokens) + BigInt(cacheReadInputTokens);
1414
- if (total <= MAX_COUNTER) inputTokens = total.toString();
1415
- else issues.push("INPUT_OVERFLOW");
1416
- }
1417
- return {
1418
- inputTokens,
1419
- outputTokens,
1420
- cachedInputTokens: inputTokens === null ? null : cacheReadInputTokens,
1421
- costMicroUsd: null,
1422
- reportedModel: model(row["model"]),
1423
- issues,
1424
- uncachedInputTokens,
1425
- cacheCreationInputTokens,
1426
- cacheReadInputTokens
1427
- };
1428
- }
1429
- __name(normalizeClaudeUsage, "normalizeClaudeUsage");
1430
- function createClaudeUsageAccumulator() {
1431
- let usage = {};
1432
- let reportedModel;
1433
- const highest = /* @__PURE__ */ new Map();
1434
- const regressed = /* @__PURE__ */ new Set();
1435
- return (snapshot) => {
1436
- const row = object(snapshot);
1437
- const incoming = object(row["usage"]);
1438
- for (const key2 of [
1439
- "input_tokens",
1440
- "output_tokens",
1441
- "cache_creation_input_tokens",
1442
- "cache_read_input_tokens"
1443
- ]) {
1444
- if (Object.hasOwn(incoming, key2)) {
1445
- const parsed = counter(incoming[key2], "INPUT", []);
1446
- const previous = highest.get(key2);
1447
- if (parsed !== null && previous !== void 0 && BigInt(parsed) < previous) {
1448
- usage = {
1449
- ...usage,
1450
- [key2]: null
1451
- };
1452
- regressed.add(key2);
1453
- } else {
1454
- usage = {
1455
- ...usage,
1456
- [key2]: incoming[key2]
1457
- };
1458
- if (parsed !== null) {
1459
- highest.set(key2, BigInt(parsed));
1460
- regressed.delete(key2);
1461
- }
1462
- }
1463
- }
1464
- }
1465
- if (Object.hasOwn(row, "model")) reportedModel = row["model"];
1466
- const result = normalizeClaudeUsage({
1467
- model: reportedModel,
1468
- usage
1469
- });
1470
- return regressed.size === 0 ? result : {
1471
- ...result,
1472
- issues: [
1473
- ...result.issues,
1474
- "CUMULATIVE_REGRESSION"
1475
- ]
1476
- };
1477
- };
1478
- }
1479
- __name(createClaudeUsageAccumulator, "createClaudeUsageAccumulator");
1480
-
1481
- // src/platform/invocation-accounting/summary.ts
1482
- function canonicalProduct(value) {
1483
- if (value === null) return null;
1484
- const product = key(value, 64);
1485
- return productSlugVariants(product).length > 1 ? emitProductSlug(product) : product;
1486
- }
1487
- __name(canonicalProduct, "canonicalProduct");
1488
- function validateInvocationUsageSummary(value, selection) {
1489
- const row = fields(value, [
1490
- "workspaceId",
1491
- "from",
1492
- "to",
1493
- "productKey",
1494
- "operationKey",
1495
- "scope",
1496
- "origin",
1497
- "currency",
1498
- "costKind",
1499
- "attempts",
1500
- "operations",
1501
- "pendingAttempts",
1502
- "knownAttempts",
1503
- "partialAttempts",
1504
- "unknownAttempts",
1505
- "inputTokens",
1506
- "outputTokens",
1507
- "totalTokens",
1508
- "costMicroUsd"
1509
- ]);
1510
- const workspaceId = uuid(selection.workspaceId);
1511
- const from = date(selection.from), to = date(selection.to);
1512
- requireContract(from < to && new Date(to).getTime() - new Date(from).getTime() <= 366 * 864e5);
1513
- const productKey = canonicalProduct(selection.productKey);
1514
- requireContract(canonicalProduct(row["productKey"]) === productKey);
1515
- const operationKey = selection.operationKey === null ? null : key(selection.operationKey);
1516
- for (const [name, expected] of Object.entries({
1517
- workspaceId,
1518
- from,
1519
- to,
1520
- operationKey,
1521
- scope: "RECORDED_V2_ATTEMPTS",
1522
- origin: "CALLER_REPORTED",
1523
- currency: "USD",
1524
- costKind: "ESTIMATE"
1525
- })) requireContract(row[name] === expected);
1526
- const attempts = decimal(row["attempts"]), operations = decimal(row["operations"]);
1527
- const pendingAttempts = decimal(row["pendingAttempts"]), knownAttempts = decimal(row["knownAttempts"]);
1528
- const partialAttempts = decimal(row["partialAttempts"]), unknownAttempts = decimal(row["unknownAttempts"]);
1529
- requireContract(BigInt(operations) <= BigInt(attempts) && BigInt(pendingAttempts) <= BigInt(unknownAttempts) && BigInt(knownAttempts) + BigInt(partialAttempts) + BigInt(unknownAttempts) === BigInt(attempts));
1530
- const component = /* @__PURE__ */ __name((value2) => {
1531
- const item = fields(value2, [
1532
- "knownSubtotal",
1533
- "knownAttempts",
1534
- "missingAttempts"
1535
- ]);
1536
- const known = decimal(item["knownAttempts"]), missing = decimal(item["missingAttempts"]);
1537
- const subtotal = item["knownSubtotal"] === null ? null : decimal(item["knownSubtotal"], 255);
1538
- requireContract(BigInt(known) + BigInt(missing) === BigInt(attempts) && known === "0" === (subtotal === null));
1539
- return Object.freeze({
1540
- knownSubtotal: subtotal,
1541
- knownAttempts: known,
1542
- missingAttempts: missing
1543
- });
1544
- }, "component");
1545
- return Object.freeze({
1546
- workspaceId,
1547
- from,
1548
- to,
1549
- productKey,
1550
- operationKey,
1551
- scope: "RECORDED_V2_ATTEMPTS",
1552
- origin: "CALLER_REPORTED",
1553
- currency: "USD",
1554
- costKind: "ESTIMATE",
1555
- attempts,
1556
- operations,
1557
- pendingAttempts,
1558
- knownAttempts,
1559
- partialAttempts,
1560
- unknownAttempts,
1561
- inputTokens: component(row["inputTokens"]),
1562
- outputTokens: component(row["outputTokens"]),
1563
- totalTokens: component(row["totalTokens"]),
1564
- costMicroUsd: component(row["costMicroUsd"])
1565
- });
1566
- }
1567
- __name(validateInvocationUsageSummary, "validateInvocationUsageSummary");
1568
-
1569
- export { CircuitBreakerOpenError, DEFAULT_GRAPHQL_PAGE_LIMIT, InvocationAccountingCoordinator, InvocationAccountingValidationError, LLMRouter, MAX_GRAPHQL_PAGE_LIMIT, PROMPTS_V2_DOCUMENTS, __resetHttpClientBreakers, buildCacheKey, buildConnection, buildLoaders, buildOffsetPage, clampGraphqlLimit, clampLimit, clampOffset, createClaudeUsageAccumulator, createHttpClient, createLeaderLease, decodeCursor, dropOldPartitions, encodeCursor, ensureMonthlyPartitions, getNamespaceVersion, httpClient, invalidateNamespace, monthlyPartitionName, normalizeClaudeUsage, normalizeCursorPagination, normalizeOffsetPagination, normalizeOpenAIUsage, normalizeRedisUrl, paginate, platform_exports, rateLimitIncr, resolveReferenceLoader, toPrismaPage, validateInvocationAttemptInput, validateInvocationAttemptReceipt, validateInvocationDelivery, validateInvocationIdentity, validateInvocationUsageInput, validateInvocationUsageReceipt, validateInvocationUsageSummary, withLeaderLock };
1570
- //# sourceMappingURL=chunk-HC6MPUIH.js.map
1571
- //# sourceMappingURL=chunk-HC6MPUIH.js.map