@readmagic/workmate 0.0.2 → 0.0.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/dist/chunks/{AddWorkspaceDirectory-BgNp7glC.js → AddWorkspaceDirectory-mANiG0xj.js} +1 -1
- package/dist/chunks/{App-Coboqa8H.js → App-aUVaOLeo.js} +1 -1
- package/dist/chunks/{ApproveApiKey-CYpBbj0k.js → ApproveApiKey-36iUE5CW.js} +1 -1
- package/dist/chunks/ApproveApiKey-DPdcp1CQ.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-DxKsTdqj.js → AssistantSessionChooser-BLcvdkgb.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-DyjVt81B.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-Cx3QGFz-.js → BypassPermissionsModeDialog-CTlpvTuz.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BAK9fxwg.js → ClaudeMdExternalIncludesDialog-5pipE8m8.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Dn7Le--z.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-BDr1Vx5K.js +1 -0
- package/dist/chunks/{DesktopHandoff-BsHgLlTy.js → DesktopHandoff-Blg1TVut.js} +1 -1
- package/dist/chunks/{DiffDialog-BgTW2Znv.js → DiffDialog-CUEpuocY.js} +2 -2
- package/dist/chunks/Doctor-B540I-gq.js +1 -0
- package/dist/chunks/Doctor-DlE1Mbb9.js +3 -0
- package/dist/chunks/ExitFlow-DCIhnP5h.js +2 -0
- package/dist/chunks/Feedback-CDTqPqsM.js +2 -0
- package/dist/chunks/{Grove-Dsi4yU08.js → Grove-D9lSG_Lh.js} +1 -1
- package/dist/chunks/Grove-DLYXL8hv.js +1 -0
- package/dist/chunks/{HybridTransport-8qA64lCx.js → HybridTransport-8j0AviF6.js} +4 -4
- package/dist/chunks/{InvalidConfigDialog-CAZ1z5WG.js → InvalidConfigDialog-I3t-0nU3.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-D82Qk_MR.js → InvalidSettingsDialog-BnthOxGT.js} +1 -1
- package/dist/chunks/MCPConnectionManager-zdocEDgk.js +1 -0
- package/dist/chunks/{McpParsingWarnings-8ZueNqAd.js → McpParsingWarnings-D0XvLirX.js} +1 -1
- package/dist/chunks/MessageSelector-BBhCstBa.js +3 -0
- package/dist/chunks/Messages-Dv2VrytX.js +11 -0
- package/dist/chunks/{Onboarding-CUztnbbv.js → Onboarding-B1WRpoBI.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-DSgrZvMv.js → OverageCreditUpsell-BSmgq089.js} +1 -1
- package/dist/chunks/PluginSettings-DN9rpwc_.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-IaihWay3.js → PromptInputFooterSuggestions-3rjz6zhK.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-okS2rQ4k.js → PromptInputHelpMenu-DgDJHZqC.js} +1 -1
- package/dist/chunks/QueryEngine-BnaHDZVZ.js +1 -0
- package/dist/chunks/REPL-B3RbzeV7.js +1 -0
- package/dist/chunks/{REPL-Dto012J0.js → REPL-CA8FEO7J.js} +44 -44
- package/dist/chunks/{RemoteCallout-C_UIYnuT.js → RemoteCallout-BFzCx_Pn.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-CuSSHAXN.js → RemoteSessionManager-BhUrtejX.js} +2 -2
- package/dist/chunks/ResumeConversation-BseKUFRI.js +1 -0
- package/dist/chunks/{SSETransport-Chj_yfPv.js → SSETransport-DGIytG74.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-h6OunbMd.js +1 -0
- package/dist/chunks/Settings-BvhG1XoW.js +2 -0
- package/dist/chunks/{TeleportProgress-DP1a8jit.js → TeleportProgress-Bens06DU.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-B6sTwXuZ.js → TeleportRepoMismatchDialog-BtLBCZUe.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-CKUuRQSG.js → TeleportResumeWrapper-t50LfWyN.js} +1 -1
- package/dist/chunks/{ThemePicker-Dyq1YVhb.js → ThemePicker-BTfuZZ7E.js} +1 -1
- package/dist/chunks/TrustDialog-CgE_pYUK.js +1 -0
- package/dist/chunks/{ValidationErrorsList-DUNh4BNa.js → ValidationErrorsList-Bl68E-2-.js} +1 -1
- package/dist/chunks/{WelcomeV2-TPbOXGrO.js → WelcomeV2-C93xQYAF.js} +1 -1
- package/dist/chunks/{add-dir-Bf_5tCeR.js → add-dir-C3IhJYVH.js} +1 -1
- package/dist/chunks/{agentDisplay-CCeYiAta.js → agentDisplay-Cju-aXCx.js} +1 -1
- package/dist/chunks/{agents-Bt72Gz1v.js → agents-Bhg0CtXR.js} +7 -7
- package/dist/chunks/{agents-T8xHY5Wk.js → agents-Du3FQ82k.js} +1 -1
- package/dist/chunks/{allErrors-CDWTJcMw.js → allErrors-DJYCAtab.js} +1 -1
- package/dist/chunks/{ant-DRF-v5bA.js → ant-CVvy4SuO.js} +1 -1
- package/dist/chunks/api-CI8HXREw.js +1 -0
- package/dist/chunks/api-gJBnC8z3.js +1 -0
- package/dist/chunks/asciicast-BsWpcxrc.js +1 -0
- package/dist/chunks/{asciicast-CQJlNTae.js → asciicast-CbAjUHT_.js} +4 -4
- package/dist/chunks/{assistant-z1ojxEET.js → assistant-C_SkUDk_.js} +1 -1
- package/dist/chunks/auth-B9V3i5oZ.js +1 -0
- package/dist/chunks/auth-CgEABs3i.js +15 -0
- package/dist/chunks/auth-fSFfSKy_.js +1 -0
- package/dist/chunks/{autoMode-DW_H3i37.js → autoMode-CZyb-mMY.js} +5 -5
- package/dist/chunks/{autonomy-46hnmyAi.js → autonomy-BpINX4jw.js} +1 -1
- package/dist/chunks/{autonomy-OxhciwYa.js → autonomy-DJZ25xZp.js} +7 -7
- package/dist/chunks/{autonomyPanel-CTEjq0Bd.js → autonomyPanel-ssoiIOx5.js} +1 -1
- package/dist/chunks/{backgroundHousekeeping-Cpxq4krt.js → backgroundHousekeeping-BHncba6e.js} +3 -3
- package/dist/chunks/backgroundHousekeeping-QK8iEXoI.js +1 -0
- package/dist/chunks/{banner-BVkLvJiB.js → banner-CWkrK10u.js} +1 -1
- package/dist/chunks/bg-B0iMGM9C.js +1 -0
- package/dist/chunks/{bg-zWGqkcST.js → bg-WnYN5ifx.js} +2 -2
- package/dist/chunks/{branch-DJzijRGm.js → branch-BXo5z2al.js} +1 -1
- package/dist/chunks/{bridge-Dpr2AWpc.js → bridge-CbKc1HeD.js} +2 -2
- package/dist/chunks/bridgeConfig-CLHy-BiF.js +1 -0
- package/dist/chunks/{bridgeConfig-DDF3teRE.js → bridgeConfig-DbqUHe0H.js} +1 -1
- package/dist/chunks/bridgeEnabled-BWSUZ7Xg.js +1 -0
- package/dist/chunks/{bridgeEnabled-D4JDZd0y.js → bridgeEnabled-CM3SaumJ.js} +1 -1
- package/dist/chunks/bridgeMain-BESKzpm0.js +1 -0
- package/dist/chunks/bridgeMain-CzhBVCsN.js +68 -0
- package/dist/chunks/bridgeMessaging-lfa_v3oi.js +1 -0
- package/dist/chunks/bridgePointer-MqLe5Asm.js +1 -0
- package/dist/chunks/{browser-BKiu1max.js → browser-BmZuQom6.js} +1 -1
- package/dist/chunks/{btw-DG9CCeq4.js → btw-Cp0whJaJ.js} +1 -1
- package/dist/chunks/{caches-BB5_91gU.js → caches-CmW7idg5.js} +2 -2
- package/dist/chunks/caches-CpqTC0Lb.js +1 -0
- package/dist/chunks/ccrClient-BPXmxWHw.js +1 -0
- package/dist/chunks/{claudeDesktop-9xfIgkzE.js → claudeDesktop-Cx31Ugjp.js} +1 -1
- package/dist/chunks/{clear-ueMvDelv.js → clear-DjGPxX7T.js} +1 -1
- package/dist/chunks/{cliLaunch-BJ9o-rIV.js → cliLaunch-BkPAatcs.js} +1 -1
- package/dist/chunks/client-DPUvQ6Rf.js +1 -0
- package/dist/chunks/{color-B0-MIfsq.js → color-DYYBN52b.js} +1 -1
- package/dist/chunks/commands-D7l3P1k9.js +1 -0
- package/dist/chunks/commitAttribution-B7NUPJ8E.js +1 -0
- package/dist/chunks/{commitAttribution-DKun9CeU.js → commitAttribution-Bmzgtqc6.js} +2 -2
- package/dist/chunks/compact-D6xqZN4Q.js +2 -0
- package/dist/chunks/{completionCache-CdHCuiqq.js → completionCache-MN3_MqK8.js} +2 -2
- package/dist/chunks/completionCache-c4aiyZ_f.js +1 -0
- package/dist/chunks/config-DiT2Z8dY.js +3 -0
- package/dist/chunks/config-huQaTcNb.js +1 -0
- package/dist/chunks/config-qLaiAn7z.js +1 -0
- package/dist/chunks/{context-DBswG0EY.js → context-Bh_iUj76.js} +1 -1
- package/dist/chunks/context-noninteractive-CNot6jbs.js +1 -0
- package/dist/chunks/{context-noninteractive-CTvyNimw.js → context-noninteractive-Cb3EM2Oz.js} +2 -2
- package/dist/chunks/conversation-CSpwF3Ha.js +1 -0
- package/dist/chunks/conversation-CvCQta8e.js +1 -0
- package/dist/chunks/{createSSHSession-BdO35H6o.js → createSSHSession-B0s839mX.js} +5 -5
- package/dist/chunks/createSession-GNSNbUbN.js +1 -0
- package/dist/chunks/{createSession-Br1g8qSD.js → createSession-VMTMXOHu.js} +1 -1
- package/dist/chunks/crossProjectResume-DGpgCUfk.js +40 -0
- package/dist/chunks/{daemon-BQiSFjc-.js → daemon-YtZbMQtn.js} +1 -1
- package/dist/chunks/datadog-D9rlcN12.js +1 -0
- package/dist/chunks/{debug-DiuXEmUq.js → debug-BrXObCdR.js} +1 -1
- package/dist/chunks/{debugUtils-3YYWvb3H.js → debugUtils-NO5KtXqi.js} +1 -1
- package/dist/chunks/{desktop-W7SA8BFk.js → desktop-DidI-4N5.js} +1 -1
- package/dist/chunks/{detached-Cv9gAylK.js → detached-TYk4hMFj.js} +1 -1
- package/dist/chunks/{detectRepository-B1PMTLAU.js → detectRepository-BPr0VWNO.js} +1 -1
- package/dist/chunks/detectRepository-BTPgN89l.js +1 -0
- package/dist/chunks/{diff-CMtRjFUb.js → diff-CZg5qL2n.js} +1 -1
- package/dist/chunks/{directoryCompletion-CeV63gvu.js → directoryCompletion-CW2ckkQg.js} +1 -1
- package/dist/chunks/doctor-CKUXGCri.js +1 -0
- package/dist/chunks/{effort-BAlVDBHq.js → effort-BcvNemuq.js} +2 -2
- package/dist/chunks/{entry-DLqeVq5C.js → entry-dA1UCfC0.js} +4 -4
- package/dist/chunks/envLessBridgeConfig-BFjJ8Kt4.js +1 -0
- package/dist/chunks/envLessBridgeConfig-bei51W3H.js +1 -0
- package/dist/chunks/esm-DjGYYlQe.js +1 -0
- package/dist/chunks/{execFileNoThrow-DResQRvR.js → execFileNoThrow-D244NytW.js} +1 -1
- package/dist/chunks/execSyncWrapper-CCMQShK-.js +1 -0
- package/dist/chunks/exit-COMnVxzw.js +1 -0
- package/dist/chunks/extra-usage-BTv_OwGN.js +1 -0
- package/dist/chunks/extra-usage-By33zGLT.js +1 -0
- package/dist/chunks/{extra-usage-core-Dh4rVUI-.js → extra-usage-core-RZMzaH0L.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-D4Ya5KPm.js → extra-usage-noninteractive-BB-BQ3kh.js} +1 -1
- package/dist/chunks/{extraUsage-DtWi8E78.js → extraUsage-CTn9FWSk.js} +1 -1
- package/dist/chunks/extractMemories-CXGZGe0h.js +1 -0
- package/dist/chunks/fast-BXzdzzXU.js +1 -0
- package/dist/chunks/{fast-DkUxqWhE.js → fast-CNXgsvnE.js} +1 -1
- package/dist/chunks/{feedback-Cn7Sbqxa.js → feedback-DeJ2gvw2.js} +1 -1
- package/dist/chunks/{file-BZriE-XU.js → file-DcZWPH2V.js} +5 -5
- package/dist/chunks/firstPartyEventLogger-CQdJn3LV.js +5 -0
- package/dist/chunks/firstPartyEventLogger-CdLshdJY.js +1 -0
- package/dist/chunks/{flushGate-ebqQZF1t.js → flushGate-CJ73xcaK.js} +1 -1
- package/dist/chunks/gemini-Cn9bMXwP.js +1 -0
- package/dist/chunks/generateRecap-BO9kzRon.js +1 -0
- package/dist/chunks/{generateSessionName-DEAw5x_h.js → generateSessionName-CGpL6ATy.js} +1 -1
- package/dist/chunks/{genericProcessUtils-DO7Fy0RJ.js → genericProcessUtils-CdQTApYX.js} +1 -1
- package/dist/chunks/git-CbcnOf0E.js +1 -0
- package/dist/chunks/git-Do0wJvux.js +6 -0
- package/dist/chunks/{githubRepoPathMapping-Tt-LdYFZ.js → githubRepoPathMapping-C4umZ1oC.js} +1 -1
- package/dist/chunks/{goal-DCaI1NPN.js → goal-C8Qzl7_i.js} +3 -3
- package/dist/chunks/{grok-CKlngG3b.js → grok-CDT9P_BL.js} +1 -1
- package/dist/chunks/{grove-DSWe6psK.js → grove-BGXzEyH9.js} +2 -2
- package/dist/chunks/{heapdump-OVbV05On.js → heapdump-CFHvdSZv.js} +5 -5
- package/dist/chunks/{help-CRtX5VX9.js → help-DUZ7Y7Em.js} +1 -1
- package/dist/chunks/{hooks-tpf90xd5.js → hooks-RHwUCXcT.js} +2 -2
- package/dist/chunks/hooks-fZ1r0jUF.js +1 -0
- package/dist/chunks/{hostGuard-t7QfbijF.js → hostGuard-C5xydXZI.js} +1 -1
- package/dist/chunks/inboundAttachments-Cfl4_n0S.js +1 -0
- package/dist/chunks/inboundAttachments-YMxf4fmR.js +1 -0
- package/dist/chunks/initReplBridge-GH3-LHF4.js +1 -0
- package/dist/chunks/install-OkuNmjmB.js +1 -0
- package/dist/chunks/{instrumentation--Sx0y1Gk.js → instrumentation-hrXeo-G4.js} +6 -6
- package/dist/chunks/{job-D7B35Usp.js → job-DjmIpwJl.js} +1 -1
- package/dist/chunks/jwtUtils-DE2GPUcx.js +1 -0
- package/dist/chunks/keybindings-B8U17bhs.js +2 -0
- package/dist/chunks/{language-8Rnu_qxl.js → language-BA5WprZv.js} +1 -1
- package/dist/chunks/language-BbaOTWm3.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-CNPkOVzu.js → launchAgentsPlatform-DnxH2SAn.js} +1 -1
- package/dist/chunks/{launchLocalMemory-BxmDhENs.js → launchLocalMemory-CgXtGng1.js} +2 -2
- package/dist/chunks/{launchLocalVault-DQlTGA-g.js → launchLocalVault-Bs6Km3Ua.js} +3 -3
- package/dist/chunks/{launchMemoryStores-EYAwxI8i.js → launchMemoryStores-DxVAIJuB.js} +1 -1
- package/dist/chunks/{launchOnboarding-CTu5Zf4E.js → launchOnboarding-Cn0t_o2k.js} +1 -1
- package/dist/chunks/{launchSchedule-CeHHSvO7.js → launchSchedule-Chwr3Nzd.js} +1 -1
- package/dist/chunks/{launchSkillStore-Bqh2Fru2.js → launchSkillStore-6zxJfWVU.js} +1 -1
- package/dist/chunks/{launchTeleport-Crc3XVZX.js → launchTeleport-Ba_Hj13c.js} +1 -1
- package/dist/chunks/{launchVault-BHLgpth_.js → launchVault-hGVrHy33.js} +1 -1
- package/dist/chunks/{v4-jw6qOKwQ.js → lazySchema-DcIJE_0i.js} +1 -1
- package/dist/chunks/loadAgentsDir-BHOyHxwz.js +1 -0
- package/dist/chunks/{loadAgentsDir-ZQwvbURI.js → loadAgentsDir-DrDu5yYy.js} +685 -683
- package/dist/chunks/loadPluginHooks-s7bvGtns.js +1 -0
- package/dist/chunks/localSearch-CebU5BA9.js +1 -0
- package/dist/chunks/{localSearch-H0LchlTi.js → localSearch-_bQhk9W6.js} +1 -1
- package/dist/chunks/{log-Duzb4o6h.js → log-BMCygSzM.js} +1 -1
- package/dist/chunks/{logoV2Utils-5lcUu53m.js → logoV2Utils-CoC4nheD.js} +1 -1
- package/dist/chunks/{magicDocs-D1FIPmYg.js → magicDocs-kMjYpjCA.js} +3 -3
- package/dist/chunks/{main-B8XtFN2P.js → main-C_rVSWfm.js} +78 -78
- package/dist/chunks/{main-CR7cXdgy.js → main-D862LI_d.js} +2 -2
- package/dist/chunks/{mappers-DKU4RgE3.js → mappers-D0CNXG32.js} +1 -1
- package/dist/chunks/mcp-1ZuFesM9.js +2 -0
- package/dist/chunks/mcp-CKvGBEjz.js +1 -0
- package/dist/chunks/mcp-DtxIl6aN.js +6 -0
- package/dist/chunks/{memoize-DgMjqLtn.js → memoize-B0zhbT8Z.js} +1 -1
- package/dist/chunks/{memory-D-Q62bJ7.js → memory-DE2jtkd_.js} +1 -1
- package/dist/chunks/{mode-DFZgqKBd.js → mode-B4WIxCMW.js} +2 -2
- package/dist/chunks/model-C4RHNhDQ.js +1 -0
- package/dist/chunks/model-fi472PRc.js +1 -0
- package/dist/chunks/{model-fDWtIRVr.js → model-j9GNZDFr.js} +1 -1
- package/dist/chunks/nativeInstaller-DktvrWRd.js +1 -0
- package/dist/chunks/{onChangeAppState-DaQ0R9Tw.js → onChangeAppState-CGVeNkt7.js} +1 -1
- package/dist/chunks/{openai-DNS0-ivj.js → openai-BSVjSJiF.js} +3 -3
- package/dist/chunks/{overageCreditGrant-qHN3tnp2.js → overageCreditGrant-BVxlYgeU.js} +1 -1
- package/dist/chunks/{panelCall-BvKpHquo.js → panelCall-Cp6fpQeL.js} +1 -1
- package/dist/chunks/parser-Bf6iasPV.js +1 -0
- package/dist/chunks/{parser-TYEkLFgh.js → parser-DFwaTGf7.js} +1 -1
- package/dist/chunks/{partition-Cv11dD5P.js → partition-RjCtgt9J.js} +1 -1
- package/dist/chunks/{passes-DQdM2Ssq.js → passes-ByTLy6pj.js} +1 -1
- package/dist/chunks/{path-Cu_AKqg6.js → path-D5U-tm91.js} +1 -1
- package/dist/chunks/permissions-B3df_htx.js +3 -0
- package/dist/chunks/pidLock-CdNZ0Wfg.js +3 -0
- package/dist/chunks/{pipeTransport-7GIO6GCA.js → pipeTransport-CqCnc-Ys.js} +1 -1
- package/dist/chunks/{plan-D8dQDl8W.js → plan-BxTA-b4l.js} +1 -1
- package/dist/chunks/{platform-B5dCGT8t.js → platform-BrYefG_2.js} +1 -1
- package/dist/chunks/{plugin-w8MqsKHn.js → plugin-DOpl5e1t.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-7FFHzSRz.js → pluginAutoupdate-L09CQ-ph.js} +1 -1
- package/dist/chunks/pluginBlocklist-B32eWmzn.js +1 -0
- package/dist/chunks/pluginCliCommands-CDMWnO3d.js +1 -0
- package/dist/chunks/{pluginFlagging-_WUQP3Lq.js → pluginFlagging-3FQGvIfq.js} +1 -1
- package/dist/chunks/pluginOperations-ClzXYNQe.js +2 -0
- package/dist/chunks/{pluginStartupCheck-BelpzwZI.js → pluginStartupCheck-BNd2QNzZ.js} +1 -1
- package/dist/chunks/pluginStartupCheck-RiZxW-WU.js +1 -0
- package/dist/chunks/plugins-CcDG95Bs.js +4 -0
- package/dist/chunks/policyLimits-Bwi9VqDF.js +1 -0
- package/dist/chunks/pollConfig-DH2oCtFS.js +1 -0
- package/dist/chunks/{poor-D3T_8wwf.js → poor-DekfGNT7.js} +1 -1
- package/dist/chunks/poorMode-AE4WNYZo.js +1 -0
- package/dist/chunks/{poorMode-BqyVuBu-.js → poorMode-CtcqaiwD.js} +1 -1
- package/dist/chunks/print-Cc_QOSPF.js +23 -0
- package/dist/chunks/{privacy-settings-D5zxu4Aa.js → privacy-settings-ChNsgGUs.js} +1 -1
- package/dist/chunks/processBashCommand-Bx6_oZoE.js +1 -0
- package/dist/chunks/processSlashCommand-AltWgIFt.js +5 -0
- package/dist/chunks/prompt-C0nU0VK3.js +139 -0
- package/dist/chunks/prompt-CYx145pp.js +1 -0
- package/dist/chunks/prompt-DH3lKFag.js +1 -0
- package/dist/chunks/{promptEditor-D6HzjcMS.js → promptEditor-Cumef6hJ.js} +2 -2
- package/dist/chunks/{protocolHandler-BXlx1N7v.js → protocolHandler-z2zxAtB1.js} +4 -4
- package/dist/chunks/{proxy-CHnxhNZI.js → proxy-CRN7jYIi.js} +3 -3
- package/dist/chunks/{rate-limit-options-1hc-RyNR.js → rate-limit-options-VL7S3SCx.js} +1 -1
- package/dist/chunks/rcDebugLog-2-1XSyFV.js +11 -0
- package/dist/chunks/reconciler-DHRE_gV2.js +4 -0
- package/dist/chunks/{referral-Cu9bEOFE.js → referral-DrebVwqx.js} +1 -1
- package/dist/chunks/{refresh-vJbxW4a1.js → refresh-pFezssA8.js} +1 -1
- package/dist/chunks/{registerProtocol-B_XbLDQO.js → registerProtocol-CukLQuxJ.js} +3 -3
- package/dist/chunks/{release-notes-CavWoMQR.js → release-notes-D7vrFNXp.js} +1 -1
- package/dist/chunks/{releaseNotes-Di6OaHF7.js → releaseNotes-CDx2P0fb.js} +2 -2
- package/dist/chunks/{reload-plugins-ofeLn07p.js → reload-plugins-CltHfg-l.js} +1 -1
- package/dist/chunks/{remote-env-dXzHAuD6.js → remote-env-SvvSuP0J.js} +1 -1
- package/dist/chunks/remoteBridgeCore-BOeljn2c.js +1 -0
- package/dist/chunks/remoteManagedSettings-CaY_ZH8r.js +1 -0
- package/dist/chunks/{rename-CtjP0lop.js → rename-CbqrCCBO.js} +1 -1
- package/dist/chunks/{renderOptions-DOXmueQV.js → renderOptions-BUJB9nAm.js} +1 -1
- package/dist/chunks/{resume-C5h5JvY1.js → resume-DockJaY9.js} +2 -2
- package/dist/chunks/{ripgrep-BN_g-F7X.js → ripgrep-BXmXjAzA.js} +1 -1
- package/dist/chunks/ripgrep-BfIpz5uC.js +1 -0
- package/dist/chunks/{runtimeObserver-DOZFrqJu.js → runtimeObserver-DSUuYKfs.js} +1 -1
- package/dist/chunks/{runtimeObserver-B93v1AxE.js → runtimeObserver-XufSllVw.js} +4 -4
- package/dist/chunks/sandbox-adapter-CEZnHq0U.js +1 -0
- package/dist/chunks/{sandbox-toggle-TiLGFwaZ.js → sandbox-toggle-CZI5fuK3.js} +1 -1
- package/dist/chunks/searchExtraTools-iQfI39wB.js +1 -0
- package/dist/chunks/{session-v9tKHhU9.js → session-B-Z3DU9o.js} +2 -2
- package/dist/chunks/{sessionDiscovery-4byQKOnc.js → sessionDiscovery-C3pMZkBM.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-DyrZmoA7.js +1 -0
- package/dist/chunks/sessionMemory-CqRpgwtU.js +1 -0
- package/dist/chunks/sessionMemory-D_HQmhj7.js +1 -0
- package/dist/chunks/sessionMemoryUtils-CZOIKrn0.js +1 -0
- package/dist/chunks/sessionObserver-B400YG3s.js +1 -0
- package/dist/chunks/{sessionObserver-OgY9BUP4.js → sessionObserver-B_09FQKV.js} +1 -1
- package/dist/chunks/sessionStorage-DRnvtrpU.js +1 -0
- package/dist/chunks/sessionTitle-CmLWNFuX.js +14 -0
- package/dist/chunks/{sessionTracing-BBxhPccY.js → sessionTracing-lArOaj9u.js} +3 -3
- package/dist/chunks/settings-DfWP5y6X.js +19 -0
- package/dist/chunks/settingsSync-BlDk6rsM.js +1 -0
- package/dist/chunks/setup-DdbmxSZh.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DDSOFi1W.js → shadowedRuleDetection-E2wF1UjU.js} +1 -1
- package/dist/chunks/{shellQuote-yXoC_y5m.js → shellQuote-DkSy9MYE.js} +1 -1
- package/dist/chunks/{sideQuestion-CAiA6jAf.js → sideQuestion-BjHCLSR9.js} +1 -1
- package/dist/chunks/sinks-Cb--pqr-.js +2 -0
- package/dist/chunks/sinks-DbwDBd-E.js +1 -0
- package/dist/chunks/{skill-learning-Dx1o4mMo.js → skill-learning-B0dyBT1_.js} +1 -1
- package/dist/chunks/skillChangeDetector-DQof8SUY.js +1 -0
- package/dist/chunks/{skillGapStore-Zvqiyxds.js → skillGapStore-75ZYlfwi.js} +2 -2
- package/dist/chunks/{skillGapStore-BV_6qzxU.js → skillGapStore-D2fqmnKx.js} +1 -1
- package/dist/chunks/{skillGenerator-jJQDphQ8.js → skillGenerator-CwXUfM4Y.js} +2 -2
- package/dist/chunks/{skillLearning-BTT3_yGc.js → skillLearning-CB-5fdMl.js} +1 -1
- package/dist/chunks/skillLearning-CSY5R5Jn.js +1 -0
- package/dist/chunks/{skillPanel-OW2M6SZr.js → skillPanel-Bum7xpgo.js} +3 -3
- package/dist/chunks/{skillSearchPanel-C0Y56c5N.js → skillSearchPanel-LSPwZIOw.js} +4 -4
- package/dist/chunks/{skills-BFsyLP33.js → skills-G8WBeffd.js} +1 -1
- package/dist/chunks/startupProfiler-DIWVcO4e.js +1 -0
- package/dist/chunks/{startupProfiler-BquH_Yqm.js → startupProfiler-xa3NmN7Z.js} +2 -2
- package/dist/chunks/{stats-CrPmPT8f.js → stats-DmFubHpI.js} +1 -1
- package/dist/chunks/{status-DHJbK4pV.js → status-ClSsvm1N.js} +2 -2
- package/dist/chunks/{status-BO5J2MAe.js → status-i5beKggW.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-CqeUBySi.js → statusNoticeHelpers-BK-54uGY.js} +1 -1
- package/dist/chunks/{stickers-BLFmyHZV.js → stickers-D5teCKMN.js} +1 -1
- package/dist/chunks/{stringUtils-D_g2L6A4.js → stringUtils-DGLPkqJ4.js} +1 -1
- package/dist/chunks/{tag-M2AEtXjW.js → tag-DYYq4H_i.js} +2 -2
- package/dist/chunks/{tasks-CoOs_Qkj.js → tasks-BySzm_YJ.js} +1 -1
- package/dist/chunks/teleport-dxtBcM01.js +1 -0
- package/dist/chunks/{templateJobs-Cl50Qw0s.js → templateJobs-CT5VxeRr.js} +1 -1
- package/dist/chunks/terminalSetup-BNs9nLbT.js +33 -0
- package/dist/chunks/{terminalSetup-Bdh9K31U.js → terminalSetup-RDKg8dVa.js} +1 -1
- package/dist/chunks/{theme-DgCIr0jU.js → theme-CVTVsRwt.js} +1 -1
- package/dist/chunks/thinkback-B-GpXG9U.js +1 -0
- package/dist/chunks/{thinkback-ERCQ86CR.js → thinkback-CXsRbDYN.js} +1 -1
- package/dist/chunks/thinkback-play-BhfCaIye.js +1 -0
- package/dist/chunks/{tmux-ZZk68JBq.js → tmux-BY7IdQ1f.js} +1 -1
- package/dist/chunks/{toolEventObserver-9XCQXiMx.js → toolEventObserver--4fqXxQZ.js} +1 -1
- package/dist/chunks/{toolEventObserver-9-5Ne25Z.js → toolEventObserver-DdhPsAs1.js} +1 -1
- package/dist/chunks/toolPool-DvHECcbN.js +1 -0
- package/dist/chunks/trustedDevice-DvpN4J1F.js +1 -0
- package/dist/chunks/trustedDevice-e6iF1X7C.js +1 -0
- package/dist/chunks/{types-Cnorfsss.js → types-C-MRCL8J.js} +3 -3
- package/dist/chunks/udsClient-BuCtv7dN.js +1 -0
- package/dist/chunks/{ultrareviewCommand-BMBHepdu.js → ultrareviewCommand-i3PfFKly.js} +2 -2
- package/dist/chunks/undercover-CPvoDtJ1.js +1 -0
- package/dist/chunks/{undercover-DDgIKbO5.js → undercover-Q24TWRw0.js} +1 -1
- package/dist/chunks/{up-D6bNw_tT.js → up-BHkC97_C.js} +1 -1
- package/dist/chunks/updateCCB-CEXA6dax.js +11 -0
- package/dist/chunks/{upgrade-BN20nsCH.js → upgrade-7OrBbrzS.js} +1 -1
- package/dist/chunks/upgrade-uR7SIVtx.js +1 -0
- package/dist/chunks/upload-B-lNHpWe.js +1 -0
- package/dist/chunks/{upstreamproxy-os5rw0Vg.js → upstreamproxy-DyR_eXO8.js} +4 -4
- package/dist/chunks/usage-7jOeIVv9.js +1 -0
- package/dist/chunks/{usage-D_sqm8us.js → usage-CZdPfUqP.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-vzUoPY51.js → useExitOnCtrlCDWithKeybindings-CzFtdlnD.js} +1 -1
- package/dist/chunks/useMainLoopModel-DegH12LZ.js +1 -0
- package/dist/chunks/useManagePlugins-BkK1zydO.js +1 -0
- package/dist/chunks/{useMergedTools-Bb4XbC9d.js → useMergedTools-DMGRA1ga.js} +1 -1
- package/dist/chunks/{useSearchInput-B1UOjxAI.js → useSearchInput-D5VU9IDU.js} +1 -1
- package/dist/chunks/{useSettingsErrors-BLbvu4--.js → useSettingsErrors-B5PSF1va.js} +1 -1
- package/dist/chunks/{util-CxlfALM4.js → util-CNa1ib_4.js} +1 -1
- package/dist/chunks/validatePlugin-Dw-RGCrm.js +1 -0
- package/dist/chunks/{vim-DLWBHwVM.js → vim-C0KTnJJs.js} +1 -1
- package/dist/chunks/{which-sEFQXpaX.js → which-CKQnSouy.js} +1 -1
- package/dist/chunks/windowsPaths-9pEkw0oV.js +1 -0
- package/dist/chunks/windowsPaths-DtapVxOo.js +1 -0
- package/dist/chunks/{workSecret-DvniZR71.js → workSecret-CNWiR2uQ.js} +1 -1
- package/dist/chunks/{workerRegistry-CFnGtb3L.js → workerRegistry-B2QD2sKq.js} +1 -1
- package/dist/chunks/worktree-D38cJ23W.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +4 -5
- package/dist/chunks/ApproveApiKey-CQsQdQBC.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-AiVi-1pI.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DUu6iRJk.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-DVTPwR5I.js +0 -1
- package/dist/chunks/Doctor-BXhz8eUa.js +0 -3
- package/dist/chunks/Doctor-D75dsEyb.js +0 -1
- package/dist/chunks/ExitFlow-B1XNACQP.js +0 -2
- package/dist/chunks/Feedback-Cvz80lAn.js +0 -2
- package/dist/chunks/Grove-B7hhBvFw.js +0 -1
- package/dist/chunks/MCPConnectionManager-BLfKm4H2.js +0 -1
- package/dist/chunks/MessageSelector-DmKtBYX9.js +0 -3
- package/dist/chunks/Messages-CaFdI1kk.js +0 -11
- package/dist/chunks/PluginSettings-0FSNch8O.js +0 -17
- package/dist/chunks/QueryEngine-WYDWzQuY.js +0 -1
- package/dist/chunks/REPL-vV_jzAVx.js +0 -1
- package/dist/chunks/ResumeConversation-g_JyOWbl.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-Daedym7_.js +0 -1
- package/dist/chunks/Settings-DUXA-qac.js +0 -2
- package/dist/chunks/TrustDialog-CdZS9t-T.js +0 -1
- package/dist/chunks/ajv-5vMo9UcX.js +0 -8
- package/dist/chunks/api-CLLIHLpn.js +0 -1
- package/dist/chunks/api-DMpNA1s8.js +0 -1
- package/dist/chunks/asciicast-BIr75_x9.js +0 -1
- package/dist/chunks/auth-Ce0jllLf.js +0 -1
- package/dist/chunks/auth-DV3P8Qup.js +0 -1
- package/dist/chunks/auth-DpFfHy1W.js +0 -15
- package/dist/chunks/backgroundHousekeeping-BycL9lOe.js +0 -1
- package/dist/chunks/bg-H849G7Sc.js +0 -1
- package/dist/chunks/bridgeConfig-CcANVX0P.js +0 -1
- package/dist/chunks/bridgeEnabled-Cn-u7P4_.js +0 -1
- package/dist/chunks/bridgeMain-CtgVyLjI.js +0 -68
- package/dist/chunks/bridgeMain-Dh0gWRVo.js +0 -1
- package/dist/chunks/bridgeMessaging-CRG6HqUb.js +0 -1
- package/dist/chunks/bridgePointer-Cug5fQ3e.js +0 -1
- package/dist/chunks/caches-C3NINY3K.js +0 -1
- package/dist/chunks/ccrClient-CRXGlUCe.js +0 -1
- package/dist/chunks/client-AnWHs0gW.js +0 -1
- package/dist/chunks/commands-DsKH3ogN.js +0 -1
- package/dist/chunks/commitAttribution-D7NrwLhc.js +0 -1
- package/dist/chunks/compact-BhWCO-oD.js +0 -2
- package/dist/chunks/completionCache-C9zlWBRz.js +0 -1
- package/dist/chunks/config-662VDD70.js +0 -3
- package/dist/chunks/config-CUN8YbOa.js +0 -1
- package/dist/chunks/config-DklnhNx1.js +0 -1
- package/dist/chunks/config-Wk3svGdH.js +0 -1
- package/dist/chunks/context-noninteractive-C3dICmA9.js +0 -1
- package/dist/chunks/conversation-CooSju3g.js +0 -1
- package/dist/chunks/conversation-DLLIOKYV.js +0 -1
- package/dist/chunks/createSession-CVG8SiEm.js +0 -1
- package/dist/chunks/crossProjectResume-DiKJb83I.js +0 -40
- package/dist/chunks/datadog-BE6D_6m0.js +0 -1
- package/dist/chunks/datadog-C69i7cfI.js +0 -1
- package/dist/chunks/debug-8kgDrUfj.js +0 -1
- package/dist/chunks/detectRepository-_Kj817Vi.js +0 -1
- package/dist/chunks/doctor-DEz8BHAz.js +0 -1
- package/dist/chunks/envLessBridgeConfig-3kCrKZl7.js +0 -1
- package/dist/chunks/envLessBridgeConfig-BfgXw47_.js +0 -1
- package/dist/chunks/esm-C8Zkk1Ux.js +0 -1
- package/dist/chunks/execSyncWrapper-CWxMek26.js +0 -1
- package/dist/chunks/exit-cyepwuyy.js +0 -1
- package/dist/chunks/extra-usage-DlFeNGQD.js +0 -1
- package/dist/chunks/extra-usage-nRFfBiXh.js +0 -1
- package/dist/chunks/extractMemories-BqN8fWZ5.js +0 -1
- package/dist/chunks/fast-NvqW2-t1.js +0 -1
- package/dist/chunks/firstPartyEventLogger-AhXYSrkP.js +0 -1
- package/dist/chunks/firstPartyEventLogger-BQYrBdvD.js +0 -5
- package/dist/chunks/gemini-Sr_00TsL.js +0 -1
- package/dist/chunks/generateRecap-5d4l_ODy.js +0 -1
- package/dist/chunks/git-Cc1jAz6r.js +0 -1
- package/dist/chunks/git-Cgc8X5l2.js +0 -6
- package/dist/chunks/hooks-DvtnNoYE.js +0 -1
- package/dist/chunks/inboundAttachments-BZ6MKpxd.js +0 -1
- package/dist/chunks/inboundAttachments-D5Ux2kCl.js +0 -1
- package/dist/chunks/initReplBridge-CjuO6in6.js +0 -1
- package/dist/chunks/install-DqpM2brU.js +0 -1
- package/dist/chunks/jwtUtils-CqXPjf-a.js +0 -1
- package/dist/chunks/keybindings-JvAmBpLt.js +0 -2
- package/dist/chunks/language-DaxZe0Xw.js +0 -1
- package/dist/chunks/lazySchema-uxlVVNM1.js +0 -1
- package/dist/chunks/loadAgentsDir-D7npVvsj.js +0 -1
- package/dist/chunks/loadPluginHooks-CaKvZVZI.js +0 -1
- package/dist/chunks/localSearch-BU5oulbF.js +0 -1
- package/dist/chunks/mcp-B06Mqsur.js +0 -6
- package/dist/chunks/mcp-C0AjA07u.js +0 -1
- package/dist/chunks/mcp-ghioDl7W.js +0 -2
- package/dist/chunks/metadata-CIx5CsoY.js +0 -1
- package/dist/chunks/model-BgrLt7P7.js +0 -1
- package/dist/chunks/model-aVc5c3Lz.js +0 -1
- package/dist/chunks/nativeInstaller-DKe1pWoL.js +0 -1
- package/dist/chunks/parser-Bj3gOqFv.js +0 -1
- package/dist/chunks/permissions-DB_2mmCl.js +0 -3
- package/dist/chunks/pidLock-DchmaAK6.js +0 -3
- package/dist/chunks/pluginBlocklist-Cw_l-yal.js +0 -1
- package/dist/chunks/pluginCliCommands-BtYWRxhS.js +0 -1
- package/dist/chunks/pluginOperations-BOkST1qE.js +0 -2
- package/dist/chunks/pluginStartupCheck-XBLJZZys.js +0 -1
- package/dist/chunks/plugins-6px6K1fh.js +0 -4
- package/dist/chunks/policyLimits-C07tQ0Wr.js +0 -1
- package/dist/chunks/pollConfig-C2Ac8WMU.js +0 -1
- package/dist/chunks/poorMode-BdBDiOFD.js +0 -1
- package/dist/chunks/print-DcQSuK0v.js +0 -23
- package/dist/chunks/processBashCommand-CEqA4QZi.js +0 -1
- package/dist/chunks/processSlashCommand-DMpFk59M.js +0 -5
- package/dist/chunks/prompt-CKvoqUC3.js +0 -1
- package/dist/chunks/prompt-aXZPR3q8.js +0 -1
- package/dist/chunks/prompt-wys9CwDo.js +0 -132
- package/dist/chunks/rcDebugLog-CivJaJ3V.js +0 -11
- package/dist/chunks/reconciler-BKX4jh34.js +0 -4
- package/dist/chunks/remoteBridgeCore-CmwkjiTK.js +0 -1
- package/dist/chunks/remoteManagedSettings-Co-CxR67.js +0 -1
- package/dist/chunks/ripgrep-hOjrgpMp.js +0 -1
- package/dist/chunks/sandbox-adapter-CO5GuywY.js +0 -1
- package/dist/chunks/searchExtraTools-CXZJU2Kv.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BUyIQVzL.js +0 -1
- package/dist/chunks/sessionMemory-ZsxCLHYd.js +0 -1
- package/dist/chunks/sessionMemory-e6YpTUhW.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BD_dqyYB.js +0 -1
- package/dist/chunks/sessionObserver-DNItJztR.js +0 -1
- package/dist/chunks/sessionStorage-xvxpRETp.js +0 -1
- package/dist/chunks/sessionTitle-Bph6GO4F.js +0 -14
- package/dist/chunks/settings-BhvhCpVh.js +0 -19
- package/dist/chunks/settingsSync-D2B5K4BT.js +0 -1
- package/dist/chunks/setup-CEnNEK6Z.js +0 -3
- package/dist/chunks/sink-CyKOf5TT.js +0 -1
- package/dist/chunks/sink-DxPJ4khU.js +0 -1
- package/dist/chunks/sinks-BNo3DvxO.js +0 -2
- package/dist/chunks/sinks-CHgtwDha.js +0 -1
- package/dist/chunks/skillChangeDetector-BRBCwQ2w.js +0 -1
- package/dist/chunks/skillLearning-BH7EAU1m.js +0 -1
- package/dist/chunks/src-xRRBgNzF.js +0 -25
- package/dist/chunks/startupProfiler-CYCH-qos.js +0 -1
- package/dist/chunks/stdio-4S7b8Uhx.js +0 -1
- package/dist/chunks/stdio-W_Kokrkh.js +0 -3
- package/dist/chunks/teleport-DjIgQeBB.js +0 -1
- package/dist/chunks/terminalSetup-nvS3KCDG.js +0 -33
- package/dist/chunks/thinkback-BSv_fvbV.js +0 -1
- package/dist/chunks/thinkback-play-DNB0IWYt.js +0 -1
- package/dist/chunks/toolPool-uQKZRMKg.js +0 -1
- package/dist/chunks/trustedDevice-0ej6e3nx.js +0 -1
- package/dist/chunks/trustedDevice-nqhuw4tp.js +0 -1
- package/dist/chunks/udsClient-CiFj4M_h.js +0 -1
- package/dist/chunks/undercover-6UUO38fQ.js +0 -1
- package/dist/chunks/updateCCB-B-OlpLjA.js +0 -11
- package/dist/chunks/upgrade-DYqlCH80.js +0 -1
- package/dist/chunks/upload-BQGByiXE.js +0 -1
- package/dist/chunks/usage-DolSCKGi.js +0 -1
- package/dist/chunks/useMainLoopModel-cZd8EKo5.js +0 -1
- package/dist/chunks/useManagePlugins-DgGZBvXV.js +0 -1
- package/dist/chunks/validatePlugin-n8a4W_jI.js +0 -1
- package/dist/chunks/windowsPaths-BLevJOlm.js +0 -1
- package/dist/chunks/windowsPaths-N_YmYY6k.js +0 -1
- package/dist/chunks/worktree-Dr_WzlXs.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{E as a,M as o,S as s,b as c,d as l,h as u,i as d,l as f,n as p,p as ee,s as m,v as te,w as h,y as ne}from"./esm-lWlUmoUA.js";import{C as g,S as re,T as ie,b as _,j as ae,w as oe,x as se,y as ce}from"./esm-Cb-L4oAk.js";import{n as v,t as le}from"./esm-Bx6rTxIs.js";import{n as ue,t as de}from"./axios-DaWTGg7G.js";import{Cn as fe,Kn as pe,Lt as y,Q as me,Vn as he,Y as ge,en as _e,mr as ve,z as ye}from"./state-ix0xIunV.js";import{E as be,J as xe,O as Se,U as Ce,l as b,ot as we,p as x,s as Te,st as Ee,z as De}from"./debug-DiuXEmUq.js";import{f as Oe,g as ke}from"./settings-BhvhCpVh.js";import{b as Ae,c as je,g as Me,n as Ne}from"./config-662VDD70.js";import{d as Pe,f as Fe,o as Ie,s as S}from"./log-Duzb4o6h.js";import{r as Le,t as Re}from"./memoize-DgMjqLtn.js";import{a as ze,i as Be,o as Ve}from"./platform-B5dCGT8t.js";import{i as He,n as Ue}from"./startupProfiler-BquH_Yqm.js";import{Bt as We,Ht as Ge,It as Ke,Kt as qe,Nt as Je,Vt as Ye,ar as Xe,er as Ze,ir as Qe,lr as $e,ur as et}from"./model-BgrLt7P7.js";import{_ as tt,b as nt,h as rt,l as it,o as at,p as ot,u as st,v as ct,y as lt}from"./proxy-CHnxhNZI.js";import{_ as ut,b as dt,c as ft,l as pt,r as mt,v as ht,y as gt}from"./sessionTracing-BBxhPccY.js";import{A as _t,B as C,C as vt,D as yt,E as bt,I as w,K as xt,L as T,M as St,N as Ct,O as wt,P as E,R as Tt,U as Et,W as D,_ as O,b as Dt,c as Ot,d as kt,h as At,i as jt,k,n as Mt,o as Nt,p as Pt,q as Ft,t as It,u as Lt,v as A,w as j,y as Rt}from"./esm-C8Zkk1Ux.js";var M;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(M||(M={}));var N;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(N||(N={}));var P;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(P||(P={}));function zt(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Bt(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var Vt=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function F(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Vt(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Ht(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ut(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Wt(e,t){return e.toLowerCase()===t.toLowerCase()}var I;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(I||(I={})),r();var Gt=class{constructor(){i(this,`kind`,I.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};r();function Kt(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var qt=class{constructor(e,t,n=!0,r=Kt(t)){i(this,`startTime`,void 0),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Ut(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Jt=class{constructor(e,t){i(this,`kind`,I.HISTOGRAM),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new qt(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new qt(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new qt(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===N.GAUGE||e.type===N.UP_DOWN_COUNTER||e.type===N.OBSERVABLE_GAUGE||e.type===N.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};r();var Yt=class e{constructor(e=new Xt,t=0,n=0,r=0){i(this,`backing`,void 0),i(this,`indexBase`,void 0),i(this,`indexStart`,void 0),i(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},Xt=class e{constructor(e=[0]){i(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},Zt=2146435072,Qt=1048575,$t=1023,en=-1022,tn=$t,nn=2**-1022;function rn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&Zt)>>20)-$t}function an(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&Qt)*2**32+r}function on(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function sn(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var L=class extends Error{};r();var cn=class{constructor(e){i(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<nn?this._minNormalLowerBoundaryIndex():rn(e)+this._rightShift(an(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new L(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new L(`overflow: ${e} is > maximum lower boundary: ${n}`);return on(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=en>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return tn>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}};r();var ln=class{constructor(e){i(this,`_scale`,void 0),i(this,`_scaleFactor`,void 0),i(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=on(Math.LOG2E,e),this._inverseFactor=on(Math.LN2,-e)}mapToIndex(e){if(e<=nn)return this._minNormalLowerBoundaryIndex()-1;if(an(e)===0)return(rn(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new L(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return nn;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new L(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return en<<this._scale}_maxNormalLowerBoundaryIndex(){return(tn+1<<this._scale)-1}},un=-10,dn=20,fn=Array.from({length:31},(e,t)=>t>10?new ln(t-10):new cn(t-10));function pn(e){if(e>dn||e<un)throw new L(`expected scale >= ${un} && <= ${dn}, got: ${e}`);return fn[e+10]}p(),r();var R=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){i(this,`low`,void 0),i(this,`high`,void 0),this.low=e,this.high=t}},mn=20,hn=160,gn=2,_n=class e{constructor(e,t=hn,n=!0,r=0,a=0,o=0,s=1/0,c=-1/0,l=new Yt,u=new Yt,d=pn(mn)){i(this,`startTime`,void 0),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_sum`,void 0),i(this,`_count`,void 0),i(this,`_zeroCount`,void 0),i(this,`_min`,void 0),i(this,`_max`,void 0),i(this,`_positive`,void 0),i(this,`_negative`,void 0),i(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=a,this._zeroCount=o,this._min=s,this._max=c,this._positive=l,this._negative=u,this._mapping=d,this._maxSize<gn&&(m.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
2
|
-
changing to the minimum size of: ${gn}`),this._maxSize=gn)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=sn(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=pn(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=R.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=R.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new R(0,-1);let r=t-n;return new R(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},vn=class{constructor(e,t){i(this,`kind`,I.EXPONENTIAL_HISTOGRAM),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new _n(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===N.GAUGE||e.type===N.UP_DOWN_COUNTER||e.type===N.OBSERVABLE_GAUGE||e.type===N.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};A(),r();var yn=class{constructor(e,t=0,n=[0,0]){i(this,`startTime`,void 0),i(this,`_current`,void 0),i(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=E(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},bn=class{constructor(){i(this,`kind`,I.LAST_VALUE)}createAccumulation(e){return new yn(e)}merge(e,t){let n=k(t.sampleTime)>=k(e.sampleTime)?t:e;return new yn(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=k(t.sampleTime)>=k(e.sampleTime)?t:e;return new yn(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};r();var z=class{constructor(e,t,n=0,r=!1){i(this,`startTime`,void 0),i(this,`monotonic`,void 0),i(this,`_current`,void 0),i(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},xn=class{constructor(e){i(this,`kind`,I.SUM),i(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new z(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new z(t.startTime,this.monotonic,r,t.reset):new z(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new z(t.startTime,this.monotonic,r,!0):new z(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};p(),r();var Sn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Sn,`DEFAULT_INSTANCE`,new Gt);var Cn=class e{createAggregator(t){switch(t.type){case N.COUNTER:case N.OBSERVABLE_COUNTER:case N.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};i(Cn,`MONOTONIC_INSTANCE`,new xn(!0)),i(Cn,`NON_MONOTONIC_INSTANCE`,new xn(!1));var wn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(wn,`DEFAULT_INSTANCE`,new bn);var Tn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Tn,`DEFAULT_INSTANCE`,new Jt([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var En=class{constructor(e,t=!0){if(i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new Jt(this._boundaries,this._recordMinMax)}},Dn=class{constructor(e=160,t=!0){i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new vn(this._maxSize,this._recordMinMax)}},On=class{_resolve(e){switch(e.type){case N.COUNTER:case N.UP_DOWN_COUNTER:case N.OBSERVABLE_COUNTER:case N.OBSERVABLE_UP_DOWN_COUNTER:return An;case N.GAUGE:case N.OBSERVABLE_GAUGE:return jn;case N.HISTOGRAM:return e.advice.explicitBucketBoundaries?new En(e.advice.explicitBucketBoundaries):Mn}return m.warn(`Unable to recognize instrument type: ${e.type}`),kn}createAggregator(e){return this._resolve(e).createAggregator(e)}},kn=new Sn,An=new Cn,jn=new wn,Mn=new Tn;new Dn;var Nn=new On,B;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(B||(B={}));function Pn(e){switch(e.type){case B.DEFAULT:return Nn;case B.DROP:return kn;case B.SUM:return An;case B.LAST_VALUE:return jn;case B.EXPONENTIAL_HISTOGRAM:{let t=e;return new Dn(t.options?.maxSize,t.options?.recordMinMax)}case B.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Mn:new En(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Fn=e=>({type:B.DEFAULT}),In=e=>M.CUMULATIVE,Ln=`otel.component.name`,Rn=`otel.component.type`,zn=`periodic_metric_reader`,Bn=`otel.sdk.metric_reader.collection.duration`,Vn=`error.type`;r();var Hn=new Map,Un=class{constructor(e,t){i(this,`collectionDuration`,void 0),i(this,`standardAttrs`,void 0);let n=Hn.get(e)??0;Hn.set(e,n+1),this.standardAttrs={[Rn]:e,[Ln]:`${e}/${n}`},this.collectionDuration=t.createHistogram(Bn,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[Vn]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}},Wn=`2.9.0`;p(),A(),r();var Gn=class{constructor(e){i(this,`_shutdown`,!1),i(this,`_metricProducers`,void 0),i(this,`_sdkMetricProducer`,void 0),i(this,`_selfObsMetrics`,void 0),i(this,`_aggregationTemporalitySelector`,void 0),i(this,`_aggregationSelector`,void 0),i(this,`_cardinalitySelector`,void 0),i(this,`_otelComponentType`,void 0),this._aggregationSelector=e?.aggregationSelector??Fn,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??In,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Un(this._otelComponentType,a())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,Wn);this._selfObsMetrics=new Un(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=yt(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=yt(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=_t(wt(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){m.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await F(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){m.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await F(this.onForceFlush(),e.timeoutMillis)}};function Kn(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}p(),A(),r();var qn=class extends Gn{constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:a,maxExportBatchSize:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:zn,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...a};switch(e){case N.COUNTER:return t.counter??t.default;case N.GAUGE:return t.gauge??t.default;case N.HISTOGRAM:return t.histogram??t.default;case N.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case N.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case N.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case N.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),i(this,`_interval`,void 0),i(this,`_exporter`,void 0),i(this,`_exportInterval`,void 0),i(this,`_exportTimeout`,void 0),i(this,`_maxExportBatchSize`,void 0),i(this,`_ongoingExportPromise`,null),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(o!==void 0&&(!Number.isInteger(o)||o<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);m.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=t,this._maxExportBatchSize=o}async _runOnce(){try{await this._doRun()}catch(e){C(e)}}async _doRun(){if(this._ongoingExportPromise){m.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&m.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){m.debug(`Error while resolving async portion of resource: `,e),C(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?Kn(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await F(Rt._export(this._exporter,e),this._exportTimeout);t.code!==j.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof Vt){m.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else m.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){m.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};A(),r();var Jn=class e{constructor(e){i(this,`_shutdown`,!1),i(this,`_temporalitySelector`,void 0),this._temporalitySelector=e?.temporalitySelector??In}export(t,n){if(this._shutdown){n({code:j.FAILED});return}return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:j.SUCCESS})}};r();var Yn=class{constructor(){i(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};p();function V(e,t,n){return $n(e)||m.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??h.DOUBLE,advice:n?.advice??{}}}function Xn(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Zn(e,t){return Wt(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Qn=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function $n(e){return Qn.test(e)}p(),r();var H=class{constructor(e,t){i(this,`_writableMetricStorage`,void 0),i(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){m.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===h.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},er=class extends H{add(e,t,n){this._record(e,t,n)}},tr=class extends H{add(e,t,n){if(e<0){m.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},nr=class extends H{record(e,t,n){this._record(e,t,n)}},rr=class extends H{record(e,t,n){if(e<0){m.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},U=class{constructor(e,t,n){i(this,`_metricStorages`,void 0),i(this,`_descriptor`,void 0),i(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},ir=class extends U{},ar=class extends U{},or=class extends U{};function sr(e){return e instanceof U}r();var cr=class{constructor(e){i(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=V(e,N.GAUGE,t);return new nr(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=V(e,N.HISTOGRAM,t);return new rr(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=V(e,N.COUNTER,t);return new tr(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=V(e,N.UP_DOWN_COUNTER,t);return new er(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=V(e,N.OBSERVABLE_GAUGE,t);return new ar(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=V(e,N.OBSERVABLE_COUNTER,t);return new ir(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=V(e,N.OBSERVABLE_UP_DOWN_COUNTER,t);return new or(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};r();var lr=class{constructor(e){i(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=V(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};r();var ur=class{constructor(e){i(this,`_valueMap`,new Map),i(this,`_keyMap`,new Map),i(this,`_hash`,void 0),this._hash=e}get(e,t){return t??(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},W=class extends ur{constructor(){super(zt)}};A(),r();var dr=class{constructor(e,t){i(this,`_activeCollectionStorage`,new W),i(this,`_cumulativeMemoStorage`,new W),i(this,`_cardinalityLimit`,void 0),i(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),i(this,`_overflowHashCode`,void 0),i(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=zt(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=E(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new W,e}};r();var fr=class e{constructor(e,t){i(this,`_aggregator`,void 0),i(this,`_unreportedAccumulations`,new Map),i(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===M.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=pr(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new W,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function pr(e){return Array.from(e.entries())}r();var mr=class extends lr{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new dr(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new fr(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new W;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function hr(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function gr(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function _r(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function vr(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function yr(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{E as a,M as o,S as s,b as c,d as l,h as u,i as d,l as f,n as p,p as ee,s as m,v as te,w as h,y as ne}from"./esm-lWlUmoUA.js";import{C as g,S as re,T as ie,b as _,j as ae,w as oe,x as se,y as ce}from"./esm-Cb-L4oAk.js";import{n as v,t as le}from"./esm-Bx6rTxIs.js";import{n as ue,t as de}from"./axios-DaWTGg7G.js";import{Cn as fe,Kn as pe,Lt as y,Q as me,Vn as he,Y as ge,en as _e,mr as ve,z as ye}from"./state-ix0xIunV.js";import{F as be,S as xe,W as Se,a as b,i as Ce,l as x,nt as we,rt as Te,w as Ee,z as De}from"./debug-BrXObCdR.js";import{f as Oe,g as ke}from"./settings-DfWP5y6X.js";import{b as Ae,c as je,g as Me,n as Ne}from"./config-DiT2Z8dY.js";import{d as Pe,f as Fe,o as Ie,s as S}from"./log-BMCygSzM.js";import{r as Le,t as Re}from"./memoize-B0zhbT8Z.js";import{a as ze,i as Be,o as Ve}from"./platform-BrYefG_2.js";import{i as He,n as Ue}from"./startupProfiler-xa3NmN7Z.js";import{Bt as We,Ht as Ge,It as Ke,Kt as qe,Nt as Je,Vt as Ye,ar as Xe,er as Ze,ir as Qe,lr as $e,ur as et}from"./model-fi472PRc.js";import{_ as tt,b as nt,h as rt,l as it,o as at,p as ot,u as st,v as ct,y as lt}from"./proxy-CRN7jYIi.js";import{A as ut,B as C,C as dt,D as ft,E as pt,I as w,K as mt,L as T,M as ht,N as gt,O as _t,P as E,R as vt,U as yt,W as D,_ as O,b as bt,c as xt,d as St,h as Ct,i as wt,k,n as Tt,o as Et,p as Dt,q as Ot,t as kt,u as At,v as A,w as j,y as jt}from"./esm-DjGYYlQe.js";import{_ as Mt,b as Nt,c as Pt,l as Ft,r as It,v as Lt,y as Rt}from"./sessionTracing-lArOaj9u.js";var M;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(M||(M={}));var N;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(N||(N={}));var P;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(P||(P={}));function zt(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function Bt(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var Vt=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function F(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Vt(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Ht(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ut(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Wt(e,t){return e.toLowerCase()===t.toLowerCase()}var I;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(I||(I={})),r();var Gt=class{constructor(){i(this,`kind`,I.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};r();function Kt(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var qt=class{constructor(e,t,n=!0,r=Kt(t)){i(this,`startTime`,void 0),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Ut(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Jt=class{constructor(e,t){i(this,`kind`,I.HISTOGRAM),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new qt(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new qt(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new qt(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===N.GAUGE||e.type===N.UP_DOWN_COUNTER||e.type===N.OBSERVABLE_GAUGE||e.type===N.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};r();var Yt=class e{constructor(e=new Xt,t=0,n=0,r=0){i(this,`backing`,void 0),i(this,`indexBase`,void 0),i(this,`indexStart`,void 0),i(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},Xt=class e{constructor(e=[0]){i(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},Zt=2146435072,Qt=1048575,$t=1023,en=-1022,tn=$t,nn=2**-1022;function rn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&Zt)>>20)-$t}function an(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&Qt)*2**32+r}function on(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function sn(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var L=class extends Error{};r();var cn=class{constructor(e){i(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<nn?this._minNormalLowerBoundaryIndex():rn(e)+this._rightShift(an(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new L(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new L(`overflow: ${e} is > maximum lower boundary: ${n}`);return on(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=en>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return tn>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}};r();var ln=class{constructor(e){i(this,`_scale`,void 0),i(this,`_scaleFactor`,void 0),i(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=on(Math.LOG2E,e),this._inverseFactor=on(Math.LN2,-e)}mapToIndex(e){if(e<=nn)return this._minNormalLowerBoundaryIndex()-1;if(an(e)===0)return(rn(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new L(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return nn;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new L(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return en<<this._scale}_maxNormalLowerBoundaryIndex(){return(tn+1<<this._scale)-1}},un=-10,dn=20,fn=Array.from({length:31},(e,t)=>t>10?new ln(t-10):new cn(t-10));function pn(e){if(e>dn||e<un)throw new L(`expected scale >= ${un} && <= ${dn}, got: ${e}`);return fn[e+10]}p(),r();var R=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){i(this,`low`,void 0),i(this,`high`,void 0),this.low=e,this.high=t}},mn=20,hn=160,gn=2,_n=class e{constructor(e,t=hn,n=!0,r=0,a=0,o=0,s=1/0,c=-1/0,l=new Yt,u=new Yt,d=pn(mn)){i(this,`startTime`,void 0),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_sum`,void 0),i(this,`_count`,void 0),i(this,`_zeroCount`,void 0),i(this,`_min`,void 0),i(this,`_max`,void 0),i(this,`_positive`,void 0),i(this,`_negative`,void 0),i(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=a,this._zeroCount=o,this._min=s,this._max=c,this._positive=l,this._negative=u,this._mapping=d,this._maxSize<gn&&(m.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
2
|
+
changing to the minimum size of: ${gn}`),this._maxSize=gn)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=sn(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=pn(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=R.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=R.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new R(0,-1);let r=t-n;return new R(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},vn=class{constructor(e,t){i(this,`kind`,I.EXPONENTIAL_HISTOGRAM),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new _n(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===N.GAUGE||e.type===N.UP_DOWN_COUNTER||e.type===N.OBSERVABLE_GAUGE||e.type===N.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};A(),r();var yn=class{constructor(e,t=0,n=[0,0]){i(this,`startTime`,void 0),i(this,`_current`,void 0),i(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=E(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},bn=class{constructor(){i(this,`kind`,I.LAST_VALUE)}createAccumulation(e){return new yn(e)}merge(e,t){let n=k(t.sampleTime)>=k(e.sampleTime)?t:e;return new yn(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=k(t.sampleTime)>=k(e.sampleTime)?t:e;return new yn(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};r();var z=class{constructor(e,t,n=0,r=!1){i(this,`startTime`,void 0),i(this,`monotonic`,void 0),i(this,`_current`,void 0),i(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},xn=class{constructor(e){i(this,`kind`,I.SUM),i(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new z(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new z(t.startTime,this.monotonic,r,t.reset):new z(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new z(t.startTime,this.monotonic,r,!0):new z(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:P.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};p(),r();var Sn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Sn,`DEFAULT_INSTANCE`,new Gt);var Cn=class e{createAggregator(t){switch(t.type){case N.COUNTER:case N.OBSERVABLE_COUNTER:case N.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};i(Cn,`MONOTONIC_INSTANCE`,new xn(!0)),i(Cn,`NON_MONOTONIC_INSTANCE`,new xn(!1));var wn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(wn,`DEFAULT_INSTANCE`,new bn);var Tn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Tn,`DEFAULT_INSTANCE`,new Jt([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var En=class{constructor(e,t=!0){if(i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new Jt(this._boundaries,this._recordMinMax)}},Dn=class{constructor(e=160,t=!0){i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new vn(this._maxSize,this._recordMinMax)}},On=class{_resolve(e){switch(e.type){case N.COUNTER:case N.UP_DOWN_COUNTER:case N.OBSERVABLE_COUNTER:case N.OBSERVABLE_UP_DOWN_COUNTER:return An;case N.GAUGE:case N.OBSERVABLE_GAUGE:return jn;case N.HISTOGRAM:return e.advice.explicitBucketBoundaries?new En(e.advice.explicitBucketBoundaries):Mn}return m.warn(`Unable to recognize instrument type: ${e.type}`),kn}createAggregator(e){return this._resolve(e).createAggregator(e)}},kn=new Sn,An=new Cn,jn=new wn,Mn=new Tn;new Dn;var Nn=new On,B;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(B||(B={}));function Pn(e){switch(e.type){case B.DEFAULT:return Nn;case B.DROP:return kn;case B.SUM:return An;case B.LAST_VALUE:return jn;case B.EXPONENTIAL_HISTOGRAM:{let t=e;return new Dn(t.options?.maxSize,t.options?.recordMinMax)}case B.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?Mn:new En(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Fn=e=>({type:B.DEFAULT}),In=e=>M.CUMULATIVE,Ln=`otel.component.name`,Rn=`otel.component.type`,zn=`periodic_metric_reader`,Bn=`otel.sdk.metric_reader.collection.duration`,Vn=`error.type`;r();var Hn=new Map,Un=class{constructor(e,t){i(this,`collectionDuration`,void 0),i(this,`standardAttrs`,void 0);let n=Hn.get(e)??0;Hn.set(e,n+1),this.standardAttrs={[Rn]:e,[Ln]:`${e}/${n}`},this.collectionDuration=t.createHistogram(Bn,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[Vn]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}},Wn=`2.9.0`;p(),A(),r();var Gn=class{constructor(e){i(this,`_shutdown`,!1),i(this,`_metricProducers`,void 0),i(this,`_sdkMetricProducer`,void 0),i(this,`_selfObsMetrics`,void 0),i(this,`_aggregationTemporalitySelector`,void 0),i(this,`_aggregationSelector`,void 0),i(this,`_cardinalitySelector`,void 0),i(this,`_otelComponentType`,void 0),this._aggregationSelector=e?.aggregationSelector??Fn,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??In,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Un(this._otelComponentType,a())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,Wn);this._selfObsMetrics=new Un(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=ft(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=ft(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=ut(_t(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){m.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await F(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){m.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await F(this.onForceFlush(),e.timeoutMillis)}};function Kn(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}p(),A(),r();var qn=class extends Gn{constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:a,maxExportBatchSize:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:zn,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...a};switch(e){case N.COUNTER:return t.counter??t.default;case N.GAUGE:return t.gauge??t.default;case N.HISTOGRAM:return t.histogram??t.default;case N.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case N.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case N.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case N.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),i(this,`_interval`,void 0),i(this,`_exporter`,void 0),i(this,`_exportInterval`,void 0),i(this,`_exportTimeout`,void 0),i(this,`_maxExportBatchSize`,void 0),i(this,`_ongoingExportPromise`,null),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(o!==void 0&&(!Number.isInteger(o)||o<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);m.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=t,this._maxExportBatchSize=o}async _runOnce(){try{await this._doRun()}catch(e){C(e)}}async _doRun(){if(this._ongoingExportPromise){m.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&m.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){m.debug(`Error while resolving async portion of resource: `,e),C(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?Kn(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await F(jt._export(this._exporter,e),this._exportTimeout);t.code!==j.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof Vt){m.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else m.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){m.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};A(),r();var Jn=class e{constructor(e){i(this,`_shutdown`,!1),i(this,`_temporalitySelector`,void 0),this._temporalitySelector=e?.temporalitySelector??In}export(t,n){if(this._shutdown){n({code:j.FAILED});return}return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:j.SUCCESS})}};r();var Yn=class{constructor(){i(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};p();function V(e,t,n){return $n(e)||m.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??h.DOUBLE,advice:n?.advice??{}}}function Xn(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Zn(e,t){return Wt(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Qn=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function $n(e){return Qn.test(e)}p(),r();var H=class{constructor(e,t){i(this,`_writableMetricStorage`,void 0),i(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){m.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===h.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},er=class extends H{add(e,t,n){this._record(e,t,n)}},tr=class extends H{add(e,t,n){if(e<0){m.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},nr=class extends H{record(e,t,n){this._record(e,t,n)}},rr=class extends H{record(e,t,n){if(e<0){m.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},U=class{constructor(e,t,n){i(this,`_metricStorages`,void 0),i(this,`_descriptor`,void 0),i(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},ir=class extends U{},ar=class extends U{},or=class extends U{};function sr(e){return e instanceof U}r();var cr=class{constructor(e){i(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=V(e,N.GAUGE,t);return new nr(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=V(e,N.HISTOGRAM,t);return new rr(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=V(e,N.COUNTER,t);return new tr(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=V(e,N.UP_DOWN_COUNTER,t);return new er(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=V(e,N.OBSERVABLE_GAUGE,t);return new ar(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=V(e,N.OBSERVABLE_COUNTER,t);return new ir(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=V(e,N.OBSERVABLE_UP_DOWN_COUNTER,t);return new or(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};r();var lr=class{constructor(e){i(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=V(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};r();var ur=class{constructor(e){i(this,`_valueMap`,new Map),i(this,`_keyMap`,new Map),i(this,`_hash`,void 0),this._hash=e}get(e,t){return t??(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},W=class extends ur{constructor(){super(zt)}};A(),r();var dr=class{constructor(e,t){i(this,`_activeCollectionStorage`,new W),i(this,`_cumulativeMemoStorage`,new W),i(this,`_cardinalityLimit`,void 0),i(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),i(this,`_overflowHashCode`,void 0),i(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=zt(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=E(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new W,e}};r();var fr=class e{constructor(e,t){i(this,`_aggregator`,void 0),i(this,`_unreportedAccumulations`,new Map),i(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===M.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=pr(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new W,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function pr(e){return Array.from(e.entries())}r();var mr=class extends lr{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new dr(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new fr(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new W;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function hr(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function gr(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function _r(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function vr(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function yr(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
|
|
3
3
|
\t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
|
|
4
4
|
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function br(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:yr(e,t):vr(e,t):_r(e,t):gr(e,t)}p(),r();var xr=class e{constructor(){i(this,`_sharedRegistry`,new Map),i(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();Zn(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),m.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
5
5
|
`,`Details:
|
|
@@ -7,9 +7,9 @@ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./e
|
|
|
7
7
|
To resolve the conflict:`,br(t,e))),n=r):m.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
|
|
8
8
|
`,`Details:
|
|
9
9
|
`,hr(t,e),`To resolve the conflict:
|
|
10
|
-
`,br(t,e))}return n}};p(),r();var Sr=class{constructor(e){i(this,`_backingStorages`,void 0),i(this,`hasAttributeProcessor`,void 0),this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,n,r){this.hasAttributeProcessor&&n===void 0&&(n=f.active());let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};p(),r();var Cr=class{constructor(e,t){i(this,`_buffer`,new W),i(this,`_instrumentName`,void 0),i(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){m.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===h.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},wr=class{constructor(){i(this,`_buffer`,new Map)}observe(e,t,n={}){if(!sr(e))return;let r=this._buffer.get(e);if(r??(r=new W,this._buffer.set(e,r)),typeof t!=`number`){m.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===h.INT&&!Number.isInteger(t)&&(m.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};p(),r();var Tr=class{constructor(){i(this,`_callbacks`,[]),i(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(sr));if(n.size===0){m.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(sr)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...n,...r])).filter(e=>e.status===`rejected`).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:r})=>{let i=new Cr(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=F(a,t)),await a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:r})=>{let i=new wr,a=Promise.resolve(n(i));t!=null&&(a=F(a,t)),await a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Ht(n.instruments,t))}};p(),r();var Er=class extends lr{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),i(this,`hasAttributeProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new dr(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new fr(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}record(e,t,n,r){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,n??f.active())),this._deltaMetricStorage.record(e,t,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};r();var Dr=class{constructor(e,t){i(this,`metricStorageRegistry`,new xr),i(this,`observableRegistry`,new Tr),i(this,`meter`,void 0),i(this,`_meterProviderSharedState`,void 0),i(this,`_instrumentationScope`,void 0),this.meter=new cr(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Er);return t.length===1?t[0]:new Sr(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,mr)}async collect(e,t,n){let r=await this.observableRegistry.observe(t,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(e);if(i.length===0)return null;let a=[];return i.forEach(n=>{let r=n.collect(e,t);r!=null&&a.push(r)}),a.length===0?{errors:r}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:r}}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=Xn(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,void 0,[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};r();var Or=class{constructor(e){i(this,`viewRegistry`,new Yn),i(this,`metricCollectors`,[]),i(this,`meterSharedStates`,new Map),i(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=Bt(e),n=this.meterSharedStates.get(t);return n??(n=new Dr(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Pn(n.selectAggregation(e))]);return t}};A(),r();var kr=class{constructor(e,t){i(this,`_sharedState`,void 0),i(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}async collect(e){let t=E(Date.now()),n=[],r=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&r.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:r}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};r();var Ar=/[\^$\\.+?()[\]{}|]/g,jr=class e{constructor(t){i(this,`_matchAll`,void 0),i(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(Ar,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},G=class{constructor(e){i(this,`_matchAll`,void 0),i(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};r();var Mr=class{process(e,t){return e}},Nr=class{constructor(e){i(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Pr(){return Ir}function Fr(e){return new Nr(e)}var Ir=new Mr;r();var Lr=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_type`,void 0),i(this,`_unitFilter`,void 0),this._nameFilter=new jr(e?.name??`*`),this._type=e?.type,this._unitFilter=new G(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};r();var Rr=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_versionFilter`,void 0),i(this,`_schemaUrlFilter`,void 0),this._nameFilter=new G(e?.name),this._versionFilter=new G(e?.version),this._schemaUrlFilter=new G(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};r();function zr(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function Br(e){if(zr(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||jr.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var Vr=class{constructor(e){i(this,`name`,void 0),i(this,`description`,void 0),i(this,`aggregation`,void 0),i(this,`attributesProcessor`,void 0),i(this,`instrumentSelector`,void 0),i(this,`meterSelector`,void 0),i(this,`aggregationCardinalityLimit`,void 0),Br(e),e.attributesProcessors==null?this.attributesProcessor=Pr():this.attributesProcessor=Fr(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Pn(e.aggregation??{type:B.DEFAULT}),this.instrumentSelector=new Lr({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new Rr({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};p(),Ot(),r();var Hr=class{constructor(e){if(i(this,`_sharedState`,void 0),i(this,`_shutdown`,!1),this._sharedState=new Or(e?.resource??At()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new Vr(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new kr(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof Gn&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,n={}){return this._shutdown?(m.warn(`A shutdown MeterProvider cannot provide a Meter`),a()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){m.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){m.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}},Ur=`exception`,Wr=Symbol.for(`nodejs.util.inspect.custom`);function Gr(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??(t[n]=r));return t}function Kr(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}p(),A(),ce(),r();var qr=class{constructor(e){i(this,`_spanContext`,void 0),i(this,`kind`,void 0),i(this,`parentSpanContext`,void 0),i(this,`attributes`,{}),i(this,`links`,[]),i(this,`events`,[]),i(this,`startTime`,void 0),i(this,`resource`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_droppedAttributesCount`,0),i(this,`_droppedEventsCount`,0),i(this,`_droppedLinksCount`,0),i(this,`_attributesCount`,0),i(this,`name`,void 0),i(this,`status`,{code:l.UNSET}),i(this,`endTime`,[0,0]),i(this,`_ended`,!1),i(this,`_duration`,[-1,-1]),i(this,`_spanProcessor`,void 0),i(this,`_spanLimits`,void 0),i(this,`_attributeValueLengthLimit`,void 0),i(this,`_recordEndMetrics`,void 0),i(this,`_performanceStartTime`,void 0),i(this,`_performanceOffset`,void 0),i(this,`_startTimeProvided`,void 0);let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=w.now(),this._performanceOffset=t-(this._performanceStartTime+w.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return m.warn(`Invalid attribute key: ${e}`),this;if(!Et(t))return m.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return m.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&m.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),St(t)&&(St(n)||(n=t),t=void 0);let i=D(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&m.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=D(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===l.UNSET||this.status.code===l.OK)return this;let t={code:e.code};return e.code===l.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&m.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){m.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=wt(this.startTime,this.endTime),this._duration[0]<0&&(m.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&m.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&m.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=w.now())return yt(e+this._performanceOffset);if(typeof e==`number`)return E(e);if(e instanceof Date)return E(e.getTime());if(Ct(e))return e;if(this._startTimeProvided)return E(Date.now());let t=w.now()-this._performanceStartTime;return bt(this.startTime,E(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[se]=e:e&&(e.code?n[g]=e.code.toString():e.name&&(n[g]=e.name),e.message&&(n[se]=e.message),e.stack&&(n[re]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Ur,n,t):m.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);m.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(m.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Wr](e,t,n){return Kr(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Gr(this.resource)}},e,t,n)}},K;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(K||(K={}));var Jr=`otel.component.name`,Yr=`otel.component.type`,Xr=`otel.span.parent.origin`,Zr=`otel.span.sampling_result`,Qr=`otel.sdk.processor.span.processed`,$r=`otel.sdk.processor.span.queue.capacity`,ei=`otel.sdk.processor.span.queue.size`,ti=`otel.sdk.span.live`,ni=`otel.sdk.span.started`,ri=`batching_span_processor`;r();var ii=class{constructor(e){i(this,`startedSpans`,void 0),i(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(ni,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ti,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=oi(t);if(this.startedSpans.add(1,{[Xr]:ai(e),[Zr]:n}),t===K.NOT_RECORD)return()=>{};let r={[Zr]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ai(e){return e?e.isRemote?`remote`:`local`:`none`}function oi(e){switch(e){case K.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case K.RECORD:return`RECORD_ONLY`;case K.NOT_RECORD:return`DROP`}}var si=`2.9.0`;p(),A(),r();var ci=class{constructor(e,t){i(this,`_sampler`,void 0),i(this,`_spanLimits`,void 0),i(this,`_idGenerator`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_resource`,void 0),i(this,`_spanProcessor`,void 0),i(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,si);this._tracerMetrics=new ii(n)}startSpan(e,t={},n=f.active()){t.root&&(n=d.deleteSpan(n));let r=d.getSpan(n);if(xt(n))return m.debug(`Instrumentation suppressed, returning Noop Span`),d.wrapSpanContext(c);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,l,p;!i||!d.isSpanContextValid(i)?l=this._idGenerator.generateTraceId():(l=i.traceId,p=i.traceState,o=i);let te=t.kind??ee.INTERNAL,h=(t.links??[]).map(e=>({context:e.context,attributes:D(e.attributes)})),ne=D(t.attributes),g=this._sampler.shouldSample(n,l,e,te,ne,h),re=this._tracerMetrics.startSpan(i,g.decision);p=g.traceState??p;let ie=g.decision===u.RECORD_AND_SAMPLED?s.SAMPLED:s.NONE,_={traceId:l,spanId:a,traceFlags:ie,traceState:p};if(g.decision===u.NOT_RECORD)return m.debug(`Recording is off, propagating context in a non-recording span`),d.wrapSpanContext(_);let ae=D(Object.assign(ne,g.attributes));return new qr({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:_,name:e,kind:te,links:h,parentSpanContext:o,attributes:ae,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:re})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??f.active(),c=this.startSpan(e,i,s),l=d.setSpan(s,c);return f.with(l,o,void 0,c)}[Wr](e,t,n){return Kr(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Gr(this._resource)},spanLimits:this._spanLimits},e,t,n)}};A(),r();var li=class{constructor(e){i(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{C(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},q=class{shouldSample(){return{decision:K.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},J=class{shouldSample(){return{decision:K.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};p(),A(),r();var Y=class{constructor(e){i(this,`_root`,void 0),i(this,`_remoteParentSampled`,void 0),i(this,`_remoteParentNotSampled`,void 0),i(this,`_localParentSampled`,void 0),i(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(C(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new J),this._remoteParentSampled=e.remoteParentSampled??new J,this._remoteParentNotSampled=e.remoteParentNotSampled??new q,this._localParentSampled=e.localParentSampled??new J,this._localParentNotSampled=e.localParentNotSampled??new q}shouldSample(e,t,n,r,i,a){let o=d.getSpanContext(e);return!o||!te(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&s.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&s.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};ce(),r();var ui=new Map,di=class{constructor(e,t,n){i(this,`processedSpans`,void 0),i(this,`queueSize`,void 0),i(this,`queueSizeCallback`,void 0),i(this,`standardAttrs`,void 0),i(this,`droppedAttrs`,void 0);let r=ui.get(e)??0;if(ui.set(e,r+1),this.standardAttrs={[Yr]:e,[Jr]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[_]:`queue_full`},this.processedSpans=t.createCounter(Qr,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter($r,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(ei,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[_]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};p(),A(),r();var fi=class{constructor(e){i(this,`_maxExportBatchSize`,void 0),i(this,`_maxQueueSize`,void 0),i(this,`_scheduledDelayMillis`,void 0),i(this,`_exportTimeoutMillis`,void 0),i(this,`_exporter`,void 0),i(this,`_metrics`,void 0),i(this,`_isExporting`,!1),i(this,`_finishedSpans`,[]),i(this,`_timer`,void 0),i(this,`_shutdownOnce`,void 0),i(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new Dt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(m.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):a();this._metrics=new di(ri,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&s.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&m.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(m.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);f.with(Ft(f.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===j.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{C(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,C(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},pi=class extends fi{onShutdown(){}};r();var mi=8,hi=16,gi=class{constructor(){i(this,`generateTraceId`,_i(hi)),i(this,`generateSpanId`,_i(mi))}},X=Buffer.allocUnsafe(hi);function _i(e){return function(){for(let t=0;t<e/4;t++)X.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(X[t]>0);t++)t===e-1&&(X[e-1]=1);return X.toString(`hex`,0,e)}}p(),Ot(),r();var Z;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Z||(Z={}));var vi=class{constructor(e={}){i(this,`_resource`,void 0),i(this,`_activeSpanProcessor`,void 0),i(this,`_forceFlushTimeoutMillis`,void 0),i(this,`_tracerOptions`,void 0),i(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??At();let t=e.spanProcessors??[];this._activeSpanProcessor=new li(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new Y({root:new J}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new gi,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return a()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new ci({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Z.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Z.timeout&&(r=Z.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Z.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Z.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Wr](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Kr(`TracerProvider`,{resource:{attributes:Gr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};A();var yi=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:k(e.startTime),duration:k(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:j.SUCCESS})}};p(),r();var bi=class{constructor(e=0){i(this,`_ratio`,void 0),i(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:ne(t)&&this._accumulate(t)<this._upperBound?K.RECORD_AND_SAMPLED:K.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};p(),A();var Q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Q||(Q={}));var $=1;function xi(){return{sampler:Si(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:T(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:T(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Si(){let e=Tt(`OTEL_TRACES_SAMPLER`)??Q.ParentBasedAlwaysOn;switch(e){case Q.AlwaysOn:return new J;case Q.AlwaysOff:return new q;case Q.ParentBasedAlwaysOn:return new Y({root:new J});case Q.ParentBasedAlwaysOff:return new Y({root:new q});case Q.TraceIdRatio:return new bi(Ci());case Q.ParentBasedTraceIdRatio:return new Y({root:new bi(Ci())});default:return m.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Q.ParentBasedAlwaysOn}".`),new Y({root:new J})}}function Ci(){let e=T(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(m.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$}.`),$):e<0||e>1?(m.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${$}.`),$):e}A();function wi(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}A();var Ti=class extends vi{constructor(e={}){let t=vt({},xi(),wi(e));delete t.generalLimits,super(t)}};A();var Ei=class extends pi{constructor(e,t){t||(t={});for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=T(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};n(),le(),_e(),we(),be(),Ve(),Ue(),ke(),nt(),ct(),rt(),it(),It(),ut(),de(),Ye(),Me(),b(),Ce(),Qe(),Ie(),Re(),Pe(),et();var Di=3600*1e3,Oi=1440*60*1e3;async function ki(){let e=Ze();if(e.error)throw Error(`Auth error: ${e.error}`);let t={"Content-Type":`application/json`,"User-Agent":$e(),...e.headers};return(await ue.get(`https://api.anthropic.com/api/claude_code/organizations/metrics_enabled`,{headers:t,timeout:5e3})).data}async function Ai(){if(Fe())return{enabled:!1,hasError:!1};try{let e=await Xe(ki,{also403Revoked:!0});return x(`Metrics opt-out API response: enabled=${e.metrics_logging_enabled}`),{enabled:e.metrics_logging_enabled,hasError:!1}}catch(e){return x(`Failed to check metrics opt-out status: ${De(e)}`),S(e),{enabled:!1,hasError:!0}}}var ji=Le(Ai,Di);async function Mi(){let e=await ji();if(e.hasError)return e;let t=je().metricsStatusCache;return t!==void 0&&t.enabled===e.enabled&&Date.now()-t.timestamp<Oi||Ae(t=>({...t,metricsStatusCache:{enabled:e.enabled,timestamp:Date.now()}})),e}async function Ni(){if(qe()&&!We())return{enabled:!1,hasError:!1};let e=je().metricsStatusCache;return e?(Date.now()-e.timestamp>Oi&&Mi().catch(S),{enabled:e.enabled,hasError:!1}):Mi()}A(),de(),Ye(),Me(),b(),Ce(),Qe(),Ie(),et(),r();var Pi=class{constructor(e={}){i(this,`endpoint`,void 0),i(this,`timeout`,void 0),i(this,`pendingExports`,[]),i(this,`isShutdown`,!1),process.env.USER_TYPE===`ant`&&process.env.ANT_CLAUDE_CODE_METRICS_ENDPOINT?this.endpoint=process.env.ANT_CLAUDE_CODE_METRICS_ENDPOINT+`/api/claude_code/metrics`:this.endpoint=`https://api.anthropic.com/api/claude_code/metrics`,this.timeout=e.timeout||5e3}async export(e,t){if(this.isShutdown){t({code:j.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{if(!(Ne()||ye())){x(`BigQuery metrics export: trust not established, skipping`),t({code:j.SUCCESS});return}if(!(await Ni()).enabled){x(`Metrics export disabled by organization setting`),t({code:j.SUCCESS});return}let n=this.transformMetricsForInternal(e),r=Ze();if(r.error){x(`Metrics export failed: ${r.error}`),t({code:j.FAILED,error:Error(r.error)});return}let i={"Content-Type":`application/json`,"User-Agent":$e(),...r.headers},a=await ue.post(this.endpoint,n,{timeout:this.timeout,headers:i});x(`BigQuery metrics exported successfully`),x(`BigQuery API Response: ${Se(a.data,null,2)}`),t({code:j.SUCCESS})}catch(e){x(`BigQuery metrics export failed: ${De(e)}`),S(e),t({code:j.FAILED,error:xe(e)})}}transformMetricsForInternal(e){let t=e.resource.attributes,n={"service.name":t[`service.name`]||`claude-code`,"service.version":t[`service.version`]||`unknown`,"os.type":t[`os.type`]||`unknown`,"os.version":t[`os.version`]||`unknown`,"host.arch":t[`host.arch`]||`unknown`,"aggregation.temporality":this.selectAggregationTemporality()===M.DELTA?`delta`:`cumulative`};if(t[`wsl.version`]&&(n[`wsl.version`]=t[`wsl.version`]),qe()){n[`user.customer_type`]=`claude_ai`;let e=Ke();e&&(n[`user.subscription_type`]=e)}else n[`user.customer_type`]=`api`;return{resource_attributes:n,metrics:e.scopeMetrics.flatMap(e=>e.metrics.map(e=>({name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit,data_points:this.extractDataPoints(e)})))}}extractDataPoints(e){return(e.dataPoints||[]).filter(e=>typeof e.value==`number`).map(e=>({attributes:this.convertAttributes(e.attributes),value:e.value,timestamp:this.hrTimeToISOString(e.endTime||e.startTime||[Date.now()/1e3,0])}))}async shutdown(){this.isShutdown=!0,await this.forceFlush(),x(`BigQuery metrics exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),x(`BigQuery metrics exporter flush complete`)}convertAttributes(e){let t={};if(e)for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return t}hrTimeToISOString(e){let[t,n]=e;return new Date(t*1e3+n/1e6).toISOString()}selectAggregationTemporality(){return M.DELTA}};b(),Ie();var Fi=class{error(e,...t){S(Error(e)),x(`[3P telemetry] OTEL diag error: ${e}`,{level:`error`})}warn(e,...t){S(Error(e)),x(`[3P telemetry] OTEL diag warn: ${e}`,{level:`warn`})}info(e,...t){}debug(e,...t){}verbose(e,...t){}};p(),Ot(),ce(),_e(),Ye(),b(),Ce(),be(),gt(),ft();var Ii=6e4,Li=5e3,Ri=5e3,zi=class extends Error{};function Bi(e,t){return new Promise((n,r)=>{setTimeout((e,t)=>e(new zi(t)),e,r,t).unref()})}function Vi(){process.env.USER_TYPE===`ant`&&(process.env.ANT_OTEL_METRICS_EXPORTER&&(process.env.OTEL_METRICS_EXPORTER=process.env.ANT_OTEL_METRICS_EXPORTER),process.env.ANT_OTEL_LOGS_EXPORTER&&(process.env.OTEL_LOGS_EXPORTER=process.env.ANT_OTEL_LOGS_EXPORTER),process.env.ANT_OTEL_TRACES_EXPORTER&&(process.env.OTEL_TRACES_EXPORTER=process.env.ANT_OTEL_TRACES_EXPORTER),process.env.ANT_OTEL_EXPORTER_OTLP_PROTOCOL&&(process.env.OTEL_EXPORTER_OTLP_PROTOCOL=process.env.ANT_OTEL_EXPORTER_OTLP_PROTOCOL),process.env.ANT_OTEL_EXPORTER_OTLP_ENDPOINT&&(process.env.OTEL_EXPORTER_OTLP_ENDPOINT=process.env.ANT_OTEL_EXPORTER_OTLP_ENDPOINT),process.env.ANT_OTEL_EXPORTER_OTLP_HEADERS&&(process.env.OTEL_EXPORTER_OTLP_HEADERS=process.env.ANT_OTEL_EXPORTER_OTLP_HEADERS)),process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE||(process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=`delta`)}function Hi(e){return(e||``).trim().split(`,`).filter(Boolean).map(e=>e.trim()).filter(e=>e!==`none`)}async function Ui(){let t=Hi(process.env.OTEL_METRICS_EXPORTER),n=parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL||Ii.toString(),10),r=[];for(let n of t)if(n===`console`){let e=new Jn,t=e.export.bind(e);e.export=(e,n)=>(e.resource&&e.resource.attributes&&(x(`
|
|
11
|
-
=== Resource Attributes ===`),x(
|
|
12
|
-
`)),t(e,n)),r.push(e)}else if(n===`otlp`){let t=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=$i();switch(t){case`grpc`:{let{OTLPMetricExporter:t}=await import(`./src-PM8NIIu_.js`).then(t=>e(t.default,1));r.push(new t);break}case`http/json`:{let{OTLPMetricExporter:e}=await import(`./esm-IYgGg4wR.js`);r.push(new e(n));break}case`http/protobuf`:{let{OTLPMetricExporter:e}=await import(`./esm-BYnFh4pG.js`);r.push(new e(n));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else if(n===`prometheus`){let{PrometheusExporter:t}=await import(`./src-CgZmCiiH.js`).then(t=>e(t.default,1));r.push(new t)}else throw Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${n}`);return r.map(e=>`export`in e?new qn({exporter:e,exportIntervalMillis:n}):e)}async function Wi(){let t=Hi(process.env.OTEL_LOGS_EXPORTER),n=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),r=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;x(`[3P telemetry] getOtlpLogExporters: types=${
|
|
10
|
+
`,br(t,e))}return n}};p(),r();var Sr=class{constructor(e){i(this,`_backingStorages`,void 0),i(this,`hasAttributeProcessor`,void 0),this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,n,r){this.hasAttributeProcessor&&n===void 0&&(n=f.active());let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};p(),r();var Cr=class{constructor(e,t){i(this,`_buffer`,new W),i(this,`_instrumentName`,void 0),i(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){m.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===h.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},wr=class{constructor(){i(this,`_buffer`,new Map)}observe(e,t,n={}){if(!sr(e))return;let r=this._buffer.get(e);if(r??(r=new W,this._buffer.set(e,r)),typeof t!=`number`){m.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===h.INT&&!Number.isInteger(t)&&(m.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};p(),r();var Tr=class{constructor(){i(this,`_callbacks`,[]),i(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(sr));if(n.size===0){m.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(sr)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...n,...r])).filter(e=>e.status===`rejected`).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:r})=>{let i=new Cr(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=F(a,t)),await a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:r})=>{let i=new wr,a=Promise.resolve(n(i));t!=null&&(a=F(a,t)),await a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Ht(n.instruments,t))}};p(),r();var Er=class extends lr{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),i(this,`hasAttributeProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new dr(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new fr(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}record(e,t,n,r){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,n??f.active())),this._deltaMetricStorage.record(e,t,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};r();var Dr=class{constructor(e,t){i(this,`metricStorageRegistry`,new xr),i(this,`observableRegistry`,new Tr),i(this,`meter`,void 0),i(this,`_meterProviderSharedState`,void 0),i(this,`_instrumentationScope`,void 0),this.meter=new cr(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Er);return t.length===1?t[0]:new Sr(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,mr)}async collect(e,t,n){let r=await this.observableRegistry.observe(t,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(e);if(i.length===0)return null;let a=[];return i.forEach(n=>{let r=n.collect(e,t);r!=null&&a.push(r)}),a.length===0?{errors:r}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:r}}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=Xn(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,void 0,[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};r();var Or=class{constructor(e){i(this,`viewRegistry`,new Yn),i(this,`metricCollectors`,[]),i(this,`meterSharedStates`,new Map),i(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=Bt(e),n=this.meterSharedStates.get(t);return n??(n=new Dr(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Pn(n.selectAggregation(e))]);return t}};A(),r();var kr=class{constructor(e,t){i(this,`_sharedState`,void 0),i(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}async collect(e){let t=E(Date.now()),n=[],r=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&r.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:r}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};r();var Ar=/[\^$\\.+?()[\]{}|]/g,jr=class e{constructor(t){i(this,`_matchAll`,void 0),i(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(Ar,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},G=class{constructor(e){i(this,`_matchAll`,void 0),i(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};r();var Mr=class{process(e,t){return e}},Nr=class{constructor(e){i(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Pr(){return Ir}function Fr(e){return new Nr(e)}var Ir=new Mr;r();var Lr=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_type`,void 0),i(this,`_unitFilter`,void 0),this._nameFilter=new jr(e?.name??`*`),this._type=e?.type,this._unitFilter=new G(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};r();var Rr=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_versionFilter`,void 0),i(this,`_schemaUrlFilter`,void 0),this._nameFilter=new G(e?.name),this._versionFilter=new G(e?.version),this._schemaUrlFilter=new G(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};r();function zr(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function Br(e){if(zr(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||jr.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var Vr=class{constructor(e){i(this,`name`,void 0),i(this,`description`,void 0),i(this,`aggregation`,void 0),i(this,`attributesProcessor`,void 0),i(this,`instrumentSelector`,void 0),i(this,`meterSelector`,void 0),i(this,`aggregationCardinalityLimit`,void 0),Br(e),e.attributesProcessors==null?this.attributesProcessor=Pr():this.attributesProcessor=Fr(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Pn(e.aggregation??{type:B.DEFAULT}),this.instrumentSelector=new Lr({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new Rr({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};p(),xt(),r();var Hr=class{constructor(e){if(i(this,`_sharedState`,void 0),i(this,`_shutdown`,!1),this._sharedState=new Or(e?.resource??Ct()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new Vr(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new kr(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof Gn&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,n={}){return this._shutdown?(m.warn(`A shutdown MeterProvider cannot provide a Meter`),a()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){m.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){m.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}},Ur=`exception`,Wr=Symbol.for(`nodejs.util.inspect.custom`);function Gr(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??(t[n]=r));return t}function Kr(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}p(),A(),ce(),r();var qr=class{constructor(e){i(this,`_spanContext`,void 0),i(this,`kind`,void 0),i(this,`parentSpanContext`,void 0),i(this,`attributes`,{}),i(this,`links`,[]),i(this,`events`,[]),i(this,`startTime`,void 0),i(this,`resource`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_droppedAttributesCount`,0),i(this,`_droppedEventsCount`,0),i(this,`_droppedLinksCount`,0),i(this,`_attributesCount`,0),i(this,`name`,void 0),i(this,`status`,{code:l.UNSET}),i(this,`endTime`,[0,0]),i(this,`_ended`,!1),i(this,`_duration`,[-1,-1]),i(this,`_spanProcessor`,void 0),i(this,`_spanLimits`,void 0),i(this,`_attributeValueLengthLimit`,void 0),i(this,`_recordEndMetrics`,void 0),i(this,`_performanceStartTime`,void 0),i(this,`_performanceOffset`,void 0),i(this,`_startTimeProvided`,void 0);let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=w.now(),this._performanceOffset=t-(this._performanceStartTime+w.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return m.warn(`Invalid attribute key: ${e}`),this;if(!yt(t))return m.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return m.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&m.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),ht(t)&&(ht(n)||(n=t),t=void 0);let i=D(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&m.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=D(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===l.UNSET||this.status.code===l.OK)return this;let t={code:e.code};return e.code===l.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&m.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){m.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=_t(this.startTime,this.endTime),this._duration[0]<0&&(m.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&m.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&m.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=w.now())return ft(e+this._performanceOffset);if(typeof e==`number`)return E(e);if(e instanceof Date)return E(e.getTime());if(gt(e))return e;if(this._startTimeProvided)return E(Date.now());let t=w.now()-this._performanceStartTime;return pt(this.startTime,E(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[se]=e:e&&(e.code?n[g]=e.code.toString():e.name&&(n[g]=e.name),e.message&&(n[se]=e.message),e.stack&&(n[re]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Ur,n,t):m.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);m.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(m.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Wr](e,t,n){return Kr(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Gr(this.resource)}},e,t,n)}},K;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(K||(K={}));var Jr=`otel.component.name`,Yr=`otel.component.type`,Xr=`otel.span.parent.origin`,Zr=`otel.span.sampling_result`,Qr=`otel.sdk.processor.span.processed`,$r=`otel.sdk.processor.span.queue.capacity`,ei=`otel.sdk.processor.span.queue.size`,ti=`otel.sdk.span.live`,ni=`otel.sdk.span.started`,ri=`batching_span_processor`;r();var ii=class{constructor(e){i(this,`startedSpans`,void 0),i(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(ni,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ti,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=oi(t);if(this.startedSpans.add(1,{[Xr]:ai(e),[Zr]:n}),t===K.NOT_RECORD)return()=>{};let r={[Zr]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ai(e){return e?e.isRemote?`remote`:`local`:`none`}function oi(e){switch(e){case K.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case K.RECORD:return`RECORD_ONLY`;case K.NOT_RECORD:return`DROP`}}var si=`2.9.0`;p(),A(),r();var ci=class{constructor(e,t){i(this,`_sampler`,void 0),i(this,`_spanLimits`,void 0),i(this,`_idGenerator`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_resource`,void 0),i(this,`_spanProcessor`,void 0),i(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,si);this._tracerMetrics=new ii(n)}startSpan(e,t={},n=f.active()){t.root&&(n=d.deleteSpan(n));let r=d.getSpan(n);if(mt(n))return m.debug(`Instrumentation suppressed, returning Noop Span`),d.wrapSpanContext(c);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,l,p;!i||!d.isSpanContextValid(i)?l=this._idGenerator.generateTraceId():(l=i.traceId,p=i.traceState,o=i);let te=t.kind??ee.INTERNAL,h=(t.links??[]).map(e=>({context:e.context,attributes:D(e.attributes)})),ne=D(t.attributes),g=this._sampler.shouldSample(n,l,e,te,ne,h),re=this._tracerMetrics.startSpan(i,g.decision);p=g.traceState??p;let ie=g.decision===u.RECORD_AND_SAMPLED?s.SAMPLED:s.NONE,_={traceId:l,spanId:a,traceFlags:ie,traceState:p};if(g.decision===u.NOT_RECORD)return m.debug(`Recording is off, propagating context in a non-recording span`),d.wrapSpanContext(_);let ae=D(Object.assign(ne,g.attributes));return new qr({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:_,name:e,kind:te,links:h,parentSpanContext:o,attributes:ae,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:re})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??f.active(),c=this.startSpan(e,i,s),l=d.setSpan(s,c);return f.with(l,o,void 0,c)}[Wr](e,t,n){return Kr(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Gr(this._resource)},spanLimits:this._spanLimits},e,t,n)}};A(),r();var li=class{constructor(e){i(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{C(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},q=class{shouldSample(){return{decision:K.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},J=class{shouldSample(){return{decision:K.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};p(),A(),r();var Y=class{constructor(e){i(this,`_root`,void 0),i(this,`_remoteParentSampled`,void 0),i(this,`_remoteParentNotSampled`,void 0),i(this,`_localParentSampled`,void 0),i(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(C(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new J),this._remoteParentSampled=e.remoteParentSampled??new J,this._remoteParentNotSampled=e.remoteParentNotSampled??new q,this._localParentSampled=e.localParentSampled??new J,this._localParentNotSampled=e.localParentNotSampled??new q}shouldSample(e,t,n,r,i,a){let o=d.getSpanContext(e);return!o||!te(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&s.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&s.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};ce(),r();var ui=new Map,di=class{constructor(e,t,n){i(this,`processedSpans`,void 0),i(this,`queueSize`,void 0),i(this,`queueSizeCallback`,void 0),i(this,`standardAttrs`,void 0),i(this,`droppedAttrs`,void 0);let r=ui.get(e)??0;if(ui.set(e,r+1),this.standardAttrs={[Yr]:e,[Jr]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[_]:`queue_full`},this.processedSpans=t.createCounter(Qr,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter($r,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter(ei,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[_]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};p(),A(),r();var fi=class{constructor(e){i(this,`_maxExportBatchSize`,void 0),i(this,`_maxQueueSize`,void 0),i(this,`_scheduledDelayMillis`,void 0),i(this,`_exportTimeoutMillis`,void 0),i(this,`_exporter`,void 0),i(this,`_metrics`,void 0),i(this,`_isExporting`,!1),i(this,`_finishedSpans`,[]),i(this,`_timer`,void 0),i(this,`_shutdownOnce`,void 0),i(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new bt(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(m.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):a();this._metrics=new di(ri,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&s.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&m.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(m.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);f.with(Ot(f.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===j.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{C(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,C(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},pi=class extends fi{onShutdown(){}};r();var mi=8,hi=16,gi=class{constructor(){i(this,`generateTraceId`,_i(hi)),i(this,`generateSpanId`,_i(mi))}},X=Buffer.allocUnsafe(hi);function _i(e){return function(){for(let t=0;t<e/4;t++)X.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(X[t]>0);t++)t===e-1&&(X[e-1]=1);return X.toString(`hex`,0,e)}}p(),xt(),r();var Z;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Z||(Z={}));var vi=class{constructor(e={}){i(this,`_resource`,void 0),i(this,`_activeSpanProcessor`,void 0),i(this,`_forceFlushTimeoutMillis`,void 0),i(this,`_tracerOptions`,void 0),i(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??Ct();let t=e.spanProcessors??[];this._activeSpanProcessor=new li(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new Y({root:new J}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new gi,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return a()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new ci({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Z.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Z.timeout&&(r=Z.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Z.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Z.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Wr](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Kr(`TracerProvider`,{resource:{attributes:Gr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};A();var yi=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:k(e.startTime),duration:k(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:j.SUCCESS})}};p(),r();var bi=class{constructor(e=0){i(this,`_ratio`,void 0),i(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:ne(t)&&this._accumulate(t)<this._upperBound?K.RECORD_AND_SAMPLED:K.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};p(),A();var Q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Q||(Q={}));var $=1;function xi(){return{sampler:Si(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:T(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:T(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:T(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Si(){let e=vt(`OTEL_TRACES_SAMPLER`)??Q.ParentBasedAlwaysOn;switch(e){case Q.AlwaysOn:return new J;case Q.AlwaysOff:return new q;case Q.ParentBasedAlwaysOn:return new Y({root:new J});case Q.ParentBasedAlwaysOff:return new Y({root:new q});case Q.TraceIdRatio:return new bi(Ci());case Q.ParentBasedTraceIdRatio:return new Y({root:new bi(Ci())});default:return m.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Q.ParentBasedAlwaysOn}".`),new Y({root:new J})}}function Ci(){let e=T(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(m.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$}.`),$):e<0||e>1?(m.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${$}.`),$):e}A();function wi(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??T(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??T(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??T(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??T(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}A();var Ti=class extends vi{constructor(e={}){let t=dt({},xi(),wi(e));delete t.generalLimits,super(t)}};A();var Ei=class extends pi{constructor(e,t){t||(t={});for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=T(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};n(),le(),_e(),we(),xe(),Ve(),Ue(),ke(),nt(),ct(),rt(),it(),kt(),Mt(),de(),Ye(),Me(),b(),De(),Qe(),Ie(),Re(),Pe(),et();var Di=3600*1e3,Oi=1440*60*1e3;async function ki(){let e=Ze();if(e.error)throw Error(`Auth error: ${e.error}`);let t={"Content-Type":`application/json`,"User-Agent":$e(),...e.headers};return(await ue.get(`https://api.anthropic.com/api/claude_code/organizations/metrics_enabled`,{headers:t,timeout:5e3})).data}async function Ai(){if(Fe())return{enabled:!1,hasError:!1};try{let e=await Xe(ki,{also403Revoked:!0});return x(`Metrics opt-out API response: enabled=${e.metrics_logging_enabled}`),{enabled:e.metrics_logging_enabled,hasError:!1}}catch(e){return x(`Failed to check metrics opt-out status: ${be(e)}`),S(e),{enabled:!1,hasError:!0}}}var ji=Le(Ai,Di);async function Mi(){let e=await ji();if(e.hasError)return e;let t=je().metricsStatusCache;return t!==void 0&&t.enabled===e.enabled&&Date.now()-t.timestamp<Oi||Ae(t=>({...t,metricsStatusCache:{enabled:e.enabled,timestamp:Date.now()}})),e}async function Ni(){if(qe()&&!We())return{enabled:!1,hasError:!1};let e=je().metricsStatusCache;return e?(Date.now()-e.timestamp>Oi&&Mi().catch(S),{enabled:e.enabled,hasError:!1}):Mi()}A(),de(),Ye(),Me(),b(),De(),Qe(),Ie(),et(),r();var Pi=class{constructor(e={}){i(this,`endpoint`,void 0),i(this,`timeout`,void 0),i(this,`pendingExports`,[]),i(this,`isShutdown`,!1),process.env.USER_TYPE===`ant`&&process.env.ANT_CLAUDE_CODE_METRICS_ENDPOINT?this.endpoint=process.env.ANT_CLAUDE_CODE_METRICS_ENDPOINT+`/api/claude_code/metrics`:this.endpoint=`https://api.anthropic.com/api/claude_code/metrics`,this.timeout=e.timeout||5e3}async export(e,t){if(this.isShutdown){t({code:j.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{if(!(Ne()||ye())){x(`BigQuery metrics export: trust not established, skipping`),t({code:j.SUCCESS});return}if(!(await Ni()).enabled){x(`Metrics export disabled by organization setting`),t({code:j.SUCCESS});return}let n=this.transformMetricsForInternal(e),r=Ze();if(r.error){x(`Metrics export failed: ${r.error}`),t({code:j.FAILED,error:Error(r.error)});return}let i={"Content-Type":`application/json`,"User-Agent":$e(),...r.headers},a=await ue.post(this.endpoint,n,{timeout:this.timeout,headers:i});x(`BigQuery metrics exported successfully`),x(`BigQuery API Response: ${Ee(a.data,null,2)}`),t({code:j.SUCCESS})}catch(e){x(`BigQuery metrics export failed: ${be(e)}`),S(e),t({code:j.FAILED,error:Se(e)})}}transformMetricsForInternal(e){let t=e.resource.attributes,n={"service.name":t[`service.name`]||`claude-code`,"service.version":t[`service.version`]||`unknown`,"os.type":t[`os.type`]||`unknown`,"os.version":t[`os.version`]||`unknown`,"host.arch":t[`host.arch`]||`unknown`,"aggregation.temporality":this.selectAggregationTemporality()===M.DELTA?`delta`:`cumulative`};if(t[`wsl.version`]&&(n[`wsl.version`]=t[`wsl.version`]),qe()){n[`user.customer_type`]=`claude_ai`;let e=Ke();e&&(n[`user.subscription_type`]=e)}else n[`user.customer_type`]=`api`;return{resource_attributes:n,metrics:e.scopeMetrics.flatMap(e=>e.metrics.map(e=>({name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit,data_points:this.extractDataPoints(e)})))}}extractDataPoints(e){return(e.dataPoints||[]).filter(e=>typeof e.value==`number`).map(e=>({attributes:this.convertAttributes(e.attributes),value:e.value,timestamp:this.hrTimeToISOString(e.endTime||e.startTime||[Date.now()/1e3,0])}))}async shutdown(){this.isShutdown=!0,await this.forceFlush(),x(`BigQuery metrics exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),x(`BigQuery metrics exporter flush complete`)}convertAttributes(e){let t={};if(e)for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return t}hrTimeToISOString(e){let[t,n]=e;return new Date(t*1e3+n/1e6).toISOString()}selectAggregationTemporality(){return M.DELTA}};b(),Ie();var Fi=class{error(e,...t){S(Error(e)),x(`[3P telemetry] OTEL diag error: ${e}`,{level:`error`})}warn(e,...t){S(Error(e)),x(`[3P telemetry] OTEL diag warn: ${e}`,{level:`warn`})}info(e,...t){}debug(e,...t){}verbose(e,...t){}};p(),xt(),ce(),_e(),Ye(),b(),De(),xe(),Rt(),Pt();var Ii=6e4,Li=5e3,Ri=5e3,zi=class extends Error{};function Bi(e,t){return new Promise((n,r)=>{setTimeout((e,t)=>e(new zi(t)),e,r,t).unref()})}function Vi(){process.env.USER_TYPE===`ant`&&(process.env.ANT_OTEL_METRICS_EXPORTER&&(process.env.OTEL_METRICS_EXPORTER=process.env.ANT_OTEL_METRICS_EXPORTER),process.env.ANT_OTEL_LOGS_EXPORTER&&(process.env.OTEL_LOGS_EXPORTER=process.env.ANT_OTEL_LOGS_EXPORTER),process.env.ANT_OTEL_TRACES_EXPORTER&&(process.env.OTEL_TRACES_EXPORTER=process.env.ANT_OTEL_TRACES_EXPORTER),process.env.ANT_OTEL_EXPORTER_OTLP_PROTOCOL&&(process.env.OTEL_EXPORTER_OTLP_PROTOCOL=process.env.ANT_OTEL_EXPORTER_OTLP_PROTOCOL),process.env.ANT_OTEL_EXPORTER_OTLP_ENDPOINT&&(process.env.OTEL_EXPORTER_OTLP_ENDPOINT=process.env.ANT_OTEL_EXPORTER_OTLP_ENDPOINT),process.env.ANT_OTEL_EXPORTER_OTLP_HEADERS&&(process.env.OTEL_EXPORTER_OTLP_HEADERS=process.env.ANT_OTEL_EXPORTER_OTLP_HEADERS)),process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE||(process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=`delta`)}function Hi(e){return(e||``).trim().split(`,`).filter(Boolean).map(e=>e.trim()).filter(e=>e!==`none`)}async function Ui(){let t=Hi(process.env.OTEL_METRICS_EXPORTER),n=parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL||Ii.toString(),10),r=[];for(let n of t)if(n===`console`){let e=new Jn,t=e.export.bind(e);e.export=(e,n)=>(e.resource&&e.resource.attributes&&(x(`
|
|
11
|
+
=== Resource Attributes ===`),x(Ee(e.resource.attributes)),x(`===========================
|
|
12
|
+
`)),t(e,n)),r.push(e)}else if(n===`otlp`){let t=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=$i();switch(t){case`grpc`:{let{OTLPMetricExporter:t}=await import(`./src-PM8NIIu_.js`).then(t=>e(t.default,1));r.push(new t);break}case`http/json`:{let{OTLPMetricExporter:e}=await import(`./esm-IYgGg4wR.js`);r.push(new e(n));break}case`http/protobuf`:{let{OTLPMetricExporter:e}=await import(`./esm-BYnFh4pG.js`);r.push(new e(n));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else if(n===`prometheus`){let{PrometheusExporter:t}=await import(`./src-CgZmCiiH.js`).then(t=>e(t.default,1));r.push(new t)}else throw Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${n}`);return r.map(e=>`export`in e?new qn({exporter:e,exportIntervalMillis:n}):e)}async function Wi(){let t=Hi(process.env.OTEL_LOGS_EXPORTER),n=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),r=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;x(`[3P telemetry] getOtlpLogExporters: types=${Ee(t)}, protocol=${n}, endpoint=${r}`);let i=[];for(let r of t)if(r===`console`)i.push(new wt);else if(r===`otlp`){let t=$i();switch(n){case`grpc`:{let{OTLPLogExporter:t}=await import(`./src-DQOX_xI1.js`).then(t=>e(t.default,1));i.push(new t);break}case`http/json`:{let{OTLPLogExporter:e}=await import(`./esm-DklLYEuz.js`);i.push(new e(t));break}case`http/protobuf`:{let{OTLPLogExporter:e}=await import(`./esm-CXM9jqO_.js`);i.push(new e(t));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${n}`)}}else throw Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${r}`);return i}async function Gi(){let t=Hi(process.env.OTEL_TRACES_EXPORTER),n=[];for(let r of t)if(r===`console`)n.push(new yi);else if(r===`otlp`){let t=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),r=$i();switch(t){case`grpc`:{let{OTLPTraceExporter:t}=await import(`./src-Dt5IJd3C.js`).then(t=>e(t.default,1));n.push(new t);break}case`http/json`:{let{OTLPTraceExporter:e}=await import(`./esm-DhRjocaU.js`);n.push(new e(r));break}case`http/protobuf`:{let{OTLPTraceExporter:e}=await import(`./esm-CXczu_-W.js`);n.push(new e(r));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else throw Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${r}`);return n}function Ki(){return t(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)}function qi(){return new qn({exporter:new Pi,exportIntervalMillis:300*1e3})}function Ji(){let e=Ke(),t=qe()&&(e===`enterprise`||e===`team`);return Ge()||t}async function Yi(e){let t=process.env.BETA_TRACING_ENDPOINT;if(!t)return;let[{OTLPTraceExporter:n},{OTLPLogExporter:r}]=await Promise.all([import(`./esm-DhRjocaU.js`),import(`./esm-DklLYEuz.js`)]),i={url:`${t}/v1/traces`},a={url:`${t}/v1/logs`},o=new Ti({resource:e,spanProcessors:[new Ei(new n(i),{scheduledDelayMillis:Ri})]});d.setGlobalTracerProvider(o),ve(o);let s=new Et({resource:e,processors:[new Tt(new r(a),{scheduledDelayMillis:Li})]});v.setGlobalLoggerProvider(s),he(s),fe(v.getLogger(`com.anthropic.claude_code.events`,`0.0.3`)),process.on(`beforeExit`,async()=>{await s?.forceFlush(),await o?.forceFlush()}),process.on(`exit`,()=>{s?.forceFlush(),o?.forceFlush()})}async function Xi(){if(He(`telemetry_init_start`),Vi(),Ce())for(let e of[`OTEL_METRICS_EXPORTER`,`OTEL_LOGS_EXPORTER`,`OTEL_TRACES_EXPORTER`]){let t=process.env[e];t?.includes(`console`)&&(process.env[e]=t.split(`,`).map(e=>e.trim()).filter(e=>e!==`console`).join(`,`))}m.setLogger(new Fi,o.ERROR),Nt();let e=[],t=Ki();x(`[3P telemetry] isTelemetryEnabled=${t} (CLAUDE_CODE_ENABLE_TELEMETRY=${process.env.CLAUDE_CODE_ENABLE_TELEMETRY})`),t&&e.push(...await Ui()),Ji()&&e.push(qi());let n=Be(),r={[oe]:`claude-code`,[ie]:`0.0.3`};if(n===`wsl`){let e=ze();e&&(r[`wsl.version`]=e)}let i=O(r),a=O(At.detect().attributes||{}),s=St.detect(),c=O(s.attributes?.[`host.arch`]?{[ae]:s.attributes[ae]}:{}),l=O(Dt.detect().attributes||{}),u=i.merge(a).merge(c).merge(l);if(Lt()){Yi(u).catch(e=>x(`Beta tracing init failed: ${e}`,{level:`error`}));let t=new Hr({resource:u,views:[],readers:e});return pe(t),Te(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{It();let n=ge(),r=y(),i=[t.shutdown()];n&&i.push(n.forceFlush().then(()=>n.shutdown())),r&&i.push(r.forceFlush().then(()=>r.shutdown())),await Promise.race([Promise.all(i),Bi(e,`OpenTelemetry shutdown timeout`)])}catch{}}),t.getMeter(`com.anthropic.claude_code`,`0.0.3`)}let f=new Hr({resource:u,views:[],readers:e});if(pe(f),t){let e=await Wi();if(x(`[3P telemetry] Created ${e.length} log exporter(s)`),e.length>0){let t=new Et({resource:u,processors:e.map(e=>new Tt(e,{scheduledDelayMillis:parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||Li.toString(),10)}))});v.setGlobalLoggerProvider(t),he(t),fe(v.getLogger(`com.anthropic.claude_code.events`,`0.0.3`)),x(`[3P telemetry] Event logger set successfully`),process.on(`beforeExit`,async()=>{await t?.forceFlush(),await y()?.forceFlush()}),process.on(`exit`,()=>{t?.forceFlush(),y()?.forceFlush()})}}if(t&&Ft()){let e=await Gi();if(e.length>0){let t=new Ti({resource:u,spanProcessors:e.map(e=>new Ei(e,{scheduledDelayMillis:parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL||Ri.toString(),10)}))});d.setGlobalTracerProvider(t),ve(t)}}return Te(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{It();let t=[f.shutdown()],n=ge();n&&t.push(n.shutdown());let r=y();r&&t.push(r.shutdown()),await Promise.race([Promise.all(t),Bi(e,`OpenTelemetry shutdown timeout`)])}catch(t){throw t instanceof Error&&t.message.includes(`timeout`)&&x(`
|
|
13
13
|
OpenTelemetry telemetry flush timed out after ${e}ms
|
|
14
14
|
|
|
15
15
|
To resolve this issue, you can:
|
|
@@ -18,4 +18,4 @@ To resolve this issue, you can:
|
|
|
18
18
|
3. Disable OpenTelemetry by unsetting CLAUDE_CODE_ENABLE_TELEMETRY env var
|
|
19
19
|
|
|
20
20
|
Current timeout: ${e}ms
|
|
21
|
-
`,{level:`error`}),t}}),f.getMeter(`com.anthropic.claude_code`,`0.0.
|
|
21
|
+
`,{level:`error`}),t}}),f.getMeter(`com.anthropic.claude_code`,`0.0.3`)}async function Zi(){let e=me();if(!e)return;let t=parseInt(process.env.CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS||`5000`,10);try{let n=[e.forceFlush()],r=ge();r&&n.push(r.forceFlush());let i=y();i&&n.push(i.forceFlush()),await Promise.race([Promise.all(n),Bi(t,`OpenTelemetry flush timeout`)]),x(`Telemetry flushed successfully`)}catch(e){e instanceof zi?x(`Telemetry flush timed out after ${t}ms. Some metrics may not be exported.`,{level:`warn`}):x(`Telemetry flush failed: ${be(e)}`,{level:`error`})}}function Qi(){let e={},t=process.env.OTEL_EXPORTER_OTLP_HEADERS;if(t)for(let n of t.split(`,`)){let[t,...r]=n.split(`=`);t&&r.length>0&&(e[t.trim()]=r.join(`=`).trim())}return e}function $i(){let e=at(),t=ot(),n=Oe(),r={},i=Qi();n?.otelHeadersHelper?r.headers=async()=>{let e=Je();return{...i,...e}}:Object.keys(i).length>0&&(r.headers=async()=>i);let a=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;if(!e||a&&st(a)){let e=tt();return(t||e)&&(r.httpAgentOptions={...t,...e&&{ca:e}}),r}let o=tt();return r.httpAgentOptions=n=>t||o?new lt(e,{...t&&{cert:t.cert,key:t.key,passphrase:t.passphrase},...o&&{ca:o}}):new lt(e),r}export{Zi as flushTelemetry,Xi as initializeTelemetry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,n){let r=n?n.trim().split(/\s+/):[],i=r[0]||`list`,a=[],o=console.log,s=console.error;console.log=(...e)=>a.push(e.map(String).join(` `)),console.error=(...e)=>a.push(e.map(String).join(` `));try{let{templatesMain:e}=await import(`./templateJobs-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,n){let r=n?n.trim().split(/\s+/):[],i=r[0]||`list`,a=[],o=console.log,s=console.error;console.log=(...e)=>a.push(e.map(String).join(` `)),console.error=(...e)=>a.push(e.map(String).join(` `));try{let{templatesMain:e}=await import(`./templateJobs-CT5VxeRr.js`);await e([i,...r.slice(1)])}finally{console.log=o,console.error=s}return e(a.join(`
|
|
2
2
|
`)||`Done.`,{display:`system`}),null}e((()=>{}))();export{t as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{C as e,F as t,S as n,a as r,l as i,z as a}from"./debug-BrXObCdR.js";import{M as o,j as s}from"./git-Do0wJvux.js";import{n as c,r as l}from"./analytics-BotDBGh0.js";c(),r(),s(),a(),n();function u(e){if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`${t}m ${n}s`:`${t}m`}function d(t){let n=(t.startsWith(`sk-ant-si-`)?t.slice(10):t).split(`.`);if(n.length!==3||!n[1])return null;try{return e(Buffer.from(n[1],`base64url`).toString(`utf8`))}catch{return null}}function f(e){let t=d(e);return typeof t==`object`&&t&&`exp`in t&&typeof t.exp==`number`?t.exp:null}var p=300*1e3,m=1800*1e3,h=3,g=6e4;function _({getAccessToken:e,onRefresh:n,label:r,refreshBufferMs:a=p}){let s=new Map,c=new Map,d=new Map;function _(e){let t=(d.get(e)??0)+1;return d.set(e,t),t}function v(e,t){let n=f(t);if(!n){i(`[${r}:token] Could not decode JWT expiry for sessionId=${e}, token prefix=${t.slice(0,15)}…, keeping existing timer`);return}let o=s.get(e);o&&clearTimeout(o);let c=_(e),l=new Date(n*1e3).toISOString(),d=n*1e3-Date.now()-a;if(d<=0){i(`[${r}:token] Token for sessionId=${e} expires=${l} (past or within buffer), refreshing immediately`),b(e,c);return}i(`[${r}:token] Scheduled token refresh for sessionId=${e} in ${u(d)} (expires=${l}, buffer=${a/1e3}s)`);let p=setTimeout(b,d,e,c);s.set(e,p)}function y(e,t){let n=s.get(e);n&&clearTimeout(n);let o=_(e),c=Math.max(t*1e3-a,3e4);i(`[${r}:token] Scheduled token refresh for sessionId=${e} in ${u(c)} (expires_in=${t}s, buffer=${a/1e3}s)`);let l=setTimeout(b,c,e,o);s.set(e,l)}async function b(a,f){let p;try{p=await e()}catch(e){i(`[${r}:token] getAccessToken threw for sessionId=${a}: ${t(e)}`,{level:`error`})}if(d.get(a)!==f){i(`[${r}:token] doRefresh for sessionId=${a} stale (gen ${f} vs ${d.get(a)}), skipping`);return}if(!p){let e=(c.get(a)??0)+1;if(c.set(a,e),i(`[${r}:token] No OAuth token available for refresh, sessionId=${a} (failure ${e}/${h})`,{level:`error`}),o(`error`,`bridge_token_refresh_no_oauth`),e<h){let e=setTimeout(b,g,a,f);s.set(a,e)}return}c.delete(a),i(`[${r}:token] Refreshing token for sessionId=${a}: new token prefix=${p.slice(0,15)}…`),l(`tengu_bridge_token_refreshed`,{}),n(a,p);let _=setTimeout(b,m,a,f);s.set(a,_),i(`[${r}:token] Scheduled follow-up refresh for sessionId=${a} in ${u(m)}`)}function x(e){_(e);let t=s.get(e);t&&(clearTimeout(t),s.delete(e)),c.delete(e)}function S(){for(let e of d.keys())_(e);for(let e of s.values())clearTimeout(e);s.clear(),c.clear()}return{schedule:v,scheduleFromExpiresIn:y,cancel:x,cancelAll:S}}export{f as n,_ as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{BS as t,FS as n,HS as r,NS as i,PS as a,RS as o,US as s,VS as c}from"./loadAgentsDir-DrDu5yYy.js";import{I as l,S as u,w as d,z as f}from"./debug-BrXObCdR.js";import{r as p,t as m}from"./promptEditor-Cumef6hJ.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(o.map(e=>c(e.key)));return e.map(e=>{let n={};for(let[r,i]of Object.entries(e.bindings))t.has(c(r))||(n[r]=i);return{context:e.context,bindings:n}}).filter(e=>Object.keys(e.bindings).length>0)}function y(){return d({$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.claude.com/docs/en/keybindings`,bindings:v(r)},null,2)+`
|
|
2
|
+
`}var b=e((()=>{u(),s(),t()}));async function x(){if(!n())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=i(),t=!1;await g(h(e),{recursive:!0});try{await _(e,y(),{encoding:`utf-8`,flag:`wx`})}catch(e){if(l(e)===`EEXIST`)t=!0;else throw e}let r=await m(e);return r.error?{type:`text`,value:`${t?`Opened`:`Created`} ${e}. Could not open in editor: ${r.error}`}:{type:`text`,value:t?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{a(),b(),f(),p()}))();export{x as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,g as n}from"./config-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,g as n}from"./config-DiT2Z8dY.js";import{i as r,s as i}from"./intl-cKc-V6Mq.js";function a(){let e=t().preferredLanguage??`auto`;return e===`en`||e===`zh`?e:r()===`zh`?`zh`:`en`}var o=e((()=>{n(),i()}));export{o as n,a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./language-BA5WprZv.js";e();export{t as getResolvedLanguage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{I as a,P as o,fi as s,t as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{n as u,r as d}from"./analytics-BotDBGh0.js";import{l as f,u as p}from"./oauth-BqJqV-2M.js";import{o as m,u as h}from"./api-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{I as a,P as o,fi as s,t as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{n as u,r as d}from"./analytics-BotDBGh0.js";import{l as f,u as p}from"./oauth-BqJqV-2M.js";import{o as m,u as h}from"./api-gJBnC8z3.js";import{n as g,r as _,t as v}from"./cron-3LntnnhJ.js";import{n as y,r as b}from"./hostGuard-C5xydXZI.js";import{n as x,t as S}from"./launchCommand-1qkTCKpf.js";function C(e){return new Promise(t=>setTimeout(t,e))}async function w(){let e;try{e=(await h()).apiKey}catch(e){let t=e instanceof Error?e.message:String(e);throw new F(t,501)}return y(T()),{"x-api-key":e,"anthropic-version":`2023-06-01`,"anthropic-beta":N,"content-type":`application/json`}}function T(){return`${f().BASE_API_URL}/v1/agents`}function E(e){if(r.isAxiosError(e)){let t=e.response?.status??0;if(t===401)return new F(`Authentication failed. Please run /login to re-authenticate.`,401);if(t===403)return new F(`Subscription required. Scheduled agents require a Claude Pro/Max/Team subscription.`,403);if(t===404)return new F(`Agent not found.`,404);if(t===429){let t=e.response?.headers?.[`retry-after`]??``,n=t?` Retry after ${t}s.`:``;return new F(`Rate limit exceeded.${n}`,429)}let n=(e.response?.data)?.error?.message??e.message;return new F(n,t)}return e instanceof F?e:new F(e instanceof Error?e.message:String(e),0)}function D(e){if(!e)return null;let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t*1e3;let n=Date.parse(e);return Number.isNaN(n)?null:Math.max(0,n-Date.now())}async function O(e){let t;for(let n=0;n<P;n++)try{return await e()}catch(e){let i=E(e);if(i.statusCode>=500){t=i,n<P-1&&await C(D(r.isAxiosError(e)?e.response?.headers?.[`retry-after`]:void 0)??500*2**n);continue}throw i}throw t??new F(`Request failed after retries`,0)}async function k(){return O(async()=>{let e=await w();return(await r.get(T(),{headers:e})).data.data??[]})}async function A(e,t){return O(async()=>{let n=await w();return(await r.post(T(),{cron_expr:e,prompt:t,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone??`UTC`},{headers:n})).data})}async function j(e){return O(async()=>{let t=await w();await r.delete(`${T()}/${e}`,{headers:t})})}async function M(e){return O(async()=>{let t=await w();return(await r.post(`${T()}/${e}/run`,{},{headers:t})).data})}var N,P,F,I=e((()=>{i(),p(),b(),m(),t(),N=`managed-agents-2026-04-01`,P=3,F=class extends Error{constructor(e,t){super(e),n(this,`statusCode`,void 0),this.statusCode=t,this.name=`AgentsApiError`}}}));function L({agent:e}){let t=v(e.cron_expr,{utc:!0}),n=e.next_run?new Date(e.next_run).toLocaleString():`—`;return(0,z.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,z.jsxs)(a,{children:[(0,z.jsx)(o,{bold:!0,children:e.id}),(0,z.jsx)(o,{dimColor:!0,children:` · `}),(0,z.jsx)(o,{color:`suggestion`,children:e.status})]}),(0,z.jsxs)(o,{children:[`Schedule: `,t]}),(0,z.jsxs)(o,{dimColor:!0,children:[`Prompt: `,e.prompt]}),(0,z.jsxs)(o,{dimColor:!0,children:[`Next run: `,n]})]})}function R(e){if(e.mode===`list`)return e.agents.length===0?(0,z.jsx)(a,{children:(0,z.jsx)(o,{dimColor:!0,children:`No scheduled agents. Use /agents-platform create <cron> <prompt> to create one.`})}):(0,z.jsxs)(a,{flexDirection:`column`,children:[(0,z.jsx)(a,{marginBottom:1,children:(0,z.jsxs)(o,{bold:!0,children:[`Scheduled Agents (`,e.agents.length,`)`]})}),e.agents.map(e=>(0,z.jsx)(L,{agent:e},e.id))]});if(e.mode===`created`){let t=v(e.agent.cron_expr,{utc:!0});return(0,z.jsxs)(a,{flexDirection:`column`,children:[(0,z.jsx)(a,{children:(0,z.jsx)(o,{bold:!0,color:`success`,children:`Agent created`})}),(0,z.jsxs)(o,{children:[`ID: `,e.agent.id]}),(0,z.jsxs)(o,{children:[`Schedule: `,t]}),(0,z.jsxs)(o,{children:[`Prompt: `,e.agent.prompt]}),(0,z.jsxs)(o,{dimColor:!0,children:[`Status: `,e.agent.status]})]})}return e.mode===`deleted`?(0,z.jsx)(a,{children:(0,z.jsxs)(o,{color:`success`,children:[`Agent `,e.id,` deleted.`]})}):e.mode===`ran`?(0,z.jsxs)(a,{flexDirection:`column`,children:[(0,z.jsx)(a,{children:(0,z.jsxs)(o,{color:`success`,children:[`Agent `,e.id,` triggered.`]})}),(0,z.jsxs)(o,{dimColor:!0,children:[`Run ID: `,e.runId]})]}):(0,z.jsx)(a,{children:(0,z.jsx)(o,{color:`error`,children:e.message})})}var z,B=e((()=>{s(),c(),g(),z=l()}));function V(e){let t=e.trim().split(/\s+/);return t.length<6?null:{cron:t.slice(0,5).join(` `),prompt:t.slice(5).join(` `)}}function H(e){let t=e.trim();if(t===``||t===`list`)return{action:`list`};let n=t.indexOf(` `),r=n===-1?t:t.slice(0,n),i=n===-1?``:t.slice(n+1).trim();if(r===`create`){if(!i)return{action:`invalid`,reason:`create requires a cron expression and prompt, e.g. create "0 9 * * 1" Run daily standup`};let e=V(i);if(!e)return{action:`invalid`,reason:`create requires at least 5 cron fields followed by a prompt, e.g. create "0 9 * * 1" Run daily standup`};let{cron:t,prompt:n}=e;return n.trim()?{action:`create`,cron:t,prompt:n.trim()}:{action:`invalid`,reason:`prompt cannot be empty`}}if(r===`delete`){if(!i)return{action:`invalid`,reason:`delete requires an agent id`};let e=i.split(/\s+/)[0];return e?{action:`delete`,id:e}:{action:`invalid`,reason:`delete requires an agent id`}}if(r===`run`){if(!i)return{action:`invalid`,reason:`run requires an agent id`};let e=i.split(/\s+/)[0];return e?{action:`run`,id:e}:{action:`invalid`,reason:`run requires an agent id`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". Use: list | create CRON PROMPT | delete ID | run ID`}}var U=e((()=>{}));async function W(e,t){if(e.action===`list`){d(`tengu_agents_platform_list`,{});try{let e=await k();return t(e.length===0?`No scheduled agents found.`:`${e.length} scheduled agent(s).`,{display:`system`}),{mode:`list`,agents:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_agents_platform_failed`,{reason:n}),t(`Failed to list agents: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`create`){let{cron:n,prompt:r}=e;if(!_(n)){let e=`Invalid cron expression: "${n}". Expected 5 fields (minute hour day month weekday).`;return d(`tengu_agents_platform_failed`,{reason:e}),t(e,{display:`system`}),null}d(`tengu_agents_platform_create`,{cron:n});try{let e=await A(n,r);return t(`Agent created: ${e.id}`,{display:`system`}),{mode:`created`,agent:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_agents_platform_failed`,{reason:n}),t(`Failed to create agent: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`delete`){let{id:n}=e;d(`tengu_agents_platform_delete`,{id:n});try{return await j(n),t(`Agent ${n} deleted.`,{display:`system`}),{mode:`deleted`,id:n}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_agents_platform_failed`,{reason:r}),t(`Failed to delete agent ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}let{id:n}=e;d(`tengu_agents_platform_run`,{id:n});try{let e=await M(n);return t(`Agent ${n} triggered. Run ID: ${e.run_id}`,{display:`system`}),{mode:`ran`,id:n,runId:e.run_id}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_agents_platform_failed`,{reason:r}),t(`Failed to run agent ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}var G;e((()=>{u(),g(),I(),B(),U(),S(),G=x({commandName:`agents-platform`,parseArgs:e=>{d(`tengu_agents_platform_started`,{args:e});let t=H(e);return t.action===`invalid`?(d(`tengu_agents_platform_failed`,{reason:t.reason}),{action:`invalid`,reason:`Usage: /agents-platform list | create CRON PROMPT | delete ID | run ID\n${t.reason}`}):t},dispatch:W,View:R,errorView:e=>null})}))();export{G as callAgentsPlatform};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Cd as l,Dd as u,Ed as d,Od as f,
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Cd as l,Dd as u,Ed as d,Od as f,Rx as p,Sd as m,Td as h,bd as g,wd as _,xd as v,yd as y,zx as b}from"./loadAgentsDir-DrDu5yYy.js";import{n as x,t as S}from"./launchCommand-1qkTCKpf.js";function C(e){return e.mode===`list`?e.stores.length===0?(0,w.jsx)(n,{children:(0,w.jsx)(r,{dimColor:!0,children:`No memory stores found. Use /local-memory create <store> to create one.`})}):(0,w.jsxs)(n,{flexDirection:`column`,children:[(0,w.jsx)(n,{marginBottom:1,children:(0,w.jsxs)(r,{bold:!0,children:[`Local Memory Stores (`,e.stores.length,`)`]})}),e.stores.map(e=>(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{children:` `}),(0,w.jsx)(r,{color:`success`,children:`◆`}),(0,w.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`created`?(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{color:`success`,children:`✓`}),(0,w.jsx)(r,{children:` Store created: `}),(0,w.jsx)(r,{bold:!0,children:e.store})]}):e.mode===`stored`?(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{color:`success`,children:`✓`}),(0,w.jsx)(r,{children:` Stored entry `}),(0,w.jsx)(r,{bold:!0,children:e.key}),(0,w.jsx)(r,{children:` in `}),(0,w.jsx)(r,{bold:!0,children:e.store})]}):e.mode===`fetched`?(0,w.jsxs)(n,{flexDirection:`column`,children:[(0,w.jsxs)(n,{marginBottom:1,children:[(0,w.jsx)(r,{bold:!0,children:e.store}),(0,w.jsx)(r,{dimColor:!0,children:`/`}),(0,w.jsx)(r,{bold:!0,children:e.key})]}),(0,w.jsx)(n,{children:(0,w.jsx)(r,{children:e.value})})]}):e.mode===`not-found`?(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{color:`error`,children:`Not found: `}),(0,w.jsx)(r,{bold:!0,children:e.store}),e.key?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(r,{dimColor:!0,children:`/`}),(0,w.jsx)(r,{bold:!0,children:e.key})]}):null]}):e.mode===`entries`?e.keys.length===0?(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{dimColor:!0,children:`No entries in `}),(0,w.jsx)(r,{bold:!0,children:e.store}),(0,w.jsxs)(r,{dimColor:!0,children:[`. Use /local-memory store `,e.store,` <key> <value> to add one.`]})]}):(0,w.jsxs)(n,{flexDirection:`column`,children:[(0,w.jsxs)(n,{marginBottom:1,children:[(0,w.jsx)(r,{bold:!0,children:e.store}),(0,w.jsxs)(r,{dimColor:!0,children:[` (`,e.keys.length,` entries)`]})]}),e.keys.map(e=>(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{children:` `}),(0,w.jsx)(r,{color:`success`,children:`·`}),(0,w.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`archived`?(0,w.jsxs)(n,{children:[(0,w.jsx)(r,{color:`success`,children:`✓`}),(0,w.jsx)(r,{children:` Archived store: `}),(0,w.jsx)(r,{bold:!0,children:e.store}),(0,w.jsxs)(r,{dimColor:!0,children:[` (renamed to `,e.store,`.archived)`]})]}):(0,w.jsx)(n,{children:(0,w.jsxs)(r,{color:`error`,children:[`Error: `,e.message]})})}var w,T=e((()=>{i(),o(),w=c()}));function E(e){let t=e.trim();if(t===``||t===`list`)return{action:`list`};let n=t.split(/\s+/),r=n[0];if(r===`list`)return{action:`list`};if(r===`create`){let e=n[1];return e?{action:`create`,store:e}:{action:`invalid`,reason:`create requires a store name. ${D}`}}if(r===`store`){let e=n[1],t=n[2];if(!e)return{action:`invalid`,reason:`store requires a store name. ${D}`};if(!t)return{action:`invalid`,reason:`store requires a key. ${D}`};let r=n.slice(3).join(` `);return r?{action:`store`,store:e,key:t,value:r}:{action:`invalid`,reason:`store requires a value. ${D}`}}if(r===`fetch`){let e=n[1],t=n[2];return e?t?{action:`fetch`,store:e,key:t}:{action:`invalid`,reason:`fetch requires a key. ${D}`}:{action:`invalid`,reason:`fetch requires a store name. ${D}`}}if(r===`entries`){let e=n[1];return e?{action:`entries`,store:e}:{action:`invalid`,reason:`entries requires a store name. ${D}`}}if(r===`archive`){let e=n[1];return e?{action:`archive`,store:e}:{action:`invalid`,reason:`archive requires a store name. ${D}`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${D}`}}var D,O=e((()=>{D=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`}));function k(e){return e.length===0?`No memory stores found.`:[`Local Memory Stores`,...e.map(e=>`- ${e}`)].join(`
|
|
2
2
|
`)}function A(e,t){return t.length===0?`No entries in "${e}".`:[`Entries in "${e}"`,...t.map(e=>`- ${e}`)].join(`
|
|
3
|
-
`)}function j({onDone:e}){let[t,i]=N.useState({kind:`menu`}),[o,c]=N.useState(0),[u,
|
|
3
|
+
`)}function j({onDone:e}){let[t,i]=N.useState({kind:`menu`}),[o,c]=N.useState(0),[u,m]=N.useState(``),[b,x]=N.useState(0),[S,C]=N.useState(null),w=N.useCallback(e=>{i(e),m(``),x(0),C(null)},[]),T=N.useCallback(t=>e(t,{display:`system`}),[e]),E=N.useCallback((e,t,n,r,i={})=>{try{if(e===`list`){T(k(h()));return}if(e===`about`){T(F);return}if(!t){C(`Internal: missing store`);return}if(e===`create`){g(t),T(`Store created: ${t}`);return}if(e===`entries`){let e=_(t);T(A(t,e));return}if(e===`archive`){y(t),T(`Archived store: ${t}`);return}if(e===`fetch`){if(!n){C(`Internal: missing key`);return}let e=v(t,n);if(e===null){T(`Entry not found: ${t}/${n}`);return}T(`Entry fetched: ${t}/${n}\n\n${e}`);return}if(e===`store`){if(!n||r===void 0){C(`Internal: missing key or value`);return}if(!i.confirmedOverwrite&&v(t,n)!==null){w({kind:`confirm-overwrite`,store:t,key:n,value:r});return}d(t,n,r),T(`Stored ${t}/${n} (${r.length} chars)`);return}}catch(e){C(e instanceof Error?e.message:String(e))}},[T,w]);if(a((e,n)=>{if(t.kind!==`menu`)return;if(n.upArrow){c(e=>Math.max(0,e-1));return}if(n.downArrow){c(e=>Math.min(L.length-1,e+1));return}if(n.return){let e=L[o];if(!e)return;if(e.kind===`list`||e.kind===`about`){E(e.kind,void 0,void 0,void 0);return}w({kind:`collect-store`,action:e.kind});return}let r=Number(e);Number.isInteger(r)&&r>=1&&r<=L.length&&c(r-1)},{isActive:t.kind===`menu`}),a((e,n)=>{if(t.kind!==`confirm-archive`&&t.kind!==`confirm-overwrite`)return;if(n.escape){w({kind:`menu`});return}let r=e.toLowerCase();r===`y`||n.return?t.kind===`confirm-archive`?E(`archive`,t.store,void 0,void 0):E(`store`,t.store,t.key,t.value,{confirmedOverwrite:!0}):r===`n`&&w({kind:`menu`})},{isActive:t.kind===`confirm-archive`||t.kind===`confirm-overwrite`}),a((e,n)=>{if(!(t.kind!==`collect-store`&&t.kind!==`collect-key`&&t.kind!==`collect-value`)&&n.escape){if(t.kind===`collect-value`){w({kind:`collect-key`,action:t.action,store:t.store});return}if(t.kind===`collect-key`){w({kind:`collect-store`,action:t.action});return}w({kind:`menu`})}},{isActive:t.kind===`collect-store`||t.kind===`collect-key`||t.kind===`collect-value`}),t.kind===`menu`)return(0,P.jsx)(s,{title:`Local Memory`,subtitle:`${L.length} actions`,onCancel:()=>T(`Local memory panel dismissed`),color:`background`,hideInputGuide:!0,children:(0,P.jsxs)(n,{flexDirection:`column`,children:[L.map((e,t)=>(0,P.jsxs)(n,{flexDirection:`row`,children:[(0,P.jsx)(r,{children:`${t===o?`›`:` `} ${e.label}`.padEnd(I)}),(0,P.jsx)(r,{dimColor:!0,children:e.description})]},e.kind)),(0,P.jsx)(n,{marginTop:1,children:(0,P.jsx)(r,{dimColor:!0,children:`↑/↓ or 1-7 select · Enter run · Esc close`})})]})});if(t.kind===`confirm-archive`)return(0,P.jsx)(s,{title:`Confirm Archive`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,P.jsxs)(n,{flexDirection:`column`,children:[(0,P.jsxs)(r,{children:[`Archive store "`,t.store,`"? This renames it to *.archived.`]}),(0,P.jsx)(n,{marginTop:1,children:(0,P.jsx)(r,{dimColor:!0,children:`y/Enter = archive · n/Esc = cancel`})})]})});if(t.kind===`confirm-overwrite`)return(0,P.jsx)(s,{title:`Confirm Overwrite`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,P.jsxs)(n,{flexDirection:`column`,children:[(0,P.jsxs)(r,{children:[`Entry "`,t.store,`/`,t.key,`" already exists. Overwrite with new value (`,t.value.length,` chars)?`]}),(0,P.jsx)(n,{marginTop:1,children:(0,P.jsx)(r,{dimColor:!0,children:`y/Enter = overwrite · n/Esc = cancel`})})]})});let D=t.kind===`collect-store`?`STORE NAME`:t.kind===`collect-key`?`KEY NAME`:`VALUE`,O=t.kind===`collect-store`?`e.g. my-notes`:t.kind===`collect-key`?`e.g. todo-2026-05-08`:`free text`;return(0,P.jsx)(s,{title:`Local Memory · ${t.kind.replace(`collect-`,``).toUpperCase()}`,onCancel:()=>w({kind:`menu`}),color:`background`,hideInputGuide:!0,children:(0,P.jsxs)(n,{flexDirection:`column`,children:[(0,P.jsx)(n,{children:(0,P.jsx)(r,{dimColor:!0,children:D})}),(0,P.jsxs)(n,{children:[(0,P.jsx)(r,{children:`> `}),(0,P.jsx)(p,{value:u,onChange:e=>{m(e),C(null)},cursorOffset:b,onChangeCursorOffset:x,onSubmit:e=>{let n=e.trim();if(t.kind===`collect-store`){if(!n){C(`Store name required`);return}if(!l(n)){C(`Invalid store name (no /, \\, :, null byte, or leading dot; max 255 chars)`);return}t.action===`create`||t.action===`entries`||t.action===`archive`?t.action===`archive`?w({kind:`confirm-archive`,store:n}):E(t.action,n,void 0,void 0):w({kind:`collect-key`,action:t.action,store:n});return}if(t.kind===`collect-key`){if(!n){C(`Key required`);return}if(!f(n)){C(`Invalid key (allowed: letters/digits/._- only; no leading dot; not a Windows reserved name)`);return}t.action===`fetch`?E(`fetch`,t.store,n,void 0):w({kind:`collect-value`,action:`store`,store:t.store,key:n});return}t.kind===`collect-value`&&E(`store`,t.store,t.key,e)},placeholder:O,columns:70,showCursor:!0})]}),S!==null&&(0,P.jsx)(n,{marginTop:0,children:(0,P.jsxs)(r,{color:`warning`,children:[`✗ `,S]})}),(0,P.jsx)(n,{marginTop:1,children:(0,P.jsx)(r,{dimColor:!0,children:`Enter = next · Esc = back`})})]})})}async function M(e,t){if(e.action===`list`)return t(k(h()),{display:`system`}),null;if(e.action===`create`){let{store:n}=e;return g(n),t(`Store created: ${n}`,{display:`system`}),null}if(e.action===`store`){let{store:n,key:r,value:i}=e;return d(n,r,i),t(`Stored entry "${r}" in store "${n}".`,{display:`system`}),null}if(e.action===`fetch`){let{store:n,key:r}=e,i=v(n,r);return i===null?(t(`Entry not found: ${n}/${r}`,{display:`system`}),null):(t(`Entry fetched: ${n}/${r}\n${i}`,{display:`system`}),null)}if(e.action===`entries`){let{store:n}=e;return t(A(n,_(n)),{display:`system`}),null}if(e.action===`archive`){let{store:n}=e;return y(n),t(`Archived store: ${n}`,{display:`system`}),null}return t(F,{display:`system`}),null}var N,P,F,I,L,R,z;e((()=>{N=t(i(),1),o(),m(),u(),b(),T(),O(),S(),P=c(),F=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`,I=26,L=[{kind:`list`,label:`List`,description:`Show all stores`},{kind:`create`,label:`Create`,description:`Create a new memory store`},{kind:`store`,label:`Store`,description:`Write an entry: store name + key + value`},{kind:`fetch`,label:`Fetch`,description:`Read an entry by store name + key`},{kind:`entries`,label:`Entries`,description:`List entry keys in a store`},{kind:`archive`,label:`Archive`,description:`Archive a store (rename to *.archived)`},{kind:`about`,label:`About`,description:`Show command syntax`}],R=x({commandName:`local-memory`,parseArgs:e=>{let t=E(e);return t.action===`invalid`?{action:`invalid`,reason:`${F}\n${t.reason}`}:t},dispatch:M,View:C,errorView:e=>N.createElement(C,{mode:`error`,message:e})}),z=async(e,t,n)=>(n??``).trim()===``?(0,P.jsx)(j,{onDone:e}):R(e,t,n)}))();export{z as callLocalMemory};
|