@readmagic/workmate 0.0.22 → 0.0.24
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-DWgTWJ7R.js → AddWorkspaceDirectory-Ch8IcWXO.js} +1 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-Cyia0s4g.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-s0Orgord.js → AgentsMdExternalIncludesDialog-LjI_H_Au.js} +1 -1
- package/dist/chunks/App-BOqh_1tN.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-CSEuuoq9.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-D2Gesf-u.js → BypassPermissionsModeDialog-CwfCwUr9.js} +1 -1
- package/dist/chunks/CustomSelect-wmZ9jz0W.js +1 -0
- package/dist/chunks/{DiffDialog-v2IiYyi3.js → DiffDialog-BpXIEWiE.js} +5 -5
- package/dist/chunks/Doctor-CMpr7tdf.js +1 -0
- package/dist/chunks/Doctor-DqW6j3_B.js +3 -0
- package/dist/chunks/{ExitFlow-BasHk1mk.js → ExitFlow-DacaBTlk.js} +2 -2
- package/dist/chunks/Grove-CNqYPWI6.js +11 -0
- package/dist/chunks/{InvalidConfigDialog-DYVQK5js.js → InvalidConfigDialog-0TMJItCC.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-Dg6OiStR.js → InvalidSettingsDialog-iwh8H52b.js} +1 -1
- package/dist/chunks/{KeybindingProviderSetup-Bn1jzN5F.js → KeybindingProviderSetup-D49HHTXD.js} +1 -1
- package/dist/chunks/MCPConnectionManager-Cie77ZAK.js +1 -0
- package/dist/chunks/MCPToolListView-B4ehtkXd.js +1 -0
- package/dist/chunks/{McpParsingWarnings-DZejAh8b.js → McpParsingWarnings-Bff66RtJ.js} +1 -1
- package/dist/chunks/MessageSelector-Dpd6Iywp.js +3 -0
- package/dist/chunks/Messages-DN7M3oS_.js +10 -0
- package/dist/chunks/Onboarding-CQmE3rUf.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-lkr_A5jQ.js → PromptInputFooterSuggestions-HI6HH3TP.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-DaQKKyM5.js → PromptInputHelpMenu-3QNUC2Cg.js} +1 -1
- package/dist/chunks/ProviderSetup-BCSPsvfv.js +1 -0
- package/dist/chunks/QueryEngine-DdLWvJv6.js +1 -0
- package/dist/chunks/REPL-BqO9KcK_.js +124 -0
- package/dist/chunks/REPL-CmZmypfF.js +1 -0
- package/dist/chunks/ResumeConversation-DBqX7gva.js +1 -0
- package/dist/chunks/SearchExtraToolsTool-BsSoILFj.js +1 -0
- package/dist/chunks/{SelectMulti-CNE06VAN.js → SelectMulti-BQRHed-d.js} +1 -1
- package/dist/chunks/Settings-B-7yBewS.js +3 -0
- package/dist/chunks/Spinner-ByQXTvAA.js +1 -0
- package/dist/chunks/{SpinnerGlyph-A6G-gloN.js → SpinnerGlyph-CmkRUvHe.js} +1 -1
- package/dist/chunks/{TextInput-7uqPhq9T.js → TextInput-B8ruWRf2.js} +5 -5
- package/dist/chunks/{ThemePicker-DT9zVy-0.js → ThemePicker-BQErFFW1.js} +1 -1
- package/dist/chunks/TrustDialog-BIhz6AZE.js +1 -0
- package/dist/chunks/{ValidationErrorsList-BLtP647v.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
- package/dist/chunks/_baseEach-CsIRoaTH.js +1 -0
- package/dist/chunks/add-dir-CrUDs19x.js +1 -0
- package/dist/chunks/{agentDisplay-vLQHFrmq.js → agentDisplay-M4pfwbMC.js} +1 -1
- package/dist/chunks/agents-CGaCQeLw.js +101 -0
- package/dist/chunks/{agents-DLz0kfsr.js → agents-DddX7lLX.js} +1 -1
- package/dist/chunks/allErrors-BF73lon8.js +1 -0
- package/dist/chunks/{appleTerminalBackup-BYKdf3of.js → appleTerminalBackup-BArZWB21.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-Bq3LMsVR.js +17 -0
- package/dist/chunks/backgroundHousekeeping-Cl3Ox7Qh.js +1 -0
- package/dist/chunks/banner-Cu2-XUek.js +2 -0
- package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
- package/dist/chunks/branch-Yg_taNlT.js +2 -0
- package/dist/chunks/{break-cache-BL2gnDLX.js → break-cache-BMXqFTeS.js} +2 -2
- package/dist/chunks/btw-udbprVvu.js +1 -0
- package/dist/chunks/caches-ChjIEcdd.js +1 -0
- package/dist/chunks/caches-DLJ6urv-.js +1 -0
- package/dist/chunks/{claudeDesktop-D3PEgx3U.js → claudeDesktop-D8ml2767.js} +1 -1
- package/dist/chunks/{clear-CXfhVRp8.js → clear-B8ZtFPOK.js} +1 -1
- package/dist/chunks/{client-DdenNfkQ.js → client-4iqhC8xq.js} +1 -1
- package/dist/chunks/client-BiqbIkwr.js +1 -0
- package/dist/chunks/client-CZ8nyVh5.js +1 -0
- package/dist/chunks/{client-DvhWKIOx.js → client-CpTCeWba.js} +1 -1
- package/dist/chunks/commands-CVCpJo7M.js +1 -0
- package/dist/chunks/compact-izk6RKHQ.js +2 -0
- package/dist/chunks/config-C-Y2qtB2.js +3 -0
- package/dist/chunks/config-CFqpXMFX.js +1 -0
- package/dist/chunks/config-DD8fCYXn.js +1 -0
- package/dist/chunks/{context-3s9wtn4L.js → context-BbVm4SWK.js} +1 -1
- package/dist/chunks/{context-noninteractive-CJhUu_4y.js → context-noninteractive-C7wrRZnM.js} +5 -5
- package/dist/chunks/context-noninteractive-x0HAzWhc.js +1 -0
- package/dist/chunks/conversation-DouVzO0K.js +1 -0
- package/dist/chunks/conversation-DrVkifKy.js +1 -0
- package/dist/chunks/conversationRecovery-DliPBo_z.js +1 -0
- package/dist/chunks/crossProjectResume-DxMy05_P.js +40 -0
- package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
- package/dist/chunks/cwd-Pa83R95t.js +1 -0
- package/dist/chunks/{datadog-v_mXWncN.js → datadog-Cu3s7P48.js} +1 -1
- package/dist/chunks/{debug-8DCufdSp.js → debug-Bglx1aTu.js} +5 -5
- package/dist/chunks/{detectRepository-DfX8xXw2.js → detectRepository-CfX8Lc0A.js} +1 -1
- package/dist/chunks/{diff-DJSt7QO6.js → diff-DdpHThJ7.js} +1 -1
- package/dist/chunks/{directoryCompletion-CT6YVeg7.js → directoryCompletion-D_Rtg-4j.js} +1 -1
- package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
- package/dist/chunks/dist-es-B7j_mv242.js +1 -0
- package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
- package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
- package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
- package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
- package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
- package/dist/chunks/dist-es-DSkyibcN.js +1 -0
- package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
- package/dist/chunks/dist-es-hwK6468D.js +1 -0
- package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
- package/dist/chunks/doctor-D_kV_D_l.js +1 -0
- package/dist/chunks/{entry-ex0-RyYV.js → entry-Bxseqbi_.js} +4 -4
- package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
- package/dist/chunks/esm-BXTZz3av.js +1 -0
- package/dist/chunks/{execFileNoThrow-BsfuytkN.js → execFileNoThrow-BTachNBI.js} +1 -1
- package/dist/chunks/exit-C_R_FgzR.js +1 -0
- package/dist/chunks/extraUsage-xMuDiNKh.js +1 -0
- package/dist/chunks/extractMemories-D4Dl1itt.js +1 -0
- package/dist/chunks/fast-DH-C5IZs.js +1 -0
- package/dist/chunks/fast-bopOPrtf.js +1 -0
- package/dist/chunks/fetchModelList-DC4VQpqa.js +1 -0
- package/dist/chunks/fetchModelList-FE8tzTDc.js +1 -0
- package/dist/chunks/{fileSuggestions-B-SLfb-o.js → fileSuggestions-C-9unnoJ.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-QmjjQmgt.js +3 -0
- package/dist/chunks/firstPartyEventLogger-lFeqhtfh.js +1 -0
- package/dist/chunks/{gemini-BC9kHhwe.js → gemini-C_ApXgwc.js} +2 -2
- package/dist/chunks/generateSessionName-CQ03xlYI.js +1 -0
- package/dist/chunks/{genericProcessUtils-BYi0OefF.js → genericProcessUtils-DwQFuna9.js} +1 -1
- package/dist/chunks/goal-CdL29Y8C.js +3 -0
- package/dist/chunks/grok-C6WAslUT.js +1 -0
- package/dist/chunks/grove-O6qp7ITR.js +1 -0
- package/dist/chunks/{help-CK90i4hE.js → help-DxanITNN.js} +1 -1
- package/dist/chunks/history-BMycjPTT.js +1 -0
- package/dist/chunks/hooks-D9ApLkBp.js +1 -0
- package/dist/chunks/{hooks-BRFDg9DV.js → hooks-DR3IYPJ3.js} +3 -3
- package/dist/chunks/{install-ZMll-dAa.js → install-0D9u2dZw.js} +1 -1
- package/dist/chunks/instrumentation-BFiGwntt.js +21 -0
- package/dist/chunks/{job-G_ukhLc4.js → job-YhJQWgE0.js} +1 -1
- package/dist/chunks/keybindings-DZrF9iNd.js +1 -0
- package/dist/chunks/{launchLocalMemory-BcRlXLm6.js → launchLocalMemory-DhJ56KDc.js} +2 -2
- package/dist/chunks/launchOnboarding-DmMoZwv5.js +8 -0
- package/dist/chunks/{loadAgentsDir-C1LkW7gl.js → loadAgentsDir-B0Anodo0.js} +540 -543
- package/dist/chunks/loadAgentsDir-BbUR6pqH.js +1 -0
- package/dist/chunks/loadPluginHooks-BSwCtQ6T.js +1 -0
- package/dist/chunks/{loader-C61fB6vU.js → loader-CICGtLp2.js} +1 -1
- package/dist/chunks/{localSearch-DFo_WTMm.js → localSearch-BxLYi6w_.js} +1 -1
- package/dist/chunks/localSearch-zfn7jgrh.js +1 -0
- package/dist/chunks/{log-DaILwWJa.js → log-D2TIwHBV.js} +1 -1
- package/dist/chunks/logoUtils-CRxTutvr.js +1 -0
- package/dist/chunks/{magicDocs-DYc9TFmI.js → magicDocs-Bkz7ZcmL.js} +3 -3
- package/dist/chunks/main-9ksgUUY_.js +345 -0
- package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
- package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
- package/dist/chunks/mcp-ChF12reQ.js +1 -0
- package/dist/chunks/mcp-DoEl5uah.js +2 -0
- package/dist/chunks/mcp-hp9qqjAy.js +6 -0
- package/dist/chunks/memory-Qv-wGNQ5.js +1 -0
- package/dist/chunks/{mode-Pan-Q2c4.js → mode-bFXPCR2P.js} +2 -2
- package/dist/chunks/model-6lkW4o2c.js +1 -0
- package/dist/chunks/model-BvQFFOf8.js +1 -0
- package/dist/chunks/modelOptions-BBvF3wHK.js +1 -0
- package/dist/chunks/nativeInstaller-CdjmE9Zy.js +1 -0
- package/dist/chunks/notifications-Bc6k-Ozy.js +1 -0
- package/dist/chunks/onChangeAppState-DLjZ1x95.js +1 -0
- package/dist/chunks/openai-D46QvESE.js +2 -0
- package/dist/chunks/{overlayContext-CMV7nYR9.js → overlayContext-8--_fbvY.js} +1 -1
- package/dist/chunks/{panel-D9fGQgln.js → panel-CVS4SK_E.js} +1 -1
- package/dist/chunks/parser-CG5RuOCK.js +1 -0
- package/dist/chunks/{parser-D8slvrJP.js → parser-Cg6hSCmn.js} +1 -1
- package/dist/chunks/partition-DznN4XZH.js +1 -0
- package/dist/chunks/{pasteStore-DNV1M5Xd.js → pasteStore-P0zP-ch0.js} +1 -1
- package/dist/chunks/permissions-DmGFViHI.js +3 -0
- package/dist/chunks/pidLock-Cm4sW35f.js +3 -0
- package/dist/chunks/{plan-CQLnPLuE.js → plan-CzGBz_87.js} +1 -1
- package/dist/chunks/{platform-Dzff1WWw.js → platform-BacQ6ACS.js} +1 -1
- package/dist/chunks/plugin-CluR79xX.js +17 -0
- package/dist/chunks/{pluginAutoupdate-BJaAqwTH.js → pluginAutoupdate-ennb9k8_.js} +1 -1
- package/dist/chunks/pluginBlocklist-9OrNEh--.js +1 -0
- package/dist/chunks/pluginCliCommands-CJv5uhOG.js +1 -0
- package/dist/chunks/{pluginFlagging-DQP8tBi2.js → pluginFlagging-js_-WmYj.js} +1 -1
- package/dist/chunks/pluginOperations-CcUSHAIa.js +2 -0
- package/dist/chunks/pluginStartupCheck-CRBUO9gP.js +1 -0
- package/dist/chunks/{pluginStartupCheck-CfRvCrFg.js → pluginStartupCheck-SRXOyqr7.js} +1 -1
- package/dist/chunks/plugins-IwwaCDba.js +4 -0
- package/dist/chunks/{poorMode-J5SYJvoY.js → poorMode-B0QGV6Ci.js} +1 -1
- package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
- package/dist/chunks/print-CgszM1ea.js +13 -0
- package/dist/chunks/processBashCommand-D098WsqY.js +1 -0
- package/dist/chunks/processSlashCommand-DOQFjJ88.js +5 -0
- package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
- package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
- package/dist/chunks/{projectOnboardingState-CJycxw5P.js → projectOnboardingState-B5YATuc6.js} +1 -1
- package/dist/chunks/prompt-BKPmDAuL.js +1 -0
- package/dist/chunks/{prompt-BGqgPgCU.js → prompt-CJ1l3XXk.js} +1 -1
- package/dist/chunks/prompt-CgOklk7z.js +1 -0
- package/dist/chunks/{promptEditor-CmQ9p4oe.js → promptEditor-DoGHJN_W.js} +1 -1
- package/dist/chunks/{protocolHandler-CJo9-PfZ.js → protocolHandler-DjQALaU2.js} +1 -1
- package/dist/chunks/{proxy-CB17QimU.js → proxy-CDBfZjO7.js} +2 -2
- package/dist/chunks/reconciler-ykkSPR-i.js +1 -0
- package/dist/chunks/refresh-Dn_I1R4v.js +1 -0
- package/dist/chunks/{registerProtocol-CLIpzVwF.js → registerProtocol-CAsDme_E.js} +1 -1
- package/dist/chunks/reject-DtcCfuZV.js +1 -0
- package/dist/chunks/{reload-plugins-DjugL8jH.js → reload-plugins-CQZFQLWP.js} +1 -1
- package/dist/chunks/rename-DyEfsZiq.js +1 -0
- package/dist/chunks/{renderOptions-Zqfm2U1y.js → renderOptions-DV0dn0IW.js} +1 -1
- package/dist/chunks/resume-BcXEDUqZ.js +2 -0
- package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
- package/dist/chunks/{ripgrep-BuzOTf1S.js → ripgrep-Dl3y5r4m.js} +1 -1
- package/dist/chunks/{runtimeObserver-CK_iZ6OB.js → runtimeObserver-DEuR8z0f.js} +1 -1
- package/dist/chunks/{runtimeObserver-CpP0L9T9.js → runtimeObserver-PJ1o8GRA.js} +4 -4
- package/dist/chunks/sandbox-adapter-DfB9kgQD.js +1 -0
- package/dist/chunks/{sandbox-toggle-KOHYvbQT.js → sandbox-toggle-D9GDUsTl.js} +1 -1
- package/dist/chunks/searchExtraTools-D4gMMQv0.js +1 -0
- package/dist/chunks/{select-C_KXmqbI.js → select-DIxfl_VN.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-lbgHnVvi.js +1 -0
- package/dist/chunks/{sessionObserver-WOYv2n7C.js → sessionObserver-BtKjvteq.js} +2 -2
- package/dist/chunks/sessionObserver-D6qzEdGJ.js +1 -0
- package/dist/chunks/sessionStorage-C_7gow_z.js +1 -0
- package/dist/chunks/sessionTracing-CtbeAD0s.js +11 -0
- package/dist/chunks/settings-B2jvL8Dp.js +24 -0
- package/dist/chunks/settings-CisDe8DB.js +1 -0
- package/dist/chunks/setup-qecdf-ES.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-Df-kZ_pK.js → shadowedRuleDetection-Bg_aIc5Z.js} +1 -1
- package/dist/chunks/{sideQuestion-CMB8hfgX.js → sideQuestion-D49GsfH7.js} +3 -3
- package/dist/chunks/sinks-C-lP7uyO.js +1 -0
- package/dist/chunks/sinks-De-B1lPQ.js +1 -0
- package/dist/chunks/skillChangeDetector-DkOJoNhT.js +1 -0
- package/dist/chunks/{skillGapStore-CfmlO6pb.js → skillGapStore-CcFoHNLl.js} +2 -2
- package/dist/chunks/{skillLifecycle-BQ2LMfMx.js → skillLifecycle-Bnz_4wE5.js} +2 -2
- package/dist/chunks/{skillSearchPanel-BwYuwLFs.js → skillSearchPanel-C_5yUhqn.js} +2 -2
- package/dist/chunks/{skills-BVHPQma0.js → skills-BE5scC-g.js} +1 -1
- package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
- package/dist/chunks/{startupProfiler-DTs9w9EN.js → startupProfiler-CJdr3SxP.js} +2 -2
- package/dist/chunks/state-B4jiUise.js +1 -0
- package/dist/chunks/state-BhOKSFi5.js +1 -0
- package/dist/chunks/status-Dw09WZLd.js +1 -0
- package/dist/chunks/statusNoticeHelpers-BRQpUIlH.js +1 -0
- package/dist/chunks/{stringUtils-BQm3OfeJ.js → stringUtils-C718f5ey.js} +1 -1
- package/dist/chunks/sts-ei3CGBNu.js +1 -0
- package/dist/chunks/switcher-CgZVah7U.js +1 -0
- package/dist/chunks/{switcher-Bq1Ct_Sn.js → switcher-DZwUo5Ed.js} +1 -1
- package/dist/chunks/{tasks-0c8Uy04D.js → tasks-DdcUQEeD.js} +1 -1
- package/dist/chunks/{templateJobs-BdFzE9XG.js → templateJobs-C8qsPrLj.js} +1 -1
- package/dist/chunks/{terminalSetup-Cf_r6pwK.js → terminalSetup-B_10N_gE.js} +3 -3
- package/dist/chunks/{terminalSetup-D7J6bxcn.js → terminalSetup-qc2PlvOm.js} +1 -1
- package/dist/chunks/{theme-Bby4fssR.js → theme-f1h2QI8J.js} +1 -1
- package/dist/chunks/tipRegistry-B71o4qWr.js +2 -0
- package/dist/chunks/{toolEventObserver-CzFZUIsM.js → toolEventObserver-7QP38x4t.js} +1 -1
- package/dist/chunks/toolPool-V-7Yv0GA.js +1 -0
- package/dist/chunks/{types-zk5Ltv5q.js → types-Dx7P7JLQ.js} +2 -2
- package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
- package/dist/chunks/{use-select-navigation-DMaC_3iw.js → use-select-navigation-hWL5VHnL.js} +1 -1
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CjW3gUOt.js → useExitOnCtrlCDWithKeybindings-BKwzUpgb.js} +1 -1
- package/dist/chunks/useMainLoopModel-DxvV70Ru.js +1 -0
- package/dist/chunks/useManagePlugins-BXLXazrR.js +1 -0
- package/dist/chunks/useMergedTools-CCgnBJzO.js +1 -0
- package/dist/chunks/{useSearchInput-C2JuUW3g.js → useSearchInput-CzopttqC.js} +1 -1
- package/dist/chunks/useSettingsErrors-SFPWfxsA.js +1 -0
- package/dist/chunks/{util-Bq5l7FF5.js → util-Cbb3S6SX.js} +1 -1
- package/dist/chunks/validatePlugin-BMSoeb_b.js +1 -0
- package/dist/chunks/vim-CoRp9lY1.js +1 -0
- package/dist/chunks/worktree-Vm-SNY5x.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -5
- package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +0 -1
- package/dist/chunks/App-BcEI6U5j.js +0 -1
- package/dist/chunks/ApproveApiKey-DegdTXZl.js +0 -1
- package/dist/chunks/ApproveApiKey-_VXIMSwY.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +0 -2
- package/dist/chunks/CustomSelect-B46Eh0gU.js +0 -1
- package/dist/chunks/Doctor-BP0Rqraa.js +0 -1
- package/dist/chunks/Doctor-By_y3C2V.js +0 -3
- package/dist/chunks/Grove-C3mhgshv.js +0 -11
- package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +0 -1
- package/dist/chunks/MCPToolListView-DLSrQHDc.js +0 -1
- package/dist/chunks/MessageSelector-CdDlJE48.js +0 -3
- package/dist/chunks/Messages-DuL_r1Or.js +0 -10
- package/dist/chunks/Onboarding-CE2GNA-h.js +0 -1
- package/dist/chunks/QueryEngine-DNNy1UCD.js +0 -1
- package/dist/chunks/REPL-CEhW-C41.js +0 -1
- package/dist/chunks/REPL-CkSL4C_8.js +0 -124
- package/dist/chunks/ResumeConversation-BMCO_3X7.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +0 -1
- package/dist/chunks/Settings-mDykHLok.js +0 -2
- package/dist/chunks/Spinner-DwsJJUtn.js +0 -1
- package/dist/chunks/TrustDialog-G4jM9IfM.js +0 -1
- package/dist/chunks/add-dir-7RfQAC3h.js +0 -1
- package/dist/chunks/agents-BNg_skSm.js +0 -101
- package/dist/chunks/allErrors-DaztSMrw.js +0 -1
- package/dist/chunks/auth-BTB00dq5.js +0 -10
- package/dist/chunks/auth-Bbc0Ny8i.js +0 -1
- package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +0 -1
- package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +0 -17
- package/dist/chunks/banner-mqZEluky.js +0 -2
- package/dist/chunks/branch-exFKkymg.js +0 -2
- package/dist/chunks/btw-3l78DYET.js +0 -1
- package/dist/chunks/caches-6Nx6tsk9.js +0 -1
- package/dist/chunks/caches-ouaWB9bY.js +0 -1
- package/dist/chunks/client-C01Bnxxv.js +0 -1
- package/dist/chunks/client-DYRgRQsr.js +0 -1
- package/dist/chunks/commands-BoxOw75F.js +0 -1
- package/dist/chunks/compact-BOYr105K.js +0 -2
- package/dist/chunks/config-BddEvZZl.js +0 -3
- package/dist/chunks/config-GEv9hUzz.js +0 -1
- package/dist/chunks/config-kw4xg7Nk.js +0 -1
- package/dist/chunks/context-noninteractive-DFvoZ2L9.js +0 -1
- package/dist/chunks/conversation-CoGharlH.js +0 -1
- package/dist/chunks/conversation-MxEVm54C.js +0 -1
- package/dist/chunks/conversationRecovery-Da_8uldZ.js +0 -1
- package/dist/chunks/crossProjectResume-CzPCHq_K.js +0 -40
- package/dist/chunks/cwd-BcO6WHKo.js +0 -1
- package/dist/chunks/cwd-CDUelriw.js +0 -1
- package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
- package/dist/chunks/dist-es-BIjDeceU.js +0 -1
- package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
- package/dist/chunks/dist-es-CEk66gUu.js +0 -1
- package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
- package/dist/chunks/dist-es-CMtO44xC.js +0 -1
- package/dist/chunks/dist-es-CYPVg66r.js +0 -9
- package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
- package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
- package/dist/chunks/dist-es-kj-F5A132.js +0 -1
- package/dist/chunks/doctor-DWvioSU9.js +0 -1
- package/dist/chunks/esm-BQY8jJNR.js +0 -1
- package/dist/chunks/exit-BxC_ZEtO.js +0 -1
- package/dist/chunks/extraUsage-DYm33Occ.js +0 -1
- package/dist/chunks/extractMemories-CzN3Ax2B.js +0 -1
- package/dist/chunks/fast-DqUpl_Lr.js +0 -1
- package/dist/chunks/fast-NUdUyAaM.js +0 -1
- package/dist/chunks/fetchModelList-CqsTAWEN.js +0 -1
- package/dist/chunks/fetchModelList-DBMHE6Ng.js +0 -1
- package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +0 -3
- package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +0 -1
- package/dist/chunks/generateSessionName-ChvKBVxB.js +0 -1
- package/dist/chunks/goal-ByyimpVU.js +0 -3
- package/dist/chunks/grok-DenjixMl.js +0 -1
- package/dist/chunks/grove-Dq8QbQ9o.js +0 -7
- package/dist/chunks/history-CNQNd6hT.js +0 -1
- package/dist/chunks/hooks-BaYwmkxD.js +0 -1
- package/dist/chunks/instrumentation-BwVyvRfY.js +0 -21
- package/dist/chunks/keybindings-wNxBzDVQ.js +0 -1
- package/dist/chunks/launchOnboarding-CDjQ64RO.js +0 -8
- package/dist/chunks/loadAgentsDir-DKXap_Om.js +0 -1
- package/dist/chunks/loadPluginHooks-DtmHtEiS.js +0 -1
- package/dist/chunks/localSearch-BB9x5C2N.js +0 -1
- package/dist/chunks/logoUtils-Dj_2SWmO.js +0 -1
- package/dist/chunks/main-BRg8L_aw.js +0 -346
- package/dist/chunks/managedEnv-DsqAYOJ4.js +0 -1
- package/dist/chunks/managedEnv-lybrMred.js +0 -1
- package/dist/chunks/mcp-Bsw3cMiJ.js +0 -6
- package/dist/chunks/mcp-DDdud6Y7.js +0 -1
- package/dist/chunks/mcp-DbgTDUt7.js +0 -2
- package/dist/chunks/memory-CzwTzihf.js +0 -1
- package/dist/chunks/model-BYfmXKHf.js +0 -1
- package/dist/chunks/model-BwBE0Pt5.js +0 -1
- package/dist/chunks/modelOptions-DvNBapgG.js +0 -1
- package/dist/chunks/nativeInstaller-DnSNJWIi.js +0 -1
- package/dist/chunks/notifications-B0DTaYoy.js +0 -1
- package/dist/chunks/omit-Dl1Us_PY.js +0 -1
- package/dist/chunks/onChangeAppState-4KOJMN82.js +0 -1
- package/dist/chunks/openai-C_6C1_0N.js +0 -10
- package/dist/chunks/parser-BKAVMTyD.js +0 -1
- package/dist/chunks/partition-B504IgAa.js +0 -1
- package/dist/chunks/permissions-CLFMhdRk.js +0 -3
- package/dist/chunks/pidLock-D9do1Afy.js +0 -3
- package/dist/chunks/plugin-BYdF7uob.js +0 -17
- package/dist/chunks/pluginBlocklist-DKKmOnWM.js +0 -1
- package/dist/chunks/pluginCliCommands-z8TtJMKH.js +0 -1
- package/dist/chunks/pluginOperations-BcfJCDco.js +0 -2
- package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +0 -1
- package/dist/chunks/plugins-CTM8jpOw.js +0 -4
- package/dist/chunks/policyLimits-a7ix6GnU.js +0 -1
- package/dist/chunks/poorMode-C11JEH3d.js +0 -1
- package/dist/chunks/print-u6MzL5Cr.js +0 -13
- package/dist/chunks/processBashCommand-DIwrI2QC.js +0 -1
- package/dist/chunks/processSlashCommand-B-Gujpxm.js +0 -5
- package/dist/chunks/prompt-BPJDGlx5.js +0 -1
- package/dist/chunks/prompt-DEdZzkEz.js +0 -1
- package/dist/chunks/reconciler-DSKLuOS7.js +0 -1
- package/dist/chunks/refresh-BbZFCNpn.js +0 -1
- package/dist/chunks/rename-DOtCOtEr.js +0 -1
- package/dist/chunks/resume-BB4T4WIV.js +0 -2
- package/dist/chunks/ripgrep-CZ2CqaHb.js +0 -1
- package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +0 -1
- package/dist/chunks/searchExtraTools-CdJghGkj.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +0 -1
- package/dist/chunks/sessionObserver-DB-sLv-X.js +0 -1
- package/dist/chunks/sessionStorage-sgOAbDn7.js +0 -1
- package/dist/chunks/sessionTracing-yBre24PH.js +0 -11
- package/dist/chunks/settings-C-KNkvsM.js +0 -1
- package/dist/chunks/settings-DKN4xSpQ.js +0 -24
- package/dist/chunks/setup-CN_Pk7AR.js +0 -3
- package/dist/chunks/sinks-BS17vtN0.js +0 -1
- package/dist/chunks/sinks-D1EjkHb4.js +0 -1
- package/dist/chunks/skillChangeDetector-CBKuGuEi.js +0 -1
- package/dist/chunks/startupProfiler-B_U4QDtf.js +0 -1
- package/dist/chunks/state-BowF111d.js +0 -1
- package/dist/chunks/state-CGuyDES7.js +0 -1
- package/dist/chunks/status-BurdTfyz.js +0 -2
- package/dist/chunks/status-DMq1An5h.js +0 -1
- package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +0 -1
- package/dist/chunks/sts-C2Gf2WYN.js +0 -1
- package/dist/chunks/switcher-DGD4ORVf.js +0 -1
- package/dist/chunks/tipRegistry-CyRXWWTz.js +0 -2
- package/dist/chunks/toolPool-CnrZcprA.js +0 -1
- package/dist/chunks/udsClient-ftP0yIpe.js +0 -1
- package/dist/chunks/useMainLoopModel-DWscpA9I.js +0 -1
- package/dist/chunks/useManagePlugins-CYXVcql2.js +0 -1
- package/dist/chunks/useMergedTools-DarmnCEw.js +0 -1
- package/dist/chunks/useSettingsErrors-DutJBiKZ.js +0 -1
- package/dist/chunks/validatePlugin-DIdEydz_.js +0 -1
- package/dist/chunks/vim-D8prM2IH.js +0 -1
- package/dist/chunks/worktree-Caqt2WRZ.js +0 -1
- /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
- /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
- /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ip as n,Lp as r,mb as i,zp as a}from"./loadAgentsDir-B0Anodo0.js";import{Gt as o,I as s,Lt as c,P as l,ai as u,di as d,fi as f,j as p,t as m,y as h}from"./src-DL3w8VPk.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{Ht as _,b as v,h as y}from"./settings-B2jvL8Dp.js";import{p as b,s as x}from"./config-C-Y2qtB2.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{_ as w,l as T}from"./startupProfiler-CJdr3SxP.js";import{A as E,F as D,G as O,H as k,I as A,K as j,M,N,P,R as F,Z as I,j as L}from"./model-BvQFFOf8.js";import{n as R,t as z}from"./systemTheme-Ceakddth.js";function B({cooldown:e}){return e?(0,H.jsx)(l,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,H.jsx)(l,{color:`fastMode`,children:`↯`})}function V(e=!0,t=!1){if(!e)return`↯`;let n=R(x().theme);return t?d.dim(p(`promptBorder`,n)(`↯`)):p(`fastMode`,n)(`↯`)}var H,U=e((()=>{f(),_(),m(),b(),z(),H=g()}));function W(e,t){P(),v(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!j(e.mainLoopModel);return{...e,...t?{mainLoopModel:D(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let n=r(e=>e.mainLoopModel),i=r(e=>e.fastMode),u=a(),[d,f]=(0,J.useState)(i??!1),p=A(),m=p.status===`cooldown`,g=t!==null,_=E(L(!0));function v(){g||(W(d,u),C(`tengu_fast_mode_toggled`,{enabled:d,source:`picker`}),d?e(`${V(d)} Fast mode ON${j(n)?``:` · model set to ${N}`} · ${_}`):(u(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function y(){if(g){i&&W(!1,u),e(`Fast mode OFF`,{display:`system`});return}e(i?`${V()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function b(){g||f(e=>!e)}return o({"confirm:yes":v,"confirm:nextField":b,"confirm:next":b,"confirm:previous":b,"confirm:cycleMode":b,"confirm:toggle":b},{context:`Confirmation`}),(0,Y.jsxs)(h,{title:(0,Y.jsxs)(l,{children:[(0,Y.jsx)(B,{cooldown:m}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${N}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:y,color:`fastMode`,inputGuide:e=>e.pending?(0,Y.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):g?(0,Y.jsx)(l,{children:`Esc to cancel`}):(0,Y.jsx)(l,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsx)(l,{color:`error`,children:t})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,Y.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(l,{bold:!0,children:`Fast mode`}),(0,Y.jsx)(l,{color:d?`fastMode`:void 0,bold:d,children:d?`ON `:`OFF`}),(0,Y.jsx)(l,{dimColor:!0,children:_})]})}),m&&p.status===`cooldown`&&(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsxs)(l,{color:`warning`,children:[p.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,T(p.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,Y.jsxs)(l,{dimColor:!0,children:[`Learn more:`,` `,(0,Y.jsx)(c,{url:`https://code.workmate.com/docs/en/fast-mode`,children:`https://code.workmate.com/docs/en/fast-mode`})]})]})}async function K(e,t,n){let r=F();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return W(e,n),C(`tengu_fast_mode_toggled`,{enabled:e,source:`shortcut`}),e?`${V(!0)} Fast mode ON${j(i)?``:` · model set to ${N}`} · ${E(L(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!O())return null;await I();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=F();return C(`tengu_fast_mode_picker_shown`,{unavailable_reason:i??``}),(0,Y.jsx)(G,{onDone:e,unavailableReason:i})}var J,Y,X=e((()=>{J=t(u(),1),m(),U(),i(),S(),n(),k(),w(),M(),y(),Y=g()}));export{U as a,V as i,q as n,X as r,G as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./fast-DH-C5IZs.js";t();export{n as FastModePicker,e as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./fetchModelList-FE8tzTDc.js";e();export{t as fetchAvailableModels};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{g as t,v as n}from"./types-Dx7P7JLQ.js";import{c as r,i}from"./debug-Bglx1aTu.js";import{Et as a,Tt as o,Yt as s,Zt as c,at as l,ct as u}from"./model-BvQFFOf8.js";import{n as d,r as f}from"./client-4iqhC8xq.js";async function p(){let e=s();try{switch(e){case`firstParty`:{let e=await o({maxRetries:1}),t=[];for await(let n of e.models.list())t.push({value:n.id,label:n.display_name??n.id,description:n.id});return t.length>0?t:null}case`openai`:{let e=d({maxRetries:1}),t=[];for await(let n of e.models.list())t.push({value:n.id,label:n.id,description:`via openai-compat`});return t.length>0?t:null}case`grok`:{let{getGrokClient:e}=await import(`./client-BiqbIkwr.js`),t=e({maxRetries:1}),n=[];for await(let e of t.models.list())n.push({value:e.id,label:e.id,description:`via grok`});return n.length>0?n:null}case`bedrock`:{let e=(await l()).map(e=>({value:e,label:e,description:`Bedrock inference profile`}));return e.length>0?e:null}case`gemini`:case`vertex`:case`foundry`:return null}}catch(t){return r(`[fetchModelList] ${e} failed: ${t instanceof Error?t.message:`unknown`}`),null}return null}var m,h,g=e((()=>{a(),f(),i(),t(),u(),c(),m=300*1e3,h=n(p,m)}));export{g as n,h as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{Lt as a,_ as o,g as s,jt as c,mn as l,p as u}from"./loadAgentsDir-B0Anodo0.js";import{Jn as d,qn as f}from"./state-B4jiUise.js";import{n as p,t as m}from"./cwd-Pa83R95t.js";import{I as h,M as g,c as _,f as v,i as ee,u as y}from"./debug-Bglx1aTu.js";import{Ir as b,Lr as x,Or as te,er as ne,h as re,nr as ie,t as ae}from"./settings-B2jvL8Dp.js";import{p as oe,s as se}from"./config-C-Y2qtB2.js";import{i as ce,n as S}from"./execFileNoThrow-BTachNBI.js";import{o as le,s as C}from"./log-D2TIwHBV.js";import{n as ue,r as w}from"./analytics-DJobLaWP.js";import{a as de,s as fe}from"./ripgrep-Dl3y5r4m.js";import*as T from"path";import{statSync as pe}from"fs";function me(e,t,n){if(t===0)return n?k:0;let r=e.charCodeAt(t-1);return he(r)?be:ge(r)&&_e(e.charCodeAt(t))?D:0}function he(e){return e===47||e===92||e===45||e===95||e===46||e===32}function ge(e){return e>=97&&e<=122}function _e(e){return e>=65&&e<=90}function E(){return new Promise(e=>setImmediate(e))}function ve(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var ye,be,D,O,k,xe,Se,Ce,A,j,we,Te=e((()=>{n(),ye=16,be=8,D=6,O=4,k=8,xe=3,Se=1,Ce=100,A=64,j=new Int32Array(A),we=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await E(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await E(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=ve(e,Ce)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,A),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*24+k+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){j[0]=g[e];let n=0,o=0,u=j[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}j[e]=t;let i=t-u-1;i===0?o+=O:n+=xe+i*Se,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*ye+o-n;f+=me(v,j[0],!0);for(let e=1;e<i;e++)f+=me(v,j[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function M(){return z||(z=new we),z}function Ee(){z=null,B=null,H++,U=null,W=[],G=[],K=[],V.clear(),q=null,J=null,Y=0,X=null,Z=null,Q=null}function N(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function De(){let e=te(m());if(!e)return null;try{return pe(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function P(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function Oe(e){if(e.length===0||!z||W.length===0)return;let t=await I(e),n=[...W,...G,...K,...e,...t],r=N(n);if(r===Q){_(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await z.loadFromFileListAsync(n).done,Q=r,_(`[FileIndex] rebuilt index with ${W.length} tracked + ${e.length} untracked files`)}async function F(e,t){let n=`${e}:${t}`;if(J===n)return q;let r=y(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,Be.default)(),s=!1,c=a.flatMap(e=>i.map(t=>T.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,_(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return q=u,J=n,u}async function ke(e,t){let n=Date.now();_(`[FileIndex] getFilesUsingGit called`);let r=m(),i=te(r);if(!i)return _(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await S(b(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(_(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return _(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=P(o.stdout.trim().split(`
|
|
2
2
|
`).filter(Boolean),i,r),c=await F(i,r);if(c){let e=s.length;s=c.filter(s),_(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}W=s;let l=Date.now()-n;if(_(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),w(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!U){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=H;U=S(b(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===H&&e.code===0){let t=P(e.stdout.trim().split(`
|
|
3
|
-
`).filter(Boolean),i,r),n=await F(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),_(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}_(`[FileIndex] background untracked fetch: ${t.length} files`),Oe(t)}}).catch(e=>{_(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return s}catch(e){return _(`[FileIndex] git ls-files error: ${g(e)}`),null}}async function I(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)Ae(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await E(),n=performance.now());return[...t].map(e=>e+T.sep)}function Ae(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function je(e){return(await Promise.all(u.map(t=>
|
|
3
|
+
`).filter(Boolean),i,r),n=await F(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),_(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}_(`[FileIndex] background untracked fetch: ${t.length} files`),Oe(t)}}).catch(e=>{_(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return s}catch(e){return _(`[FileIndex] git ls-files error: ${g(e)}`),null}}async function I(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)Ae(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await E(),n=performance.now());return[...t].map(e=>e+T.sep)}function Ae(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function je(e){return(await Promise.all(u.map(t=>o(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function Me(e,t){_(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await ke(e,t);if(n!==null)return _(`[FileIndex] using git ls-files result (${n.length} files)`),n;_(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await fe(i,`.`,e)).map(e=>T.relative(m(),e)),o=Date.now()-r;return _(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),w(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function Ne(){let e=AbortSignal.timeout(1e4),t=M();try{let n=ae(),r=se(),i=n.respectGitignore??r.respectGitignore??!0,a=m(),[o,s]=await Promise.all([Me(e,i),je(a)]);G=s;let c=[...o,...s],l=await I(c);K=l;let u=[...l,...c],d=N(u);d===Z?_(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,Z=d,Q=null)}catch(e){C(e)}return t}function Pe(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function Fe(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=Pe(n,r),n===``)return``}return n}function L(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Ie(e,t){return e.search(t,$).map(e=>L(e.path,e.score))}function R(){if(B)return;let e=De();if(z&&!(e!==null&&e!==X)&&Date.now()-Y<He)return;let t=H,n=Date.now();M(),B=Ne().then(r=>t===H?(B=null,V.emit(),X=e,Y=Date.now(),_(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(_(`[FileIndex] Cache refresh failed: ${g(e)}`),C(e),t===H&&(B=null),M()))}async function Le(){let e=y(),t=m();try{return(await e.readdir(t)).map(e=>{let n=T.join(t,e.name),r=T.relative(t,n);return e.isDirectory()?r+T.sep:r})}catch(e){return C(e),[]}}async function Re(e,t=!1){if(!e&&!t)return[];if(ae().fileSuggestion?.type===`command`)return(await a({...c(),query:e})).slice(0,$).map(L);if(e===``||e===`.`||e===`./`){let e=await Le();return R(),e.slice(0,$).map(L)}let n=Date.now();try{let t=B!==null;R();let r=e,i=`.${T.sep}`;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=ne(r));let a=z?Ie(z,r):[],o=Date.now()-n;return _(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),w(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return C(e),[]}}function ze(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var Be,z,B,V,Ve,H,U,W,G,K,q,J,Y,X,Z,Q,$,He,Ue=e((()=>{Be=t(i(),1),s(),Te(),ue(),oe(),p(),ee(),h(),ce(),v(),x(),l(),le(),ie(),de(),re(),d(),z=null,B=null,V=f(),Ve=V.subscribe,H=0,U=null,W=[],G=[],K=[],q=null,J=null,Y=0,X=null,Z=null,Q=null,$=15,He=5e3}));export{Ue as a,Re as i,Ee as n,Ve as o,Fe as r,R as s,ze as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{i as r,l as i,o as a}from"./envUtils-DfkgIdYf.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{C as c,v as l,w as u}from"./esm-BbMeEYcz.js";import{Tt as d,Z as f,_ as ee,c as te,et as p,it as ne,n as re,o as ie,t as ae,v as oe,w as m,wt as se}from"./esm-BXTZz3av.js";import{n as h,t as ce}from"./axios-DaWTGg7G.js";import{d as le,l as ue}from"./types-Dx7P7JLQ.js";import{It as g,st as _}from"./state-B4jiUise.js";import{n as de,t as fe}from"./cwd-Pa83R95t.js";import{C as v,I as pe,M as me,V as he,x as ge,z as _e}from"./debug-Bglx1aTu.js";import{Gt as ve,qt as ye}from"./settings-B2jvL8Dp.js";import{p as y,u as b}from"./config-C-Y2qtB2.js";import{a as be,s as xe}from"./execFileNoThrow-BTachNBI.js";import{d as Se,o as Ce,p as x,s as S}from"./log-D2TIwHBV.js";import{a as we,i as Te,o as Ee}from"./platform-BacQ6ACS.js";import{i as De,n as Oe}from"./analytics-DJobLaWP.js";import{n as ke,r as C}from"./startupProfiler-CJdr3SxP.js";import*as w from"path";import{randomUUID as T}from"crypto";import{appendFile as Ae,mkdir as E,readdir as je,unlink as D,writeFile as Me}from"fs/promises";function O(e,t,n){return new Promise((r,i)=>{if(t?.aborted){n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r();return}let a=setTimeout((e,t,n)=>{e?.removeEventListener(`abort`,t),n()},e,t,o,r);function o(){clearTimeout(a),n?.throwOnAbort||n?.abortError?i(n.abortError?.()??Error(`aborted`)):r()}t?.addEventListener(`abort`,o,{once:!0}),n?.unref&&a.unref()})}var k=e((()=>{}));function A(){return i(process.env.CLAUDE_CODE_USE_BEDROCK)||i(process.env.CLAUDE_CODE_USE_VERTEX)||i(process.env.CLAUDE_CODE_USE_FOUNDRY)||x()}function Ne(){return x()}var Pe=e((()=>{a(),Se()}));async function Fe(){}var Ie,j,M=e((()=>{xe(),n(),g(),y(),de(),ye(),a(),Ie=t(e=>({deviceId:b(),sessionId:_(),email:void 0,appVersion:`0.0.24`,platform:ve(),userType:process.env.USER_TYPE,...i(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}})),j=t(async()=>{let e=await be(`git config --get user.email`,{shell:!0,reject:!1,cwd:fe()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function Le(){return{seconds:0,nanos:0}}function N(e){return e!=null}var P,Re=e((()=>{P={fromJSON(e){return{seconds:N(e.seconds)?globalThis.Number(e.seconds):0,nanos:N(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return P.fromPartial(e??{})},fromPartial(e){let t=Le();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function ze(){return{account_id:0,organization_uuid:``,account_uuid:``}}function F(e){return e!=null}var I,Be=e((()=>{I={fromJSON(e){return{account_id:F(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:F(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:F(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return I.fromPartial(e??{})},fromPartial(e){let t=ze();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function Ve(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function He(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function Ue(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function We(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function Ge(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function L(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):Ge(P.fromJSON(e))}function R(e){return e!=null}var z,B,V,H,Ke=e((()=>{Re(),Be(),z={fromJSON(e){return{actor_id:R(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:R(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:R(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return z.fromPartial(e??{})},fromPartial(e){let t=Ve();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},B={fromJSON(e){return{platform:R(e.platform)?globalThis.String(e.platform):``,node_version:R(e.node_version)?globalThis.String(e.node_version):``,terminal:R(e.terminal)?globalThis.String(e.terminal):``,package_managers:R(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:R(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:R(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:R(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:R(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:R(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:R(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:R(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:R(e.version)?globalThis.String(e.version):``,github_event_name:R(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:R(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:R(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:R(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:R(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:R(e.github_actions_metadata)?z.fromJSON(e.github_actions_metadata):void 0,arch:R(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:R(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:R(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:R(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:R(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:R(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:R(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:R(e.version_base)?globalThis.String(e.version_base):``,coworker_type:R(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:R(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:R(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:R(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:R(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:R(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:R(e.vcs)?globalThis.String(e.vcs):``,platform_raw:R(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=z.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return B.fromPartial(e??{})},fromPartial(e){let t=He();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?z.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},V={fromJSON(e){return{slack_team_id:R(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:R(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:R(e.trigger)?globalThis.String(e.trigger):``,creation_method:R(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return V.fromPartial(e??{})},fromPartial(e){let t=Ue();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},H={fromJSON(e){return{event_name:R(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:R(e.client_timestamp)?L(e.client_timestamp):void 0,model:R(e.model)?globalThis.String(e.model):``,session_id:R(e.session_id)?globalThis.String(e.session_id):``,user_type:R(e.user_type)?globalThis.String(e.user_type):``,betas:R(e.betas)?globalThis.String(e.betas):``,env:R(e.env)?B.fromJSON(e.env):void 0,entrypoint:R(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:R(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:R(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:R(e.client_type)?globalThis.String(e.client_type):``,process:R(e.process)?globalThis.String(e.process):``,additional_metadata:R(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:R(e.auth)?I.fromJSON(e.auth):void 0,server_timestamp:R(e.server_timestamp)?L(e.server_timestamp):void 0,event_id:R(e.event_id)?globalThis.String(e.event_id):``,device_id:R(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:R(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:R(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:R(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:R(e.email)?globalThis.String(e.email):``,agent_id:R(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:R(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:R(e.agent_type)?globalThis.String(e.agent_type):``,slack:R(e.slack)?V.fromJSON(e.slack):void 0,team_name:R(e.team_name)?globalThis.String(e.team_name):``,skill_name:R(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:R(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:R(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=B.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=I.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=V.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return H.fromPartial(e??{})},fromPartial(e){let t=We();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?B.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?I.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?V.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function U(){return w.join(r(),`telemetry`)}function qe(e){if(!h.isAxiosError(e))return me(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var W,G,K,Je=e((()=>{oe(),ce(),g(),Ke(),a(),pe(),ue(),Ce(),k(),ge(),d(),Oe(),p(),o(),W=T(),G=`1p_failed_events.`,K=class{constructor(e={}){s(this,`endpoint`,void 0),s(this,`timeout`,void 0),s(this,`maxBatchSize`,void 0),s(this,`batchDelayMs`,void 0),s(this,`baseBackoffDelayMs`,void 0),s(this,`maxBackoffDelayMs`,void 0),s(this,`maxAttempts`,void 0),s(this,`isKilled`,void 0),s(this,`pendingExports`,[]),s(this,`isShutdown`,!1),s(this,`schedule`,void 0),s(this,`cancelBackoff`,null),s(this,`attempts`,0),s(this,`isRetrying`,!1),s(this,`lastExportErrorContext`,void 0);let t=e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`);this.endpoint=`${t}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return w.join(U(),`${G}${_()}.${W}.json`)}async loadEventsFromFile(e){try{return await le(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await D(e)}catch{}else await E(U(),{recursive:!0}),await Me(e,`${t.map(e=>v(e)).join(`
|
|
2
|
+
`)}\n`,`utf8`)}catch(e){S(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await E(U(),{recursive:!0}),await Ae(e,`${t.map(e=>v(e)).join(`
|
|
3
|
+
`)}\n`,`utf8`)}catch(e){S(e)}}async deleteFile(e){try{await D(e)}catch{}}async retryPreviousBatches(){try{let e=`${G}${_()}.`,t;try{t=(await je(U())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(W))}catch(e){if(_e(e))return;throw e}for(let e of t){let t=w.join(U(),e);this.retryFileInBackground(t)}}catch(e){S(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}let n=await this.sendEventsInBatches(t);n.length===0?await this.deleteFile(e):await this.saveEventsToFile(e,n)}async export(e,t){if(this.isShutdown){t({code:m.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{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:m.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:m.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:m.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:m.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:m.SUCCESS})}catch(e){S(e),t({code:m.FAILED,error:he(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=qe(i);for(let r=e;r<t.length;r++)n.push(...t[r]);break}e<t.length-1&&this.batchDelayMs>0&&await O(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;S(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff()}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":se(),"x-service-name":`workmate`};try{let n=await h.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}catch(e){throw e}}logSuccess(e,t,n){}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{},r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){t.push({event_type:`ClaudeCodeInternalEvent`,event_data:H.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:_(),additional_metadata:Buffer.from(v({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=ne(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=De(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:H.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(v(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush()}async forceFlush(){await Promise.all(this.pendingExports)}}}));function q(e){return!1}var Ye=e((()=>{}));function J(){return{}}function Xe(e){let t=J()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}async function Ze(){if($)try{await $.shutdown()}catch{}}function Y(){return!A()}async function Qe(e,t,n={}){try{let r=await f({model:n.model,betas:n.betas}),i={event_name:t,event_id:T(),core_metadata:r,user_metadata:Ie(!0),event_metadata:n},a=b();a&&(i.user_id=a),e.emit({body:t,attributes:i})}catch{}}function $e(e,t={}){Y()&&(!Q||q(`firstParty`)||Qe(Q,e,t))}function et(){if(C(`1p_event_logging_start`),!Y())return;C(`1p_event_after_config`);let e=parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||X.toString(),10),t=Z,n=tt,r=Te(),i={[c]:`workmate`,[u]:`0.0.24`};if(r===`wsl`){let e=we();e&&(i[`wsl.version`]=e)}$=new ie({resource:ee(i),processors:[new re(new K({maxBatchSize:t,isKilled:()=>q(`firstParty`)}),{scheduledDelayMillis:e,maxExportBatchSize:t,maxQueueSize:n})]}),Q=$.getLogger(`com.anthropic.claude_code.events`,`0.0.24`)}var X,Z,tt,Q,$,nt=e((()=>{te(),ae(),l(),y(),Ee(),ke(),M(),Pe(),Je(),p(),Ye(),X=1e4,Z=200,tt=8192,Q=null,$=null}));export{$e as a,j as c,Pe as d,A as f,O as h,Y as i,Fe as l,k as m,nt as n,Xe as o,Ne as p,et as r,Ze as s,J as t,M as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./firstPartyEventLogger-QmjjQmgt.js";e();export{t as initialize1PEventLogging};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
2
|
-
`)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`))continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);r===`data`&&(o.data=o.data?`${o.data}\n${i}`:i)}o.data&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function S(){return(process.env.GEMINI_BASE_URL||T).replace(/\/+$/,``)}function C(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*w(e){let t=await(e.fetchOverride??fetch)(`${S()}/${C(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...y({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,E);let{frames:a,remaining:o}=x(i);i=o;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${h(e)}`)}}i+=r.decode();let{frames:e}=x(i);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${h(e)}`)}}finally{n.releaseLock()}}var T,E,D=e((()=>{m(),v(),T=`https://generativelanguage.googleapis.com/v1beta`,E={stream:!0}}));async function*O(e,
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{KS as t,PS as n,WS as r,YS as i,Yi as a,ZS as o,da as s,eC as c,et as l,iS as u,la as d,qS as f,rt as p}from"./loadAgentsDir-B0Anodo0.js";import{I as m,M as h,c as g,i as _}from"./debug-Bglx1aTu.js";import{c as v,i as y}from"./proxy-CDBfZjO7.js";import{randomUUID as b}from"crypto";function x(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={};for(let e of a.split(`
|
|
2
|
+
`)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`))continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);r===`data`&&(o.data=o.data?`${o.data}\n${i}`:i)}o.data&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function S(){return(process.env.GEMINI_BASE_URL||T).replace(/\/+$/,``)}function C(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*w(e){let t=await(e.fetchOverride??fetch)(`${S()}/${C(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...y({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,E);let{frames:a,remaining:o}=x(i);i=o;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${h(e)}`)}}i+=r.decode();let{frames:e}=x(i);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${h(e)}`)}}finally{n.releaseLock()}}var T,E,D=e((()=>{m(),v(),T=`https://generativelanguage.googleapis.com/v1beta`,E={stream:!0}}));async function*O(e,n,a,l,m,h){try{let u=c(m.model),_=s(e,a),v=(await Promise.all(a.map(e=>p(e,{getToolPermissionContext:m.getToolPermissionContext,tools:a,agents:m.agents,allowedAgentTypes:m.allowedAgentTypes,model:m.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:y,systemInstruction:x}=i(_,n),S=f(v),C=t(m.toolChoice),T=w({model:u,signal:l,fetchOverride:m.fetchOverride,body:{contents:y,...x&&{systemInstruction:x},...S.length>0&&{tools:S},...C&&{toolConfig:{functionCallingConfig:C}},generationConfig:{...m.temperatureOverride!==void 0&&{temperature:m.temperatureOverride},...h.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...h.type===`enabled`&&{thinkingBudget:h.budgetTokens}}}}}});g(`[Gemini] Calling model=${u}, messages=${y.length}, tools=${S.length}`);let E=r(T,u),D={},O=null,k=0,A=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,k=Date.now()-A;break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.type===`thinking`?r.signature=n.signature:r[o]=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:d([t],a,m.agentId)},requestId:void 0,type:`assistant`,uuid:b(),timestamp:new Date().toISOString()};break}case`message_delta`:case`message_stop`:break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:k}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);g(`[Gemini] Error: ${t}`,{level:`error`}),yield u({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{l(),_(),a(),D(),n()}))();export{O as queryModelGemini};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{X as t,Yi as n,Yx as r,Z as i,aC as a,qg as o}from"./loadAgentsDir-B0Anodo0.js";import{f as s,l as c}from"./types-Dx7P7JLQ.js";import{I as l,M as u,c as d,i as f}from"./debug-Bglx1aTu.js";import{r as p,t as m}from"./sessionTitle-k4wpUS5l.js";async function h(e,t){let n=m(e);if(!n)return null;try{let e=await i({systemPrompt:a([`Generate a short kebab-case name (2-4 words) that captures the main topic of this conversation. Use lowercase words separated by hyphens. Examples: "fix-login-bug", "add-auth-feature", "refactor-api-client", "debug-test-failures". Return JSON with a "name" field.`]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:t,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),o=s(Array.isArray(e.message.content)?r(e.message.content):e.message.content);return o&&typeof o==`object`&&`name`in o&&typeof o.name==`string`?o.name:null}catch(e){return d(`generateSessionName failed: ${u(e)}`,{level:`error`}),null}}var g=e((()=>{t(),f(),l(),c(),n(),p(),o()}));export{g as n,h as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-BTachNBI.js";function i(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}async function a(e,t=10){if(process.platform===`win32`){let r=await n(`powershell.exe`,[`-NoProfile`,`-Command`,`
|
|
2
2
|
$pid = ${String(e)}
|
|
3
3
|
$ancestors = @()
|
|
4
4
|
for ($i = 0; $i -lt ${t}; $i++) {
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$c as t,Ag as n,Fg as r,Qc as i,al as a,cl as o,dl as s,el as c,fl as l,il as u,ll as d,nl as f,ol as p,pl as m,rl as h,tl as g}from"./loadAgentsDir-B0Anodo0.js";import{I as _,P as v,t as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{t as x}from"./select-DIxfl_VN.js";import{t as S}from"./CustomSelect-wmZ9jz0W.js";import{n as C,t as w}from"./PermissionDialog-BaibiQae.js";function T({currentGoal:e,newObjective:t,onConfirm:n,onCancel:r}){function i(e){e===`yes`?n():r()}let o=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,E.jsx)(w,{color:`warning`,title:`Replace active goal?`,children:(0,E.jsxs)(_,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,E.jsx)(v,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,E.jsxs)(_,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(v,{dimColor:!0,children:`Current goal:`}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Status: `}),a(e.status)]}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Time: `}),u(e)]}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Tokens: `}),o]})]}),(0,E.jsxs)(_,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(v,{dimColor:!0,children:`New objective:`}),(0,E.jsx)(v,{children:t})]}),(0,E.jsx)(_,{marginTop:1,children:(0,E.jsx)(x,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:i,onCancel:r})})]})})}var E,D=e((()=>{y(),S(),C(),d(),E=b()}));function O(e){let t=e.split(`
|
|
2
|
+
`)[0]??e;return t.length<=F?t:`${t.slice(0,F)}…`}function k(){r(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function A(){let e=p();if(!e)return"No active goal. Set one with `/goal <objective>`.";let t=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`,n=[`Goal: ${e.objective}`,`Status: ${a(e.status)}`,`Time: ${u(e)}`,`Tokens: ${t}`,`Continuation turns: ${e.turnsExecuted}`];return e.status===`max_turns`&&n.push("Hint: Max continuation turns reached (150). Run `/goal continue` to reset and continue."),n.join(`
|
|
3
|
+
`)}function j(e){return m(e),o(),t(),`Goal set.`}async function M(e,n,r){let i=r.trim();if(!i||i.toLowerCase()===`status`)return e(A(),{display:`system`}),null;let a=i.toLowerCase();if(a===`clear`){let t=g();return t&&(c(),k()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(a===`pause`){let n=s();return n&&(t(),k()),e(n?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(a===`resume`){if(p()?.status===`max_turns`)return e("Goal reached max continuation turns (150). Run `/goal continue` to reset turn counter and continue.",{display:`system`}),null;let n=l();return n&&t(),e(n?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!n}),null}if(a===`continue`){let n=h();return n&&t(),e(n?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!n}),null}if(a===`complete`){let n=f();return n&&(t(),k()),e(n?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(i.length>P)return e(`Goal objective is too long (${i.length} chars; limit ${P}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let o=p();return o&&o.status!==`complete`?(0,N.jsx)(T,{currentGoal:o,newObjective:i,onConfirm:()=>{k(),e(j(i),{display:`system`,shouldQuery:!0,displayArgs:O(i),metaMessages:[`<goal-objective-updated>\n${i}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(j(i),{display:`system`,shouldQuery:!0,displayArgs:O(i),metaMessages:[`<goal-objective-updated>\n${i}\n</goal-objective-updated>`]}),null)}var N,P,F;e((()=>{d(),i(),n(),D(),N=b(),P=4e3,F=80}))();export{M as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{BS as t,FS as n,LS as r,PS as i,RS as a,Yi as o,da as s,et as c,iS as l,la as u,nC as d,n_ as f,o_ as p,rt as m}from"./loadAgentsDir-B0Anodo0.js";import{c as h,i as g}from"./debug-Bglx1aTu.js";import{M as _,k as v}from"./model-BvQFFOf8.js";import{n as y,t as b}from"./client-CpTCeWba.js";import{n as x,t as S}from"./openaiShared-G2-w4gJt.js";import{randomUUID as C}from"crypto";async function*w(e,i,o,c,p){try{let l=d(p.model),g=s(e,o),_=(await Promise.all(o.map(e=>m(e,{getToolPermissionContext:p.getToolPermissionContext,tools:o,agents:p.agents,allowedAgentTypes:p.allowedAgentTypes,model:p.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),y=t(g,i),S=a(_),w=r(p.toolChoice),T=b({maxRetries:0,fetchOverride:p.fetchOverride,source:p.querySource});h(`[Grok] Calling model=${l}, messages=${y.length}, tools=${S.length}`);let E=n(await T.chat.completions.create({model:l,messages:y,...S.length>0&&{tools:S,...w&&{tool_choice:w}},stream:!0,stream_options:{include_usage:!0},...p.temperatureOverride!==void 0&&{temperature:p.temperatureOverride}},{signal:c}),l),D={},O=null,k={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},A=0,j=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,A=Date.now()-j,e.message.usage&&(k=x(k,e.message.usage));break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:u([t],o,p.agentId)},requestId:void 0,type:`assistant`,uuid:C(),timestamp:new Date().toISOString()};break}case`message_delta`:{let t=e.usage;t&&(k=x(k,t));break}case`message_stop`:break}e.type===`message_stop`&&k.input_tokens+k.output_tokens>0&&f(v(l,k),k,p.model),yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:A}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);h(`[Grok] Error: ${t}`,{level:`error`}),yield l({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{y(),S(),i(),o(),c(),g(),p(),_()}))();export{w as queryModelGrok};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function e(){return{success:!1}}async function t(){}async function n(e){}async function r(){return!1}async function i(){return{success:!1}}function a(e,t,n){return!1}async function o(){}export{r as a,e as i,o as n,t as o,i as r,n as s,a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ei as n,Ni as r,Si as i,bb as a,gb as o,hb as s,mb as c}from"./loadAgentsDir-B0Anodo0.js";import{I as l,Lt as u,P as d,Wt as f,a as p,ai as m,n as h,ot as g,r as _,t as v,x as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{v as x,y as S}from"./startupProfiler-CJdr3SxP.js";import{n as C,t as w}from"./useExitOnCtrlCDWithKeybindings-BKwzUpgb.js";import{n as T,t as E}from"./select-DIxfl_VN.js";import{n as D,r as O}from"./modalContext-DDZdU1J8.js";import{n as k,t as A}from"./PromptInputHelpMenu-3QNUC2Cg.js";function j({commands:e,maxHeight:t,columns:r,title:i,onCancel:a,emptyMessage:o}){let{headerFocused:s,focusHeader:c}=p(),u=Math.max(1,r-10),f=Math.max(1,Math.floor((t-10)/2)),m=(0,M.useMemo)(()=>{let t=new Set;return e.filter(e=>t.has(e.name)?!1:(t.add(e.name),!0)).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({label:`/${e.name}`,value:e.name,description:S(n(e),u,!0)}))},[e,u]);return(0,N.jsx)(l,{flexDirection:`column`,paddingY:1,children:e.length===0&&o?(0,N.jsx)(d,{dimColor:!0,children:o}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(d,{children:i}),(0,N.jsx)(l,{marginTop:1,children:(0,N.jsx)(E,{options:m,visibleOptionCount:f,onCancel:a,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:c,isDisabled:s})})]})})}var M,N,P=e((()=>{M=t(m(),1),r(),x(),v(),T(),N=b()}));function F(){return(0,I.jsxs)(l,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,I.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(d,{bold:!0,children:`Getting started`}),(0,I.jsxs)(l,{flexDirection:`column`,children:[(0,I.jsxs)(d,{children:[(0,I.jsx)(d,{bold:!0,children:`1. `}),(0,I.jsx)(d,{children:`Ask a question or describe a task — Work Mate will explore your code and respond.`})]}),(0,I.jsxs)(d,{children:[(0,I.jsx)(d,{bold:!0,children:`2. `}),(0,I.jsx)(d,{children:`When Work Mate wants to edit files or run commands, you review and approve each action.`})]}),(0,I.jsxs)(d,{children:[(0,I.jsx)(d,{bold:!0,children:`3. `}),(0,I.jsx)(d,{children:`Type `}),(0,I.jsx)(d,{bold:!0,children:`/help`}),(0,I.jsx)(d,{children:` for commands, or `}),(0,I.jsx)(d,{bold:!0,children:`?`}),(0,I.jsx)(d,{children:` for shortcuts.`})]})]})]}),(0,I.jsxs)(l,{flexDirection:`column`,children:[(0,I.jsx)(l,{children:(0,I.jsx)(d,{bold:!0,children:`Shortcuts`})}),(0,I.jsx)(A,{gap:2,fixedWidth:!0})]})]})}var I,L=e((()=>{v(),k(),I=b()}));function R({onClose:e,commands:t}){let{rows:n,columns:r}=g(),a=Math.floor(n/2),s=O(),c=()=>e(`Help dialog dismissed`,{display:`system`});f(`help:dismiss`,c,{context:`Help`});let p=C(c),m=o(`help:dismiss`,`Help`,`esc`),v=i(),b=t.filter(e=>v.has(e.name)&&!e.isHidden),x=t.filter(e=>!v.has(e.name)&&!e.isHidden),S=[(0,z.jsx)(h,{title:`general`,children:(0,z.jsx)(F,{})},`general`)];return S.push((0,z.jsx)(h,{title:`commands`,children:(0,z.jsx)(j,{commands:b,maxHeight:a,columns:r,title:`Browse default commands:`,onCancel:c})},`commands`)),S.push((0,z.jsx)(h,{title:`custom-commands`,children:(0,z.jsx)(j,{commands:x,maxHeight:a,columns:r,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:c})},`custom`)),(0,z.jsx)(l,{flexDirection:`column`,height:s?void 0:a,children:(0,z.jsxs)(y,{color:`professionalBlue`,children:[(0,z.jsx)(_,{title:`Work Mate v0.0.24`,color:`professionalBlue`,defaultTab:`general`,children:S}),(0,z.jsx)(l,{marginTop:1,children:(0,z.jsxs)(d,{children:[`For more help: `,(0,z.jsx)(u,{url:`https://code.workmate.com/docs/en/overview`})]})}),(0,z.jsx)(l,{marginTop:1,children:(0,z.jsx)(d,{dimColor:!0,children:p.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,p.keyName,` again to exit`]}):(0,z.jsxs)(d,{italic:!0,children:[m,` to cancel`]})})})]})})}var z,B=e((()=>{w(),s(),r(),D(),a(),v(),c(),P(),L(),z=b()})),V,H;e((()=>{B(),V=b(),H=async(e,{options:{commands:t}})=>(0,V.jsx)(R,{commands:t,onClose:e})}))();export{H as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,l as n,o as r}from"./envUtils-DfkgIdYf.js";import{It as i,Q as a,st as o}from"./state-B4jiUise.js";import{$ as s,C as c,I as l,N as u,S as d,c as f,et as p,f as m,h,i as g,x as _}from"./debug-Bglx1aTu.js";import{b as v,x as y}from"./config-C-Y2qtB2.js";import{h as b,m as x}from"./firstPartyEventLogger-QmjjQmgt.js";import{a as S,i as C,n as w,r as T}from"./pasteStore-P0zP-ch0.js";import{join as E}from"path";import{appendFile as D,writeFile as O}from"fs/promises";function k(e){return(e.match(/\r\n|\r|\n/g)||[]).length}function A(e,t){return t===0?`[Pasted text #${e}]`:`[Pasted text #${e} +${t} lines]`}function j(e){return`[Image #${e}]`}function M(e){return[...e.matchAll(/\[(Pasted text|Image|\.\.\.Truncated text) #(\d+)(?: \+\d+ lines)?(\.)*\]/g)].map(e=>({id:parseInt(e[2]||`0`,10),match:e[0],index:e.index})).filter(e=>e.id>0)}function N(e,t){let n=M(e),r=e;for(let e=n.length-1;e>=0;e--){let i=n[e],a=t[i.id];a?.type===`text`&&(r=r.slice(0,i.index)+a.content+r.slice(i.index+i.match.length))}return r}function P(e){return d(e)}async function*F(){let e=o();for(let e=q.length-1;e>=0;e--)yield q[e];let n=E(t(),`history.jsonl`);try{for await(let t of h(n))try{let n=P(t);if(n.sessionId===e&&Q.has(n.timestamp))continue;yield n}catch(e){f(`Failed to parse history line: ${e}`)}}catch(e){if(u(e)===`ENOENT`)return;throw e}}async function*I(){for await(let e of F())yield await z(e)}async function*L(){let e=a(),t=o(),n=[],r=0;for await(let i of F())if(!(!i||typeof i.project!=`string`)&&i.project===e&&(i.sessionId===t?(yield await z(i),r++):n.push(i),r+n.length>=G))break;for(let e of n){if(r>=G)return;yield await z(e),r++}}async function R(e){if(e.content)return{id:e.id,type:e.type,content:e.content,mediaType:e.mediaType,filename:e.filename};if(e.contentHash){let t=await C(e.contentHash);if(t)return{id:e.id,type:e.type,content:t,mediaType:e.mediaType,filename:e.filename}}return null}async function z(e){let t={};for(let[n,r]of Object.entries(e.pastedContents||{})){let e=await R(r);e&&(t[Number(n)]=e)}return{display:e.display,pastedContents:t}}async function B(){if(q.length===0)return;let e;try{let n=E(t(),`history.jsonl`);await O(n,``,{encoding:`utf8`,mode:384,flag:`a`}),e=await y(n,{stale:1e4,retries:{retries:3,minTimeout:50}});let r=q.map(e=>`${c(e)}\n`);q=[],await D(n,r.join(``),{mode:384})}catch(e){f(`Failed to write prompt history: ${e}`)}finally{e&&await e()}}async function V(e){if(!(J||q.length===0)&&!(e>5)){J=!0;try{await B()}finally{J=!1,q.length>0&&(await b(500),V(e+1))}}}async function H(e){let t=typeof e==`string`?{display:e,pastedContents:{}}:e,n={};if(t.pastedContents){for(let[e,r]of Object.entries(t.pastedContents))if(r.type!==`image`)if(r.content.length<=K)n[Number(e)]={id:r.id,type:r.type,content:r.content,mediaType:r.mediaType,filename:r.filename};else{let t=w(r.content);n[Number(e)]={id:r.id,type:r.type,contentHash:t,mediaType:r.mediaType,filename:r.filename},S(t,r.content)}}let r={...t,pastedContents:n,timestamp:Date.now(),project:a(),sessionId:o()};q.push(r),Z=r,Y=V(0)}function U(e){n(process.env.CLAUDE_CODE_SKIP_PROMPT_HISTORY)||(X||(X=!0,p(async()=>{Y&&await Y,q.length>0&&await B()})),H(e))}function W(){if(!Z)return;let e=Z;Z=null;let t=q.lastIndexOf(e);t===-1?Q.add(e.timestamp):q.splice(t,1)}var G,K,q,J,Y,X,Z,Q,$=e((()=>{i(),s(),g(),r(),l(),m(),v(),T(),x(),_(),G=100,K=1024,q=[],J=!1,Y=null,X=!1,Z=null,Q=new Set}));export{L as a,I as c,A as i,M as l,N as n,k as o,j as r,$ as s,U as t,W as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Kt as e,mn as t,on as n}from"./loadAgentsDir-B0Anodo0.js";t();export{e as executeSessionEndHooks,n as getSessionEndHookTimeoutMs};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Cd as o,Ec as s,Ed as c,Hp as l,Ip as u,Lp as d,Rp as ee,Sd as f,Tc as p,Td as m,Up as h,bd as g,mb as _,wd as v,xd as y}from"./loadAgentsDir-B0Anodo0.js";import{I as b,Lt as x,P as S,Wt as C,ai as w,t as T,y as E}from"./src-DL3w8VPk.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{It as O,rt as te}from"./state-B4jiUise.js";import{d as k,h as ne,s as A}from"./settings-B2jvL8Dp.js";import{l as j,o as M}from"./stringUtils-C718f5ey.js";import{n as N,r as re}from"./analytics-DJobLaWP.js";import{n as P,t as F}from"./select-DIxfl_VN.js";function ie(e,t){let n={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},r=L(t);g(e).forEach(e=>{let t=n[e.event];if(t){let n=r[e.event].matcherMetadata===void 0?``:e.matcher||``;t[n]||(t[n]=[]),t[n].push(e)}});let i=te();if(i)for(let[e,t]of Object.entries(i)){let r=e,i=n[r];if(i)for(let e of t??[]){let t=e.matcher||``;if(`pluginRoot`in e){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:n,matcher:e.matcher,source:`pluginHook`,pluginName:e.pluginId})}}}return n}function ae(e,t){return c(Object.keys(e[t]||{}),e,t)}function oe(e,t,n){let r=n??``;return e[t]?.[r]??[]}function I(e,t){return L(t)[e].matcherMetadata}var L,R=e((()=>{r(),O(),m(),L=n(e=>({PreToolUse:{summary:`Before tool execution`,description:`Input to command is JSON of tool call arguments.
|
|
2
2
|
Exit code 0 - stdout/stderr not shown
|
|
3
3
|
Exit code 2 - show stderr to model and block tool call
|
|
4
4
|
Other exit codes - show stderr to user only but continue with tool call`,matcherMetadata:{fieldToMatch:`tool_name`,values:e}},PostToolUse:{summary:`After tool execution`,description:`Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).
|
|
@@ -33,7 +33,7 @@ Other exit codes - show stderr to user only but continue with compaction`,matche
|
|
|
33
33
|
Exit code 0 - stdout shown to user
|
|
34
34
|
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:`trigger`,values:[`manual`,`auto`]}},SessionEnd:{summary:`When a session is ending`,description:`Input to command is JSON with session end reason.
|
|
35
35
|
Exit code 0 - command completes successfully
|
|
36
|
-
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:`reason`,values:[`clear`,`
|
|
36
|
+
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:`reason`,values:[`clear`,`prompt_input_exit`,`other`]}},PermissionRequest:{summary:`When a permission dialog is displayed`,description:`Input to command is JSON with tool_name, tool_input, and tool_use_id.
|
|
37
37
|
Output JSON with hookSpecificOutput containing decision to allow or deny.
|
|
38
38
|
Exit code 0 - use hook decision if provided
|
|
39
39
|
Other exit codes - show stderr to user only`,matcherMetadata:{fieldToMatch:`tool_name`,values:e}},Setup:{summary:`Repo setup hooks for init and maintenance`,description:`Input to command is JSON with trigger (init or maintenance).
|
|
@@ -76,4 +76,4 @@ CLAUDE_ENV_FILE is set — write bash exports there to apply env to subsequent B
|
|
|
76
76
|
The matcher field specifies filenames to watch in the current directory (e.g. ".envrc|.env").
|
|
77
77
|
Hook output can include hookSpecificOutput.watchPaths (array of absolute paths) to dynamically update the watch list.
|
|
78
78
|
Exit code 0 - command completes successfully
|
|
79
|
-
Other exit codes - show stderr to user only`}}),e=>e.slice().sort().join(`,`))}));function z({hookEventMetadata:e,hooksByEvent:t,totalHooksCount:n,restrictedByPolicy:r,onSelectEvent:i,onCancel:o}){return(0,B.jsx)(E,{title:`Hooks`,subtitle:`${n} ${j(n,`hook`)} configured`,onCancel:o,children:(0,B.jsxs)(b,{flexDirection:`column`,gap:1,children:[r&&(0,B.jsxs)(b,{flexDirection:`column`,children:[(0,B.jsxs)(S,{color:`suggestion`,children:[a.info,` Hooks Restricted by Policy`]}),(0,B.jsx)(S,{dimColor:!0,children:`Only hooks from managed settings can run. User-defined hooks from ~/.workmate/settings.json, .workmate/settings.json, and .workmate/settings.local.json are blocked.`})]}),(0,B.jsx)(b,{flexDirection:`column`,children:(0,B.jsxs)(S,{dimColor:!0,children:[a.info,` This menu is read-only. To add or modify hooks, edit settings.json directly or ask Work Mate.`,` `,(0,B.jsx)(x,{url:`https://code.workmate.com/docs/en/hooks`,children:`Learn more`})]})}),(0,B.jsx)(b,{flexDirection:`column`,children:(0,B.jsx)(F,{onChange:e=>{i(e)},onCancel:o,options:Object.entries(e).map(([e,n])=>{let r=t[e]||0;return{label:r>0?(0,B.jsxs)(S,{children:[e,` `,(0,B.jsxs)(S,{color:`suggestion`,children:[`(`,r,`)`]})]}):e,value:e,description:n.summary}})})})]})})}var B,V=e((()=>{i(),T(),M(),P(),B=D()}));function H({selectedEvent:e,selectedMatcher:t,hooksForSelectedMatcher:n,hookEventMetadata:r,onSelect:i,onCancel:a}){let
|
|
79
|
+
Other exit codes - show stderr to user only`}}),e=>e.slice().sort().join(`,`))}));function z({hookEventMetadata:e,hooksByEvent:t,totalHooksCount:n,restrictedByPolicy:r,onSelectEvent:i,onCancel:o}){return(0,B.jsx)(E,{title:`Hooks`,subtitle:`${n} ${j(n,`hook`)} configured`,onCancel:o,children:(0,B.jsxs)(b,{flexDirection:`column`,gap:1,children:[r&&(0,B.jsxs)(b,{flexDirection:`column`,children:[(0,B.jsxs)(S,{color:`suggestion`,children:[a.info,` Hooks Restricted by Policy`]}),(0,B.jsx)(S,{dimColor:!0,children:`Only hooks from managed settings can run. User-defined hooks from ~/.workmate/settings.json, .workmate/settings.json, and .workmate/settings.local.json are blocked.`})]}),(0,B.jsx)(b,{flexDirection:`column`,children:(0,B.jsxs)(S,{dimColor:!0,children:[a.info,` This menu is read-only. To add or modify hooks, edit settings.json directly or ask Work Mate.`,` `,(0,B.jsx)(x,{url:`https://code.workmate.com/docs/en/hooks`,children:`Learn more`})]})}),(0,B.jsx)(b,{flexDirection:`column`,children:(0,B.jsx)(F,{onChange:e=>{i(e)},onCancel:o,options:Object.entries(e).map(([e,n])=>{let r=t[e]||0;return{label:r>0?(0,B.jsxs)(S,{children:[e,` `,(0,B.jsxs)(S,{color:`suggestion`,children:[`(`,r,`)`]})]}):e,value:e,description:n.summary}})})})]})})}var B,V=e((()=>{i(),T(),M(),P(),B=D()}));function H({selectedEvent:e,selectedMatcher:t,hooksForSelectedMatcher:n,hookEventMetadata:r,onSelect:i,onCancel:a}){let s=r.matcherMetadata===void 0?e:`${e} - Matcher: ${t||`(all)`}`;return n.length===0?(0,U.jsx)(E,{title:s,subtitle:r.description,onCancel:a,inputGuide:()=>(0,U.jsx)(S,{children:`Esc to go back`}),children:(0,U.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,U.jsx)(S,{dimColor:!0,children:`No hooks configured for this event.`}),(0,U.jsx)(S,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,U.jsx)(E,{title:s,subtitle:r.description,onCancel:a,children:(0,U.jsx)(b,{flexDirection:`column`,children:(0,U.jsx)(F,{options:n.map((e,t)=>({label:`[${e.config.type}] ${y(e.config)}`,value:t.toString(),description:e.source===`pluginHook`&&e.pluginName?`${o(e.source)} (${e.pluginName})`:o(e.source)})),onChange:e=>{let t=n[parseInt(e,10)];t&&i(t)},onCancel:a})})})}var U,W=e((()=>{T(),m(),P(),U=D()}));function G({selectedEvent:e,matchersForSelectedEvent:t,hooksByEventAndMatcher:n,eventDescription:r,onSelect:i,onCancel:a}){let o=K.useMemo(()=>t.map(t=>{let r=n[e]?.[t]||[];return{matcher:t,sources:Array.from(new Set(r.map(e=>e.source))),hookCount:r.length}}),[t,n,e]);return t.length===0?(0,q.jsx)(E,{title:`${e} - Matchers`,subtitle:r,onCancel:a,inputGuide:()=>(0,q.jsx)(S,{children:`Esc to go back`}),children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(S,{dimColor:!0,children:`No hooks configured for this event.`}),(0,q.jsx)(S,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,q.jsx)(E,{title:`${e} - Matchers`,subtitle:r,onCancel:a,children:(0,q.jsx)(b,{flexDirection:`column`,children:(0,q.jsx)(F,{options:o.map(e=>({label:`[${e.sources.map(v).join(`, `)}] ${e.matcher||`(all)`}`,value:e.matcher,description:`${e.hookCount} ${j(e.hookCount,`hook`)}`})),onChange:e=>{i(e)},onCancel:a})})})}var K,q,se=e((()=>{K=t(w(),1),T(),m(),M(),P(),q=D()}));function ce({selectedHook:e,eventSupportsMatcher:t,onCancel:n}){return(0,J.jsx)(E,{title:`Hook details`,onCancel:n,inputGuide:()=>(0,J.jsx)(S,{children:`Esc to go back`}),children:(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsxs)(b,{flexDirection:`column`,children:[(0,J.jsxs)(S,{children:[`Event: `,(0,J.jsx)(S,{bold:!0,children:e.event})]}),t&&(0,J.jsxs)(S,{children:[`Matcher: `,(0,J.jsx)(S,{bold:!0,children:e.matcher||`(all)`})]}),(0,J.jsxs)(S,{children:[`Type: `,(0,J.jsx)(S,{bold:!0,children:e.config.type})]}),(0,J.jsxs)(S,{children:[`Source: `,(0,J.jsx)(S,{dimColor:!0,children:f(e.source)})]}),e.pluginName&&(0,J.jsxs)(S,{children:[`Plugin: `,(0,J.jsx)(S,{dimColor:!0,children:e.pluginName})]})]}),(0,J.jsxs)(b,{flexDirection:`column`,children:[(0,J.jsxs)(S,{dimColor:!0,children:[le(e.config),`:`]}),(0,J.jsx)(b,{borderStyle:`round`,borderDimColor:!0,paddingLeft:1,paddingRight:1,children:(0,J.jsx)(S,{children:ue(e.config)})})]}),`statusMessage`in e.config&&e.config.statusMessage&&(0,J.jsxs)(S,{children:[`Status message: `,(0,J.jsx)(S,{dimColor:!0,children:e.config.statusMessage})]}),(0,J.jsx)(S,{dimColor:!0,children:`To modify or remove this hook, edit settings.json directly or ask Work Mate to help.`})]})})}function le(e){switch(e.type){case`command`:return`Command`;case`prompt`:return`Prompt`;case`agent`:return`Prompt`;case`http`:return`URL`}}function ue(e){switch(e.type){case`command`:return e.command;case`prompt`:return e.prompt;case`agent`:return e.prompt;case`http`:return e.url}}var J,Y=e((()=>{T(),m(),J=D()}));function de({toolNames:e,onExit:t}){let[n,r]=(0,X.useState)({mode:`select-event`}),[i,a]=(0,X.useState)(()=>k()?.disableAllHooks===!0&&A(`policySettings`)?.disableAllHooks===!0),[o,s]=(0,X.useState)(()=>A(`policySettings`)?.allowManagedHooksOnly===!0);h(e=>{if(e===`policySettings`){let e=k()?.disableAllHooks===!0;a(e&&A(`policySettings`)?.disableAllHooks===!0),s(A(`policySettings`)?.allowManagedHooksOnly===!0)}});let c=n.mode,l=`event`in n?n.event:`PreToolUse`,u=`matcher`in n?n.matcher:null,f=d(e=>e.mcp),p=ee(),m=(0,X.useMemo)(()=>[...e,...f.tools.map(e=>e.name)],[e,f.tools]),g=(0,X.useMemo)(()=>ie(p.getState(),m),[m,p]),_=(0,X.useMemo)(()=>ae(g,l),[g,l]),v=(0,X.useMemo)(()=>oe(g,l,u),[g,l,u]),y=(0,X.useCallback)(()=>{t(`Hooks dialog dismissed`,{display:`system`})},[t]);C(`confirm:no`,y,{context:`Confirmation`,isActive:c===`select-event`}),C(`confirm:no`,()=>{r({mode:`select-event`})},{context:`Confirmation`,isActive:c===`select-matcher`}),C(`confirm:no`,()=>{`event`in n&&(I(n.event,m)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event}))},{context:`Confirmation`,isActive:c===`select-hook`}),C(`confirm:no`,()=>{if(n.mode===`view-hook`){let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}},{context:`Confirmation`,isActive:c===`view-hook`});let x=L(m),w=k()?.disableAllHooks===!0,{hooksByEvent:T,totalHooksCount:D}=(0,X.useMemo)(()=>{let e={},t=0;for(let[n,r]of Object.entries(g)){let i=Object.values(r).reduce((e,t)=>e+t.length,0);e[n]=i,t+=i}return{hooksByEvent:e,totalHooksCount:t}},[g]);if(w)return(0,Z.jsx)(E,{title:`Hook Configuration - Disabled`,onCancel:y,inputGuide:()=>(0,Z.jsx)(S,{children:`Esc to close`}),children:(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsxs)(S,{children:[`All hooks are currently `,(0,Z.jsx)(S,{bold:!0,children:`disabled`}),i&&` by a managed settings file`,`. You have `,(0,Z.jsx)(S,{bold:!0,children:D}),` `,`configured `,j(D,`hook`),` that `,j(D,`is`,`are`),` not running.`]}),(0,Z.jsx)(b,{marginTop:1,children:(0,Z.jsx)(S,{dimColor:!0,children:`When hooks are disabled:`})}),(0,Z.jsx)(S,{dimColor:!0,children:`· No hook commands will execute`}),(0,Z.jsx)(S,{dimColor:!0,children:`· StatusLine will not be displayed`}),(0,Z.jsx)(S,{dimColor:!0,children:`· Tool operations will proceed without hook validation`})]}),!i&&(0,Z.jsx)(S,{dimColor:!0,children:`To re-enable hooks, remove "disableAllHooks" from settings.json or ask Work Mate.`})]})});switch(n.mode){case`select-event`:return(0,Z.jsx)(z,{hookEventMetadata:x,hooksByEvent:T,totalHooksCount:D,restrictedByPolicy:o,onSelectEvent:e=>{I(e,m)===void 0?r({mode:`select-hook`,event:e,matcher:``}):r({mode:`select-matcher`,event:e})},onCancel:y});case`select-matcher`:return(0,Z.jsx)(G,{selectedEvent:n.event,matchersForSelectedEvent:_,hooksByEventAndMatcher:g,eventDescription:x[n.event].description,onSelect:e=>{r({mode:`select-hook`,event:n.event,matcher:e})},onCancel:()=>{r({mode:`select-event`})}});case`select-hook`:return(0,Z.jsx)(H,{selectedEvent:n.event,selectedMatcher:n.matcher,hooksForSelectedMatcher:v,hookEventMetadata:x[n.event],onSelect:e=>{r({mode:`view-hook`,event:n.event,hook:e})},onCancel:()=>{I(n.event,m)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event})}});case`view-hook`:return(0,Z.jsx)(ce,{selectedHook:n.hook,eventSupportsMatcher:I(n.event,m)!==void 0,onCancel:()=>{let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}})}}var X,Z,fe=e((()=>{X=t(w(),1),u(),l(),T(),_(),R(),ne(),M(),V(),W(),se(),Y(),Z=D()})),Q,$;e((()=>{fe(),N(),s(),Q=D(),$=async(e,t)=>{re(`tengu_hooks_command`,{});let n=t.getAppState().toolPermissionContext;return(0,Q.jsx)(de,{toolNames:p(n).map(e=>e.name),onExit:e})}}))();export{$ as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kn as i,s as a,t as o}from"./src-DL3w8VPk.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kn as i,s as a,t as o}from"./src-DL3w8VPk.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{I as c,M as l,c as u,i as d}from"./debug-Bglx1aTu.js";import{Wt as f,b as p,h as m,qt as h,t as g}from"./settings-B2jvL8Dp.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,n as b,r as x,s as S,t as C}from"./nativeInstaller-CdjmE9Zy.js";import{join as w}from"node:path";import{homedir as T}from"node:os";var E=e(r(),1);_(),o(),d(),h(),c(),C(),m();var D=s();function O(){let e=f.platform===`win32`,t=T();return e?w(t,`.local`,`bin`,`claude.exe`).replace(/\//g,`\\`):`~/.local/bin/claude`}function k({messages:e}){return e.length===0?null:(0,D.jsxs)(t,{flexDirection:`column`,gap:0,marginBottom:1,children:[(0,D.jsx)(t,{children:(0,D.jsxs)(n,{color:`warning`,children:[(0,D.jsx)(a,{status:`warning`,withSpace:!0}),`Setup notes:`]})}),e.map((e,r)=>(0,D.jsx)(t,{marginLeft:2,children:(0,D.jsxs)(n,{dimColor:!0,children:[`• `,e]})},r))]})}function A({onDone:e,force:r,target:i}){let[o,s]=(0,E.useState)({type:`checking`});return(0,E.useEffect)(()=>{async function e(){try{u(`Install: Starting installation process (force=${r}, target=${i})`);let e=i||g()?.autoUpdatesChannel||`latest`;s({type:`installing`,version:e}),u(`Install: Calling installLatest(channelOrVersion=${e}, forceReinstall=${r})`);let t=await S(e,r);if(u(`Install: installLatest returned version=${t.latestVersion}, wasUpdated=${t.wasUpdated}, lockFailed=${t.lockFailed}`),t.lockFailed)throw Error(`Could not install - another process is currently installing Work Mate. Please try again in a moment.`);t.latestVersion||u(`Install: Failed to retrieve version information during install`,{level:`error`}),t.wasUpdated||u(`Install: Already up to date`),s({type:`setting-up`});let n=await b(!0);u(`Install: Setup launcher completed with ${n.length} messages`),n.length>0&&n.forEach(e=>u(`Install: Setup message: ${e.message}`)),u(`Install: Cleaning up npm installations after successful install`);let{removed:a,errors:o,warnings:c}=await x();a>0&&u(`Cleaned up ${a} npm installation(s)`),o.length>0&&u(`Cleanup errors: ${o.join(`, `)}`);let l=await y();l.length>0&&u(`Shell alias cleanup: ${l.map(e=>e.message).join(`; `)}`),v(`tengu_claude_install_command`,{has_version:+!!t.latestVersion,forced:+!!r}),(i===`latest`||i===`stable`)&&(p(`userSettings`,{autoUpdatesChannel:i}),u(`Install: Saved autoUpdatesChannel=${i} to user settings`));let d=[...c,...l.map(e=>e.message)];n.length>0?(s({type:`set-up`,messages:n.map(e=>e.message)}),setTimeout(s,2e3,{type:`success`,version:t.latestVersion||`current`,setupMessages:[...n.map(e=>e.message),...d]})):(u(`Install: Shell PATH already configured`),s({type:`success`,version:t.latestVersion||`current`,setupMessages:d.length>0?d:void 0}))}catch(e){u(`Install command failed: ${e}`,{level:`error`}),s({type:`error`,message:l(e)})}}e()},[r,i]),(0,E.useEffect)(()=>{o.type===`success`?setTimeout(e,2e3,`Work Mate installation completed successfully`,{display:`system`}):o.type===`error`&&setTimeout(e,3e3,`Work Mate installation failed`,{display:`system`})},[o,e]),(0,D.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[o.type===`checking`&&(0,D.jsx)(n,{color:`claude`,children:`Checking installation status...`}),o.type===`cleaning-npm`&&(0,D.jsx)(n,{color:`warning`,children:`Cleaning up old npm installations...`}),o.type===`installing`&&(0,D.jsxs)(n,{color:`claude`,children:[`Installing Work Mate native build `,o.version,`...`]}),o.type===`setting-up`&&(0,D.jsx)(n,{color:`claude`,children:`Setting up launcher and shell integration...`}),o.type===`set-up`&&(0,D.jsx)(k,{messages:o.messages}),o.type===`success`&&(0,D.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,D.jsxs)(t,{children:[(0,D.jsx)(a,{status:`success`,withSpace:!0}),(0,D.jsx)(n,{color:`success`,bold:!0,children:`Work Mate successfully installed!`})]}),(0,D.jsxs)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:[o.version!==`current`&&(0,D.jsxs)(t,{children:[(0,D.jsx)(n,{dimColor:!0,children:`Version: `}),(0,D.jsx)(n,{color:`claude`,children:o.version})]}),(0,D.jsxs)(t,{children:[(0,D.jsx)(n,{dimColor:!0,children:`Location: `}),(0,D.jsx)(n,{color:`text`,children:O()})]})]}),(0,D.jsx)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:(0,D.jsxs)(t,{marginTop:1,children:[(0,D.jsx)(n,{dimColor:!0,children:`Next: Run `}),(0,D.jsx)(n,{color:`claude`,bold:!0,children:`claude --help`}),(0,D.jsx)(n,{dimColor:!0,children:` to get started`})]})}),o.setupMessages&&(0,D.jsx)(k,{messages:o.setupMessages})]}),o.type===`error`&&(0,D.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,D.jsxs)(t,{children:[(0,D.jsx)(a,{status:`error`,withSpace:!0}),(0,D.jsx)(n,{color:`error`,children:`Installation failed`})]}),(0,D.jsx)(n,{color:`error`,children:o.message}),(0,D.jsx)(t,{marginTop:1,children:(0,D.jsx)(n,{dimColor:!0,children:`Try running with --force to override checks`})})]})]})}var j={type:`local-jsx`,name:`install`,description:`安装 Work Mate 原生构建`,argumentHint:`[options]`,async call(e,t,n){let r=n.includes(`--force`),a=n.filter(e=>!e.startsWith(`--`))[0],{unmount:o}=await i((0,D.jsx)(A,{onDone:(t,n)=>{o(),e(t,n)},force:r,target:a}))}};export{j as install};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DfkgIdYf.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{A as g,C as re,S as ie,b as _,v,w as ae,x as oe,y as se}from"./esm-BbMeEYcz.js";import{A as ce,B as y,C as le,D as ue,Dt as b,E as de,Et as fe,I as x,K as pe,L as S,M as me,N as he,O as ge,P as C,R as _e,Tt as ve,U as ye,W as w,_ as T,b as be,c as xe,d as Se,h as Ce,i as we,k as E,n as Te,o as Ee,p as De,q as Oe,t as ke,u as Ae,v as D,w as O,wt as je,y as Me}from"./esm-BXTZz3av.js";import{n as Ne,t as Pe}from"./axios-DaWTGg7G.js";import{Cn as Fe,Et as k,I as Ie,It as Le,U as Re,Vn as ze,nn as Be,vn as Ve}from"./state-B4jiUise.js";import{$ as He,C as Ue,I as We,M as Ge,V as Ke,c as A,et as qe,i as j,r as Je,x as Ye}from"./debug-Bglx1aTu.js";import{n as Xe,p as Ze}from"./config-C-Y2qtB2.js";import{o as Qe,s as $e}from"./log-D2TIwHBV.js";import{a as et,i as tt,o as nt}from"./platform-BacQ6ACS.js";import{n as rt,r as it}from"./startupProfiler-CJdr3SxP.js";import{At as at,Dt as ot}from"./model-BvQFFOf8.js";import{_ as st,a as ct,c as lt,f as ut,g as dt,l as ft,m as pt,v as mt,y as ht}from"./proxy-CDBfZjO7.js";import{C as gt,S as _t,_ as vt,c as yt,g as bt,l as xt,r as St}from"./sessionTracing-CtbeAD0s.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 Ct(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function wt(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var Tt=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 Tt(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Et(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Dt(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 Ot(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 kt=class{constructor(){i(this,`kind`,I.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};r();function At(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 jt=class{constructor(e,t,n=!0,r=At(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=Dt(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},Mt=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 jt(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 jt(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 jt(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 Nt=class e{constructor(e=new Pt,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))}},Pt=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])}},Ft=2146435072,It=1048575,Lt=1023,Rt=-1022,zt=Lt,Bt=2**-1022;function Vt(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&Ft)>>20)-Lt}function Ht(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&It)*2**32+r}function Ut(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function Wt(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 Gt=class{constructor(e){i(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<Bt?this._minNormalLowerBoundaryIndex():Vt(e)+this._rightShift(Ht(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 Ut(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=Rt>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return zt>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}};r();var Kt=class{constructor(e){i(this,`_scale`,void 0),i(this,`_scaleFactor`,void 0),i(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=Ut(Math.LOG2E,e),this._inverseFactor=Ut(Math.LN2,-e)}mapToIndex(e){if(e<=Bt)return this._minNormalLowerBoundaryIndex()-1;if(Ht(e)===0)return(Vt(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 Bt;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 Rt<<this._scale}_maxNormalLowerBoundaryIndex(){return(zt+1<<this._scale)-1}},qt=-10,Jt=20,Yt=Array.from({length:31},(e,t)=>t>10?new Kt(t-10):new Gt(t-10));function Xt(e){if(e>Jt||e<qt)throw new L(`expected scale >= ${qt} && <= ${Jt}, got: ${e}`);return Yt[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}},Zt=20,Qt=160,$t=2,en=class e{constructor(e,t=Qt,n=!0,r=0,a=0,o=0,s=1/0,c=-1/0,l=new Nt,u=new Nt,d=Xt(Zt)){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<$t&&(m.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
|
|
2
|
+
changing to the minimum size of: ${$t}`),this._maxSize=$t)}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=Wt(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=Xt(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()}},tn=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 en(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}}})}}};D(),r();var nn=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=C(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},rn=class{constructor(){i(this,`kind`,I.LAST_VALUE)}createAccumulation(e){return new nn(e)}merge(e,t){let n=E(t.sampleTime)>=E(e.sampleTime)?t:e;return new nn(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=E(t.sampleTime)>=E(e.sampleTime)?t:e;return new nn(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}},an=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 on=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(on,`DEFAULT_INSTANCE`,new kt);var sn=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(sn,`MONOTONIC_INSTANCE`,new an(!0)),i(sn,`NON_MONOTONIC_INSTANCE`,new an(!1));var cn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(cn,`DEFAULT_INSTANCE`,new rn);var ln=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(ln,`DEFAULT_INSTANCE`,new Mt([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var un=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 Mt(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 tn(this._maxSize,this._recordMinMax)}},fn=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 mn;case N.GAUGE:case N.OBSERVABLE_GAUGE:return hn;case N.HISTOGRAM:return e.advice.explicitBucketBoundaries?new un(e.advice.explicitBucketBoundaries):gn}return m.warn(`Unable to recognize instrument type: ${e.type}`),pn}createAggregator(e){return this._resolve(e).createAggregator(e)}},pn=new on,mn=new sn,hn=new cn,gn=new ln;new dn;var _n=new fn,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 vn(e){switch(e.type){case B.DEFAULT:return _n;case B.DROP:return pn;case B.SUM:return mn;case B.LAST_VALUE:return hn;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?gn:new un(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var yn=e=>({type:B.DEFAULT}),bn=e=>M.CUMULATIVE,xn=`otel.component.name`,Sn=`otel.component.type`,Cn=`periodic_metric_reader`,wn=`otel.sdk.metric_reader.collection.duration`,Tn=`error.type`;r();var En=new Map,Dn=class{constructor(e,t){i(this,`collectionDuration`,void 0),i(this,`standardAttrs`,void 0);let n=En.get(e)??0;En.set(e,n+1),this.standardAttrs={[Sn]:e,[xn]:`${e}/${n}`},this.collectionDuration=t.createHistogram(wn,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[Tn]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}},On=`2.9.0`;p(),D(),r();var kn=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??yn,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??bn,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Dn(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`,On);this._selfObsMetrics=new Dn(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=ue(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=ue(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=ce(ge(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 An(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(),D(),r();var jn=class extends kn{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:Cn,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){y(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),y(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?An(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await F(Me._export(this._exporter,e),this._exportTimeout);t.code!==O.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof Tt){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()}};D(),r();var Mn=class e{constructor(e){i(this,`_shutdown`,!1),i(this,`_temporalitySelector`,void 0),this._temporalitySelector=e?.temporalitySelector??bn}export(t,n){if(this._shutdown){n({code:O.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:O.SUCCESS})}};r();var Nn=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 Ln(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 Pn(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 Fn(e,t){return Ot(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var In=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Ln(e){return In.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())}},Rn=class extends H{add(e,t,n){this._record(e,t,n)}},zn=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)}},Bn=class extends H{record(e,t,n){this._record(e,t,n)}},Vn=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)}},Hn=class extends U{},Un=class extends U{},Wn=class extends U{};function Gn(e){return e instanceof U}r();var Kn=class{constructor(e){i(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=V(e,N.GAUGE,t);return new Bn(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=V(e,N.HISTOGRAM,t);return new Vn(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=V(e,N.COUNTER,t);return new zn(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=V(e,N.UP_DOWN_COUNTER,t);return new Rn(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=V(e,N.OBSERVABLE_GAUGE,t);return new Un(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=V(e,N.OBSERVABLE_COUNTER,t);return new Hn(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=V(e,N.OBSERVABLE_UP_DOWN_COUNTER,t);return new Wn(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 qn=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 Jn=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 Jn{constructor(){super(Ct)}};D(),r();var Yn=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=Ct(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=C(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 Xn=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=Zn(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 Zn(e){return Array.from(e.entries())}r();var Qn=class extends qn{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 Yn(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Xn(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 $n(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 er(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function tr(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function nr(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 rr(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
|
+
\t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
|
|
4
|
+
\t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function ir(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:rr(e,t):nr(e,t):tr(e,t):er(e,t)}p(),r();var ar=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();Fn(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),m.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
|
|
5
|
+
`,`Details:
|
|
6
|
+
`,$n(t,e),`The longer description will be used.
|
|
7
|
+
To resolve the conflict:`,ir(t,e))),n=r):m.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
|
|
8
|
+
`,`Details:
|
|
9
|
+
`,$n(t,e),`To resolve the conflict:
|
|
10
|
+
`,ir(t,e))}return n}};p(),r();var or=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 sr=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)}},cr=class{constructor(){i(this,`_buffer`,new Map)}observe(e,t,n={}){if(!Gn(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 lr=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(Gn));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(Gn)),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 sr(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 cr,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&&Et(n.instruments,t))}};p(),r();var ur=class extends qn{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 Yn(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new Xn(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 ar),i(this,`observableRegistry`,new lr),i(this,`meter`,void 0),i(this,`_meterProviderSharedState`,void 0),i(this,`_instrumentationScope`,void 0),this.meter=new Kn(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,ur);return t.length===1?t[0]:new or(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,Qn)}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=Pn(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 fr=class{constructor(e){i(this,`viewRegistry`,new Nn),i(this,`metricCollectors`,[]),i(this,`meterSharedStates`,new Map),i(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=wt(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,vn(n.selectAggregation(e))]);return t}};D(),r();var pr=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=C(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 mr=/[\^$\\.+?()[\]{}|]/g,hr=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(mr,`\\$&`).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 gr=class{process(e,t){return e}},_r=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 vr(){return br}function yr(e){return new _r(e)}var br=new gr;r();var xr=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_type`,void 0),i(this,`_unitFilter`,void 0),this._nameFilter=new hr(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 Sr=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 Cr(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function wr(e){if(Cr(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||hr.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 Tr=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),wr(e),e.attributesProcessors==null?this.attributesProcessor=vr():this.attributesProcessor=yr(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=vn(e.aggregation??{type:B.DEFAULT}),this.instrumentSelector=new xr({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new Sr({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};p(),xe(),r();var Er=class{constructor(e){if(i(this,`_sharedState`,void 0),i(this,`_shutdown`,!1),this._sharedState=new fr(e?.resource??Ce()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new Tr(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new pr(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof kn&&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)))}},Dr=`exception`,Or=Symbol.for(`nodejs.util.inspect.custom`);function kr(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??(t[n]=r));return t}function Ar(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(),D(),v(),r();var jr=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=x.now(),this._performanceOffset=t-(this._performanceStartTime+x.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(!ye(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++),me(t)&&(me(n)||(n=t),t=void 0);let i=w(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=w(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=ge(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<=x.now())return ue(e+this._performanceOffset);if(typeof e==`number`)return C(e);if(e instanceof Date)return C(e.getTime());if(he(e))return e;if(this._startTimeProvided)return C(Date.now());let t=x.now()-this._performanceStartTime;return de(this.startTime,C(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[_]=e:e&&(e.code?n[ie]=e.code.toString():e.name&&(n[ie]=e.name),e.message&&(n[_]=e.message),e.stack&&(n[oe]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Dr,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}[Or](e,t,n){return Ar(`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:kr(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 Mr=`otel.component.name`,Nr=`otel.component.type`,Pr=`otel.span.parent.origin`,Fr=`otel.span.sampling_result`,Ir=`otel.sdk.processor.span.processed`,Lr=`otel.sdk.processor.span.queue.capacity`,Rr=`otel.sdk.processor.span.queue.size`,zr=`otel.sdk.span.live`,Br=`otel.sdk.span.started`,Vr=`batching_span_processor`;r();var Hr=class{constructor(e){i(this,`startedSpans`,void 0),i(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(Br,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(zr,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=Wr(t);if(this.startedSpans.add(1,{[Pr]:Ur(e),[Fr]:n}),t===K.NOT_RECORD)return()=>{};let r={[Fr]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function Ur(e){return e?e.isRemote?`remote`:`local`:`none`}function Wr(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 Gr=`2.9.0`;p(),D(),r();var Kr=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`,Gr);this._tracerMetrics=new Hr(n)}startSpan(e,t={},n=f.active()){t.root&&(n=d.deleteSpan(n));let r=d.getSpan(n);if(pe(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:w(e.attributes)})),ne=w(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 v=w(Object.assign(ne,g.attributes));return new jr({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:_,name:e,kind:te,links:h,parentSpanContext:o,attributes:v,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)}[Or](e,t,n){return Ar(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:kr(this._resource)},spanLimits:this._spanLimits},e,t,n)}};D(),r();var qr=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=>{y(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(),D(),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||(y(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()}}`}};v(),r();var Jr=new Map,Yr=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=Jr.get(e)??0;if(Jr.set(e,r+1),this.standardAttrs={[Nr]:e,[Mr]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[se]:`queue_full`},this.processedSpans=t.createCounter(Ir,{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(Lr,{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(Rr,{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,[se]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};p(),D(),r();var Xr=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 be(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 Yr(Vr,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(Oe(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===O.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=>{y(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,y(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)}},Zr=class extends Xr{onShutdown(){}};r();var Qr=8,$r=16,ei=class{constructor(){i(this,`generateTraceId`,ti($r)),i(this,`generateSpanId`,ti(Qr))}},X=Buffer.allocUnsafe($r);function ti(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(),xe(),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 ni=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??Ce();let t=e.spanProcessors??[];this._activeSpanProcessor=new qr(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 ei,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 Kr({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()}[Or](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Ar(`TracerProvider`,{resource:{attributes:kr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};D();var ri=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:E(e.startTime),duration:E(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:O.SUCCESS})}};p(),r();var ii=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(),D();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 ai(){return{sampler:oi(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:S(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:S(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:S(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:S(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:S(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:S(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:S(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:S(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function oi(){let e=_e(`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 ii(si());case Q.ParentBasedTraceIdRatio:return new Y({root:new ii(si())});default:return m.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Q.ParentBasedAlwaysOn}".`),new Y({root:new J})}}function si(){let e=S(`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}D();function ci(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??S(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??S(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??S(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??S(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}D();var li=class extends ni{constructor(e={}){let t=le({},ai(),ci(e));delete t.generalLimits,super(t)}};D();var ui=class extends Zr{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=S(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};n(),fe(),Pe(),Le(),He(),We(),Ye(),Qe(),nt(),rt(),ht(),st(),pt(),lt(),_t(),ke(),j();async function di(){return A(`Metrics opt-out check skipped — login removed`),{enabled:!1,hasError:!1}}D(),Ze(),j(),at(),ve(),r();var fi=class{constructor(e={}){i(this,`endpoint`,void 0),i(this,`timeout`,void 0),i(this,`pendingExports`,[]),i(this,`isShutdown`,!1),this.endpoint=`https://api.anthropic.com/api/claude_code/metrics`,this.timeout=e.timeout||5e3}async export(e,t){if(this.isShutdown){t({code:O.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(!(Xe()||Ie())){A(`BigQuery metrics export: trust not established, skipping`),t({code:O.SUCCESS});return}if(!(await di()).enabled){A(`Metrics export disabled by organization setting`),t({code:O.SUCCESS});return}let n=this.transformMetricsForInternal(e),r=ot();if(r.error){A(`Metrics export failed: ${r.error}`),t({code:O.FAILED,error:Error(r.error)});return}let i={"Content-Type":`application/json`,"User-Agent":je(),...r.headers},a=await Ne.post(this.endpoint,n,{timeout:this.timeout,headers:i});A(`BigQuery metrics exported successfully`),A(`BigQuery API Response: ${Ue(a.data,null,2)}`),t({code:O.SUCCESS})}catch(e){A(`BigQuery metrics export failed: ${Ge(e)}`),$e(e),t({code:O.FAILED,error:Ke(e)})}}transformMetricsForInternal(e){let t=e.resource.attributes,n={"service.name":t[`service.name`]||`workmate`,"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`};return t[`wsl.version`]&&(n[`wsl.version`]=t[`wsl.version`]),n[`user.customer_type`]=`api`,{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(),A(`BigQuery metrics exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),A(`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}};j(),Qe();var pi=class{error(e,...t){$e(Error(e)),A(`[3P telemetry] OTEL diag error: ${e}`,{level:`error`})}warn(e,...t){$e(Error(e)),A(`[3P telemetry] OTEL diag warn: ${e}`,{level:`warn`})}info(e,...t){}debug(e,...t){}verbose(e,...t){}};p(),xe(),v(),Le(),j(),We(),Ye(),bt(),yt();var mi=6e4,hi=5e3,gi=5e3,_i=class extends Error{};function vi(e,t){return new Promise((n,r)=>{setTimeout((e,t)=>e(new _i(t)),e,r,t).unref()})}function yi(){process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE||(process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=`delta`)}function bi(e){return(e||``).trim().split(`,`).filter(Boolean).map(e=>e.trim()).filter(e=>e!==`none`)}async function xi(){let t=bi(process.env.OTEL_METRICS_EXPORTER),n=parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL||mi.toString(),10),r=[];for(let n of t)if(n===`console`){let e=new Mn,t=e.export.bind(e);e.export=(e,n)=>(e.resource?.attributes&&(A(`
|
|
11
|
+
=== Resource Attributes ===`),A(Ue(e.resource.attributes)),A(`===========================
|
|
12
|
+
`)),t(e,n)),r.push(e)}else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),t=Ai();switch(e){case`http/json`:{let{OTLPMetricExporter:e}=await import(`./esm-BadZVa27.js`);r.push(new e(t));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else if(n===`prometheus`){let{PrometheusExporter:t}=await import(`./src-BacxF9BD.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 jn({exporter:e,exportIntervalMillis:n}):e)}async function Si(){let e=bi(process.env.OTEL_LOGS_EXPORTER),t=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;A(`[3P telemetry] getOtlpLogExporters: types=${Ue(e)}, protocol=${t}, endpoint=${n}`);let r=[];for(let n of e)if(n===`console`)r.push(new we);else if(n===`otlp`){let e=Ai();switch(t){case`http/json`:{let{OTLPLogExporter:t}=await import(`./esm-BCmY8V0C.js`);r.push(new t(e));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else throw Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${n}`);return r}async function Ci(){let e=bi(process.env.OTEL_TRACES_EXPORTER),t=[];for(let n of e)if(n===`console`)t.push(new ri);else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=Ai();switch(e){case`http/json`:{let{OTLPTraceExporter:e}=await import(`./esm-BUJtY-Rb.js`);t.push(new e(n));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else throw Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${n}`);return t}function wi(){return t(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)}function Ti(){return new jn({exporter:new fi,exportIntervalMillis:300*1e3})}function Ei(){return!1}async function Di(e){let t=process.env.BETA_TRACING_ENDPOINT;if(!t)return;let[{OTLPTraceExporter:n},{OTLPLogExporter:r}]=await Promise.all([import(`./esm-BUJtY-Rb.js`),import(`./esm-BCmY8V0C.js`)]),i={url:`${t}/v1/traces`},a={url:`${t}/v1/logs`},o=new li({resource:e,spanProcessors:[new ui(new n(i),{scheduledDelayMillis:gi})]});d.setGlobalTracerProvider(o),ze(o);let s=new Ee({resource:e,processors:[new Te(new r(a),{scheduledDelayMillis:hi})]});b.setGlobalLoggerProvider(s),Ve(s),Be(b.getLogger(`com.anthropic.claude_code.events`,`0.0.24`)),process.on(`beforeExit`,async()=>{await s?.forceFlush(),await o?.forceFlush()}),process.on(`exit`,()=>{s?.forceFlush(),o?.forceFlush()})}async function Oi(){if(it(`telemetry_init_start`),yi(),Je())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 pi,o.ERROR),vt();let e=[],t=wi();A(`[3P telemetry] isTelemetryEnabled=${t} (CLAUDE_CODE_ENABLE_TELEMETRY=${process.env.CLAUDE_CODE_ENABLE_TELEMETRY})`),t&&e.push(...await xi()),Ei()&&e.push(Ti());let n=tt(),r={[re]:`workmate`,[ae]:`0.0.24`};if(n===`wsl`){let e=et();e&&(r[`wsl.version`]=e)}let i=T(r),a=T(Ae.detect().attributes||{}),s=Se.detect(),c=T(s.attributes?.[`host.arch`]?{[g]:s.attributes[g]}:{}),l=T(De.detect().attributes||{}),u=i.merge(a).merge(c).merge(l);if(gt()){Di(u).catch(e=>A(`Beta tracing init failed: ${e}`,{level:`error`}));let t=new Er({resource:u,views:[],readers:e});return Fe(t),qe(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{St();let n=Re(),r=k(),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),vi(e,`OpenTelemetry shutdown timeout`)])}catch{}}),t.getMeter(`com.anthropic.claude_code`,`0.0.24`)}let f=new Er({resource:u,views:[],readers:e});if(Fe(f),t){let e=await Si();if(A(`[3P telemetry] Created ${e.length} log exporter(s)`),e.length>0){let t=new Ee({resource:u,processors:e.map(e=>new Te(e,{scheduledDelayMillis:parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||hi.toString(),10)}))});b.setGlobalLoggerProvider(t),Ve(t),Be(b.getLogger(`com.anthropic.claude_code.events`,`0.0.24`)),A(`[3P telemetry] Event logger set successfully`),process.on(`beforeExit`,async()=>{await t?.forceFlush(),await k()?.forceFlush()}),process.on(`exit`,()=>{t?.forceFlush(),k()?.forceFlush()})}}if(t&&xt()){let e=await Ci();if(e.length>0){let t=new li({resource:u,spanProcessors:e.map(e=>new ui(e,{scheduledDelayMillis:parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL||gi.toString(),10)}))});d.setGlobalTracerProvider(t),ze(t)}}return qe(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{St();let t=[f.shutdown()],n=Re();n&&t.push(n.shutdown());let r=k();r&&t.push(r.shutdown()),await Promise.race([Promise.all(t),vi(e,`OpenTelemetry shutdown timeout`)])}catch(t){throw t instanceof Error&&t.message.includes(`timeout`)&&A(`
|
|
13
|
+
OpenTelemetry telemetry flush timed out after ${e}ms
|
|
14
|
+
|
|
15
|
+
To resolve this issue, you can:
|
|
16
|
+
1. Increase the timeout by setting CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS env var (e.g., 5000 for 5 seconds)
|
|
17
|
+
2. Check if your OpenTelemetry backend is experiencing scalability issues
|
|
18
|
+
3. Disable OpenTelemetry by unsetting CLAUDE_CODE_ENABLE_TELEMETRY env var
|
|
19
|
+
|
|
20
|
+
Current timeout: ${e}ms
|
|
21
|
+
`,{level:`error`}),t}}),f.getMeter(`com.anthropic.claude_code`,`0.0.24`)}function ki(){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 Ai(){let e=ct(),t=ut(),n={},r=ki();Object.keys(r).length>0&&(n.headers=async()=>r);let i=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;if(!e||i&&ft(i)){let e=dt();return(t||e)&&(n.httpAgentOptions={...t,...e&&{ca:e}}),n}let a=dt();return n.httpAgentOptions=n=>t||a?new mt(e,{...t&&{cert:t.cert,key:t.key,passphrase:t.passphrase},...a&&{ca:a}}):new mt(e),n}export{Oi 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-C8qsPrLj.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};
|