@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.
- package/configs/eslint/index.js +1 -1
- package/configs/tsconfig/tsconfig.json +1 -1
- package/dist/EventQueueFactory-9NGZV9jl.js +1457 -0
- package/dist/EventQueueFactory-9NGZV9jl.js.map +1 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js +283 -0
- package/dist/RedisStreamsConnection-CY8WySJy.js.map +1 -0
- package/dist/ai-credits/index.d.ts +2 -3
- package/dist/ai-credits/index.js +3 -4
- package/dist/ai-credits/index.js.map +1 -1
- package/dist/ai-credits-Ca-NNcVx.js +546 -0
- package/dist/ai-credits-Ca-NNcVx.js.map +1 -0
- package/dist/{assistant-session-CJZhF4D6.d.ts → assistant-session-DA5ZKJOr.d.ts} +4 -5
- package/dist/auth/index.d.ts +2 -77
- package/dist/auth/index.js +3 -7
- package/dist/auth/index.js.map +1 -1
- package/dist/auth-CEuBEBQN.js +228 -0
- package/dist/auth-CEuBEBQN.js.map +1 -0
- package/dist/cache/index.d.ts +2 -3
- package/dist/cache/index.js +3 -7
- package/dist/cache/index.js.map +1 -1
- package/dist/cache-CU0uLwcS.js +1837 -0
- package/dist/cache-CU0uLwcS.js.map +1 -0
- package/dist/captcha/index.d.ts +2 -1
- package/dist/captcha/index.js +3 -3
- package/dist/captcha/index.js.map +1 -1
- package/dist/captcha-BT7yh1YS.js +77 -0
- package/dist/captcha-BT7yh1YS.js.map +1 -0
- package/dist/client/internal-client.d.ts +4 -7
- package/dist/client/internal-client.js +172 -4
- package/dist/client/internal-client.js.map +1 -1
- package/dist/client-BgAEvDC2.d.ts +86 -0
- package/dist/client-DcZ3iGES.js +565 -0
- package/dist/client-DcZ3iGES.js.map +1 -0
- package/dist/collector-endpoint-iyQYeI50.js +50 -0
- package/dist/collector-endpoint-iyQYeI50.js.map +1 -0
- package/dist/context-CZnXf2yb.js +247 -0
- package/dist/context-CZnXf2yb.js.map +1 -0
- package/dist/crypto/index.d.ts +2 -1
- package/dist/crypto/index.js +3 -3
- package/dist/crypto/index.js.map +1 -1
- package/dist/crypto-DO9fM0FO.js +145 -0
- package/dist/crypto-DO9fM0FO.js.map +1 -0
- package/dist/database/index.d.ts +104 -108
- package/dist/database/index.js +468 -6
- package/dist/database/index.js.map +1 -1
- package/dist/dataloader/index.d.ts +2 -1
- package/dist/dataloader/index.js +3 -3
- package/dist/dataloader/index.js.map +1 -1
- package/dist/dataloader-DwpT3YoS.js +294 -0
- package/dist/dataloader-DwpT3YoS.js.map +1 -0
- package/dist/deployed-environment-p_Tdl3sT.js +38 -0
- package/dist/deployed-environment-p_Tdl3sT.js.map +1 -0
- package/dist/dist-BGKdXVy3.js +1718 -0
- package/dist/dist-BGKdXVy3.js.map +1 -0
- package/dist/env-DdaoGjIt.js +74 -0
- package/dist/env-DdaoGjIt.js.map +1 -0
- package/dist/event-queue/index.d.ts +2 -7
- package/dist/event-queue/index.js +7 -9
- package/dist/event-queue/index.js.map +1 -1
- package/dist/event-queue-Cw-YJPY_.js +1384 -0
- package/dist/event-queue-Cw-YJPY_.js.map +1 -0
- package/dist/{explicit-activity-scope-CCoxVwAr.d.ts → explicit-activity-scope-D8VeGGpt.d.ts} +1 -2
- package/dist/export/index.d.ts +2 -2
- package/dist/export/index.js +3 -14
- package/dist/export/index.js.map +1 -1
- package/dist/export-B6fphx8a.js +642 -0
- package/dist/export-B6fphx8a.js.map +1 -0
- package/dist/feature-flags/index.d.ts +2 -10
- package/dist/feature-flags/index.js +3 -6
- package/dist/feature-flags/index.js.map +1 -1
- package/dist/feature-flags-71oDkrUe.js +422 -0
- package/dist/feature-flags-71oDkrUe.js.map +1 -0
- package/dist/files/index.d.ts +2 -3
- package/dist/files/index.js +3 -4
- package/dist/files/index.js.map +1 -1
- package/dist/files-DjH0099H.js +830 -0
- package/dist/files-DjH0099H.js.map +1 -0
- package/dist/gateway/index.d.ts +4 -6
- package/dist/gateway/index.js +7 -13
- package/dist/gateway/index.js.map +1 -1
- package/dist/gateway/security/index.d.ts +2 -2
- package/dist/gateway/security/index.js +3 -5
- package/dist/gateway/security/index.js.map +1 -1
- package/dist/gateway-DBFmxWks.js +50 -0
- package/dist/gateway-DBFmxWks.js.map +1 -0
- package/dist/graph/index.d.ts +3 -10
- package/dist/graph/index.js +4 -13
- package/dist/graph/index.js.map +1 -1
- package/dist/graph-DDYgIryR.js +2152 -0
- package/dist/graph-DDYgIryR.js.map +1 -0
- package/dist/graph-emitter-CdOXP7Tn.js +621 -0
- package/dist/graph-emitter-CdOXP7Tn.js.map +1 -0
- package/dist/graphql/index.d.ts +3 -2
- package/dist/graphql/index.js +4 -6
- package/dist/graphql/index.js.map +1 -1
- package/dist/graphql/services/index.d.ts +2 -24
- package/dist/graphql/services/index.js +3 -4
- package/dist/graphql/services/index.js.map +1 -1
- package/dist/graphql-DHAHHcww.js +161 -0
- package/dist/graphql-DHAHHcww.js.map +1 -0
- package/dist/graphql-DNkMkGBZ.d.ts +21 -0
- package/dist/i18n/index.d.ts +3 -3
- package/dist/i18n/index.js +3 -4
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n-BBMYFd0P.js +860 -0
- package/dist/i18n-BBMYFd0P.js.map +1 -0
- package/dist/import-optional-peer-B82VYxeX.js +18 -0
- package/dist/import-optional-peer-B82VYxeX.js.map +1 -0
- package/dist/index-3KOZ1zN9.d.ts +233 -0
- package/dist/index-BBqooJ52.d.ts +45 -0
- package/dist/index-BGzMYJsm.d.ts +209 -0
- package/dist/index-BKwHQtHQ.d.ts +63 -0
- package/dist/index-BMIMnp6T.d.ts +8 -0
- package/dist/index-BQDsNAMR.d.ts +81 -0
- package/dist/index-BVOL7458.d.ts +10 -0
- package/dist/index-BcqQs-Uq.d.ts +69 -0
- package/dist/index-BeVtqGO-.d.ts +208 -0
- package/dist/index-BiTzGUZP.d.ts +114 -0
- package/dist/index-BqYfCQSP.d.ts +500 -0
- package/dist/index-C0qLquY0.d.ts +150 -0
- package/dist/index-C5uEKchX.d.ts +60 -0
- package/dist/index-CDOqxSIi.d.ts +37 -0
- package/dist/index-CG6wj66Y.d.ts +148 -0
- package/dist/index-CIgoeobA.d.ts +145 -0
- package/dist/index-CPQDMSFS.d.ts +103 -0
- package/dist/index-CSRcgkVi.d.ts +23 -0
- package/dist/index-CZTnQIRU.d.ts +341 -0
- package/dist/index-CaM9JUcc.d.ts +144 -0
- package/dist/index-CkT2aUr3.d.ts +704 -0
- package/dist/index-CliOgq6L.d.ts +203 -0
- package/dist/index-CnzbJZP7.d.ts +999 -0
- package/dist/index-D6UeLAye.d.ts +63 -0
- package/dist/index-DGgh9DWn.d.ts +59 -0
- package/dist/index-DY3dNhMN.d.ts +420 -0
- package/dist/index-DZC-2o9R.d.ts +207 -0
- package/dist/index-DqbGqfAy.d.ts +127 -0
- package/dist/index-Dt1HJPTX.d.ts +12 -0
- package/dist/index-DtI6aBtB.d.ts +22 -0
- package/dist/index-FKohsiex.d.ts +38 -0
- package/dist/index-FbXPfen7.d.ts +132 -0
- package/dist/index-MArCb8Aq.d.ts +306 -0
- package/dist/index-N-huORcj.d.ts +303 -0
- package/dist/index-YOShAwkq.d.ts +45 -0
- package/dist/index-bZKZUvBu.d.ts +646 -0
- package/dist/index-yBSjMY32.d.ts +24 -0
- package/dist/index.d.ts +501 -544
- package/dist/index.js +1820 -2171
- package/dist/index.js.map +1 -1
- package/dist/init/index.d.ts +2 -2
- package/dist/init/index.js +3 -16
- package/dist/init/index.js.map +1 -1
- package/dist/init-Dy3KhT6Y.js +325 -0
- package/dist/init-Dy3KhT6Y.js.map +1 -0
- package/dist/instrumentation/index.d.ts +3 -4
- package/dist/instrumentation/index.js +5 -5
- package/dist/instrumentation/index.js.map +1 -1
- package/dist/instrumentation-xkkmDgJ0.js +1678 -0
- package/dist/instrumentation-xkkmDgJ0.js.map +1 -0
- package/dist/lake/index.d.ts +50 -54
- package/dist/lake/index.js +169 -193
- package/dist/lake/index.js.map +1 -1
- package/dist/layer/index.d.ts +3 -2
- package/dist/layer/index.js +4 -5
- package/dist/layer/index.js.map +1 -1
- package/dist/layer-BZBZZWeV.d.ts +69 -0
- package/dist/layer-Bcix-WCl.js +105 -0
- package/dist/layer-Bcix-WCl.js.map +1 -0
- package/dist/layer-CEKy6cm8.js +252 -0
- package/dist/layer-CEKy6cm8.js.map +1 -0
- package/dist/lifecycle/index.d.ts +2 -1
- package/dist/lifecycle/index.js +3 -4
- package/dist/lifecycle/index.js.map +1 -1
- package/dist/lifecycle-DeoLSX0U.js +76 -0
- package/dist/lifecycle-DeoLSX0U.js.map +1 -0
- package/dist/logger/index.d.ts +2 -3
- package/dist/logger/index.js +3 -3
- package/dist/logger/index.js.map +1 -1
- package/dist/logger-B6rCpb7D.js +290 -0
- package/dist/logger-B6rCpb7D.js.map +1 -0
- package/dist/metrics/index.d.ts +13 -14
- package/dist/metrics/index.js +3 -4
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics-BrLwNUrb.js +52 -0
- package/dist/metrics-BrLwNUrb.js.map +1 -0
- package/dist/metrics-collector-C2eShrlW.js +922 -0
- package/dist/metrics-collector-C2eShrlW.js.map +1 -0
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +3 -4
- package/dist/middleware/index.js.map +1 -1
- package/dist/middleware-CUxJVUpD.js +1243 -0
- package/dist/middleware-CUxJVUpD.js.map +1 -0
- package/dist/middleware-Cq0zFMGp.js +253 -0
- package/dist/middleware-Cq0zFMGp.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -5
- package/dist/notifications/index.js +3 -6
- package/dist/notifications/index.js.map +1 -1
- package/dist/notifications-CdETrtFK.js +869 -0
- package/dist/notifications-CdETrtFK.js.map +1 -0
- package/dist/observability/index.d.ts +2 -3
- package/dist/observability/index.js +3 -4
- package/dist/observability/index.js.map +1 -1
- package/dist/observability-DBDXipTU.js +272 -0
- package/dist/observability-DBDXipTU.js.map +1 -0
- package/dist/platform/index.d.ts +2 -1
- package/dist/platform/index.js +3 -5
- package/dist/platform/index.js.map +1 -1
- package/dist/platform-DZwczW7v.js +1510 -0
- package/dist/platform-DZwczW7v.js.map +1 -0
- package/dist/prisma/generator/index.d.ts +1 -1
- package/dist/prisma/generator/index.js +97 -84
- package/dist/prisma/generator/index.js.map +1 -1
- package/dist/prisma/index.d.ts +4 -7
- package/dist/prisma/index.js +5 -12
- package/dist/prisma/index.js.map +1 -1
- package/dist/prisma-BzOOdt79.js +863 -0
- package/dist/prisma-BzOOdt79.js.map +1 -0
- package/dist/prisma-extension-Cfl09swM.d.ts +172 -0
- package/dist/product-alias/index.d.ts +2 -1
- package/dist/product-alias/index.js +3 -3
- package/dist/product-alias/index.js.map +1 -1
- package/dist/product-alias-BPqtskMq.js +273 -0
- package/dist/product-alias-BPqtskMq.js.map +1 -0
- package/dist/rbac/index.d.ts +2 -122
- package/dist/rbac/index.js +3 -6
- package/dist/rbac/index.js.map +1 -1
- package/dist/rbac-BB9l9Xph.js +1486 -0
- package/dist/rbac-BB9l9Xph.js.map +1 -0
- package/dist/resource-caps/index.d.ts +66 -72
- package/dist/resource-caps/index.js +430 -5
- package/dist/resource-caps/index.js.map +1 -1
- package/dist/rolldown-runtime-ad2WFvuA.js +17 -0
- package/dist/sdk-Dju9o-sq.js +124 -0
- package/dist/sdk-Dju9o-sq.js.map +1 -0
- package/dist/security-DIG-95Ic.js +1647 -0
- package/dist/security-DIG-95Ic.js.map +1 -0
- package/dist/server/index.d.ts +7 -164
- package/dist/server/index.js +2000 -1507
- package/dist/server/index.js.map +1 -1
- package/dist/service-jwt-Bu-WNA_-.js +80 -0
- package/dist/service-jwt-Bu-WNA_-.js.map +1 -0
- package/dist/services-BWzfz7vG.js +102 -0
- package/dist/services-BWzfz7vG.js.map +1 -0
- package/dist/sharding/index.d.ts +41 -44
- package/dist/sharding/index.js +156 -137
- package/dist/sharding/index.js.map +1 -1
- package/dist/sharing/index.d.ts +2 -1
- package/dist/sharing/index.js +3 -4
- package/dist/sharing/index.js.map +1 -1
- package/dist/sharing-CflDsSJ-.js +911 -0
- package/dist/sharing-CflDsSJ-.js.map +1 -0
- package/dist/stub-BqwKn4eh.js +630 -0
- package/dist/stub-BqwKn4eh.js.map +1 -0
- package/dist/tags/index.d.ts +2 -3
- package/dist/tags/index.js +3 -4
- package/dist/tags/index.js.map +1 -1
- package/dist/tags-B5xpbgsk.js +868 -0
- package/dist/{chunk-PBZFAAOM.js.map → tags-B5xpbgsk.js.map} +1 -1
- package/dist/telemetry/index.d.ts +64 -76
- package/dist/telemetry/index.js +369 -201
- package/dist/telemetry/index.js.map +1 -1
- package/dist/temporal/index.d.ts +2 -148
- package/dist/temporal/index.js +3 -5
- package/dist/temporal/index.js.map +1 -1
- package/dist/temporal-B534uYK8.js +706 -0
- package/dist/temporal-B534uYK8.js.map +1 -0
- package/dist/tracker/index.d.ts +5 -11
- package/dist/tracker/index.js +5 -20
- package/dist/tracker/index.js.map +1 -1
- package/dist/tracker-BQVoEFUo.js +839 -0
- package/dist/tracker-BQVoEFUo.js.map +1 -0
- package/dist/types-BYMYND1L.js +44 -0
- package/dist/types-BYMYND1L.js.map +1 -0
- package/dist/types-C6EKaS3V.d.ts +106 -0
- package/dist/types-CWybW61E.d.ts +323 -0
- package/dist/types-C_yfu3XK.d.ts +34 -0
- package/dist/types-Cj2RWXbz.js +90 -0
- package/dist/types-Cj2RWXbz.js.map +1 -0
- package/dist/types-DgaQqvxo.d.ts +70 -0
- package/dist/usage/index.d.ts +2 -213
- package/dist/usage/index.js +3 -15
- package/dist/usage/index.js.map +1 -1
- package/dist/usage-BKFZiWQn.js +682 -0
- package/dist/usage-BKFZiWQn.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.js.map +1 -1
- package/dist/utils-DL85Tnbn.js +500 -0
- package/dist/utils-DL85Tnbn.js.map +1 -0
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +3 -3
- package/dist/validation/index.js.map +1 -1
- package/dist/validation-CPUITdMk.js +762 -0
- package/dist/validation-CPUITdMk.js.map +1 -0
- package/dist/workspace-extension-COrC0dYi.js +979 -0
- package/dist/workspace-extension-COrC0dYi.js.map +1 -0
- package/dist/{workspace-extension-BGwTOV_r.d.ts → workspace-extension-DTFTdGVF.d.ts} +43 -45
- package/package.json +7 -10
- package/dist/EventQueueFactory-GXC3A7DH.js +0 -8
- package/dist/EventQueueFactory-GXC3A7DH.js.map +0 -1
- package/dist/chunk-4XIBXZ6J.js +0 -276
- package/dist/chunk-4XIBXZ6J.js.map +0 -1
- package/dist/chunk-554Z4C2K.js +0 -1006
- package/dist/chunk-554Z4C2K.js.map +0 -1
- package/dist/chunk-5CAFHK2Z.js +0 -107
- package/dist/chunk-5CAFHK2Z.js.map +0 -1
- package/dist/chunk-63ZXJ42X.js +0 -451
- package/dist/chunk-63ZXJ42X.js.map +0 -1
- package/dist/chunk-6XEXJATV.js +0 -304
- package/dist/chunk-6XEXJATV.js.map +0 -1
- package/dist/chunk-726AR6Q7.js +0 -1532
- package/dist/chunk-726AR6Q7.js.map +0 -1
- package/dist/chunk-A5F6Z5UE.js +0 -21
- package/dist/chunk-A5F6Z5UE.js.map +0 -1
- package/dist/chunk-A6DE32ZS.js +0 -1507
- package/dist/chunk-A6DE32ZS.js.map +0 -1
- package/dist/chunk-AXJDGQPE.js +0 -690
- package/dist/chunk-AXJDGQPE.js.map +0 -1
- package/dist/chunk-BJQOGOVW.js +0 -602
- package/dist/chunk-BJQOGOVW.js.map +0 -1
- package/dist/chunk-CFXWH2IS.js +0 -52
- package/dist/chunk-CFXWH2IS.js.map +0 -1
- package/dist/chunk-DRWH5XCJ.js +0 -876
- package/dist/chunk-DRWH5XCJ.js.map +0 -1
- package/dist/chunk-E4QNLVY4.js +0 -909
- package/dist/chunk-E4QNLVY4.js.map +0 -1
- package/dist/chunk-EBDHIL7V.js +0 -774
- package/dist/chunk-EBDHIL7V.js.map +0 -1
- package/dist/chunk-ELU7VL3E.js +0 -245
- package/dist/chunk-ELU7VL3E.js.map +0 -1
- package/dist/chunk-FZRODKIN.js +0 -31
- package/dist/chunk-FZRODKIN.js.map +0 -1
- package/dist/chunk-GCIB76AJ.js +0 -882
- package/dist/chunk-GCIB76AJ.js.map +0 -1
- package/dist/chunk-HC6MPUIH.js +0 -1571
- package/dist/chunk-HC6MPUIH.js.map +0 -1
- package/dist/chunk-HNMHPSAM.js +0 -272
- package/dist/chunk-HNMHPSAM.js.map +0 -1
- package/dist/chunk-HTLEGD3Q.js +0 -1480
- package/dist/chunk-HTLEGD3Q.js.map +0 -1
- package/dist/chunk-I3KOWRT3.js +0 -89
- package/dist/chunk-I3KOWRT3.js.map +0 -1
- package/dist/chunk-ID3WR4JS.js +0 -509
- package/dist/chunk-ID3WR4JS.js.map +0 -1
- package/dist/chunk-JS52ZHTK.js +0 -1346
- package/dist/chunk-JS52ZHTK.js.map +0 -1
- package/dist/chunk-JVMAQOA3.js +0 -521
- package/dist/chunk-JVMAQOA3.js.map +0 -1
- package/dist/chunk-KH4TRQCO.js +0 -1063
- package/dist/chunk-KH4TRQCO.js.map +0 -1
- package/dist/chunk-KJOSPVB2.js +0 -57
- package/dist/chunk-KJOSPVB2.js.map +0 -1
- package/dist/chunk-KO2ZXZ7W.js +0 -61
- package/dist/chunk-KO2ZXZ7W.js.map +0 -1
- package/dist/chunk-KS2HQCJR.js +0 -56
- package/dist/chunk-KS2HQCJR.js.map +0 -1
- package/dist/chunk-LA5KPWZ2.js +0 -413
- package/dist/chunk-LA5KPWZ2.js.map +0 -1
- package/dist/chunk-MESLAC5W.js +0 -574
- package/dist/chunk-MESLAC5W.js.map +0 -1
- package/dist/chunk-MWPYA2HD.js +0 -94
- package/dist/chunk-MWPYA2HD.js.map +0 -1
- package/dist/chunk-NUB5GQTU.js +0 -270
- package/dist/chunk-NUB5GQTU.js.map +0 -1
- package/dist/chunk-OBBCR6WY.js +0 -277
- package/dist/chunk-OBBCR6WY.js.map +0 -1
- package/dist/chunk-OQDSAOG3.js +0 -1908
- package/dist/chunk-OQDSAOG3.js.map +0 -1
- package/dist/chunk-OXNCBE7P.js +0 -971
- package/dist/chunk-OXNCBE7P.js.map +0 -1
- package/dist/chunk-PBZFAAOM.js +0 -941
- package/dist/chunk-PN6GIF3R.js +0 -1185
- package/dist/chunk-PN6GIF3R.js.map +0 -1
- package/dist/chunk-PYD44IHJ.js +0 -728
- package/dist/chunk-PYD44IHJ.js.map +0 -1
- package/dist/chunk-QVPIACWD.js +0 -679
- package/dist/chunk-QVPIACWD.js.map +0 -1
- package/dist/chunk-QWNNFE4P.js +0 -41
- package/dist/chunk-QWNNFE4P.js.map +0 -1
- package/dist/chunk-RU266375.js +0 -327
- package/dist/chunk-RU266375.js.map +0 -1
- package/dist/chunk-RYTSVGGA.js +0 -1624
- package/dist/chunk-RYTSVGGA.js.map +0 -1
- package/dist/chunk-RZOFS2BQ.js +0 -225
- package/dist/chunk-RZOFS2BQ.js.map +0 -1
- package/dist/chunk-SBS4S2PJ.js +0 -100
- package/dist/chunk-SBS4S2PJ.js.map +0 -1
- package/dist/chunk-SPRG6G6G.js +0 -530
- package/dist/chunk-SPRG6G6G.js.map +0 -1
- package/dist/chunk-STWFX5E2.js +0 -233
- package/dist/chunk-STWFX5E2.js.map +0 -1
- package/dist/chunk-UNASM5VJ.js +0 -419
- package/dist/chunk-UNASM5VJ.js.map +0 -1
- package/dist/chunk-VAT66FJA.js +0 -245
- package/dist/chunk-VAT66FJA.js.map +0 -1
- package/dist/chunk-VFCMR5GX.js +0 -49
- package/dist/chunk-VFCMR5GX.js.map +0 -1
- package/dist/chunk-VGAHZKNJ.js +0 -66
- package/dist/chunk-VGAHZKNJ.js.map +0 -1
- package/dist/chunk-VTJTAAXC.js +0 -627
- package/dist/chunk-VTJTAAXC.js.map +0 -1
- package/dist/chunk-VXVLKRU6.js +0 -758
- package/dist/chunk-VXVLKRU6.js.map +0 -1
- package/dist/chunk-WWUU5ETI.js +0 -163
- package/dist/chunk-WWUU5ETI.js.map +0 -1
- package/dist/chunk-XE4OXN2W.js +0 -10
- package/dist/chunk-XE4OXN2W.js.map +0 -1
- package/dist/chunk-XOJORS75.js +0 -1853
- package/dist/chunk-XOJORS75.js.map +0 -1
- package/dist/chunk-YMZEUTD2.js +0 -110
- package/dist/chunk-YMZEUTD2.js.map +0 -1
- package/dist/chunk-Z77BTSOK.js +0 -617
- package/dist/chunk-Z77BTSOK.js.map +0 -1
- package/dist/chunk-ZZK3WEDI.js +0 -181
- package/dist/chunk-ZZK3WEDI.js.map +0 -1
- package/dist/client-CCXpAZ2r.d.ts +0 -89
- package/dist/client-DSI_760t.d.ts +0 -36
- package/dist/client-JU6T3UPB.js +0 -11
- package/dist/client-JU6T3UPB.js.map +0 -1
- package/dist/dist-2X4Q7PJA.js +0 -1491
- package/dist/dist-2X4Q7PJA.js.map +0 -1
- package/dist/env-4UWSUS64.js +0 -4
- package/dist/env-4UWSUS64.js.map +0 -1
- package/dist/graph-emitter-r5TylDBm.d.ts +0 -47
- package/dist/graphql-CMHMQjvd.d.ts +0 -23
- package/dist/i18n-Qm2AkPC-.d.ts +0 -33
- package/dist/index--yvpa6ay.d.ts +0 -83
- package/dist/index-4gKQKZ2B.d.ts +0 -71
- package/dist/index-5x0XMKXN.d.ts +0 -149
- package/dist/index-B70b5mYS.d.ts +0 -33
- package/dist/index-B8KrxO4j.d.ts +0 -755
- package/dist/index-BOuDKnqD.d.ts +0 -201
- package/dist/index-BTMt4OjA.d.ts +0 -201
- package/dist/index-BejbszA7.d.ts +0 -39
- package/dist/index-BkeOYZye.d.ts +0 -198
- package/dist/index-BuAj5nXg.d.ts +0 -83
- package/dist/index-BvkVcW8I.d.ts +0 -349
- package/dist/index-CWmH_-RZ.d.ts +0 -247
- package/dist/index-CbgWNcus.d.ts +0 -258
- package/dist/index-CmfPeQza.d.ts +0 -166
- package/dist/index-CmpG-zak.d.ts +0 -607
- package/dist/index-CoMKgL-p.d.ts +0 -12
- package/dist/index-D8HGwglK.d.ts +0 -541
- package/dist/index-DCaVm66D.d.ts +0 -1101
- package/dist/index-DE2w7E0d.d.ts +0 -83
- package/dist/index-DSOpj8DI.d.ts +0 -17
- package/dist/index-DW9q22GH.d.ts +0 -75
- package/dist/index-DnjJ9CwI.d.ts +0 -347
- package/dist/index-DwMJZ8PP.d.ts +0 -317
- package/dist/index-PaojfSdd.d.ts +0 -71
- package/dist/index-aHtYvc3i.d.ts +0 -284
- package/dist/index-e_18DzAg.d.ts +0 -18
- package/dist/index-ffmipXSA.d.ts +0 -55
- package/dist/index-joONjwLt.d.ts +0 -33
- package/dist/index-kssw5ziY.d.ts +0 -250
- package/dist/index-lFffh5-G.d.ts +0 -125
- package/dist/index-pxYge_6k.d.ts +0 -79
- package/dist/layer-Cv9vSwBx.d.ts +0 -70
- package/dist/pino-logger-H4HPW5P6.js +0 -5
- package/dist/pino-logger-H4HPW5P6.js.map +0 -1
- package/dist/prisma-extension-gYhYriA0.d.ts +0 -174
- package/dist/sdk-L75WWUP3.js +0 -156
- package/dist/sdk-L75WWUP3.js.map +0 -1
- package/dist/shutdown-registry-CW9LryO8.d.ts +0 -10
- package/dist/types-Bo2wkjSP.d.ts +0 -35
- package/dist/types-DVpvrAhd.d.ts +0 -71
- package/dist/types-DgJ4lDYA.d.ts +0 -108
- package/dist/types-USOv09qy.d.ts +0 -327
- package/dist/workspace-guard-NXVYYBVJ.js +0 -5
- package/dist/workspace-guard-NXVYYBVJ.js.map +0 -1
package/dist/chunk-MESLAC5W.js
DELETED
|
@@ -1,574 +0,0 @@
|
|
|
1
|
-
import { logger } from './chunk-RU266375.js';
|
|
2
|
-
import { __export, __name } from './chunk-XE4OXN2W.js';
|
|
3
|
-
|
|
4
|
-
// src/ai-credits/index.ts
|
|
5
|
-
var ai_credits_exports = {};
|
|
6
|
-
__export(ai_credits_exports, {
|
|
7
|
-
AI_CREDIT_MAX_TOKENS_PER_REPORT: () => AI_CREDIT_MAX_TOKENS_PER_REPORT,
|
|
8
|
-
AiCreditInputError: () => AiCreditInputError,
|
|
9
|
-
AiCreditMeter: () => AiCreditMeter,
|
|
10
|
-
aiCreditIdempotencyHash: () => aiCreditIdempotencyHash,
|
|
11
|
-
aiCreditQuotaName: () => aiCreditQuotaName,
|
|
12
|
-
defaultAiCreditHashPrefix: () => defaultAiCreditHashPrefix,
|
|
13
|
-
encodeAiCreditHashComponent: () => encodeAiCreditHashComponent,
|
|
14
|
-
isAiCreditInputError: () => isAiCreditInputError,
|
|
15
|
-
validateAiTokenUsage: () => validateAiTokenUsage
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
// src/ai-credits/validation.ts
|
|
19
|
-
var AI_CREDIT_MAX_TOKENS_PER_REPORT = 2e6;
|
|
20
|
-
function blank(value) {
|
|
21
|
-
return typeof value !== "string" || value.trim().length === 0;
|
|
22
|
-
}
|
|
23
|
-
__name(blank, "blank");
|
|
24
|
-
function validateAiTokenUsage(report, maxTokensPerReport = AI_CREDIT_MAX_TOKENS_PER_REPORT) {
|
|
25
|
-
const { sessionId, messageId, model, inputTokens, outputTokens } = report;
|
|
26
|
-
const counts = [
|
|
27
|
-
inputTokens,
|
|
28
|
-
outputTokens,
|
|
29
|
-
report.cacheReadTokens ?? 0,
|
|
30
|
-
report.cacheWriteTokens ?? 0
|
|
31
|
-
];
|
|
32
|
-
if (blank(sessionId)) return {
|
|
33
|
-
code: "SESSION_ID_REQUIRED",
|
|
34
|
-
message: "sessionId is required."
|
|
35
|
-
};
|
|
36
|
-
if (blank(messageId)) return {
|
|
37
|
-
code: "MESSAGE_ID_REQUIRED",
|
|
38
|
-
message: "messageId is required."
|
|
39
|
-
};
|
|
40
|
-
if (blank(model)) return {
|
|
41
|
-
code: "MODEL_REQUIRED",
|
|
42
|
-
message: "model is required."
|
|
43
|
-
};
|
|
44
|
-
if (counts.some((count) => !Number.isSafeInteger(count))) {
|
|
45
|
-
return {
|
|
46
|
-
code: "TOKEN_COUNTS_NOT_INTEGERS",
|
|
47
|
-
message: "Token counts must be integers."
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
if (counts.some((count) => count < 0)) {
|
|
51
|
-
return {
|
|
52
|
-
code: "TOKEN_COUNTS_NEGATIVE",
|
|
53
|
-
message: "Token counts must be non-negative."
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
if (counts.reduce((sum, count) => sum + count, 0) > maxTokensPerReport) {
|
|
57
|
-
return {
|
|
58
|
-
code: "TOKEN_COUNTS_EXCEED_MAXIMUM",
|
|
59
|
-
message: `Reported tokens exceed the per-report maximum of ${maxTokensPerReport}.`
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
__name(validateAiTokenUsage, "validateAiTokenUsage");
|
|
65
|
-
function aiCreditQuotaName(productId) {
|
|
66
|
-
const id = productId.trim();
|
|
67
|
-
if (!id) throw new Error("aiCreditQuotaName requires a productId");
|
|
68
|
-
return `${id}.ai.credits`;
|
|
69
|
-
}
|
|
70
|
-
__name(aiCreditQuotaName, "aiCreditQuotaName");
|
|
71
|
-
function defaultAiCreditHashPrefix(productId) {
|
|
72
|
-
const id = productId.trim();
|
|
73
|
-
if (!id) throw new Error("defaultAiCreditHashPrefix requires a productId");
|
|
74
|
-
return `${id}:aicredit`;
|
|
75
|
-
}
|
|
76
|
-
__name(defaultAiCreditHashPrefix, "defaultAiCreditHashPrefix");
|
|
77
|
-
function encodeAiCreditHashComponent(value) {
|
|
78
|
-
return value.replaceAll("%", "%25").replaceAll(":", "%3A");
|
|
79
|
-
}
|
|
80
|
-
__name(encodeAiCreditHashComponent, "encodeAiCreditHashComponent");
|
|
81
|
-
function aiCreditIdempotencyHash(prefix, sessionId, messageId) {
|
|
82
|
-
const head = prefix.trim();
|
|
83
|
-
if (!head) throw new Error("aiCreditIdempotencyHash requires a prefix");
|
|
84
|
-
if (blank(sessionId) || blank(messageId)) {
|
|
85
|
-
throw new Error("aiCreditIdempotencyHash requires a sessionId and a messageId");
|
|
86
|
-
}
|
|
87
|
-
return `${head}:${encodeAiCreditHashComponent(sessionId)}:${encodeAiCreditHashComponent(messageId)}`;
|
|
88
|
-
}
|
|
89
|
-
__name(aiCreditIdempotencyHash, "aiCreditIdempotencyHash");
|
|
90
|
-
|
|
91
|
-
// src/ai-credits/errors.ts
|
|
92
|
-
var AiCreditInputError = class extends Error {
|
|
93
|
-
static {
|
|
94
|
-
__name(this, "AiCreditInputError");
|
|
95
|
-
}
|
|
96
|
-
code;
|
|
97
|
-
/** GraphQL error code products should surface. */
|
|
98
|
-
graphqlCode = "BAD_USER_INPUT";
|
|
99
|
-
constructor(code, message) {
|
|
100
|
-
super(message);
|
|
101
|
-
this.name = "AiCreditInputError";
|
|
102
|
-
this.code = code;
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
function isAiCreditInputError(error) {
|
|
106
|
-
return error instanceof AiCreditInputError;
|
|
107
|
-
}
|
|
108
|
-
__name(isAiCreditInputError, "isAiCreditInputError");
|
|
109
|
-
|
|
110
|
-
// src/ai-credits/meter.ts
|
|
111
|
-
var DEFAULT_REQUEST_TIMEOUT_MS = 5e3;
|
|
112
|
-
var QUOTE_AI_CREDITS_QUERY = `query AiCreditMeterQuote($model: String!, $inputTokens: Int!, $outputTokens: Int!) {
|
|
113
|
-
quoteAiCredits(model: $model, inputTokens: $inputTokens, outputTokens: $outputTokens)
|
|
114
|
-
}`;
|
|
115
|
-
var QUOTE_AI_CREDITS_WITH_CACHE_QUERY = `query AiCreditMeterQuoteWithCache($model: String!, $inputTokens: Int!, $outputTokens: Int!, $cacheReadTokens: Int, $cacheWriteTokens: Int) {
|
|
116
|
-
quoteAiCredits(model: $model, inputTokens: $inputTokens, outputTokens: $outputTokens, cacheReadTokens: $cacheReadTokens, cacheWriteTokens: $cacheWriteTokens)
|
|
117
|
-
}`;
|
|
118
|
-
var CACHE_PRICING_CAPABILITY_QUERY = `query AiCreditMeterCachePricingSupported {
|
|
119
|
-
aiCacheTokenPricingSupported
|
|
120
|
-
}`;
|
|
121
|
-
var TRACK_USAGE_MUTATION = `mutation AiCreditMeterTrackUsage($input: TrackUsageInput!) {
|
|
122
|
-
trackUsage(input: $input)
|
|
123
|
-
}`;
|
|
124
|
-
var CHECK_WORKSPACE_QUOTA_QUERY = `query AiCreditMeterCheckQuota($workspaceId: ID!, $quotaName: String!, $amount: Float) {
|
|
125
|
-
checkWorkspaceQuota(workspaceId: $workspaceId, quotaName: $quotaName, amount: $amount) { allowed assignmentId limitLeft noLimit }
|
|
126
|
-
}`;
|
|
127
|
-
var GATE_PROBE_AMOUNT = 1;
|
|
128
|
-
var WORKSPACE_QUOTA_ASSIGNMENTS_QUERY = `query AiCreditMeterQuotaAssignments($workspaceId: ID!) {
|
|
129
|
-
workspaceQuotaAssignments(workspaceId: $workspaceId) { quotaName used limit noLimit isActive }
|
|
130
|
-
}`;
|
|
131
|
-
function errorMessage(error) {
|
|
132
|
-
return error instanceof Error ? error.message : String(error);
|
|
133
|
-
}
|
|
134
|
-
__name(errorMessage, "errorMessage");
|
|
135
|
-
function requireNonEmpty(value, field) {
|
|
136
|
-
const trimmed = value?.trim() ?? "";
|
|
137
|
-
if (!trimmed) throw new Error(`AiCreditMeter: ${field} is required`);
|
|
138
|
-
return trimmed;
|
|
139
|
-
}
|
|
140
|
-
__name(requireNonEmpty, "requireNonEmpty");
|
|
141
|
-
function internalServiceHeaders() {
|
|
142
|
-
const token = process.env["TRUSTED_GATEWAY_TOKEN"] || process.env["INTERNAL_SERVICE_TOKEN"];
|
|
143
|
-
return token ? {
|
|
144
|
-
"x-internal-service-token": token
|
|
145
|
-
} : {};
|
|
146
|
-
}
|
|
147
|
-
__name(internalServiceHeaders, "internalServiceHeaders");
|
|
148
|
-
var AiCreditMeter = class {
|
|
149
|
-
static {
|
|
150
|
-
__name(this, "AiCreditMeter");
|
|
151
|
-
}
|
|
152
|
-
productId;
|
|
153
|
-
quotaName;
|
|
154
|
-
hashPrefix;
|
|
155
|
-
serviceName;
|
|
156
|
-
activityGatewayUrl;
|
|
157
|
-
billingGatewayUrl;
|
|
158
|
-
pricingOption;
|
|
159
|
-
fetchImpl;
|
|
160
|
-
requestTimeoutMs;
|
|
161
|
-
maxTokensPerReport;
|
|
162
|
-
guard;
|
|
163
|
-
log;
|
|
164
|
-
pricing = null;
|
|
165
|
-
constructor(options) {
|
|
166
|
-
this.productId = requireNonEmpty(options.productId, "productId");
|
|
167
|
-
this.quotaName = options.quotaName?.trim() || aiCreditQuotaName(this.productId);
|
|
168
|
-
this.hashPrefix = options.hashPrefix?.trim() || defaultAiCreditHashPrefix(this.productId);
|
|
169
|
-
this.serviceName = options.serviceName?.trim() || void 0;
|
|
170
|
-
this.activityGatewayUrl = options.activityGatewayUrl?.trim() || void 0;
|
|
171
|
-
this.billingGatewayUrl = options.billingGatewayUrl?.trim() || void 0;
|
|
172
|
-
this.pricingOption = options.pricingClient;
|
|
173
|
-
this.fetchImpl = options.fetch ?? ((url, init) => fetch(url, init));
|
|
174
|
-
this.requestTimeoutMs = options.requestTimeoutMs ?? DEFAULT_REQUEST_TIMEOUT_MS;
|
|
175
|
-
if (!Number.isSafeInteger(this.requestTimeoutMs) || this.requestTimeoutMs <= 0) {
|
|
176
|
-
throw new Error("AiCreditMeter: requestTimeoutMs must be a positive integer");
|
|
177
|
-
}
|
|
178
|
-
this.maxTokensPerReport = options.maxTokensPerReport ?? AI_CREDIT_MAX_TOKENS_PER_REPORT;
|
|
179
|
-
if (!Number.isSafeInteger(this.maxTokensPerReport) || this.maxTokensPerReport <= 0) {
|
|
180
|
-
throw new Error("AiCreditMeter: maxTokensPerReport must be a positive integer");
|
|
181
|
-
}
|
|
182
|
-
this.guard = options.guard;
|
|
183
|
-
this.log = options.logger ?? logger;
|
|
184
|
-
}
|
|
185
|
-
/** The idempotency hash this meter records a turn under. */
|
|
186
|
-
hashFor(sessionId, messageId) {
|
|
187
|
-
return aiCreditIdempotencyHash(this.hashPrefix, sessionId, messageId);
|
|
188
|
-
}
|
|
189
|
-
/**
|
|
190
|
-
* Server-side price of one model call in credits, from billing's per-model
|
|
191
|
-
* token table. Returns null — after logging why — when it cannot be priced.
|
|
192
|
-
*
|
|
193
|
-
* When the turn reports cache counts, billing is first asked whether it prices
|
|
194
|
-
* them (`aiCacheTokenPricingSupported`). If it does, the cache counts are priced
|
|
195
|
-
* with its cache-token prices; if it does not (an older billing, or the probe
|
|
196
|
-
* fails), the turn is priced on input/output alone. The answer is not cached,
|
|
197
|
-
* so a billing rollback is picked up on the next report.
|
|
198
|
-
*/
|
|
199
|
-
async quote(input) {
|
|
200
|
-
const url = this.billingGatewayUrl ?? process.env["GLOBAL_PUBLIC_GATEWAY_URL"]?.trim();
|
|
201
|
-
if (!url) {
|
|
202
|
-
this.log.warn("[AiCreditMeter] GLOBAL_PUBLIC_GATEWAY_URL not set; cannot price AI credits", {
|
|
203
|
-
productId: this.productId,
|
|
204
|
-
model: input.model
|
|
205
|
-
});
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
try {
|
|
209
|
-
const client = await this.getPricingClient(url);
|
|
210
|
-
const hasCacheCounts = input.cacheReadTokens != null || input.cacheWriteTokens != null;
|
|
211
|
-
const priceCache = hasCacheCounts && await this.supportsCachePricing(client, input.model);
|
|
212
|
-
const response = await client.crossLayerQuery({
|
|
213
|
-
...this.pricingRequest(),
|
|
214
|
-
query: priceCache ? QUOTE_AI_CREDITS_WITH_CACHE_QUERY : QUOTE_AI_CREDITS_QUERY,
|
|
215
|
-
variables: {
|
|
216
|
-
model: input.model,
|
|
217
|
-
inputTokens: input.inputTokens,
|
|
218
|
-
outputTokens: input.outputTokens,
|
|
219
|
-
...priceCache ? {
|
|
220
|
-
cacheReadTokens: input.cacheReadTokens ?? 0,
|
|
221
|
-
cacheWriteTokens: input.cacheWriteTokens ?? 0
|
|
222
|
-
} : {}
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
if (response.errors?.length) {
|
|
226
|
-
throw new Error(response.errors.map((error) => error.message).join(", "));
|
|
227
|
-
}
|
|
228
|
-
const credits = response.data?.quoteAiCredits;
|
|
229
|
-
if (typeof credits !== "number" || !Number.isFinite(credits) || credits < 0) {
|
|
230
|
-
throw new Error(`quoteAiCredits returned no usable value (${String(credits)})`);
|
|
231
|
-
}
|
|
232
|
-
return credits;
|
|
233
|
-
} catch (error) {
|
|
234
|
-
this.log.warn("[AiCreditMeter] Failed to quote AI credits; skipping charge", {
|
|
235
|
-
productId: this.productId,
|
|
236
|
-
model: input.model,
|
|
237
|
-
error: errorMessage(error)
|
|
238
|
-
});
|
|
239
|
-
return null;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
/**
|
|
243
|
-
* Validate, price and record one completed assistant turn. See the module
|
|
244
|
-
* header for the contract: throws only {@link AiCreditInputError}.
|
|
245
|
-
*/
|
|
246
|
-
async charge(input) {
|
|
247
|
-
const workspaceId = input.workspaceId?.trim() ?? "";
|
|
248
|
-
if (!workspaceId) {
|
|
249
|
-
throw new AiCreditInputError("WORKSPACE_ID_REQUIRED", "This request has no workspace context.");
|
|
250
|
-
}
|
|
251
|
-
const invalid = validateAiTokenUsage(input, this.maxTokensPerReport);
|
|
252
|
-
if (invalid) throw new AiCreditInputError(invalid.code, invalid.message);
|
|
253
|
-
const hash = this.hashFor(input.sessionId, input.messageId);
|
|
254
|
-
const logFields = {
|
|
255
|
-
productId: this.productId,
|
|
256
|
-
quotaName: this.quotaName,
|
|
257
|
-
workspaceId,
|
|
258
|
-
sessionId: input.sessionId,
|
|
259
|
-
messageId: input.messageId,
|
|
260
|
-
model: input.model,
|
|
261
|
-
inputTokens: input.inputTokens,
|
|
262
|
-
outputTokens: input.outputTokens
|
|
263
|
-
};
|
|
264
|
-
const skipped = /* @__PURE__ */ __name((reason, credits2, detail) => {
|
|
265
|
-
this.log.warn(`[AiCreditMeter] turn not charged (${reason})`, {
|
|
266
|
-
...logFields,
|
|
267
|
-
credits: credits2,
|
|
268
|
-
detail
|
|
269
|
-
});
|
|
270
|
-
return {
|
|
271
|
-
status: "skipped",
|
|
272
|
-
reason,
|
|
273
|
-
credits: credits2,
|
|
274
|
-
hash,
|
|
275
|
-
quotaName: this.quotaName,
|
|
276
|
-
...detail ? {
|
|
277
|
-
detail
|
|
278
|
-
} : {}
|
|
279
|
-
};
|
|
280
|
-
}, "skipped");
|
|
281
|
-
if (this.guard) {
|
|
282
|
-
try {
|
|
283
|
-
const verdict = await this.guard({
|
|
284
|
-
...input,
|
|
285
|
-
workspaceId
|
|
286
|
-
});
|
|
287
|
-
if (!verdict.allow) return skipped("GUARD_REFUSED", null, verdict.detail);
|
|
288
|
-
} catch (error) {
|
|
289
|
-
this.log.warn("[AiCreditMeter] charge guard threw; charging anyway", {
|
|
290
|
-
...logFields,
|
|
291
|
-
error: errorMessage(error)
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
const credits = await this.quote(input);
|
|
296
|
-
if (credits === null) return skipped("NOT_PRICED", null);
|
|
297
|
-
if (credits <= 0) return skipped("ZERO_COST", credits);
|
|
298
|
-
try {
|
|
299
|
-
await this.trackUsage({
|
|
300
|
-
workspaceId,
|
|
301
|
-
amount: credits,
|
|
302
|
-
description: input.description?.trim() || `AI credits for session ${input.sessionId}`,
|
|
303
|
-
userId: input.userId ?? void 0,
|
|
304
|
-
hash,
|
|
305
|
-
metadata: {
|
|
306
|
-
model: input.model,
|
|
307
|
-
sessionId: input.sessionId,
|
|
308
|
-
messageId: input.messageId,
|
|
309
|
-
inputTokens: input.inputTokens,
|
|
310
|
-
outputTokens: input.outputTokens,
|
|
311
|
-
...input.cacheReadTokens != null || input.cacheWriteTokens != null ? {
|
|
312
|
-
cacheReadTokens: input.cacheReadTokens ?? 0,
|
|
313
|
-
cacheWriteTokens: input.cacheWriteTokens ?? 0
|
|
314
|
-
} : {},
|
|
315
|
-
credits,
|
|
316
|
-
...input.metadata
|
|
317
|
-
}
|
|
318
|
-
});
|
|
319
|
-
} catch (error) {
|
|
320
|
-
return skipped("RECORD_FAILED", credits, errorMessage(error));
|
|
321
|
-
}
|
|
322
|
-
this.log.info(`[AiCreditMeter] Charged ${credits} AI credits for session ${input.sessionId}`, {
|
|
323
|
-
...logFields,
|
|
324
|
-
credits
|
|
325
|
-
});
|
|
326
|
-
return {
|
|
327
|
-
status: "charged",
|
|
328
|
-
credits,
|
|
329
|
-
hash,
|
|
330
|
-
quotaName: this.quotaName
|
|
331
|
-
};
|
|
332
|
-
}
|
|
333
|
-
/**
|
|
334
|
-
* Read the quota's ENFORCED usage from wspace-activity-svc — the ledger the
|
|
335
|
-
* charge lands on and the gateway's `@usage` check reads. All active rows are
|
|
336
|
-
* summed, because a workspace can hold several (plan + add-ons, or duplicate
|
|
337
|
-
* rows) and `checkWorkspaceQuota` sums them; a single-row read under-reports.
|
|
338
|
-
*
|
|
339
|
-
* Returns null (never throws) when activity is unreachable or no assignment
|
|
340
|
-
* exists, so a screen can show "not provisioned" instead of a confident zero.
|
|
341
|
-
*/
|
|
342
|
-
async readUsage(workspaceId, quotaName = this.quotaName) {
|
|
343
|
-
try {
|
|
344
|
-
const data = await this.activityRequest(workspaceId, WORKSPACE_QUOTA_ASSIGNMENTS_QUERY, {
|
|
345
|
-
workspaceId: workspaceId.trim()
|
|
346
|
-
});
|
|
347
|
-
const rows = (data.workspaceQuotaAssignments ?? []).filter((row) => row.isActive && row.quotaName === quotaName);
|
|
348
|
-
if (rows.length === 0) return null;
|
|
349
|
-
const used = rows.reduce((sum, row) => sum + (Number.isFinite(row.used) ? row.used : 0), 0);
|
|
350
|
-
const noLimit = rows.some((row) => row.noLimit);
|
|
351
|
-
const limit = noLimit ? null : rows.reduce((sum, row) => sum + (row.limit ?? 0), 0);
|
|
352
|
-
return {
|
|
353
|
-
quotaName,
|
|
354
|
-
used,
|
|
355
|
-
limit,
|
|
356
|
-
noLimit,
|
|
357
|
-
remaining: limit === null ? null : Math.max(limit - used, 0),
|
|
358
|
-
assignments: rows.length
|
|
359
|
-
};
|
|
360
|
-
} catch (error) {
|
|
361
|
-
this.log.warn("[AiCreditMeter] Failed to read workspace quota usage", {
|
|
362
|
-
productId: this.productId,
|
|
363
|
-
quotaName,
|
|
364
|
-
workspaceId,
|
|
365
|
-
error: errorMessage(error)
|
|
366
|
-
});
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
/**
|
|
371
|
-
* Ask wspace-activity-svc whether `amount` of the quota may be spent — the same
|
|
372
|
-
* `checkWorkspaceQuota` the gateway's `@usage` gate runs, so every activity
|
|
373
|
-
* enforcement rule (row aggregation, renamed keys, the
|
|
374
|
-
* `TEST_ENTITLEMENT_WORKSPACE_IDS` entitlement) applies.
|
|
375
|
-
*
|
|
376
|
-
* Returns null (never throws) when activity cannot answer.
|
|
377
|
-
*/
|
|
378
|
-
async checkAllowance(workspaceId, options = {}) {
|
|
379
|
-
const quotaName = options.quotaName ?? this.quotaName;
|
|
380
|
-
const amount = options.amount ?? GATE_PROBE_AMOUNT;
|
|
381
|
-
try {
|
|
382
|
-
if (!Number.isFinite(amount) || amount < 0) throw new Error("amount must be a non-negative finite number");
|
|
383
|
-
const data = await this.activityRequest(workspaceId, CHECK_WORKSPACE_QUOTA_QUERY, {
|
|
384
|
-
workspaceId: workspaceId.trim(),
|
|
385
|
-
quotaName,
|
|
386
|
-
amount
|
|
387
|
-
});
|
|
388
|
-
const result = data.checkWorkspaceQuota;
|
|
389
|
-
if (!result || typeof result.allowed !== "boolean") {
|
|
390
|
-
throw new Error("checkWorkspaceQuota returned no verdict");
|
|
391
|
-
}
|
|
392
|
-
return {
|
|
393
|
-
quotaName,
|
|
394
|
-
allowed: result.allowed,
|
|
395
|
-
provisioned: result.assignmentId != null,
|
|
396
|
-
noLimit: result.noLimit === true,
|
|
397
|
-
limitLeft: typeof result.limitLeft === "number" && Number.isFinite(result.limitLeft) ? result.limitLeft : null
|
|
398
|
-
};
|
|
399
|
-
} catch (error) {
|
|
400
|
-
this.log.warn("[AiCreditMeter] Failed to check workspace quota allowance", {
|
|
401
|
-
productId: this.productId,
|
|
402
|
-
quotaName,
|
|
403
|
-
workspaceId,
|
|
404
|
-
error: errorMessage(error)
|
|
405
|
-
});
|
|
406
|
-
return null;
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
/**
|
|
410
|
-
* Pre-flight gate for an AI call. Reads the ledger standing
|
|
411
|
-
* ({@link readUsage}); when it shows a limited budget spent, the refusal is
|
|
412
|
-
* confirmed with activity's {@link checkAllowance} before it is returned.
|
|
413
|
-
*
|
|
414
|
-
* - not provisioned or unreadable -> not exhausted (the call is not gated);
|
|
415
|
-
* - budget left, or no limit -> not exhausted (no second call);
|
|
416
|
-
* - spent and activity refuses -> exhausted;
|
|
417
|
-
* - spent and activity cannot answer -> exhausted (fail closed on a known
|
|
418
|
-
* spent budget, as before this check existed);
|
|
419
|
-
* - spent but activity allows -> not exhausted, `entitled: true`. This
|
|
420
|
-
* is a test-entitled doctor workspace; the call proceeds and
|
|
421
|
-
* {@link charge} still records it.
|
|
422
|
-
*/
|
|
423
|
-
async readGate(workspaceId, quotaName = this.quotaName) {
|
|
424
|
-
const usage = await this.readUsage(workspaceId, quotaName);
|
|
425
|
-
const spent = usage !== null && !usage.noLimit && (usage.remaining ?? 0) <= 0;
|
|
426
|
-
if (!spent) return {
|
|
427
|
-
usage,
|
|
428
|
-
exhausted: false,
|
|
429
|
-
entitled: false
|
|
430
|
-
};
|
|
431
|
-
const allowance = await this.checkAllowance(workspaceId, {
|
|
432
|
-
quotaName
|
|
433
|
-
});
|
|
434
|
-
if (allowance?.allowed) {
|
|
435
|
-
this.log.info("[AiCreditMeter] budget spent but activity allows the call (test entitlement); not refused", {
|
|
436
|
-
productId: this.productId,
|
|
437
|
-
quotaName,
|
|
438
|
-
workspaceId,
|
|
439
|
-
used: usage.used,
|
|
440
|
-
limit: usage.limit
|
|
441
|
-
});
|
|
442
|
-
return {
|
|
443
|
-
usage,
|
|
444
|
-
exhausted: false,
|
|
445
|
-
entitled: true
|
|
446
|
-
};
|
|
447
|
-
}
|
|
448
|
-
return {
|
|
449
|
-
usage,
|
|
450
|
-
exhausted: true,
|
|
451
|
-
entitled: false
|
|
452
|
-
};
|
|
453
|
-
}
|
|
454
|
-
async trackUsage(record) {
|
|
455
|
-
const data = await this.activityRequest(record.workspaceId, TRACK_USAGE_MUTATION, {
|
|
456
|
-
input: {
|
|
457
|
-
// Sent in the input AND as x-workspace-id: activity takes the workspace from request
|
|
458
|
-
// context, and the @rbac directive resolves input.workspaceId.
|
|
459
|
-
workspaceId: record.workspaceId,
|
|
460
|
-
quotaName: this.quotaName,
|
|
461
|
-
productId: this.productId,
|
|
462
|
-
amount: record.amount,
|
|
463
|
-
description: record.description,
|
|
464
|
-
userId: record.userId,
|
|
465
|
-
hash: record.hash,
|
|
466
|
-
metadata: record.metadata
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
if (data.trackUsage !== true) {
|
|
470
|
-
throw new Error(`trackUsage did not confirm the record (returned ${String(data.trackUsage)})`);
|
|
471
|
-
}
|
|
472
|
-
}
|
|
473
|
-
async activityRequest(workspaceId, query, variables) {
|
|
474
|
-
const url = this.activityGatewayUrl ?? process.env["WSPACE_INT_GATEWAY_URL"]?.trim();
|
|
475
|
-
if (!url) throw new Error("WSPACE_INT_GATEWAY_URL not set; cannot reach wspace-activity-svc");
|
|
476
|
-
const workspace = workspaceId.trim();
|
|
477
|
-
if (!workspace) throw new Error("workspaceId is required");
|
|
478
|
-
const controller = new AbortController();
|
|
479
|
-
const timeout = setTimeout(() => controller.abort(), this.requestTimeoutMs);
|
|
480
|
-
try {
|
|
481
|
-
const response = await this.fetchImpl(url, {
|
|
482
|
-
method: "POST",
|
|
483
|
-
headers: {
|
|
484
|
-
"Content-Type": "application/json",
|
|
485
|
-
"x-actor-type": "service",
|
|
486
|
-
"x-actor-id": this.resolveServiceName(),
|
|
487
|
-
...internalServiceHeaders(),
|
|
488
|
-
"x-workspace-id": workspace
|
|
489
|
-
},
|
|
490
|
-
body: JSON.stringify({
|
|
491
|
-
query,
|
|
492
|
-
variables
|
|
493
|
-
}),
|
|
494
|
-
signal: controller.signal
|
|
495
|
-
});
|
|
496
|
-
if (!response.ok) {
|
|
497
|
-
const body = await response.text().catch(() => response.statusText);
|
|
498
|
-
throw new Error(`activity request failed with HTTP ${response.status}: ${body.slice(0, 500)}`);
|
|
499
|
-
}
|
|
500
|
-
const result = await response.json();
|
|
501
|
-
if (result.errors?.length) {
|
|
502
|
-
throw new Error(result.errors.map((error) => error.message).join(", "));
|
|
503
|
-
}
|
|
504
|
-
if (!result.data) throw new Error("activity response did not include data");
|
|
505
|
-
return result.data;
|
|
506
|
-
} finally {
|
|
507
|
-
clearTimeout(timeout);
|
|
508
|
-
}
|
|
509
|
-
}
|
|
510
|
-
/** Options shared by every pricing call. */
|
|
511
|
-
pricingRequest() {
|
|
512
|
-
return {
|
|
513
|
-
// Only the actor type: the signed service JWT is the identity. An x-actor-id on a
|
|
514
|
-
// service token is read as "on behalf of" and downgrades the actor.
|
|
515
|
-
headers: {
|
|
516
|
-
"x-actor-type": "service"
|
|
517
|
-
},
|
|
518
|
-
timeout: this.requestTimeoutMs,
|
|
519
|
-
skipRetry: true,
|
|
520
|
-
skipCircuitBreaker: true
|
|
521
|
-
};
|
|
522
|
-
}
|
|
523
|
-
/** Whether billing prices cache counts. Any failure reads as "no" and falls back to input/output. */
|
|
524
|
-
async supportsCachePricing(client, model) {
|
|
525
|
-
try {
|
|
526
|
-
const response = await client.crossLayerQuery({
|
|
527
|
-
...this.pricingRequest(),
|
|
528
|
-
query: CACHE_PRICING_CAPABILITY_QUERY,
|
|
529
|
-
variables: {}
|
|
530
|
-
});
|
|
531
|
-
if (response.data?.aiCacheTokenPricingSupported === true) return true;
|
|
532
|
-
} catch {
|
|
533
|
-
}
|
|
534
|
-
this.log.warn("[AiCreditMeter] billing does not price cache tokens; quoting input/output only", {
|
|
535
|
-
productId: this.productId,
|
|
536
|
-
model
|
|
537
|
-
});
|
|
538
|
-
return false;
|
|
539
|
-
}
|
|
540
|
-
resolveServiceName() {
|
|
541
|
-
return this.serviceName || process.env["SERVICE_IDENTITY"] || process.env["SERVICE_NAME"] || `wspace-${this.productId}-svc`;
|
|
542
|
-
}
|
|
543
|
-
getPricingClient(url) {
|
|
544
|
-
if (this.pricing && this.pricing.url === url) return this.pricing.client;
|
|
545
|
-
const option = this.pricingOption;
|
|
546
|
-
const client = (async () => {
|
|
547
|
-
if (option && typeof option === "function") return option(url);
|
|
548
|
-
if (option) return option;
|
|
549
|
-
const gateway = await import('./client-JU6T3UPB.js');
|
|
550
|
-
const identity = this.resolveServiceName();
|
|
551
|
-
return new gateway.GatewayClient({
|
|
552
|
-
// This service's OWN layer; the be-sdk signs the service JWT because the call leaves it.
|
|
553
|
-
layer: "wspace",
|
|
554
|
-
serviceName: identity,
|
|
555
|
-
serviceIdentity: identity,
|
|
556
|
-
crossLayerGatewayUrl: url,
|
|
557
|
-
timeout: this.requestTimeoutMs,
|
|
558
|
-
enableLogging: process.env["NODE_ENV"] !== "production"
|
|
559
|
-
});
|
|
560
|
-
})();
|
|
561
|
-
this.pricing = {
|
|
562
|
-
url,
|
|
563
|
-
client
|
|
564
|
-
};
|
|
565
|
-
client.catch(() => {
|
|
566
|
-
if (this.pricing?.client === client) this.pricing = null;
|
|
567
|
-
});
|
|
568
|
-
return client;
|
|
569
|
-
}
|
|
570
|
-
};
|
|
571
|
-
|
|
572
|
-
export { AI_CREDIT_MAX_TOKENS_PER_REPORT, AiCreditInputError, AiCreditMeter, aiCreditIdempotencyHash, aiCreditQuotaName, ai_credits_exports, defaultAiCreditHashPrefix, encodeAiCreditHashComponent, isAiCreditInputError, validateAiTokenUsage };
|
|
573
|
-
//# sourceMappingURL=chunk-MESLAC5W.js.map
|
|
574
|
-
//# sourceMappingURL=chunk-MESLAC5W.js.map
|