@readmagic/workmate 0.0.5 → 0.0.6
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-DJRkEz7o.js → AddWorkspaceDirectory-ClHi-Dr6.js} +1 -1
- package/dist/chunks/{App-iJu5qyiF.js → App-BP06lHmf.js} +1 -1
- package/dist/chunks/{ApproveApiKey-CRejTHUw.js → ApproveApiKey-Bsy8kr2a.js} +1 -1
- package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-CBLQ1v-J.js → AssistantSessionChooser-CcocKoTJ.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-CyoLEYWH.js → BackgroundTasksDialog-DNeBhGCf.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-D1FCKVOi.js → BypassPermissionsModeDialog-BKj_3Idm.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-CI0yF6sZ.js → ClaudeMdExternalIncludesDialog-BD-7yAZh.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +1 -0
- package/dist/chunks/{DesktopHandoff-D1rrMxeP.js → DesktopHandoff-BmPmCfT3.js} +1 -1
- package/dist/chunks/{DiffDialog-BKcfKx7O.js → DiffDialog-C4XSSjvV.js} +1 -1
- package/dist/chunks/Doctor-BhD-ZzZm.js +1 -0
- package/dist/chunks/{Doctor-Yco1McrL.js → Doctor-DEQe2q16.js} +1 -1
- package/dist/chunks/{ExitFlow-D3csukbB.js → ExitFlow-BttnAv-O.js} +1 -1
- package/dist/chunks/{Feedback-bEUtrHia.js → Feedback-BaYA8-SU.js} +1 -1
- package/dist/chunks/Grove-BJziCbZH.js +11 -0
- package/dist/chunks/Grove-sWm-oLBf.js +1 -0
- package/dist/chunks/{HybridTransport-9fTBC2Pv.js → HybridTransport-B8V6O6rM.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-9M-1nfZ6.js → InvalidConfigDialog-CHzBSJDf.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-B2F6pryH.js → InvalidSettingsDialog-BKenH3bD.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-MWpKjeZT.js → MCPConnectionManager-CNh9dNlk.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-BPBb7Npe.js → McpParsingWarnings-Bj2-YL8o.js} +1 -1
- package/dist/chunks/{MessageSelector-DsQmqFt2.js → MessageSelector-DdR6wJhh.js} +1 -1
- package/dist/chunks/{Messages-B3sGRx5A.js → Messages-Ch6cboMV.js} +2 -2
- package/dist/chunks/{Onboarding-cHcnsBGp.js → Onboarding-BrAJp0aL.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-CWCD_RpM.js → OverageCreditUpsell-Ds1cB7RC.js} +1 -1
- package/dist/chunks/PluginSettings-CGqEzejq.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-D5sAO6y-.js → PromptInputFooterSuggestions-egs9VvUs.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-n6hAdsto.js → PromptInputHelpMenu-SieM5NoY.js} +1 -1
- package/dist/chunks/{QueryEngine-cwdsr4dr.js → QueryEngine-CZZMl3PB.js} +1 -1
- package/dist/chunks/{REPL-CJzScgbZ.js → REPL-CG2N7E4Q.js} +6 -6
- package/dist/chunks/REPL-DvA910N_.js +1 -0
- package/dist/chunks/{RemoteCallout-CiA4rCEs.js → RemoteCallout-Cs-ro8_i.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-zdHfmvfj.js → RemoteSessionManager-B740Dp6m.js} +1 -1
- package/dist/chunks/{ResumeConversation-Rxwd6HAJ.js → ResumeConversation-DzV2zmuX.js} +1 -1
- package/dist/chunks/{SSETransport-BPbhCa2f.js → SSETransport-DtpMDekF.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +1 -0
- package/dist/chunks/{Settings-CxI_KHUj.js → Settings-XKw6FI_m.js} +2 -2
- package/dist/chunks/{TeleportProgress-DrulEQ7z.js → TeleportProgress-rYaHIEfe.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-D3FOLr0P.js → TeleportRepoMismatchDialog-DY97YZMB.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-DI5iRFND.js → TeleportResumeWrapper-jaQzyTCh.js} +1 -1
- package/dist/chunks/{ThemePicker-CQ7dfFtv.js → ThemePicker-BViWzLp3.js} +1 -1
- package/dist/chunks/{TrustDialog-CnVKrdxQ.js → TrustDialog-DGJ_BisZ.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-CPYeuppg.js → ValidationErrorsList-B8pRiGuy.js} +1 -1
- package/dist/chunks/{WelcomeV2-C-UXdIng.js → WelcomeV2-DqnbSdIu.js} +1 -1
- package/dist/chunks/{add-dir-xTz4COgn.js → add-dir-C2Hu3oE4.js} +1 -1
- package/dist/chunks/{agentDisplay-BuSReYxu.js → agentDisplay-XoDJhr03.js} +1 -1
- package/dist/chunks/{agents-Du9KYHqN.js → agents-BIHTGDYh.js} +1 -1
- package/dist/chunks/{agents-CiLlKN2I.js → agents-C4QXeHIJ.js} +1 -1
- package/dist/chunks/{allErrors-P3utlEeA.js → allErrors-1896uQA1.js} +1 -1
- package/dist/chunks/{ant-CBIfqmAb.js → ant-B6k6cBts.js} +1 -1
- package/dist/chunks/api-BsFW57_Q.js +1 -0
- package/dist/chunks/{api-B-5jqiMg.js → api-gqTA-D7n.js} +1 -1
- package/dist/chunks/{assistant-XOnU01yl.js → assistant-DJ9hd4uC.js} +1 -1
- package/dist/chunks/auth-8Vd3_U8t.js +1 -0
- package/dist/chunks/{auth-DT2yxy94.js → auth-BnSrKyJe.js} +1 -1
- package/dist/chunks/auth-DRTjfnGy.js +1 -0
- package/dist/chunks/{autoMode-CEMflt3g.js → autoMode-BNukrVAB.js} +1 -1
- package/dist/chunks/{autonomy-_N8aDaA8.js → autonomy-BEmI7WVW.js} +1 -1
- package/dist/chunks/{autonomy-Cg5zweUa.js → autonomy-DGcy5Rml.js} +1 -1
- package/dist/chunks/{autonomyPanel-I4yCy3Fr.js → autonomyPanel-fhge09AG.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-DhF2lrQ9.js → backgroundHousekeeping-BVMf_Tjn.js} +2 -2
- package/dist/chunks/{branch-BIX-pyHp.js → branch-Bpe-gocq.js} +1 -1
- package/dist/chunks/{break-cache-BQfgkNAo.js → break-cache-C_p7Kmx2.js} +3 -3
- package/dist/chunks/{bridge-CYskzVt8.js → bridge-D12Shbkj.js} +2 -2
- package/dist/chunks/{bridgeConfig-5p_w4s5r.js → bridgeConfig-BhxRF2vm.js} +1 -1
- package/dist/chunks/bridgeConfig-CqIQ_rvD.js +1 -0
- package/dist/chunks/bridgeEnabled-D0XC5kNh.js +1 -0
- package/dist/chunks/{bridgeEnabled-DhFrLTbG.js → bridgeEnabled-SbB-6zdY.js} +1 -1
- package/dist/chunks/{bridgeMain-BX2AkLPs.js → bridgeMain-DHUpZFgL.js} +6 -6
- package/dist/chunks/bridgeMain-DUbQjgCp.js +1 -0
- package/dist/chunks/{bridgeMessaging-B5Lbzr8e.js → bridgeMessaging-DHc5dOhB.js} +1 -1
- package/dist/chunks/{btw-CWWFO7u8.js → btw-D9hMM5d2.js} +1 -1
- package/dist/chunks/caches-CWzT7e6Y.js +1 -0
- package/dist/chunks/{caches-DPqPIogk.js → caches-UeVVM3T0.js} +2 -2
- package/dist/chunks/{ccrClient-CTLnU9Y1.js → ccrClient-Iza0L8Zw.js} +1 -1
- package/dist/chunks/{clear-DCAgZwc4.js → clear-B4d38ssF.js} +1 -1
- package/dist/chunks/client-BzKQTXzF.js +1 -0
- package/dist/chunks/{color-CmJGInHL.js → color-D8VOyoYl.js} +1 -1
- package/dist/chunks/commands-DDamMmo4.js +1 -0
- package/dist/chunks/commitAttribution-CgohL8vD.js +1 -0
- package/dist/chunks/{commitAttribution-CGZr7XNO.js → commitAttribution-ChAgixdj.js} +1 -1
- package/dist/chunks/{compact-C6-lMHgn.js → compact-IFHwxjZ9.js} +1 -1
- package/dist/chunks/config-DY5-_kk_.js +1 -0
- package/dist/chunks/{config-3m_9zSrj.js → config-DmomySWC.js} +1 -1
- package/dist/chunks/config-WxgxrQoP.js +1 -0
- package/dist/chunks/{context-C9V4GF0n.js → context-Cl6BJ2vm.js} +1 -1
- package/dist/chunks/{context-noninteractive-BmC4o5xo.js → context-noninteractive-9hELVC29.js} +1 -1
- package/dist/chunks/context-noninteractive-Beij5MfU.js +1 -0
- package/dist/chunks/conversation-BBB91hEw.js +1 -0
- package/dist/chunks/{conversation-CYqqk0o7.js → conversation-BWVTM40Y.js} +1 -1
- package/dist/chunks/{createSSHSession-BL6j0AU5.js → createSSHSession-BM-5pbv6.js} +1 -1
- package/dist/chunks/createSession-CoQtL5Rj.js +1 -0
- package/dist/chunks/{createSession-D_sgO1Xy.js → createSession-Cvl1Q50F.js} +1 -1
- package/dist/chunks/{crossProjectResume-D5hTOfnE.js → crossProjectResume-BasMLl2n.js} +1 -1
- package/dist/chunks/{datadog-UkGdjL8-.js → datadog-CpqEQbHa.js} +1 -1
- package/dist/chunks/{desktop-HbYKh-VK.js → desktop-B_L6T6jI.js} +1 -1
- package/dist/chunks/{diff-nTV17iWX.js → diff-CVzOodeg.js} +1 -1
- package/dist/chunks/doctor-1L0TFuGw.js +1 -0
- package/dist/chunks/{entry-CCFI6-gM.js → entry-DHVYCR26.js} +1 -1
- package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-DXd10GXD.js → envLessBridgeConfig-Ck2-KMq0.js} +1 -1
- package/dist/chunks/{esm-CGoYrggU.js → esm-D5q6s4l8.js} +1 -1
- package/dist/chunks/{exit-ropaQiOr.js → exit-Bm1S_f3i.js} +1 -1
- package/dist/chunks/extra-usage-UHAWtypK.js +1 -0
- package/dist/chunks/{extra-usage-core-DLYHAInT.js → extra-usage-core-BFOolqoi.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-D8iszH3c.js → extra-usage-noninteractive-cUGZy0en.js} +1 -1
- package/dist/chunks/{extra-usage-g2Pw4zt_.js → extra-usage-zDHVtWKZ.js} +1 -1
- package/dist/chunks/{extraUsage-C2Ylufhj.js → extraUsage-Dq66zzqR.js} +1 -1
- package/dist/chunks/extractMemories-BcaklA33.js +1 -0
- package/dist/chunks/fast-DALAHO3d.js +1 -0
- package/dist/chunks/{fast-Dx2fTmWr.js → fast-MS7WZpD8.js} +1 -1
- package/dist/chunks/{feedback-DCQ4pJ3v.js → feedback-Fw4m28ZC.js} +1 -1
- package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-BNGPPBNP.js → firstPartyEventLogger-CoSUd0a1.js} +2 -2
- package/dist/chunks/{flushGate-XaheIZZT.js → flushGate-De-yppeo.js} +1 -1
- package/dist/chunks/{gemini-BCCLHK3K.js → gemini-BPziscyN.js} +1 -1
- package/dist/chunks/{generateRecap-BhvbixY2.js → generateRecap-jGDLI_wU.js} +1 -1
- package/dist/chunks/{generateSessionName-CN1oh7Fa.js → generateSessionName-hDJ6HBJ1.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-B4AM8luI.js → githubRepoPathMapping-qAoiyj6P.js} +1 -1
- package/dist/chunks/{goal-Bp6fyGqo.js → goal-CFx4eRkf.js} +1 -1
- package/dist/chunks/{grok-ax26ju8y.js → grok-Byblph7F.js} +1 -1
- package/dist/chunks/{grove-DrBVaZSN.js → grove-CpqjcGCb.js} +1 -1
- package/dist/chunks/{heapdump-JseysNDr.js → heapdump-C4kPlqGt.js} +1 -1
- package/dist/chunks/{help-DR9hKneR.js → help-B1h-faJ3.js} +1 -1
- package/dist/chunks/hooks-DPLIIpAD.js +1 -0
- package/dist/chunks/{hooks-C5n23H1E.js → hooks-X6J03MnA.js} +1 -1
- package/dist/chunks/hostGuard-BHI6Q8Mt.js +1 -0
- package/dist/chunks/inboundAttachments-BekVc0W-.js +1 -0
- package/dist/chunks/{inboundAttachments-Cp8XvLMZ.js → inboundAttachments-CUJE3KaU.js} +1 -1
- package/dist/chunks/{initReplBridge-DJs28ZkI.js → initReplBridge-JQ-afRx9.js} +1 -1
- package/dist/chunks/{install-C7qTB0V5.js → install-D5YORIJL.js} +1 -1
- package/dist/chunks/{instrumentation-CLZttr_u.js → instrumentation-Bw3CxPQf.js} +3 -3
- package/dist/chunks/{job-BhiazwPH.js → job-DOWtcltx.js} +1 -1
- package/dist/chunks/{keybindings-CkL8BzUt.js → keybindings-BLw5J-Zj.js} +1 -1
- package/dist/chunks/{language-DIw2871r.js → language-C6Fq-XOZ.js} +1 -1
- package/dist/chunks/language-Cqw5gYJR.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-j-mWpwW1.js → launchAgentsPlatform-jWWf-Lk9.js} +1 -1
- package/dist/chunks/{launchLocalMemory-DmoXp0Xo.js → launchLocalMemory-kHeD0I0y.js} +1 -1
- package/dist/chunks/{launchLocalVault-1uKe0HjA.js → launchLocalVault-DLqkOjmb.js} +1 -1
- package/dist/chunks/{launchMemoryStores-SxDKjHJ3.js → launchMemoryStores-Ct7AVXrO.js} +1 -1
- package/dist/chunks/{launchOnboarding-CTtpnXcs.js → launchOnboarding-Cc6WwPX9.js} +1 -1
- package/dist/chunks/{launchSchedule-BDVnGhaL.js → launchSchedule-ZyvuvjgU.js} +1 -1
- package/dist/chunks/{launchSkillStore-SmMLxp4K.js → launchSkillStore-BejQnLog.js} +1 -1
- package/dist/chunks/{launchTeleport-B472ZSGz.js → launchTeleport-8CuYUfIR.js} +1 -1
- package/dist/chunks/{launchVault-CsyBgxle.js → launchVault-DIvIOuPh.js} +1 -1
- package/dist/chunks/{loadAgentsDir-Clu7Uk6a.js → loadAgentsDir-D206qwP3.js} +47 -47
- package/dist/chunks/loadAgentsDir-TZjwTqdr.js +1 -0
- package/dist/chunks/{loadPluginHooks-Cvd5VdjQ.js → loadPluginHooks-Ddhsyn0_.js} +1 -1
- package/dist/chunks/{localSearch-iA6JTk19.js → localSearch-CzrbOklu.js} +1 -1
- package/dist/chunks/localSearch-DrOAL6f4.js +1 -0
- package/dist/chunks/{logoV2Utils-YHBJLIrC.js → logoV2Utils-8M56V7oN.js} +1 -1
- package/dist/chunks/{magicDocs-Bf1fqnHN.js → magicDocs-DWjL2k7P.js} +1 -1
- package/dist/chunks/{main-gtV_TqXP.js → main-BohPzJFF.js} +16 -16
- package/dist/chunks/{mappers-C8lYERPX.js → mappers-BDMZFgKx.js} +1 -1
- package/dist/chunks/{mcp-Ci0OPVrR.js → mcp-Bt1ITh-Z.js} +1 -1
- package/dist/chunks/{mcp-CNuhEGP6.js → mcp-CwJ-AIpt.js} +2 -2
- package/dist/chunks/{mcp-CwIYauZl.js → mcp-W0LFoyFR.js} +1 -1
- package/dist/chunks/{memory-DCGqfQ1U.js → memory-3wV7m7UU.js} +1 -1
- package/dist/chunks/{mode-DO6g7nkX.js → mode-CUkHFkju.js} +1 -1
- package/dist/chunks/{model-DLXL0CNu.js → model-BY3auM2c.js} +1 -1
- package/dist/chunks/model-CKkOnnnx.js +1 -0
- package/dist/chunks/model-DRXcJyU9.js +1 -0
- package/dist/chunks/{nativeInstaller-OPuO2sm_.js → nativeInstaller-CA5d6_G7.js} +1 -1
- package/dist/chunks/{onChangeAppState-CHhRDkM7.js → onChangeAppState-DBmy2Ow_.js} +1 -1
- package/dist/chunks/{openai-HOebt-8k.js → openai-Cbomn0Ws.js} +1 -1
- package/dist/chunks/{overageCreditGrant-Bi1CTBAx.js → overageCreditGrant-DsUrmeBh.js} +1 -1
- package/dist/chunks/{panel-CrTPqXCv.js → panel-BSZGX6jN.js} +1 -1
- package/dist/chunks/{panelCall-D0eURklm.js → panelCall-BsVoL1uF.js} +1 -1
- package/dist/chunks/{partition-C8RSL3SQ.js → partition-BAakXjvj.js} +1 -1
- package/dist/chunks/{passes-BJci5SM_.js → passes-CLRt7Cvm.js} +1 -1
- package/dist/chunks/{permissions-JU9CGHgI.js → permissions-BVSFuwNP.js} +1 -1
- package/dist/chunks/{pidLock-Bd2e6xuT.js → pidLock-D5rUnDB-.js} +2 -2
- package/dist/chunks/{plan-D4gMsK7i.js → plan-SYZ4DXR8.js} +1 -1
- package/dist/chunks/{plugin-CwCo5Kik.js → plugin-Bfjzhmrk.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CO-n9bqe.js → pluginAutoupdate-reO2PgtQ.js} +1 -1
- package/dist/chunks/{pluginBlocklist-5qbaTRbV.js → pluginBlocklist-C3H2afWG.js} +1 -1
- package/dist/chunks/{pluginCliCommands-I-lsw_us.js → pluginCliCommands-lqdxdkQp.js} +1 -1
- package/dist/chunks/{pluginFlagging-DNPBbJZo.js → pluginFlagging-D9HKAGBC.js} +1 -1
- package/dist/chunks/{pluginOperations-Cz6eQ0Vu.js → pluginOperations-EN3EKLux.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DJ9fslCK.js → pluginStartupCheck-BY73BMT2.js} +1 -1
- package/dist/chunks/pluginStartupCheck-CwWOlveD.js +1 -0
- package/dist/chunks/{plugins-CzJIuPfb.js → plugins-Dn6ceWrT.js} +1 -1
- package/dist/chunks/policyLimits-CkTI5KEt.js +1 -0
- package/dist/chunks/{poor-Dha9p9RF.js → poor-j-y-bv8o.js} +1 -1
- package/dist/chunks/{poorMode-1NLYiS3Y.js → poorMode-DhzFKpPl.js} +1 -1
- package/dist/chunks/poorMode-V11s-3cf.js +1 -0
- package/dist/chunks/{print-BL4EUT5Z.js → print-Db_VXmfO.js} +4 -4
- package/dist/chunks/{privacy-settings-6ZWxR4Qt.js → privacy-settings-DHMJREbb.js} +1 -1
- package/dist/chunks/{processBashCommand-BZs9wggV.js → processBashCommand-BcM_fhV9.js} +1 -1
- package/dist/chunks/{processSlashCommand-D8lKLNzM.js → processSlashCommand-DEVo3GPX.js} +1 -1
- package/dist/chunks/{prompt-Bg_1U0gO.js → prompt-BNHtszmZ.js} +1 -1
- package/dist/chunks/prompt-CrX31AGm.js +1 -0
- package/dist/chunks/prompt-IAvMxKDl.js +1 -0
- package/dist/chunks/{promptEditor-BhYDmwdS.js → promptEditor-DeMrXUir.js} +1 -1
- package/dist/chunks/{protocolHandler-Dnb7lITm.js → protocolHandler-BHxBy84Z.js} +1 -1
- package/dist/chunks/{rate-limit-options-DVzT3eWH.js → rate-limit-options-DIudL9fb.js} +1 -1
- package/dist/chunks/{rcDebugLog-VKwMl0yg.js → rcDebugLog-CUy1_F23.js} +1 -1
- package/dist/chunks/{reconciler-BdRXZTJf.js → reconciler-BXpPyfSY.js} +1 -1
- package/dist/chunks/{referral-BlrMpBAV.js → referral-CUaIo_vT.js} +1 -1
- package/dist/chunks/{refresh-jwqnoK2h.js → refresh-CuaVBIQ0.js} +1 -1
- package/dist/chunks/{registerProtocol-CuKZAiCc.js → registerProtocol-B7Fzdofu.js} +1 -1
- package/dist/chunks/{release-notes-BgP8u7NE.js → release-notes-fbfv2DC0.js} +1 -1
- package/dist/chunks/{releaseNotes-CunqVlbU.js → releaseNotes-CxAHFLPl.js} +2 -2
- package/dist/chunks/{reload-plugins-CD9TzvFm.js → reload-plugins-B9IT9CFA.js} +1 -1
- package/dist/chunks/{remote-env-QaP_W_sv.js → remote-env-BOklGlll.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-9-HVMo63.js → remoteBridgeCore-j0bG1zjv.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-jZ6u8ZBT.js → remoteManagedSettings-Cq994lyc.js} +1 -1
- package/dist/chunks/{rename-29qxHf8W.js → rename-Iev7wQsI.js} +1 -1
- package/dist/chunks/{resume-D-SpOy_1.js → resume-y7MCTZHJ.js} +1 -1
- package/dist/chunks/{runtimeObserver-DOEcrylu.js → runtimeObserver-BZcJ1FbH.js} +1 -1
- package/dist/chunks/{runtimeObserver-Dm3LIUMp.js → runtimeObserver-CyzLASla.js} +2 -2
- package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +1 -0
- package/dist/chunks/{sandbox-toggle-B61AeBor.js → sandbox-toggle-CWpBO228.js} +1 -1
- package/dist/chunks/searchExtraTools-BUOUds7p.js +1 -0
- package/dist/chunks/{session-RwJCIIcs.js → session-DL4cA_8l.js} +1 -1
- package/dist/chunks/{sessionDiscovery-dkFeWcA3.js → sessionDiscovery-DAfNKqp1.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +1 -0
- package/dist/chunks/{sessionMemory-btARBn8H.js → sessionMemory-BS8_TbKj.js} +1 -1
- package/dist/chunks/sessionMemory-D5fSHXvZ.js +1 -0
- package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +1 -0
- package/dist/chunks/sessionObserver-ChfQtK2m.js +1 -0
- package/dist/chunks/{sessionObserver-CSOYgsvH.js → sessionObserver-ShbCwJ8x.js} +1 -1
- package/dist/chunks/sessionStorage-Cf5wmnyB.js +1 -0
- package/dist/chunks/{sessionTitle-CLOlPZ_M.js → sessionTitle-coed9IuJ.js} +1 -1
- package/dist/chunks/{sessionTracing-D8wr9j4X.js → sessionTracing-D9rUyiq0.js} +1 -1
- package/dist/chunks/{settings-Dlp5JTa_.js → settings-BovzmwMP.js} +2 -2
- package/dist/chunks/{settingsSync-QWA0VZSu.js → settingsSync-PqU9XGJq.js} +1 -1
- package/dist/chunks/{setup-UI9uv2-K.js → setup-B_FOvNpp.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-CXsmUY2o.js → shadowedRuleDetection-D1wsAdpp.js} +1 -1
- package/dist/chunks/{sideQuestion-CHpOVzY5.js → sideQuestion-wSi38p81.js} +1 -1
- package/dist/chunks/sinks-BpcRrN_T.js +1 -0
- package/dist/chunks/{sinks-1hFrW9HK.js → sinks-C_Dl1p4K.js} +2 -2
- package/dist/chunks/{skill-learning-Ck17rwH8.js → skill-learning-B5tmc7EX.js} +1 -1
- package/dist/chunks/{skillChangeDetector-s0F9Yf9a.js → skillChangeDetector-DNqohXxz.js} +1 -1
- package/dist/chunks/{skillGapStore-BJ1h2LVr.js → skillGapStore-D-kQKVDZ.js} +1 -1
- package/dist/chunks/{skillGapStore-DyqNKuNy.js → skillGapStore-Df5BWAk5.js} +2 -2
- package/dist/chunks/{skillGenerator-BT8NGzXT.js → skillGenerator-DbcdpAkw.js} +2 -2
- package/dist/chunks/skillLearning-C5cXZE6_.js +1 -0
- package/dist/chunks/{skillLearning-Cn9Uw0Kd.js → skillLearning-ClRiDcJH.js} +1 -1
- package/dist/chunks/{skillPanel-N0GoWjIi.js → skillPanel-LBd4E-MM.js} +3 -3
- package/dist/chunks/{skillSearchPanel-CTwtgTzy.js → skillSearchPanel-CErRnUwo.js} +2 -2
- package/dist/chunks/{skills-Bv3lH-aA.js → skills-CBKhfg_a.js} +1 -1
- package/dist/chunks/{stats-C1Ff6w4i.js → stats-BY4dskVg.js} +1 -1
- package/dist/chunks/{status-DyXiBa0m.js → status-BnJIXtKl.js} +2 -2
- package/dist/chunks/{status-FD7HVYS7.js → status-DU-B4SMW.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-kTp9Rdk6.js → statusNoticeHelpers-CzTuGNuC.js} +1 -1
- package/dist/chunks/{tag-RzOSA5T0.js → tag-B-wVW9Aj.js} +1 -1
- package/dist/chunks/{tasks-eJrOcdhB.js → tasks-CBVL005y.js} +1 -1
- package/dist/chunks/{teleport-ABA-hdmP.js → teleport-dtqQXM4x.js} +1 -1
- package/dist/chunks/{templateJobs-BnOBSFtq.js → templateJobs-D6998LcG.js} +1 -1
- package/dist/chunks/{terminalSetup-BfvmoJaK.js → terminalSetup-0SBdyKF5.js} +1 -1
- package/dist/chunks/{terminalSetup-D_P5iZmq.js → terminalSetup-CuV-qU6v.js} +1 -1
- package/dist/chunks/{theme-S0kVMVt4.js → theme-p0AooruD.js} +1 -1
- package/dist/chunks/thinkback-Catprqs_.js +1 -0
- package/dist/chunks/{thinkback-HyW_R_88.js → thinkback-DI2NpvG-.js} +1 -1
- package/dist/chunks/{thinkback-play-H6md4czq.js → thinkback-play-CqrIRx2o.js} +1 -1
- package/dist/chunks/{toolEventObserver-BAFzvePj.js → toolEventObserver-DTccwC3c.js} +1 -1
- package/dist/chunks/{toolEventObserver--Z6jENks.js → toolEventObserver-DlH73w-S.js} +1 -1
- package/dist/chunks/{toolPool-CR61XXm3.js → toolPool-B64V-jmK.js} +1 -1
- package/dist/chunks/{trustedDevice-Dn4rXbxT.js → trustedDevice-BTYoQCkC.js} +1 -1
- package/dist/chunks/trustedDevice-CiwjT_Y6.js +1 -0
- package/dist/chunks/{ultrareviewCommand-mYDTBCFD.js → ultrareviewCommand-BDFUS3hf.js} +1 -1
- package/dist/chunks/undercover-XYapZ_SS.js +1 -0
- package/dist/chunks/{undercover-CdapzvNH.js → undercover-vuTpCnQJ.js} +2 -2
- package/dist/chunks/{updateCCB-DPShheOr.js → updateCCB-DFL5Wt_I.js} +1 -1
- package/dist/chunks/{upgrade-BOeakAP6.js → upgrade-D5qwcaWQ.js} +1 -1
- package/dist/chunks/upgrade-DIg3j929.js +1 -0
- package/dist/chunks/{upload-BXQsDtLW.js → upload-B_yADHX9.js} +1 -1
- package/dist/chunks/{usage-iNQzY960.js → usage-C0SnnC-i.js} +1 -1
- package/dist/chunks/usage-CYJKE8N6.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CntByfTQ.js → useExitOnCtrlCDWithKeybindings-DKIqRraH.js} +1 -1
- package/dist/chunks/useMainLoopModel-XetDUXd-.js +1 -0
- package/dist/chunks/{useManagePlugins-B8HD0RUh.js → useManagePlugins-B2KhKiu5.js} +1 -1
- package/dist/chunks/{useMergedTools-DfchLQZC.js → useMergedTools-CKvwz_Zt.js} +1 -1
- package/dist/chunks/{useSearchInput-H-8hJeFD.js → useSearchInput-D1Vr2Js1.js} +1 -1
- package/dist/chunks/{useSettingsErrors-BF5i5Xju.js → useSettingsErrors-B7BXHchG.js} +1 -1
- package/dist/chunks/{util-CoicMvOv.js → util-BaDs-wL5.js} +1 -1
- package/dist/chunks/{validatePlugin-z2fcngf8.js → validatePlugin-DtiYlXby.js} +1 -1
- package/dist/chunks/{vim-DdvQlLDm.js → vim-C-icQDz1.js} +1 -1
- package/dist/chunks/{workerRegistry-CzqQwCHC.js → workerRegistry-ChqPPIaO.js} +1 -1
- package/dist/chunks/worktree-DAn8ooa1.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-CKfn7U1R.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +0 -1
- package/dist/chunks/Doctor-CcJUwSQn.js +0 -1
- package/dist/chunks/Grove-DPkIjqg8.js +0 -1
- package/dist/chunks/Grove-Dsd7F39b.js +0 -11
- package/dist/chunks/PluginSettings-B0jbwB2M.js +0 -17
- package/dist/chunks/REPL-DlBJIPCw.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +0 -1
- package/dist/chunks/api-BiwZmmsh.js +0 -1
- package/dist/chunks/auth-BQa4kzQo.js +0 -1
- package/dist/chunks/auth-UAJhZNmZ.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +0 -1
- package/dist/chunks/bridgeConfig-DWEqKbXk.js +0 -1
- package/dist/chunks/bridgeEnabled-CjVCMwnq.js +0 -1
- package/dist/chunks/bridgeMain-6lollTtZ.js +0 -1
- package/dist/chunks/caches-C46fa77L.js +0 -1
- package/dist/chunks/client-Bup0Sgcn.js +0 -1
- package/dist/chunks/commands-BdB1eFvP.js +0 -1
- package/dist/chunks/commitAttribution-D6J3NuhB.js +0 -1
- package/dist/chunks/config-Bxt1UH1T.js +0 -1
- package/dist/chunks/config-CjjXZfNi.js +0 -1
- package/dist/chunks/context-noninteractive-DvGo1l7b.js +0 -1
- package/dist/chunks/conversation-CH9ouFai.js +0 -1
- package/dist/chunks/createSession-DUfOAeyE.js +0 -1
- package/dist/chunks/doctor-7fgVhEKL.js +0 -1
- package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +0 -1
- package/dist/chunks/extra-usage-CLhv1Z4g.js +0 -1
- package/dist/chunks/extractMemories-B2IAvbXM.js +0 -1
- package/dist/chunks/fast-_G6zcFye.js +0 -1
- package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +0 -1
- package/dist/chunks/hooks-BUJLxdFJ.js +0 -1
- package/dist/chunks/hostGuard-C5xydXZI.js +0 -1
- package/dist/chunks/inboundAttachments-C0nMTtCi.js +0 -1
- package/dist/chunks/language-DfOAuDFc.js +0 -1
- package/dist/chunks/loadAgentsDir-DTbJJff-.js +0 -1
- package/dist/chunks/localSearch-DKv8PRLD.js +0 -1
- package/dist/chunks/model-BQF64tZx.js +0 -1
- package/dist/chunks/model-DvrvG6BB.js +0 -1
- package/dist/chunks/pluginStartupCheck-CoW7073W.js +0 -1
- package/dist/chunks/policyLimits-BkjgMQD0.js +0 -1
- package/dist/chunks/poorMode-qlxqU8Hm.js +0 -1
- package/dist/chunks/prompt-CN7gBNKS.js +0 -1
- package/dist/chunks/prompt-D-zHhqp8.js +0 -1
- package/dist/chunks/sandbox-adapter-LzTcKwBp.js +0 -1
- package/dist/chunks/searchExtraTools-CbJJQqzH.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +0 -1
- package/dist/chunks/sessionMemory-C4JAUZ6V.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +0 -1
- package/dist/chunks/sessionObserver-DMvWci8-.js +0 -1
- package/dist/chunks/sessionStorage-Diyuvt20.js +0 -1
- package/dist/chunks/sinks-CXq8-7Qn.js +0 -1
- package/dist/chunks/skillLearning-1ZfYIzfL.js +0 -1
- package/dist/chunks/thinkback-C6gV2LpU.js +0 -1
- package/dist/chunks/trustedDevice-DUrFWupL.js +0 -1
- package/dist/chunks/undercover-k3JoOKAb.js +0 -1
- package/dist/chunks/upgrade-D7iGU0PQ.js +0 -1
- package/dist/chunks/usage-DbRdMJog.js +0 -1
- package/dist/chunks/useMainLoopModel-DHkRIgNs.js +0 -1
- package/dist/chunks/worktree-DMhP5T0p.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
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-Dlp5JTa_.js";import{b as Ae,c as je,g as Me,n as Ne}from"./config-3m_9zSrj.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{$n as We,Bt as Ge,Ft as Ke,Gt as qe,Mt as Je,Vt as Ye,ar as Xe,ir as Ze,or as Qe,rr as $e,zt as et}from"./model-BQF64tZx.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-CGoYrggU.js";import{_ as Mt,b as Nt,c as Pt,l as Ft,r as It,v as Lt,y as Rt}from"./sessionTracing-D8wr9j4X.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}, \
|
|
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-BovzmwMP.js";import{b as Ae,c as je,g as Me,n as Ne}from"./config-DmomySWC.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{$n as We,Bt as Ge,Ft as Ke,Gt as qe,Mt as Je,Vt as Ye,ar as Xe,ir as Ze,or as Qe,rr as $e,zt as et}from"./model-CKkOnnnx.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-D5q6s4l8.js";import{_ as Mt,b as Nt,c as Pt,l as Ft,r as It,v as Lt,y as Rt}from"./sessionTracing-D9rUyiq0.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
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.
|
|
@@ -9,7 +9,7 @@ To resolve the conflict:`,br(t,e))),n=r):m.warn(`A view or instrument with the n
|
|
|
9
9
|
`,hr(t,e),`To resolve the conflict:
|
|
10
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(),Ge(),Me(),b(),De(),$e(),Ie(),Re(),Pe(),Qe();var Di=3600*1e3,Oi=1440*60*1e3;async function ki(){let e=We();if(e.error)throw Error(`Auth error: ${e.error}`);let t={"Content-Type":`application/json`,"User-Agent":Xe(),...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 Ze(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()&&!et())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(),Ge(),Me(),b(),De(),$e(),Ie(),Qe(),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=We();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":Xe(),...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(),Ge(),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
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 Ye()||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.
|
|
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 Ye()||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.6`)),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.6`};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.6`)}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.6`)),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.6`)}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-D6998LcG.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AS as t,IS as n,LS as r,PS as i,RS as a,jS as o,kS as s,zS as c}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AS as t,IS as n,LS as r,PS as i,RS as a,jS as o,kS as s,zS as c}from"./loadAgentsDir-D206qwP3.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-DeMrXUir.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(i.map(e=>r(e.key)));return e.map(e=>{let n={};for(let[i,a]of Object.entries(e.bindings))t.has(r(i))||(n[i]=a);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(a)},null,2)+`
|
|
2
2
|
`}var b=e((()=>{u(),c(),n()}));async function x(){if(!o())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=s(),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 n=await m(e);return n.error?{type:`text`,value:`${t?`Opened`:`Created`} ${e}. Could not open in editor: ${n.error}`}:{type:`text`,value:t?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{t(),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-DmomySWC.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-C6Fq-XOZ.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-gqTA-D7n.js";import{n as g,r as _,t as v}from"./cron-3LntnnhJ.js";import{n as y,r as b}from"./hostGuard-BHI6Q8Mt.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.`,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,Fx as f,Od as p,Px as m,Sd as h,Td as g,bd as _,wd as v,xd as y,yd as b}from"./loadAgentsDir-
|
|
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,Fx as f,Od as p,Px as m,Sd as h,Td as g,bd as _,wd as v,xd as y,yd as b}from"./loadAgentsDir-D206qwP3.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
3
|
`)}function j({onDone:e}){let[t,i]=N.useState({kind:`menu`}),[o,c]=N.useState(0),[u,f]=N.useState(``),[h,x]=N.useState(0),[S,C]=N.useState(null),w=N.useCallback(e=>{i(e),f(``),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(g()));return}if(e===`about`){T(F);return}if(!t){C(`Internal: missing store`);return}if(e===`create`){_(t),T(`Store created: ${t}`);return}if(e===`entries`){let e=v(t);T(A(t,e));return}if(e===`archive`){b(t),T(`Archived store: ${t}`);return}if(e===`fetch`){if(!n){C(`Internal: missing key`);return}let e=y(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&&y(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)(m,{value:u,onChange:e=>{f(e),C(null)},cursorOffset:h,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(!p(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(g()),{display:`system`}),null;if(e.action===`create`){let{store:n}=e;return _(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=y(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,v(n)),{display:`system`}),null}if(e.action===`archive`){let{store:n}=e;return b(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(),h(),u(),f(),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};
|
|
@@ -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{Dd as l,Fx as u,Od as d,Px as f,_d as p,gd as m,hd as h,md as g,pd as _,vd as v}from"./loadAgentsDir-
|
|
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{Dd as l,Fx as u,Od as d,Px as f,_d as p,gd as m,hd as h,md as g,pd as _,vd as v}from"./loadAgentsDir-D206qwP3.js";import{n as y,t as b}from"./launchCommand-1qkTCKpf.js";function x(e){return e.mode===`list`?e.keys.length===0?(0,S.jsx)(n,{children:(0,S.jsx)(r,{dimColor:!0,children:`No secrets stored. Use /local-vault set <key> <value> to add one.`})}):(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsx)(n,{marginBottom:1,children:(0,S.jsxs)(r,{bold:!0,children:[`Local Vault Keys (`,e.keys.length,`)`]})}),e.keys.map(e=>(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{children:` `}),(0,S.jsx)(r,{color:`success`,children:`●`}),(0,S.jsxs)(r,{children:[` `,e]})]},e))]}):e.mode===`set-ok`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Secret stored: `}),(0,S.jsx)(r,{bold:!0,children:e.key}),(0,S.jsx)(r,{dimColor:!0,children:` = [REDACTED]`})]}):e.mode===`get-masked`?(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{bold:!0,children:e.key}),(0,S.jsx)(r,{dimColor:!0,children:`: `}),(0,S.jsx)(r,{children:e.masked})]}),(0,S.jsx)(n,{marginTop:1,children:(0,S.jsxs)(r,{dimColor:!0,children:[`Use /local-vault get `,e.key,` --reveal to see the full value.`]})})]}):e.mode===`get-revealed`?(0,S.jsxs)(n,{flexDirection:`column`,children:[(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{bold:!0,children:e.key}),(0,S.jsx)(r,{dimColor:!0,children:`: `}),(0,S.jsx)(r,{color:`warning`,children:e.value})]}),(0,S.jsx)(n,{marginTop:1,children:(0,S.jsx)(r,{dimColor:!0,color:`warning`,children:`⚠ Secret revealed in terminal — clear scrollback if this session is shared.`})})]}):e.mode===`not-found`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`error`,children:`Key not found: `}),(0,S.jsx)(r,{bold:!0,children:e.key})]}):e.mode===`deleted`?(0,S.jsxs)(n,{children:[(0,S.jsx)(r,{color:`success`,children:`✓`}),(0,S.jsx)(r,{children:` Deleted: `}),(0,S.jsx)(r,{bold:!0,children:e.key})]}):(0,S.jsx)(n,{children:(0,S.jsxs)(r,{color:`error`,children:[`Error: `,e.message]})})}var S,C=e((()=>{i(),o(),S=c()}));function w(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===`set`){let e=n[1];if(!e)return{action:`invalid`,reason:`set requires a key name. ${T}`};if(E.test(e))return{action:`invalid`,reason:`Key name must not start with "-" or a hyphen-like character (reserved for flags). ${T}`};let t=n.slice(2).join(` `);return t?{action:`set`,key:e,value:t}:{action:`invalid`,reason:`set requires a value. ${T}`}}if(r===`get`){let e=[`--reveal`],t=n.filter(t=>!e.includes(t))[1];return t?{action:`get`,key:t,reveal:n.includes(`--reveal`)}:{action:`invalid`,reason:`get requires a key name. ${T}`}}if(r===`delete`){let e=n[1];return e?{action:`delete`,key:e}:{action:`invalid`,reason:`delete requires a key name. ${T}`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${T}`}}var T,E,D=e((()=>{T=`Usage: /local-vault list | set KEY VALUE | get KEY [--reveal] | delete KEY`,E=/^[-‐-―−﹘﹣-]/}));function O(e){return e.length===0?`No secrets stored.`:[`Local Vault Keys`,...e.map(e=>`- ${e}`)].join(`
|
|
2
2
|
`)}function k({onDone:e}){let[t,i]=j.useState({kind:`menu`}),[o,c]=j.useState(0),[l,u]=j.useState(``),[h,y]=j.useState(0),[b,x]=j.useState(null),[S,C]=j.useState(!1),w=j.useCallback(e=>{i(e),u(``),y(0),x(null)},[]),T=j.useCallback(t=>e(t,{display:`system`}),[e]);a((e,n)=>{if(t.kind!==`menu`||S)return;if(n.upArrow){c(e=>Math.max(0,e-1));return}if(n.downArrow){c(e=>Math.min(F.length-1,e+1));return}if(n.return){let e=F[o];if(!e)return;if(e.kind===`about`){T(N);return}if(e.kind===`list`){C(!0),m().then(e=>{T(O(e))});return}w({kind:`collect-key`,action:e.kind});return}let r=Number(e);Number.isInteger(r)&&r>=1&&r<=F.length&&c(r-1)},{isActive:t.kind===`menu`&&!S}),a((e,n)=>{if(t.kind!==`confirm-overwrite`&&t.kind!==`confirm-delete`)return;if(n.escape){w({kind:`menu`});return}let r=e.toLowerCase();if(r===`y`||n.return)if(t.kind===`confirm-delete`){C(!0);let e=t.key;_(e).then(t=>{T(t?`Deleted: ${e}`:`Key not found: ${e}`)})}else{C(!0);let e=t.key,n=t.value;v(e,n).then(()=>T(`Secret stored: ${e} = [REDACTED]`)).catch(t=>T(`Failed to store ${e}: ${t instanceof Error?t.message:String(t)}`))}else r===`n`&&w({kind:`menu`})},{isActive:(t.kind===`confirm-overwrite`||t.kind===`confirm-delete`)&&!S}),a((e,n)=>{if(!(t.kind!==`collect-key`&&t.kind!==`collect-value`)&&n.escape){if(t.kind===`collect-value`){w({kind:`collect-key`,action:`set`});return}w({kind:`menu`})}},{isActive:(t.kind===`collect-key`||t.kind===`collect-value`)&&!S});let E=e=>{let n=e.trim();if(!n){x(`Key required`);return}if(!d(n)){x(`Invalid key (allowed: letters/digits/._- only; no leading dot; not a Windows reserved name)`);return}if(t.kind===`collect-key`){if(t.action===`get`){C(!0),g(n).then(e=>{T(e===null?`Key not found: ${n}`:`Key found: ${n} = ${p(e)}`)});return}if(t.action===`delete`){w({kind:`confirm-delete`,key:n});return}if(t.action===`set`){w({kind:`collect-value`,key:n});return}}},D=e=>{if(t.kind!==`collect-value`)return;if(e.length===0){x(`Secret value cannot be empty`);return}let n=t.key;C(!0),g(n).then(t=>{if(t!==null){C(!1),w({kind:`confirm-overwrite`,key:n,value:e});return}return v(n,e).then(()=>T(`Secret stored: ${n} = [REDACTED]`))}).catch(e=>T(`Failed to store ${n}: ${e instanceof Error?e.message:String(e)}`))};if(t.kind===`menu`)return(0,M.jsx)(s,{title:`Local Vault`,subtitle:`${F.length} actions`,onCancel:()=>T(`Local vault panel dismissed`),color:`background`,hideInputGuide:!0,children:(0,M.jsxs)(n,{flexDirection:`column`,children:[F.map((e,t)=>(0,M.jsxs)(n,{flexDirection:`row`,children:[(0,M.jsx)(r,{children:`${t===o?`›`:` `} ${e.label}`.padEnd(P)}),(0,M.jsx)(r,{dimColor:!0,children:e.description})]},e.kind)),S&&(0,M.jsx)(n,{marginTop:1,children:(0,M.jsx)(r,{dimColor:!0,children:`Working...`})}),(0,M.jsx)(n,{marginTop:1,children:(0,M.jsx)(r,{dimColor:!0,children:`↑/↓ or 1-5 select · Enter run · Esc close`})})]})});if(t.kind===`confirm-delete`)return(0,M.jsx)(s,{title:`Confirm Delete`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,M.jsxs)(n,{flexDirection:`column`,children:[(0,M.jsxs)(r,{children:[`Delete secret "`,t.key,`"? This cannot be undone.`]}),(0,M.jsx)(n,{marginTop:1,children:(0,M.jsx)(r,{dimColor:!0,children:`y/Enter = delete · n/Esc = cancel`})}),S&&(0,M.jsx)(r,{dimColor:!0,children:`Deleting...`})]})});if(t.kind===`confirm-overwrite`)return(0,M.jsx)(s,{title:`Confirm Overwrite`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,M.jsxs)(n,{flexDirection:`column`,children:[(0,M.jsxs)(r,{children:[`Secret "`,t.key,`" already exists. Overwrite? Old value is lost.`]}),(0,M.jsx)(n,{marginTop:1,children:(0,M.jsx)(r,{dimColor:!0,children:`y/Enter = overwrite · n/Esc = cancel`})}),S&&(0,M.jsx)(r,{dimColor:!0,children:`Storing...`})]})});let k=t.kind===`collect-key`?`KEY NAME`:`SECRET VALUE`,A=t.kind===`collect-key`?`e.g. github-token`:`(masked input — value never displayed)`,I=t.kind===`collect-key`?E:D,L=t.kind===`collect-value`;return(0,M.jsx)(s,{title:`Local Vault · ${t.kind===`collect-key`?`KEY`:`VALUE`}`,onCancel:()=>w({kind:`menu`}),color:`background`,hideInputGuide:!0,children:(0,M.jsxs)(n,{flexDirection:`column`,children:[(0,M.jsx)(n,{children:(0,M.jsx)(r,{dimColor:!0,children:k})}),(0,M.jsxs)(n,{children:[(0,M.jsx)(r,{children:`> `}),(0,M.jsx)(f,{value:l,onChange:e=>{u(e),x(null)},cursorOffset:h,onChangeCursorOffset:y,onSubmit:I,placeholder:A,columns:70,showCursor:!0,mask:L?`*`:void 0})]}),b!==null&&(0,M.jsx)(n,{marginTop:0,children:(0,M.jsxs)(r,{color:`warning`,children:[`✗ `,b]})}),S&&(0,M.jsx)(n,{marginTop:0,children:(0,M.jsx)(r,{dimColor:!0,children:`Working...`})}),(0,M.jsx)(n,{marginTop:1,children:(0,M.jsx)(r,{dimColor:!0,children:`Enter = next · Esc = back`})})]})})}async function A(e,t){if(e.action===`list`)return t(O(await m()),{display:`system`}),null;if(e.action===`set`){let{key:n,value:r}=e;return await v(n,r),t(`Secret stored: ${n} = [REDACTED]`,{display:`system`}),null}if(e.action===`get`){let{key:n,reveal:r}=e,i=await g(n);return i===null?(t(`Key not found: ${n}`,{display:`system`}),null):r?(t([`Secret revealed for: ${n}`,`Warning: secret revealed in terminal.`,`${n} = ${i}`].join(`
|
|
3
3
|
`),{display:`system`}),null):(t(`Key found: ${n} = ${p(i)}`,{display:`system`}),null)}if(e.action===`delete`){let{key:n}=e;return await _(n)?(t(`Deleted: ${n}`,{display:`system`}),null):(t(`Key not found: ${n}`,{display:`system`}),null)}return t(N,{display:`system`}),null}var j,M,N,P,F,I,L;e((()=>{j=t(i(),1),o(),h(),l(),u(),C(),D(),b(),M=c(),N=`Usage: /local-vault list | set KEY VALUE | get KEY [--reveal] | delete KEY`,P=26,F=[{kind:`list`,label:`List`,description:`Show stored secret keys`},{kind:`set`,label:`Set`,description:`Store a secret: KEY + VALUE (input is masked)`},{kind:`get`,label:`Get`,description:`Look up a secret (returns masked preview)`},{kind:`delete`,label:`Delete`,description:`Delete a stored secret by KEY`},{kind:`about`,label:`About`,description:`Show command syntax`}],I=y({commandName:`local-vault`,parseArgs:e=>{let t=w(e);return t.action===`invalid`?{action:`invalid`,reason:`${N}\n${t.reason}`}:t},dispatch:A,View:x,errorView:e=>j.createElement(x,{mode:`error`,message:e})}),L=async(e,t,n)=>(n??``).trim()===``?(0,M.jsx)(k,{onDone:e}):I(e,t,n)}))();export{L as callLocalVault};
|
|
@@ -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-B-5jqiMg.js";import{n as g,r as _}from"./hostGuard-C5xydXZI.js";import{n as v,t as y}from"./launchCommand-1qkTCKpf.js";function b(e){return new Promise(t=>setTimeout(t,e))}async function x(){let e;try{e=(await h()).apiKey}catch(e){let t=e instanceof Error?e.message:String(e);throw new z(t,501)}return g(S()),{"x-api-key":e,"anthropic-version":`2023-06-01`,"anthropic-beta":L,"content-type":`application/json`}}function S(){return`${f().BASE_API_URL}/v1/memory_stores`}function C(e){if(r.isAxiosError(e)){let t=e.response?.status??0;if(t===401)return new z(`Authentication failed.`,401);if(t===403)return new z(`Subscription required. Memory stores require a Claude Pro/Max/Team subscription.`,403);if(t===404)return new z(`Memory store or memory not found.`,404);if(t===429){let t=e.response?.headers?.[`retry-after`]??``,n=t?` Retry after ${t}s.`:``;return new z(`Rate limit exceeded.${n}`,429)}let n=(e.response?.data)?.error?.message??e.message;return new z(n,t)}return e instanceof z?e:new z(e instanceof Error?e.message:String(e),0)}function w(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 T(e){let t;for(let n=0;n<R;n++)try{return await e()}catch(e){let i=C(e);if(i.statusCode>=500){t=i,n<R-1&&await b(w(r.isAxiosError(e)?e.response?.headers?.[`retry-after`]:void 0)??500*2**n);continue}throw i}throw t??new z(`Request failed after retries`,0)}async function E(){return T(async()=>{let e=await x();return(await r.get(S(),{headers:e})).data.data??[]})}async function D(e,t){return T(async()=>{let n=await x(),i={name:e};return t&&(i.namespace=t),(await r.post(S(),i,{headers:n})).data})}async function O(e){return T(async()=>{let t=await x();return(await r.get(`${S()}/${e}`,{headers:t})).data})}async function k(e){return T(async()=>{let t=await x();return(await r.post(`${S()}/${e}/archive`,{},{headers:t})).data})}async function A(e){return T(async()=>{let t=await x();return(await r.get(`${S()}/${e}/memories`,{headers:t})).data.data??[]})}async function j(e,t){return T(async()=>{let n=await x(),i={content:t};return(await r.post(`${S()}/${e}/memories`,i,{headers:n})).data})}async function M(e,t){return T(async()=>{let n=await x();return(await r.get(`${S()}/${e}/memories/${t}`,{headers:n})).data})}async function N(e,t,n){return T(async()=>{let i=await x(),a={content:n};return(await r.patch(`${S()}/${e}/memories/${t}`,a,{headers:i})).data})}async function P(e,t){return T(async()=>{let n=await x();await r.delete(`${S()}/${e}/memories/${t}`,{headers:n})})}async function F(e){return T(async()=>{let t=await x();return(await r.get(`${S()}/${e}/memory_versions`,{headers:t})).data.data??[]})}async function I(e,t){return T(async()=>{let n=await x();return(await r.post(`${S()}/${e}/memory_versions/${t}/redact`,{},{headers:n})).data})}var L,R,z,B=e((()=>{i(),p(),_(),m(),t(),L=`managed-agents-2026-04-01`,R=3,z=class extends Error{constructor(e,t){super(e),n(this,`statusCode`,void 0),this.statusCode=t,this.name=`MemoryStoresApiError`}}}));function V({store:e}){let t=!!e.archived_at,n=e.created_at?new Date(e.created_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(o,{bold:!0,children:e.memory_store_id}),(0,U.jsx)(o,{dimColor:!0,children:` · `}),(0,U.jsx)(o,{color:t?`warning`:`success`,children:t?`archived`:`active`}),e.namespace?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o,{dimColor:!0,children:` · ns: `}),(0,U.jsx)(o,{children:e.namespace})]}):null]}),(0,U.jsxs)(o,{children:[`Name: `,e.name]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,n]})]})}function H(e){if(e.mode===`list`)return e.stores.length===0?(0,U.jsx)(a,{children:(0,U.jsx)(o,{dimColor:!0,children:`No memory stores found. Use /memory-stores create <name> to create one.`})}):(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory Stores (`,e.stores.length,`)`]})}),e.stores.map(e=>(0,U.jsx)(V,{store:e},e.memory_store_id))]});if(e.mode===`detail`){let{store:t}=e,n=!!t.archived_at,r=t.created_at?new Date(t.created_at).toLocaleString():`—`,i=t.archived_at?new Date(t.archived_at).toLocaleString():null;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory Store: `,t.memory_store_id]})}),(0,U.jsxs)(o,{children:[`Name: `,t.name]}),t.namespace?(0,U.jsxs)(o,{children:[`Namespace: `,t.namespace]}):null,(0,U.jsxs)(o,{children:[`Status:`,` `,(0,U.jsx)(o,{color:n?`warning`:`success`,children:n?`archived`:`active`})]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,r]}),i?(0,U.jsxs)(o,{dimColor:!0,children:[`Archived: `,i]}):null]})}if(e.mode===`created`){let{store:t}=e;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`success`,children:`Memory store created`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_store_id]}),(0,U.jsxs)(o,{children:[`Name: `,t.name]}),t.namespace?(0,U.jsxs)(o,{children:[`Namespace: `,t.namespace]}):null]})}if(e.mode===`archived`){let{store:t}=e,n=t.archived_at?new Date(t.archived_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`warning`,children:`Memory store archived`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_store_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Archived at: `,n]})]})}if(e.mode===`memory-list`){let{storeId:t,memories:n}=e;return n.length===0?(0,U.jsx)(a,{children:(0,U.jsxs)(o,{dimColor:!0,children:[`No memories in store `,t,`. Use /memory-stores create-memory `,t,` <content> to add one.`]})}):(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memories in `,t,` (`,n.length,`)`]})}),n.map(e=>(0,U.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(o,{bold:!0,children:e.memory_id}),(0,U.jsx)(o,{dimColor:!0,children:e.content.length>80?`${e.content.slice(0,80)}…`:e.content})]},e.memory_id))]})}if(e.mode===`memory-detail`){let{memory:t}=e,n=t.created_at?new Date(t.created_at).toLocaleString():`—`,r=t.updated_at?new Date(t.updated_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory: `,t.memory_id]})}),(0,U.jsxs)(o,{children:[`Store: `,t.memory_store_id]}),(0,U.jsxs)(o,{children:[`Content: `,t.content]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,n]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Updated: `,r]})]})}if(e.mode===`memory-created`){let{memory:t}=e;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`success`,children:`Memory created`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_id]}),(0,U.jsxs)(o,{children:[`Store: `,t.memory_store_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Content: `,t.content]})]})}if(e.mode===`memory-updated`){let{memory:t}=e;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`success`,children:`Memory updated`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Content: `,t.content]})]})}if(e.mode===`memory-deleted`)return(0,U.jsx)(a,{children:(0,U.jsxs)(o,{color:`success`,children:[`Memory `,e.memoryId,` deleted from store `,e.storeId,`.`]})});if(e.mode===`versions`){let{storeId:t,versions:n}=e;return n.length===0?(0,U.jsx)(a,{children:(0,U.jsxs)(o,{dimColor:!0,children:[`No memory versions found for store `,t,`.`]})}):(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory Versions in `,t,` (`,n.length,`)`]})}),n.map(e=>{let t=e.created_at?new Date(e.created_at).toLocaleString():`—`,n=!!e.redacted_at;return(0,U.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(o,{bold:!0,children:e.version_id}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o,{dimColor:!0,children:` · `}),(0,U.jsx)(o,{color:`warning`,children:`redacted`})]}):null]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,t]})]},e.version_id)})]})}if(e.mode===`redacted`){let{version:t}=e,n=t.redacted_at?new Date(t.redacted_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`warning`,children:`Version redacted`})}),(0,U.jsxs)(o,{children:[`ID: `,t.version_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Redacted at: `,n]})]})}return(0,U.jsx)(a,{children:(0,U.jsx)(o,{color:`error`,children:e.message})})}var U,W=e((()=>{s(),c(),U=l()}));function G(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===`get`){if(!i)return{action:`invalid`,reason:`get requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`get`,id:e}:{action:`invalid`,reason:`get requires a store id`}}if(r===`create`)return i?{action:`create`,name:i}:{action:`invalid`,reason:`create requires a store name, e.g. create "My Work Store"`};if(r===`archive`){if(!i)return{action:`invalid`,reason:`archive requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`archive`,id:e}:{action:`invalid`,reason:`archive requires a store id`}}if(r===`memories`){if(!i)return{action:`invalid`,reason:`memories requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`memories`,storeId:e}:{action:`invalid`,reason:`memories requires a store id`}}if(r===`create-memory`){let e=i.split(/\s+/);if(e.length<2||!e[0])return{action:`invalid`,reason:`create-memory requires a store id and content, e.g. create-memory ms_123 "The content"`};let t=e[0],n=e.slice(1).join(` `);return n.trim()?{action:`create-memory`,storeId:t,content:n.trim()}:{action:`invalid`,reason:`create-memory requires non-empty content`}}if(r===`get-memory`){let e=i.split(/\s+/);return e.length<2||!e[0]||!e[1]?{action:`invalid`,reason:`get-memory requires a store id and memory id, e.g. get-memory ms_123 mem_456`}:{action:`get-memory`,storeId:e[0],memoryId:e[1]}}if(r===`update-memory`){let e=i.split(/\s+/);if(e.length<3||!e[0]||!e[1])return{action:`invalid`,reason:`update-memory requires store id, memory id, and content, e.g. update-memory ms_123 mem_456 "New content"`};let t=e[0],n=e[1],r=e.slice(2).join(` `);return r.trim()?{action:`update-memory`,storeId:t,memoryId:n,content:r.trim()}:{action:`invalid`,reason:`update-memory requires non-empty content`}}if(r===`delete-memory`){let e=i.split(/\s+/);return e.length<2||!e[0]||!e[1]?{action:`invalid`,reason:`delete-memory requires a store id and memory id, e.g. delete-memory ms_123 mem_456`}:{action:`delete-memory`,storeId:e[0],memoryId:e[1]}}if(r===`versions`){if(!i)return{action:`invalid`,reason:`versions requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`versions`,storeId:e}:{action:`invalid`,reason:`versions requires a store id`}}if(r===`redact`){let e=i.split(/\s+/);return e.length<2||!e[0]||!e[1]?{action:`invalid`,reason:`redact requires a store id and version id, e.g. redact ms_123 ver_456`}:{action:`redact`,storeId:e[0],versionId:e[1]}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${K}`}}var K,q=e((()=>{K=`Usage: /memory-stores list | get ID | create NAME | archive ID | memories STORE_ID | create-memory STORE_ID CONTENT | get-memory STORE_ID MEMORY_ID | update-memory STORE_ID MEMORY_ID CONTENT | delete-memory STORE_ID MEMORY_ID | versions STORE_ID | redact STORE_ID VERSION_ID`}));async function J(e,t){if(e.action===`list`){d(`tengu_memory_stores_list`,{});try{let e=await E();return t(e.length===0?`No memory stores found.`:`${e.length} memory store(s).`,{display:`system`}),{mode:`list`,stores:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to list memory stores: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`get`){let{id:n}=e;d(`tengu_memory_stores_get`,{id:n});try{let e=await O(n);return t(`Memory store ${n} fetched.`,{display:`system`}),{mode:`detail`,store:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to get memory store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`create`){let{name:n}=e;d(`tengu_memory_stores_create`,{name:n});try{let e=await D(n);return t(`Memory store created: ${e.memory_store_id}`,{display:`system`}),{mode:`created`,store:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to create memory store: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`archive`){let{id:n}=e;d(`tengu_memory_stores_archive`,{id:n});try{let e=await k(n);return t(`Memory store ${n} archived.`,{display:`system`}),{mode:`archived`,store:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to archive memory store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`memories`){let{storeId:n}=e;d(`tengu_memory_stores_list_memories`,{storeId:n});try{let e=await A(n);return t(e.length===0?`No memories in store ${n}.`:`${e.length} memory(ies) in store ${n}.`,{display:`system`}),{mode:`memory-list`,storeId:n,memories:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to list memories in store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`create-memory`){let{storeId:n,content:r}=e;d(`tengu_memory_stores_create_memory`,{storeId:n});try{let e=await j(n,r);return t(`Memory created: ${e.memory_id}`,{display:`system`}),{mode:`memory-created`,memory:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to create memory in store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`get-memory`){let{storeId:n,memoryId:r}=e;d(`tengu_memory_stores_get_memory`,{storeId:n});try{let e=await M(n,r);return t(`Memory ${r} fetched.`,{display:`system`}),{mode:`memory-detail`,memory:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to get memory ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`update-memory`){let{storeId:n,memoryId:r,content:i}=e;d(`tengu_memory_stores_update_memory`,{storeId:n});try{let e=await N(n,r,i);return t(`Memory ${r} updated.`,{display:`system`}),{mode:`memory-updated`,memory:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to update memory ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`delete-memory`){let{storeId:n,memoryId:r}=e;d(`tengu_memory_stores_delete_memory`,{storeId:n});try{return await P(n,r),t(`Memory ${r} deleted.`,{display:`system`}),{mode:`memory-deleted`,storeId:n,memoryId:r}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to delete memory ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`versions`){let{storeId:n}=e;d(`tengu_memory_stores_versions`,{storeId:n});try{let e=await F(n);return t(e.length===0?`No memory versions found for store ${n}.`:`${e.length} version(s) in store ${n}.`,{display:`system`}),{mode:`versions`,storeId:n,versions:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to list versions for store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}let{storeId:n,versionId:r}=e;d(`tengu_memory_stores_redact`,{storeId:n});try{let e=await I(n,r);return t(`Version ${r} redacted.`,{display:`system`}),{mode:`redacted`,version:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to redact version ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}var Y,X;e((()=>{u(),B(),W(),q(),y(),Y=`Usage: /memory-stores list | get ID | create NAME | archive ID | memories STORE_ID | create-memory STORE_ID CONTENT | get-memory STORE_ID MEMORY_ID | update-memory STORE_ID MEMORY_ID CONTENT | delete-memory STORE_ID MEMORY_ID | versions STORE_ID | redact STORE_ID VERSION_ID`,X=v({commandName:`memory-stores`,parseArgs:e=>{d(`tengu_memory_stores_started`,{args:e});let t=G(e);return t.action===`invalid`?(d(`tengu_memory_stores_failed`,{reason:t.reason}),{action:`invalid`,reason:`${Y}\n${t.reason}`}):t},dispatch:J,View:H,errorView:e=>null})}))();export{X as callMemoryStores};
|
|
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-gqTA-D7n.js";import{n as g,r as _}from"./hostGuard-BHI6Q8Mt.js";import{n as v,t as y}from"./launchCommand-1qkTCKpf.js";function b(e){return new Promise(t=>setTimeout(t,e))}async function x(){let e;try{e=(await h()).apiKey}catch(e){let t=e instanceof Error?e.message:String(e);throw new z(t,501)}return g(S()),{"x-api-key":e,"anthropic-version":`2023-06-01`,"anthropic-beta":L,"content-type":`application/json`}}function S(){return`${f().BASE_API_URL}/v1/memory_stores`}function C(e){if(r.isAxiosError(e)){let t=e.response?.status??0;if(t===401)return new z(`Authentication failed.`,401);if(t===403)return new z(`Subscription required. Memory stores require a Claude Pro/Max/Team subscription.`,403);if(t===404)return new z(`Memory store or memory not found.`,404);if(t===429){let t=e.response?.headers?.[`retry-after`]??``,n=t?` Retry after ${t}s.`:``;return new z(`Rate limit exceeded.${n}`,429)}let n=(e.response?.data)?.error?.message??e.message;return new z(n,t)}return e instanceof z?e:new z(e instanceof Error?e.message:String(e),0)}function w(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 T(e){let t;for(let n=0;n<R;n++)try{return await e()}catch(e){let i=C(e);if(i.statusCode>=500){t=i,n<R-1&&await b(w(r.isAxiosError(e)?e.response?.headers?.[`retry-after`]:void 0)??500*2**n);continue}throw i}throw t??new z(`Request failed after retries`,0)}async function E(){return T(async()=>{let e=await x();return(await r.get(S(),{headers:e})).data.data??[]})}async function D(e,t){return T(async()=>{let n=await x(),i={name:e};return t&&(i.namespace=t),(await r.post(S(),i,{headers:n})).data})}async function O(e){return T(async()=>{let t=await x();return(await r.get(`${S()}/${e}`,{headers:t})).data})}async function k(e){return T(async()=>{let t=await x();return(await r.post(`${S()}/${e}/archive`,{},{headers:t})).data})}async function A(e){return T(async()=>{let t=await x();return(await r.get(`${S()}/${e}/memories`,{headers:t})).data.data??[]})}async function j(e,t){return T(async()=>{let n=await x(),i={content:t};return(await r.post(`${S()}/${e}/memories`,i,{headers:n})).data})}async function M(e,t){return T(async()=>{let n=await x();return(await r.get(`${S()}/${e}/memories/${t}`,{headers:n})).data})}async function N(e,t,n){return T(async()=>{let i=await x(),a={content:n};return(await r.patch(`${S()}/${e}/memories/${t}`,a,{headers:i})).data})}async function P(e,t){return T(async()=>{let n=await x();await r.delete(`${S()}/${e}/memories/${t}`,{headers:n})})}async function F(e){return T(async()=>{let t=await x();return(await r.get(`${S()}/${e}/memory_versions`,{headers:t})).data.data??[]})}async function I(e,t){return T(async()=>{let n=await x();return(await r.post(`${S()}/${e}/memory_versions/${t}/redact`,{},{headers:n})).data})}var L,R,z,B=e((()=>{i(),p(),_(),m(),t(),L=`managed-agents-2026-04-01`,R=3,z=class extends Error{constructor(e,t){super(e),n(this,`statusCode`,void 0),this.statusCode=t,this.name=`MemoryStoresApiError`}}}));function V({store:e}){let t=!!e.archived_at,n=e.created_at?new Date(e.created_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(o,{bold:!0,children:e.memory_store_id}),(0,U.jsx)(o,{dimColor:!0,children:` · `}),(0,U.jsx)(o,{color:t?`warning`:`success`,children:t?`archived`:`active`}),e.namespace?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o,{dimColor:!0,children:` · ns: `}),(0,U.jsx)(o,{children:e.namespace})]}):null]}),(0,U.jsxs)(o,{children:[`Name: `,e.name]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,n]})]})}function H(e){if(e.mode===`list`)return e.stores.length===0?(0,U.jsx)(a,{children:(0,U.jsx)(o,{dimColor:!0,children:`No memory stores found. Use /memory-stores create <name> to create one.`})}):(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory Stores (`,e.stores.length,`)`]})}),e.stores.map(e=>(0,U.jsx)(V,{store:e},e.memory_store_id))]});if(e.mode===`detail`){let{store:t}=e,n=!!t.archived_at,r=t.created_at?new Date(t.created_at).toLocaleString():`—`,i=t.archived_at?new Date(t.archived_at).toLocaleString():null;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory Store: `,t.memory_store_id]})}),(0,U.jsxs)(o,{children:[`Name: `,t.name]}),t.namespace?(0,U.jsxs)(o,{children:[`Namespace: `,t.namespace]}):null,(0,U.jsxs)(o,{children:[`Status:`,` `,(0,U.jsx)(o,{color:n?`warning`:`success`,children:n?`archived`:`active`})]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,r]}),i?(0,U.jsxs)(o,{dimColor:!0,children:[`Archived: `,i]}):null]})}if(e.mode===`created`){let{store:t}=e;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`success`,children:`Memory store created`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_store_id]}),(0,U.jsxs)(o,{children:[`Name: `,t.name]}),t.namespace?(0,U.jsxs)(o,{children:[`Namespace: `,t.namespace]}):null]})}if(e.mode===`archived`){let{store:t}=e,n=t.archived_at?new Date(t.archived_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`warning`,children:`Memory store archived`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_store_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Archived at: `,n]})]})}if(e.mode===`memory-list`){let{storeId:t,memories:n}=e;return n.length===0?(0,U.jsx)(a,{children:(0,U.jsxs)(o,{dimColor:!0,children:[`No memories in store `,t,`. Use /memory-stores create-memory `,t,` <content> to add one.`]})}):(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memories in `,t,` (`,n.length,`)`]})}),n.map(e=>(0,U.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(o,{bold:!0,children:e.memory_id}),(0,U.jsx)(o,{dimColor:!0,children:e.content.length>80?`${e.content.slice(0,80)}…`:e.content})]},e.memory_id))]})}if(e.mode===`memory-detail`){let{memory:t}=e,n=t.created_at?new Date(t.created_at).toLocaleString():`—`,r=t.updated_at?new Date(t.updated_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory: `,t.memory_id]})}),(0,U.jsxs)(o,{children:[`Store: `,t.memory_store_id]}),(0,U.jsxs)(o,{children:[`Content: `,t.content]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,n]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Updated: `,r]})]})}if(e.mode===`memory-created`){let{memory:t}=e;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`success`,children:`Memory created`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_id]}),(0,U.jsxs)(o,{children:[`Store: `,t.memory_store_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Content: `,t.content]})]})}if(e.mode===`memory-updated`){let{memory:t}=e;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`success`,children:`Memory updated`})}),(0,U.jsxs)(o,{children:[`ID: `,t.memory_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Content: `,t.content]})]})}if(e.mode===`memory-deleted`)return(0,U.jsx)(a,{children:(0,U.jsxs)(o,{color:`success`,children:[`Memory `,e.memoryId,` deleted from store `,e.storeId,`.`]})});if(e.mode===`versions`){let{storeId:t,versions:n}=e;return n.length===0?(0,U.jsx)(a,{children:(0,U.jsxs)(o,{dimColor:!0,children:[`No memory versions found for store `,t,`.`]})}):(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{marginBottom:1,children:(0,U.jsxs)(o,{bold:!0,children:[`Memory Versions in `,t,` (`,n.length,`)`]})}),n.map(e=>{let t=e.created_at?new Date(e.created_at).toLocaleString():`—`,n=!!e.redacted_at;return(0,U.jsxs)(a,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(a,{children:[(0,U.jsx)(o,{bold:!0,children:e.version_id}),n?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(o,{dimColor:!0,children:` · `}),(0,U.jsx)(o,{color:`warning`,children:`redacted`})]}):null]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Created: `,t]})]},e.version_id)})]})}if(e.mode===`redacted`){let{version:t}=e,n=t.redacted_at?new Date(t.redacted_at).toLocaleString():`—`;return(0,U.jsxs)(a,{flexDirection:`column`,children:[(0,U.jsx)(a,{children:(0,U.jsx)(o,{bold:!0,color:`warning`,children:`Version redacted`})}),(0,U.jsxs)(o,{children:[`ID: `,t.version_id]}),(0,U.jsxs)(o,{dimColor:!0,children:[`Redacted at: `,n]})]})}return(0,U.jsx)(a,{children:(0,U.jsx)(o,{color:`error`,children:e.message})})}var U,W=e((()=>{s(),c(),U=l()}));function G(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===`get`){if(!i)return{action:`invalid`,reason:`get requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`get`,id:e}:{action:`invalid`,reason:`get requires a store id`}}if(r===`create`)return i?{action:`create`,name:i}:{action:`invalid`,reason:`create requires a store name, e.g. create "My Work Store"`};if(r===`archive`){if(!i)return{action:`invalid`,reason:`archive requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`archive`,id:e}:{action:`invalid`,reason:`archive requires a store id`}}if(r===`memories`){if(!i)return{action:`invalid`,reason:`memories requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`memories`,storeId:e}:{action:`invalid`,reason:`memories requires a store id`}}if(r===`create-memory`){let e=i.split(/\s+/);if(e.length<2||!e[0])return{action:`invalid`,reason:`create-memory requires a store id and content, e.g. create-memory ms_123 "The content"`};let t=e[0],n=e.slice(1).join(` `);return n.trim()?{action:`create-memory`,storeId:t,content:n.trim()}:{action:`invalid`,reason:`create-memory requires non-empty content`}}if(r===`get-memory`){let e=i.split(/\s+/);return e.length<2||!e[0]||!e[1]?{action:`invalid`,reason:`get-memory requires a store id and memory id, e.g. get-memory ms_123 mem_456`}:{action:`get-memory`,storeId:e[0],memoryId:e[1]}}if(r===`update-memory`){let e=i.split(/\s+/);if(e.length<3||!e[0]||!e[1])return{action:`invalid`,reason:`update-memory requires store id, memory id, and content, e.g. update-memory ms_123 mem_456 "New content"`};let t=e[0],n=e[1],r=e.slice(2).join(` `);return r.trim()?{action:`update-memory`,storeId:t,memoryId:n,content:r.trim()}:{action:`invalid`,reason:`update-memory requires non-empty content`}}if(r===`delete-memory`){let e=i.split(/\s+/);return e.length<2||!e[0]||!e[1]?{action:`invalid`,reason:`delete-memory requires a store id and memory id, e.g. delete-memory ms_123 mem_456`}:{action:`delete-memory`,storeId:e[0],memoryId:e[1]}}if(r===`versions`){if(!i)return{action:`invalid`,reason:`versions requires a store id`};let e=i.split(/\s+/)[0];return e?{action:`versions`,storeId:e}:{action:`invalid`,reason:`versions requires a store id`}}if(r===`redact`){let e=i.split(/\s+/);return e.length<2||!e[0]||!e[1]?{action:`invalid`,reason:`redact requires a store id and version id, e.g. redact ms_123 ver_456`}:{action:`redact`,storeId:e[0],versionId:e[1]}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${K}`}}var K,q=e((()=>{K=`Usage: /memory-stores list | get ID | create NAME | archive ID | memories STORE_ID | create-memory STORE_ID CONTENT | get-memory STORE_ID MEMORY_ID | update-memory STORE_ID MEMORY_ID CONTENT | delete-memory STORE_ID MEMORY_ID | versions STORE_ID | redact STORE_ID VERSION_ID`}));async function J(e,t){if(e.action===`list`){d(`tengu_memory_stores_list`,{});try{let e=await E();return t(e.length===0?`No memory stores found.`:`${e.length} memory store(s).`,{display:`system`}),{mode:`list`,stores:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to list memory stores: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`get`){let{id:n}=e;d(`tengu_memory_stores_get`,{id:n});try{let e=await O(n);return t(`Memory store ${n} fetched.`,{display:`system`}),{mode:`detail`,store:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to get memory store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`create`){let{name:n}=e;d(`tengu_memory_stores_create`,{name:n});try{let e=await D(n);return t(`Memory store created: ${e.memory_store_id}`,{display:`system`}),{mode:`created`,store:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to create memory store: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`archive`){let{id:n}=e;d(`tengu_memory_stores_archive`,{id:n});try{let e=await k(n);return t(`Memory store ${n} archived.`,{display:`system`}),{mode:`archived`,store:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to archive memory store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`memories`){let{storeId:n}=e;d(`tengu_memory_stores_list_memories`,{storeId:n});try{let e=await A(n);return t(e.length===0?`No memories in store ${n}.`:`${e.length} memory(ies) in store ${n}.`,{display:`system`}),{mode:`memory-list`,storeId:n,memories:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to list memories in store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`create-memory`){let{storeId:n,content:r}=e;d(`tengu_memory_stores_create_memory`,{storeId:n});try{let e=await j(n,r);return t(`Memory created: ${e.memory_id}`,{display:`system`}),{mode:`memory-created`,memory:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to create memory in store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}if(e.action===`get-memory`){let{storeId:n,memoryId:r}=e;d(`tengu_memory_stores_get_memory`,{storeId:n});try{let e=await M(n,r);return t(`Memory ${r} fetched.`,{display:`system`}),{mode:`memory-detail`,memory:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to get memory ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`update-memory`){let{storeId:n,memoryId:r,content:i}=e;d(`tengu_memory_stores_update_memory`,{storeId:n});try{let e=await N(n,r,i);return t(`Memory ${r} updated.`,{display:`system`}),{mode:`memory-updated`,memory:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to update memory ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`delete-memory`){let{storeId:n,memoryId:r}=e;d(`tengu_memory_stores_delete_memory`,{storeId:n});try{return await P(n,r),t(`Memory ${r} deleted.`,{display:`system`}),{mode:`memory-deleted`,storeId:n,memoryId:r}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to delete memory ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}if(e.action===`versions`){let{storeId:n}=e;d(`tengu_memory_stores_versions`,{storeId:n});try{let e=await F(n);return t(e.length===0?`No memory versions found for store ${n}.`:`${e.length} version(s) in store ${n}.`,{display:`system`}),{mode:`versions`,storeId:n,versions:e}}catch(e){let r=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:r}),t(`Failed to list versions for store ${n}: ${r}`,{display:`system`}),{mode:`error`,message:r}}}let{storeId:n,versionId:r}=e;d(`tengu_memory_stores_redact`,{storeId:n});try{let e=await I(n,r);return t(`Version ${r} redacted.`,{display:`system`}),{mode:`redacted`,version:e}}catch(e){let n=e instanceof Error?e.message:String(e);return d(`tengu_memory_stores_failed`,{reason:n}),t(`Failed to redact version ${r}: ${n}`,{display:`system`}),{mode:`error`,message:n}}}var Y,X;e((()=>{u(),B(),W(),q(),y(),Y=`Usage: /memory-stores list | get ID | create NAME | archive ID | memories STORE_ID | create-memory STORE_ID CONTENT | get-memory STORE_ID MEMORY_ID | update-memory STORE_ID MEMORY_ID CONTENT | delete-memory STORE_ID MEMORY_ID | versions STORE_ID | redact STORE_ID VERSION_ID`,X=v({commandName:`memory-stores`,parseArgs:e=>{d(`tengu_memory_stores_started`,{args:e});let t=G(e);return t.action===`invalid`?(d(`tengu_memory_stores_failed`,{reason:t.reason}),{action:`invalid`,reason:`${Y}\n${t.reason}`}):t},dispatch:J,View:H,errorView:e=>null})}))();export{X as callMemoryStores};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,fi as i,t as a,x as o}from"./src-CDCSSo0U2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{b as c,c as l,g as u,y as d}from"./config-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,fi as i,t as a,x as o}from"./src-CDCSSo0U2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{b as c,c as l,g as u,y as d}from"./config-DmomySWC.js";import{n as f,r as p}from"./analytics-BotDBGh0.js";import{n as m,t as h}from"./ThemePicker-BViWzLp3.js";function g(e){return e}function _(e){let t=e.trim().toLowerCase();return t===``||t===`reset`?{sub:`full`}:x.has(t)?{sub:t}:{sub:`full`,unknownArg:t}}function v({onDone:e}){let[,n]=t();return(0,b.jsx)(o,{color:`permission`,children:(0,b.jsx)(h,{onThemeSelect:t=>{n(t),p(`tengu_onboarding_step`,{stepId:g(`theme`)}),e(`Theme set to ${t}.`)},onCancel:()=>e(`Theme picker dismissed.`),skipExitHandling:!0})})}function y({theme:e,hasCompletedOnboarding:t,lastOnboardingVersion:i}){return(0,b.jsxs)(n,{flexDirection:`column`,paddingLeft:1,children:[(0,b.jsx)(r,{bold:!0,children:`Onboarding status`}),(0,b.jsxs)(r,{children:[`- Theme: `,(0,b.jsx)(r,{bold:!0,children:e})]}),(0,b.jsxs)(r,{children:[`- Onboarding completed:`,` `,(0,b.jsx)(r,{bold:!0,color:t?`success`:`warning`,children:t?`yes`:`no`})]}),(0,b.jsxs)(r,{children:[`- Last onboarding version: `,(0,b.jsx)(r,{bold:!0,children:i})]}),(0,b.jsx)(r,{dimColor:!0,children:`Run /onboarding (no args) to re-run the full flow, or /onboarding theme | trust | model | mcp for a specific step.`})]})}var b,x,S;e((()=>{i(),a(),f(),m(),u(),b=s(),x=new Set([`full`,`theme`,`trust`,`model`,`mcp`,`status`]),S=async(e,t,n)=>{let{sub:r,unknownArg:i}=_(n);if(p(`tengu_onboarding_step`,{stepId:g(`slash_${r}`)}),i!==void 0)return e(`Unknown /onboarding subcommand: \`${i}\`.\nValid: full | theme | trust | model | mcp | status`,{display:`system`}),null;if(r===`theme`)return(0,b.jsx)(v,{onDone:t=>e(t)});if(r===`trust`)return d(e=>({...e,hasTrustDialogAccepted:!1})),e("Workspace trust cleared for the current project. The trust dialog will appear on the next `claude` launch.",{display:`system`}),null;if(r===`model`)return e("Run `/model` to pick the AI model. Onboarding does not own the model picker; this entry exists for discoverability only.",{display:`system`}),null;if(r===`mcp`)return e("MCP server setup:\n - `/mcp` — list configured MCP servers\n - `claude mcp add <name> <command>` — add a server (in your shell)\n - `claude mcp remove <name>` — remove a server\nServers also load from `.mcp.json` in the workspace and from `~/.claude.json` globally.",{display:`system`}),null;if(r===`status`){let e=l();return(0,b.jsx)(y,{theme:e.theme??`(unset)`,hasCompletedOnboarding:e.hasCompletedOnboarding===!0,lastOnboardingVersion:e.lastOnboardingVersion??`(unset)`})}return c(e=>({...e,hasCompletedOnboarding:!1})),e(`Onboarding flag cleared. The full first-run setup (theme, OAuth/API key, security notes, terminal-setup) will run on the next \`claude\` launch.
|
|
2
2
|
|
|
3
3
|
For individual steps in this session, use:
|
|
4
4
|
/onboarding theme — re-pick theme inline
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{I as o,P as s,fi as c,t as l}from"./src-CDCSSo0U2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{n as d,r as f}from"./analytics-BotDBGh0.js";import{l as p,u as m}from"./oauth-BqJqV-2M.js";import{a as h,l as g,o as _}from"./api-B-5jqiMg.js";import{n as v,r as y,t as b}from"./cron-3LntnnhJ.js";import{r as x,t as S}from"./hostGuard-C5xydXZI.js";function C(e){return new Promise(t=>setTimeout(t,e))}async function w(){let e,t;try{let n=await g();e=n.accessToken,t=n.orgUUID}catch(e){let t=e instanceof Error?e.message:String(e);throw new L(`Not authenticated: ${t}.`,401)}return S(T()),{...h(e),"anthropic-beta":F,"x-organization-uuid":t}}function T(){return`${p().BASE_API_URL}/v1/code/triggers`}function E(e){if(i.isAxiosError(e)){let t=e.response?.status??0;if(t===401)return new L(`Authentication failed.`,401);if(t===403)return new L(`Subscription required. Scheduled triggers require a Claude Pro/Max/Team subscription.`,403);if(t===404)return new L(`Trigger not found.`,404);if(t===429){let t=e.response?.headers?.[`retry-after`]??``,n=t?` Retry after ${t}s.`:``;return new L(`Rate limit exceeded.${n}`,429)}let n=(e.response?.data)?.error?.message??e.message;return new L(n,t)}return e instanceof L?e:new L(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<I;n++)try{return await e()}catch(e){let r=E(e);if(r.statusCode>=500){t=r,n<I-1&&await C(D(i.isAxiosError(e)?e.response?.headers?.[`retry-after`]:void 0)??500*2**n);continue}throw r}throw t??new L(`Request failed after retries`,0)}async function k(){return O(async()=>{let e=await w();return(await i.get(T(),{headers:e})).data.data??[]})}async function A(e){return O(async()=>{let t=await w();return(await i.get(`${T()}/${e}`,{headers:t})).data})}async function j(e){return O(async()=>{let t=await w();return(await i.post(T(),e,{headers:t})).data})}async function M(e,t){return O(async()=>{let n=await w();return(await i.post(`${T()}/${e}`,t,{headers:n})).data})}async function N(e){return O(async()=>{let t=await w();await i.delete(`${T()}/${e}`,{headers:t})})}async function P(e){return O(async()=>{let t=await w();return(await i.post(`${T()}/${e}/run`,{},{headers:t})).data})}var F,I,L,R=e((()=>{a(),m(),x(),_(),n(),F=`ccr-triggers-2026-01-30`,I=3,L=class extends Error{constructor(e,t){super(e),r(this,`statusCode`,void 0),this.statusCode=t,this.name=`TriggersApiError`}}}));function z({trigger:e}){let t=b(e.cron_expression,{utc:!0}),n=e.next_run?new Date(e.next_run).toLocaleString():`—`,r=e.enabled?`enabled`:`disabled`;return(0,V.jsxs)(o,{flexDirection:`column`,marginBottom:1,children:[(0,V.jsxs)(o,{children:[(0,V.jsx)(s,{bold:!0,children:e.trigger_id}),(0,V.jsx)(s,{dimColor:!0,children:` · `}),(0,V.jsx)(s,{color:e.enabled?`success`:`warning`,children:r}),e.agent_id?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(s,{dimColor:!0,children:` · agent: `}),(0,V.jsx)(s,{children:e.agent_id})]}):null]}),(0,V.jsxs)(s,{children:[`Schedule: `,t]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Prompt: `,e.prompt]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Next run: `,n]})]})}function B(e){if(e.mode===`list`)return e.triggers.length===0?(0,V.jsx)(o,{children:(0,V.jsx)(s,{dimColor:!0,children:`No scheduled triggers. Use /schedule create <cron> <prompt> to create one.`})}):(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{marginBottom:1,children:(0,V.jsxs)(s,{bold:!0,children:[`Scheduled Triggers (`,e.triggers.length,`)`]})}),e.triggers.map(e=>(0,V.jsx)(z,{trigger:e},e.trigger_id))]});if(e.mode===`detail`){let{trigger:t}=e,n=b(t.cron_expression,{utc:!0}),r=t.next_run?new Date(t.next_run).toLocaleString():`—`,i=t.last_run?new Date(t.last_run).toLocaleString():`—`;return(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{marginBottom:1,children:(0,V.jsxs)(s,{bold:!0,children:[`Trigger: `,t.trigger_id]})}),(0,V.jsxs)(s,{children:[`Status:`,` `,(0,V.jsx)(s,{color:t.enabled?`success`:`warning`,children:t.enabled?`enabled`:`disabled`})]}),(0,V.jsxs)(s,{children:[`Schedule: `,n]}),t.agent_id?(0,V.jsxs)(s,{children:[`Agent: `,t.agent_id]}):null,(0,V.jsxs)(s,{children:[`Next run: `,r]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Last run: `,i]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Prompt: `,t.prompt]}),t.created_at?(0,V.jsxs)(s,{dimColor:!0,children:[`Created: `,new Date(t.created_at).toLocaleString()]}):null]})}if(e.mode===`created`){let{trigger:t}=e,n=b(t.cron_expression,{utc:!0});return(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{children:(0,V.jsx)(s,{bold:!0,color:`success`,children:`Trigger created`})}),(0,V.jsxs)(s,{children:[`ID: `,t.trigger_id]}),(0,V.jsxs)(s,{children:[`Schedule: `,n]}),(0,V.jsxs)(s,{children:[`Prompt: `,t.prompt]}),t.agent_id?(0,V.jsxs)(s,{children:[`Agent: `,t.agent_id]}):null,(0,V.jsxs)(s,{dimColor:!0,children:[`Status: `,t.enabled?`enabled`:`disabled`]})]})}if(e.mode===`updated`){let{trigger:t}=e;return(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{children:(0,V.jsx)(s,{bold:!0,color:`success`,children:`Trigger updated`})}),(0,V.jsxs)(s,{children:[`ID: `,t.trigger_id]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Status: `,t.enabled?`enabled`:`disabled`]})]})}return e.mode===`deleted`?(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`success`,children:[`Trigger `,e.id,` deleted.`]})}):e.mode===`ran`?(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`success`,children:[`Trigger `,e.id,` fired.`]})}),(0,V.jsxs)(s,{dimColor:!0,children:[`Run ID: `,e.runId]})]}):e.mode===`enabled`?(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`success`,children:[`Trigger `,e.id,` enabled.`]})}):e.mode===`disabled`?(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`warning`,children:[`Trigger `,e.id,` disabled.`]})}):(0,V.jsx)(o,{children:(0,V.jsx)(s,{color:`error`,children:e.message})})}var V,H=e((()=>{c(),l(),v(),V=u()}));function U(e){let t=e.trim().split(/\s+/);return t.length<6?null:{cron:t.slice(0,5).join(` `),prompt:t.slice(5).join(` `)}}function W(e){return e.trim().split(/\s+/).length===5}function G(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===`get`){if(!i)return{action:`invalid`,reason:`get requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:`get`,id:e}:{action:`invalid`,reason:`get requires a trigger id`}}if(r===`create`){if(!i)return{action:`invalid`,reason:`create requires a cron expression and prompt, e.g. create "0 9 * * 1" Run weekly standup`};let e=U(i);if(!e)return{action:`invalid`,reason:`create requires 5 cron fields followed by a prompt, e.g. create "0 9 * * 1" Run weekly standup`};let{cron:t,prompt:n}=e;return W(t)?n.trim()?{action:`create`,cron:t,prompt:n.trim()}:{action:`invalid`,reason:`prompt cannot be empty`}:{action:`invalid`,reason:`Invalid cron expression: "${t}". Expected 5 fields (minute hour day month weekday).`}}if(r===`update`){let e=i.split(/\s+/);if(e.length<3||!e[0])return{action:`invalid`,reason:`update requires an id, field, and value, e.g. update trg_123 enabled false`};let t=e[0],n=e[1]??``,r=e.slice(2).join(` `);return n?r?{action:`update`,id:t,field:n,value:r}:{action:`invalid`,reason:`update requires a value`}:{action:`invalid`,reason:`update requires a field name`}}if(r===`delete`){if(!i)return{action:`invalid`,reason:`delete requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:`delete`,id:e}:{action:`invalid`,reason:`delete requires a trigger id`}}if(r===`run`){if(!i)return{action:`invalid`,reason:`run requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:`run`,id:e}:{action:`invalid`,reason:`run requires a trigger id`}}if(r===`enable`||r===`disable`){if(!i)return{action:`invalid`,reason:`${r} requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:r,id:e}:{action:`invalid`,reason:`${r} requires a trigger id`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${K}`}}var K,q=e((()=>{K=`Usage: /schedule list | get ID | create CRON PROMPT | update ID FIELD VALUE | delete ID | run ID | enable ID | disable ID`})),J,Y;e((()=>{J=t(c(),1),d(),v(),R(),H(),q(),Y=async(e,t,n)=>{f(`tengu_schedule_started`,{args:n??``});let r=G(n??``);if(r.action===`invalid`)return f(`tengu_schedule_failed`,{reason:r.reason}),e(`Usage: /schedule list | get ID | create CRON PROMPT | update ID FIELD VALUE | delete ID | run ID | enable ID | disable ID\n${r.reason}`,{display:`system`}),null;if(r.action===`list`){f(`tengu_schedule_list`,{});try{let t=await k();return e(t.length===0?`No scheduled triggers found.`:`${t.length} scheduled trigger(s).`,{display:`system`}),J.createElement(B,{mode:`list`,triggers:t})}catch(t){let n=t instanceof Error?t.message:String(t);return f(`tengu_schedule_failed`,{reason:n}),e(`Failed to list triggers: ${n}`,{display:`system`}),J.createElement(B,{mode:`error`,message:n})}}if(r.action===`get`){let{id:t}=r;f(`tengu_schedule_get`,{id:t});try{let n=await A(t);return e(`Trigger ${t} fetched.`,{display:`system`}),J.createElement(B,{mode:`detail`,trigger:n})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to get trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`create`){let{cron:t,prompt:n}=r;if(!y(t)){let n=`Invalid cron expression: "${t}". Expected 5 fields (minute hour day month weekday).`;return f(`tengu_schedule_failed`,{reason:n}),e(n,{display:`system`}),null}f(`tengu_schedule_create`,{cron:t});try{let r=await j({cron_expression:t,prompt:n});return e(`Trigger created: ${r.trigger_id}`,{display:`system`}),J.createElement(B,{mode:`created`,trigger:r})}catch(t){let n=t instanceof Error?t.message:String(t);return f(`tengu_schedule_failed`,{reason:n}),e(`Failed to create trigger: ${n}`,{display:`system`}),J.createElement(B,{mode:`error`,message:n})}}if(r.action===`update`){let{id:t,field:n,value:i}=r;f(`tengu_schedule_update`,{id:t,field:n});let a={};if(n===`enabled`)a={enabled:i===`true`||i===`1`};else if(n===`cron_expression`||n===`cron`)a={cron_expression:i};else if(n===`prompt`)a={prompt:i};else if(n===`agent_id`)a={agent_id:i};else{let t=`Unknown field "${n}". Valid fields: enabled, cron_expression, prompt, agent_id`;return f(`tengu_schedule_failed`,{reason:t}),e(t,{display:`system`}),J.createElement(B,{mode:`error`,message:t})}try{let n=await M(t,a);return e(`Trigger ${t} updated.`,{display:`system`}),J.createElement(B,{mode:`updated`,trigger:n})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to update trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`delete`){let{id:t}=r;f(`tengu_schedule_delete`,{id:t});try{return await N(t),e(`Trigger ${t} deleted.`,{display:`system`}),J.createElement(B,{mode:`deleted`,id:t})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to delete trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`run`){let{id:t}=r;f(`tengu_schedule_run`,{id:t});try{let n=await P(t);return e(`Trigger ${t} fired. Run ID: ${n.run_id}`,{display:`system`}),J.createElement(B,{mode:`ran`,id:t,runId:n.run_id})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to run trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`enable`){let{id:t}=r;f(`tengu_schedule_enable`,{id:t});try{return await M(t,{enabled:!0}),e(`Trigger ${t} enabled.`,{display:`system`}),J.createElement(B,{mode:`enabled`,id:t})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to enable trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}let{id:i}=r;f(`tengu_schedule_disable`,{id:i});try{return await M(i,{enabled:!1}),e(`Trigger ${i} disabled.`,{display:`system`}),J.createElement(B,{mode:`disabled`,id:i})}catch(t){let n=t instanceof Error?t.message:String(t);return f(`tengu_schedule_failed`,{reason:n}),e(`Failed to disable trigger ${i}: ${n}`,{display:`system`}),J.createElement(B,{mode:`error`,message:n})}}}))();export{Y as callSchedule};
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{I as o,P as s,fi as c,t as l}from"./src-CDCSSo0U2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{n as d,r as f}from"./analytics-BotDBGh0.js";import{l as p,u as m}from"./oauth-BqJqV-2M.js";import{a as h,l as g,o as _}from"./api-gqTA-D7n.js";import{n as v,r as y,t as b}from"./cron-3LntnnhJ.js";import{r as x,t as S}from"./hostGuard-BHI6Q8Mt.js";function C(e){return new Promise(t=>setTimeout(t,e))}async function w(){let e,t;try{let n=await g();e=n.accessToken,t=n.orgUUID}catch(e){let t=e instanceof Error?e.message:String(e);throw new L(`Not authenticated: ${t}.`,401)}return S(T()),{...h(e),"anthropic-beta":F,"x-organization-uuid":t}}function T(){return`${p().BASE_API_URL}/v1/code/triggers`}function E(e){if(i.isAxiosError(e)){let t=e.response?.status??0;if(t===401)return new L(`Authentication failed.`,401);if(t===403)return new L(`Subscription required. Scheduled triggers require a Claude Pro/Max/Team subscription.`,403);if(t===404)return new L(`Trigger not found.`,404);if(t===429){let t=e.response?.headers?.[`retry-after`]??``,n=t?` Retry after ${t}s.`:``;return new L(`Rate limit exceeded.${n}`,429)}let n=(e.response?.data)?.error?.message??e.message;return new L(n,t)}return e instanceof L?e:new L(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<I;n++)try{return await e()}catch(e){let r=E(e);if(r.statusCode>=500){t=r,n<I-1&&await C(D(i.isAxiosError(e)?e.response?.headers?.[`retry-after`]:void 0)??500*2**n);continue}throw r}throw t??new L(`Request failed after retries`,0)}async function k(){return O(async()=>{let e=await w();return(await i.get(T(),{headers:e})).data.data??[]})}async function A(e){return O(async()=>{let t=await w();return(await i.get(`${T()}/${e}`,{headers:t})).data})}async function j(e){return O(async()=>{let t=await w();return(await i.post(T(),e,{headers:t})).data})}async function M(e,t){return O(async()=>{let n=await w();return(await i.post(`${T()}/${e}`,t,{headers:n})).data})}async function N(e){return O(async()=>{let t=await w();await i.delete(`${T()}/${e}`,{headers:t})})}async function P(e){return O(async()=>{let t=await w();return(await i.post(`${T()}/${e}/run`,{},{headers:t})).data})}var F,I,L,R=e((()=>{a(),m(),x(),_(),n(),F=`ccr-triggers-2026-01-30`,I=3,L=class extends Error{constructor(e,t){super(e),r(this,`statusCode`,void 0),this.statusCode=t,this.name=`TriggersApiError`}}}));function z({trigger:e}){let t=b(e.cron_expression,{utc:!0}),n=e.next_run?new Date(e.next_run).toLocaleString():`—`,r=e.enabled?`enabled`:`disabled`;return(0,V.jsxs)(o,{flexDirection:`column`,marginBottom:1,children:[(0,V.jsxs)(o,{children:[(0,V.jsx)(s,{bold:!0,children:e.trigger_id}),(0,V.jsx)(s,{dimColor:!0,children:` · `}),(0,V.jsx)(s,{color:e.enabled?`success`:`warning`,children:r}),e.agent_id?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(s,{dimColor:!0,children:` · agent: `}),(0,V.jsx)(s,{children:e.agent_id})]}):null]}),(0,V.jsxs)(s,{children:[`Schedule: `,t]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Prompt: `,e.prompt]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Next run: `,n]})]})}function B(e){if(e.mode===`list`)return e.triggers.length===0?(0,V.jsx)(o,{children:(0,V.jsx)(s,{dimColor:!0,children:`No scheduled triggers. Use /schedule create <cron> <prompt> to create one.`})}):(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{marginBottom:1,children:(0,V.jsxs)(s,{bold:!0,children:[`Scheduled Triggers (`,e.triggers.length,`)`]})}),e.triggers.map(e=>(0,V.jsx)(z,{trigger:e},e.trigger_id))]});if(e.mode===`detail`){let{trigger:t}=e,n=b(t.cron_expression,{utc:!0}),r=t.next_run?new Date(t.next_run).toLocaleString():`—`,i=t.last_run?new Date(t.last_run).toLocaleString():`—`;return(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{marginBottom:1,children:(0,V.jsxs)(s,{bold:!0,children:[`Trigger: `,t.trigger_id]})}),(0,V.jsxs)(s,{children:[`Status:`,` `,(0,V.jsx)(s,{color:t.enabled?`success`:`warning`,children:t.enabled?`enabled`:`disabled`})]}),(0,V.jsxs)(s,{children:[`Schedule: `,n]}),t.agent_id?(0,V.jsxs)(s,{children:[`Agent: `,t.agent_id]}):null,(0,V.jsxs)(s,{children:[`Next run: `,r]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Last run: `,i]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Prompt: `,t.prompt]}),t.created_at?(0,V.jsxs)(s,{dimColor:!0,children:[`Created: `,new Date(t.created_at).toLocaleString()]}):null]})}if(e.mode===`created`){let{trigger:t}=e,n=b(t.cron_expression,{utc:!0});return(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{children:(0,V.jsx)(s,{bold:!0,color:`success`,children:`Trigger created`})}),(0,V.jsxs)(s,{children:[`ID: `,t.trigger_id]}),(0,V.jsxs)(s,{children:[`Schedule: `,n]}),(0,V.jsxs)(s,{children:[`Prompt: `,t.prompt]}),t.agent_id?(0,V.jsxs)(s,{children:[`Agent: `,t.agent_id]}):null,(0,V.jsxs)(s,{dimColor:!0,children:[`Status: `,t.enabled?`enabled`:`disabled`]})]})}if(e.mode===`updated`){let{trigger:t}=e;return(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{children:(0,V.jsx)(s,{bold:!0,color:`success`,children:`Trigger updated`})}),(0,V.jsxs)(s,{children:[`ID: `,t.trigger_id]}),(0,V.jsxs)(s,{dimColor:!0,children:[`Status: `,t.enabled?`enabled`:`disabled`]})]})}return e.mode===`deleted`?(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`success`,children:[`Trigger `,e.id,` deleted.`]})}):e.mode===`ran`?(0,V.jsxs)(o,{flexDirection:`column`,children:[(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`success`,children:[`Trigger `,e.id,` fired.`]})}),(0,V.jsxs)(s,{dimColor:!0,children:[`Run ID: `,e.runId]})]}):e.mode===`enabled`?(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`success`,children:[`Trigger `,e.id,` enabled.`]})}):e.mode===`disabled`?(0,V.jsx)(o,{children:(0,V.jsxs)(s,{color:`warning`,children:[`Trigger `,e.id,` disabled.`]})}):(0,V.jsx)(o,{children:(0,V.jsx)(s,{color:`error`,children:e.message})})}var V,H=e((()=>{c(),l(),v(),V=u()}));function U(e){let t=e.trim().split(/\s+/);return t.length<6?null:{cron:t.slice(0,5).join(` `),prompt:t.slice(5).join(` `)}}function W(e){return e.trim().split(/\s+/).length===5}function G(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===`get`){if(!i)return{action:`invalid`,reason:`get requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:`get`,id:e}:{action:`invalid`,reason:`get requires a trigger id`}}if(r===`create`){if(!i)return{action:`invalid`,reason:`create requires a cron expression and prompt, e.g. create "0 9 * * 1" Run weekly standup`};let e=U(i);if(!e)return{action:`invalid`,reason:`create requires 5 cron fields followed by a prompt, e.g. create "0 9 * * 1" Run weekly standup`};let{cron:t,prompt:n}=e;return W(t)?n.trim()?{action:`create`,cron:t,prompt:n.trim()}:{action:`invalid`,reason:`prompt cannot be empty`}:{action:`invalid`,reason:`Invalid cron expression: "${t}". Expected 5 fields (minute hour day month weekday).`}}if(r===`update`){let e=i.split(/\s+/);if(e.length<3||!e[0])return{action:`invalid`,reason:`update requires an id, field, and value, e.g. update trg_123 enabled false`};let t=e[0],n=e[1]??``,r=e.slice(2).join(` `);return n?r?{action:`update`,id:t,field:n,value:r}:{action:`invalid`,reason:`update requires a value`}:{action:`invalid`,reason:`update requires a field name`}}if(r===`delete`){if(!i)return{action:`invalid`,reason:`delete requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:`delete`,id:e}:{action:`invalid`,reason:`delete requires a trigger id`}}if(r===`run`){if(!i)return{action:`invalid`,reason:`run requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:`run`,id:e}:{action:`invalid`,reason:`run requires a trigger id`}}if(r===`enable`||r===`disable`){if(!i)return{action:`invalid`,reason:`${r} requires a trigger id`};let e=i.split(/\s+/)[0];return e?{action:r,id:e}:{action:`invalid`,reason:`${r} requires a trigger id`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${K}`}}var K,q=e((()=>{K=`Usage: /schedule list | get ID | create CRON PROMPT | update ID FIELD VALUE | delete ID | run ID | enable ID | disable ID`})),J,Y;e((()=>{J=t(c(),1),d(),v(),R(),H(),q(),Y=async(e,t,n)=>{f(`tengu_schedule_started`,{args:n??``});let r=G(n??``);if(r.action===`invalid`)return f(`tengu_schedule_failed`,{reason:r.reason}),e(`Usage: /schedule list | get ID | create CRON PROMPT | update ID FIELD VALUE | delete ID | run ID | enable ID | disable ID\n${r.reason}`,{display:`system`}),null;if(r.action===`list`){f(`tengu_schedule_list`,{});try{let t=await k();return e(t.length===0?`No scheduled triggers found.`:`${t.length} scheduled trigger(s).`,{display:`system`}),J.createElement(B,{mode:`list`,triggers:t})}catch(t){let n=t instanceof Error?t.message:String(t);return f(`tengu_schedule_failed`,{reason:n}),e(`Failed to list triggers: ${n}`,{display:`system`}),J.createElement(B,{mode:`error`,message:n})}}if(r.action===`get`){let{id:t}=r;f(`tengu_schedule_get`,{id:t});try{let n=await A(t);return e(`Trigger ${t} fetched.`,{display:`system`}),J.createElement(B,{mode:`detail`,trigger:n})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to get trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`create`){let{cron:t,prompt:n}=r;if(!y(t)){let n=`Invalid cron expression: "${t}". Expected 5 fields (minute hour day month weekday).`;return f(`tengu_schedule_failed`,{reason:n}),e(n,{display:`system`}),null}f(`tengu_schedule_create`,{cron:t});try{let r=await j({cron_expression:t,prompt:n});return e(`Trigger created: ${r.trigger_id}`,{display:`system`}),J.createElement(B,{mode:`created`,trigger:r})}catch(t){let n=t instanceof Error?t.message:String(t);return f(`tengu_schedule_failed`,{reason:n}),e(`Failed to create trigger: ${n}`,{display:`system`}),J.createElement(B,{mode:`error`,message:n})}}if(r.action===`update`){let{id:t,field:n,value:i}=r;f(`tengu_schedule_update`,{id:t,field:n});let a={};if(n===`enabled`)a={enabled:i===`true`||i===`1`};else if(n===`cron_expression`||n===`cron`)a={cron_expression:i};else if(n===`prompt`)a={prompt:i};else if(n===`agent_id`)a={agent_id:i};else{let t=`Unknown field "${n}". Valid fields: enabled, cron_expression, prompt, agent_id`;return f(`tengu_schedule_failed`,{reason:t}),e(t,{display:`system`}),J.createElement(B,{mode:`error`,message:t})}try{let n=await M(t,a);return e(`Trigger ${t} updated.`,{display:`system`}),J.createElement(B,{mode:`updated`,trigger:n})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to update trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`delete`){let{id:t}=r;f(`tengu_schedule_delete`,{id:t});try{return await N(t),e(`Trigger ${t} deleted.`,{display:`system`}),J.createElement(B,{mode:`deleted`,id:t})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to delete trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`run`){let{id:t}=r;f(`tengu_schedule_run`,{id:t});try{let n=await P(t);return e(`Trigger ${t} fired. Run ID: ${n.run_id}`,{display:`system`}),J.createElement(B,{mode:`ran`,id:t,runId:n.run_id})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to run trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}if(r.action===`enable`){let{id:t}=r;f(`tengu_schedule_enable`,{id:t});try{return await M(t,{enabled:!0}),e(`Trigger ${t} enabled.`,{display:`system`}),J.createElement(B,{mode:`enabled`,id:t})}catch(n){let r=n instanceof Error?n.message:String(n);return f(`tengu_schedule_failed`,{reason:r}),e(`Failed to enable trigger ${t}: ${r}`,{display:`system`}),J.createElement(B,{mode:`error`,message:r})}}let{id:i}=r;f(`tengu_schedule_disable`,{id:i});try{return await M(i,{enabled:!1}),e(`Trigger ${i} disabled.`,{display:`system`}),J.createElement(B,{mode:`disabled`,id:i})}catch(t){let n=t instanceof Error?t.message:String(t);return f(`tengu_schedule_failed`,{reason:n}),e(`Failed to disable trigger ${i}: ${n}`,{display:`system`}),J.createElement(B,{mode:`error`,message:n})}}}))();export{Y as callSchedule};
|