@readmagic/workmate 0.0.2 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-BgNp7glC.js → AddWorkspaceDirectory-BTC7FPqM.js} +1 -1
- package/dist/chunks/{App-Coboqa8H.js → App-DOm71vtY.js} +1 -1
- package/dist/chunks/{ApproveApiKey-CYpBbj0k.js → ApproveApiKey-9YQzwrrC.js} +1 -1
- package/dist/chunks/ApproveApiKey-LPrZMlgU.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-DxKsTdqj.js → AssistantSessionChooser-CnYfFWrx.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-D_UHm7xo.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-Cx3QGFz-.js → BypassPermissionsModeDialog-DAq-qbqC.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog--w2zWWEn.js +1 -0
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BAK9fxwg.js → ClaudeMdExternalIncludesDialog-CyvidoR3.js} +1 -1
- package/dist/chunks/ConsoleOAuthFlow-BXdC6j3_.js +1 -0
- package/dist/chunks/{DesktopHandoff-BsHgLlTy.js → DesktopHandoff-gRvy-WlW.js} +1 -1
- package/dist/chunks/{DiffDialog-BgTW2Znv.js → DiffDialog-CdfVTgOx.js} +2 -2
- package/dist/chunks/Doctor-BuiYwjAS.js +1 -0
- package/dist/chunks/Doctor-DKlHJBXq.js +3 -0
- package/dist/chunks/ExitFlow-rExuBL3w.js +2 -0
- package/dist/chunks/Feedback-gGpjUC_F.js +2 -0
- package/dist/chunks/{Grove-Dsi4yU08.js → Grove-CD769Wvw.js} +1 -1
- package/dist/chunks/Grove-ENfM8hC6.js +1 -0
- package/dist/chunks/{HybridTransport-8qA64lCx.js → HybridTransport-kN1jmg26.js} +4 -4
- package/dist/chunks/{InvalidConfigDialog-CAZ1z5WG.js → InvalidConfigDialog-BpJub73a.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-D82Qk_MR.js → InvalidSettingsDialog-DzOp3Ihx.js} +1 -1
- package/dist/chunks/MCPConnectionManager-CaBvO7NB.js +1 -0
- package/dist/chunks/{McpParsingWarnings-8ZueNqAd.js → McpParsingWarnings-Cc6FWyU4.js} +1 -1
- package/dist/chunks/MessageSelector-DOB1S2-O.js +3 -0
- package/dist/chunks/Messages-Clihwd2F.js +11 -0
- package/dist/chunks/{Onboarding-CUztnbbv.js → Onboarding-D00lTweB.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-DSgrZvMv.js → OverageCreditUpsell-B-Bf_-UX.js} +1 -1
- package/dist/chunks/PluginSettings-DUxj_oAg.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-IaihWay3.js → PromptInputFooterSuggestions-MwS_cExV.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-okS2rQ4k.js → PromptInputHelpMenu-V2dEpzhC.js} +1 -1
- package/dist/chunks/QueryEngine-BLcPQYq_.js +1 -0
- package/dist/chunks/{REPL-Dto012J0.js → REPL-B_E07dnf.js} +44 -44
- package/dist/chunks/REPL-BhURgntS.js +1 -0
- package/dist/chunks/{RemoteCallout-C_UIYnuT.js → RemoteCallout-ChCjmgw1.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-CuSSHAXN.js → RemoteSessionManager-B43isWQs.js} +2 -2
- package/dist/chunks/ResumeConversation-DaQ9n8_C.js +1 -0
- package/dist/chunks/{SSETransport-Chj_yfPv.js → SSETransport-h43pQVlJ.js} +3 -3
- package/dist/chunks/SearchExtraToolsTool-DSq7beKs.js +1 -0
- package/dist/chunks/Settings-CNsaWv8g.js +2 -0
- package/dist/chunks/{TeleportProgress-DP1a8jit.js → TeleportProgress-QtJrXSCX.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-B6sTwXuZ.js → TeleportRepoMismatchDialog-D-HVj-A6.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-CKUuRQSG.js → TeleportResumeWrapper-C6sbzJsJ.js} +1 -1
- package/dist/chunks/{ThemePicker-Dyq1YVhb.js → ThemePicker-CqPCp5Hs.js} +1 -1
- package/dist/chunks/TrustDialog-CeVwxDlZ.js +1 -0
- package/dist/chunks/{ValidationErrorsList-DUNh4BNa.js → ValidationErrorsList-Bl68E-2-.js} +1 -1
- package/dist/chunks/{WelcomeV2-TPbOXGrO.js → WelcomeV2-DNiXQ5ES.js} +1 -1
- package/dist/chunks/{add-dir-Bf_5tCeR.js → add-dir-V3xjklnJ.js} +1 -1
- package/dist/chunks/{agentDisplay-CCeYiAta.js → agentDisplay-BuiwcrQi.js} +1 -1
- package/dist/chunks/{agents-Bt72Gz1v.js → agents-D7um1IXM.js} +7 -7
- package/dist/chunks/{agents-T8xHY5Wk.js → agents-ZY6IaVE7.js} +1 -1
- package/dist/chunks/{allErrors-CDWTJcMw.js → allErrors-CHVdQ3fT.js} +1 -1
- package/dist/chunks/{ant-DRF-v5bA.js → ant-D66LZCap.js} +1 -1
- package/dist/chunks/api-C-rOQY-l.js +1 -0
- package/dist/chunks/api-Dmn7DUgU.js +1 -0
- package/dist/chunks/asciicast-BsWpcxrc.js +1 -0
- package/dist/chunks/{asciicast-CQJlNTae.js → asciicast-CbAjUHT_.js} +4 -4
- package/dist/chunks/{assistant-z1ojxEET.js → assistant-CYF7ch7C.js} +1 -1
- package/dist/chunks/auth-C4Rvit2q.js +1 -0
- package/dist/chunks/auth-Cj7EX1eG.js +1 -0
- package/dist/chunks/auth-DAxGNCIR.js +15 -0
- package/dist/chunks/{autoMode-DW_H3i37.js → autoMode-TysBQkU_.js} +5 -5
- package/dist/chunks/{autonomy-OxhciwYa.js → autonomy-CNEbT-t_.js} +7 -7
- package/dist/chunks/{autonomy-46hnmyAi.js → autonomy-k3QPea5z.js} +1 -1
- package/dist/chunks/{autonomyPanel-CTEjq0Bd.js → autonomyPanel-DiztRblF.js} +1 -1
- package/dist/chunks/{backgroundHousekeeping-Cpxq4krt.js → backgroundHousekeeping-C9m4tiFi.js} +3 -3
- package/dist/chunks/backgroundHousekeeping-DQjzXBe0.js +1 -0
- package/dist/chunks/{banner-BVkLvJiB.js → banner-CWkrK10u.js} +1 -1
- package/dist/chunks/bg-B0iMGM9C.js +1 -0
- package/dist/chunks/{bg-zWGqkcST.js → bg-WnYN5ifx.js} +2 -2
- package/dist/chunks/{branch-DJzijRGm.js → branch-_NBgDfrK.js} +1 -1
- package/dist/chunks/{bridge-Dpr2AWpc.js → bridge-DpmFl8p8.js} +2 -2
- package/dist/chunks/{bridgeConfig-DDF3teRE.js → bridgeConfig-DMBOO3gW.js} +1 -1
- package/dist/chunks/bridgeConfig-DsI5d0s7.js +1 -0
- package/dist/chunks/bridgeEnabled-DZzlF2d8.js +1 -0
- package/dist/chunks/{bridgeEnabled-D4JDZd0y.js → bridgeEnabled-FjPuA7zx.js} +1 -1
- package/dist/chunks/bridgeMain-BppY0KW3.js +68 -0
- package/dist/chunks/bridgeMain-BrY4tkF6.js +1 -0
- package/dist/chunks/bridgeMessaging-N5zlzCCr.js +1 -0
- package/dist/chunks/bridgePointer-MqLe5Asm.js +1 -0
- package/dist/chunks/{browser-BKiu1max.js → browser-BmZuQom6.js} +1 -1
- package/dist/chunks/{btw-DG9CCeq4.js → btw-BFRje_Zi.js} +1 -1
- package/dist/chunks/caches-BBLH8G1I.js +1 -0
- package/dist/chunks/{caches-BB5_91gU.js → caches-CcfPJ4_A.js} +2 -2
- package/dist/chunks/ccrClient-q2JCVCU2.js +1 -0
- package/dist/chunks/{claudeDesktop-9xfIgkzE.js → claudeDesktop-Cx31Ugjp.js} +1 -1
- package/dist/chunks/{clear-ueMvDelv.js → clear-CxY7W5Wt.js} +1 -1
- package/dist/chunks/{cliLaunch-BJ9o-rIV.js → cliLaunch-BkPAatcs.js} +1 -1
- package/dist/chunks/client-CtVu3BLD.js +1 -0
- package/dist/chunks/{color-B0-MIfsq.js → color-DOWhfjnA.js} +1 -1
- package/dist/chunks/commands-BWw1sQeH.js +1 -0
- package/dist/chunks/{commitAttribution-DKun9CeU.js → commitAttribution-CLbEIaRJ.js} +2 -2
- package/dist/chunks/commitAttribution-DIT_s0vY.js +1 -0
- package/dist/chunks/compact-CaOnQVkH.js +2 -0
- package/dist/chunks/{completionCache-CdHCuiqq.js → completionCache-MN3_MqK8.js} +2 -2
- package/dist/chunks/completionCache-c4aiyZ_f.js +1 -0
- package/dist/chunks/config-DiT2Z8dY.js +3 -0
- package/dist/chunks/config-DmPGzNmi.js +1 -0
- package/dist/chunks/config-HHTwEsWp.js +1 -0
- package/dist/chunks/{context-DBswG0EY.js → context-B2OvKo2t.js} +1 -1
- package/dist/chunks/context-noninteractive-BilCSCV1.js +1 -0
- package/dist/chunks/{context-noninteractive-CTvyNimw.js → context-noninteractive-BuGxX3YL.js} +2 -2
- package/dist/chunks/conversation-BWXf3un9.js +1 -0
- package/dist/chunks/conversation-awh8AwwL.js +1 -0
- package/dist/chunks/{createSSHSession-BdO35H6o.js → createSSHSession-C-c7I5iJ.js} +5 -5
- package/dist/chunks/{createSession-Br1g8qSD.js → createSession-D_fIDqgc.js} +1 -1
- package/dist/chunks/createSession-Hvpx3Le7.js +1 -0
- package/dist/chunks/crossProjectResume-_XjvSXA3.js +40 -0
- package/dist/chunks/{daemon-BQiSFjc-.js → daemon-YtZbMQtn.js} +1 -1
- package/dist/chunks/datadog-Ed8emSFA.js +1 -0
- package/dist/chunks/{debug-DiuXEmUq.js → debug-BrXObCdR.js} +1 -1
- package/dist/chunks/{debugUtils-3YYWvb3H.js → debugUtils-NO5KtXqi.js} +1 -1
- package/dist/chunks/{desktop-W7SA8BFk.js → desktop-D_ofPlyi.js} +1 -1
- package/dist/chunks/{detached-Cv9gAylK.js → detached-TYk4hMFj.js} +1 -1
- package/dist/chunks/{detectRepository-B1PMTLAU.js → detectRepository-BPr0VWNO.js} +1 -1
- package/dist/chunks/detectRepository-BTPgN89l.js +1 -0
- package/dist/chunks/{diff-CMtRjFUb.js → diff-CUAgBDu1.js} +1 -1
- package/dist/chunks/{directoryCompletion-CeV63gvu.js → directoryCompletion-CW2ckkQg.js} +1 -1
- package/dist/chunks/doctor-CkdQ7Fv7.js +1 -0
- package/dist/chunks/{effort-BAlVDBHq.js → effort-DCgooYMY.js} +2 -2
- package/dist/chunks/{entry-DLqeVq5C.js → entry-Bh0gPOAo.js} +4 -4
- package/dist/chunks/envLessBridgeConfig-DJHZAlU-.js +1 -0
- package/dist/chunks/envLessBridgeConfig-sxodu0xO.js +1 -0
- package/dist/chunks/esm-B62dCLgf.js +1 -0
- package/dist/chunks/{execFileNoThrow-DResQRvR.js → execFileNoThrow-D244NytW.js} +1 -1
- package/dist/chunks/execSyncWrapper-CCMQShK-.js +1 -0
- package/dist/chunks/exit-CFJR3NfE.js +1 -0
- package/dist/chunks/extra-usage-CjaHpu8y.js +1 -0
- package/dist/chunks/extra-usage-D1Y-3OWQ.js +1 -0
- package/dist/chunks/{extra-usage-core-Dh4rVUI-.js → extra-usage-core-B6ga8Rni.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-D4Ya5KPm.js → extra-usage-noninteractive-Dc9AndId.js} +1 -1
- package/dist/chunks/{extraUsage-DtWi8E78.js → extraUsage-2DwLEr26.js} +1 -1
- package/dist/chunks/extractMemories-C3qrwpu2.js +1 -0
- package/dist/chunks/{fast-DkUxqWhE.js → fast-CW_NsL0x.js} +1 -1
- package/dist/chunks/fast-D3CPmUX4.js +1 -0
- package/dist/chunks/{feedback-Cn7Sbqxa.js → feedback-BpRorTAC.js} +1 -1
- package/dist/chunks/{file-BZriE-XU.js → file-DcZWPH2V.js} +5 -5
- package/dist/chunks/firstPartyEventLogger-CuUiNdj8.js +5 -0
- package/dist/chunks/firstPartyEventLogger-DPUQnc6J.js +1 -0
- package/dist/chunks/{flushGate-ebqQZF1t.js → flushGate-BltVae97.js} +1 -1
- package/dist/chunks/gemini-YyIxfveQ.js +1 -0
- package/dist/chunks/generateRecap-tx4wLIkI.js +1 -0
- package/dist/chunks/{generateSessionName-DEAw5x_h.js → generateSessionName-BkDigIN8.js} +1 -1
- package/dist/chunks/{genericProcessUtils-DO7Fy0RJ.js → genericProcessUtils-CdQTApYX.js} +1 -1
- package/dist/chunks/git-CbcnOf0E.js +1 -0
- package/dist/chunks/git-Do0wJvux.js +6 -0
- package/dist/chunks/{githubRepoPathMapping-Tt-LdYFZ.js → githubRepoPathMapping-C4umZ1oC.js} +1 -1
- package/dist/chunks/{goal-DCaI1NPN.js → goal-DZrD4puM.js} +3 -3
- package/dist/chunks/{grok-CKlngG3b.js → grok-BZf7W_hL.js} +1 -1
- package/dist/chunks/{grove-DSWe6psK.js → grove-CFBPplP6.js} +2 -2
- package/dist/chunks/{heapdump-OVbV05On.js → heapdump-DWc3Z2NO.js} +5 -5
- package/dist/chunks/{help-CRtX5VX9.js → help-pap9jNUJ.js} +1 -1
- package/dist/chunks/{hooks-tpf90xd5.js → hooks-Bmat0L6A.js} +2 -2
- package/dist/chunks/hooks-cCAzfabs.js +1 -0
- package/dist/chunks/{hostGuard-t7QfbijF.js → hostGuard-C5xydXZI.js} +1 -1
- package/dist/chunks/inboundAttachments-DZgSqDwY.js +1 -0
- package/dist/chunks/inboundAttachments-DkfNHtF9.js +1 -0
- package/dist/chunks/initReplBridge-myzllvlk.js +1 -0
- package/dist/chunks/install-D4jmHjmk.js +1 -0
- package/dist/chunks/{instrumentation--Sx0y1Gk.js → instrumentation-Nqgm1SMw.js} +6 -6
- package/dist/chunks/{job-D7B35Usp.js → job-CT9bcgPb.js} +1 -1
- package/dist/chunks/jwtUtils-DE2GPUcx.js +1 -0
- package/dist/chunks/keybindings-DETOn3qJ.js +2 -0
- package/dist/chunks/{language-8Rnu_qxl.js → language-BA5WprZv.js} +1 -1
- package/dist/chunks/language-BbaOTWm3.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-CNPkOVzu.js → launchAgentsPlatform-CuRQgd2Q.js} +1 -1
- package/dist/chunks/{launchLocalMemory-BxmDhENs.js → launchLocalMemory-CRMqifzn.js} +2 -2
- package/dist/chunks/{launchLocalVault-DQlTGA-g.js → launchLocalVault-DlKX_oDE.js} +3 -3
- package/dist/chunks/{launchMemoryStores-EYAwxI8i.js → launchMemoryStores-CN0ecWpP.js} +1 -1
- package/dist/chunks/{launchOnboarding-CTu5Zf4E.js → launchOnboarding-DTdUA_wE.js} +1 -1
- package/dist/chunks/{launchSchedule-CeHHSvO7.js → launchSchedule-psiSLmTA.js} +1 -1
- package/dist/chunks/{launchSkillStore-Bqh2Fru2.js → launchSkillStore-CQQ00Ads.js} +1 -1
- package/dist/chunks/{launchTeleport-Crc3XVZX.js → launchTeleport-CXFRPVMR.js} +1 -1
- package/dist/chunks/{launchVault-BHLgpth_.js → launchVault-Dn6jq0Rc.js} +1 -1
- package/dist/chunks/{v4-jw6qOKwQ.js → lazySchema-DcIJE_0i.js} +1 -1
- package/dist/chunks/{loadAgentsDir-ZQwvbURI.js → loadAgentsDir-BURvZNN6.js} +685 -683
- package/dist/chunks/loadAgentsDir-Db9UTm45.js +1 -0
- package/dist/chunks/loadPluginHooks-C9A9oS-w.js +1 -0
- package/dist/chunks/{localSearch-H0LchlTi.js → localSearch-D2Rs8wQP.js} +1 -1
- package/dist/chunks/localSearch-hBh1ATr2.js +1 -0
- package/dist/chunks/{log-Duzb4o6h.js → log-BMCygSzM.js} +1 -1
- package/dist/chunks/{logoV2Utils-5lcUu53m.js → logoV2Utils-DN9nzdX-.js} +1 -1
- package/dist/chunks/{magicDocs-D1FIPmYg.js → magicDocs-DIeTcwAA.js} +3 -3
- package/dist/chunks/{main-B8XtFN2P.js → main-CI54PZrG.js} +78 -78
- package/dist/chunks/{main-CR7cXdgy.js → main-D862LI_d.js} +2 -2
- package/dist/chunks/{mappers-DKU4RgE3.js → mappers-Q_Z3Kjo-.js} +1 -1
- package/dist/chunks/mcp-CtbhGaLC.js +2 -0
- package/dist/chunks/mcp-DMacvhqZ.js +1 -0
- package/dist/chunks/mcp-RvwPC7FB.js +6 -0
- package/dist/chunks/{memoize-DgMjqLtn.js → memoize-B0zhbT8Z.js} +1 -1
- package/dist/chunks/{memory-D-Q62bJ7.js → memory-BPN8gW7n.js} +1 -1
- package/dist/chunks/{mode-DFZgqKBd.js → mode-Jl_Boaym.js} +2 -2
- package/dist/chunks/model-BIVmcl_N.js +1 -0
- package/dist/chunks/{model-fDWtIRVr.js → model-CWBwPvTH.js} +1 -1
- package/dist/chunks/model-DlVpqR0P.js +1 -0
- package/dist/chunks/nativeInstaller-8arnRiUO.js +1 -0
- package/dist/chunks/{onChangeAppState-DaQ0R9Tw.js → onChangeAppState-DBantDJ6.js} +1 -1
- package/dist/chunks/{openai-DNS0-ivj.js → openai-yin1iDG8.js} +3 -3
- package/dist/chunks/{overageCreditGrant-qHN3tnp2.js → overageCreditGrant-CN_sVURL.js} +1 -1
- package/dist/chunks/{panelCall-BvKpHquo.js → panelCall-CPKC6VR5.js} +1 -1
- package/dist/chunks/parser-Bf6iasPV.js +1 -0
- package/dist/chunks/{parser-TYEkLFgh.js → parser-DFwaTGf7.js} +1 -1
- package/dist/chunks/{partition-Cv11dD5P.js → partition-CW0BJ881.js} +1 -1
- package/dist/chunks/{passes-DQdM2Ssq.js → passes-DOm9ukdK.js} +1 -1
- package/dist/chunks/{path-Cu_AKqg6.js → path-D5U-tm91.js} +1 -1
- package/dist/chunks/permissions-CxDJ__l6.js +3 -0
- package/dist/chunks/pidLock-C69HNTTb.js +3 -0
- package/dist/chunks/{pipeTransport-7GIO6GCA.js → pipeTransport-CqCnc-Ys.js} +1 -1
- package/dist/chunks/{plan-D8dQDl8W.js → plan-B0rEs32a.js} +1 -1
- package/dist/chunks/{platform-B5dCGT8t.js → platform-BrYefG_2.js} +1 -1
- package/dist/chunks/{plugin-w8MqsKHn.js → plugin-BSEMgcGu.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-7FFHzSRz.js → pluginAutoupdate-CTByPD8J.js} +1 -1
- package/dist/chunks/pluginBlocklist-mogKaK0p.js +1 -0
- package/dist/chunks/pluginCliCommands-DQQ7C7kk.js +1 -0
- package/dist/chunks/{pluginFlagging-_WUQP3Lq.js → pluginFlagging-mHNff1t9.js} +1 -1
- package/dist/chunks/pluginOperations-JEedVzfS.js +2 -0
- package/dist/chunks/pluginStartupCheck-D7ts2V3p.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BelpzwZI.js → pluginStartupCheck-RscVZDi4.js} +1 -1
- package/dist/chunks/plugins-Cr03lISA.js +4 -0
- package/dist/chunks/policyLimits-DWtLyJ4n.js +1 -0
- package/dist/chunks/pollConfig-DH2oCtFS.js +1 -0
- package/dist/chunks/{poor-D3T_8wwf.js → poor-DekfGNT7.js} +1 -1
- package/dist/chunks/poorMode-AE4WNYZo.js +1 -0
- package/dist/chunks/{poorMode-BqyVuBu-.js → poorMode-CtcqaiwD.js} +1 -1
- package/dist/chunks/print-CZUmAzmt.js +23 -0
- package/dist/chunks/{privacy-settings-D5zxu4Aa.js → privacy-settings-CwJ1H8Ua.js} +1 -1
- package/dist/chunks/processBashCommand-aKNneP2u.js +1 -0
- package/dist/chunks/processSlashCommand-BcPnWNxZ.js +5 -0
- package/dist/chunks/prompt-CIyhCdkE.js +1 -0
- package/dist/chunks/prompt-DNDgGM9q.js +139 -0
- package/dist/chunks/prompt-DRhjinu2.js +1 -0
- package/dist/chunks/{promptEditor-D6HzjcMS.js → promptEditor-DMJyosKj.js} +2 -2
- package/dist/chunks/{protocolHandler-BXlx1N7v.js → protocolHandler-z2zxAtB1.js} +4 -4
- package/dist/chunks/{proxy-CHnxhNZI.js → proxy-CRN7jYIi.js} +3 -3
- package/dist/chunks/{rate-limit-options-1hc-RyNR.js → rate-limit-options--Y3oF1g0.js} +1 -1
- package/dist/chunks/rcDebugLog-DoL1FpGJ.js +11 -0
- package/dist/chunks/reconciler-CJcSh6xo.js +4 -0
- package/dist/chunks/{referral-Cu9bEOFE.js → referral-UKJv23_5.js} +1 -1
- package/dist/chunks/{refresh-vJbxW4a1.js → refresh-ul_i5R1a.js} +1 -1
- package/dist/chunks/{registerProtocol-B_XbLDQO.js → registerProtocol-CukLQuxJ.js} +3 -3
- package/dist/chunks/{release-notes-CavWoMQR.js → release-notes-CGv_6MMt.js} +1 -1
- package/dist/chunks/{releaseNotes-Di6OaHF7.js → releaseNotes-BKZNuDLD.js} +2 -2
- package/dist/chunks/{reload-plugins-ofeLn07p.js → reload-plugins-2W11dpLQ.js} +1 -1
- package/dist/chunks/{remote-env-dXzHAuD6.js → remote-env-D9xsoBfx.js} +1 -1
- package/dist/chunks/remoteBridgeCore-asY9JAXU.js +1 -0
- package/dist/chunks/remoteManagedSettings-Bxo3bv1U.js +1 -0
- package/dist/chunks/{rename-CtjP0lop.js → rename-CHsHMWpO.js} +1 -1
- package/dist/chunks/{renderOptions-DOXmueQV.js → renderOptions-BUJB9nAm.js} +1 -1
- package/dist/chunks/{resume-C5h5JvY1.js → resume-NduOaghx.js} +2 -2
- package/dist/chunks/{ripgrep-BN_g-F7X.js → ripgrep-BXmXjAzA.js} +1 -1
- package/dist/chunks/ripgrep-BfIpz5uC.js +1 -0
- package/dist/chunks/{runtimeObserver-B93v1AxE.js → runtimeObserver-BXbjibFk.js} +4 -4
- package/dist/chunks/{runtimeObserver-DOZFrqJu.js → runtimeObserver-Bo80nWQf.js} +1 -1
- package/dist/chunks/sandbox-adapter-DDfVl_2V.js +1 -0
- package/dist/chunks/{sandbox-toggle-TiLGFwaZ.js → sandbox-toggle-C-WCDRN4.js} +1 -1
- package/dist/chunks/searchExtraTools-BHWzsbNO.js +1 -0
- package/dist/chunks/{session-v9tKHhU9.js → session-pDd13-wE.js} +2 -2
- package/dist/chunks/{sessionDiscovery-4byQKOnc.js → sessionDiscovery-CSUnpsCy.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BZvxeufx.js +1 -0
- package/dist/chunks/sessionMemory-CAmpw2yb.js +1 -0
- package/dist/chunks/sessionMemory-DT0IkiA1.js +1 -0
- package/dist/chunks/sessionMemoryUtils-B4kGNH4j.js +1 -0
- package/dist/chunks/{sessionObserver-OgY9BUP4.js → sessionObserver-Ur7PqKl_.js} +1 -1
- package/dist/chunks/sessionObserver-oIkwTidC.js +1 -0
- package/dist/chunks/sessionStorage-DqARUj0K.js +1 -0
- package/dist/chunks/sessionTitle-pWMaI79N.js +14 -0
- package/dist/chunks/{sessionTracing-BBxhPccY.js → sessionTracing-CCPRzOvy.js} +3 -3
- package/dist/chunks/settings-DfWP5y6X.js +19 -0
- package/dist/chunks/settingsSync-D_4P3Esd.js +1 -0
- package/dist/chunks/setup-JHvhWKh9.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-DDSOFi1W.js → shadowedRuleDetection-Chi3afMR.js} +1 -1
- package/dist/chunks/{shellQuote-yXoC_y5m.js → shellQuote-DkSy9MYE.js} +1 -1
- package/dist/chunks/{sideQuestion-CAiA6jAf.js → sideQuestion-D03MXdE2.js} +1 -1
- package/dist/chunks/sinks-B4_pw0Gb.js +2 -0
- package/dist/chunks/sinks-Cro1Y8C2.js +1 -0
- package/dist/chunks/{skill-learning-Dx1o4mMo.js → skill-learning-7ZQF5JvA.js} +1 -1
- package/dist/chunks/skillChangeDetector-uCaYrerZ.js +1 -0
- package/dist/chunks/{skillGapStore-BV_6qzxU.js → skillGapStore-BND2Lq0Z.js} +1 -1
- package/dist/chunks/{skillGapStore-Zvqiyxds.js → skillGapStore-z3LP64O-.js} +2 -2
- package/dist/chunks/{skillGenerator-jJQDphQ8.js → skillGenerator-DaNb-yKH.js} +2 -2
- package/dist/chunks/skillLearning-GZxYPlyl.js +1 -0
- package/dist/chunks/{skillLearning-BTT3_yGc.js → skillLearning-rMX1bSBa.js} +1 -1
- package/dist/chunks/{skillPanel-OW2M6SZr.js → skillPanel-q7GPSQ6_.js} +3 -3
- package/dist/chunks/{skillSearchPanel-C0Y56c5N.js → skillSearchPanel-oj8gy1ZL.js} +4 -4
- package/dist/chunks/{skills-BFsyLP33.js → skills-QqbeFP0s.js} +1 -1
- package/dist/chunks/startupProfiler-DIWVcO4e.js +1 -0
- package/dist/chunks/{startupProfiler-BquH_Yqm.js → startupProfiler-xa3NmN7Z.js} +2 -2
- package/dist/chunks/{stats-CrPmPT8f.js → stats-DmFubHpI.js} +1 -1
- package/dist/chunks/{status-BO5J2MAe.js → status-BEIsLmfj.js} +1 -1
- package/dist/chunks/{status-DHJbK4pV.js → status-DW3Z_7xa.js} +2 -2
- package/dist/chunks/{statusNoticeHelpers-CqeUBySi.js → statusNoticeHelpers-CaHS8xig.js} +1 -1
- package/dist/chunks/{stickers-BLFmyHZV.js → stickers-D5teCKMN.js} +1 -1
- package/dist/chunks/{stringUtils-D_g2L6A4.js → stringUtils-DGLPkqJ4.js} +1 -1
- package/dist/chunks/{tag-M2AEtXjW.js → tag-CRg93Die.js} +2 -2
- package/dist/chunks/{tasks-CoOs_Qkj.js → tasks-BEohK1ij.js} +1 -1
- package/dist/chunks/teleport-4Srg5vcP.js +1 -0
- package/dist/chunks/{templateJobs-Cl50Qw0s.js → templateJobs-DYP1fjYU.js} +1 -1
- package/dist/chunks/terminalSetup-BNs9nLbT.js +33 -0
- package/dist/chunks/{terminalSetup-Bdh9K31U.js → terminalSetup-RDKg8dVa.js} +1 -1
- package/dist/chunks/{theme-DgCIr0jU.js → theme-kNL4kl_3.js} +1 -1
- package/dist/chunks/{thinkback-ERCQ86CR.js → thinkback-gV-sKkMM.js} +1 -1
- package/dist/chunks/thinkback-hc5eJ9ul.js +1 -0
- package/dist/chunks/thinkback-play-BpWMqbgJ.js +1 -0
- package/dist/chunks/{tmux-ZZk68JBq.js → tmux-BY7IdQ1f.js} +1 -1
- package/dist/chunks/{toolEventObserver-9-5Ne25Z.js → toolEventObserver-C98uraqD.js} +1 -1
- package/dist/chunks/{toolEventObserver-9XCQXiMx.js → toolEventObserver-ar5NDa0M.js} +1 -1
- package/dist/chunks/toolPool-CNYKDRq5.js +1 -0
- package/dist/chunks/trustedDevice-0dehm9qz.js +1 -0
- package/dist/chunks/trustedDevice-BBKUhCCL.js +1 -0
- package/dist/chunks/{types-Cnorfsss.js → types-C-MRCL8J.js} +3 -3
- package/dist/chunks/udsClient-BuCtv7dN.js +1 -0
- package/dist/chunks/{ultrareviewCommand-BMBHepdu.js → ultrareviewCommand-yXlFsMnv.js} +2 -2
- package/dist/chunks/{undercover-DDgIKbO5.js → undercover-BTIRVF1t.js} +1 -1
- package/dist/chunks/undercover-CG_269xD.js +1 -0
- package/dist/chunks/{up-D6bNw_tT.js → up-BHkC97_C.js} +1 -1
- package/dist/chunks/updateCCB-B2xAJ4Nr.js +11 -0
- package/dist/chunks/upgrade-J7lKLkD2.js +1 -0
- package/dist/chunks/{upgrade-BN20nsCH.js → upgrade-yNl7EO4e.js} +1 -1
- package/dist/chunks/upload-BWVIHmMB.js +1 -0
- package/dist/chunks/{upstreamproxy-os5rw0Vg.js → upstreamproxy-DyR_eXO8.js} +4 -4
- package/dist/chunks/{usage-D_sqm8us.js → usage-B2PbCUMi.js} +1 -1
- package/dist/chunks/usage-Ck8Cu45g.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-vzUoPY51.js → useExitOnCtrlCDWithKeybindings-CV4GZ-sq.js} +1 -1
- package/dist/chunks/useMainLoopModel-CO4yBjRM.js +1 -0
- package/dist/chunks/useManagePlugins-BzFKIDrD.js +1 -0
- package/dist/chunks/{useMergedTools-Bb4XbC9d.js → useMergedTools-CRLWSGDl.js} +1 -1
- package/dist/chunks/{useSearchInput-B1UOjxAI.js → useSearchInput-BzGq4t7t.js} +1 -1
- package/dist/chunks/{useSettingsErrors-BLbvu4--.js → useSettingsErrors-CSemUjj1.js} +1 -1
- package/dist/chunks/{util-CxlfALM4.js → util-BnReK81E.js} +1 -1
- package/dist/chunks/validatePlugin-D6sPqea1.js +1 -0
- package/dist/chunks/{vim-DLWBHwVM.js → vim-C0KTnJJs.js} +1 -1
- package/dist/chunks/{which-sEFQXpaX.js → which-CKQnSouy.js} +1 -1
- package/dist/chunks/windowsPaths-9pEkw0oV.js +1 -0
- package/dist/chunks/windowsPaths-DtapVxOo.js +1 -0
- package/dist/chunks/{workSecret-DvniZR71.js → workSecret-CNWiR2uQ.js} +1 -1
- package/dist/chunks/{workerRegistry-CFnGtb3L.js → workerRegistry-CUXbNyL9.js} +1 -1
- package/dist/chunks/worktree-89ttIVxH.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +5 -10
- package/dist/chunks/ApproveApiKey-CQsQdQBC.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-AiVi-1pI.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DUu6iRJk.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-DVTPwR5I.js +0 -1
- package/dist/chunks/Doctor-BXhz8eUa.js +0 -3
- package/dist/chunks/Doctor-D75dsEyb.js +0 -1
- package/dist/chunks/ExitFlow-B1XNACQP.js +0 -2
- package/dist/chunks/Feedback-Cvz80lAn.js +0 -2
- package/dist/chunks/Grove-B7hhBvFw.js +0 -1
- package/dist/chunks/MCPConnectionManager-BLfKm4H2.js +0 -1
- package/dist/chunks/MessageSelector-DmKtBYX9.js +0 -3
- package/dist/chunks/Messages-CaFdI1kk.js +0 -11
- package/dist/chunks/PluginSettings-0FSNch8O.js +0 -17
- package/dist/chunks/QueryEngine-WYDWzQuY.js +0 -1
- package/dist/chunks/REPL-vV_jzAVx.js +0 -1
- package/dist/chunks/ResumeConversation-g_JyOWbl.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-Daedym7_.js +0 -1
- package/dist/chunks/Settings-DUXA-qac.js +0 -2
- package/dist/chunks/TrustDialog-CdZS9t-T.js +0 -1
- package/dist/chunks/ajv-5vMo9UcX.js +0 -8
- package/dist/chunks/api-CLLIHLpn.js +0 -1
- package/dist/chunks/api-DMpNA1s8.js +0 -1
- package/dist/chunks/asciicast-BIr75_x9.js +0 -1
- package/dist/chunks/auth-Ce0jllLf.js +0 -1
- package/dist/chunks/auth-DV3P8Qup.js +0 -1
- package/dist/chunks/auth-DpFfHy1W.js +0 -15
- package/dist/chunks/backgroundHousekeeping-BycL9lOe.js +0 -1
- package/dist/chunks/bg-H849G7Sc.js +0 -1
- package/dist/chunks/bridgeConfig-CcANVX0P.js +0 -1
- package/dist/chunks/bridgeEnabled-Cn-u7P4_.js +0 -1
- package/dist/chunks/bridgeMain-CtgVyLjI.js +0 -68
- package/dist/chunks/bridgeMain-Dh0gWRVo.js +0 -1
- package/dist/chunks/bridgeMessaging-CRG6HqUb.js +0 -1
- package/dist/chunks/bridgePointer-Cug5fQ3e.js +0 -1
- package/dist/chunks/caches-C3NINY3K.js +0 -1
- package/dist/chunks/ccrClient-CRXGlUCe.js +0 -1
- package/dist/chunks/client-AnWHs0gW.js +0 -1
- package/dist/chunks/commands-DsKH3ogN.js +0 -1
- package/dist/chunks/commitAttribution-D7NrwLhc.js +0 -1
- package/dist/chunks/compact-BhWCO-oD.js +0 -2
- package/dist/chunks/completionCache-C9zlWBRz.js +0 -1
- package/dist/chunks/config-662VDD70.js +0 -3
- package/dist/chunks/config-CUN8YbOa.js +0 -1
- package/dist/chunks/config-DklnhNx1.js +0 -1
- package/dist/chunks/config-Wk3svGdH.js +0 -1
- package/dist/chunks/context-noninteractive-C3dICmA9.js +0 -1
- package/dist/chunks/conversation-CooSju3g.js +0 -1
- package/dist/chunks/conversation-DLLIOKYV.js +0 -1
- package/dist/chunks/createSession-CVG8SiEm.js +0 -1
- package/dist/chunks/crossProjectResume-DiKJb83I.js +0 -40
- package/dist/chunks/datadog-BE6D_6m0.js +0 -1
- package/dist/chunks/datadog-C69i7cfI.js +0 -1
- package/dist/chunks/debug-8kgDrUfj.js +0 -1
- package/dist/chunks/detectRepository-_Kj817Vi.js +0 -1
- package/dist/chunks/doctor-DEz8BHAz.js +0 -1
- package/dist/chunks/envLessBridgeConfig-3kCrKZl7.js +0 -1
- package/dist/chunks/envLessBridgeConfig-BfgXw47_.js +0 -1
- package/dist/chunks/esm-C8Zkk1Ux.js +0 -1
- package/dist/chunks/execSyncWrapper-CWxMek26.js +0 -1
- package/dist/chunks/exit-cyepwuyy.js +0 -1
- package/dist/chunks/extra-usage-DlFeNGQD.js +0 -1
- package/dist/chunks/extra-usage-nRFfBiXh.js +0 -1
- package/dist/chunks/extractMemories-BqN8fWZ5.js +0 -1
- package/dist/chunks/fast-NvqW2-t1.js +0 -1
- package/dist/chunks/firstPartyEventLogger-AhXYSrkP.js +0 -1
- package/dist/chunks/firstPartyEventLogger-BQYrBdvD.js +0 -5
- package/dist/chunks/gemini-Sr_00TsL.js +0 -1
- package/dist/chunks/generateRecap-5d4l_ODy.js +0 -1
- package/dist/chunks/git-Cc1jAz6r.js +0 -1
- package/dist/chunks/git-Cgc8X5l2.js +0 -6
- package/dist/chunks/hooks-DvtnNoYE.js +0 -1
- package/dist/chunks/inboundAttachments-BZ6MKpxd.js +0 -1
- package/dist/chunks/inboundAttachments-D5Ux2kCl.js +0 -1
- package/dist/chunks/initReplBridge-CjuO6in6.js +0 -1
- package/dist/chunks/install-DqpM2brU.js +0 -1
- package/dist/chunks/jwtUtils-CqXPjf-a.js +0 -1
- package/dist/chunks/keybindings-JvAmBpLt.js +0 -2
- package/dist/chunks/language-DaxZe0Xw.js +0 -1
- package/dist/chunks/lazySchema-uxlVVNM1.js +0 -1
- package/dist/chunks/loadAgentsDir-D7npVvsj.js +0 -1
- package/dist/chunks/loadPluginHooks-CaKvZVZI.js +0 -1
- package/dist/chunks/localSearch-BU5oulbF.js +0 -1
- package/dist/chunks/mcp-B06Mqsur.js +0 -6
- package/dist/chunks/mcp-C0AjA07u.js +0 -1
- package/dist/chunks/mcp-ghioDl7W.js +0 -2
- package/dist/chunks/metadata-CIx5CsoY.js +0 -1
- package/dist/chunks/model-BgrLt7P7.js +0 -1
- package/dist/chunks/model-aVc5c3Lz.js +0 -1
- package/dist/chunks/nativeInstaller-DKe1pWoL.js +0 -1
- package/dist/chunks/parser-Bj3gOqFv.js +0 -1
- package/dist/chunks/permissions-DB_2mmCl.js +0 -3
- package/dist/chunks/pidLock-DchmaAK6.js +0 -3
- package/dist/chunks/pluginBlocklist-Cw_l-yal.js +0 -1
- package/dist/chunks/pluginCliCommands-BtYWRxhS.js +0 -1
- package/dist/chunks/pluginOperations-BOkST1qE.js +0 -2
- package/dist/chunks/pluginStartupCheck-XBLJZZys.js +0 -1
- package/dist/chunks/plugins-6px6K1fh.js +0 -4
- package/dist/chunks/policyLimits-C07tQ0Wr.js +0 -1
- package/dist/chunks/pollConfig-C2Ac8WMU.js +0 -1
- package/dist/chunks/poorMode-BdBDiOFD.js +0 -1
- package/dist/chunks/print-DcQSuK0v.js +0 -23
- package/dist/chunks/processBashCommand-CEqA4QZi.js +0 -1
- package/dist/chunks/processSlashCommand-DMpFk59M.js +0 -5
- package/dist/chunks/prompt-CKvoqUC3.js +0 -1
- package/dist/chunks/prompt-aXZPR3q8.js +0 -1
- package/dist/chunks/prompt-wys9CwDo.js +0 -132
- package/dist/chunks/rcDebugLog-CivJaJ3V.js +0 -11
- package/dist/chunks/reconciler-BKX4jh34.js +0 -4
- package/dist/chunks/remoteBridgeCore-CmwkjiTK.js +0 -1
- package/dist/chunks/remoteManagedSettings-Co-CxR67.js +0 -1
- package/dist/chunks/ripgrep-hOjrgpMp.js +0 -1
- package/dist/chunks/sandbox-adapter-CO5GuywY.js +0 -1
- package/dist/chunks/searchExtraTools-CXZJU2Kv.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-BUyIQVzL.js +0 -1
- package/dist/chunks/sessionMemory-ZsxCLHYd.js +0 -1
- package/dist/chunks/sessionMemory-e6YpTUhW.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BD_dqyYB.js +0 -1
- package/dist/chunks/sessionObserver-DNItJztR.js +0 -1
- package/dist/chunks/sessionStorage-xvxpRETp.js +0 -1
- package/dist/chunks/sessionTitle-Bph6GO4F.js +0 -14
- package/dist/chunks/settings-BhvhCpVh.js +0 -19
- package/dist/chunks/settingsSync-D2B5K4BT.js +0 -1
- package/dist/chunks/setup-CEnNEK6Z.js +0 -3
- package/dist/chunks/sink-CyKOf5TT.js +0 -1
- package/dist/chunks/sink-DxPJ4khU.js +0 -1
- package/dist/chunks/sinks-BNo3DvxO.js +0 -2
- package/dist/chunks/sinks-CHgtwDha.js +0 -1
- package/dist/chunks/skillChangeDetector-BRBCwQ2w.js +0 -1
- package/dist/chunks/skillLearning-BH7EAU1m.js +0 -1
- package/dist/chunks/src-xRRBgNzF.js +0 -25
- package/dist/chunks/startupProfiler-CYCH-qos.js +0 -1
- package/dist/chunks/stdio-4S7b8Uhx.js +0 -1
- package/dist/chunks/stdio-W_Kokrkh.js +0 -3
- package/dist/chunks/teleport-DjIgQeBB.js +0 -1
- package/dist/chunks/terminalSetup-nvS3KCDG.js +0 -33
- package/dist/chunks/thinkback-BSv_fvbV.js +0 -1
- package/dist/chunks/thinkback-play-DNB0IWYt.js +0 -1
- package/dist/chunks/toolPool-uQKZRMKg.js +0 -1
- package/dist/chunks/trustedDevice-0ej6e3nx.js +0 -1
- package/dist/chunks/trustedDevice-nqhuw4tp.js +0 -1
- package/dist/chunks/udsClient-CiFj4M_h.js +0 -1
- package/dist/chunks/undercover-6UUO38fQ.js +0 -1
- package/dist/chunks/updateCCB-B-OlpLjA.js +0 -11
- package/dist/chunks/upgrade-DYqlCH80.js +0 -1
- package/dist/chunks/upload-BQGByiXE.js +0 -1
- package/dist/chunks/usage-DolSCKGi.js +0 -1
- package/dist/chunks/useMainLoopModel-cZd8EKo5.js +0 -1
- package/dist/chunks/useManagePlugins-DgGZBvXV.js +0 -1
- package/dist/chunks/validatePlugin-n8a4W_jI.js +0 -1
- package/dist/chunks/windowsPaths-BLevJOlm.js +0 -1
- package/dist/chunks/windowsPaths-N_YmYY6k.js +0 -1
- package/dist/chunks/worktree-Dr_WzlXs.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,u as r}from"./envUtils-DSxRz_kt.js";import{en as i,ht as a,nt as o}from"./state-ix0xIunV.js";import{Aa as s,Ao as c,Bl as l,Da as u,Ea as d,Fa as f,Fy as p,Il as m,Ma as h,Na as ee,Oa as g,Oo as _,Pa as te,Py as v,Ta as y,Ua as b,Uo as x,Va as S,Ya as ne,ja as C,jr as re,ka as w,mr as ie,zo as T}from"./loadAgentsDir-ZQwvbURI.js";import{U as ae,l as oe,ot as E,p as D,st as se,z as O}from"./debug-DiuXEmUq.js";import{b as ce,c as le,g as ue}from"./config-662VDD70.js";import{M as k,_ as de,i as A,j as fe,p as pe}from"./git-Cgc8X5l2.js";import{g as me,m as j}from"./log-Duzb4o6h.js";import{n as he,r as M}from"./analytics-BotDBGh0.js";import{Hr as N,Lt as P,Ur as F,Vt as ge,ht as _e,kt as I,vn as L,yn as R}from"./model-BgrLt7P7.js";import{O as z,_ as ve,d as ye,k as be,n as B,t as V}from"./rcDebugLog-CivJaJ3V.js";import{a as H,c as U,d as xe,f as Se,o as W,r as G,s as K,u as q}from"./debugUtils-3YYWvb3H.js";import{a as Ce,i as J,n as we,o as Y,t as X}from"./bridgeConfig-DDF3teRE.js";import{a as Z,o as Q,r as Te,s as Ee,t as De}from"./bridgeEnabled-D4JDZd0y.js";import{i as Oe,t as ke}from"./assistant-C83quuNj.js";import{t as Ae}from"./capacityWake-CV_x9H8j.js";import{n as je,t as Me}from"./pollConfig-C2Ac8WMU.js";import{i as Ne}from"./trustedDevice-nqhuw4tp.js";import{a as Pe,n as Fe,r as Ie,t as Le}from"./workSecret-DvniZR71.js";import{a as Re,i as $,n as ze,t as Be}from"./createSession-Br1g8qSD.js";import{i as Ve,n as He}from"./envLessBridgeConfig-3kCrKZl7.js";import{n as Ue,o as We}from"./mappers-DKU4RgE3.js";import{n as Ge,r as Ke,t as qe}from"./sessionTitle-Bph6GO4F.js";import{a as Je,i as Ye,n as Xe,o as Ze,r as Qe,t as $e}from"./bridgeMessaging-CRG6HqUb.js";import{t as et}from"./HybridTransport-8qA64lCx.js";import{n as tt,r as nt,t as rt}from"./flushGate-ebqQZF1t.js";import{hostname as it}from"os";import{randomUUID as at}from"crypto";i(),j(),de(),ue(),F(),ge(),Ce(),p(),Te(),T(),S(),re(),$(),Ve(),Ue(),Ke(),h(),oe(),V(),fe(),he(),E(),U(),m(),z(),ye(),n(),W(),ae(),L(),d();var ot=2e3,st=6e4,ct=900*1e3,lt=0;async function ut(e){let{dir:n,machineName:i,branch:a,gitRepoUrl:o,title:s,baseUrl:c,sessionIngressUrl:d,workerType:f,getAccessToken:p,createSession:m,archiveSession:h,getCurrentTitle:ee=()=>s,toSDKMessages:_=()=>{throw Error(`BridgeCoreParams.toSDKMessages not provided. Pass it if you use writeMessages() or initialMessages — daemon callers that only use writeSdkMessages() never hit this path.`)},onAuth401:te,getPollIntervalConfig:v=()=>je,initialHistoryCap:b=200,initialMessages:x,previouslyFlushedUUIDs:S,onInboundMessage:ne,onPermissionResponse:re,onInterrupt:ie,onSetModel:T,onSetMaxThinkingTokens:ae,onSetPermissionMode:oe,onStateChange:E,onUserMessage:ce,perpetual:le,initialSSESequenceNum:ue=0}=e,de=++lt,{writeBridgePointer:A,clearBridgePointer:fe,readBridgePointer:pe}=await import(`./bridgePointer-Cug5fQ3e.js`),me=le?await pe(n):null,j=me?.source===`repl`?me:null;D(`[bridge:repl] initBridgeCore #${de} starting (initialMessages=${x?.length??0}${j?` perpetual prior=env:${j.environmentId}`:``})`);let he=C({baseUrl:c,getAccessToken:p,runnerVersion:`0.0.2`,onDebug:D,onAuth401:te,getTrustedDeviceToken:Ne}),N=process.env.USER_TYPE===`ant`?w(he):he,P={dir:n,machineName:i,branch:a,gitRepoUrl:o,maxSessions:1,spawnMode:`single-session`,verbose:!1,sandbox:!1,bridgeId:at(),workerType:f,environmentId:at(),reuseEnvironmentId:j?.environmentId,apiBaseUrl:c,sessionIngressUrl:d},F,ge;try{let e=await N.registerBridgeEnvironment(P);F=e.environment_id,ge=e.environment_secret}catch(e){return K(`registration_failed`,`[bridge:repl] Environment registration failed: ${O(e)}`),j&&await fe(n),E?.(`failed`,O(e)),null}D(`[bridge:repl] Environment registered: ${F}`),k(`info`,`bridge_repl_env_registered`),M(`tengu_bridge_repl_env_registered`,{});async function _e(e,t){if(F!==e)return D(`[bridge:repl] Env mismatch (requested ${e}, got ${F}) — cannot reconnect in place`),!1;let n=Se(t),r=n===t?[t]:[t,n];for(let e of r)try{return await N.reconnectSession(F,e),D(`[bridge:repl] Reconnected session ${e} in place on env ${F}`),!0}catch(t){D(`[bridge:repl] reconnectSession(${e}) failed: ${O(t)}`)}return D(`[bridge:repl] reconnectSession exhausted — falling through to fresh session`),!1}let I=j?await _e(j.environmentId,j.sessionId):!1;j&&!I&&await fe(n);let L;if(I&&j){if(L=j.sessionId,D(`[bridge:repl] Perpetual session reused: ${L}`),x&&S)for(let e of x)S.add(e.uuid)}else{let e=await m({environmentId:F,title:s,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});if(!e)return D(`[bridge:repl] Session creation failed, deregistering environment`),M(`tengu_bridge_repl_session_failed`,{}),await N.deregisterEnvironment(F).catch(()=>{}),E?.(`failed`,`Session creation failed`),null;L=e,D(`[bridge:repl] Session created: ${L}`)}await A(n,{sessionId:L,environmentId:F,source:`repl`}),k(`info`,`bridge_repl_session_created`),M(`tengu_bridge_repl_started`,{has_initial_messages:!!(x&&x.length>0),inProtectedNamespace:r()});let R=new Set;if(x)for(let e of x)R.add(e.uuid);let z=new $e(2e3);for(let e of R)z.add(e);let ye=new $e(2e3),V=new AbortController,H=null;ve(e=>{V.signal.aborted||H?.reportMetadata(e)},{replayCurrent:!0});let U=0,W=I?ue:0,G=null,q=null,Ce=Ae(V.signal),J=Ce.wake,we=Ce.signal,Y=new rt,X=!ce,Z=0,Q=null;async function Te(){if(Q)return Q;Q=Ee();try{return await Q}finally{Q=null}}async function Ee(){if(Z++,B(`doReconnect: attempt=${Z}/3 envId=${F} sessionId=${L} workId=${G}`),U++,D(`[bridge:repl] Reconnecting after env lost (attempt ${Z}/3)`),Z>3)return D(`[bridge:repl] Environment reconnect limit reached (3), giving up`),!1;if(H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}if(J(),Y.drop(),G){let e=G;if(await N.stopWork(F,e,!1).catch(()=>{}),G!==e)return D(`[bridge:repl] Poll loop recovered during stopWork await — deferring to it`),Z=0,!0;G=null,q=null}if(V.signal.aborted)return D(`[bridge:repl] Reconnect aborted by teardown`),!1;let e=F;P.reuseEnvironmentId=e;try{let e=await N.registerBridgeEnvironment(P);F=e.environment_id,ge=e.environment_secret}catch(e){return P.reuseEnvironmentId=void 0,D(`[bridge:repl] Environment re-registration failed: ${O(e)}`),!1}if(P.reuseEnvironmentId=void 0,D(`[bridge:repl] Re-registered: requested=${e} got=${F}`),V.signal.aborted)return D(`[bridge:repl] Reconnect aborted after env registration, cleaning up`),await N.deregisterEnvironment(F).catch(()=>{}),!1;if(H!==null)return D(`[bridge:repl] Poll loop recovered during registerBridgeEnvironment await — deferring to it`),Z=0,!0;if(await _e(e,L))return M(`tengu_bridge_repl_reconnected_in_place`,{}),Z=0,!0;if(F!==e&&M(`tengu_bridge_repl_env_expired_fresh_session`,{}),await h(L),V.signal.aborted)return D(`[bridge:repl] Reconnect aborted after archive, cleaning up`),await N.deregisterEnvironment(F).catch(()=>{}),!1;let t=ee(),r=await m({environmentId:F,title:t,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});return r?V.signal.aborted?(D(`[bridge:repl] Reconnect aborted after session creation, cleaning up`),await h(r),!1):(L=r,l(xe(r)).catch(()=>{}),W=0,ye.clear(),X=!ce,D(`[bridge:repl] Re-created session: ${L}`),await A(n,{sessionId:L,environmentId:F,source:`repl`}),S?.clear(),Z=0,!0):(D(`[bridge:repl] Session creation failed during reconnection`),!1)}function De(){return p()}function Oe(){let e=Y.end();if(e.length===0)return;if(!H){D(`[bridge:repl] Cannot drain ${e.length} pending message(s): no transport`);return}for(let t of e)z.add(t.uuid);let t=_(e).map(e=>({...e,session_id:L}));D(`[bridge:repl] Drained ${e.length} pending message(s) after flush`),H.writeBatch(t)}let ke=null;function Me(){ke?.()}function Ie(e){if(B(`handleTransportPermanentClose: code=${e} transport=${H?`exists`:`null`} pollAborted=${V.signal.aborted}`),D(`[bridge:repl] Transport permanently closed: code=${e}`),M(`tengu_bridge_repl_ws_closed`,{code:e}),H){let e=H.getLastSequenceNum();e>W&&(W=e),H=null}J();let t=Y.drop();if(t>0&&D(`[bridge:repl] Dropping ${t} pending message(s) on transport close (code=${e})`,{level:`warn`}),e===1e3){E?.(`failed`,`session ended`),V.abort(),Me();return}E?.(`reconnecting`,`Remote Control connection lost (code ${e})`),D(`[bridge:repl] Transport reconnect budget exhausted (code=${e}), attempting env reconnect`),Te().then(t=>{t||V.signal.aborted||(D(`[bridge:repl] reconnectEnvironmentWithSession resolved false — tearing down`),M(`tengu_bridge_repl_reconnect_failed`,{close_code:e}),E?.(`failed`,`reconnection failed`),Me())})}let Re;process.env.USER_TYPE===`ant`&&process.platform!==`win32`&&(Re=()=>{D(`[bridge:repl] SIGUSR2 received — forcing doReconnect() for testing`),Te()},process.on(`SIGUSR2`,Re));let $=null;process.env.USER_TYPE===`ant`&&g({fireClose:e=>{if(!$){D(`[bridge:debug] fireClose: no transport wired yet`);return}D(`[bridge:debug] fireClose(${e}) — injecting`),$(e)},forceReconnect:()=>{D(`[bridge:debug] forceReconnect — injecting`),Te()},injectFault:u,wakePollLoop:J,describe:()=>`env=${F} session=${L} transport=${H?.getStateLabel()??`null`} workId=${G??`null`}`}),dt({api:N,getCredentials:()=>({environmentId:F,environmentSecret:ge}),signal:V.signal,getPollIntervalConfig:v,onStateChange:E,getWsState:()=>H?.getStateLabel()??`null`,isAtCapacity:()=>H!==null,capacitySignal:we,onFatalError:Me,getHeartbeatInfo:()=>!G||!q?null:{environmentId:F,workId:G,sessionToken:q},onHeartbeatFatal:e=>{if(D(`[bridge:repl] heartbeatWork fatal (status=${e.status}) — tearing down work item for fast re-dispatch`),H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}Y.drop(),G&&N.stopWork(F,G,!1).catch(e=>{D(`[bridge:repl] stopWork after heartbeat fatal: ${O(e)}`)}),G=null,q=null,J(),E?.(`reconnecting`,`Work item lease expired, fetching fresh token`)},async onEnvironmentLost(){return await Te()?{environmentId:F,environmentSecret:ge}:null},onWorkReceived:(e,r,i,a)=>{if(H?.isConnectedStatus()&&D(`[bridge:repl] Work received while transport connected, replacing with fresh token (workId=${i})`),D(`[bridge:repl] Work received: workId=${i} workSessionId=${e} currentSessionId=${L} match=${Pe(e,L)}`),A(n,{sessionId:L,environmentId:F,source:`repl`}),!Pe(e,L)){D(`[bridge:repl] Rejecting foreign session: expected=${L} got=${e}`);return}G=i,q=r;let o=a||t(process.env.CLAUDE_BRIDGE_USE_CCR_V2),s;if(!o){if(s=De(),!s){D(`[bridge:repl] No OAuth token available for session ingress, skipping work`);return}be(s)}if(M(`tengu_bridge_repl_work_received`,{}),H){let e=H;H=null;let t=e.getLastSequenceNum();t>W&&(W=t),e.close()}Y.deactivate();let l=e=>Ye(e,{transport:H,sessionId:L,onInterrupt:ie,onSetModel:T,onSetMaxThinkingTokens:ae,onSetPermissionMode:oe}),u=!1,f=e=>{H=e,e.setOnConnect(()=>{if(H===e){if(D(`[bridge:repl] Ingress transport connected`),M(`tengu_bridge_repl_ws_connected`,{}),!o){let e=De();e&&be(e)}if(He=!1,!u&&x&&x.length>0){u=!0;let t=b,n=x.filter(e=>Je(e)&&!S?.has(e.uuid)),r=t>0&&n.length>t?n.slice(-t):n;r.length<n.length&&(D(`[bridge:repl] Capped initial flush: ${n.length} -> ${r.length} (cap=${t})`),M(`tengu_bridge_repl_history_capped`,{eligible_count:n.length,capped_count:r.length}));let i=_(r);if(i.length>0){D(`[bridge:repl] Flushing ${i.length} initial message(s) via transport`);let t=i.map(e=>({...e,session_id:L})),n=e.droppedBatchCount;e.writeBatch(t).then(()=>{if(e.droppedBatchCount>n){D(`[bridge:repl] Initial flush dropped ${e.droppedBatchCount-n} batch(es) — not marking ${i.length} UUID(s) as flushed`);return}if(S)for(let e of i)e.uuid&&S.add(e.uuid)}).catch(e=>D(`[bridge:repl] Initial flush failed: ${e}`)).finally(()=>{H===e&&(Oe(),E?.(`connected`))})}else Oe(),E?.(`connected`)}else Y.active||E?.(`connected`)}}),e.setOnData(e=>{try{let t=JSON.parse(e);B(`ingress: type=${t.type}${t.type===`control_request`?` subtype=${t.request?.subtype} request_id=${t.request_id}`:``}${t.type===`control_response`?` subtype=${t.response?.subtype} request_id=${t.response?.request_id}`:``}${t.type===`user`?` uuid=${t.uuid}`:``}${t.type===`keep_alive`?``:` len=${e.length}`}`)}catch{B(`ingress (non-JSON): ${String(e).slice(0,200)}`)}Qe(e,z,ye,ne,re,l)}),$=Ie,e.setOnClose(t=>{H===e&&(B(`transport onClose: code=${t} connected=${e.isConnectedStatus()} state=${e.getStateLabel()} seq=${e.getLastSequenceNum()}`),Ie(t))}),!u&&x&&x.length>0&&Y.start(),e.connect()};if(U++,o){let t=Le(c,e),n=U;D(`[bridge:repl] CCR v2: sessionUrl=${t} session=${e} gen=${n}`),nt({sessionUrl:t,ingressToken:r,sessionId:e,initialSequenceNum:W}).then(e=>{if(V.signal.aborted){e.close();return}if(n!==U){D(`[bridge:repl] CCR v2: discarding stale handshake gen=${n} current=${U}`),e.close();return}f(e)},e=>{D(`[bridge:repl] CCR v2: createV2ReplTransport failed: ${O(e)}`,{level:`error`}),M(`tengu_bridge_repl_ccr_v2_init_failed`,{}),n===U&&(G&&(N.stopWork(F,G,!1).catch(e=>{D(`[bridge:repl] stopWork after v2 init failure: ${O(e)}`)}),G=null,q=null),J())})}else{let t=Fe(d,e);D(`[bridge:repl] Ingress URL: ${t}`),D(`[bridge:repl] Creating HybridTransport: session=${e}`);let n=s??``;f(tt(new et(new URL(t),{Authorization:`Bearer ${n}`,"anthropic-version":`2023-06-01`},e,()=>({Authorization:`Bearer ${De()??n}`,"anthropic-version":`2023-06-01`}),{maxConsecutiveFailures:50,isBridge:!0,onBatchDropped:()=>{E?.(`reconnecting`,`Lost sync with Remote Control — events could not be delivered`),J()}})))}}});let ze=le?setInterval(()=>{Q||A(n,{sessionId:L,environmentId:F,source:`repl`})},60*6e4):null;ze?.unref?.();let Be=v().session_keepalive_interval_v2_ms,Ve=Be>0?setInterval(()=>{H&&(D(`[bridge:repl] keep_alive sent`),H.write({type:`keep_alive`}).catch(e=>{D(`[bridge:repl] keep_alive write failed: ${O(e)}`)}))},Be):null;Ve?.unref?.();let He=!1;ke=async()=>{if(He){D(`[bridge:repl] Teardown already in progress, skipping duplicate call env=${F} session=${L}`);return}He=!0;let e=Date.now();if(D(`[bridge:repl] Teardown starting: env=${F} session=${L} workId=${G??`none`} transportState=${H?.getStateLabel()??`null`}`),ze!==null&&clearInterval(ze),Ve!==null&&clearInterval(Ve),Re&&process.off(`SIGUSR2`,Re),process.env.USER_TYPE===`ant`&&(y(),$=null),V.abort(),D(`[bridge:repl] Teardown: poll loop aborted`),H){let e=H.getLastSequenceNum();e>W&&(W=e)}if(le){H=null,Y.drop(),await A(n,{sessionId:L,environmentId:F,source:`repl`}),D(`[bridge:repl] Teardown (perpetual): leaving env=${F} session=${L} alive on server, duration=${Date.now()-e}ms`);return}let t=H;if(H=null,Y.drop(),t){let e={...Ze(L),session_id:L};t.write(e)}let r=G?N.stopWork(F,G,!0).then(()=>{D(`[bridge:repl] Teardown: stopWork completed`)}).catch(e=>{D(`[bridge:repl] Teardown stopWork failed: ${O(e)}`)}):Promise.resolve();await Promise.all([r,h(L)]),t?.close(),D(`[bridge:repl] Teardown: transport closed`),await N.deregisterEnvironment(F).catch(e=>{D(`[bridge:repl] Teardown deregister failed: ${O(e)}`)}),await fe(n),D(`[bridge:repl] Teardown complete: env=${F} duration=${Date.now()-e}ms`)};let Ue=se(()=>ke?.());return D(`[bridge:repl] Ready: env=${F} session=${L}`),E?.(`ready`),{get bridgeSessionId(){return L},get environmentId(){return F},getSSESequenceNum(){let e=H?.getLastSequenceNum()??0;return Math.max(W,e)},sessionIngressUrl:d,writeMessages(e){let t=e.filter(e=>Je(e)&&!R.has(e.uuid)&&!z.has(e.uuid));if(t.length===0)return;if(!X)for(let e of t){let t=Xe(e);if(t!==void 0&&ce?.(t,L)){X=!0;break}}if(Y.enqueue(...t)){D(`[bridge:repl] Queued ${t.length} message(s) during initial flush`);return}if(!H){let e=t.map(e=>e.type).join(`,`);D(`[bridge:repl] Transport not configured, dropping ${t.length} message(s) [${e}] for session=${L}`,{level:`warn`});return}for(let e of t)z.add(e.uuid);D(`[bridge:repl] Sending ${t.length} message(s) via transport`);let n=_(t).map(e=>({...e,session_id:L}));H.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!z.has(e.uuid));if(t.length===0)return;if(!H){D(`[bridge:repl] Transport not configured, dropping ${t.length} SDK message(s) for session=${L}`,{level:`warn`});return}for(let e of t)e.uuid&&z.add(e.uuid);let n=t.map(e=>({...e,session_id:L}));H.writeBatch(n)},sendControlRequest(e){if(!H){D(`[bridge:repl] Transport not configured, skipping control_request`);return}let t={...e,session_id:L};H.write(t),D(`[bridge:repl] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(!H){D(`[bridge:repl] Transport not configured, skipping control_response`);return}let t={...e,session_id:L};H.write(t),D(`[bridge:repl] Sent control_response`)},sendControlCancelRequest(e){if(!H){D(`[bridge:repl] Transport not configured, skipping control_cancel_request`);return}let t={type:`control_cancel_request`,request_id:e,session_id:L};H.write(t),D(`[bridge:repl] Sent control_cancel_request request_id=${e}`)},sendResult(){if(!H){D(`[bridge:repl] sendResult: skipping, transport not configured session=${L}`);return}H.reportState(`idle`);let e={...Ze(L),session_id:L};H.write(e),D(`[bridge:repl] Sent result for session=${L}`)},async teardown(){Ue(),await ke?.(),D(`[bridge:repl] Torn down`),M(`tengu_bridge_repl_teardown`,{})}}}async function dt({api:e,getCredentials:t,signal:n,onStateChange:r,onWorkReceived:i,onEnvironmentLost:a,getWsState:o,isAtCapacity:c,capacitySignal:l,onFatalError:u,getPollIntervalConfig:d=()=>je,getHeartbeatInfo:p,onHeartbeatFatal:m}){D(`[bridge:repl] Starting work poll loop for env=${t().environmentId}`);let h=0,g=null,_=null,v=0,y=!1;for(;!n.aborted;){let{environmentId:b,environmentSecret:x}=t(),S=d();try{let t=await e.pollForWork(b,x,n,S.reclaim_older_than_ms);if(v=0,h>0&&(D(`[bridge:repl] Poll recovered after ${h} consecutive error(s)`),h=0,g=null,_=null,r?.(`ready`)),!t){let t=y;if(y=!1,c?.()&&l&&!t){let t=S.poll_interval_ms_at_capacity;if(S.non_exclusive_heartbeat_interval_ms>0&&p){M(`tengu_bridge_heartbeat_mode_entered`,{heartbeat_interval_ms:S.non_exclusive_heartbeat_interval_ms});let r=t>0?Date.now()+t:null,i=!1,a=0;for(;!n.aborted&&c()&&(r===null||Date.now()<r);){let t=d();if(t.non_exclusive_heartbeat_interval_ms<=0)break;let n=p();if(!n)break;let r=l();try{await e.heartbeatWork(n.environmentId,n.workId,n.sessionToken)}catch(e){if(D(`[bridge:repl:heartbeat] Failed: ${O(e)}`),e instanceof s){r.cleanup(),M(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),m?(m(e),D(`[bridge:repl:heartbeat] Fatal (status=${e.status}), work state cleared — fast-polling for re-dispatch`)):i=!0;break}}a++,await R(t.non_exclusive_heartbeat_interval_ms,r.signal),r.cleanup()}let o=i?`error`:n.aborted?`shutdown`:c()?r!==null&&Date.now()>=r?`poll_due`:`config_disabled`:`capacity_changed`;if(M(`tengu_bridge_heartbeat_mode_exited`,{reason:o,heartbeat_cycles:a}),!i){o===`poll_due`&&D(`[bridge:repl] Heartbeat poll_due after ${a} cycles — falling through to pollForWork`);continue}}let r=t>0?t:S.non_exclusive_heartbeat_interval_ms;if(r>0){let e=l(),t=Date.now();await R(r,e.signal),e.cleanup();let n=Date.now()-t-r;n>6e4&&(D(`[bridge:repl] At-capacity sleep overran by ${Math.round(n/1e3)}s — process suspension detected, forcing one fast-poll cycle`),M(`tengu_bridge_repl_suspension_detected`,{overrun_ms:n}),y=!0)}}else await R(S.poll_interval_ms_not_at_capacity,n);continue}let a;try{a=Ie(t.secret)}catch(n){D(`[bridge:repl] Failed to decode work secret: ${O(n)}`),M(`tengu_bridge_repl_work_secret_failed`,{}),await e.stopWork(b,t.id,!1).catch(()=>{});continue}D(`[bridge:repl] Acknowledging workId=${t.id}`);try{await e.acknowledgeWork(b,t.id,a.session_ingress_token)}catch(e){D(`[bridge:repl] Acknowledge failed workId=${t.id}: ${O(e)}`)}if(t.data.type===`healthcheck`){D(`[bridge:repl] Healthcheck received`);continue}if(t.data.type===`session`){let e=t.data.id;try{f(e,`session_id`)}catch{D(`[bridge:repl] Invalid session_id in work: ${e}`);continue}i(e,a.session_ingress_token,t.id,a.use_code_sessions===!0),D(`[bridge:repl] Work accepted, continuing poll loop`)}}catch(i){if(n.aborted)break;if(i instanceof s&&i.status===404&&a){let e=t().environmentId;if(b!==e){D(`[bridge:repl] Stale poll error for old env=${b}, current env=${e} — skipping onEnvironmentLost`),h=0,g=null;continue}if(v++,D(`[bridge:repl] Environment deleted, attempting re-registration (attempt ${v}/3)`),M(`tengu_bridge_repl_env_lost`,{attempt:v}),v>3){D(`[bridge:repl] Environment re-registration limit reached (3), giving up`),r?.(`failed`,`Environment deleted and re-registration limit reached`),u?.();break}r?.(`reconnecting`,`environment lost, recreating session`);let i=await a();if(n.aborted)break;if(i){h=0,g=null,r?.(`ready`),D(`[bridge:repl] Re-registered environment: ${i.environmentId}`);continue}r?.(`failed`,`Environment deleted and re-registration failed`),u?.();break}if(i instanceof s){let e=ee(i.errorType),t=te(i);D(`[bridge:repl] Fatal poll error: ${i.message} (status=${i.status}, type=${i.errorType??`unknown`})${t?` (suppressed)`:``}`),M(`tengu_bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),k(e?`info`:`error`,`bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),t||r?.(`failed`,e?`session expired · /remote-control to reconnect`:i.message),u?.();break}let c=Date.now();_!==null&&c-_>6e4*2&&(D(`[bridge:repl] Detected system sleep (${Math.round((c-_)/1e3)}s gap), resetting poll error budget`),k(`info`,`bridge_repl_poll_sleep_detected`,{gapMs:c-_}),h=0,g=null),_=c,h++,g===null&&(g=c);let l=c-g,f=H(i),m=G(i),y=o?.()??`unknown`;if(D(`[bridge:repl] Poll error (attempt ${h}, elapsed ${Math.round(l/1e3)}s, ws=${y}): ${m}`),M(`tengu_bridge_repl_poll_error`,{status:f,consecutiveErrors:h,elapsedMs:l}),h===1&&r?.(`reconnecting`,m),l>=9e5){D(`[bridge:repl] Poll failures exceeded ${ct/1e3}s (${h} errors), giving up`),k(`info`,`bridge_repl_poll_give_up`),M(`tengu_bridge_repl_poll_give_up`,{consecutiveErrors:h,elapsedMs:l,lastStatus:f}),r?.(`failed`,`connection to server lost`);break}let x=Math.min(ot*2**(h-1),st);if(d().non_exclusive_heartbeat_interval_ms>0){let t=p?.();if(t)try{await e.heartbeatWork(t.environmentId,t.workId,t.sessionToken)}catch{}}await R(x,n)}}D(`[bridge:repl] Work poll loop ended (aborted=${n.aborted}) env=${t().environmentId}`)}oe(),ae(),W(),U();async function ft(t){let{onInboundMessage:n,onPermissionResponse:r,onInterrupt:i,onSetModel:s,onSetMaxThinkingTokens:l,onSetPermissionMode:u,onStateChange:d,initialMessages:f,getMessages:p,previouslyFlushedUUIDs:m,initialName:h,perpetual:ee,outboundOnly:g,tags:te}=t??{};if(q(Q),!await Z())return K(`not_enabled`,`[bridge:repl] Skipping: bridge not enabled`),null;if(!X())return K(`no_oauth`,`[bridge:repl] Skipping: no OAuth tokens`),d?.(`failed`,`/login`),null;if(await ne(),!b(`allow_remote_control`))return K(`policy_denied`,`[bridge:repl] Skipping: allow_remote_control policy not allowed`),d?.(`failed`,`disabled by your organization's policy`),null;if(!J()){let e=le();if(e.bridgeOauthDeadExpiresAt!=null&&(e.bridgeOauthDeadFailCount??0)>=3&&I()?.expiresAt===e.bridgeOauthDeadExpiresAt)return D(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${e.bridgeOauthDeadFailCount} times)`),null;await _e();let t=I();if(t&&t.expiresAt!==null&&t.expiresAt<=Date.now()){K(`oauth_expired_unrefreshable`,`[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)`),d?.(`failed`,`/login`);let e=t.expiresAt;return ce(t=>({...t,bridgeOauthDeadExpiresAt:e,bridgeOauthDeadFailCount:t.bridgeOauthDeadExpiresAt===e?(t.bridgeOauthDeadFailCount??0)+1:1})),null}}let y=we(),S=`remote-control-${v()}`,C=!1,re=!1;if(h)S=h,C=!0,re=!0;else{let e=a(),t=e?ie(e):void 0;if(t)S=t,C=!0,re=!0;else if(f&&f.length>0)for(let e=f.length-1;e>=0;e--){let t=f[e];if(t.type!==`user`||t.isMeta||t.toolUseResult||t.isCompactSummary||t.origin&&t.origin.kind!==`human`||x(t))continue;let n=_(t.message.content);if(!n)continue;let r=mt(n);if(r){S=r,C=!0;break}}}let w=0,T,ae=0,oe=(e,t,n)=>{C=!0,S=e,D(`[bridge:repl] derived title from message ${n}: ${e}`),Re(t,e,{baseUrl:y,getAccessToken:X}).catch(()=>{})},E=(e,t)=>{let n=++ae,r=w;Ge(e,AbortSignal.timeout(15e3)).then(e=>{e&&n===ae&&T===t&&!ie(a())&&oe(e,t,r)})},se=(e,t)=>{if(re||ie(a()))return!0;if(T!==void 0&&T!==t&&(w=0),T=t,w++,w===1&&!C){let n=mt(e);n&&oe(n,t,w),E(e,t)}else if(w===3){let n=p?.(),r=n?qe(c(n)):e;E(r,t)}return w>=3},ue=Y()?`self-hosted`:await N();if(!ue)return K(`no_org_uuid`,`[bridge:repl] Skipping: no org UUID`),d?.(`failed`,`/login`),null;if(Ee()&&!ee){let e=await He();if(e)return K(`version_too_old`,`[bridge:repl] Skipping: ${e}`,!0),d?.(`failed`,"run `claude update` to upgrade"),null;D(`[bridge:repl] Using env-less bridge path (tengu_bridge_repl_v2)`);let{initEnvLessBridgeCore:t}=await import(`./remoteBridgeCore-CmwkjiTK.js`);return t({baseUrl:y,orgUUID:ue,title:S,getAccessToken:X,onAuth401:P,toSDKMessages:We,initialHistoryCap:200,initialMessages:f,onInboundMessage:n,onUserMessage:se,onPermissionResponse:r,onInterrupt:i,onSetModel:s,onSetMaxThinkingTokens:l,onSetPermissionMode:u,onStateChange:d,outboundOnly:g,tags:te})}let k=De();if(k)return K(`version_too_old`,`[bridge:repl] Skipping: ${k}`),d?.(`failed`,"run `claude update` to upgrade"),null;let de=await A(),fe=await pe(),me=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||y,j=`claude_code`;{let{isAssistantMode:t}=(Oe(),e(ke));t()&&(j=`claude_code_assistant`)}return ut({dir:o(),machineName:it(),branch:de,gitRepoUrl:fe,title:S,baseUrl:y,sessionIngressUrl:me,workerType:j,getAccessToken:X,createSession:e=>ze({...e,events:[],baseUrl:y,getAccessToken:X}),archiveSession:e=>Be(e,{baseUrl:y,getAccessToken:X,timeoutMs:1500}).catch(e=>{D(`[bridge:repl] archiveBridgeSession threw: ${O(e)}`,{level:`error`})}),getCurrentTitle:()=>ie(a())??S,onUserMessage:se,toSDKMessages:We,onAuth401:P,getPollIntervalConfig:Me,initialHistoryCap:200,initialMessages:f,previouslyFlushedUUIDs:m,onInboundMessage:n,onPermissionResponse:r,onInterrupt:i,onSetModel:s,onSetMaxThinkingTokens:l,onSetPermissionMode:u,onStateChange:d,perpetual:ee})}var pt=50;function mt(e){let t=me(e),n=(/^(.*?[.!?])\s/.exec(t)?.[1]??t).replace(/\s+/g,` `).trim();if(n)return n.length>pt?n.slice(0,pt-1)+`…`:n}export{ft as initReplBridge};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,kn as i,s as a,t as o}from"./src-CDCSSo0U2.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{U as c,l,p as u,z as d}from"./debug-DiuXEmUq.js";import{Jt as f,Zt as p,g as m,n as h,y as g}from"./settings-BhvhCpVh.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{a as y,n as b,r as x,s as S,t as C}from"./nativeInstaller-DKe1pWoL.js";import{join as w}from"node:path";import{homedir as T}from"node:os";var E=e(r(),1);_(),o(),l(),p(),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||h()?.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 Claude. 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`)&&(g(`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:d(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:`Install Work Mate native build`,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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{D as e,E as t,U as n,l as r,p as i,z as a}from"./debug-DiuXEmUq.js";import{M as o,j as s}from"./git-Cgc8X5l2.js";import{n as c,r as l}from"./analytics-BotDBGh0.js";c(),r(),s(),n(),t();function u(e){if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n>0?`${t}m ${n}s`:`${t}m`}function d(t){let n=(t.startsWith(`sk-ant-si-`)?t.slice(10):t).split(`.`);if(n.length!==3||!n[1])return null;try{return e(Buffer.from(n[1],`base64url`).toString(`utf8`))}catch{return null}}function f(e){let t=d(e);return typeof t==`object`&&t&&`exp`in t&&typeof t.exp==`number`?t.exp:null}var p=300*1e3,m=1800*1e3,h=3,g=6e4;function _({getAccessToken:e,onRefresh:t,label:n,refreshBufferMs:r=p}){let s=new Map,c=new Map,d=new Map;function _(e){let t=(d.get(e)??0)+1;return d.set(e,t),t}function v(e,t){let a=f(t);if(!a){i(`[${n}:token] Could not decode JWT expiry for sessionId=${e}, token prefix=${t.slice(0,15)}…, keeping existing timer`);return}let o=s.get(e);o&&clearTimeout(o);let c=_(e),l=new Date(a*1e3).toISOString(),d=a*1e3-Date.now()-r;if(d<=0){i(`[${n}:token] Token for sessionId=${e} expires=${l} (past or within buffer), refreshing immediately`),b(e,c);return}i(`[${n}:token] Scheduled token refresh for sessionId=${e} in ${u(d)} (expires=${l}, buffer=${r/1e3}s)`);let p=setTimeout(b,d,e,c);s.set(e,p)}function y(e,t){let a=s.get(e);a&&clearTimeout(a);let o=_(e),c=Math.max(t*1e3-r,3e4);i(`[${n}:token] Scheduled token refresh for sessionId=${e} in ${u(c)} (expires_in=${t}s, buffer=${r/1e3}s)`);let l=setTimeout(b,c,e,o);s.set(e,l)}async function b(r,f){let p;try{p=await e()}catch(e){i(`[${n}:token] getAccessToken threw for sessionId=${r}: ${a(e)}`,{level:`error`})}if(d.get(r)!==f){i(`[${n}:token] doRefresh for sessionId=${r} stale (gen ${f} vs ${d.get(r)}), skipping`);return}if(!p){let e=(c.get(r)??0)+1;if(c.set(r,e),i(`[${n}:token] No OAuth token available for refresh, sessionId=${r} (failure ${e}/${h})`,{level:`error`}),o(`error`,`bridge_token_refresh_no_oauth`),e<h){let e=setTimeout(b,g,r,f);s.set(r,e)}return}c.delete(r),i(`[${n}:token] Refreshing token for sessionId=${r}: new token prefix=${p.slice(0,15)}…`),l(`tengu_bridge_token_refreshed`,{}),t(r,p);let _=setTimeout(b,m,r,f);s.set(r,_),i(`[${n}:token] Scheduled follow-up refresh for sessionId=${r} in ${u(m)}`)}function x(e){_(e);let t=s.get(e);t&&(clearTimeout(t),s.delete(e)),c.delete(e)}function S(){for(let e of d.keys())_(e);for(let e of s.values())clearTimeout(e);s.clear(),c.clear()}return{schedule:v,scheduleFromExpiresIn:y,cancel:x,cancelAll:S}}export{f as n,_ as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Xx as t,Yx as n,Zx as r,aS as i,eS as a,iS as o,nS as s,rS as c}from"./loadAgentsDir-ZQwvbURI.js";import{B as l,E as u,O as d,U as f}from"./debug-DiuXEmUq.js";import{r as p,t as m}from"./promptEditor-D6HzjcMS.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(a.map(e=>c(e.key)));return e.map(e=>{let n={};for(let[r,i]of Object.entries(e.bindings))t.has(c(r))||(n[r]=i);return{context:e.context,bindings:n}}).filter(e=>Object.keys(e.bindings).length>0)}function y(){return d({$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.claude.com/docs/en/keybindings`,bindings:v(o)},null,2)+`
|
|
2
|
-
`}var b=e((()=>{u(),i(),s()}));async function x(){if(!r())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=n(),t=!1;await g(h(e),{recursive:!0});try{await _(e,y(),{encoding:`utf-8`,flag:`wx`})}catch(e){if(l(e)===`EEXIST`)t=!0;else throw e}let i=await m(e);return i.error?{type:`text`,value:`${t?`Opened`:`Created`} ${e}. Could not open in editor: ${i.error}`}:{type:`text`,value:t?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{t(),b(),f(),p()}))();export{x as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./language-8Rnu_qxl.js";e();export{t as getResolvedLanguage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";function t(e){let t;return()=>t??(t=e())}var n=e((()=>{}));export{t as n,n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./loadAgentsDir-ZQwvbURI.js";e();export{t as clearAgentDefinitionsCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{vy as e,xy as t,yy as n}from"./loadAgentsDir-ZQwvbURI.js";e();export{n as loadPluginHooks,t as setupPluginHookHotReload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,o as n,t as r}from"./localSearch-H0LchlTi.js";n();export{r as clearSkillIndexCache,e as getSkillIndex,t as searchSkills};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./p-map-HKDr3iDo.js";import{D as r,H as i,I as a,P as o,T as s,fi as c,j as ee,kn as l,t as u,y as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{B_ as p,ES as m,F_ as h,Fb as te,G_ as g,H_ as _,Hb as v,Ib as y,Jy as b,M_ as x,OS as S,U_ as ne,Vb as re,Y_ as C,Yy as ie,a_ as ae,ag as oe,b_ as w,cS as se,dg as T,e_ as E,j_ as D,lS as O,lg as k,n_ as A,r_ as j,s_ as M,t_ as N,x_ as P}from"./loadAgentsDir-ZQwvbURI.js";import{K as F,U as I}from"./debug-DiuXEmUq.js";import{c as L,g as R,o as z,y as B}from"./config-662VDD70.js";import{n as V,o as H}from"./process-gEbdy6uY.js";import{i as U,o as W}from"./platform-B5dCGT8t.js";import{s as ce,u as G}from"./types-Cnorfsss.js";import{n as le,r as K}from"./analytics-BotDBGh0.js";import{l as q,o as ue}from"./stringUtils-D_g2L6A4.js";import{n as J,t as Y}from"./exit-BOhGfSlm.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";n();var X=e(c(),1);S(),V(),u(),g(),ue(),v(),y();var Z=f();function pe({servers:e,scope:t,onDone:n}){let c=Object.keys(e),[l,u]=(0,X.useState)({});(0,X.useEffect)(()=>{p().then(({servers:e})=>u(e))},[]);let f=c.filter(e=>l[e]!==void 0);async function g(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(l[e]!==void 0){let t=1;for(;l[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await h(e,n,t),r++}}v(r)}let[_]=i(),v=(0,X.useCallback)(e=>{H(e>0?`\n${ee(`success`,_)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),n(),m()},[_,t,n]),y=(0,X.useCallback)(()=>{v(0)},[v]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(d,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${c.length} MCP ${q(c.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:y,hideInputGuide:!0,children:[f.length>0&&(0,Z.jsx)(o,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(o,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(te,{options:c.map(e=>({label:`${e}${f.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:c.filter(e=>!f.includes(e)),onSubmit:g,onCancel:y,hideIndexes:!0})]}),(0,Z.jsx)(a,{paddingX:1,children:(0,Z.jsx)(o,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(s,{children:[(0,Z.jsx)(r,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(r,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(re,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}u(),ie(),le(),j(),T(),g(),x(),O(),R(),I(),S(),ce(),W();async function Q(e,t){try{let n=await oe(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw F(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-CEnNEK6Z.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-ghioDl7W.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let n=_(e),r=()=>{n&&(n.type===`sse`||n.type===`http`)&&(N(e,n),E(e,n))};try{if(t.scope){let n=P(t.scope);K(`tengu_mcp_delete`,{name:e,scope:n}),await C(e,n),r(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${w(n)}`)}let n=z(),i=L(),{servers:a}=ne(`project`),o=!!a[e],s=[];if(n.mcpServers?.[e]&&s.push(`local`),o&&s.push(`project`),i.mcpServers?.[e]&&s.push(`user`),s.length===0)Y(`No MCP server found with name: "${e}"`);else if(s.length===1){let t=s[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await C(e,t),r(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${w(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),s.forEach(e=>{process.stderr.write(` - ${D(e)} (${w(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),s.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await p();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let n=await t(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:k()});for(let{name:e,server:t,status:r}of n)if(t.type===`sse`)console.log(`${e}: ${t.url} (SSE) - ${r}`);else if(t.type===`http`)console.log(`${e}: ${t.url} (HTTP) - ${r}`);else if(t.type===`claudeai-proxy`)console.log(`${e}: ${t.url} - ${r}`);else if(!t.type||t.type===`stdio`){let n=t,i=Array.isArray(n.args)?n.args:[];console.log(`${e}: ${n.command} ${i.join(` `)} - ${r}`)}}await m(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=_(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${D(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),A(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),A(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await m(0)}async function _e(e,t,n){try{let r=P(n.scope),i=G(t),a=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await ae():void 0;await h(e,i,r);let o=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;a&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&M(e,{type:i.type,url:i.url},a),K(`tengu_mcp_add`,{scope:r,source:`json`,type:o}),J(`Added ${o} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=P(e.scope);K(`tengu_mcp_add`,{scope:t,platform:U(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-9xfIgkzE.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:i}=await l((0,Z.jsx)(se,{children:(0,Z.jsx)(b,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Work Mate.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,Gt as a,H as o,I as s,Lt as c,P as l,T as u,Wt as d,fi as f,j as p,t as m,y as h}from"./src-CDCSSo0U2.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{$g as _,$y as v,D_ as y,Hb as b,M_ as x,Mb as S,Nb as C,Qg as w,Vb as T,b_ as E,dS as D,i_ as O,k_ as k,lS as A,r_ as j,tb as ee,uS as M}from"./loadAgentsDir-ZQwvbURI.js";import{l as te,u as ne}from"./debug-DiuXEmUq.js";import{l as re,n as ie,o as ae}from"./stringUtils-D_g2L6A4.js";import{D as oe,O as se}from"./rcDebugLog-CivJaJ3V.js";import{u as ce}from"./referral-Cu9bEOFE.js";import{i as le,n as N,r as ue}from"./MCPConnectionManager-BLfKm4H2.js";import{n as de,t as fe}from"./McpParsingWarnings-8ZueNqAd.js";import{a as pe,c as P,i as F,l as me,n as he,o as I,r as ge,s as _e,t as ve,u as L}from"./PluginSettings-0FSNch8O.js";function ye({agentServer:e,onCancel:t,onComplete:n}){let[a]=o(),[f,m]=(0,R.useState)(!1),[g,_]=(0,R.useState)(null),[y,b]=(0,R.useState)(null),x=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>x.current?.abort(),[]),d(`confirm:no`,(0,R.useCallback)(()=>{f&&(x.current?.abort(),x.current=null,m(!1),b(null))},[f]),{context:`Confirmation`,isActive:f});let S=(0,R.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;m(!0),_(null);let t=new AbortController;x.current=t;try{let r={type:e.transport,url:e.url};await O(e.name,r,b,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof w)&&_(e.message)}finally{m(!1),x.current=null}},[e,n]),E=ie(String(e.name));if(f)return(0,z.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,z.jsxs)(l,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(v,{}),(0,z.jsx)(l,{children:` A browser window will open for authentication`})]}),y&&(0,z.jsxs)(s,{flexDirection:`column`,children:[(0,z.jsx)(l,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,z.jsx)(c,{url:y})]}),(0,z.jsx)(s,{marginLeft:3,children:(0,z.jsxs)(l,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,z.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let D=[];return e.needsAuth&&D.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),D.push({label:`Back`,value:`back`}),(0,z.jsxs)(h,{title:`${E} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,z.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):(0,z.jsxs)(u,{children:[(0,z.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,z.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,z.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,z.jsxs)(s,{flexDirection:`column`,gap:0,children:[(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Type: `}),(0,z.jsx)(l,{dimColor:!0,children:e.transport})]}),e.url&&(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`URL: `}),(0,z.jsx)(l,{dimColor:!0,children:e.url})]}),e.command&&(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Command: `}),(0,z.jsx)(l,{dimColor:!0,children:e.command})]}),(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Used by: `}),(0,z.jsx)(l,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,z.jsxs)(s,{marginTop:1,children:[(0,z.jsx)(l,{bold:!0,children:`Status: `}),(0,z.jsxs)(l,{children:[p(`inactive`,a)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,z.jsxs)(s,{children:[(0,z.jsx)(l,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,z.jsxs)(l,{children:[p(`success`,a)(r.tick),` authenticated`]}):(0,z.jsxs)(l,{children:[p(`warning`,a)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,z.jsx)(s,{children:(0,z.jsx)(l,{dimColor:!0,children:`This server connects only when running the agent.`})}),g&&(0,z.jsx)(s,{children:(0,z.jsxs)(l,{color:`error`,children:[`Error: `,g]})}),(0,z.jsx)(s,{children:(0,z.jsx)(C,{options:D,onChange:async e=>{switch(e){case`auth`:await S();break;case`back`:t();break}},onCancel:t})})]})}var R,z,B=e((()=>{n(),R=t(f(),1),m(),ce(),j(),ae(),b(),S(),ee(),z=g()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:E(e)};case`user`:return{label:`User MCPs`,path:E(e)};case`local`:return{label:`Local MCPs`,path:E(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function be(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function xe({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:d,onComplete:f}){let[m]=o(),[g,_]=(0,H.useState)(0),v=H.useMemo(()=>be(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),y=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),b=H.useMemo(()=>(v.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[v]),x=V(`dynamic`),S=H.useMemo(()=>{let e=[];for(let t of W){let n=v.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of y)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of b)e.push({type:`server`,server:t});return e},[v,y,t,b]),C=(0,H.useCallback)(()=>{f(`MCP dialog dismissed`,{display:`system`})},[f]);a({"confirm:previous":()=>_(e=>e===0?S.length-1:e-1),"confirm:next":()=>_(e=>e===S.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=S[g];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&d&&d(e.agentServer))},[S,g,n,d]),"confirm:no":C},{context:`Confirmation`});let w=e=>S.findIndex(t=>t.type===`server`&&t.server===e),E=e=>S.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),D=ne(),O=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let k=e=>{let t=w(e),n=g===t,i=``,a=``;if(e.client.type===`disabled`)i=p(`inactive`,m)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=p(`success`,m)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=p(`inactive`,m)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=p(`warning`,m)(r.triangleUpOutline),a=`needs authentication`):(i=p(`error`,m)(r.cross),a=`failed`);return(0,U.jsxs)(s,{children:[(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(l,{dimColor:!n,children:a})]},`${e.name}-${t}`)},A=e=>{let t=E(e),n=g===t,i=e.needsAuth?p(`warning`,m)(r.triangleUpOutline):p(`inactive`,m)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(s,{children:[(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(l,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(l,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(l,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},j=e.length+t.length;return(0,U.jsxs)(s,{flexDirection:`column`,children:[(0,U.jsx)(fe,{}),(0,U.jsx)(h,{title:`Manage MCP servers`,subtitle:`${j} ${re(j,`server`)}`,onCancel:C,hideInputGuide:!0,children:(0,U.jsxs)(s,{flexDirection:`column`,children:[W.map(e=>{let t=v.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(s,{paddingLeft:2,children:[(0,U.jsx)(l,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(l,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>k(e))]},e)}),y.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(s,{paddingLeft:2,children:(0,U.jsx)(l,{bold:!0,children:`claude.ai`})}),y.map(e=>k(e))]}),t.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(s,{paddingLeft:2,children:(0,U.jsx)(l,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(s,{paddingLeft:2,children:(0,U.jsxs)(l,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>A(e))]},e))]}),b.length>0&&(0,U.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(s,{paddingLeft:2,children:[(0,U.jsx)(l,{bold:!0,children:x.label}),x.path&&(0,U.jsxs)(l,{dimColor:!0,children:[` (`,x.path,`)`]})]}),b.map(e=>k(e))]}),(0,U.jsxs)(s,{flexDirection:`column`,children:[O&&(0,U.jsx)(l,{dimColor:!0,children:D?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(l,{dimColor:!0,children:[(0,U.jsx)(c,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(s,{paddingX:1,children:(0,U.jsx)(l,{dimColor:!0,italic:!0,children:(0,U.jsxs)(u,{children:[(0,U.jsx)(i,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(f(),1),m(),ce(),x(),te(),ae(),b(),de(),U=g(),W=[`project`,`local`,`user`,`enterprise`]}));function Se({serverName:e,onComplete:t}){let[n]=o(),i=D(),a=ue(),[c,u]=(0,K.useState)(!0),[d,f]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){f(`MCP server "${e}" not found`),u(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:u(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:f(`${e} requires authentication`),u(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:f(`Failed to reconnect to ${e}`),u(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);f(n),u(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),c?(0,q.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(l,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(l,{bold:!0,children:e})]}),(0,q.jsxs)(s,{children:[(0,q.jsx)(v,{}),(0,q.jsx)(l,{children:` Establishing connection to MCP server`})]})]}):d?(0,q.jsxs)(s,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(s,{children:[(0,q.jsxs)(l,{children:[p(`error`,n)(r.cross),` `]}),(0,q.jsxs)(l,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(l,{dimColor:!0,children:[`Error: `,d]})]}):null}var K,q,J=e((()=>{n(),K=t(f(),1),m(),N(),A(),ee(),q=g()}));function Y({onComplete:e}){let t=M(e=>e.mcp),n=M(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>y(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;if(r||i){let n=await new _(e.name,e.config).tokens(),r=oe()!==null&&e.type===`connected`,i=e.type===`connected`&&k(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.claude.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(xe,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=k(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(0,Z.jsx)(_e,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(me,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(ge,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=k(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(pe,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(ye,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,Ce=e((()=>{X=t(f(),1),j(),x(),A(),se(),B(),G(),L(),P(),I(),F(),Z=g()})),we=e((()=>{B(),G(),J(),L(),Ce(),P(),I(),F()}));function Te({action:e,target:t,onComplete:n}){let r=M(e=>e.mcp.clients),i=le(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function Ee(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(Se,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Te,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return process.env.USER_TYPE===`ant`?(0,$.jsx)(ve,{onComplete:e,args:`manage`,showMcpRedirectMessage:!0}):(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(f(),1),we(),J(),N(),A(),he(),$=g()}))();export{Ee as call};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{G as e,Gp as t,Ia as n,La as r,Rd as i,TC as a,W as o,Wp as s,Xu as c,Yu as l,aw as u,iw as d,nl as f,po as p,tl as m,wC as h,zd as g,zo as _}from"./loadAgentsDir-ZQwvbURI.js";import{E as v,O as y}from"./debug-DiuXEmUq.js";import{o as b,s as x}from"./log-Duzb4o6h.js";import{_ as S,u as C}from"./model-BgrLt7P7.js";import{Cn as w,Sn as T,xn as E}from"./prompt-wys9CwDo.js";import{a as D,o as O}from"./fileStateCache-DDW5toIs.js";import{I as k,K as A,f as j}from"./stdio-W_Kokrkh.js";import{n as M,t as N}from"./stdio-4S7b8Uhx.js";A(),a(),n(),w(),c(),u(),O(),b(),_(),S(),e(),s(),v(),g(),m();var P=[r];async function F(e,n,r){let a=D(100);t(e);let s=new M({name:`claude/tengu`,version:`0.0.2`},{capabilities:{tools:{}}});s.setRequestHandler(k,async()=>{let e=T(),t=l(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=f(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:f(n.inputSchema),outputSchema:r}}))}}),s.setRequestHandler(j,async({params:{name:e,arguments:t}})=>{let s=l(T()),c=E(s,e);if(!c)throw Error(`Tool ${e} not found`);let u={abortController:d(),options:{commands:P,tools:s,mainLoopModel:C(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:n,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>h(),setAppState:()=>{},messages:[],readFileState:a,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await c.validateInput?.(t??{},u);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${`message`in n?n.message:String(n)}`);let r=await c.call(t??{},u,o,p({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:y(r.data)}]}}catch(e){return x(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?i(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
-
`).trim()||`Error`}]}}});async function c(){let e=new N;await s.connect(e)}return await c()}export{F as startMCPServer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,o as i}from"./envUtils-DSxRz_kt.js";import{C as a,H as o,R as s,en as c,ht as l,rt as u}from"./state-ix0xIunV.js";import{E as d,O as f,U as p,l as ee}from"./debug-DiuXEmUq.js";import{Jt as m,Xt as h,Zt as g,qt as te}from"./settings-BhvhCpVh.js";import{_ as ne,m as re}from"./git-Cgc8X5l2.js";import{r as ie,t as ae}from"./execFileNoThrow-DResQRvR.js";import{a as _,n as oe,o as se,r as v}from"./platform-B5dCGT8t.js";import{It as y,Kt as ce,Mn as le,Vt as ue,_ as de,jn as b,u as x}from"./model-BgrLt7P7.js";import{i as fe,t as pe}from"./genericProcessUtils-DO7Fy0RJ.js";import{extname as me}from"path";import{stat as he}from"fs/promises";import{AsyncLocalStorage as ge}from"async_hooks";function _e(){return process.platform===`linux`&&r(process.env.CLAUDE_CODE_BUBBLEWRAP)}function ve(){return process.platform===`linux`?T??!1:!1}async function S(){if(E!==void 0)return E;if(process.platform===`darwin`)return E=null,null;try{let e=await pe(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of te)if(e.includes(t))return E=t,t}}catch{}return E=null,null}async function ye(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&m.platform!==`darwin`?await S()||`pycharm`:m.terminal}function be(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&m.platform!==`darwin`?E===void 0?`pycharm`:E||`pycharm`:m.terminal}async function C(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await S()}var w,T,E,D,O=e((()=>{n(),g(),i(),ie(),fe(),w=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await ae(`test`,[`-f`,`/.dockerenv`]);return e===0}),T=null,process.platform===`linux`&&he(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{T=!0},()=>{T=!1}),D={...m,terminal:be(),getIsDocker:w,getIsBubblewrapSandbox:_e,isMuslEnvironment:ve,getTerminalWithJetBrainsDetectionAsync:ye,initJetBrainsDetection:C}}));function k(e){return A?.has(e)??!1}var A,j=e((()=>{ee(),p()}));function M(){return P.getStore()}function N(e,t){return P.run(e,t)}function xe(e){return e?.agentType===`subagent`}function Se(){let e=M();if(!(!xe(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function Ce(){let e=M();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var P,F=e((()=>{P=new ge}));function we(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function I(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function Te(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&k(t))}function Ee(e,t,n){let r=L(e);return!r||!B.has(r.serverName)&&!Te(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function L(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function De(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function R(e,t=0){if(typeof e==`string`)return e.length>V?`${e.slice(0,H)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=G)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,W).map(e=>R(e,t+1));return e.length>W&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,W).map(([e,n])=>[e,R(n,t+1)]);return n.length>W&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function Oe(e){if(!I())return;let t=f(R(e));return t.length>U&&(t=t.slice(0,U)+`…[truncated]`),t}function z(e){let t=me(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>K?`other`:n}function ke(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=z(t);e&&(r.add(e),n=e)}for(let t of e.split(J)){if(!t)continue;let e=t.split(Y);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(q.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=z(i);a&&!r.has(a)&&(r.add(a),n=n?n+`,`+a:a)}}if(n)return n}function Ae(){let e=M();if(e)return{agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};let t=process.env.CLAUDE_CODE_AGENT_ID,n=process.env.CLAUDE_CODE_PARENT_SESSION_ID,r=t?`standalone`:void 0;if(t||r||n)return{...t?{agentId:t}:{},...r?{agentType:r}:{},...n?{parentSessionId:n}:{}};let i=u();return i?{parentSessionId:i}:{}}function je(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(Q&&$){let e=n-$;e>0&&(r=(t.user-Q.user+(t.system-Q.system))/(e*1e3)*100)}return Q=t,$=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function Me(e={}){let t=e.model?String(e.model):x(),n=typeof e.betas==`string`?e.betas:b(t).join(`,`),[r,i]=await Promise.all([Z(),re()]),c=je();return{model:t,sessionId:l(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(s()),clientType:a(),...c&&{processMetrics:c},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...Ae(),...y()&&{subscriptionType:y()},...o()?{kairosActive:!0}:{},...i&&{rh:i}}}function Ne(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,kairosActive:o,skillMode:s,observerMode:c,...l}=e,u={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(u.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(u.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(u.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(u.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(u.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(u.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(u.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(u.github_action_ref=r.githubActionRef),r.wslVersion&&(u.wsl_version=r.wslVersion),r.linuxDistroId&&(u.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(u.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(u.linux_kernel=r.linuxKernel),r.vcs&&(u.vcs=r.vcs),r.versionBase&&(u.version_base=r.versionBase);let d={session_id:l.sessionId,model:l.model,user_type:l.userType,is_interactive:l.isInteractive===`true`,client_type:l.clientType};if(l.betas&&(d.betas=l.betas),l.entrypoint&&(d.entrypoint=l.entrypoint),l.agentSdkVersion&&(d.agent_sdk_version=l.agentSdkVersion),l.sweBenchRunId&&(d.swe_bench_run_id=l.sweBenchRunId),l.sweBenchInstanceId&&(d.swe_bench_instance_id=l.sweBenchInstanceId),l.sweBenchTaskId&&(d.swe_bench_task_id=l.sweBenchTaskId),l.agentId&&(d.agent_id=l.agentId),l.parentSessionId&&(d.parent_session_id=l.parentSessionId),l.agentType&&(d.agent_type=l.agentType),t.githubActionsMetadata){let e=t.githubActionsMetadata;u.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let p;return(t.accountUuid||t.organizationUuid)&&(p={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:u,...i&&{process:Buffer.from(f(i)).toString(`base64`)},...p&&{auth:p},core:d,additional:{...a&&{rh:a},...o&&{is_assistant_mode:!0},...s&&{skill_mode:s},...c&&{observer_mode:c},...n}}}var B,V,H,U,W,G,K,q,J,Y,X,Z,Q,$,Pe=e((()=>{n(),g(),O(),le(),de(),c(),i(),j(),ue(),ne(),se(),F(),d(),B=new Set,V=512,H=128,U=4*1024,W=20,G=2,K=10,q=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),J=/\s*(?:&&|\|\||[;|])\s*/,Y=/\s+/,X=t(()=>{let e=`0.0.2`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),Z=t(async()=>{let[e,t,n,i]=await Promise.all([m.getPackageManagers(),m.getRuntimes(),v(),oe()]);return{platform:h(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:m.arch,nodeVersion:m.nodeVersion,terminal:D.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:m.isRunningWithBun(),isCi:r(process.env.CI),isClaubbit:r(process.env.CLAUBBIT),isClaudeCodeRemote:r(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:m.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:r(process.env.GITHUB_ACTIONS),isClaudeCodeAction:r(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:ce(),version:`0.0.2`,versionBase:X(),buildTime:`2026-07-12T15:42:48.748Z`,deploymentEnvironment:m.detectDeploymentEnvironment(),...r(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},..._()&&{wslVersion:_()},...n??{},...i.length>0?{vcs:i.join(`,`)}:{}}}),Q=null,$=null}));export{D as _,z as a,I as c,Ne as d,Ce as f,N as g,F as h,Me as i,Ee as l,Se as m,De as n,ke as o,M as p,Oe as r,Pe as s,L as t,we as u,C as v,O as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./memoize-BK3gG5ob.js";import{d as a,i as o,l as s,n as c,o as l,s as u,t as d}from"./envUtils-DSxRz_kt.js";import{n as ee,t as te}from"./defineProperty-C-QyHrDq.js";import{n as f,t as p}from"./axios-DaWTGg7G.js";import{di as ne,ui as re}from"./src-CDCSSo0U2.js";import{A as ie,C as ae,p as oe,t as se,w as ce}from"./v4-jw6qOKwQ.js";import{$ as le,H as ue,Jr as de,On as fe,Sr as pe,X as me,Xn as he,Yr as ge,_n as _e,en as m,ht as ve,pt as ye,qn as be,sn as xe,tt as Se,xr as Ce,y as we,z as h}from"./state-ix0xIunV.js";import{A as Te,B as Ee,D as De,E as Oe,G as ke,O as Ae,U as je,X as Me,Y as Ne,_ as Pe,d as Fe,f as Ie,h as Le,l as g,p as _,z as v}from"./debug-DiuXEmUq.js";import{Kt as Re,c as y,f as b,g as ze,n as Be,y as Ve}from"./settings-BhvhCpVh.js";import{C as He,b as x,c as S,g as Ue,n as C,w as We}from"./config-662VDD70.js";import{a as Ge,c as Ke,i as qe,o as Je,r as Ye,s as Xe,t as Ze}from"./execFileNoThrow-DResQRvR.js";import{d as Qe,f as $e,o as et,s as w}from"./log-Duzb4o6h.js";import{r as tt,t as nt}from"./memoize-DgMjqLtn.js";import{s as rt,u as it}from"./types-Cnorfsss.js";import{n as at,r as T}from"./analytics-BotDBGh0.js";import{n as ot,t as st}from"./lazySchema-uxlVVNM1.js";import{l as E,n as ct,r as lt,s as ut,t as dt,u as D}from"./oauth-BqJqV-2M.js";import{n as ft,t as pt}from"./bundledMode--fG1S62b.js";import{n as mt,o as ht}from"./stringUtils-D_g2L6A4.js";import{a as gt,i as _t,l as vt}from"./proxy-CHnxhNZI.js";import{userInfo as yt}from"os";import{join as bt}from"path";import{chmodSync as xt,mkdirSync as St,readFileSync as Ct,writeFileSync as wt}from"fs";import{createHash as Tt,randomUUID as Et}from"crypto";import{mkdir as Dt,stat as Ot,writeFile as kt}from"fs/promises";import{exec as At,execFile as jt}from"child_process";import{AsyncLocalStorage as Mt}from"async_hooks";function Nt(){return process.env.USER_TYPE,null}function Pt(){return process.env.USER_TYPE===`ant`?Nt()?.antModels??[]:[]}function Ft(e){if(process.env.USER_TYPE!==`ant`||e===void 0)return;let t=e.toLowerCase();return Pt().find(n=>n.alias===e||t.includes(n.model.toLowerCase()))}var It=e((()=>{}));function Lt(e){let t=[],n=!1;async function r(){if(!n&&t.length!==0){for(n=!0;t.length>0;){let{args:n,resolve:r,reject:i,context:a}=t.shift();try{r(await e.apply(a,n))}catch(e){i(e)}}n=!1,t.length>0&&r()}}return function(...e){return new Promise((n,i)=>{t.push({args:e,resolve:n,reject:i,context:this}),r()})}}var Rt=e((()=>{}));function zt(e,t){return e.find(e=>e.includes(t))??null}async function Bt(){let{BedrockClient:e}=await import(`./dist-es-yHGBqhBe.js`),t=d(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await _t(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await W();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}async function Vt(){let{BedrockRuntimeClient:e}=await import(`./dist-es-Gt_DpXlP.js`),t=d(),n=s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),r={region:t,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await _t(),...n&&{requestHandler:new(await(import(`./dist-es-C7vygWzp.js`))).NodeHttpHandler,httpAuthSchemes:[{schemeId:`smithy.api#noAuth`,identityProvider:()=>async()=>({}),signer:new(await(import(`./dist-es-gUzZ_7Vf.js`))).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:`smithy.api#noAuth`}]}};if(!n&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let e=await W();e&&(r.credentials={accessKeyId:e.accessKeyId,secretAccessKey:e.secretAccessKey,sessionToken:e.sessionToken})}return new e(r)}function Ht(e){return e.startsWith(`anthropic.`)}function Ut(e){if(!e.startsWith(`arn:`))return e;let t=e.lastIndexOf(`/`);return t===-1?e:e.substring(t+1)}function Wt(e){let t=Ut(e);for(let e of Jt)if(t.startsWith(`${e}.anthropic.`))return e}function Gt(e,t){let n=Wt(e);return n?e.replace(`${n}.`,`${t}.`):Ht(e)?`${t}.${e}`:e}var Kt,qt,Jt,Yt=e((()=>{i(),K(),l(),et(),vt(),Kt=r(async function(){let[e,{ListInferenceProfilesCommand:t}]=await Promise.all([Bt(),import(`./dist-es-yHGBqhBe.js`)]),n=[],r;try{do{let i=new t({...r&&{nextToken:r},typeEquals:`SYSTEM_DEFINED`}),a=await e.send(i);a.inferenceProfileSummaries&&n.push(...a.inferenceProfileSummaries),r=a.nextToken}while(r);return n.filter(e=>e.inferenceProfileId?.includes(`anthropic`)).map(e=>e.inferenceProfileId).filter(Boolean)}catch(e){throw w(e),e}}),qt=r(async function(e){try{let[t,{GetInferenceProfileCommand:n}]=await Promise.all([Bt(),import(`./dist-es-yHGBqhBe.js`)]),r=new n({inferenceProfileIdentifier:e}),i=await t.send(r);if(!i.models||i.models.length===0)return null;let a=i.models[0];if(!a?.modelArn)return null;let o=a.modelArn.lastIndexOf(`/`);return o>=0?a.modelArn.substring(o+1):a.modelArn}catch(e){return w(e),null}}),Jt=[`us`,`eu`,`apac`,`global`]})),Xt,Zt,Qt,$t,en,tn,nn,rn,an,on,sn,cn,ln,un,dn=e((()=>{Xt={firstParty:`claude-3-7-sonnet-20250219`,bedrock:`us.anthropic.claude-3-7-sonnet-20250219-v1:0`,vertex:`claude-3-7-sonnet@20250219`,foundry:`claude-3-7-sonnet`,openai:`claude-3-7-sonnet-20250219`,gemini:`claude-3-7-sonnet-20250219`,grok:`claude-3-7-sonnet-20250219`},Zt={firstParty:`claude-3-5-sonnet-20241022`,bedrock:`anthropic.claude-3-5-sonnet-20241022-v2:0`,vertex:`claude-3-5-sonnet-v2@20241022`,foundry:`claude-3-5-sonnet`,openai:`claude-3-5-sonnet-20241022`,gemini:`claude-3-5-sonnet-20241022`,grok:`claude-3-5-sonnet-20241022`},Qt={firstParty:`claude-3-5-haiku-20241022`,bedrock:`us.anthropic.claude-3-5-haiku-20241022-v1:0`,vertex:`claude-3-5-haiku@20241022`,foundry:`claude-3-5-haiku`,openai:`claude-3-5-haiku-20241022`,gemini:`claude-3-5-haiku-20241022`,grok:`claude-3-5-haiku-20241022`},$t={firstParty:`claude-haiku-4-5-20251001`,bedrock:`us.anthropic.claude-haiku-4-5-20251001-v1:0`,vertex:`claude-haiku-4-5@20251001`,foundry:`claude-haiku-4-5`,openai:`claude-haiku-4-5-20251001`,gemini:`claude-haiku-4-5-20251001`,grok:`claude-haiku-4-5-20251001`},en={firstParty:`claude-sonnet-4-20250514`,bedrock:`us.anthropic.claude-sonnet-4-20250514-v1:0`,vertex:`claude-sonnet-4@20250514`,foundry:`claude-sonnet-4`,openai:`claude-sonnet-4-20250514`,gemini:`claude-sonnet-4-20250514`,grok:`claude-sonnet-4-20250514`},tn={firstParty:`claude-sonnet-4-5-20250929`,bedrock:`us.anthropic.claude-sonnet-4-5-20250929-v1:0`,vertex:`claude-sonnet-4-5@20250929`,foundry:`claude-sonnet-4-5`,openai:`claude-sonnet-4-5-20250929`,gemini:`claude-sonnet-4-5-20250929`,grok:`claude-sonnet-4-5-20250929`},nn={firstParty:`claude-opus-4-20250514`,bedrock:`us.anthropic.claude-opus-4-20250514-v1:0`,vertex:`claude-opus-4@20250514`,foundry:`claude-opus-4`,openai:`claude-opus-4-20250514`,gemini:`claude-opus-4-20250514`,grok:`claude-opus-4-20250514`},rn={firstParty:`claude-opus-4-1-20250805`,bedrock:`us.anthropic.claude-opus-4-1-20250805-v1:0`,vertex:`claude-opus-4-1@20250805`,foundry:`claude-opus-4-1`,openai:`claude-opus-4-1-20250805`,gemini:`claude-opus-4-1-20250805`,grok:`claude-opus-4-1-20250805`},an={firstParty:`claude-opus-4-5-20251101`,bedrock:`us.anthropic.claude-opus-4-5-20251101-v1:0`,vertex:`claude-opus-4-5@20251101`,foundry:`claude-opus-4-5`,openai:`claude-opus-4-5-20251101`,gemini:`claude-opus-4-5-20251101`,grok:`claude-opus-4-5-20251101`},on={firstParty:`claude-opus-4-6`,bedrock:`us.anthropic.claude-opus-4-6-v1`,vertex:`claude-opus-4-6`,foundry:`claude-opus-4-6`,openai:`claude-opus-4-6`,gemini:`claude-opus-4-6`,grok:`claude-opus-4-6`},sn={firstParty:`claude-opus-4-7`,bedrock:`us.anthropic.claude-opus-4-7-v1`,vertex:`claude-opus-4-7`,foundry:`claude-opus-4-7`,openai:`claude-opus-4-7`,gemini:`claude-opus-4-7`,grok:`claude-opus-4-7`},cn={firstParty:`claude-sonnet-4-6`,bedrock:`us.anthropic.claude-sonnet-4-6`,vertex:`claude-sonnet-4-6`,foundry:`claude-sonnet-4-6`,openai:`claude-sonnet-4-6`,gemini:`claude-sonnet-4-6`,grok:`claude-sonnet-4-6`},ln={haiku35:Qt,haiku45:$t,sonnet35:Zt,sonnet37:Xt,sonnet40:en,sonnet45:tn,sonnet46:cn,opus40:nn,opus41:rn,opus45:an,opus46:on,opus47:sn},Object.values(ln).map(e=>e.firstParty),un=Object.fromEntries(Object.entries(ln).map(([e,t])=>[t.firstParty,e]))}));function O(e=Be()){let t=e.modelType;return t===`openai`?`openai`:t===`gemini`?`gemini`:t===`grok`?`grok`:s(process.env.CLAUDE_CODE_USE_BEDROCK)?`bedrock`:s(process.env.CLAUDE_CODE_USE_VERTEX)?`vertex`:s(process.env.CLAUDE_CODE_USE_FOUNDRY)?`foundry`:s(process.env.CLAUDE_CODE_USE_OPENAI)?`openai`:s(process.env.CLAUDE_CODE_USE_GEMINI)?`gemini`:s(process.env.CLAUDE_CODE_USE_GROK)?`grok`:`firstParty`}function fn(){return O()}function pn(){let e=process.env.ANTHROPIC_BASE_URL;if(!e)return!0;try{let t=new URL(e).host,n=[`api.anthropic.com`];return process.env.USER_TYPE===`ant`&&n.push(`api-staging.anthropic.com`),n.includes(t)}catch{return!1}}var k=e((()=>{ze(),l()}));function mn(e){let t={};for(let n of bn)t[n]=ln[n][e];return t}async function hn(){let e=mn(`bedrock`),t;try{t=await Kt()}catch(t){return w(t),e}if(!t?.length)return e;let n={};for(let r of bn){let i=ln[r].firstParty;n[r]=zt(t,i)||e[r]}return n}function gn(e){let t=Be().modelOverrides;if(!t)return e;let n={...e};for(let[e,r]of Object.entries(t)){let t=un[e];t&&r&&(n[t]=r)}return n}function _n(e){let t;try{t=Be().modelOverrides}catch{return e}if(!t)return e;for(let[n,r]of Object.entries(t))if(r===e)return n;return e}function vn(){if(le()===null){if(O()!==`bedrock`){be(mn(O()));return}xn()}}function A(){let e=le();return e===null?(vn(),gn(mn(O()))):gn(e)}async function yn(){if(le()===null){if(O()!==`bedrock`){be(mn(O()));return}await xn()}}var bn,xn,Sn=e((()=>{m(),et(),Rt(),ze(),Yt(),dn(),k(),bn=Object.keys(ln),xn=Lt(async()=>{if(le()===null)try{be(await hn())}catch(e){w(e)}})}));function Cn(){if(s(process.env.DISABLE_COST_WARNINGS)||B())return!1;let e=Ma(),t=R()!==null;if(!e.hasToken&&!t)return!1;let n=S(),r=n.oauthAccount?.organizationRole,i=n.oauthAccount?.workspaceRole;return!r||!i?!1:[`admin`,`billing`].includes(r)||[`workspace_admin`,`workspace_billing`].includes(i)}function wn(e){En=e}function Tn(){if(En!==null)return En;if(!B())return!1;let e=V();if(e===`max`||e===`pro`)return!0;let t=S().oauthAccount?.organizationRole;return!!t&&[`admin`,`billing`,`owner`,`primary_owner`].includes(t)}var En,Dn=e((()=>{K(),Ue(),l(),En=null}));function On(){return process.env.USER_TYPE===`ant`?process.env.CLAUDE_MOCK_HEADERLESS_429?process.env.CLAUDE_MOCK_HEADERLESS_429:j?Rn:null:null}function kn(){return!j||process.env.USER_TYPE!==`ant`||Object.keys(Ln).length===0?null:Ln}function An(){Ln={},Hn=[],zn=null,Bn=null,M=null,Rn=null,wn(null),j=!1}function jn(e){let t=kn();if(!t)return e;let n=new globalThis.Headers(e);return Object.entries(t).forEach(([e,t])=>{t!==void 0&&n.set(e,t)}),n}function Mn(){return process.env.USER_TYPE===`ant`?j||!!process.env.CLAUDE_MOCK_HEADERLESS_429:!1}function Nn(){return!j||process.env.USER_TYPE!==`ant`?null:zn||Vn}function Pn(){return j&&zn!==null&&process.env.USER_TYPE===`ant`}function Fn(){return Bn!==null}function In(e){if(Bn===null||!e)return null;if(M!==null&&Date.now()>=M)return An(),null;M===null&&(M=Date.now()+Bn);let t=M-Date.now(),n={...Ln};return n[`retry-after`]=String(Math.max(1,Math.ceil(t/1e3))),n}var Ln,j,Rn,zn,Bn,M,Vn,Hn,Un=e((()=>{Dn(),Ln={},j=!1,Rn=null,zn=null,Bn=null,M=null,Vn=`max`}));async function Wn(){let e=S().oauthAccount?.accountUuid,t=R();if(!e||!t)return;let n=`${E().BASE_API_URL}/api/claude_cli_profile`;try{return(await f.get(n,{headers:{"x-api-key":t,"anthropic-beta":ut},params:{account_uuid:e},timeout:1e4})).data}catch(e){w(e)}}async function Gn(e){let t=`${E().BASE_API_URL}/api/oauth/profile`;try{return(await f.get(t,{headers:{Authorization:`Bearer ${e}`,"Content-Type":`application/json`},timeout:1e4})).data}catch(e){w(e)}}var Kn=e((()=>{p(),D(),K(),Ue(),et()}));function qn(e){return!!e?.includes(ct)}function Jn(e){return e?.split(` `).filter(Boolean)??[]}function Yn({codeChallenge:e,state:t,port:n,isManual:r,loginWithClaudeAi:i,inferenceOnly:a,orgUUID:o,loginHint:s,loginMethod:c}){let l=i?E().CLAUDE_AI_AUTHORIZE_URL:E().CONSOLE_AUTHORIZE_URL,u=new URL(l);u.searchParams.append(`code`,`true`),u.searchParams.append(`client_id`,E().CLIENT_ID),u.searchParams.append(`response_type`,`code`),u.searchParams.append(`redirect_uri`,r?E().MANUAL_REDIRECT_URL:`http://localhost:${n}/callback`);let d=a?[ct]:dt;return u.searchParams.append(`scope`,d.join(` `)),u.searchParams.append(`code_challenge`,e),u.searchParams.append(`code_challenge_method`,`S256`),u.searchParams.append(`state`,t),o&&u.searchParams.append(`orgUUID`,o),s&&u.searchParams.append(`login_hint`,s),c&&u.searchParams.append(`login_method`,c),u.toString()}async function Xn(e,t,n,r,i=!1,a){let o={grant_type:`authorization_code`,code:e,redirect_uri:i?E().MANUAL_REDIRECT_URL:`http://localhost:${r}/callback`,client_id:E().CLIENT_ID,code_verifier:n,state:t};a!==void 0&&(o.expires_in=a);let s=await f.post(E().TOKEN_URL,o,{headers:{"Content-Type":`application/json`},timeout:15e3});if(s.status!==200)throw Error(s.status===401?`Authentication failed: Invalid authorization code`:`Token exchange failed (${s.status}): ${s.statusText}`);return T(`tengu_oauth_token_exchange_success`,{}),s.data}async function Zn(e,{scopes:t}={}){let n={grant_type:`refresh_token`,refresh_token:e,client_id:E().CLIENT_ID,scope:(t?.length?t:lt).join(` `)};try{let t=await f.post(E().TOKEN_URL,n,{headers:{"Content-Type":`application/json`},timeout:15e3});if(t.status!==200)throw Error(`Token refresh failed: ${t.statusText}`);let r=t.data,{access_token:i,refresh_token:a=e,expires_in:o}=r,s=Date.now()+o*1e3,c=Jn(r.scope);T(`tengu_oauth_token_refresh_success`,{});let l=S(),u=G(),d=l.oauthAccount?.billingType!==void 0&&l.oauthAccount?.accountCreatedAt!==void 0&&l.oauthAccount?.subscriptionCreatedAt!==void 0&&u?.subscriptionType!=null&&u?.rateLimitTier!=null?null:await tr(i);if(d&&l.oauthAccount){let e={};d.displayName!==void 0&&(e.displayName=d.displayName),typeof d.hasExtraUsageEnabled==`boolean`&&(e.hasExtraUsageEnabled=d.hasExtraUsageEnabled),d.billingType!==null&&(e.billingType=d.billingType),d.accountCreatedAt!==void 0&&(e.accountCreatedAt=d.accountCreatedAt),d.subscriptionCreatedAt!==void 0&&(e.subscriptionCreatedAt=d.subscriptionCreatedAt),Object.keys(e).length>0&&x(t=>({...t,oauthAccount:t.oauthAccount?{...t.oauthAccount,...e}:t.oauthAccount}))}return{accessToken:i,refreshToken:a,expiresAt:s,scopes:c,subscriptionType:d?.subscriptionType??u?.subscriptionType??null,rateLimitTier:d?.rateLimitTier??u?.rateLimitTier??null,profile:d?.rawProfile,tokenAccount:r.account?{uuid:r.account.uuid,emailAddress:r.account.email_address,organizationUuid:r.organization?.uuid}:void 0}}catch(e){let t=f.isAxiosError(e)&&e.response?.data?JSON.stringify(e.response.data):void 0;throw T(`tengu_oauth_token_refresh_failure`,{error:e.message,...t&&{responseBody:t}}),e}}async function Qn(e){let t=await f.get(E().ROLES_URL,{headers:{Authorization:`Bearer ${e}`}});if(t.status!==200)throw Error(`Failed to fetch user roles: ${t.statusText}`);let n=t.data;if(!S().oauthAccount)throw Error(`OAuth account information not found in config`);x(e=>({...e,oauthAccount:e.oauthAccount?{...e.oauthAccount,organizationRole:n.organization_role,workspaceRole:n.workspace_role,organizationName:n.organization_name}:e.oauthAccount})),T(`tengu_oauth_roles_stored`,{org_role:n.organization_role})}async function $n(e){try{let t=await f.post(E().API_KEY_URL,null,{headers:{Authorization:`Bearer ${e}`}}),n=t.data?.raw_key;return n?(await so(n),T(`tengu_oauth_api_key`,{status:`success`,statusCode:t.status}),n):null}catch(e){throw T(`tengu_oauth_api_key`,{status:`failure`,error:e instanceof Error?e.message:String(e)}),e}}function er(e){return e!==null&&Date.now()+300*1e3>=e}async function tr(e){let t=await Gn(e),n=t?.organization?.organization_type,r=null;switch(n){case`claude_max`:r=`max`;break;case`claude_pro`:r=`pro`;break;case`claude_enterprise`:r=`enterprise`;break;case`claude_team`:r=`team`;break;default:r=null;break}let i={subscriptionType:r,rateLimitTier:t?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:t?.organization?.has_extra_usage_enabled??null,billingType:t?.organization?.billing_type??null};return t?.account?.display_name&&(i.displayName=t.account.display_name),t?.account?.created_at&&(i.accountCreatedAt=t.account.created_at),t?.organization?.subscription_created_at&&(i.subscriptionCreatedAt=t.organization.subscription_created_at),T(`tengu_oauth_profile_fetch_success`,{}),{...i,rawProfile:t}}async function nr(){let e=S().oauthAccount?.organizationUuid;if(e)return e;let t=G()?.accessToken;return t===void 0||!bo()?null:(await Gn(t))?.organization?.uuid||null}async function rr(){let e=process.env.CLAUDE_CODE_ACCOUNT_UUID,t=process.env.CLAUDE_CODE_USER_EMAIL,n=process.env.CLAUDE_CODE_ORGANIZATION_UUID,r=!!(e&&t&&n);e&&t&&n&&(S().oauthAccount||ir({accountUuid:e,emailAddress:t,organizationUuid:n})),await vo();let i=S();if(i.oauthAccount&&i.oauthAccount.billingType!==void 0&&i.oauthAccount.accountCreatedAt!==void 0&&i.oauthAccount.subscriptionCreatedAt!==void 0||!B()||!bo())return!1;let a=G();if(a?.accessToken){let e=await Gn(a.accessToken);if(e)return r&&_(`OAuth profile fetch succeeded, overriding env var account info`,{level:`info`}),ir({accountUuid:e.account.uuid,emailAddress:e.account.email,organizationUuid:e.organization.uuid,displayName:e.account.display_name||void 0,hasExtraUsageEnabled:e.organization.has_extra_usage_enabled??!1,billingType:e.organization.billing_type??void 0,accountCreatedAt:e.account.created_at,subscriptionCreatedAt:e.organization.subscription_created_at??void 0}),!0}return!1}function ir({accountUuid:e,emailAddress:t,organizationUuid:n,displayName:r,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s}){let c={accountUuid:e,emailAddress:t,organizationUuid:n,hasExtraUsageEnabled:i,billingType:a,accountCreatedAt:o,subscriptionCreatedAt:s};r&&(c.displayName=r),x(e=>e.oauthAccount?.accountUuid===c.accountUuid&&e.oauthAccount?.emailAddress===c.emailAddress&&e.oauthAccount?.organizationUuid===c.organizationUuid&&e.oauthAccount?.displayName===c.displayName&&e.oauthAccount?.hasExtraUsageEnabled===c.hasExtraUsageEnabled&&e.oauthAccount?.billingType===c.billingType&&e.oauthAccount?.accountCreatedAt===c.accountCreatedAt&&e.oauthAccount?.subscriptionCreatedAt===c.subscriptionCreatedAt?e:{...e,oauthAccount:c})}var ar=e((()=>{p(),at(),D(),K(),Ue(),g(),Kn()}));function or(e,t,n){if(s(process.env.CLAUDE_CODE_REMOTE))try{St(dr,{recursive:!0,mode:448}),wt(e,t,{encoding:`utf8`,mode:384}),_(`Persisted ${n} to ${e} for subprocess access`)}catch(e){_(`Failed to persist ${n} to disk (non-fatal): ${v(e)}`,{level:`error`})}}function sr(e,t){try{let n=Le().readFileSync(e,{encoding:`utf8`}).trim();return n?(_(`Read ${t} from well-known file ${e}`),n):null}catch(n){return ke(n)||_(`Failed to read ${t} from ${e}: ${v(n)}`,{level:`debug`}),null}}function cr({envVar:e,wellKnownPath:t,label:n,getCached:r,setCached:i}){let a=r();if(a!==void 0)return a;let o=process.env[e];if(!o){let e=sr(t,n);return i(e),e}let s=parseInt(o,10);if(Number.isNaN(s))return _(`${e} must be a valid file descriptor number, got: ${o}`,{level:`error`}),i(null),null;try{let e=Le(),r=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${s}`:`/proc/self/fd/${s}`,a=e.readFileSync(r,{encoding:`utf8`}).trim();return a?(_(`Successfully read ${n} from file descriptor ${s}`),i(a),or(t,a,n),a):(_(`File descriptor contained empty ${n}`,{level:`error`}),i(null),null)}catch(e){_(`Failed to read ${n} from file descriptor ${s}: ${v(e)}`,{level:`error`});let r=sr(t,n);return i(r),r}}function lr(){return cr({envVar:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,wellKnownPath:fr,label:`OAuth token`,getCached:Se,setCached:he})}function ur(){return cr({envVar:`CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR`,wellKnownPath:pr,label:`API key`,getCached:we,setCached:_e})}var dr,fr,pr,mr,hr=e((()=>{m(),g(),l(),je(),Pe(),dr=`/home/claude/.claude/remote`,fr=`${dr}/.oauth_token`,pr=`${dr}/.api_key`,mr=`${dr}/.session_ingress_token`}));function N(e=``){let t=c(),n=process.env.CLAUDE_CONFIG_DIR?`-${Tt(`sha256`).update(t).digest(`hex`).substring(0,8)}`:``;return`Claude Code${E().OAUTH_FILE_SUFFIX}${e}${n}`}function gr(){try{return process.env.USER||yt().username}catch{return`claude-code-user`}}function P(){F.cache={data:null,cachedAt:0},F.generation++,F.readInFlight=null}function _r(e){if(F.cache.cachedAt!==0)return;let t=null;if(e)try{t=JSON.parse(e)}catch{return}F.cache={data:t,cachedAt:Date.now()}}var vr,F,yr=e((()=>{D(),l(),vr=`-credentials`,F={cache:{data:null,cachedAt:0},generation:0,readInFlight:null}}));async function br(){if(process.platform===`darwin`&&(await Je(`security delete-generic-password -a $USER -s "${N()}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error(`Failed to delete keychain entry`)}function xr(e){return e.slice(-20)}var Sr=e((()=>{Ke(),yr()}));function Cr(e){return e?.name===`CredentialsProviderError`}function wr(e){if(!e||typeof e!=`object`)return!1;let t=e;if(!t.Credentials||typeof t.Credentials!=`object`)return!1;let n=t.Credentials;return typeof n.AccessKeyId==`string`&&typeof n.SecretAccessKey==`string`&&typeof n.SessionToken==`string`&&n.AccessKeyId.length>0&&n.SecretAccessKey.length>0&&n.SessionToken.length>0}async function Tr(){let{STSClient:e,GetCallerIdentityCommand:t}=await import(`./dist-es-C-OjW2Ao.js`);await new e().send(new t({}))}async function Er(){try{_(`Clearing AWS credential provider cache`);let{fromIni:e}=await import(`./dist-es-CIULjvtA2.js`);await e({ignoreCache:!0})(),_(`AWS credential provider cache refreshed`)}catch{_(`Failed to clear AWS credential cache (this is expected if no credentials are configured)`)}}var Dr=e((()=>{g()})),Or,kr=e((()=>{pe(),ee(),Or=class e{constructor(){te(this,`status`,{isAuthenticating:!1,output:[]}),te(this,`changed`,Ce()),te(this,`subscribe`,this.changed.subscribe)}static getInstance(){return e.instance||(e.instance=new e),e.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(e){this.status.output.push(e),this.changed.emit(this.getStatus())}setError(e){this.status.error=e,this.changed.emit(this.getStatus())}endAuthentication(e){e?this.status={isAuthenticating:!1,output:[]}:this.status.isAuthenticating=!1,this.changed.emit(this.getStatus())}static reset(){e.instance&&(e.instance.changed.clear(),e.instance=null)}},te(Or,`instance`,null)})),Ar,jr,Mr,Nr,Pr,Fr,Ir,Lr,Rr,zr,Br,Vr,Hr,Ur,Wr,Gr,Kr=e((()=>{Ar=`claude-code-20250219`,jr=`interleaved-thinking-2025-05-14`,Mr=`context-1m-2025-08-07`,Nr=`context-management-2025-06-27`,Pr=`structured-outputs-2025-12-15`,Fr=`tool-search-tool-2025-10-19`,Ir=`effort-2025-11-24`,Lr=`task-budgets-2026-03-13`,Rr=`prompt-caching-scope-2026-01-05`,zr=`fast-mode-2026-02-01`,Br=`redact-thinking-2026-02-12`,Vr=`afk-mode-2026-01-31`,Hr=process.env.USER_TYPE===`ant`?`cli-internal-2026-02-09`:``,Ur=`advisor-tool-2026-03-01`,Wr=new Set([jr,Mr,Fr]),Gr=new Set([Ar,jr,Nr])}));function qr(e,t){return de(e,t)}var Jr=e((()=>{ge()}));function Yr(){return`claude-code/0.0.2`}var Xr=e((()=>{}));function Zr(){return $r.getStore()?.workload}function Qr(e,t){return $r.run({workload:e},t)}var $r,ei=e((()=>{$r=new Mt}));function ti(){let e=process.env.CLAUDE_AGENT_SDK_VERSION?`, agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`:``,t=process.env.CLAUDE_AGENT_SDK_CLIENT_APP?`, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`:``,n=Zr(),r=n?`, workload/${n}`:``;return`claude-cli/0.0.2 (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}${e}${t}${r})`}function ni(){let e=[];return process.env.CLAUDE_CODE_ENTRYPOINT&&e.push(process.env.CLAUDE_CODE_ENTRYPOINT),process.env.CLAUDE_AGENT_SDK_VERSION&&e.push(`agent-sdk/${process.env.CLAUDE_AGENT_SDK_VERSION}`),process.env.CLAUDE_AGENT_SDK_CLIENT_APP&&e.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`),`claude-code/0.0.2${e.length>0?` (${e.join(`, `)})`:``}`}function ri(){return`Claude-User (${Yr()}; +https://support.anthropic.com/)`}function ii(){if(B()){let e=G();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":ut}}:{headers:{},error:`No OAuth token available`}}let e=R();return e?{headers:{"x-api-key":e}}:{headers:{},error:`No API key available`}}async function ai(e,t){try{return await e()}catch(n){if(!f.isAxiosError(n))throw n;let r=n.response?.status;if(!(r===401||t?.also403Revoked&&r===403&&typeof n.response?.data==`string`&&n.response.data.includes(`OAuth token has been revoked`)))throw n;let i=G()?.accessToken;if(!i)throw n;return await ho(i),await e()}}var oi=e((()=>{p(),D(),K(),Xr(),ei()}));function si(){return{error:(e,...t)=>console.error(`[Anthropic SDK ERROR]`,e,...t),warn:(e,...t)=>console.error(`[Anthropic SDK WARN]`,e,...t),info:(e,...t)=>console.error(`[Anthropic SDK INFO]`,e,...t),debug:(e,...t)=>console.error(`[Anthropic SDK DEBUG]`,e,...t)}}async function ci({apiKey:e,maxRetries:n,model:r,fetchOverride:i,source:a}){let c=process.env.CLAUDE_CODE_CONTAINER_ID,l=process.env.CLAUDE_CODE_REMOTE_SESSION_ID,u=process.env.CLAUDE_AGENT_SDK_CLIENT_APP,ee=ui(),te={"x-app":`cli`,"User-Agent":ti(),"X-Claude-Code-Session-Id":ve(),...ee,...c?{"x-claude-remote-container-id":c}:{},...l?{"x-claude-remote-session-id":l}:{},...u?{"x-client-app":u}:{},...process.env.ANTHROPIC_AUTH_NONCE?{"x-auth-nonce":process.env.ANTHROPIC_AUTH_NONCE}:{}};_(`[API:request] Creating client, ANTHROPIC_CUSTOM_HEADERS present: ${!!process.env.ANTHROPIC_CUSTOM_HEADERS}, has Authorization header: ${!!ee.Authorization}`),s(process.env.CLAUDE_CODE_ADDITIONAL_PROTECTION)&&(te[`x-anthropic-additional-protection`]=`true`),_(`[API:auth] OAuth token check starting`),await vo(),_(`[API:auth] OAuth token check complete`),B()||await li(te,h());let f=di(i,a),p={defaultHeaders:te,maxRetries:n,timeout:parseInt(process.env.API_TIMEOUT_MS||`600000`,10),dangerouslyAllowBrowser:!0,fetchOptions:gt({forAnthropicAPI:!0}),...f&&{fetch:f}};if(s(process.env.CLAUDE_CODE_USE_BEDROCK)){let{BedrockClient:e}=await import(`./bedrockClient-DxE_mHFI.js`),t=r===hc()&&process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION?process.env.ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION:d(),n={...p,awsRegion:t,...s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&{skipAuth:!0},...Fe()&&{logger:si()}};if(process.env.AWS_BEARER_TOKEN_BEDROCK)n.skipAuth=!0,n.defaultHeaders={...n.defaultHeaders,Authorization:`Bearer ${process.env.AWS_BEARER_TOKEN_BEDROCK}`};else if(!s(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)){let e=await W();e&&(n.awsAccessKey=e.accessKeyId,n.awsSecretKey=e.secretAccessKey,n.awsSessionToken=e.sessionToken)}return new e(n)}if(s(process.env.CLAUDE_CODE_USE_FOUNDRY)){let{AnthropicFoundry:e}=await import(`./foundry-sdk-BdeF2aBu.js`),t;if(!process.env.ANTHROPIC_FOUNDRY_API_KEY)if(s(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH))t=()=>Promise.resolve(``);else{let{DefaultAzureCredential:e,getBearerTokenProvider:n}=await import(`./esm-CGx9qY3q.js`);t=n(new e,`https://cognitiveservices.azure.com/.default`)}return new e({...p,...t&&{azureADTokenProvider:t},...Fe()&&{logger:si()}})}if(s(process.env.CLAUDE_CODE_USE_VERTEX)){s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)||await qo();let[{AnthropicVertex:e},{GoogleAuth:n}]=await Promise.all([import(`./vertex-sdk-DjXcZ2J7.js`),import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1))]),i=process.env.GCLOUD_PROJECT||process.env.GOOGLE_CLOUD_PROJECT||process.env.gcloud_project||process.env.google_cloud_project,a=process.env.GOOGLE_APPLICATION_CREDENTIALS||process.env.google_application_credentials,c=s(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)?{getClient:()=>({getRequestHeaders:()=>({})})}:new n({scopes:[`https://www.googleapis.com/auth/cloud-platform`],...i||a?{}:{projectId:process.env.ANTHROPIC_VERTEX_PROJECT_ID}});return new e({...p,region:o(r),googleAuth:c,...Fe()&&{logger:si()}})}return new Me({apiKey:B()?null:e||R(),authToken:B()?G()?.accessToken:void 0,...process.env.USER_TYPE===`ant`&&s(process.env.USE_STAGING_OAUTH)?{baseURL:E().BASE_API_URL}:{},...p,...Fe()&&{logger:si()}})}async function li(e,t){let n=process.env.ANTHROPIC_AUTH_TOKEN||await Ha(t);n&&(e.Authorization=`Bearer ${n}`)}function ui(){let e={},t=process.env.ANTHROPIC_CUSTOM_HEADERS;if(!t)return e;let n=t.split(/\n|\r\n/);for(let t of n){if(!t.trim())continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n).trim(),i=t.slice(n+1).trim();r&&(e[r]=i)}return e}function di(e,t){let n=e??globalThis.fetch,r=O()===`firstParty`&&pn();return(e,i)=>{let a=new Headers(i?.headers);r&&!a.has(`x-client-request-id`)&&a.set(fi,Et());try{let n=e instanceof Request?e.url:String(e),r=a.get(fi);_(`[API REQUEST] ${new URL(n).pathname}${r?` ${fi}=${r}`:``} source=${t??`unknown`}`)}catch{}return n(e,{...i,headers:a})}}var fi,pi=e((()=>{Ne(),K(),oi(),$(),k(),vt(),m(),D(),g(),l(),fi=`x-client-request-id`}));function mi(){return bt(c(),`cache`)}function hi(){return bt(mi(),`model-capabilities.json`)}function gi(){return!(O()!==`firstParty`||!pn())}function _i(e){return[...e].sort((e,t)=>t.id.length-e.id.length||e.id.localeCompare(t.id))}function vi(e){if(!gi())return;let t=Si(hi());if(!t||t.length===0)return;let n=e.toLowerCase();return t.find(e=>e.id.toLowerCase()===n)||t.find(e=>n.includes(e.id.toLowerCase()))}async function yi(){if(gi()&&!$e())try{let e=await ci({maxRetries:1}),t=B()?[ut]:void 0,n=[];for await(let r of e.models.list({betas:t})){let e=bi().safeParse(r);e.success&&n.push(e.data)}if(n.length===0)return;let r=hi(),i=_i(n);if(qr(Si(r),i)){_(`[modelCapabilities] cache unchanged, skipping write`);return}await Dt(mi(),{recursive:!0}),await kt(r,Ae({models:i,timestamp:Date.now()}),{encoding:`utf-8`,mode:384}),Si.cache.delete(r),_(`[modelCapabilities] cached ${i.length} models`)}catch(e){_(`[modelCapabilities] fetch failed: ${e instanceof Error?e.message:`unknown`}`)}}var bi,xi,Si,Ci=e((()=>{Jr(),i(),se(),D(),pi(),K(),g(),l(),rt(),st(),Qe(),Oe(),k(),bi=ot(()=>ce({id:ie(),max_input_tokens:ae().optional(),max_tokens:ae().optional()}).strip()),xi=ot(()=>ce({models:oe(bi()),timestamp:ae()})),Si=r(e=>{try{let t=Ct(e,`utf-8`),n=xi().safeParse(it(t,!1));return n.success?n.data.models:null}catch{return null}},e=>e)}));function wi(){return s(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function I(e){return!wi()&&/\[1m\]/i.test(e)}function Ti(e){if(wi())return!1;let t=Z(e);return t.includes(`claude-sonnet-4`)||t.includes(`opus-4-6`)||t.includes(`opus-4-7`)}function Ei(e,t){if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS){let e=parseInt(process.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS,10);if(!isNaN(e)&&e>0)return e}if(I(e))return 1e6;let n=vi(e);if(n?.max_input_tokens&&n.max_input_tokens>=1e5)return n.max_input_tokens>2e5&&wi()?ji:n.max_input_tokens;if(t?.includes(`context-1m-2025-08-07`)&&Ti(e)||Di(e))return 1e6;if(process.env.USER_TYPE===`ant`){let t=Ft(e);if(t?.contextWindow)return t.contextWindow}return ji}function Di(e){return wi()||I(e)||!Z(e).includes(`sonnet-4-6`)?!1:S().clientDataCache?.coral_reef_sonnet===`true`}function Oi(e,t){if(!e)return{used:null,remaining:null};let n=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;if(n===0)return{used:null,remaining:null};let r=Math.round(n/t*100),i=Math.min(100,Math.max(0,r));return{used:i,remaining:100-i}}function ki(e){let t,n;if(process.env.USER_TYPE===`ant`){let r=Ft(e.toLowerCase());if(r)return t=r.defaultMaxTokens??Ni,n=r.upperMaxTokensLimit??Pi,{default:t,upperLimit:n}}let r=Z(e);r.includes(`opus-4-7`)||r.includes(`opus-4-6`)?(t=64e3,n=128e3):r.includes(`sonnet-4-6`)?(t=32e3,n=128e3):r.includes(`opus-4-5`)||r.includes(`sonnet-4`)||r.includes(`haiku-4`)?(t=32e3,n=64e3):r.includes(`opus-4-1`)||r.includes(`opus-4`)?(t=32e3,n=32e3):r.includes(`claude-3-opus`)?(t=4096,n=4096):r.includes(`claude-3-sonnet`)?(t=8192,n=8192):r.includes(`claude-3-haiku`)?(t=4096,n=4096):r.includes(`3-5-sonnet`)||r.includes(`3-5-haiku`)?(t=8192,n=8192):r.includes(`3-7-sonnet`)?(t=32e3,n=64e3):(t=Ni,n=Pi);let i=vi(e);return i?.max_tokens&&i.max_tokens>=4096&&(n=i.max_tokens,t=Math.min(t,n)),{default:t,upperLimit:n}}function Ai(e){return ki(e).upperLimit-1}var ji,Mi,Ni,Pi,Fi,Ii=e((()=>{Kr(),Ue(),l(),$(),It(),Ci(),ji=2e5,Mi=2e4,Ni=32e3,Pi=64e3,Fi=8e3})),Li,Ri,zi,Bi=e((()=>{i(),k(),Li=[{modelEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],Ri=[{modelEnvVar:`OPENAI_DEFAULT_OPUS_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_SONNET_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES`},{modelEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL`,capabilitiesEnvVar:`OPENAI_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES`}],zi=r((e,t)=>{if(O()===`firstParty`)return;let n=e.toLowerCase(),r=O()===`openai`?Ri:Li;for(let e of r){let r=process.env[e.modelEnvVar],i=process.env[e.capabilitiesEnvVar];if(!(!r||i===void 0)&&n===r.toLowerCase())return i.toLowerCase().split(`,`).map(e=>e.trim()).includes(t)}},(e,t)=>`${e.toLowerCase()}:${t}`)}));function Vi(e){let t=[],n=[];for(let r of e)Zi.includes(r)?t.push(r):n.push(r);return{allowed:t,disallowed:n}}function Hi(e){if(!e||e.length===0)return;if(B()){console.warn(`Warning: Custom betas are only available for API key users. Ignoring provided betas.`);return}let{allowed:t,disallowed:n}=Vi(e);for(let e of n)console.warn(`Warning: Beta header '${e}' is not allowed. Only the following betas are supported: ${Zi.join(`, `)}`);return t.length>0?t:void 0}function Ui(e){let t=zi(e,`interleaved_thinking`);if(t!==void 0)return t;let n=Z(e),r=O();return r===`foundry`?!0:r===`firstParty`?!n.includes(`claude-3-`):n.includes(`claude-opus-4`)||n.includes(`claude-sonnet-4`)}function Wi(e){let t=Z(e),n=O();return n===`foundry`?!0:n===`firstParty`?!t.includes(`claude-3-`):t.includes(`claude-opus-4`)||t.includes(`claude-sonnet-4`)||t.includes(`claude-haiku-4`)}function Gi(e){let t=Z(e),n=O();return n!==`firstParty`&&n!==`foundry`?!1:t.includes(`claude-sonnet-4-6`)||t.includes(`claude-sonnet-4-5`)||t.includes(`claude-opus-4-1`)||t.includes(`claude-opus-4-5`)||t.includes(`claude-opus-4-6`)||t.includes(`claude-opus-4-7`)||t.includes(`claude-haiku-4-5`)}function Ki(e){return!0}function qi(){return(O()===`firstParty`||O()===`foundry`)&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)&&pn()}function Ji(){return O()===`firstParty`&&!s(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function Yi(e,t){let n=[...$i(e)];t?.isAgenticQuery&&(n.includes(`claude-code-20250219`)||n.push(Ar),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Hr&&!n.includes(Hr)&&n.push(Hr));let r=ye();return!r||r.length===0?n:[...n,...r.filter(e=>!n.includes(e))]}function Xi(){Qi.cache?.clear?.(),$i.cache?.clear?.(),ea.cache?.clear?.()}var Zi,Qi,$i,ea,ta=e((()=>{i(),m(),Kr(),D(),K(),Ii(),l(),$(),Bi(),k(),ze(),Zi=[Mr],Qi=r(e=>{let t=[],n=Z(e).includes(`haiku`);O();let r=qi();n||(t.push(Ar),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT===`cli`&&Hr&&t.push(Hr)),B()&&t.push(ut),I(e)&&t.push(Mr),!s(process.env.DISABLE_INTERLEAVED_THINKING)&&Ui(e)&&t.push(jr),r&&Ui(e)&&!h()&&Be().showThinkingSummaries!==!0&&t.push(Br);let i=s(process.env.USE_API_CONTEXT_MANAGEMENT)||Wi(e),a=Wi(e);return qi()&&(i||a)&&t.push(Nr),r&&Gi(e),process.env.USER_TYPE,r&&t.push(Rr),process.env.ANTHROPIC_BETAS&&t.push(...process.env.ANTHROPIC_BETAS.split(`,`).map(e=>e.trim()).filter(Boolean)),t}),$i=r(e=>{let t=Qi(e);return O()===`bedrock`?t.filter(e=>!Wr.has(e)):t}),ea=r(e=>Qi(e).filter(e=>Wr.has(e)))}));function na(e,t){return{name:`${e.name}-with-${t.name}-fallback`,read(){return e.read()??(t.read()||{})},async readAsync(){return await e.readAsync()??(await t.readAsync()||{})},update(n){let r=e.read(),i=e.update(n);if(i.success)return r===null&&t.delete(),i;let a=t.update(n);return a.success?(r!==null&&e.delete(),{success:!0,warning:a.warning}):{success:!1}},delete(){let n=e.delete(),r=t.delete();return n||r}}}var ra=e((()=>{}));async function ia(){try{let e=N(vr),{stdout:t,code:n}=await Ze(`security`,[`find-generic-password`,`-a`,gr(),`-w`,`-s`,e],{useCwd:!1,preserveOutputOnError:!1});if(n===0&&t)return De(t.trim())}catch{}return null}function aa(){if(ca!==void 0)return ca;if(process.platform!==`darwin`)return ca=!1,!1;try{ca=Xe(`security`,[`show-keychain-info`],{reject:!1,stdio:[`ignore`,`pipe`,`pipe`]}).exitCode===36}catch{ca=!1}return ca}var oa,sa,ca,la=e((()=>{Ke(),g(),Ye(),Ge(),Oe(),yr(),oa=4032,sa={name:`keychain`,read(){let e=F.cache;if(Date.now()-e.cachedAt<3e4)return e.data;try{let e=N(vr),t=qe(`security find-generic-password -a "${gr()}" -w -s "${e}"`);if(t){let e=De(t);return F.cache={data:e,cachedAt:Date.now()},e}}catch{}return e.data===null?(F.cache={data:null,cachedAt:Date.now()},null):(_(`[keychain] read failed; serving stale cache`,{level:`warn`}),F.cache={data:e.data,cachedAt:Date.now()},e.data)},async readAsync(){let e=F.cache;if(Date.now()-e.cachedAt<3e4)return e.data;if(F.readInFlight)return F.readInFlight;let t=F.generation,n=ia().then(n=>{if(t===F.generation){n===null&&e.data!==null&&_(`[keychain] readAsync failed; serving stale cache`,{level:`warn`});let t=n??e.data;return F.cache={data:t,cachedAt:Date.now()},F.readInFlight=null,t}return n});return F.readInFlight=n,n},update(e){P();try{let t=N(vr),n=gr(),r=Ae(e),i=Buffer.from(r,`utf-8`).toString(`hex`),a=`add-generic-password -U -a "${n}" -s "${t}" -X "${i}"\n`,o;return a.length<=oa?o=Xe(`security`,[`-i`],{input:a,stdio:[`pipe`,`pipe`,`pipe`],reject:!1}):(_(`Keychain payload (${r.length}B JSON) exceeds security -i stdin limit; using argv`,{level:`warn`}),o=Xe(`security`,[`add-generic-password`,`-U`,`-a`,n,`-s`,t,`-X`,i],{stdio:[`ignore`,`pipe`,`pipe`],reject:!1})),o.exitCode===0?(F.cache={data:e,cachedAt:Date.now()},{success:!0}):{success:!1}}catch{return{success:!1}}},delete(){P();try{let e=N(vr);return qe(`security delete-generic-password -a "${gr()}" -s "${e}"`),!0}catch{return!1}}}}));function ua(){let e=c();return{storageDir:e,storagePath:bt(e,`.credentials.json`)}}var da,fa=e((()=>{l(),je(),Pe(),Oe(),da={name:`plaintext`,read(){let{storagePath:e}=ua();try{return De(Le().readFileSync(e,{encoding:`utf8`}))}catch{return null}},async readAsync(){let{storagePath:e}=ua();try{return De(await Le().readFile(e,{encoding:`utf8`}))}catch{return null}},update(e){try{let{storageDir:t,storagePath:n}=ua();try{Le().mkdirSync(t)}catch(e){if(Ee(e)!==`EEXIST`)throw e}return Te(n,Ae(e),{encoding:`utf8`,flush:!1}),xt(n,384),{success:!0,warning:`Warning: Storing credentials in plaintext.`}}catch{return{success:!1}}},delete(){let{storagePath:e}=ua();try{return Le().unlinkSync(e),!0}catch(e){return Ee(e)===`ENOENT`}}}}));function pa(){return process.platform===`darwin`?na(sa,da):da}var ma=e((()=>{ra(),la(),fa()}));function ha(e){return new Promise(t=>{jt(`security`,[`find-generic-password`,`-a`,gr(),`-w`,`-s`,e],{encoding:`utf-8`,timeout:ba},(e,n)=>{t({stdout:e?null:n?.trim()||null,timedOut:!!(e&&`killed`in e&&e.killed)})})})}function ga(){if(process.platform!==`darwin`||Sa||u())return;let e=ha(N(vr)),t=ha(N());Sa=Promise.all([e,t]).then(([e,t])=>{e.timedOut||_r(e.stdout),t.timedOut||(xa={stdout:t.stdout})})}async function _a(){Sa&&await Sa}function va(){return xa}function ya(){xa=null}var ba,xa,Sa,Ca=e((()=>{l(),yr(),ba=1e4,xa=null,Sa=null}));function wa(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 Ta=e((()=>{}));function Ea(){return Oa}function Da(){Oa.clear()}var Oa,ka=e((()=>{Oa=new Map})),Aa=n({calculateApiKeyHelperTTL:()=>Ba,checkAndRefreshOAuthTokenIfNeeded:()=>vo,checkGcpCredentialsValid:()=>eo,clearApiKeyHelperCache:()=>Ka,clearAwsCredentialsCache:()=>Za,clearGcpCredentialsCache:()=>ro,clearOAuthTokenCache:()=>po,getAccountInformation:()=>Ro,getAnthropicApiKey:()=>R,getAnthropicApiKeyWithSource:()=>Pa,getApiKeyFromApiKeyHelper:()=>Ha,getApiKeyFromApiKeyHelperCached:()=>Ga,getApiKeyFromConfigOrMacOSKeychain:()=>Jo,getApiKeyHelperElapsedMs:()=>Va,getAuthTokenSource:()=>Ma,getClaudeAIOAuthTokens:()=>G,getClaudeAIOAuthTokensAsync:()=>_o,getConfiguredApiKeyHelper:()=>z,getOauthAccountInfo:()=>So,getOtelHeadersFromHelper:()=>Fo,getRateLimitTier:()=>Ao,getSubscriptionName:()=>jo,getSubscriptionType:()=>V,handleOAuth401Error:()=>ho,hasAnthropicApiKeyAuth:()=>Na,hasOpusAccess:()=>wo,hasProfileScope:()=>bo,is1PApiCustomer:()=>xo,isAnthropicAuthEnabled:()=>L,isAwsAuthRefreshFromProjectSettings:()=>La,isAwsCredentialExportFromProjectSettings:()=>za,isClaudeAISubscriber:()=>B,isConsumerSubscriber:()=>Lo,isCustomApiKeyApproved:()=>co,isEnterpriseSubscriber:()=>Oo,isGcpAuthRefreshFromProjectSettings:()=>$a,isMaxSubscriber:()=>To,isOtelHeadersHelperFromProjectOrLocalSettings:()=>Po,isOverageProvisioningAllowed:()=>Co,isProSubscriber:()=>ko,isTeamPremiumSubscriber:()=>Do,isTeamSubscriber:()=>Eo,isUsing3PServices:()=>Mo,prefetchApiKeyFromApiKeyHelperIfSafe:()=>qa,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>ao,prefetchGcpCredentialsIfSafe:()=>io,refreshAndGetAwsCredentials:()=>W,refreshAwsAuth:()=>Ya,refreshGcpAuth:()=>no,refreshGcpCredentialsIfNeeded:()=>qo,removeApiKey:()=>lo,saveApiKey:()=>so,saveOAuthTokensIfNeeded:()=>fo,validateForceLoginOrg:()=>zo});function ja(){return s(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT===`claude-desktop`}function L(){if(u())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let e=b()||{},t=s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||e.modelType===`openai`||e.modelType===`gemini`||!!process.env.OPENAI_BASE_URL||!!process.env.GEMINI_BASE_URL,n=e.apiKeyHelper,r=process.env.ANTHROPIC_AUTH_TOKEN||n||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,{source:i}=Pa({skipRetrievingKeyFromApiKeyHelper:!0}),a=i===`ANTHROPIC_API_KEY`||i===`apiKeyHelper`;return!(t||r&&!ja()||a&&!ja())}function Ma(){if(u())return z()?{source:`apiKeyHelper`,hasToken:!0}:{source:`none`,hasToken:!1};if(process.env.ANTHROPIC_AUTH_TOKEN&&!ja())return{source:`ANTHROPIC_AUTH_TOKEN`,hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:`CLAUDE_CODE_OAUTH_TOKEN`,hasToken:!0};if(lr())return process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR?{source:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,hasToken:!0}:{source:`CCR_OAUTH_TOKEN_FILE`,hasToken:!0};if(z()&&!ja())return{source:`apiKeyHelper`,hasToken:!0};let e=G();return qn(e?.scopes)&&e?.accessToken?{source:`claude.ai`,hasToken:!0}:{source:`none`,hasToken:!1}}function R(){let{key:e}=Pa();return e}function Na(){let{key:e,source:t}=Pa({skipRetrievingKeyFromApiKeyHelper:!0});return e!==null&&t!==`none`}function Pa(e={}){if(u())return process.env.ANTHROPIC_API_KEY?{key:process.env.ANTHROPIC_API_KEY,source:`ANTHROPIC_API_KEY`}:z()?{key:e.skipRetrievingKeyFromApiKeyHelper?null:Ga(),source:`apiKeyHelper`}:{key:null,source:`none`};let t=a()?void 0:process.env.ANTHROPIC_API_KEY;if(xe()&&t)return{key:t,source:`ANTHROPIC_API_KEY`};if(s(process.env.CI)){let e=ur();if(e)return{key:e,source:`ANTHROPIC_API_KEY`};if(!t&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error(`ANTHROPIC_API_KEY or CLAUDE_CODE_OAUTH_TOKEN env var is required`);return t?{key:t,source:`ANTHROPIC_API_KEY`}:{key:null,source:`none`}}if(t&&S().customApiKeyResponses?.approved?.includes(xr(t)))return{key:t,source:`ANTHROPIC_API_KEY`};let n=ur();return n?{key:n,source:`ANTHROPIC_API_KEY`}:z()?e.skipRetrievingKeyFromApiKeyHelper?{key:null,source:`apiKeyHelper`}:{key:Ga(),source:`apiKeyHelper`}:Jo()||{key:null,source:`none`}}function z(){return u()?y(`flagSettings`)?.apiKeyHelper:(b()||{}).apiKeyHelper}function Fa(){let e=z();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.apiKeyHelper===e||n?.apiKeyHelper===e}function Ia(){return(b()||{}).awsAuthRefresh}function La(){let e=Ia();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsAuthRefresh===e||n?.awsAuthRefresh===e}function Ra(){return(b()||{}).awsCredentialExport}function za(){let e=Ra();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.awsCredentialExport===e||n?.awsCredentialExport===e}function Ba(){let e=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(e){let t=parseInt(e,10);if(!Number.isNaN(t)&&t>=0)return t;_(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${e}`,{level:`error`})}return Bo}function Va(){let e=U?.startedAt;return e?Date.now()-e:0}async function Ha(e){if(!z())return null;let t=Ba();return H?(Date.now()-H.timestamp<t||U||(U={promise:Ua(e,!1,Vo),startedAt:null}),H.value):(U||(U={promise:Ua(e,!0,Vo),startedAt:Date.now()}),U.promise)}async function Ua(e,t,n){try{let t=await Wa(e);return n===Vo&&t!==null&&(H={value:t,timestamp:Date.now()}),t}catch(e){if(n!==Vo)return` `;let r=e instanceof Error?e.message:String(e);return console.error(re.red(`apiKeyHelper failed: ${r}`)),_(`Error getting API key from apiKeyHelper: ${r}`,{level:`error`}),!t&&H&&H.value!==` `?(H={...H,timestamp:Date.now()},H.value):(H={value:` `,timestamp:Date.now()},` `)}finally{n===Vo&&(U=null)}}async function Wa(e){let t=z();if(!t)return null;if(Fa()&&!C()&&!e)return Ie(`apiKeyHelper invoked before trust check`,Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in .`)),T(`tengu_apiKeyHelper_missing_trust11`,{}),null;let n=await Je(t,{shell:!0,timeout:600*1e3,reject:!1});if(n.failed){let e=n.timedOut?`timed out`:`exited ${n.exitCode}`,t=n.stderr?.trim();throw Error(t?`${e}: ${t}`:e)}let r=n.stdout?.trim();if(!r)throw Error(`did not return a value`);return r}function Ga(){return H?.value??null}function Ka(){Vo++,H=null,U=null}function qa(e){Fa()&&!C()||Ha(e)}async function Ja(){let e=Ia();if(!e)return!1;if(La()&&!C()&&!h())return Ie(`awsAuthRefresh invoked before trust check`,Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),T(`tengu_awsAuthRefresh_missing_trust`,{}),!1;try{return _(`Fetching AWS caller identity for AWS auth refresh command`),await Tr(),_(`Fetched AWS caller identity, skipping AWS auth refresh command`),!1}catch{return Ya(e)}}function Ya(e){_(`Running AWS auth refresh command`);let t=Or.getInstance();return t.startAuthentication(),new Promise(n=>{let r=At(e,{timeout:Uo});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),_(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),_(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)_(`AWS auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?re.red(`AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):re.red(`Error running awsAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}async function Xa(){let e=Ra();if(!e)return null;if(za()&&!C()&&!h())return Ie(`awsCredentialExport invoked before trust check`,Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in .`)),T(`tengu_awsCredentialExport_missing_trust`,{}),null;try{return _(`Fetching AWS caller identity for credential export command`),await Tr(),_(`Fetched AWS caller identity, skipping AWS credential export command`),null}catch{try{_(`Running AWS credential export command`);let t=await Je(e,{shell:!0,reject:!1});if(t.exitCode!==0||!t.stdout)throw Error(`awsCredentialExport did not return a valid value`);let n=De(t.stdout.trim());if(!wr(n))throw Error(`awsCredentialExport did not return valid AWS STS output structure`);return _(`AWS credentials retrieved from awsCredentialExport`),{accessKeyId:n.Credentials.AccessKeyId,secretAccessKey:n.Credentials.SecretAccessKey,sessionToken:n.Credentials.SessionToken}}catch(e){let t=re.red(`Error getting AWS credentials from awsCredentialExport (in settings or ~/.claude.json):`);return e instanceof Error?console.error(t,e.message):console.error(t,e),null}}}function Za(){W.cache.clear()}function Qa(){return(b()||{}).gcpAuthRefresh}function $a(){let e=Qa();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.gcpAuthRefresh===e||n?.gcpAuthRefresh===e}async function eo(){try{let{GoogleAuth:e}=await import(`./src-CiJCsqUl.js`).then(e=>t(e.default,1)),n=new e({scopes:[`https://www.googleapis.com/auth/cloud-platform`]}),r=(async()=>{await(await n.getClient()).getAccessToken()})(),i=wa(Wo).then(()=>{throw new ts(`GCP credentials check timed out`)});return await Promise.race([r,i]),!0}catch{return!1}}async function to(){let e=Qa();if(!e)return!1;if($a()&&!C()&&!h())return Ie(`gcpAuthRefresh invoked before trust check`,Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in .`)),T(`tengu_gcpAuthRefresh_missing_trust`,{}),!1;try{if(_(`Checking GCP credentials validity for auth refresh`),await eo())return _(`GCP credentials are valid, skipping auth refresh command`),!1}catch{}return no(e)}function no(e){_(`Running GCP auth refresh command`);let t=Or.getInstance();return t.startAuthentication(),new Promise(n=>{let r=At(e,{timeout:Ko});r.stdout.on(`data`,e=>{let n=e.toString().trim();n&&(t.addOutput(n),_(n,{level:`debug`}))}),r.stderr.on(`data`,e=>{let n=e.toString().trim();n&&(t.setError(n),_(n,{level:`error`}))}),r.on(`close`,(e,r)=>{if(e===0)_(`GCP auth refresh completed successfully`),t.endAuthentication(!0),n(!0);else{let e=r===`SIGTERM`?re.red(`GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal.`):re.red(`Error running gcpAuthRefresh (in settings or ~/.claude.json):`);console.error(e),t.endAuthentication(!1),n(!1)}})})}function ro(){qo.cache.clear()}function io(){Qa()&&($a()&&!C()&&!h()||qo())}function ao(){let e=Ia(),t=Ra();!e&&!t||(La()||za())&&!C()&&!h()||(W(),A())}function oo(e){return/^[a-zA-Z0-9-_]+$/.test(e)}async function so(e){if(!oo(e))throw Error(`Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.`);await uo();let t=!1;if(process.platform===`darwin`)try{let n=N();await Je(`security`,[`-i`],{input:`add-generic-password -U -a "${gr()}" -s "${n}" -X "${Buffer.from(e,`utf-8`).toString(`hex`)}"\n`,reject:!1}),T(`tengu_api_key_saved_to_keychain`,{}),t=!0}catch(e){w(e),T(`tengu_api_key_keychain_error`,{error:v(e)}),T(`tengu_api_key_saved_to_config`,{})}else T(`tengu_api_key_saved_to_config`,{});let n=xr(e);x(r=>{let i=r.customApiKeyResponses?.approved??[];return{...r,primaryApiKey:t?r.primaryApiKey:e,customApiKeyResponses:{...r.customApiKeyResponses,approved:i.includes(n)?i:[...i,n],rejected:r.customApiKeyResponses?.rejected??[]}}}),Jo.cache.clear?.(),ya()}function co(e){let t=S(),n=xr(e);return t.customApiKeyResponses?.approved?.includes(n)??!1}async function lo(){await uo(),x(e=>({...e,primaryApiKey:void 0})),Jo.cache.clear?.(),ya()}async function uo(){try{await br()}catch(e){w(e)}}function fo(e){if(!qn(e.scopes))return T(`tengu_oauth_tokens_not_claude_ai`,{}),{success:!0};if(!e.refreshToken||!e.expiresAt)return T(`tengu_oauth_tokens_inference_only`,{}),{success:!0};let t=pa(),n=t.name;try{let r=t.read()||{},i=r.claudeAiOauth;r.claudeAiOauth={accessToken:e.accessToken,refreshToken:e.refreshToken,expiresAt:e.expiresAt,scopes:e.scopes,subscriptionType:e.subscriptionType??i?.subscriptionType??null,rateLimitTier:e.rateLimitTier??i?.rateLimitTier??null};let a=t.update(r);return a.success?T(`tengu_oauth_tokens_saved`,{storageBackend:n}):T(`tengu_oauth_tokens_save_failed`,{storageBackend:n}),G.cache?.clear?.(),Xi(),Da(),a}catch(e){return w(e),T(`tengu_oauth_tokens_save_exception`,{storageBackend:n,error:v(e)}),{success:!1,warning:`Failed to save OAuth tokens`}}}function po(){G.cache?.clear?.(),P()}async function mo(){try{let{mtimeMs:e}=await Ot(bt(c(),`.credentials.json`));e!==Yo&&(Yo=e,po())}catch{G.cache?.clear?.()}}function ho(e){let t=Xo.get(e);if(t)return t;let n=go(e).finally(()=>{Xo.delete(e)});return Xo.set(e,n),n}async function go(e){po();let t=await _o();return t?.refreshToken?t.accessToken===e?vo(0,!0):(T(`tengu_oauth_401_recovered_from_keychain`,{}),!0):!1}async function _o(){if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||lr())return G();try{let e=(await pa().readAsync())?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return w(e),null}}function vo(e=0,t=!1){return e===0&&!t?Zo||(Zo=yo(e,t).finally(()=>{Zo=null}),Zo):yo(e,t)}async function yo(e,t){await mo();let n=G();if(!t&&(!n?.refreshToken||!er(n.expiresAt))||!n?.refreshToken||!qn(n.scopes))return!1;G.cache?.clear?.(),P();let r=await _o();if(!r?.refreshToken||!er(r.expiresAt))return!1;let i=c();await Dt(i,{recursive:!0});let a;try{T(`tengu_oauth_token_refresh_lock_acquiring`,{}),a=await We(i),T(`tengu_oauth_token_refresh_lock_acquired`,{})}catch(n){return n.code===`ELOCKED`?e<5?(T(`tengu_oauth_token_refresh_lock_retry`,{retryCount:e+1}),await wa(1e3+Math.random()*1e3),yo(e+1,t)):(T(`tengu_oauth_token_refresh_lock_retry_limit_reached`,{maxRetries:5}),!1):(w(n),T(`tengu_oauth_token_refresh_lock_error`,{error:v(n)}),!1)}try{G.cache?.clear?.(),P();let e=await _o();return!e?.refreshToken||!er(e.expiresAt)?(T(`tengu_oauth_token_refresh_race_resolved`,{}),!1):(T(`tengu_oauth_token_refresh_starting`,{}),fo(await Zn(e.refreshToken,{scopes:qn(e.scopes)?void 0:e.scopes})),G.cache?.clear?.(),P(),!0)}catch(e){w(e),G.cache?.clear?.(),P();let t=await _o();return t&&!er(t.expiresAt)?(T(`tengu_oauth_token_refresh_race_recovered`,{}),!0):!1}finally{T(`tengu_oauth_token_refresh_lock_releasing`,{}),await a(),T(`tengu_oauth_token_refresh_lock_released`,{})}}function B(){return L()?qn(G()?.scopes):!1}function bo(){return G()?.scopes?.includes(`user:profile`)??!1}function xo(){return!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||B())}function So(){return L()?S().oauthAccount:void 0}function Co(){let e=So()?.billingType;return!(!B()||!e||e!==`stripe_subscription`&&e!==`stripe_subscription_contracted`&&e!==`apple_subscription`&&e!==`google_play_subscription`)}function wo(){let e=V();return e===`max`||e===`enterprise`||e===`team`||e===`pro`||e===null}function V(){if(Pn())return Nn();if(!L())return null;let e=G();return e?e.subscriptionType??null:null}function To(){return V()===`max`}function Eo(){return V()===`team`}function Do(){return V()===`team`&&Ao()===`default_claude_max_5x`}function Oo(){return V()===`enterprise`}function ko(){return V()===`pro`}function Ao(){if(!L())return null;let e=G();return e?e.rateLimitTier??null:null}function jo(){switch(V()){case`enterprise`:return`Claude Enterprise`;case`team`:return`Claude Team`;case`max`:return`Claude Max`;case`pro`:return`Claude Pro`;default:return`Claude API`}}function Mo(){return!!(s(process.env.CLAUDE_CODE_USE_BEDROCK)||s(process.env.CLAUDE_CODE_USE_VERTEX)||s(process.env.CLAUDE_CODE_USE_FOUNDRY)||s(process.env.CLAUDE_CODE_USE_OPENAI)||s(process.env.CLAUDE_CODE_USE_GEMINI)||s(process.env.CLAUDE_CODE_USE_GROK))}function No(){return(b()||{}).otelHeadersHelper}function Po(){let e=No();if(!e)return!1;let t=y(`projectSettings`),n=y(`localSettings`);return t?.otelHeadersHelper===e||n?.otelHeadersHelper===e}function Fo(){let e=No();if(!e)return{};let t=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||es.toString(),10);if(Qo&&Date.now()-$o<t)return Qo;if(Po()&&!C())return{};try{let t=qe(e,{timeout:3e4})?.toString().trim();if(!t)throw Error(`otelHeadersHelper did not return a valid value`);let n=De(t);if(typeof n!=`object`||!n||Array.isArray(n))throw Error(`otelHeadersHelper must return a JSON object with string key-value pairs`);for(let[e,t]of Object.entries(n))if(typeof t!=`string`)throw Error(`otelHeadersHelper returned non-string value for key "${e}": ${typeof t}`);return Qo=n,$o=Date.now(),Qo}catch(e){throw w(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${v(e)}`)),e}}function Io(e){return e===`max`||e===`pro`}function Lo(){let e=V();return B()&&e!==null&&Io(e)}function Ro(){if(O()!==`firstParty`)return;let{source:e}=Ma(),t={};e===`CLAUDE_CODE_OAUTH_TOKEN`||e===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`?t.tokenSource=e:B()?t.subscription=jo():t.tokenSource=e;let{key:n,source:r}=Pa();if(n&&(t.apiKeySource=r),e===`claude.ai`||r===`/login managed key`){let e=So()?.organizationName;e&&(t.organization=e)}let i=So()?.emailAddress;return(e===`claude.ai`||r===`/login managed key`)&&i&&(t.email=i),t}async function zo(){if(process.env.ANTHROPIC_UNIX_SOCKET||!L())return{valid:!0};let e=y(`policySettings`)?.forceLoginOrgUUID;if(!e)return{valid:!0};await vo();let t=G();if(!t)return{valid:!0};let{source:n}=Ma(),r=n===`CLAUDE_CODE_OAUTH_TOKEN`||n===`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`,i=await Gn(t.accessToken);if(!i)return{valid:!1,message:`Unable to verify organization for the current authentication token.\nThis machine requires organization ${e} but the profile could not be fetched.\nThis may be a network error, or the token may lack the user:profile scope required for\nverification (tokens from 'claude setup-token' do not include this scope).\nTry again, or obtain a full-scope token via 'claude auth login'.`};let a=i.organization.uuid;return a===e?{valid:!0}:r?{valid:!1,message:`The ${n===`CLAUDE_CODE_OAUTH_TOKEN`?`CLAUDE_CODE_OAUTH_TOKEN`:`CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR`} environment variable provides a token for a\ndifferent organization than required by this machine's managed settings.\n\nRequired organization: ${e}\nToken organization: ${a}\n\nRemove the environment variable or obtain a token for the correct organization.`}:{valid:!1,message:`Your authentication token belongs to organization ${a},\nbut this machine requires organization ${e}.\n\nPlease log in with the correct organization: claude auth login`}}var Bo,H,U,Vo,Ho,Uo,W,Wo,Go,Ko,qo,Jo,G,Yo,Xo,Zo,Qo,$o,es,ts,K=e((()=>{ne(),Ke(),i(),D(),at(),Sn(),k(),m(),Un(),ar(),Kn(),hr(),Sr(),Dr(),kr(),ta(),Ue(),g(),l(),je(),Ye(),He(),et(),nt(),ma(),Ca(),yr(),ze(),Ta(),Oe(),ka(),Bo=300*1e3,H=null,U=null,Vo=0,Ho=3600*1e3,Uo=180*1e3,W=tt(async()=>{let e=await Ja(),t=await Xa();return(e||t)&&await Er(),t},Ho),Wo=5e3,Go=3600*1e3,Ko=180*1e3,qo=tt(async()=>await to(),Go),Jo=r(()=>{if(u())return null;if(process.platform===`darwin`){let e=va();if(e){if(e.stdout)return{key:e.stdout,source:`/login managed key`}}else{let e=N();try{let t=qe(`security find-generic-password -a $USER -w -s "${e}"`);if(t)return{key:t,source:`/login managed key`}}catch(e){w(e)}}}let e=S();return e.primaryApiKey?{key:e.primaryApiKey,source:`/login managed key`}:null}),G=r(()=>{if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};let e=lr();if(e)return{accessToken:e,refreshToken:null,expiresAt:null,scopes:[`user:inference`],subscriptionType:null,rateLimitTier:null};try{let e=pa().read()?.claudeAiOauth;return e?.accessToken?e:null}catch(e){return w(e),null}}),Yo=0,Xo=new Map,Zo=null,Qo=null,$o=0,es=1740*1e3,ts=class extends Error{}}));function q(){return!s(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function ns(){return q()?is()===null:!1}function rs(e,t){switch(e){case`free`:return t===`oauth`?`Fast mode requires a paid subscription`:`Fast mode unavailable during evaluation. Please purchase credits.`;case`preference`:return`Fast mode has been disabled by your organization`;case`extra_usage_disabled`:return`Fast mode requires extra usage billing · /extra-usage to enable`;case`network_error`:return`Fast mode unavailable due to network connectivity issues`;case`unknown`:return`Fast mode is currently unavailable`}}function is(){if(!q())return`Fast mode is not available`;if(ft(),h()&&xe()&&!ue()&&!y(`flagSettings`)?.fastMode){let e=`Fast mode is not available in the Agent SDK`;return _(`Fast mode unavailable: ${e}`),e}if(O()!==`firstParty`){let e=`Fast mode is not available on Bedrock, Vertex, or Foundry`;return _(`Fast mode unavailable: ${e}`),e}if(J.status===`disabled`){if((J.reason===`network_error`||J.reason===`unknown`)&&s(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null;let e=G()===null?`api-key`:`oauth`,t=rs(J.reason,e);return _(`Fast mode unavailable: ${t}`),t}return null}function as(){return`opus`+(kc()?`[1m]`:``)}function os(e){if(!q()||!ns()||!ss(e))return!1;let t=Be();return!t.fastModePerSessionOptIn&&t.fastMode===!0}function ss(e){if(!q())return!1;let t=Q(e??wc());return t.toLowerCase().includes(`opus-4-7`)||t.toLowerCase().includes(`opus-4-6`)}function cs(){return xs.status===`cooldown`&&Date.now()>=xs.resetAt&&(q()&&!Ss&&(_(`Fast mode cooldown expired, re-enabling fast mode`),Ss=!0,ws.emit()),xs={status:`active`}),xs}function ls(e,t){if(!q())return;xs={status:`cooldown`,resetAt:e,reason:t},Ss=!1;let n=e-Date.now();_(`Fast mode cooldown triggered (${t}), duration ${Math.round(n/1e3)}s`),T(`tengu_fast_mode_fallback_triggered`,{cooldown_duration_ms:n,cooldown_reason:t}),Cs.emit(e,t)}function us(){xs={status:`active`}}function ds(){J.status!==`disabled`&&(J={status:`disabled`,reason:`preference`},Ve(`userSettings`,{fastMode:void 0}),x(e=>({...e,penguinModeOrgEnabled:!1})),ks.emit(!1))}function fs(e){switch(e){case`out_of_credits`:return`Fast mode disabled · extra usage credits exhausted`;case`org_level_disabled`:case`org_service_level_disabled`:return`Fast mode disabled · extra usage disabled by your organization`;case`org_level_disabled_until`:return`Fast mode disabled · extra usage spending cap reached`;case`member_level_disabled`:return`Fast mode disabled · extra usage disabled for your account`;case`seat_tier_level_disabled`:case`seat_tier_zero_credit_limit`:case`member_zero_credit_limit`:return`Fast mode disabled · extra usage not available for your plan`;case`overage_not_provisioned`:case`no_limits_configured`:return`Fast mode requires extra usage billing · /extra-usage to enable`;default:return`Fast mode disabled · extra usage not available`}}function ps(e){return e===`org_level_disabled_until`||e===`out_of_credits`}function ms(e){let t=fs(e);_(`Fast mode overage rejection: ${e??`unknown`} — ${t}`),T(`tengu_fast_mode_overage_rejected`,{overage_disabled_reason:e??`unknown`}),ps(e)||(Ve(`userSettings`,{fastMode:void 0}),x(e=>({...e,penguinModeOrgEnabled:!1}))),Ds.emit(t)}function hs(){return cs().status===`cooldown`}function gs(e,t){let n=q()&&ns()&&!!t&&ss(e);return n&&hs()?`cooldown`:n?`on`:`off`}async function _s(e){let t=`${E().BASE_API_URL}/api/claude_code_penguin_mode`,n=`accessToken`in e?{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":ut}:{"x-api-key":e.apiKey};return(await f.get(t,{headers:n})).data}function vs(){if(!q()||J.status!==`pending`)return;let e=process.env.USER_TYPE===`ant`,t=S().penguinModeOrgEnabled===!0;J=e||t?{status:`enabled`}:{status:`disabled`,reason:`unknown`}}async function ys(){if($e()||!q())return;if(Ns)return _(`Fast mode prefetch in progress, returning in-flight promise`),Ns;let e=R();if(!(G()?.accessToken&&bo())&&!e){let e=process.env.USER_TYPE===`ant`,t=S().penguinModeOrgEnabled===!0;J=e||t?{status:`enabled`}:{status:`disabled`,reason:`preference`};return}let t=Date.now();if(t-Ms<js){_(`Skipping fast mode prefetch, fetched recently`);return}Ms=t;let n=async()=>{let t=G(),n=t?.accessToken&&bo()?{accessToken:t.accessToken}:e?{apiKey:e}:null;if(!n)throw Error(`No auth available`);return _s(n)};async function r(){try{let e;try{e=await n()}catch(t){if(f.isAxiosError(t)&&(t.response?.status===401||t.response?.status===403&&typeof t.response?.data==`string`&&t.response.data.includes(`OAuth token has been revoked`))){let r=G()?.accessToken;if(r)await ho(r),e=await n();else throw t}else throw t}let t=J.status===`pending`?S().penguinModeOrgEnabled:J.status===`enabled`;J=e.enabled?{status:`enabled`}:{status:`disabled`,reason:e.disabled_reason??`preference`},t!==e.enabled&&(e.enabled||Ve(`userSettings`,{fastMode:void 0}),x(t=>({...t,penguinModeOrgEnabled:e.enabled})),ks.emit(e.enabled)),_(`Org fast mode: ${e.enabled?`enabled`:`disabled (${e.disabled_reason??`preference`})`}`)}catch(e){let t=process.env.USER_TYPE===`ant`,n=S().penguinModeOrgEnabled===!0;J=t||n?{status:`enabled`}:{status:`disabled`,reason:`network_error`},_(`Failed to fetch org fast mode status, defaulting to ${J.status===`enabled`?`enabled (cached)`:`disabled (network_error)`}: ${e}`,{level:`error`}),T(`tengu_org_penguin_mode_fetch_failed`,{})}finally{Ns=null}}return Ns=r(),Ns}var bs,xs,Ss,Cs,ws,Ts,Es,Ds,Os,J,ks,As,js,Ms,Ns,Ps=e((()=>{p(),D(),m(),at(),K(),pt(),Ue(),g(),l(),$(),k(),Qe(),ze(),pe(),bs=`Opus 4.7`,xs={status:`active`},Ss=!1,Cs=Ce(),ws=Ce(),Ts=Cs.subscribe,Es=ws.subscribe,Ds=Ce(),Os=Ds.subscribe,J={status:`pending`},ks=Ce(),As=ks.subscribe,js=3e4,Ms=0,Ns=null}));function Fs(e){return q()&&e?Ks:Gs}function Is(e,t){return t.input_tokens/1e6*e.inputTokens+t.output_tokens/1e6*e.outputTokens+(t.cache_read_input_tokens??0)/1e6*e.promptCacheReadTokens+(t.cache_creation_input_tokens??0)/1e6*e.promptCacheWriteTokens+(t.server_tool_use?.web_search_requests??0)*e.webSearchRequests}function Ls(e,t){let n=Z(e);return n===X(on.firstParty)?Fs(t.speed===`fast`):Xs[n]||(Rs(e,n),Xs[Z(wc())]??Ys)}function Rs(e,t){T(`tengu_unknown_model_cost`,{model:e,shortName:t}),fe()}function zs(e,t){return Is(Ls(e,t),t)}function Bs(e,t){return zs(e,{input_tokens:t.inputTokens,output_tokens:t.outputTokens,cache_read_input_tokens:t.cacheReadInputTokens,cache_creation_input_tokens:t.cacheCreationInputTokens})}function Vs(e){return Number.isInteger(e)?`$${e}`:`$${e.toFixed(2)}`}function Hs(e){return`${Vs(e.inputTokens)}/${Vs(e.outputTokens)} per Mtok`}var Us,Ws,Gs,Ks,qs,Js,Ys,Xs,Zs=e((()=>{at(),m(),Ps(),dn(),$(),Us={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:.3,webSearchRequests:.01},Ws={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:.01},Gs={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:.5,webSearchRequests:.01},Ks={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:.01},qs={inputTokens:.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:.08,webSearchRequests:.01},Js={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:.1,webSearchRequests:.01},Ys=Gs,Xs={[X(Qt.firstParty)]:qs,[X($t.firstParty)]:Js,[X(Zt.firstParty)]:Us,[X(Xt.firstParty)]:Us,[X(en.firstParty)]:Us,[X(tn.firstParty)]:Us,[X(cn.firstParty)]:Us,[X(nn.firstParty)]:Ws,[X(rn.firstParty)]:Ws,[X(an.firstParty)]:Gs,[X(on.firstParty)]:Gs}}));function Qs(e){return ec.includes(e)}function $s(e){return tc.includes(e)}var ec,tc,nc=e((()=>{ec=[`sonnet`,`opus`,`haiku`,`best`,`sonnet[1m]`,`opus[1m]`,`opusplan`],tc=[`sonnet`,`opus`,`haiku`]}));function rc(e,t){return e.includes(t)?!0:Qs(e)?Q(e).toLowerCase().includes(t):!1}function ic(e,t){return e.startsWith(t)?e.length===t.length||e[t.length]===`-`:!1}function ac(e,t){let n=Qs(e)?Q(e).toLowerCase():e;return!!(ic(n,t)||!t.startsWith(`claude-`)&&ic(n,`claude-${t}`))}function oc(e,t){for(let n of t){if($s(n))continue;let t=n.indexOf(e);if(t===-1)continue;let r=t+e.length;if(r===n.length||n[r]===`-`)return!0}return!1}function sc(e){let{availableModels:t}=b()||{};if(!t)return!0;if(t.length===0)return!1;let n=_n(e).trim().toLowerCase(),r=t.map(e=>e.trim().toLowerCase());if(r.includes(n)&&(!$s(n)||!oc(n,r)))return!0;for(let e of r)if($s(e)&&!oc(e,r)&&rc(n,e))return!0;if(Qs(n)){let e=Q(n).toLowerCase();if(r.includes(e))return!0}for(let e of r)if(!$s(e)&&Qs(e)&&Q(e).toLowerCase()===n)return!0;for(let e of r)if(!$s(e)&&!Qs(e)&&ac(n,e))return!0;return!1}var cc=e((()=>{ze(),nc(),$(),Sn()}));function lc(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}function uc(e){let t=e.toLowerCase().replace(/\[1m\]$/,``);return pc.some(e=>e.value.toLowerCase()===t)}var dc,fc,pc,mc=e((()=>{dc=`gpt-5.5`,fc=`gpt-5.4-mini`,pc=[{value:`gpt-5.5`,label:`GPT-5.5`,description:`Frontier model for complex coding, research, and real-world work`},{value:`gpt-5.4`,label:`GPT-5.4`,description:`Strong model for everyday coding`},{value:`gpt-5.4-mini`,label:`GPT-5.4-Mini`,description:`Small, fast, and cost-efficient model for simpler coding tasks`},{value:`gpt-5.3-codex`,label:`GPT-5.3-Codex`,description:`Coding-optimized model`},{value:`gpt-5.3-codex-spark`,label:`GPT-5.3-Codex-Spark`,description:`Ultra-fast coding model`},{value:`gpt-5.2`,label:`GPT-5.2`,description:`Optimized for professional work and long-running agents`}]}));function hc(){let e=O();return e===`openai`&&lc()?process.env.OPENAI_SMALL_FAST_MODEL??`gpt-5.4-mini`:e===`openai`&&process.env.OPENAI_SMALL_FAST_MODEL?process.env.OPENAI_SMALL_FAST_MODEL:e===`gemini`&&process.env.GEMINI_SMALL_FAST_MODEL?process.env.GEMINI_SMALL_FAST_MODEL:process.env.ANTHROPIC_SMALL_FAST_MODEL||Sc()}function gc(e){return e===A().opus40||e===A().opus41||e===A().opus45||e===A().opus46||e===A().opus47}function _c(){let e,t=me();if(t!==void 0)e=t;else{let t=b()||{};e=process.env.ANTHROPIC_MODEL||t.model||void 0}if(!(e&&!sc(e)))return e}function vc(){let e=_c();return e==null?Tc():Q(e)}function yc(){return Y()}function bc(){let e=O();if(e===`openai`)return process.env.OPENAI_MODEL;if(e===`gemini`)return process.env.GEMINI_MODEL;if(e===`grok`)return process.env.GROK_MODEL}function Y(){let e=O();return e===`openai`&&lc()?dc:e===`openai`&&process.env.OPENAI_DEFAULT_OPUS_MODEL?process.env.OPENAI_DEFAULT_OPUS_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_OPUS_MODEL?process.env.GEMINI_DEFAULT_OPUS_MODEL:process.env.ANTHROPIC_DEFAULT_OPUS_MODEL?process.env.ANTHROPIC_DEFAULT_OPUS_MODEL:bc()||A().opus47}function xc(){let e=O();return e===`openai`&&lc()?dc:e===`openai`&&process.env.OPENAI_DEFAULT_SONNET_MODEL?process.env.OPENAI_DEFAULT_SONNET_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_SONNET_MODEL?process.env.GEMINI_DEFAULT_SONNET_MODEL:process.env.ANTHROPIC_DEFAULT_SONNET_MODEL?process.env.ANTHROPIC_DEFAULT_SONNET_MODEL:bc()||(e===`firstParty`?A().sonnet46:A().sonnet45)}function Sc(){let e=O();return e===`openai`&&lc()?fc:e===`openai`&&process.env.OPENAI_DEFAULT_HAIKU_MODEL?process.env.OPENAI_DEFAULT_HAIKU_MODEL:e===`gemini`&&process.env.GEMINI_DEFAULT_HAIKU_MODEL?process.env.GEMINI_DEFAULT_HAIKU_MODEL:process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL?process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL:bc()||A().haiku45}function Cc(e){let{permissionMode:t,mainLoopModel:n,exceeds200kTokens:r=!1}=e;return _c()===`opusplan`&&t===`plan`&&!r?Y():_c()===`haiku`&&t===`plan`?xc():n}function wc(){return process.env.USER_TYPE===`ant`?Nt()?.defaultModel??Y()+`[1m]`:To()||Do()?Y()+(kc()?`[1m]`:``):xc()}function Tc(){return Q(wc())}function X(e){if(e=e.toLowerCase(),e.includes(`claude-opus-4-7`))return`claude-opus-4-7`;if(e.includes(`claude-opus-4-6`))return`claude-opus-4-6`;if(e.includes(`claude-opus-4-5`))return`claude-opus-4-5`;if(e.includes(`claude-opus-4-1`))return`claude-opus-4-1`;if(e.includes(`claude-opus-4`))return`claude-opus-4`;if(e.includes(`claude-sonnet-4-6`))return`claude-sonnet-4-6`;if(e.includes(`claude-sonnet-4-5`))return`claude-sonnet-4-5`;if(e.includes(`claude-sonnet-4`))return`claude-sonnet-4`;if(e.includes(`claude-haiku-4-5`))return`claude-haiku-4-5`;if(e.includes(`claude-3-7-sonnet`))return`claude-3-7-sonnet`;if(e.includes(`claude-3-5-sonnet`))return`claude-3-5-sonnet`;if(e.includes(`claude-3-5-haiku`))return`claude-3-5-haiku`;if(e.includes(`claude-3-opus`))return`claude-3-opus`;if(e.includes(`claude-3-sonnet`))return`claude-3-sonnet`;if(e.includes(`claude-3-haiku`))return`claude-3-haiku`;let t=e.match(/(claude-(\d+-\d+-)?\w+)/);return t&&t[1]?t[1]:e}function Z(e){return X(_n(e))}function Ec(e=!1){return To()||Do()?kc()?`Opus 4.7 with 1M context · Most capable for complex work${e?Oc(!0):``}`:`Opus 4.7 · Most capable for complex work${e?Oc(!0):``}`:`Sonnet 4.6 · Best for everyday tasks`}function Dc(e){return e===`opusplan`?`Opus 4.7 in plan mode, else Sonnet 4.6`:Nc(Q(e))}function Oc(e){if(O()!==`firstParty`)return``;let t=Hs(Fs(e));return` ·${e?` (↯)`:``} ${t}`}function kc(){return!(wi()||ko()||O()!==`firstParty`||!pn()||B()&&V()===null)}function Ac(e){return e===`opusplan`?`Opus Plan`:Qs(e)?mt(e):Nc(e)}function jc(e){switch(e){case A().opus47:return`Opus 4.7`;case A().opus47+`[1m]`:return`Opus 4.7 (1M context)`;case A().opus46:return`Opus 4.6`;case A().opus46+`[1m]`:return`Opus 4.6 (1M context)`;case A().opus45:return`Opus 4.5`;case A().opus41:return`Opus 4.1`;case A().opus40:return`Opus 4`;case A().sonnet46+`[1m]`:return`Sonnet 4.6 (1M context)`;case A().sonnet46:return`Sonnet 4.6`;case A().sonnet45+`[1m]`:return`Sonnet 4.5 (1M context)`;case A().sonnet45:return`Sonnet 4.5`;case A().sonnet40:return`Sonnet 4`;case A().sonnet40+`[1m]`:return`Sonnet 4 (1M context)`;case A().sonnet37:return`Sonnet 3.7`;case A().sonnet35:return`Sonnet 3.5`;case A().haiku45:return`Haiku 4.5`;case A().haiku35:return`Haiku 3.5`;default:return null}}function Mc(e){let[t=``,...n]=e.split(`-`);return[t.slice(0,3)+`*`.repeat(Math.max(0,t.length-3)),...n].join(`-`)}function Nc(e){let t=jc(e);if(t)return t;if(process.env.USER_TYPE===`ant`){let t=Q(e),n=Ft(e);return n?Mc(n.model.replace(/\[1m\]$/i,``))+(I(t)?`[1m]`:``):t===e?t:`${e} (${t})`}return e}function Q(e){let t=e.trim(),n=t.toLowerCase(),r=I(n),i=r?n.replace(/\[1m]$/i,``).trim():n;if(Qs(i))switch(i){case`opusplan`:return xc()+(r?`[1m]`:``);case`sonnet`:return xc()+(r?`[1m]`:``);case`haiku`:return Sc()+(r?`[1m]`:``);case`opus`:return Y()+(r?`[1m]`:``);case`best`:return yc();default:}if(O()===`firstParty`&&Fc(i)&&Ic())return Y()+(r?`[1m]`:``);if(process.env.USER_TYPE===`ant`){let e=I(n),t=Ft(n.replace(/\[1m]$/i,``).trim());if(t){let n=e?`[1m]`:``;return t.model+n}}return r?t.replace(/\[1m\]$/i,``).trim()+`[1m]`:t}function Pc(e,t){return I(e)||!I(t)?e:Ti(Q(e))?e+`[1m]`:e}function Fc(e){return Bc.includes(e)}function Ic(){return!s(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Lc(e){if(e===null)return process.env.USER_TYPE===`ant`?`Default for Ants (${Dc(wc())})`:B()?`Default (${Ec()})`:`Default (${Tc()})`;let t=Q(e);return e===t?t:`${e} (${t})`}function Rc(e){if(O()===`foundry`)return;let t=e.toLowerCase().includes(`[1m]`),n=Z(e);if(n.includes(`claude-opus-4-7`))return t?`Opus 4.7 (with 1M context)`:`Opus 4.7`;if(n.includes(`claude-opus-4-6`))return t?`Opus 4.6 (with 1M context)`:`Opus 4.6`;if(n.includes(`claude-opus-4-5`))return`Opus 4.5`;if(n.includes(`claude-opus-4-1`))return`Opus 4.1`;if(n.includes(`claude-opus-4`))return`Opus 4`;if(n.includes(`claude-sonnet-4-6`))return t?`Sonnet 4.6 (with 1M context)`:`Sonnet 4.6`;if(n.includes(`claude-sonnet-4-5`))return t?`Sonnet 4.5 (with 1M context)`:`Sonnet 4.5`;if(n.includes(`claude-sonnet-4`))return t?`Sonnet 4 (with 1M context)`:`Sonnet 4`;if(n.includes(`claude-3-7-sonnet`))return`Claude 3.7 Sonnet`;if(n.includes(`claude-3-5-sonnet`))return`Claude 3.5 Sonnet`;if(n.includes(`claude-haiku-4-5`))return`Haiku 4.5`;if(n.includes(`claude-3-5-haiku`))return`Claude 3.5 Haiku`}function zc(e){return e.replace(/\[(1|2)m\]/gi,``)}var Bc,$=e((()=>{m(),It(),K(),Ii(),l(),Sn(),Zs(),ze(),k(),Re(),cc(),nc(),ht(),mc(),Bc=[`claude-opus-4-20250514`,`claude-opus-4-1-20250805`,`claude-opus-4-0`,`claude-opus-4-1`]}));export{ms as $,pi as $n,jn as $r,Co as $t,mc as A,Yi as An,xr as Ar,_o as At,Xs as B,Mi as Bn,Qn as Br,bo as Bt,Q as C,Lt as Ci,pa as Cn,Gr as Cr,Pa as Ct,Pc as D,Ft as Di,Xi as Dn,Dr,Va as Dt,Ac as E,It as Ei,aa as En,kr as Er,Jo as Et,ec as F,qi as Fn,or as Fr,jo as Ft,Zs as G,Di as Gn,Jn as Gr,za as Gt,zs as H,Ei as Hn,nr as Hr,xo as Ht,nc as I,Ji as In,sr as Ir,V as It,as as J,wi as Jn,qn as Jr,co as Jt,bs as K,I as Kn,rr as Kr,B as Kt,qs as L,zi as Ln,Yn as Lr,ho as Lt,uc as M,ta as Mn,yr as Mr,So as Mt,cc as N,Ki as Nn,mr as Nr,Fo as Nt,dc as O,Hi as On,Cr as Or,Ma as Ot,sc as P,Gi as Pn,hr as Pr,Ao as Pt,os as Q,ci as Qn,Kn as Qr,Po as Qt,Js as R,Bi as Rn,$n as Rr,Na as Rt,zc as S,Rt as Si,ga as Sn,Lr as Sr,R as St,Nc as T,Pt as Ti,la as Tn,Or as Tr,Ga as Tt,Hs as U,Ai as Un,ar as Ur,L as Ut,Bs as V,Oi as Vn,tr as Vr,K as Vt,Fs as W,ki as Wn,er as Wr,La as Wt,gs as X,yi as Xn,Wn as Xr,$a as Xt,cs as Y,Ci as Yn,ir as Yr,Oo as Yt,is as Z,fi as Zn,Gn as Zr,To as Zt,$ as _,Vt as _i,ka as _n,Ir as _r,Ka as _t,Sc as a,Mn as ai,ao as an,ai as ar,ss as at,kc as b,Yt as bi,_a as bn,Br as br,po as bt,Y as c,Dn as ci,Ya as cn,Qr as cr,Os as ct,Rc as d,Sn as di,lo as dn,Jr as dr,vs as dt,In as ei,ko as en,ii as er,ds as et,Oc as f,O as fi,so as fn,qr as fr,ls as ft,_c as g,Gt as gi,Ea as gn,Nr as gr,eo as gt,hc as h,pn as hi,Da as hn,Mr as hr,vo as ht,Ec as i,Fn as ii,qa as in,oi as ir,q as it,lc as j,$i as jn,P as jr,z as jt,pc as k,ea as kn,Sr as kr,G as kt,xc as l,yn as li,no as ln,Yr as lr,As as lt,Cc as m,k as mi,zo as mn,Vr as mr,Ba as mt,yc as n,kn as ni,Eo as nn,ti as nr,ns as nt,Tc as o,Tn as oi,io as on,Zr as or,Es as ot,jc as p,fn as pi,fo as pn,Ur as pr,Aa as pt,us as q,Ii as qn,Zn as qr,Lo as qt,Z as r,Un as ri,Mo as rn,ri as rr,hs as rt,wc as s,Cn as si,W as sn,ei as sr,Ts as st,X as t,On as ti,Do as tn,ni as tr,Ps as tt,vc as u,A as ui,qo as un,Xr as ur,ys as ut,Ic as v,Wt as vi,Ta as vn,zr as vr,Za as vt,Dc as w,Nt as wi,ma as wn,Kr as wr,Ha as wt,Lc as x,Ht as xi,Ca as xn,Pr as xr,Ro as xt,gc as y,qt as yi,wa as yn,Rr as yr,ro as yt,Us as z,Fi as zn,Xn as zr,wo as zt};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as e,u as t}from"./model-BgrLt7P7.js";e();export{t as getMainLoopModel};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DSxRz_kt.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{A as a,B as o,E as s,G as c,J as l,O as u,U as d,_ as f,h as p,l as m,ot as ee,p as h,st as te,z as g}from"./debug-DiuXEmUq.js";import{Jt as ne,Zt as re}from"./settings-BhvhCpVh.js";import{C as ie,S as ae,b as oe,c as _,g as se,w as v}from"./config-662VDD70.js";import{n as y,r as b}from"./execFileNoThrow-DResQRvR.js";import{o as x,s as S}from"./log-Duzb4o6h.js";import{n as C,r as w}from"./analytics-BotDBGh0.js";import{vn as ce,yn as le}from"./model-BgrLt7P7.js";import{_ as ue,y as de}from"./metadata-CIx5CsoY.js";import{n as fe,r as pe,t as me}from"./semver-BMRJYn3q.js";import{C as he,S as ge,_ as _e,a as T,b as ve,c as ye,d as be,g as xe,h as Se,i as Ce,l as we,n as Te,o as E,p as Ee,s as De,t as Oe,v as D,x as ke,y as Ae}from"./pidLock-DchmaAK6.js";import{a as je,i as Me,n as Ne,r as Pe,t as Fe}from"./xdg-DcF9ejUM.js";import{homedir as O}from"os";import{basename as Ie,delimiter as Le,dirname as k,join as A,resolve as j}from"path";import{constants as Re}from"fs";import{createHash as ze}from"crypto";import{access as M,chmod as N,copyFile as P,mkdir as F,readdir as I,readlink as L,rename as R,rm as z,rmdir as Be,stat as B,symlink as Ve,unlink as V,writeFile as He}from"fs/promises";async function Ue(e=`latest`){let t=Date.now(),{stdout:n,code:r,stderr:i}=await y(`npm`,[`view`,`@${e}`,`version`,`--prefer-online`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0}),a=Date.now()-t;if(r!==0){w(`tengu_version_check_failure`,{latency_ms:a,source_npm:!0,exit_code:r});let e=Error(`npm view failed with code ${r}: ${i}`);throw S(e),e}return w(`tengu_version_check_success`,{latency_ms:a,source_npm:!0}),h(`npm view @${e} version: ${n}`),n.trim()}async function We(e=`latest`,t,n){let i=Date.now();try{let a=await r.get(`${t}/${e}`,{timeout:3e4,responseType:`text`,...n});return w(`tengu_version_check_success`,{latency_ms:Date.now()-i}),a.data.trim()}catch(n){let a=Date.now()-i,o=n instanceof Error?n.message:String(n),s;r.isAxiosError(n)&&n.response&&(s=n.response.status),w(`tengu_version_check_failure`,{latency_ms:a,http_status:s,is_timeout:o.includes(`timeout`)});let c=Error(`Failed to fetch version from ${t}/${e}: ${o}`);throw S(c),c}}async function Ge(e){if(/^v?\d+\.\d+\.\d+(-\S+)?$/.test(e)){let t=e.startsWith(`v`)?e.slice(1):e;if(/^99\.99\./.test(t))throw Error(`Version ${t} is not available for installation. Use 'stable' or 'latest'.`);return t}let t=e;if(t!==`stable`&&t!==`latest`)throw Error(`Invalid channel: ${e}. Use 'stable' or 'latest'`);return process.env.USER_TYPE===`ant`?Ue(t===`stable`?`stable`:`latest`):We(t,H)}async function Ke(e,t){let n=p();await n.rm(t,{recursive:!0,force:!0});let r=W(),i=`-${r}`;h(`Fetching integrity hash for ${i}@${e}`);let{stdout:o,code:s,stderr:c}=await y(`npm`,[`view`,`${i}@${e}`,`dist.integrity`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0});if(s!==0)throw Error(`npm view integrity failed with code ${s}: ${c}`);let l=o.trim();if(!l)throw Error(`Failed to fetch integrity hash for ${i}@${e}`);h(`Got integrity hash for ${r}: ${l}`),await n.mkdir(t);let d={name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},f={name:`claude-native-installer`,version:`0.0.1`,lockfileVersion:3,requires:!0,packages:{"":{name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},"node_modules/":{version:e,optionalDependencies:{[i]:e}},[`node_modules/${i}`]:{version:e,integrity:l}}};a(A(t,`package.json`),u(d,null,2),{encoding:`utf8`,flush:!0}),a(A(t,`package-lock.json`),u(f,null,2),{encoding:`utf8`,flush:!0});let m=await y(`npm`,[`ci`,`--prefer-online`,`--registry`,U],{timeout:6e4,preserveOutputOnError:!0,cwd:t});if(m.code!==0)throw Error(`npm ci failed with code ${m.code}: ${m.stderr}`);h(`Successfully downloaded and verified @${e}`)}function qe(){return Number(process.env.CLAUDE_CODE_STALL_TIMEOUT_MS_FOR_TESTING)||Ze}async function Je(e,t,n,i={}){let a;for(let o=1;o<=3;o++){let s=new AbortController,c,u=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{u(),c=setTimeout(e=>e.abort(),qe(),s)};try{d();let a=await r.get(e,{timeout:5*6e4,responseType:`arraybuffer`,signal:s.signal,onDownloadProgress:()=>{d()},...i});u();let o=ze(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await He(n,Buffer.from(a.data)),await N(n,493);return}catch(e){u();let t=r.isCancel(e);if(a=t?new Qe:l(e),t&&o<3){h(`Download stalled on attempt ${o}/3, retrying...`),await le(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ye(e,t,n,i){let a=p();await a.rm(t,{recursive:!0,force:!0});let o=W(),s=Date.now();w(`tengu_binary_download_attempt`,{});let c;try{c=(await r.get(`${n}/${e}/manifest.json`,{timeout:1e4,responseType:`json`,...i})).data}catch(t){let i=Date.now()-s,a=t instanceof Error?t.message:String(t),o;throw r.isAxiosError(t)&&t.response&&(o=t.response.status),w(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),S(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw w(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=G(o),f=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let m=A(t,d);try{await Je(f,u,m,i||{}),w(`tengu_binary_download_success`,{latency_ms:Date.now()-s})}catch(e){let t=Date.now()-s,n=e instanceof Error?e.message:String(e),i;throw r.isAxiosError(e)&&e.response&&(i=e.response.status),w(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),S(Error(`Failed to download binary from ${f}: ${n}`)),e}}async function Xe(e,t){return process.env.USER_TYPE===`ant`?(await Ke(e,t),`npm`):(await Ye(e,t,H),`binary`)}var H,U,Ze,Qe,$e=e((()=>{i(),C(),m(),d(),b(),f(),x(),ce(),s(),$(),H=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,U=`https://artifactory.infra.ant.dev/artifactory/api/npm/npm-all/`,Ze=6e4,Qe=class extends Error{constructor(){super(`Download stalled: no data received for 60 seconds`),this.name=`StallTimeoutError`}}}));function W(){let e=ne.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw h(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&ue.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function G(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function K(){let e=G(W());return{versions:A(Pe(),`claude`,`versions`),staging:A(Ne(),`claude`,`staging`),locks:A(Me(),`claude`,`locks`),executable:A(Fe(),e)}}async function q(e){try{let t=await B(e);return!t.isFile()||t.size===0?!1:(await M(e,Re.X_OK),!0)}catch{return!1}}async function J(e){let t=K(),n=[t.versions,t.staging,t.locks];await Promise.all(n.map(e=>F(e,{recursive:!0}))),await F(k(t.executable),{recursive:!0});let r=A(t.versions,e);try{await B(r)}catch{await He(r,``,{encoding:`utf8`})}return{stagingPath:A(t.staging,e),installPath:r}}async function et(e,t,n=0){let r=K(),i=Y(r,e);if(await F(r.locks,{recursive:!0}),E()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await ye(e,i,async()=>{try{await t()}catch(e){throw S(e),e}}))return w(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await le(Math.min(o*2**(r-1),s))}return w(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:a}),X(e,Error(`Lock held by another process`)),!1}let a=null;try{try{a=await v(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{h(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return w(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),w(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw S(e),e}}finally{a&&await a()}}async function tt(e,t){await F(k(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await P(e,n),await N(n,493),await R(n,t),h(`Atomically installed binary to ${t}`)}catch(e){try{await V(n)}catch{}throw e}}async function nt(e,t){try{let n=A(e,`node_modules`,`@anthropic-ai`),r=(await I(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw w(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=A(n,r,`cli`);try{await B(i)}catch{throw w(`tengu_native_install_package_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Native binary not found in staged package`)}await tt(i,t),await z(e,{recursive:!0,force:!0}),w(`tengu_native_install_package_success`,{})}catch(e){let t=g(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&w(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),S(l(e)),e}}async function rt(e,t){try{let n=A(e,G(W()));try{await B(n)}catch{throw w(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await tt(n,t),await z(e,{recursive:!0,force:!0}),w(`tengu_native_install_binary_success`,{})}catch(e){throw g(e).includes(`Staged binary not found`)||w(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),S(l(e)),e}}async function it(e,t,n){n===`npm`?await nt(e,t):await rt(e,t)}async function at(e,n){let{stagingPath:r,installPath:i}=await J(e),{executable:a}=K(),o=t(process.env.ENABLE_LOCKLESS_UPDATES)?`${r}.${process.pid}.${Date.now()}`:r,s=!await ot(e)||n;if(s?(h(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await it(o,i,await Xe(e,o))):h(`Version ${e} already installed, updating symlink`),await ct(a),await lt(a,i),!await q(a)){let e=!1;try{await B(i),e=!0}catch{}throw Error(`Failed to create executable at ${a}. Source file exists: ${e}. Check write permissions to ${a}.`)}return s}async function ot(e){let{installPath:t}=await J(e);return q(t)}async function st(e,n=!1){let r=Date.now(),i=await Ge(e),{executable:a}=K();if(h(`Checking for native installer update to version ${i}`),!n){let e=await Ee();if(e&&me(i,e)){if(h(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),fe(`0.0.2`,e))return h(`Native installer: current version 0.0.2 is already at or above maxVersion ${e}, skipping update`),w(`tengu_native_update_skipped_max_version`,{latency_ms:Date.now()-r,max_version:e,available_version:i}),{success:!0,latestVersion:i};i=e}}if(!n&&i===`0.0.2`&&await ot(i)&&await q(a))return h(`Found ${i} at ${a}, skipping install`),w(`tengu_native_update_complete`,{latency_ms:Date.now()-r,was_new_install:!1,was_force_reinstall:!1,was_already_running:!0}),{success:!0,latestVersion:i};if(!n&&xe(i))return w(`tengu_native_update_skipped_minimum_version`,{latency_ms:Date.now()-r,target_version:i}),{success:!0,latestVersion:i};let o=!1,s;if(t(process.env.ENABLE_LOCKLESS_UPDATES))o=await at(i,n),s=Date.now()-r;else{let{installPath:e}=await J(i);n&&await ht(e);let t=await et(e,async()=>{o=await at(i,n)},3);if(s=Date.now()-r,!t){let t=K(),n;if(E()){let r=Y(t,e);T(r)&&(n=De(r)?.pid)}return w(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return w(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),h(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function ct(e){try{await Be(e),h(`Removed empty directory at ${e}`)}catch(t){let n=o(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&h(`Could not remove directory at ${e}: ${t}`)}}async function lt(e,t){if(W().startsWith(`win32`))try{await F(k(e),{recursive:!0});let n;try{n=await B(e)}catch{}if(n){try{let e=await B(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await R(e,r);try{await P(t,e);try{await V(r)}catch{}}catch(t){try{await R(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw S(n),n}throw t}}else try{await P(t,e)}catch(e){throw c(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return S(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=k(e);try{await F(n,{recursive:!0}),h(`Created directory ${n} for symlink`)}catch(e){return S(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await B(e),n=!0}catch{}if(n){try{let n=await L(e);if(j(k(e),n)===j(t))return!1}catch{}await V(e)}}catch(e){S(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await Ve(t,r),await R(r,e),h(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await V(r)}catch{}return S(Error(`Failed to create symlink from ${e} to ${t}: ${n}`)),!1}}async function ut(e=!1){if(t(process.env.DISABLE_INSTALLATION_CHECKS))return[];let n=await we();if(n===`development`)return[];let r=_();if(!(e||n===`native`||r.installMethod===`native`))return[];let i=K(),a=[],o=k(i.executable),s=j(o),l=W().startsWith(`win32`);try{await M(o)}catch{a.push({message:`installMethod is native, but directory ${o} does not exist`,userActionRequired:!0,type:`error`})}if(l)await q(i.executable)||a.push({message:`installMethod is native, but claude command is missing or invalid at ${i.executable}`,userActionRequired:!0,type:`error`});else try{let e=await L(i.executable);await q(j(k(i.executable),e))||a.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){c(e)?a.push({message:`installMethod is native, but claude command not found at ${i.executable}`,userActionRequired:!0,type:`error`}):await q(i.executable)||a.push({message:`${i.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Le).some(e=>{try{let t=j(e);return l?t.toLowerCase()===s.toLowerCase():t===s}catch{return!1}}))if(l){let e=o.replace(/\//g,`\\`);a.push({message:`Native installation exists but ${e} is not in your PATH. Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`,userActionRequired:!0,type:`path`})}else{let e=ge(),t=D()[e],n=t?t.replace(O(),`~`):`your shell config file`;a.push({message:`Native installation exists but ~/.local/bin is not in your PATH. Run:\n\necho 'export PATH="$HOME/.local/bin:$PATH"' >> ${n} && source ${n}`,userActionRequired:!0,type:`path`})}return a}function dt(e,t=!1){if(t)return ft(e,t);if(Q)return h(`installLatest: joining in-flight call`),Q;let n=ft(e,t);Q=n;let r=()=>{Q=null};return n.then(r,r),n}async function ft(e,t=!1){let n=await st(e,t);return n.success?(_().installMethod!==`native`&&(oe(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),h(`Native installer: Set installMethod to "native" and disabled legacy auto-updater for protection`)),gt(),{latestVersion:n.latestVersion,wasUpdated:n.success,lockFailed:!1}):{latestVersion:null,wasUpdated:!1,lockFailed:n.lockFailed,lockHolderPid:n.lockHolderPid}}async function pt(e){try{let t=await L(e),n=j(k(e),t);if(await q(n))return n}catch{}return null}function Y(e,t){let n=Ie(t);return A(e.locks,`${n}.lock`)}async function mt(){let e=K();if(!process.execPath.includes(e.versions))return;let t=j(process.execPath);try{let n=Y(e,t);if(await F(e.locks,{recursive:!0}),E()){if(!await Oe(t,n)){w(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}w(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),h(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await v(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{h(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),w(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),h(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(c(e)){h(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}w(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(c(e)){h(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}h(`NON-FATAL: Failed to lock current version during execution ${g(e)}`,{level:`info`})}}function X(e,t){S(Error(`NON-FATAL: Lock acquisition failed for ${e} (expected in multi-process scenarios)`,{cause:t}))}async function ht(e){let t=Y(K(),e);try{await V(t),h(`Force-removed lock file at ${t}`)}catch(e){h(`Failed to force-remove lock file: ${g(e)}`)}}async function gt(){await Promise.resolve();let e=K(),t=Date.now()-36e5;if(W().startsWith(`win32`)){let t=k(e.executable);try{let e=await I(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await V(A(t,r)),n++}catch{}n>0&&h(`Cleaned up ${n} old Windows executables on startup`)}catch(e){c(e)||h(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await I(e.staging),r=0;for(let i of n){let n=A(e.staging,i);try{(await B(n)).mtime.getTime()<t&&(await z(n,{recursive:!0,force:!0}),r++,h(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(h(`Cleaned up ${r} orphaned staging directories`),w(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){c(e)||h(`Failed to clean up staging directories: ${e}`)}if(E()){let t=Te(e.locks);t>0&&(h(`Cleaned up ${t} stale version locks`),w(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await I(e.versions)}catch(e){c(e)||h(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=A(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await B(n)).mtime.getTime()<t&&(await V(n),i++,h(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await B(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:j(n),mtime:e.mtime})}catch{}}if(i>0&&(h(`Cleaned up ${i} orphaned temp install files`),w(`tengu_native_temp_files_cleanup`,{cleaned_count:i})),r.length!==0)try{let t=process.execPath,n=new Set;t&&t.includes(e.versions)&&n.add(j(t));let i=await pt(e.executable);i&&n.add(i);for(let t of r){if(n.has(t.resolvedPath))continue;let r=Y(e,t.resolvedPath),i=!1;if(E())i=T(r);else try{i=await ae(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),h(`Protecting locked version from cleanup: ${t.name}`))}let a=r.filter(e=>!n.has(e.resolvedPath)).sort((e,t)=>t.mtime.getTime()-e.mtime.getTime()).slice(2);if(a.length===0){w(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:0,protected_count:n.size,retained_count:2,lock_failed_count:0,error_count:0});return}let o=0,s=0,c=0;await Promise.all(a.map(async e=>{try{await et(e.path,async()=>{await V(e.path)})?o++:(s++,h(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,S(Error(`Failed to delete version ${e.name}: ${t}`))}})),w(`tengu_native_version_cleanup`,{total_count:r.length,deleted_count:o,protected_count:n.size,retained_count:2,lock_failed_count:s,error_count:c})}catch(e){c(e)||S(Error(`Version cleanup failed: ${e}`))}}async function _t(){let e=[],t=D();for(let[n,r]of Object.entries(t))try{let t=await ve(r);if(!t)continue;let{filtered:i,hadAlias:a}=_e(t);a&&(await ke(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),h(`Cleaned up claude alias from ${n} config`))}catch(t){S(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function vt(e){try{let t=await y(`npm`,[`config`,`get`,`prefix`]);if(t.code!==0||!t.stdout)return{success:!1,error:`Failed to get npm global prefix`};let n=t.stdout.trim(),r=!1;async function i(e,t){try{return await V(e),h(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(W().startsWith(`win32`)){let e=A(n,`claude.cmd`),t=A(n,`claude.ps1`),a=A(n,`claude`);await i(e,`bin script`)&&(r=!0),await i(t,`PowerShell script`)&&(r=!0),await i(a,`bin executable`)&&(r=!0)}else await i(A(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(h(`Successfully removed ${e} manually`),{success:!0,warning:`${e} executables removed, but node_modules directory was left intact for safety. You may manually delete it later at: ${W().startsWith(`win32`)?A(n,`node_modules`,e):A(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return h(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function yt(e){let{code:t,stderr:n}=await y(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return h(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){h(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),h(`Attempting manual removal due to ENOTEMPTY error`);let t=await vt(e);if(t.success)return{success:!0,warning:t.warning};if(t.error)return{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}. Manual removal also failed: ${t.error}`}}return h(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),{success:!1,error:`Failed to remove global npm installation of ${e}: ${n}`}}return{success:!1}}async function bt(){let e=[],t=[],n=0,r=await yt(`@anthropic-ai/claude-code`);r.success?(n++,r.warning&&t.push(r.warning)):r.error&&e.push(r.error);let i=A(O(),`.claude`,`local`);try{await z(i,{recursive:!0}),n++,h(`Removed local installation at ${i}`)}catch(t){c(t)||(e.push(`Failed to remove ${i}: ${t}`),h(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{C(),Se(),ee(),se(),m(),be(),re(),de(),n(),d(),b(),he(),ie(),x(),pe(),Ae(),ce(),je(),$e(),Ce(),Z=10080*60*1e3,Q=null})),xt=e((()=>{$()}));export{_t as a,mt as c,gt as i,ut as n,$ as o,bt as r,dt as s,xt as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./parser-TYEkLFgh.js";t();export{e as parseCommand};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,Wt as o,Xn as s,a as c,di as l,fi as u,hn as d,k as f,kt as p,n as m,o as ee,ot as h,r as g,s as te,t as _,ui as v,x as ne,y}from"./src-CDCSSo0U2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{en as re,nt as x}from"./state-ix0xIunV.js";import{B as ie,BC as S,G as C,H as ae,IC as w,IE as T,K as E,NE as D,Nb as O,Pb as k,TS as A,U as oe,V as se,VC as ce,_o as j,_u as M,ex as le,fS as ue,lS as N,tx as de,uS as fe,vu as P,zo as pe}from"./loadAgentsDir-ZQwvbURI.js";import{E as F,O as I}from"./debug-DiuXEmUq.js";import{B as L,L as R,an as z,dn as me,g as B,o as V,z as he}from"./settings-BhvhCpVh.js";import{l as ge,o as _e}from"./stringUtils-D_g2L6A4.js";import{u as H}from"./referral-Cu9bEOFE.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-vzUoPY51.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-BgNp7glC.js";import{t as Se}from"./SearchBox-vfLXEPed.js";import{n as Ce,t as we}from"./useSearchInput-B1UOjxAI.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-DDSOFi1W.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case M.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,W.jsxs)(a,{dimColor:!0,children:[`Any Bash command starting with `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,W.jsxs)(a,{dimColor:!0,children:[`The Bash command `,(0,W.jsx)(a,{bold:!0,children:e.ruleContent})]}):(0,W.jsx)(a,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,W.jsxs)(a,{dimColor:!0,children:[`Any use of the `,(0,W.jsx)(a,{bold:!0,children:e.toolName}),` tool`]})}}var W,ke=e((()=>{u(),_(),P(),W=b()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${V(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${V(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function je({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:o,setToolPermissionContext:s}){let c=z.map(Ae),l=(0,Me.useCallback)(i=>{if(i===`cancel`){t();return}else if(z.includes(i)){let t=i,a=w(o,{type:`addRules`,rules:n,behavior:r,destination:t});ce({type:`addRules`,rules:n,behavior:r,destination:t}),s(a);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Ee(a,{sandboxAutoAllowEnabled:D.isSandboxingEnabled()&&D.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,o,s]);return(0,G.jsxs)(y,{title:`Add ${r} permission ${ge(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,G.jsx)(i,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,G.jsxs)(i,{flexDirection:`column`,children:[(0,G.jsx)(a,{bold:!0,children:L(e)}),(0,G.jsx)(Oe,{ruleValue:e})]},L(e)))}),(0,G.jsxs)(i,{flexDirection:`column`,marginY:1,children:[(0,G.jsx)(a,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,G.jsx)(O,{options:c,onChange:l})]})]})}var Me,G,Ne=e((()=>{u(),Me=t(u(),1),k(),_(),S(),R(),Te(),T(),me(),B(),_e(),ke(),G=b()}));function Pe({onCancel:e,onSubmit:t,ruleBehavior:n}){let[s,c]=(0,Fe.useState)(``),[l,u]=(0,Fe.useState)(0),d=ve();o(`confirm:no`,e,{context:`Settings`});let{columns:f}=h(),m=f-6;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,K.jsxs)(a,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,K.jsxs)(i,{flexDirection:`column`,children:[(0,K.jsxs)(a,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,K.jsx)(p,{}),`e.g., `,(0,K.jsx)(a,{bold:!0,children:L({toolName:M.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:L({toolName:M.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(le,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(he(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:m,cursorOffset:l,onChangeCursorOffset:u})})]})]}),(0,K.jsx)(i,{marginLeft:3,children:d.pending?(0,K.jsxs)(a,{dimColor:!0,children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsx)(a,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Fe,K,Ie=e((()=>{n(),u(),Fe=t(u(),1),de(),ye(),A(),_(),H(),P(),R(),K=b()}));function Le({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=c();(0,q.useEffect)(()=>{e?.(n)},[n,e]);let[o]=(0,q.useState)(()=>De()),[s,l]=(0,q.useState)(()=>new Set),[u,f]=(0,q.useState)(()=>new Set),[p,m]=(0,q.useState)(0);(0,q.useEffect)(()=>{t({approved:s,retry:u,denials:o})},[s,u,o,t]);let ee=(0,q.useCallback)(e=>{let t=Number(e);l(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),h=(0,q.useCallback)(e=>{m(Number(e))},[]);if(d((e,t)=>{e===`r`&&(f(e=>{let t=new Set(e);return t.has(p)?t.delete(p):t.add(p),t}),l(e=>{if(e.has(p))return e;let t=new Set(e);return t.add(p),t}))},{isActive:o.length>0}),o.length===0)return(0,J.jsx)(a,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let g=o.map((e,t)=>{let n=s.has(t),r=u.has(t)?` (retry)`:``;return{label:(0,J.jsxs)(a,{children:[(0,J.jsx)(te,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,J.jsx)(a,{dimColor:!0,children:r})]}),value:String(t)}});return(0,J.jsxs)(i,{flexDirection:`column`,children:[(0,J.jsx)(a,{children:`Commands recently denied by the auto mode classifier.`}),(0,J.jsx)(i,{marginTop:1,children:(0,J.jsx)(O,{options:g,onChange:ee,onFocus:h,visibleOptionCount:Math.min(10,g.length),isDisabled:n,onUpFromFirstItem:r})})]})}var q,J,Re=e((()=>{u(),q=t(u(),1),_(),U(),k(),J=b()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Be.useCallback)(()=>{o(w(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,o,t]),c=(0,Be.useCallback)(e=>{e===`yes`?s():n()},[s,n]);return(0,Y.jsxs)(y,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(i,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(a,{bold:!0,children:e})}),(0,Y.jsx)(a,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(O,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{u(),Be=t(u(),1),k(),_(),S(),Y=b()}));function He({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:o,onHeaderFocusChange:s}){let{headerFocused:l,focusHeader:u}=c();(0,X.useEffect)(()=>{s?.(l)},[l,s]);let d=Ue.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),f=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=d.find(t=>t.path===e);t&&t.isDeletable&&o(t.path)},[d,n,o]),p=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),m=Ue.useMemo(()=>{let e=d.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[d]);return(0,Z.jsxs)(i,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(i,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(a,{children:`- ${x()}`}),(0,Z.jsx)(a,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(O,{options:m,onChange:f,onCancel:p,visibleOptionCount:Math.min(10,m.length),onUpFromFirstItem:u,isDisabled:l})]})}var Ue,X,Z,We=e((()=>{n(),Ue=t(u(),1),X=t(u(),1),re(),k(),_(),Z=b()}));function Ge({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${E(e.source)}`})}function Ke(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function qe({rule:e,onDelete:t,onCancel:n}){let r=ve();o(`confirm:no`,n,{context:`Confirmation`});let s=(0,$.jsxs)(i,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(a,{bold:!0,children:L(e.ruleValue)}),(0,$.jsx)(Oe,{ruleValue:e.ruleValue}),(0,$.jsx)(Ge,{rule:e})]}),c=(0,$.jsx)(i,{marginLeft:3,children:r.pending?(0,$.jsxs)(a,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(a,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(a,{bold:!0,color:`permission`,children:`Rule details`}),s,(0,$.jsxs)(a,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
-
`,`Contact your system administrator for more information.`]})]}),c]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(i,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(a,{bold:!0,color:`error`,children:[`Delete `,Ke(e.ruleBehavior),` tool?`]}),s,(0,$.jsx)(a,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(O,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),c]})}function Je(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:a,onSelect:o,onCancel:s,lastFocusedRuleKey:l,cursorOffset:u,onHeaderFocusChange:d}=e,p=ee(),{headerFocused:m,focusHeader:h,blurHeader:g}=c();return(0,Q.useEffect)(()=>{r&&m&&g()},[r,m,g]),(0,Q.useEffect)(()=>{d?.(m)},[m,d]),(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(i,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(f,{query:n,isFocused:r&&!m,isTerminalFocused:a,width:p,cursorOffset:u})}),(0,$.jsx)(O,{options:t,onChange:o,onCancel:s,visibleOptionCount:Math.min(10,t.length),isDisabled:r||m,defaultFocusValue:l,onUpFromFirstItem:h})]})}function Ye({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(i,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(a,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Je,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Xe({onExit:e,initialTab:t,onRetryDenials:n}){let c=De().length>0,l=t??(c?`recent`:`allow`),[u,d]=(0,Q.useState)([]),f=fe(e=>e.toolPermissionContext),p=ue(),ee=s(),h=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),te=(0,Q.useCallback)(e=>{h.current=e},[]),[_,y]=(0,Q.useState)(),[b,re]=(0,Q.useState)(),[x,S]=(0,Q.useState)(null),[C,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,j]=(0,Q.useState)(!1),[M,le]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{le(e)},[]),de=(0,Q.useMemo)(()=>{let e=new Map;return se(f).forEach(t=>{e.set(I(t),t)}),e},[f]),P=(0,Q.useMemo)(()=>{let e=new Map;return oe(f).forEach(t=>{e.set(I(t),t)}),e},[f]),pe=(0,Q.useMemo)(()=>{let e=new Map;return ae(f).forEach(t=>{e.set(I(t),t)}),e},[f]),F=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return de;case`deny`:return P;case`ask`:return pe;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=L(r.ruleValue).toLowerCase(),t=L(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=L(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[de,P,pe]),R=ve(),z=!_&&!x&&!C&&!E&&!O,{query:me,setQuery:B,cursorOffset:V}=Ce({isActive:z&&A,onExit:()=>{j(!1)}}),he=(0,Q.useCallback)(e=>{z&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),j(!0),B(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),j(!0),B(e.key))))},[z,A,B]),ge=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=F(t);if(e===`add-new-rule`){S(t);return}else{y(n.get(e));return}},[F]),_e=(0,Q.useCallback)(()=>{S(null)},[]),H=(0,Q.useCallback)((e,t)=>{T({ruleValue:e,ruleBehavior:t}),S(null)},[]),ye=(0,Q.useCallback)((e,t)=>{T(null);for(let t of e)d(e=>[...e,`Added ${t.ruleBehavior} rule ${v.bold(L(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;d(n=>[...n,v.yellow(`${r.warning} Warning: ${L(e.rule.ruleValue)} is ${t}`),v.dim(` ${e.reason}`),v.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{T(null)},[]),Se=(0,Q.useCallback)(()=>D(!0),[]),we=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=h.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let a=r(t.approved);a.length>0||u.length>0?e([...a.length>0?[`Approved ${a.map(e=>v.bold(e.display)).join(`, `)}`]:[],...u].join(`
|
|
3
|
-
`)):e(`Permissions dialog dismissed`,{display:`system`})},[u,e,n]);o(`confirm:no`,Te,{context:`Settings`,isActive:z&&!A});let Ee=()=>{if(!_)return;let{options:e}=F(_.ruleBehavior),t=I(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),ie({rule:_,initialContext:f,setToolPermissionContext(e){p(t=>({...t,toolPermissionContext:e}))}}),d(e=>[...e,`Deleted ${_.ruleBehavior} rule ${v.bold(L(_.ruleValue))}`]),y(void 0)};if(_)return(0,$.jsx)(qe,{rule:_,onDelete:Ee,onCancel:()=>y(void 0)});if(x&&x!==`workspace`&&x!==`recent`)return(0,$.jsx)(Pe,{onCancel:_e,onSubmit:H,ruleBehavior:x});if(C)return(0,$.jsx)(je,{onAddRules:ye,onCancel:be,ruleValues:[C.ruleValue],ruleBehavior:C.ruleBehavior,initialContext:f,setToolPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=w(f,n);p(e=>({...e,toolPermissionContext:r})),t&&ce(n),d(n=>[...n,`Added directory ${v.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:f});if(O)return(0,$.jsx)(ze,{directoryPath:O,onRemove:()=>{d(e=>[...e,`Removed directory ${v.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:me,isSearchMode:A,isFocused:ee,onCancel:Te,lastFocusedRuleKey:b,cursorOffset:V,getRulesOptions:F,handleToolSelect:ge,onHeaderFocusChange:N};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:he,children:(0,$.jsxs)(ne,{color:`permission`,children:[(0,$.jsxs)(g,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!_||!!x||!!C||E||!!O,initialHeaderFocused:!c,navFromContent:!A,children:[(0,$.jsx)(m,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:N,onStateChange:te})}),(0,$.jsx)(m,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ye,{tab:`allow`,...U})}),(0,$.jsx)(m,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ye,{tab:`ask`,...U})}),(0,$.jsx)(m,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ye,{tab:`deny`,...U})}),(0,$.jsx)(m,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(i,{flexDirection:`column`,children:[(0,$.jsx)(a,{children:`Claude Code can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(He,{onExit:e,toolPermissionContext:f,onRequestAddDirectory:Se,onRequestRemoveDirectory:we,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(i,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(a,{dimColor:!0,children:R.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,R.keyName,` again to exit`]}):M?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):c&&l===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,Ze=e((()=>{l(),n(),u(),Q=t(u(),1),N(),S(),k(),ye(),we(),_(),H(),U(),R(),C(),F(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=b()})),Qe,$e;e((()=>{Ze(),pe(),Qe=b(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,j(e)])}})}))();export{$e as call};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./axios-DaWTGg7G.js";import{IE as l,NE as u,OS as ee}from"./loadAgentsDir-ZQwvbURI.js";import{n as te}from"./cwd-CYmmnQVS.js";import{A as ne,D as d,E as f,G as p,J as re,K as ie,M as ae,O as oe,U as m,_ as h,h as g,l as _,p as v}from"./debug-DiuXEmUq.js";import{A as y,Jt as se,M as ce,Qt as le,Zt as ue,en as de,g as fe,n as pe}from"./settings-BhvhCpVh.js";import{a as me,c as b,g as x,i as he}from"./config-662VDD70.js";import{c as ge,n as S,o as _e,r as C,t as w}from"./execFileNoThrow-DResQRvR.js";import{o as T,s as E}from"./log-Duzb4o6h.js";import{n as ve,t as ye}from"./which-sEFQXpaX.js";import{i as D,o as O}from"./platform-B5dCGT8t.js";import{n as k,t as be}from"./bundledMode--fG1S62b.js";import{i as xe,r as Se}from"./genericProcessUtils-DO7Fy0RJ.js";import{a as Ce,i as we}from"./ripgrep-BN_g-F7X.js";import{n as Te,r as Ee}from"./semver-BMRJYn3q.js";import{homedir as A}from"os";import{basename as De,delimiter as Oe,join as j,posix as M,win32 as N}from"path";import{constants as ke}from"fs";import{access as P,open as Ae,readFile as F,realpath as I,stat as je}from"fs/promises";function L(){return j(a(),`local`)}function Me(){return j(L(),`claude`)}function Ne(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function R(){try{return await P(j(L(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function z(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var B=e((()=>{x(),o(),m(),C(),h(),T(),f()}));function V(e){let t=e?.homedir??A();return{zsh:j((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:j(t,`.bashrc`),fish:j(t,`.config/fish/config.fish`)}}function Pe(e){let t=!1;return{filtered:e.filter(e=>{if(H.test(e)){let n=e.match(/alias\s+claude\s*=\s*["']([^"']+)["']/);if(n||(n=e.match(/alias\s+claude\s*=\s*([^#\n]+)/)),n&&n[1]&&n[1].trim()===Me())return t=!0,!1}return!0}),hadAlias:t}}async function Fe(e){try{return(await F(e,{encoding:`utf8`})).split(`
|
|
2
|
-
`)}catch(e){if(ie(e))return null;throw e}}async function Ie(e,t){let n=await Ae(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
-
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function Le(e){let t=V(e);for(let e of Object.values(t)){let t=await Fe(e);if(t){for(let e of t)if(H.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function Re(e){let t=await Le(e);if(!t)return null;let n=e?.homedir??A(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await je(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var H,U=e((()=>{m(),B(),H=/^\s*alias\s+claude\s*=/}));async function ze(){let e=await Be();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Be(){try{return{}}catch(e){return E(e),{}}}function Ve(e){let t=pe()?.minimumVersion;if(!t)return!1;let n=!Te(e,t);return n&&v(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function He(){let e=se.isRunningWithBun(),t=null;return t=e?await S(`bun`,[`pm`,`bin`,`-g`],{cwd:A()}):await S(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:A()}),t.code===0?t.stdout.trim():(E(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function Ue(){try{let e=await He();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await P(e,ke.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return E(new Je(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return E(e),{hasPermissions:!1,npmPrefix:null}}}async function We(){let e=await S(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:A()});if(e.code!==0)return v(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=d(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return v(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ge(e){try{return(await s.get(`${qe}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return v(`Failed to fetch ${e} from GCS: ${t}`),null}}async function Ke(){let[e,t]=await Promise.all([Ge(`latest`),Ge(`stable`)]);return{latest:e,stable:t}}var qe,Je,Ye=e((()=>{c(),x(),_(),ue(),o(),m(),C(),h(),ee(),T(),Ee(),fe(),U(),f(),qe=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Je=class extends ae{}}));function W(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Xe(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(v(`Detected mise installation: ${e}`),!0):!1}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(v(`Detected asdf installation: ${e}`),!0):!1}function G(){let e=D();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(v(`Detected Homebrew cask installation: ${t}`),!0):!1}function Qe(){if(D()!==`windows`)return!1;let e=process.execPath||process.argv[0]||``;for(let t of[/Microsoft[/\\]WinGet[/\\]Packages/i,/Microsoft[/\\]WinGet[/\\]Links/i])if(t.test(e))return v(`Detected winget installation: ${e}`),!0;return!1}var K,q,J,Y,X,$e,et=e((()=>{n(),_(),C(),O(),K=t(async()=>{try{let e=await F(`/etc/os-release`,`utf8`),t=e.match(/^ID=["']?(\S+?)["']?\s*$/m),n=e.match(/^ID_LIKE=["']?(.+?)["']?\s*$/m);return{id:t?.[1]??``,idLike:n?.[1]?.split(` `)??[]}}catch{return null}}),q=t(async()=>{if(D()!==`linux`)return!1;let e=await K();if(e&&!W(e,[`arch`]))return!1;let t=await w(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(v(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(D()!==`linux`)return!1;let e=await K();if(e&&!W(e,[`debian`]))return!1;let t=await w(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(v(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(D()!==`linux`)return!1;let e=await K();if(e&&!W(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await w(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(v(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),X=t(async()=>{if(D()!==`linux`)return!1;let e=await K();if(e&&!W(e,[`alpine`]))return!1;let t=await w(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(v(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),$e=t(async()=>G()?`homebrew`:Qe()?`winget`:Xe()?`mise`:Ze()?`asdf`:await q()?`pacman`:await X()?`apk`:await J()?`deb`:await Y()?`rpm`:`unknown`)}));function tt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return D()===`windows`&&(e=e.split(N.sep).join(M.sep),t=t.split(N.sep).join(M.sep)),[e,t]}async function nt(){let[e]=tt();if(k())return G()||Qe()||Xe()||Ze()||await q()||await J()||await Y()||await X()?`package-manager`:`native`;if(Ne())return`npm-local`;if([`/usr/local/lib/node_modules`,`/usr/lib/node_modules`,`/opt/homebrew/lib/node_modules`,`/opt/homebrew/bin`,`/usr/local/bin`,`/.nvm/versions/node/`].some(t=>e.includes(t))||e.includes(`/npm/`)||e.includes(`/nvm/`))return`npm-global`;let t=await _e(`npm config get prefix`,{shell:!0,reject:!1}),n=t.exitCode===0?t.stdout.trim():null;return n&&e.startsWith(n)?`npm-global`:`unknown`}async function rt(){if(k()){try{return await I(process.execPath)}catch{}try{let e=await ve(`claude`);if(e)return e}catch{}try{return await g().stat(j(A(),`.local/bin/claude`)),j(A(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function it(){try{return k()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function at(){let e=g(),t=[],n=j(A(),`.claude`,`local`);await R()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await w(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=D()===`windows`,o=a?j(n,`claude`):j(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await I(o)).includes(`/Caskroom/`)&&(e=G())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?j(n,`node_modules`,i):j(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=j(A(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(b().installMethod===`native`){let n=j(A(),`.local`,`share`,`claude`);try{await e.stat(n),t.some(e=>e.type===`native`)||t.push({type:`native`,path:n})}catch{}}return t}async function ot(e){let t=[];try{let e=d(await F(j(le(),`managed-settings.json`),`utf-8`)),n=e&&typeof e==`object`?e.strictPluginOnlyCustomization:void 0;if(n!==void 0&&typeof n!=`boolean`)if(!Array.isArray(n))t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has an invalid value (expected true or an array, got ${typeof n})`,fix:`The field is silently ignored (schema .catch rescues it). Set it to true, or an array of: ${y.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!y.includes(e));e.length>0&&t.push({issue:`managed-settings.json: strictPluginOnlyCustomization has ${e.length} value(s) this client doesn't recognize: ${e.map(String).join(`, `)}`,fix:`These are silently ignored (forwards-compat). Known surfaces for this version: ${y.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=b();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(Oe),n=j(A(),`.local`,`bin`),r=n;if(D()===`windows`&&(r=n.split(N.sep).join(M.sep)),!e.some(e=>{let t=e;D()===`windows`&&(t=e.split(N.sep).join(M.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(D()===`windows`){let e=n.split(M.sep).join(N.sep);t.push({issue:`Native installation exists but ${e} is not in your PATH`,fix:`Add it by opening: System Properties → Environment Variables → Edit User PATH → New → Add the path above. Then restart your terminal.`})}else{let e=z(),n=V()[e],r=n?n.replace(A(),`~`):`your shell config file`;t.push({issue:`Native installation exists but ~/.local/bin is not in your PATH`,fix:`Run: echo 'export PATH="$HOME/.local/bin:$PATH"' >> ${r} then open a new terminal or run: source ${r}`})}}i(process.env.DISABLE_INSTALLATION_CHECKS)||(e===`npm-local`&&n.installMethod!==`local`&&t.push({issue:`Running from local installation but config install method is '${n.installMethod}'`,fix:`Consider using native installation: claude install`}),e===`native`&&n.installMethod!==`native`&&t.push({issue:`Running native installation but config install method is '${n.installMethod}'`,fix:`Run claude install to update configuration`})),e===`npm-global`&&await R()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await Le(),a=await Re();return e===`npm-local`&&!await ve(`claude`)&&!a&&(r?t.push({issue:`Local installation not accessible`,fix:`Alias exists but points to invalid target: ${r}. Update alias: alias claude="~/.claude/local/claude"`}):t.push({issue:`Local installation not accessible`,fix:`Create alias: alias claude="~/.claude/local/claude"`})),t}function st(){if(D()!==`linux`)return[];let e=[],t=u.getLinuxGlobPatternWarnings();if(t.length>0){let n=t.slice(0,3).join(`, `),r=t.length-3,i=r>0?`${n} (${r} more)`:n;e.push({issue:`Glob patterns in sandbox permission rules are not fully supported on Linux`,fix:`Found ${t.length} pattern(s): ${i}. On Linux, glob patterns in Edit/Read rules will be ignored.`})}return e}async function ct(){let e=await nt(),t=typeof MACRO<`u`?`0.0.2`:`unknown`,n=await rt(),r=it(),i=await at(),a=await ot(e);if(a.push(...st()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=D()===`windows`;for(let n of e)n.type===`npm-global`?a.push({issue:`Leftover npm global installation at ${n.path}`,fix:`Run: npm -g uninstall @anthropic-ai/claude-code`}):n.type===`npm-global-orphan`?a.push({issue:`Orphaned npm global package at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`}):n.type===`npm-local`&&a.push({issue:`Leftover npm local installation at ${n.path}`,fix:t?`Run: rmdir /s /q "${n.path}"`:`Run: rm -rf ${n.path}`})}let o=b().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await Ue()).hasPermissions,!s&&!me()&&a.push({issue:`Insufficient permissions for auto-updates`,fix:"Do one of: (1) Re-install node without sudo, or (2) Use `claude install` for native installation"}));let c=we(),l={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},u=e===`package-manager`?await $e():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=me();return e?`disabled (${he(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:u,ripgrepStatus:l}}var lt=e((()=>{ge(),Ye(),be(),x(),te(),o(),C(),h(),B(),et(),O(),Ce(),l(),de(),ce(),U(),f(),ye()}));function ut(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function Z(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function dt(e,t){if(!Z(e))return!1;if(e===process.pid)return!0;try{let n=Se(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Q(e){let t=g();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=d(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function $(e){let t=Q(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!Z(n))return!1;if(!dt(n,r))return v(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=g();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>vt&&!Z(n))return!1}catch{}return!0}function ft(e,t){let n=g(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ne(r,oe(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function pt(e,t){let n=g(),r=De(e);if($(t))return v(`Cannot acquire lock for ${r} - held by PID ${Q(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return ft(t,i),Q(t)?.pid===process.pid?(v(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Q(t)?.pid===process.pid&&(n.unlinkSync(t),v(`Released PID lock for ${r}`))}catch(e){v(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return v(`Failed to acquire lock for ${r}: ${e}`),null}}async function mt(e,t){let n=await pt(e,t);if(!n)return!1;let r=()=>{try{n()}catch{}};return process.on(`exit`,r),process.on(`SIGINT`,r),process.on(`SIGTERM`,r),!0}async function ht(e,t,n){let r=await pt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function gt(e){let t=g(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=j(e,t),i=Q(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:Z(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(p(e))return n;E(re(e))}return n}function _t(e){let t=g(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=j(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,v(`Cleaned up legacy directory lock: ${i}`)):$(r)||(t.unlinkSync(r),n++,v(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(p(e))return 0;E(re(e))}return n}var vt,yt=e((()=>{_(),o(),m(),h(),xe(),T(),f(),vt=7200*1e3}));export{B as C,z as S,Pe as _,$ as a,Fe as b,ht as c,lt as d,Ke as f,Ve as g,Ye as h,yt as i,nt as l,We as m,_t as n,ut as o,ze as p,gt as r,Q as s,mt as t,ct as u,V as v,Ie as x,U as y};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Es as e,Ms as t,Rs as n,Us as r,Vs as i}from"./loadAgentsDir-ZQwvbURI.js";import{U as a,l as o,p as s,z as c}from"./debug-DiuXEmUq.js";import{i as l,n as u,r as d,t as f}from"./pluginFlagging-_WUQP3Lq.js";import{d as p,s as m}from"./pluginOperations-BOkST1qE.js";m(),o(),a(),e(),i(),d();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await l();let e=t(),i=u(),a=await r(),o=[];for(let t of Object.keys(a))try{let r=await n(t);if(!r.forceRemoveDeletedPlugins)continue;let a=h(e,r,t);for(let t of a){if(t in i)continue;let n=e.plugins[t]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of n){let{scope:n}=e;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await p(t,n)}catch(e){s(`Failed to auto-uninstall delisted plugin ${t} from ${n}: ${c(e)}`,{level:`error`})}}await f(t),o.push(t)}}}catch(e){s(`Failed to check for delisted plugins in "${t}": ${c(e)}`,{level:`warn`})}return o}export{g as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./figures-5ThXQEtq.js";import{ES as n,Fv as r,Nv as i,OS as a,Pv as o,Ts as s,ws as c,xD as l,yD as u}from"./loadAgentsDir-ZQwvbURI.js";import{U as d,z as f}from"./debug-DiuXEmUq.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-Duzb4o6h.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-BOkST1qE.js";e(),d(),a(),h(),s(),u(),p(),r(),_(),T();function E(e,n,r){g(e);let a=r?`${n} plugin "${r}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${a}: ${f(e)}`);let s=r?(()=>{let{name:e,marketplace:t}=l(r);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...i(e,t,c())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:o(e),...s}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:o}=l(r.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:r.scope||n,install_source:`cli-explicit`,...i(a,o,c())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let a=await x(e,n,!r);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:o,marketplace:s}=l(a.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...s&&{_PROTO_marketplace_name:s},scope:a.scope||n,...i(o,s,c())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:o}=l(r.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...i(a,o,c())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:a,marketplace:o}=l(r.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:a,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...i(a,o,c())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),v(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,r){try{m(`Checking for updates for plugin "${e}" at ${r} scope…\n`);let a=await S(e,r);if(!a.success)throw Error(a.message);if(m(`${t.tick} ${a.message}\n`),!a.alreadyUpToDate){let{name:t,marketplace:n}=l(a.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:a.oldVersion||`unknown`,new_version:a.newVersion||`unknown`,...i(t,n,c())})}await n(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
|