@readmagic/workmate 0.0.6 → 0.0.7
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-ClHi-Dr6.js → AddWorkspaceDirectory-CFrrXnt9.js} +1 -1
- package/dist/chunks/{App-BP06lHmf.js → App-Buad9Llp.js} +1 -1
- package/dist/chunks/{ApproveApiKey-Bsy8kr2a.js → ApproveApiKey-B2HJUD7h.js} +1 -1
- package/dist/chunks/ApproveApiKey-BQbHdvc3.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-CcocKoTJ.js → AssistantSessionChooser-4lm4eXQ8.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-D4qA0M5O.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-BKj_3Idm.js → BypassPermissionsModeDialog-DllL8dxU.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +1 -0
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BD-7yAZh.js → ClaudeMdExternalIncludesDialog-BZSyRqeq.js} +1 -1
- package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +1 -0
- package/dist/chunks/{DesktopHandoff-BmPmCfT3.js → DesktopHandoff-DaP4Riar.js} +1 -1
- package/dist/chunks/{DiffDialog-C4XSSjvV.js → DiffDialog-B7hx8i_Y.js} +2 -2
- package/dist/chunks/Doctor-89OgoAUA.js +1 -0
- package/dist/chunks/Doctor-CuKJ-nGt.js +3 -0
- package/dist/chunks/ExitFlow-DnPydE17.js +2 -0
- package/dist/chunks/{Feedback-BaYA8-SU.js → Feedback-SmGiR3mf.js} +2 -2
- package/dist/chunks/{Grove-BJziCbZH.js → Grove-CjN9DO47.js} +1 -1
- package/dist/chunks/Grove-Cq88VBmM.js +1 -0
- package/dist/chunks/{HybridTransport-B8V6O6rM.js → HybridTransport-rK83Qijz.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-CHzBSJDf.js → InvalidConfigDialog-DdO0AxyF.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-BKenH3bD.js → InvalidSettingsDialog-s1G0DwXF.js} +1 -1
- package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +1 -0
- package/dist/chunks/{McpParsingWarnings-Bj2-YL8o.js → McpParsingWarnings-Du5IxZos.js} +1 -1
- package/dist/chunks/MessageSelector-iIroHvXo.js +3 -0
- package/dist/chunks/Messages-D4Hm4gaY.js +11 -0
- package/dist/chunks/{Onboarding-BrAJp0aL.js → Onboarding-BiZByBK-.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-Ds1cB7RC.js → OverageCreditUpsell-BM7szLgm.js} +1 -1
- package/dist/chunks/PluginSettings-uY5KTCtK.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-egs9VvUs.js → PromptInputFooterSuggestions-BmsFdOu9.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-SieM5NoY.js → PromptInputHelpMenu-DX-0wEDo.js} +1 -1
- package/dist/chunks/QueryEngine-CGYaShXD.js +1 -0
- package/dist/chunks/REPL-CRJB2t2z.js +142 -0
- package/dist/chunks/REPL-u4Yq29Du.js +1 -0
- package/dist/chunks/{RemoteCallout-Cs-ro8_i.js → RemoteCallout-B-tyvQOe.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-B740Dp6m.js → RemoteSessionManager-DCd0O5_l.js} +2 -2
- package/dist/chunks/ResumeConversation-DAAXlOCd.js +1 -0
- package/dist/chunks/{SSETransport-DtpMDekF.js → SSETransport-5VK5okFv.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +1 -0
- package/dist/chunks/Settings-CUjWlncb.js +2 -0
- package/dist/chunks/{TeleportProgress-rYaHIEfe.js → TeleportProgress-DxN0bQL2.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-DY97YZMB.js → TeleportRepoMismatchDialog-A5Ss0kuk.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-jaQzyTCh.js → TeleportResumeWrapper-Bz14mUqR.js} +1 -1
- package/dist/chunks/{ThemePicker-BViWzLp3.js → ThemePicker-CVSRqTzW.js} +1 -1
- package/dist/chunks/TrustDialog-CY8an_Tg.js +1 -0
- package/dist/chunks/{ValidationErrorsList-B8pRiGuy.js → ValidationErrorsList-BYsDtAvX.js} +1 -1
- package/dist/chunks/{WelcomeV2-DqnbSdIu.js → WelcomeV2-C1BfrqC5.js} +1 -1
- package/dist/chunks/{add-dir-C2Hu3oE4.js → add-dir-DfLYgwox.js} +1 -1
- package/dist/chunks/{agentDisplay-XoDJhr03.js → agentDisplay-CMmHIl86.js} +1 -1
- package/dist/chunks/{agents-C4QXeHIJ.js → agents-DE_4mAHG.js} +1 -1
- package/dist/chunks/agents-DJtPfvnL.js +103 -0
- package/dist/chunks/allErrors-CQE2k0zO.js +1 -0
- package/dist/chunks/{ant-B6k6cBts.js → ant-ClQkuQjZ.js} +1 -1
- package/dist/chunks/{api-gqTA-D7n.js → api-2cdIPaeq.js} +1 -1
- package/dist/chunks/api-CG-lhKe-.js +1 -0
- package/dist/chunks/{assistant-DJ9hd4uC.js → assistant-Bje16tQx.js} +1 -1
- package/dist/chunks/auth-DMfEiQrC.js +1 -0
- package/dist/chunks/auth-D_cGl8WD.js +1 -0
- package/dist/chunks/{auth-BnSrKyJe.js → auth-DqcKPbw8.js} +1 -1
- package/dist/chunks/{autoMode-BNukrVAB.js → autoMode-ZW70mpr0.js} +5 -5
- package/dist/chunks/{autonomy-BEmI7WVW.js → autonomy-CwbWsCnv.js} +1 -1
- package/dist/chunks/autonomy-Oui8yK8G.js +15 -0
- package/dist/chunks/{autonomyPanel-fhge09AG.js → autonomyPanel-Mq50H7iM.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BpLtI45r.js +1 -0
- package/dist/chunks/backgroundHousekeeping-DtJNx4Ja.js +17 -0
- package/dist/chunks/{branch-Bpe-gocq.js → branch-DU5O9KZ0.js} +1 -1
- package/dist/chunks/{bridge-D12Shbkj.js → bridge-DNNxtPlz.js} +2 -2
- package/dist/chunks/{bridgeConfig-BhxRF2vm.js → bridgeConfig-CE6dMsiJ.js} +1 -1
- package/dist/chunks/bridgeConfig-DP9dD1Cv.js +1 -0
- package/dist/chunks/{bridgeEnabled-SbB-6zdY.js → bridgeEnabled-Cc0mGlTb.js} +1 -1
- package/dist/chunks/bridgeEnabled-D8wP3DWQ.js +1 -0
- package/dist/chunks/bridgeMain-CwxMa_pd.js +1 -0
- package/dist/chunks/bridgeMain-D11t1BYQ.js +68 -0
- package/dist/chunks/{bridgeMessaging-DHc5dOhB.js → bridgeMessaging-DdvApEqW.js} +1 -1
- package/dist/chunks/{bridgePointer-MqLe5Asm.js → bridgePointer-DqHMHa2B.js} +1 -1
- package/dist/chunks/{btw-D9hMM5d2.js → btw-CejSEdNl.js} +1 -1
- package/dist/chunks/{caches-UeVVM3T0.js → caches-5HVQSevy.js} +2 -2
- package/dist/chunks/caches-B-nJoHLM.js +1 -0
- package/dist/chunks/{ccrClient-Iza0L8Zw.js → ccrClient-BFyfO67b.js} +1 -1
- package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-Fe-QL-sN.js} +1 -1
- package/dist/chunks/{clear-B4d38ssF.js → clear-D8m2utXW.js} +1 -1
- package/dist/chunks/client-C6MbjvOB.js +17 -0
- package/dist/chunks/client-DKXCfdde.js +1 -0
- package/dist/chunks/client-xxikkAoZ.js +1 -0
- package/dist/chunks/{color-D8VOyoYl.js → color-DWhgZH7A.js} +1 -1
- package/dist/chunks/commands-CxJpmEKF.js +1 -0
- package/dist/chunks/commitAttribution-DM6SBMwl.js +1 -0
- package/dist/chunks/{commitAttribution-ChAgixdj.js → commitAttribution-DPnHHKSA.js} +1 -1
- package/dist/chunks/compact-CblM7306.js +2 -0
- package/dist/chunks/config-BLVBFi5v.js +1 -0
- package/dist/chunks/config-CMnqm6Se.js +1 -0
- package/dist/chunks/{config-DmomySWC.js → config-DRDuVyzE.js} +2 -2
- package/dist/chunks/{context-Cl6BJ2vm.js → context-CdSMMM-0.js} +1 -1
- package/dist/chunks/context-noninteractive-CPkf2vB9.js +1 -0
- package/dist/chunks/{context-noninteractive-9hELVC29.js → context-noninteractive-DNury4JI.js} +5 -5
- package/dist/chunks/conversation-DCMw_rsE.js +1 -0
- package/dist/chunks/conversation-pUtvc-cE.js +1 -0
- package/dist/chunks/{createSSHSession-BM-5pbv6.js → createSSHSession-BOdTAX3N.js} +1 -1
- package/dist/chunks/{createSession-Cvl1Q50F.js → createSession-8Ei-Lj7V.js} +1 -1
- package/dist/chunks/createSession-CjqxVh_Q.js +1 -0
- package/dist/chunks/crossProjectResume-Bj_Pe8oe.js +40 -0
- package/dist/chunks/{datadog-CpqEQbHa.js → datadog-DqHxqiwY.js} +1 -1
- package/dist/chunks/{desktop-B_L6T6jI.js → desktop-Z5FAfunZ.js} +1 -1
- package/dist/chunks/{diff-CVzOodeg.js → diff-CJEKvOA5.js} +1 -1
- package/dist/chunks/doctor-BA2ZLDTl.js +1 -0
- package/dist/chunks/{entry-DHVYCR26.js → entry-DE0uMIf0.js} +4 -4
- package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +1 -0
- package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +1 -0
- package/dist/chunks/{esm-D5q6s4l8.js → esm-5w3xFBnt.js} +1 -1
- package/dist/chunks/exit-Dt9kHtJO.js +1 -0
- package/dist/chunks/{extra-usage-zDHVtWKZ.js → extra-usage-C7E2Z1p1.js} +1 -1
- package/dist/chunks/extra-usage-D0Kkjp-2.js +1 -0
- package/dist/chunks/{extra-usage-core-BFOolqoi.js → extra-usage-core-DjdaD1qO.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-cUGZy0en.js → extra-usage-noninteractive-BnD1RhKK.js} +1 -1
- package/dist/chunks/{extraUsage-Dq66zzqR.js → extraUsage-CpgRTcMk.js} +1 -1
- package/dist/chunks/extractMemories-DhUprYa7.js +1 -0
- package/dist/chunks/{fast-MS7WZpD8.js → fast-C4ZevUNL.js} +1 -1
- package/dist/chunks/fast-CChxlAAF.js +1 -0
- package/dist/chunks/{feedback-Fw4m28ZC.js → feedback-BIhBhV6n.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-CoSUd0a1.js → firstPartyEventLogger-BXY1IJ2D.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-CnkGSojw.js +1 -0
- package/dist/chunks/{flushGate-De-yppeo.js → flushGate-CgHq81Gw.js} +1 -1
- package/dist/chunks/{gemini-BPziscyN.js → gemini-C1J-x1g7.js} +1 -1
- package/dist/chunks/generateRecap-C0jjCg0Z.js +1 -0
- package/dist/chunks/generateSessionName-w0BMtwS7.js +1 -0
- package/dist/chunks/{githubRepoPathMapping-qAoiyj6P.js → githubRepoPathMapping-8D0kpsif.js} +1 -1
- package/dist/chunks/{goal-CFx4eRkf.js → goal-B4GsR54_.js} +3 -3
- package/dist/chunks/grok-ffNyU3Lt.js +1 -0
- package/dist/chunks/{grove-CpqjcGCb.js → grove-BQisE2JM.js} +1 -1
- package/dist/chunks/{heapdump-C4kPlqGt.js → heapdump-DiCjAPR3.js} +1 -1
- package/dist/chunks/{help-B1h-faJ3.js → help-2hn8VK2-.js} +1 -1
- package/dist/chunks/hooks-CBmrBO-J.js +1 -0
- package/dist/chunks/{hooks-X6J03MnA.js → hooks-CkA9bhHl.js} +2 -2
- package/dist/chunks/inboundAttachments-C5K3XPTC.js +1 -0
- package/dist/chunks/{inboundAttachments-CUJE3KaU.js → inboundAttachments-IH-g95jo.js} +1 -1
- package/dist/chunks/initReplBridge-C-P4dgAG.js +1 -0
- package/dist/chunks/{install-D5YORIJL.js → install-Dzlm4u58.js} +1 -1
- package/dist/chunks/{instrumentation-Bw3CxPQf.js → instrumentation-Yt31gxWN.js} +3 -3
- package/dist/chunks/{job-DOWtcltx.js → job-BXujwZNa.js} +1 -1
- package/dist/chunks/{keybindings-BLw5J-Zj.js → keybindings-D8FXoO89.js} +2 -2
- package/dist/chunks/language-Baosud0X.js +1 -0
- package/dist/chunks/{language-C6Fq-XOZ.js → language-Ca4B018X.js} +1 -1
- package/dist/chunks/{launchAgentsPlatform-jWWf-Lk9.js → launchAgentsPlatform-D6DmNuDt.js} +1 -1
- package/dist/chunks/{launchLocalMemory-kHeD0I0y.js → launchLocalMemory-C0FzUq7x.js} +2 -2
- package/dist/chunks/{launchLocalVault-DLqkOjmb.js → launchLocalVault-DkYAre4O.js} +3 -3
- package/dist/chunks/{launchMemoryStores-Ct7AVXrO.js → launchMemoryStores-D2rKWAPs.js} +1 -1
- package/dist/chunks/{launchOnboarding-Cc6WwPX9.js → launchOnboarding-gOVAFEFp.js} +1 -1
- package/dist/chunks/{launchSchedule-ZyvuvjgU.js → launchSchedule-IZdFstT_.js} +1 -1
- package/dist/chunks/{launchSkillStore-BejQnLog.js → launchSkillStore-B7LamM1d.js} +1 -1
- package/dist/chunks/{launchTeleport-8CuYUfIR.js → launchTeleport-C2BQMfYP.js} +3 -3
- package/dist/chunks/{launchVault-DIvIOuPh.js → launchVault-C60WUcCI.js} +1 -1
- package/dist/chunks/{lazySchema-DcIJE_0i.js → lazySchema-DULtBUCI.js} +1 -1
- package/dist/chunks/loadAgentsDir-B9c3Emvg.js +1 -0
- package/dist/chunks/{loadAgentsDir-D206qwP3.js → loadAgentsDir-x3rlgED4.js} +690 -692
- package/dist/chunks/loadPluginHooks-BhNdAjeY.js +1 -0
- package/dist/chunks/localSearch-BLCGsdyM.js +1 -0
- package/dist/chunks/{localSearch-CzrbOklu.js → localSearch-DtplGF-l.js} +1 -1
- package/dist/chunks/{logoV2Utils-8M56V7oN.js → logoV2Utils-gGK9gErT.js} +1 -1
- package/dist/chunks/{magicDocs-DWjL2k7P.js → magicDocs-qdDB_mKb.js} +2 -2
- package/dist/chunks/{main-BohPzJFF.js → main-OWFSddRx.js} +82 -82
- package/dist/chunks/managedEnv-Aq5BXfY7.js +1 -0
- package/dist/chunks/managedEnv-BHoeDjpS.js +1 -0
- package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
- package/dist/chunks/{mappers-BDMZFgKx.js → mappers-04gNXJ3w.js} +1 -1
- package/dist/chunks/mcp-BSNdwbxR.js +1 -0
- package/dist/chunks/mcp-CMnDNI-4.js +6 -0
- package/dist/chunks/mcp-D1yA9E56.js +2 -0
- package/dist/chunks/memory-D1zbyjxN.js +1 -0
- package/dist/chunks/{mode-CUkHFkju.js → mode-DY087x_x.js} +2 -2
- package/dist/chunks/{model-CKkOnnnx.js → model-CZViyZnE.js} +1 -1
- package/dist/chunks/{model-BY3auM2c.js → model-D0EfJBuw.js} +1 -1
- package/dist/chunks/model-DLLkVV6S.js +1 -0
- package/dist/chunks/{nativeInstaller-CA5d6_G7.js → nativeInstaller-yj81F75v.js} +1 -1
- package/dist/chunks/onChangeAppState-DhGKPG9g.js +1 -0
- package/dist/chunks/{openai-Cbomn0Ws.js → openai-EYRnUsco.js} +3 -3
- package/dist/chunks/{overageCreditGrant-DsUrmeBh.js → overageCreditGrant-Du3dOYVu.js} +1 -1
- package/dist/chunks/{panelCall-BsVoL1uF.js → panelCall-dMvRPAGE.js} +1 -1
- package/dist/chunks/{partition-BAakXjvj.js → partition-C4FWzYVm.js} +1 -1
- package/dist/chunks/{passes-CLRt7Cvm.js → passes-Daz-ARWD.js} +1 -1
- package/dist/chunks/permissions-DF8tAmDF.js +3 -0
- package/dist/chunks/{pidLock-D5rUnDB-.js → pidLock-CbC_il6r.js} +2 -2
- package/dist/chunks/{plan-SYZ4DXR8.js → plan-rsb_83Fo.js} +1 -1
- package/dist/chunks/{plugin-Bfjzhmrk.js → plugin-Cm31-nej.js} +1 -1
- package/dist/chunks/pluginAutoupdate-0k03PVff.js +1 -0
- package/dist/chunks/pluginBlocklist-wPFCUPdm.js +1 -0
- package/dist/chunks/pluginCliCommands-DhL9LbH0.js +1 -0
- package/dist/chunks/{pluginFlagging-D9HKAGBC.js → pluginFlagging-CAdaFV_D.js} +1 -1
- package/dist/chunks/pluginOperations-Cs_Z4C6O.js +2 -0
- package/dist/chunks/pluginStartupCheck-BRXGKGjG.js +1 -0
- package/dist/chunks/pluginStartupCheck-KeU0efTj.js +1 -0
- package/dist/chunks/{plugins-Dn6ceWrT.js → plugins-CQNKZmjP.js} +4 -4
- package/dist/chunks/policyLimits-D2s8M8P2.js +1 -0
- package/dist/chunks/{pollConfig-DH2oCtFS.js → pollConfig-2nFzv6Hy.js} +1 -1
- package/dist/chunks/{poor-j-y-bv8o.js → poor-DXumVTR4.js} +1 -1
- package/dist/chunks/{poorMode-DhzFKpPl.js → poorMode-CBOtooa0.js} +1 -1
- package/dist/chunks/poorMode-yNZL5uYf.js +1 -0
- package/dist/chunks/print-uxCF5ka5.js +23 -0
- package/dist/chunks/{privacy-settings-DHMJREbb.js → privacy-settings-BncbJCV0.js} +1 -1
- package/dist/chunks/processBashCommand-CGdwvPmD.js +1 -0
- package/dist/chunks/processSlashCommand-DQarepEb.js +5 -0
- package/dist/chunks/prompt-BgOdcHkd.js +1 -0
- package/dist/chunks/{prompt-BNHtszmZ.js → prompt-CE3sFmZV.js} +5 -5
- package/dist/chunks/prompt-CLJKFebn.js +1 -0
- package/dist/chunks/{promptEditor-DeMrXUir.js → promptEditor-CyTzyjwG.js} +2 -2
- package/dist/chunks/{protocolHandler-BHxBy84Z.js → protocolHandler-JR8pASdH.js} +1 -1
- package/dist/chunks/rate-limit-options-C-EqWjeI.js +1 -0
- package/dist/chunks/{rcDebugLog-CUy1_F23.js → rcDebugLog-DBB9r8aw.js} +1 -1
- package/dist/chunks/reconciler-CYD_XpG4.js +4 -0
- package/dist/chunks/{referral-CUaIo_vT.js → referral-CKmHHxj_.js} +1 -1
- package/dist/chunks/refresh-ZqZdmLK5.js +1 -0
- package/dist/chunks/{registerProtocol-B7Fzdofu.js → registerProtocol-wZv2uiW_.js} +1 -1
- package/dist/chunks/{release-notes-fbfv2DC0.js → release-notes-B5K7wVqZ.js} +1 -1
- package/dist/chunks/{releaseNotes-CxAHFLPl.js → releaseNotes-B8gbyFFJ.js} +2 -2
- package/dist/chunks/{reload-plugins-B9IT9CFA.js → reload-plugins-B9ApSp2m.js} +1 -1
- package/dist/chunks/{remote-env-BOklGlll.js → remote-env-CAt1dHIS.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-j0bG1zjv.js → remoteBridgeCore-Bk3UdSLJ.js} +1 -1
- package/dist/chunks/remoteManagedSettings-bswzAB6W.js +1 -0
- package/dist/chunks/rename-CE_U6KE6.js +1 -0
- package/dist/chunks/{resume-y7MCTZHJ.js → resume-BicEjsPd.js} +2 -2
- package/dist/chunks/{runtimeObserver-CyzLASla.js → runtimeObserver-BrGF5QWX.js} +4 -4
- package/dist/chunks/{runtimeObserver-BZcJ1FbH.js → runtimeObserver-CiwnPFjK.js} +1 -1
- package/dist/chunks/sandbox-adapter-BtMiHImm.js +1 -0
- package/dist/chunks/{sandbox-toggle-CWpBO228.js → sandbox-toggle-D8eebdyI.js} +1 -1
- package/dist/chunks/searchExtraTools-hLLPuh7c.js +1 -0
- package/dist/chunks/{session-DL4cA_8l.js → session-BZIlR9Gc.js} +2 -2
- package/dist/chunks/{sessionDiscovery-DAfNKqp1.js → sessionDiscovery-DfDqTrF1.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-Bm8wiqwe.js +1 -0
- package/dist/chunks/sessionMemory-D37S0-jX.js +1 -0
- package/dist/chunks/sessionMemory-DmlAG3jq.js +1 -0
- package/dist/chunks/sessionMemoryUtils-6EWDHSGU.js +1 -0
- package/dist/chunks/sessionObserver-BUw2rzKl.js +1 -0
- package/dist/chunks/{sessionObserver-ShbCwJ8x.js → sessionObserver-KgquhGWw.js} +1 -1
- package/dist/chunks/sessionStorage-CucBSK5Q.js +1 -0
- package/dist/chunks/{sessionTitle-coed9IuJ.js → sessionTitle-DAnM73S0.js} +2 -2
- package/dist/chunks/{sessionTracing-D9rUyiq0.js → sessionTracing-_Hh5VXxt.js} +1 -1
- package/dist/chunks/settings-BeLFUeie.js +19 -0
- package/dist/chunks/settings-Cl16Haug.js +1 -0
- package/dist/chunks/settingsSync-BNvFYH3c.js +1 -0
- package/dist/chunks/setup-D8kXv3ts.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D1wsAdpp.js → shadowedRuleDetection-C6R5zOUe.js} +1 -1
- package/dist/chunks/{sideQuestion-wSi38p81.js → sideQuestion-hUhxls9r.js} +3 -3
- package/dist/chunks/{sinks-C_Dl1p4K.js → sinks-BuE17DeZ.js} +2 -2
- package/dist/chunks/sinks-FevoYQqP.js +1 -0
- package/dist/chunks/{skill-learning-B5tmc7EX.js → skill-learning-CMdxGtxr.js} +1 -1
- package/dist/chunks/skillChangeDetector-C65ZLSYV.js +1 -0
- package/dist/chunks/{skillGapStore-Df5BWAk5.js → skillGapStore-D18LRJAM.js} +2 -2
- package/dist/chunks/{skillGapStore-D-kQKVDZ.js → skillGapStore-Ep62R-2_.js} +1 -1
- package/dist/chunks/{skillGenerator-DbcdpAkw.js → skillGenerator-Bc7WwNT8.js} +2 -2
- package/dist/chunks/{skillLearning-ClRiDcJH.js → skillLearning-Cs9fJgkV.js} +1 -1
- package/dist/chunks/skillLearning-duPZl69A.js +1 -0
- package/dist/chunks/{skillPanel-LBd4E-MM.js → skillPanel-Cyzby746.js} +3 -3
- package/dist/chunks/{skillSearchPanel-CErRnUwo.js → skillSearchPanel-Cll9ccA5.js} +4 -4
- package/dist/chunks/{skills-CBKhfg_a.js → skills-BPPeYBy7.js} +1 -1
- package/dist/chunks/{stats-BY4dskVg.js → stats-CqfF4Axp.js} +1 -1
- package/dist/chunks/{status-DU-B4SMW.js → status-CC9Q-2Yn.js} +1 -1
- package/dist/chunks/{status-BnJIXtKl.js → status-D4IQpsNK.js} +2 -2
- package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +1 -0
- package/dist/chunks/syncCache-CANQZ9mQ.js +1 -0
- package/dist/chunks/{tag-B-wVW9Aj.js → tag-DDbNqBMu.js} +2 -2
- package/dist/chunks/{tasks-CBVL005y.js → tasks-CZvWJYGr.js} +1 -1
- package/dist/chunks/teleport-Dk5j03Ix.js +1 -0
- package/dist/chunks/{templateJobs-D6998LcG.js → templateJobs-D1BdhZsv.js} +1 -1
- package/dist/chunks/{terminalSetup-CuV-qU6v.js → terminalSetup-3JNy6i_J.js} +5 -5
- package/dist/chunks/{terminalSetup-0SBdyKF5.js → terminalSetup-Cn6jeYw1.js} +1 -1
- package/dist/chunks/{theme-p0AooruD.js → theme-Cg4GNOoQ.js} +1 -1
- package/dist/chunks/thinkback-p-vKIRW_.js +1 -0
- package/dist/chunks/thinkback-play-DnPTDE8B.js +1 -0
- package/dist/chunks/{thinkback-DI2NpvG-.js → thinkback-rFA1do6F.js} +1 -1
- package/dist/chunks/{toolEventObserver-DlH73w-S.js → toolEventObserver-CzsCuUMc.js} +1 -1
- package/dist/chunks/{toolEventObserver-DTccwC3c.js → toolEventObserver-SFwURL5F.js} +1 -1
- package/dist/chunks/toolPool-BR27AMJO.js +1 -0
- package/dist/chunks/trustedDevice-BYt39fui.js +1 -0
- package/dist/chunks/{trustedDevice-BTYoQCkC.js → trustedDevice-CKedohmT.js} +1 -1
- package/dist/chunks/{types-C-MRCL8J.js → types-Dut4311z.js} +2 -2
- package/dist/chunks/{ultrareviewCommand-BDFUS3hf.js → ultrareviewCommand-C_4OSBTW.js} +2 -2
- package/dist/chunks/{undercover-vuTpCnQJ.js → undercover-D30rKimg.js} +1 -1
- package/dist/chunks/undercover-DRSwLozU.js +1 -0
- package/dist/chunks/{updateCCB-DFL5Wt_I.js → updateCCB-C2G-U-qA.js} +1 -1
- package/dist/chunks/upgrade-Bi-bIz7R.js +1 -0
- package/dist/chunks/{upgrade-D5qwcaWQ.js → upgrade-Chs-OQFd.js} +1 -1
- package/dist/chunks/{upload-B_yADHX9.js → upload-D8FWMSQx.js} +1 -1
- package/dist/chunks/{usage-C0SnnC-i.js → usage-BxVeUt60.js} +1 -1
- package/dist/chunks/usage-DUO7Yy1f.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DKIqRraH.js → useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js} +1 -1
- package/dist/chunks/useMainLoopModel-Gy1Vv4Qr.js +1 -0
- package/dist/chunks/useManagePlugins-B11_87VN.js +1 -0
- package/dist/chunks/useMergedTools-CR56my9t.js +1 -0
- package/dist/chunks/{useSearchInput-D1Vr2Js1.js → useSearchInput-C5OzQnX6.js} +1 -1
- package/dist/chunks/{useSettingsErrors-B7BXHchG.js → useSettingsErrors-B9vOZL41.js} +1 -1
- package/dist/chunks/{util-BaDs-wL5.js → util-8EHwfg4A.js} +1 -1
- package/dist/chunks/validatePlugin-6q1qmnAC.js +1 -0
- package/dist/chunks/{vim-C-icQDz1.js → vim-CNDzwoTd.js} +1 -1
- package/dist/chunks/{workerRegistry-ChqPPIaO.js → workerRegistry-CvyHvwx-.js} +1 -1
- package/dist/chunks/worktree-ogmNCIpz.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +0 -1
- package/dist/chunks/Doctor-BhD-ZzZm.js +0 -1
- package/dist/chunks/Doctor-DEQe2q16.js +0 -3
- package/dist/chunks/ExitFlow-BttnAv-O.js +0 -2
- package/dist/chunks/Grove-sWm-oLBf.js +0 -1
- package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +0 -1
- package/dist/chunks/MessageSelector-DdR6wJhh.js +0 -3
- package/dist/chunks/Messages-Ch6cboMV.js +0 -11
- package/dist/chunks/PluginSettings-CGqEzejq.js +0 -17
- package/dist/chunks/QueryEngine-CZZMl3PB.js +0 -1
- package/dist/chunks/REPL-CG2N7E4Q.js +0 -142
- package/dist/chunks/REPL-DvA910N_.js +0 -1
- package/dist/chunks/ResumeConversation-DzV2zmuX.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +0 -1
- package/dist/chunks/Settings-XKw6FI_m.js +0 -2
- package/dist/chunks/TrustDialog-DGJ_BisZ.js +0 -1
- package/dist/chunks/agents-BIHTGDYh.js +0 -103
- package/dist/chunks/allErrors-1896uQA1.js +0 -1
- package/dist/chunks/api-BsFW57_Q.js +0 -1
- package/dist/chunks/auth-8Vd3_U8t.js +0 -1
- package/dist/chunks/auth-DRTjfnGy.js +0 -1
- package/dist/chunks/autonomy-DGcy5Rml.js +0 -15
- package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +0 -17
- package/dist/chunks/bridgeConfig-CqIQ_rvD.js +0 -1
- package/dist/chunks/bridgeEnabled-D0XC5kNh.js +0 -1
- package/dist/chunks/bridgeMain-DHUpZFgL.js +0 -68
- package/dist/chunks/bridgeMain-DUbQjgCp.js +0 -1
- package/dist/chunks/caches-CWzT7e6Y.js +0 -1
- package/dist/chunks/client-BzKQTXzF.js +0 -1
- package/dist/chunks/commands-DDamMmo4.js +0 -1
- package/dist/chunks/commitAttribution-CgohL8vD.js +0 -1
- package/dist/chunks/compact-IFHwxjZ9.js +0 -2
- package/dist/chunks/config-DY5-_kk_.js +0 -1
- package/dist/chunks/config-WxgxrQoP.js +0 -1
- package/dist/chunks/context-noninteractive-Beij5MfU.js +0 -1
- package/dist/chunks/conversation-BBB91hEw.js +0 -1
- package/dist/chunks/conversation-BWVTM40Y.js +0 -1
- package/dist/chunks/createSession-CoQtL5Rj.js +0 -1
- package/dist/chunks/crossProjectResume-BasMLl2n.js +0 -40
- package/dist/chunks/doctor-1L0TFuGw.js +0 -1
- package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +0 -1
- package/dist/chunks/envLessBridgeConfig-Ck2-KMq0.js +0 -1
- package/dist/chunks/exit-Bm1S_f3i.js +0 -1
- package/dist/chunks/extra-usage-UHAWtypK.js +0 -1
- package/dist/chunks/extractMemories-BcaklA33.js +0 -1
- package/dist/chunks/fast-DALAHO3d.js +0 -1
- package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +0 -1
- package/dist/chunks/generateRecap-jGDLI_wU.js +0 -1
- package/dist/chunks/generateSessionName-hDJ6HBJ1.js +0 -1
- package/dist/chunks/grok-Byblph7F.js +0 -1
- package/dist/chunks/hooks-DPLIIpAD.js +0 -1
- package/dist/chunks/inboundAttachments-BekVc0W-.js +0 -1
- package/dist/chunks/initReplBridge-JQ-afRx9.js +0 -1
- package/dist/chunks/language-Cqw5gYJR.js +0 -1
- package/dist/chunks/loadAgentsDir-TZjwTqdr.js +0 -1
- package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +0 -1
- package/dist/chunks/localSearch-DrOAL6f4.js +0 -1
- package/dist/chunks/mcp-Bt1ITh-Z.js +0 -1
- package/dist/chunks/mcp-CwJ-AIpt.js +0 -6
- package/dist/chunks/mcp-W0LFoyFR.js +0 -2
- package/dist/chunks/memory-3wV7m7UU.js +0 -1
- package/dist/chunks/model-DRXcJyU9.js +0 -1
- package/dist/chunks/onChangeAppState-DBmy2Ow_.js +0 -1
- package/dist/chunks/permissions-BVSFuwNP.js +0 -3
- package/dist/chunks/pluginAutoupdate-reO2PgtQ.js +0 -1
- package/dist/chunks/pluginBlocklist-C3H2afWG.js +0 -1
- package/dist/chunks/pluginCliCommands-lqdxdkQp.js +0 -1
- package/dist/chunks/pluginOperations-EN3EKLux.js +0 -2
- package/dist/chunks/pluginStartupCheck-BY73BMT2.js +0 -1
- package/dist/chunks/pluginStartupCheck-CwWOlveD.js +0 -1
- package/dist/chunks/policyLimits-CkTI5KEt.js +0 -1
- package/dist/chunks/poorMode-V11s-3cf.js +0 -1
- package/dist/chunks/print-Db_VXmfO.js +0 -23
- package/dist/chunks/processBashCommand-BcM_fhV9.js +0 -1
- package/dist/chunks/processSlashCommand-DEVo3GPX.js +0 -5
- package/dist/chunks/prompt-CrX31AGm.js +0 -1
- package/dist/chunks/prompt-IAvMxKDl.js +0 -1
- package/dist/chunks/rate-limit-options-DIudL9fb.js +0 -1
- package/dist/chunks/reconciler-BXpPyfSY.js +0 -4
- package/dist/chunks/refresh-CuaVBIQ0.js +0 -1
- package/dist/chunks/remoteManagedSettings-Cq994lyc.js +0 -1
- package/dist/chunks/rename-Iev7wQsI.js +0 -1
- package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +0 -1
- package/dist/chunks/searchExtraTools-BUOUds7p.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +0 -1
- package/dist/chunks/sessionMemory-BS8_TbKj.js +0 -1
- package/dist/chunks/sessionMemory-D5fSHXvZ.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +0 -1
- package/dist/chunks/sessionObserver-ChfQtK2m.js +0 -1
- package/dist/chunks/sessionStorage-Cf5wmnyB.js +0 -1
- package/dist/chunks/settings-BovzmwMP.js +0 -19
- package/dist/chunks/settingsSync-PqU9XGJq.js +0 -1
- package/dist/chunks/setup-B_FOvNpp.js +0 -3
- package/dist/chunks/sinks-BpcRrN_T.js +0 -1
- package/dist/chunks/skillChangeDetector-DNqohXxz.js +0 -1
- package/dist/chunks/skillLearning-C5cXZE6_.js +0 -1
- package/dist/chunks/statusNoticeHelpers-CzTuGNuC.js +0 -1
- package/dist/chunks/teleport-dtqQXM4x.js +0 -1
- package/dist/chunks/thinkback-Catprqs_.js +0 -1
- package/dist/chunks/thinkback-play-CqrIRx2o.js +0 -1
- package/dist/chunks/toolPool-B64V-jmK.js +0 -1
- package/dist/chunks/trustedDevice-CiwjT_Y6.js +0 -1
- package/dist/chunks/undercover-XYapZ_SS.js +0 -1
- package/dist/chunks/upgrade-DIg3j929.js +0 -1
- package/dist/chunks/usage-CYJKE8N6.js +0 -1
- package/dist/chunks/useMainLoopModel-XetDUXd-.js +0 -1
- package/dist/chunks/useManagePlugins-B2KhKiu5.js +0 -1
- package/dist/chunks/useMergedTools-CKvwz_Zt.js +0 -1
- package/dist/chunks/validatePlugin-DtiYlXby.js +0 -1
- package/dist/chunks/worktree-DAn8ooa1.js +0 -1
|
@@ -1 +1 @@
|
|
|
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{E as a,F as o,I as s,S as c,V as l,W as u,a as d,d as f,l as p,nt as m,p as ee,rt as te,w as h,z as g}from"./debug-BrXObCdR.js";import{Jt as ne,Zt as re}from"./settings-BovzmwMP.js";import{C as ie,S as ae,b as oe,c as se,g as ce,w as _}from"./config-DmomySWC.js";import{n as v,r as y}from"./execFileNoThrow-D244NytW.js";import{o as b,s as x}from"./log-BMCygSzM.js";import{n as S,r as C}from"./analytics-BotDBGh0.js";import{_n as le,vn as ue}from"./model-CKkOnnnx.js";import{ft as de,ut as fe}from"./esm-D5q6s4l8.js";import{n as pe,r as me,t as he}from"./semver-BMRJYn3q.js";import{C as ge,S as _e,_ as ve,a as w,b as ye,c as be,d as xe,g as Se,h as Ce,i as we,l as Te,n as Ee,o as T,p as De,s as Oe,t as ke,v as E,x as Ae,y as je}from"./pidLock-D5rUnDB-.js";import{a as Me,i as Ne,n as Pe,r as Fe,t as Ie}from"./xdg-DcF9ejUM.js";import{homedir as D}from"os";import{basename as Le,delimiter as Re,dirname as O,join as k,resolve as A}from"path";import{constants as ze}from"fs";import{createHash as Be}from"crypto";import{access as j,chmod as M,copyFile as N,mkdir as P,readdir as F,readlink as I,rename as L,rm as R,rmdir as Ve,stat as z,symlink as He,unlink as B,writeFile as V}from"fs/promises";async function Ue(e=`latest`){let t=Date.now(),{stdout:n,code:r,stderr:i}=await v(`npm`,[`view`,`@${e}`,`version`,`--prefer-online`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0}),a=Date.now()-t;if(r!==0){C(`tengu_version_check_failure`,{latency_ms:a,source_npm:!0,exit_code:r});let e=Error(`npm view failed with code ${r}: ${i}`);throw x(e),e}return C(`tengu_version_check_success`,{latency_ms:a,source_npm:!0}),p(`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 C(`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),C(`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 x(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=f();await n.rm(t,{recursive:!0,force:!0});let r=W(),i=`-${r}`;p(`Fetching integrity hash for ${i}@${e}`);let{stdout:o,code:s,stderr:c}=await v(`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}`);p(`Got integrity hash for ${r}: ${l}`),await n.mkdir(t);let u={name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},d={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(k(t,`package.json`),h(u,null,2),{encoding:`utf8`,flush:!0}),a(k(t,`package-lock.json`),h(d,null,2),{encoding:`utf8`,flush:!0});let m=await v(`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}`);p(`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,l=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{l(),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});l();let o=Be(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await V(n,Buffer.from(a.data)),await M(n,493);return}catch(e){l();let t=r.isCancel(e);if(a=t?new Qe:u(e),t&&o<3){p(`Download stalled on attempt ${o}/3, retrying...`),await ue(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ye(e,t,n,i){let a=f();await a.rm(t,{recursive:!0,force:!0});let o=W(),s=Date.now();C(`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),C(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),x(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw C(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=G(o),p=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let m=k(t,d);try{await Je(p,u,m,i||{}),C(`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),C(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),x(Error(`Failed to download binary from ${p}: ${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(),S(),d(),g(),y(),ee(),b(),le(),c(),$(),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 p(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&fe.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function G(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function K(){let e=G(W());return{versions:k(Fe(),`claude`,`versions`),staging:k(Pe(),`claude`,`staging`),locks:k(Ne(),`claude`,`locks`),executable:k(Ie(),e)}}async function q(e){try{let t=await z(e);return!t.isFile()||t.size===0?!1:(await j(e,ze.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=>P(e,{recursive:!0}))),await P(O(t.executable),{recursive:!0});let r=k(t.versions,e);try{await z(r)}catch{await V(r,``,{encoding:`utf8`})}return{stagingPath:k(t.staging,e),installPath:r}}async function et(e,t,n=0){let r=K(),i=Y(r,e);if(await P(r.locks,{recursive:!0}),T()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await be(e,i,async()=>{try{await t()}catch(e){throw x(e),e}}))return C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await ue(Math.min(o*2**(r-1),s))}return C(`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 _(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{p(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw x(e),e}}finally{a&&await a()}}async function tt(e,t){await P(O(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await N(e,n),await M(n,493),await L(n,t),p(`Atomically installed binary to ${t}`)}catch(e){try{await B(n)}catch{}throw e}}async function nt(e,t){try{let n=k(e,`node_modules`,`@anthropic-ai`),r=(await F(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw C(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=k(n,r,`cli`);try{await z(i)}catch{throw C(`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 R(e,{recursive:!0,force:!0}),C(`tengu_native_install_package_success`,{})}catch(e){let t=o(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&C(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(e)),e}}async function rt(e,t){try{let n=k(e,G(W()));try{await z(n)}catch{throw C(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await tt(n,t),await R(e,{recursive:!0,force:!0}),C(`tengu_native_install_binary_success`,{})}catch(e){throw o(e).includes(`Staged binary not found`)||C(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(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?(p(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await it(o,i,await Xe(e,o))):p(`Version ${e} already installed, updating symlink`),await ct(a),await lt(a,i),!await q(a)){let e=!1;try{await z(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(p(`Checking for native installer update to version ${i}`),!n){let e=await De();if(e&&he(i,e)){if(p(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),pe(`0.0.6`,e))return p(`Native installer: current version 0.0.6 is already at or above maxVersion ${e}, skipping update`),C(`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.6`&&await ot(i)&&await q(a))return p(`Found ${i} at ${a}, skipping install`),C(`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&&Se(i))return C(`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(T()){let r=Y(t,e);w(r)&&(n=Oe(r)?.pid)}return C(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return C(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),p(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function ct(e){try{await Ve(e),p(`Removed empty directory at ${e}`)}catch(t){let n=s(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&p(`Could not remove directory at ${e}: ${t}`)}}async function lt(e,t){if(W().startsWith(`win32`))try{await P(O(e),{recursive:!0});let n;try{n=await z(e)}catch{}if(n){try{let e=await z(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await L(e,r);try{await N(t,e);try{await B(r)}catch{}}catch(t){try{await L(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw x(n),n}throw t}}else try{await N(t,e)}catch(e){throw l(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return x(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=O(e);try{await P(n,{recursive:!0}),p(`Created directory ${n} for symlink`)}catch(e){return x(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await z(e),n=!0}catch{}if(n){try{let n=await I(e);if(A(O(e),n)===A(t))return!1}catch{}await B(e)}}catch(e){x(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await He(t,r),await L(r,e),p(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await B(r)}catch{}return x(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 Te();if(n===`development`||!(e||n===`native`))return[];let r=K(),i=[],a=O(r.executable),o=A(a),s=W().startsWith(`win32`);try{await j(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await q(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await I(r.executable);await q(A(O(r.executable),e))||i.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){l(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await q(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Re).some(e=>{try{let t=A(e);return s?t.toLowerCase()===o.toLowerCase():t===o}catch{return!1}}))if(s){let e=a.replace(/\//g,`\\`);i.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=_e(),t=E()[e],n=t?t.replace(D(),`~`):`your shell config file`;i.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 i}function dt(e,t=!1){if(t)return ft(e,t);if(Q)return p(`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?(se().installMethod!==`native`&&(oe(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),p(`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 I(e),n=A(O(e),t);if(await q(n))return n}catch{}return null}function Y(e,t){let n=Le(t);return k(e.locks,`${n}.lock`)}async function mt(){let e=K();if(!process.execPath.includes(e.versions))return;let t=A(process.execPath);try{let n=Y(e,t);if(await P(e.locks,{recursive:!0}),T()){if(!await ke(t,n)){C(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),p(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await _(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{p(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),p(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}p(`NON-FATAL: Failed to lock current version during execution ${o(e)}`,{level:`info`})}}function X(e,t){x(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 B(t),p(`Force-removed lock file at ${t}`)}catch(e){p(`Failed to force-remove lock file: ${o(e)}`)}}async function gt(){await Promise.resolve();let e=K(),t=Date.now()-36e5;if(W().startsWith(`win32`)){let t=O(e.executable);try{let e=await F(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await B(k(t,r)),n++}catch{}n>0&&p(`Cleaned up ${n} old Windows executables on startup`)}catch(e){l(e)||p(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await F(e.staging),r=0;for(let i of n){let n=k(e.staging,i);try{(await z(n)).mtime.getTime()<t&&(await R(n,{recursive:!0,force:!0}),r++,p(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(p(`Cleaned up ${r} orphaned staging directories`),C(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){l(e)||p(`Failed to clean up staging directories: ${e}`)}if(T()){let t=Ee(e.locks);t>0&&(p(`Cleaned up ${t} stale version locks`),C(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await F(e.versions)}catch(e){l(e)||p(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=k(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await z(n)).mtime.getTime()<t&&(await B(n),i++,p(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await z(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:A(n),mtime:e.mtime})}catch{}}if(i>0&&(p(`Cleaned up ${i} orphaned temp install files`),C(`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(A(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(T())i=w(r);else try{i=await ae(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),p(`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){C(`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 B(e.path)})?o++:(s++,p(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,x(Error(`Failed to delete version ${e.name}: ${t}`))}})),C(`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){l(e)||x(Error(`Version cleanup failed: ${e}`))}}async function _t(){let e=[],t=E();for(let[n,r]of Object.entries(t))try{let t=await ye(r);if(!t)continue;let{filtered:i,hadAlias:a}=ve(t);a&&(await Ae(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),p(`Cleaned up claude alias from ${n} config`))}catch(t){x(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function vt(e){try{let t=await v(`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 B(e),p(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(W().startsWith(`win32`)){let e=k(n,`claude.cmd`),t=k(n,`claude.ps1`),a=k(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(k(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(p(`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`)?k(n,`node_modules`,e):k(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return p(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function yt(e){let{code:t,stderr:n}=await v(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return p(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){p(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),p(`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 p(`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=k(D(),`.claude`,`local`);try{await R(i,{recursive:!0}),n++,p(`Removed local installation at ${i}`)}catch(t){l(t)||(e.push(`Failed to remove ${i}: ${t}`),p(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{S(),Ce(),m(),ce(),d(),xe(),re(),de(),n(),g(),y(),ge(),ie(),b(),me(),je(),le(),Me(),$e(),we(),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
|
+
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{E as a,F as o,I as s,S as c,V as l,W as u,a as d,d as f,l as p,nt as m,p as ee,rt as te,w as h,z as g}from"./debug-BrXObCdR.js";import{$t as ne,Xt as re}from"./settings-BeLFUeie.js";import{C as ie,S as ae,b as oe,c as se,g as ce,w as _}from"./config-DRDuVyzE.js";import{n as v,r as y}from"./execFileNoThrow-D244NytW.js";import{o as b,s as x}from"./log-BMCygSzM.js";import{n as S,r as C}from"./analytics-BotDBGh0.js";import{_n as le,vn as ue}from"./model-CZViyZnE.js";import{ft as de,ut as fe}from"./esm-5w3xFBnt.js";import{n as pe,r as me,t as he}from"./semver-BMRJYn3q.js";import{C as ge,S as _e,_ as ve,a as w,b as ye,c as be,d as xe,g as Se,h as Ce,i as we,l as Te,n as Ee,o as T,p as De,s as Oe,t as ke,v as E,x as Ae,y as je}from"./pidLock-CbC_il6r.js";import{a as Me,i as Ne,n as Pe,r as Fe,t as Ie}from"./xdg-DcF9ejUM.js";import{homedir as D}from"os";import{basename as Le,delimiter as Re,dirname as O,join as k,resolve as A}from"path";import{constants as ze}from"fs";import{createHash as Be}from"crypto";import{access as j,chmod as M,copyFile as N,mkdir as P,readdir as F,readlink as I,rename as L,rm as R,rmdir as Ve,stat as z,symlink as He,unlink as B,writeFile as V}from"fs/promises";async function Ue(e=`latest`){let t=Date.now(),{stdout:n,code:r,stderr:i}=await v(`npm`,[`view`,`@${e}`,`version`,`--prefer-online`,`--registry`,U],{timeout:3e4,preserveOutputOnError:!0}),a=Date.now()-t;if(r!==0){C(`tengu_version_check_failure`,{latency_ms:a,source_npm:!0,exit_code:r});let e=Error(`npm view failed with code ${r}: ${i}`);throw x(e),e}return C(`tengu_version_check_success`,{latency_ms:a,source_npm:!0}),p(`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 C(`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),C(`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 x(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=f();await n.rm(t,{recursive:!0,force:!0});let r=W(),i=`-${r}`;p(`Fetching integrity hash for ${i}@${e}`);let{stdout:o,code:s,stderr:c}=await v(`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}`);p(`Got integrity hash for ${r}: ${l}`),await n.mkdir(t);let u={name:`claude-native-installer`,version:`0.0.1`,dependencies:{"":e}},d={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(k(t,`package.json`),h(u,null,2),{encoding:`utf8`,flush:!0}),a(k(t,`package-lock.json`),h(d,null,2),{encoding:`utf8`,flush:!0});let m=await v(`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}`);p(`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,l=()=>{c&&(clearTimeout(c),c=void 0)},d=()=>{l(),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});l();let o=Be(`sha256`);o.update(a.data);let c=o.digest(`hex`);if(c!==t)throw Error(`Checksum mismatch: expected ${t}, got ${c}`);await V(n,Buffer.from(a.data)),await M(n,493);return}catch(e){l();let t=r.isCancel(e);if(a=t?new Qe:u(e),t&&o<3){p(`Download stalled on attempt ${o}/3, retrying...`),await ue(1e3);continue}throw a}}throw a??Error(`Download failed after all retries`)}async function Ye(e,t,n,i){let a=f();await a.rm(t,{recursive:!0,force:!0});let o=W(),s=Date.now();C(`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),C(`tengu_binary_manifest_fetch_failure`,{latency_ms:i,http_status:o,is_timeout:a.includes(`timeout`)}),x(Error(`Failed to fetch manifest from ${n}/${e}/manifest.json: ${a}`)),t}let l=c.platforms[o];if(!l)throw C(`tengu_binary_platform_not_found`,{}),Error(`Platform ${o} not found in manifest for version ${e}`);let u=l.checksum,d=G(o),p=`${n}/${e}/${o}/${d}`;await a.mkdir(t);let m=k(t,d);try{await Je(p,u,m,i||{}),C(`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),C(`tengu_binary_download_failure`,{latency_ms:t,http_status:i,is_timeout:n.includes(`timeout`),is_checksum_mismatch:n.includes(`Checksum mismatch`)}),x(Error(`Failed to download binary from ${p}: ${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(),S(),d(),g(),y(),ee(),b(),le(),c(),$(),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=re.platform,t=process.arch===`x64`?`x64`:process.arch===`arm64`?`arm64`:null;if(!t){let e=Error(`Unsupported architecture: ${process.arch}`);throw p(`Native installer does not support architecture: ${process.arch}`,{level:`error`}),e}return e===`linux`&&fe.isMuslEnvironment()?`linux-${t}-musl`:`${e}-${t}`}function G(e){return e.startsWith(`win32`)?`claude.exe`:`claude`}function K(){let e=G(W());return{versions:k(Fe(),`claude`,`versions`),staging:k(Pe(),`claude`,`staging`),locks:k(Ne(),`claude`,`locks`),executable:k(Ie(),e)}}async function q(e){try{let t=await z(e);return!t.isFile()||t.size===0?!1:(await j(e,ze.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=>P(e,{recursive:!0}))),await P(O(t.executable),{recursive:!0});let r=k(t.versions,e);try{await z(r)}catch{await V(r,``,{encoding:`utf8`})}return{stagingPath:k(t.staging,e),installPath:r}}async function et(e,t,n=0){let r=K(),i=Y(r,e);if(await P(r.locks,{recursive:!0}),T()){let r=0,a=n+1,o=n>0?1e3:100,s=n>0?5e3:500;for(;r<a;){if(await be(e,i,async()=>{try{await t()}catch(e){throw x(e),e}}))return C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!1,attempts:r+1}),!0;r++,r<a&&await ue(Math.min(o*2**(r-1),s))}return C(`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 _(e,{stale:Z,retries:{retries:n,minTimeout:n>0?1e3:100,maxTimeout:n>0?5e3:500},lockfilePath:i,onCompromised:e=>{p(`NON-FATAL: Version lock was compromised during operation: ${e.message}`,{level:`info`})}})}catch(t){return C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!1}),X(e,t),!1}try{return await t(),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!1}),!0}catch(e){throw x(e),e}}finally{a&&await a()}}async function tt(e,t){await P(O(t),{recursive:!0});let n=`${t}.tmp.${process.pid}.${Date.now()}`;try{await N(e,n),await M(n,493),await L(n,t),p(`Atomically installed binary to ${t}`)}catch(e){try{await B(n)}catch{}throw e}}async function nt(e,t){try{let n=k(e,`node_modules`,`@anthropic-ai`),r=(await F(n)).find(e=>e.startsWith(`claude-cli-native-`));if(!r)throw C(`tengu_native_install_package_failure`,{stage_find_package:!0,error_package_not_found:!0}),Error(`Could not find platform-specific native package`);let i=k(n,r,`cli`);try{await z(i)}catch{throw C(`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 R(e,{recursive:!0,force:!0}),C(`tengu_native_install_package_success`,{})}catch(e){let t=o(e);throw!t.includes(`Could not find platform-specific`)&&!t.includes(`Native binary not found`)&&C(`tengu_native_install_package_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(e)),e}}async function rt(e,t){try{let n=k(e,G(W()));try{await z(n)}catch{throw C(`tengu_native_install_binary_failure`,{stage_binary_exists:!0,error_binary_not_found:!0}),Error(`Staged binary not found`)}await tt(n,t),await R(e,{recursive:!0,force:!0}),C(`tengu_native_install_binary_success`,{})}catch(e){throw o(e).includes(`Staged binary not found`)||C(`tengu_native_install_binary_failure`,{stage_atomic_move:!0,error_move_failed:!0}),x(u(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?(p(n?`Force reinstalling native installer version ${e}`:`Downloading native installer version ${e}`),await it(o,i,await Xe(e,o))):p(`Version ${e} already installed, updating symlink`),await ct(a),await lt(a,i),!await q(a)){let e=!1;try{await z(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(p(`Checking for native installer update to version ${i}`),!n){let e=await De();if(e&&he(i,e)){if(p(`Native installer: maxVersion ${e} is set, capping update from ${i} to ${e}`),pe(`0.0.7`,e))return p(`Native installer: current version 0.0.7 is already at or above maxVersion ${e}, skipping update`),C(`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.7`&&await ot(i)&&await q(a))return p(`Found ${i} at ${a}, skipping install`),C(`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&&Se(i))return C(`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(T()){let r=Y(t,e);w(r)&&(n=Oe(r)?.pid)}return C(`tengu_native_update_lock_failed`,{latency_ms:s,lock_holder_pid:n}),{success:!1,latestVersion:i,lockFailed:!0,lockHolderPid:n}}}return C(`tengu_native_update_complete`,{latency_ms:s,was_new_install:o,was_force_reinstall:n}),p(`Successfully updated to version ${i}`),{success:!0,latestVersion:i}}async function ct(e){try{await Ve(e),p(`Removed empty directory at ${e}`)}catch(t){let n=s(t);n!==`ENOTDIR`&&n!==`ENOENT`&&n!==`ENOTEMPTY`&&p(`Could not remove directory at ${e}: ${t}`)}}async function lt(e,t){if(W().startsWith(`win32`))try{await P(O(e),{recursive:!0});let n;try{n=await z(e)}catch{}if(n){try{let e=await z(t);if(n.size===e.size)return!1}catch{}let r=`${e}.old.${Date.now()}`;await L(e,r);try{await N(t,e);try{await B(r)}catch{}}catch(t){try{await L(r,e)}catch(e){let n=Error(`Failed to restore old executable: ${e}`,{cause:t});throw x(n),n}throw t}}else try{await N(t,e)}catch(e){throw l(e)?Error(`Source file does not exist: ${t}`):e}return!0}catch(n){return x(Error(`Failed to copy executable from ${t} to ${e}: ${n}`)),!1}let n=O(e);try{await P(n,{recursive:!0}),p(`Created directory ${n} for symlink`)}catch(e){return x(Error(`Failed to create directory ${n}: ${e}`)),!1}try{let n=!1;try{await z(e),n=!0}catch{}if(n){try{let n=await I(e);if(A(O(e),n)===A(t))return!1}catch{}await B(e)}}catch(e){x(Error(`Failed to check/remove existing symlink: ${e}`))}let r=`${e}.tmp.${process.pid}.${Date.now()}`;try{return await He(t,r),await L(r,e),p(`Atomically updated symlink ${e} -> ${t}`),!0}catch(n){try{await B(r)}catch{}return x(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 Te();if(n===`development`||!(e||n===`native`))return[];let r=K(),i=[],a=O(r.executable),o=A(a),s=W().startsWith(`win32`);try{await j(a)}catch{i.push({message:`installMethod is native, but directory ${a} does not exist`,userActionRequired:!0,type:`error`})}if(s)await q(r.executable)||i.push({message:`installMethod is native, but claude command is missing or invalid at ${r.executable}`,userActionRequired:!0,type:`error`});else try{let e=await I(r.executable);await q(A(O(r.executable),e))||i.push({message:`Claude symlink points to missing or invalid binary: ${e}`,userActionRequired:!0,type:`error`})}catch(e){l(e)?i.push({message:`installMethod is native, but claude command not found at ${r.executable}`,userActionRequired:!0,type:`error`}):await q(r.executable)||i.push({message:`${r.executable} exists but is not a valid Claude binary`,userActionRequired:!0,type:`error`})}if(!(process.env.PATH||``).split(Re).some(e=>{try{let t=A(e);return s?t.toLowerCase()===o.toLowerCase():t===o}catch{return!1}}))if(s){let e=a.replace(/\//g,`\\`);i.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=_e(),t=E()[e],n=t?t.replace(D(),`~`):`your shell config file`;i.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 i}function dt(e,t=!1){if(t)return ft(e,t);if(Q)return p(`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?(se().installMethod!==`native`&&(oe(e=>({...e,installMethod:`native`,autoUpdates:!1,autoUpdatesProtectedForNative:!0})),p(`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 I(e),n=A(O(e),t);if(await q(n))return n}catch{}return null}function Y(e,t){let n=Le(t);return k(e.locks,`${n}.lock`)}async function mt(){let e=K();if(!process.execPath.includes(e.versions))return;let t=A(process.execPath);try{let n=Y(e,t);if(await P(e.locks,{recursive:!0}),T()){if(!await ke(t,n)){C(`tengu_version_lock_failed`,{is_pid_based:!0,is_lifetime_lock:!0}),X(t,Error(`Lock already held by another process`));return}C(`tengu_version_lock_acquired`,{is_pid_based:!0,is_lifetime_lock:!0}),p(`Acquired PID lock on running version: ${t}`)}else{let e;try{e=await _(t,{stale:Z,retries:0,lockfilePath:n,onCompromised:e=>{p(`NON-FATAL: Lock on running version was compromised: ${e.message}`,{level:`info`})}}),C(`tengu_version_lock_acquired`,{is_pid_based:!1,is_lifetime_lock:!0}),p(`Acquired mtime-based lock on running version: ${t}`),te(async()=>{try{await e?.()}catch{}})}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}C(`tengu_version_lock_failed`,{is_pid_based:!1,is_lifetime_lock:!0}),X(t,e);return}}}catch(e){if(l(e)){p(`Cannot lock current version - file does not exist: ${t}`,{level:`info`});return}p(`NON-FATAL: Failed to lock current version during execution ${o(e)}`,{level:`info`})}}function X(e,t){x(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 B(t),p(`Force-removed lock file at ${t}`)}catch(e){p(`Failed to force-remove lock file: ${o(e)}`)}}async function gt(){await Promise.resolve();let e=K(),t=Date.now()-36e5;if(W().startsWith(`win32`)){let t=O(e.executable);try{let e=await F(t),n=0;for(let r of e)if(/^claude\.exe\.old\.\d+$/.test(r))try{await B(k(t,r)),n++}catch{}n>0&&p(`Cleaned up ${n} old Windows executables on startup`)}catch(e){l(e)||p(`Failed to clean up old Windows executables: ${e}`)}}try{let n=await F(e.staging),r=0;for(let i of n){let n=k(e.staging,i);try{(await z(n)).mtime.getTime()<t&&(await R(n,{recursive:!0,force:!0}),r++,p(`Cleaned up old staging directory: ${i}`))}catch{}}r>0&&(p(`Cleaned up ${r} orphaned staging directories`),C(`tengu_native_staging_cleanup`,{cleaned_count:r}))}catch(e){l(e)||p(`Failed to clean up staging directories: ${e}`)}if(T()){let t=Ee(e.locks);t>0&&(p(`Cleaned up ${t} stale version locks`),C(`tengu_native_stale_locks_cleanup`,{cleaned_count:t}))}let n;try{n=await F(e.versions)}catch(e){l(e)||p(`Failed to readdir versions directory: ${e}`);return}let r=[],i=0;for(let a of n){let n=k(e.versions,a);if(/\.tmp\.\d+\.\d+$/.test(a)){try{(await z(n)).mtime.getTime()<t&&(await B(n),i++,p(`Cleaned up orphaned temp install file: ${a}`))}catch{}continue}try{let e=await z(n);if(!e.isFile()||process.platform!==`win32`&&e.size>0&&!(e.mode&73))continue;r.push({name:a,path:n,resolvedPath:A(n),mtime:e.mtime})}catch{}}if(i>0&&(p(`Cleaned up ${i} orphaned temp install files`),C(`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(A(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(T())i=w(r);else try{i=await ae(t.resolvedPath,{stale:Z,lockfilePath:r})}catch{i=!1}i&&(n.add(t.resolvedPath),p(`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){C(`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 B(e.path)})?o++:(s++,p(`Skipping deletion of ${e.name} - locked by another process`))}catch(t){c++,x(Error(`Failed to delete version ${e.name}: ${t}`))}})),C(`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){l(e)||x(Error(`Version cleanup failed: ${e}`))}}async function _t(){let e=[],t=E();for(let[n,r]of Object.entries(t))try{let t=await ye(r);if(!t)continue;let{filtered:i,hadAlias:a}=ve(t);a&&(await Ae(r,i),e.push({message:`Removed claude alias from ${r}. Run: unalias claude`,userActionRequired:!0,type:`alias`}),p(`Cleaned up claude alias from ${n} config`))}catch(t){x(t),e.push({message:`Failed to clean up ${r}: ${t}`,userActionRequired:!1,type:`error`})}return e}async function vt(e){try{let t=await v(`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 B(e),p(`Manually removed ${t}: ${e}`),!0}catch{return!1}}if(W().startsWith(`win32`)){let e=k(n,`claude.cmd`),t=k(n,`claude.ps1`),a=k(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(k(n,`bin`,`claude`),`bin symlink`)&&(r=!0);return r?(p(`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`)?k(n,`node_modules`,e):k(n,`lib`,`node_modules`,e)}`}):{success:!1}}catch(e){return p(`Manual removal failed: ${e}`,{level:`error`}),{success:!1,error:`Manual removal failed: ${e}`}}}async function yt(e){let{code:t,stderr:n}=await v(`npm`,[`uninstall`,`-g`,e],{cwd:process.cwd()});if(t===0)return p(`Removed global npm installation of ${e}`),{success:!0};if(n&&!n.includes(`npm ERR! code E404`)){if(n.includes(`npm error code ENOTEMPTY`)){p(`Failed to uninstall global npm package ${e}: ${n}`,{level:`error`}),p(`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 p(`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=k(D(),`.claude`,`local`);try{await R(i,{recursive:!0}),n++,p(`Removed local installation at ${i}`)}catch(t){l(t)||(e.push(`Failed to remove ${i}: ${t}`),p(`Failed to remove local installation: ${t}`,{level:`error`}))}return{removed:n,errors:e,warnings:t}}var Z,Q,$=e((()=>{S(),Ce(),m(),ce(),d(),xe(),ne(),de(),n(),g(),y(),ge(),ie(),b(),me(),je(),le(),Me(),$e(),we(),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};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Un as e,en as t}from"./state-ix0xIunV.js";import{W as n,z as r}from"./debug-BrXObCdR.js";import{Bt as i,Lt as a,Wt as o}from"./settings-BeLFUeie.js";import{b as s,c,g as l}from"./config-DRDuVyzE.js";import{o as u,s as d}from"./log-BMCygSzM.js";import{Bt as f,_t as p,gt as m,vt as h}from"./model-CZViyZnE.js";import{d as g,m as _,p as v}from"./rcDebugLog-DBB9r8aw.js";import{r as y,t as b}from"./managedEnv-Aq5BXfY7.js";t(),f(),l(),r(),u(),y(),a(),g();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:i(e.permission_mode)}}:{},...typeof e.is_ultraplan_mode==`boolean`?{isUltraplanMode:e.is_ultraplan_mode}:{}})}function S({newState:t,oldState:r}){let i=r.toolPermissionContext.mode,a=t.toolPermissionContext.mode;if(i!==a){let e=o(i),n=o(a);e!==n&&_({permission_mode:n,is_ultraplan_mode:n===`plan`&&t.isUltraplanMode&&!r.isUltraplanMode?!0:null}),v(a)}if(t.mainLoopModel!==r.mainLoopModel&&e(t.mainLoopModel),t.expandedView!==r.expandedView){let e=t.expandedView===`tasks`;c().showExpandedTodos!==e&&s(t=>({...t,showExpandedTodos:e}))}if(t.verbose!==r.verbose&&c().verbose!==t.verbose){let e=t.verbose;s(t=>({...t,verbose:e}))}if(process.env.USER_TYPE===`ant`&&t.tungstenPanelVisible!==r.tungstenPanelVisible&&t.tungstenPanelVisible!==void 0&&c().tungstenPanelVisible!==t.tungstenPanelVisible){let e=t.tungstenPanelVisible;s(t=>({...t,tungstenPanelVisible:e}))}if(t.settings!==r.settings)try{m(),p(),h(),t.settings.env!==r.settings.env&&b()}catch(e){d(n(e))}}export{S as n,x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DSxRz_kt.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}from"./envUtils-DSxRz_kt.js";import{$f as i,Hc as a,Mo as o,Uc as s,Vo as c,Wc as l,Yf as ee,ao as u,at as d,ct as f,ho as p,zo as m}from"./loadAgentsDir-x3rlgED4.js";import{a as h,l as g}from"./debug-BrXObCdR.js";import{Kn as _,Un as te,V as ne,W as v}from"./model-CZViyZnE.js";import{En as re,Tn as y,i as ie,r as b,t as x,wn as S}from"./prompt-CE3sFmZV.js";import{B as C,F as w,L as T,P as E,R as D,ot as ae}from"./rcDebugLog-DBB9r8aw.js";import{n as oe,r as O}from"./client-C6MbjvOB.js";import{n as se,t as k}from"./openaiShared-G2-w4gJt.js";import{homedir as A}from"os";import{join as j}from"path";import{randomUUID as M}from"crypto";import{chmod as ce,mkdir as N,readFile as P,writeFile as F}from"fs/promises";function I(){return j(L(),J)}function L(){return(process.env.CLAUDE_CONFIG_DIR??j(A(),`.claude`)).normalize(`NFC`)}function R(){return j(process.env.CODEX_HOME??j(process.env.HOME??``,`.codex`),`auth.json`)}function z(e){return typeof e==`string`&&e.length>0?e:void 0}function B(e){try{let t=JSON.parse(e);return t&&typeof t==`object`?t:null}catch{return null}}function V(e){let[,t]=e.split(`.`);if(!t)return null;try{let e=t.replace(/-/g,`+`).replace(/_/g,`/`),n=e.padEnd(e.length+(4-e.length%4)%4,`=`);return B(Buffer.from(n,`base64`).toString(`utf8`))}catch{return null}}function H(e){let t=V(e),n=t?.[`https://api.openai.com/auth`];return n&&typeof n==`object`?n:t??{}}function U(e){let t=V(e)?.exp;return typeof t==`number`?t*1e3:null}function W(e){if(e.accountId)return e.accountId;for(let t of[e.idToken,e.accessToken]){if(!t)continue;let e=H(t),n=z(e.chatgpt_account_id)??z(e.chatgpt_account_user_id)??z(e.account_id);if(n)return n}}async function G(e){try{let t=await P(e,`utf8`),n=JSON.parse(t),r=n.tokens,i=r?.id_token,a=r?.access_token,o=r?.refresh_token;return!i||!a||!o?null:{idToken:i,accessToken:a,refreshToken:o,accountId:W({idToken:i,accessToken:a,accountId:r.account_id}),lastRefresh:n.last_refresh}}catch{return null}}async function le(e){let t=I();await N(L(),{recursive:!0});let n={auth_mode:`chatgpt`,tokens:{id_token:e.idToken,access_token:e.accessToken,refresh_token:e.refreshToken,account_id:W(e)},last_refresh:new Date().toISOString()};await F(t,`${JSON.stringify(n,null,2)}\n`,{mode:384}),await ce(t,384).catch(()=>void 0)}async function ue(e,t){let n=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/x-www-form-urlencoded`},body:t});if(!n.ok){let e=await n.text().catch(()=>``);throw Error(`ChatGPT token request failed (${n.status})${e?`: ${e}`:``}`)}return await n.json()}async function de(e){let t=new URLSearchParams({grant_type:`refresh_token`,refresh_token:e.refreshToken,client_id:q,scope:`openid profile email offline_access api.connectors.read api.connectors.invoke`}),n=await ue(`${K}/oauth/token`,t);return{idToken:n.id_token,accessToken:n.access_token,refreshToken:n.refresh_token??e.refreshToken,accountId:W({idToken:n.id_token,accessToken:n.access_token,accountId:e.accountId})}}function fe(){return process.env.OPENAI_AUTH_MODE===`chatgpt`}async function pe(){let e=await G(I());if(e||(e=await G(R()),e&&g(`[OpenAI] Using ChatGPT auth from Codex auth.json`)),!e)throw Error(`ChatGPT account is not logged in.`);let t=U(e.accessToken);return t!==null&&t<=Date.now()+Y&&(e=await de(e),await le(e)),{accessToken:e.accessToken,accountId:e.accountId??W(e)}}var K,q,J,Y,X=e((()=>{h(),K=`https://auth.openai.com`,q=`app_EMoamEEZ73f0CkXaXp7hrann`,J=`openai-chatgpt-auth.json`,Y=300*1e3}));function Z(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
|
|
2
2
|
`):``}function me(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return Z(e);let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`text`&&typeof e.text==`string`)t.push({type:`input_text`,text:e.text});else if(e.type===`image_url`){let n=e.image_url;typeof n?.url==`string`&&t.push({type:`input_image`,image_url:n.url})}}return t.length>0?t:Z(e)}function he(e){let t=[],n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.role;if(i===`system`||i===`developer`){let t=Z(e.content);t&&n.push(t);continue}if(i===`tool`){let n=e.tool_call_id;typeof n==`string`&&t.push({type:`function_call_output`,call_id:n,output:Z(e.content)});continue}if(i===`assistant`){let n=Z(e.content);n&&t.push({role:`assistant`,content:n});let r=e.tool_calls;if(Array.isArray(r))for(let e of r){if(!e||typeof e!=`object`)continue;let n=e,r=n.function,i=typeof n.id==`string`?n.id:void 0,a=typeof r?.name==`string`?r.name:void 0;!i||!a||t.push({type:`function_call`,call_id:i,name:a,arguments:typeof r?.arguments==`string`?r.arguments:`{}`})}continue}i===`user`&&t.push({role:`user`,content:me(e.content)})}return{input:t,instructions:n.length>0?n.join(`
|
|
3
3
|
|
|
4
4
|
`):void 0}}function ge(e){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.function,r=typeof e?.name==`string`?e.name:void 0;r&&t.push({type:`function`,name:r,description:typeof e?.description==`string`?e.description:``,parameters:e?.parameters&&typeof e.parameters==`object`?e.parameters:{type:`object`,properties:{}},strict:!1})}return t}function _e(e){if(e===`required`)return`required`;if(e===`auto`)return`auto`;if(!e||typeof e!=`object`)return e;let t=e,n=t.function;return t.type===`function`&&typeof n?.name==`string`?{type:`function`,name:n.name}:e}function ve(e){let{input:t,instructions:n}=he(e.messages),r=ge(e.tools);return{model:e.model,stream:!0,store:!1,input:t,...n?{instructions:n}:{},...r.length>0?{tools:r}:{},...e.toolChoice?{tool_choice:_e(e.toolChoice)}:{},parallel_tool_calls:!0}}async function*ye(e){if(!e.body)throw Error(`ChatGPT response did not include a body`);let t=e.body.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
|
|
@@ -6,5 +6,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r}f
|
|
|
6
6
|
`);for(;a>=0;){let e=r.slice(0,a);r=r.slice(a+2);let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
|
|
7
7
|
`);if(t&&t!==`[DONE]`){let e=JSON.parse(t);e&&typeof e==`object`&&(yield e)}a=r.indexOf(`
|
|
8
8
|
|
|
9
|
-
`)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${
|
|
10
|
-
`);return i?[
|
|
9
|
+
`)}}}function be(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function xe(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*Q(e,t){let n=`msg_${M().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:xe(e),stop_sequence:null},usage:be(e)},yield{type:`message_stop`}}}}async function Se(e){let t=await pe(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`workmate`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return ye(i)}var Ce=e((()=>{X()}));function we(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(n(process.env.OPENAI_ENABLE_THINKING))return!0;let r=e.toLowerCase();return r.includes(`deepseek`)||r.includes(`mimo`)}function Te(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function Ee(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var De=e((()=>{r()}));function Oe(e,t,n,r){if(!r||s())return e;let i=t.filter(e=>n.has(e.name)).map(x).sort().join(`
|
|
10
|
+
`);return i?[p({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function ke(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:s}=e,c=[],l=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return l.length>0&&t&&c.push({message:{...t,content:m(l,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:M(),timestamp:new Date().toISOString()}),o===`max_tokens`&&c.push(u({content:`Output truncated: response exceeded the ${s} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),c}async function*Ae(e,t,n,r,i){try{let a=ae(i.model),o=c(e,n),s=await l(i.model,n,i.getToolPermissionContext||(async()=>S()),i.agents||[],i.querySource),u=new Set;if(s)for(let e of n)ie(e)&&u.add(e.name);let d=n;s&&u.size>0&&(d=n.filter(e=>!!(!u.has(e.name)||re(e,`SearchExtraTools`))));let p=(await Promise.all(d.map(e=>f(e,{getToolPermissionContext:i.getToolPermissionContext,tools:n,agents:i.agents,allowedAgentTypes:i.allowedAgentTypes,model:i.model,deferLoading:s&&u.has(e.name)})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),m=we(a),h=C(Oe(o.filter(ke),n,u,s),t,{enableThinking:m}),_=D(p),v=T(i.toolChoice);if(s){let e=d.filter(e=>u.has(e.name)).length;g(`[OpenAI] Tool search enabled: ${e}/${u.size} deferred tools included, total tools=${_.length}`)}else g(`[OpenAI] Tool search disabled, total tools=${_.length}`);let{upperLimit:y}=te(a),b=Te(y,i.maxOutputTokensOverride);g(`[OpenAI] Calling model=${a}, messages=${h.length}, tools=${_.length}, thinking=${m}`);let x=fe()?Q(await Se({request:ve({model:a,messages:h,tools:_,toolChoice:v}),signal:r,fetchOverride:i.fetchOverride}),a):w(await oe({maxRetries:0,fetchOverride:i.fetchOverride,source:i.querySource}).chat.completions.create(Ee({model:a,messages:h,tools:_,toolChoice:v,enableThinking:m,maxTokens:b,temperatureOverride:i.temperatureOverride}),{signal:r}),a),E={},O=null,k=null,A={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},j=0,M=Date.now();for await(let e of x){switch(e.type){case`message_start`:O=e.message,j=Date.now()-M,e.message.usage&&(A={...A,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?E[t]={...n,input:``}:n.type===`text`?E[t]={...n,text:``}:n.type===`thinking`?E[t]={...n,thinking:``,signature:``}:E[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=E[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(A=se(A,t)),e.delta.stop_reason!=null&&(k=e.delta.stop_reason);break}case`message_stop`:if(O){for(let e of $({partialMessage:O,contentBlocks:E,tools:n,agentId:i.agentId,usage:A,stopReason:k,maxTokens:b}))yield e;O=null}A.input_tokens+A.output_tokens>0&&ee(ne(a,A),A,i.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:j}:void 0}}if(O)for(let e of $({partialMessage:O,contentBlocks:E,tools:n,agentId:i.agentId,usage:A,stopReason:k,maxTokens:b}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);g(`[OpenAI] Error: ${t}`,{level:`error`}),yield u({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{O(),k(),E(),X(),Ce(),o(),d(),y(),h(),i(),v(),De(),_(),a(),b()}))();export{Ae as queryModelOpenAI};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{b as r,c as i,g as a}from"./config-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{b as r,c as i,g as a}from"./config-DRDuVyzE.js";import{d as o,f as s,o as c,s as l}from"./log-BMCygSzM.js";import{l as u,u as d}from"./oauth-BqJqV-2M.js";import{Bt as f,jt as p}from"./model-CZViyZnE.js";import{a as m,l as h,o as g}from"./api-2cdIPaeq.js";async function _(){try{let{accessToken:e,orgUUID:n}=await h(),r=`${u().BASE_API_URL}/api/oauth/organizations/${n}/overage_credit_grant`;return(await t.get(r,{headers:m(e)})).data}catch(e){return l(e),null}}function v(){let e=p()?.organizationUuid;if(!e)return null;let t=i().overageCreditGrantCache?.[e];return!t||Date.now()-t.timestamp>S?null:t.info}function y(){let e=p()?.organizationUuid;if(!e)return;let t=i().overageCreditGrantCache;!t||!(e in t)||r(t=>{let n={...t.overageCreditGrantCache};return delete n[e],{...t,overageCreditGrantCache:n}})}async function b(){if(s())return;let e=p()?.organizationUuid;if(!e)return;let t=await _();t&&r(n=>{let r=n.overageCreditGrantCache?.[e],i=r?.info,a=i&&i.available===t.available&&i.eligible===t.eligible&&i.granted===t.granted&&i.amount_minor_units===t.amount_minor_units&&i.currency===t.currency;if(a&&r&&Date.now()-r.timestamp<=S)return n;let o={info:a?i:t,timestamp:Date.now()};return{...n,overageCreditGrantCache:{...n.overageCreditGrantCache,[e]:o}}})}function x(e){if(e.amount_minor_units==null||!e.currency)return null;if(e.currency.toUpperCase()===`USD`){let t=e.amount_minor_units/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}return null}var S,C=e((()=>{n(),d(),f(),a(),c(),o(),g(),S=3600*1e3}));export{b as a,y as i,v as n,C as r,x as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,mt as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,mt as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{Ku as u,qu as d}from"./loadAgentsDir-x3rlgED4.js";function f(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function p(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function m(e){let t=[];return e.model&&t.push(e.model),t.push(`${p(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var h,g,_,v,y,b=e((()=>{h={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},g={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},_={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},v={running:`●`,done:`✓`,pending:`○`},y={running:`warning`,done:`success`,pending:`subtle`}}));function x(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function S({agents:e,selectedIndex:t,focused:i}){let[a,s]=o(T),c=w[Math.floor(s/T)%w.length];return e.length===0?(0,C.jsx)(r,{color:`subtle`,children:`(no agents in this phase)`}):(0,C.jsx)(n,{ref:a,flexDirection:`column`,children:e.map((e,a)=>{let o=f(e),s=a===t&&i,l=e.status===`running`?c:o.mark,u=x(e.label??`agent-${e.id}`,E);return(0,C.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,C.jsxs)(n,{children:[(0,C.jsx)(r,{color:o.color,children:l}),(0,C.jsxs)(r,{children:[` `,u]})]}),(0,C.jsx)(r,{color:`subtle`,children:m(e)})]},e.id)})})}var C,w,T,E,D=e((()=>{i(),s(),b(),C=l(),w=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],T=120,E=18}));function O(e,t){return e?.status===`done`?`done`:t.length>0?t.every(e=>e.status===`done`)?`done`:`running`:e?.status===`running`?`running`:`pending`}function k(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=e.agents.filter(e=>e.phase===i);r.push({title:i,status:O(a,o),done:o.filter(e=>e.status===`done`).length,total:o.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);for(let t of e.agents)t.phase&&i(t.phase);return r}function A(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function j(e){return e.filter(e=>e.status===`running`)}function M(e,t){let n=Math.max(0,Math.trunc(t)),r=e.slice(0,n);return{runs:r,overflow:Math.max(0,e.length-r.length)}}function N(e,t){return`${e}#${t.slice(-4)}`}function P(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var F=e((()=>{}));function I({phases:e,agents:t,selectedIndex:i,focused:a}){let[s,c]=o(z),l=R[Math.floor(c/z)%R.length],u=t.length;return(0,L.jsx)(n,{ref:s,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let o=t===i,s=o&&a,c=e.status===`running`?l:e.status?v[e.status]:` `,u=e.status?y[e.status]:`subtle`;return(0,L.jsxs)(n,{backgroundColor:s?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,L.jsxs)(n,{children:[(0,L.jsx)(r,{color:o?`claude`:void 0,children:s?`>`:` `}),(0,L.jsx)(r,{children:` `}),(0,L.jsx)(r,{color:u,children:c}),(0,L.jsxs)(r,{children:[` `,e.title]})]}),(0,L.jsxs)(r,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var L,R,z,B=e((()=>{i(),s(),b(),F(),L=l(),R=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],z=120}));function V({runs:e,activeRunId:t}){if(e.length===0)return(0,H.jsx)(r,{color:`subtle`,children:`(no runs)`});let{runs:i,overflow:a}=M(e,W);return(0,H.jsxs)(n,{children:[i.map(e=>{let i=e.runId===t,a=x(N(e.workflowName,e.runId),U),o=`═`.repeat(a.length+2);return(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(n,{children:[(0,H.jsx)(r,{color:g[e.status],children:h[e.status]}),(0,H.jsx)(r,{children:` `}),(0,H.jsx)(r,{color:i?`claude`:void 0,bold:i,children:a})]}),(0,H.jsx)(r,{color:i?`claude`:void 0,children:i?o:``})]},e.runId)}),a>0?(0,H.jsxs)(n,{flexDirection:`column`,marginRight:2,children:[(0,H.jsxs)(r,{color:`subtle`,children:[`+`,a]}),(0,H.jsx)(r,{children:` `})]}):null]})}var H,U,W,G=e((()=>{i(),s(),b(),F(),D(),H=l(),U=18,W=6}));function K(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function q(e,t=`normal`){a((n,r)=>{let i=K(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var J=e((()=>{s()}));function Y(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function ee(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function te({onDone:e,context:t}){let i=u(),a=(0,X.useSyncExternalStore)(i.subscribe,()=>i.listRuns(),()=>[]),s=j(a),[l,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(`phases`),[m,h]=(0,X.useState)(0),[v,y]=(0,X.useState)(0),[b,x]=(0,X.useState)(null);(0,X.useEffect)(()=>{i.loadPersistedRuns()},[i]),(0,X.useEffect)(()=>{if(s.length===0){l!==null&&d(null);return}s.some(e=>e.runId===l)||d(s[0].runId)},[s,l]);let C=s.find(e=>e.runId===l),w=C?k(C):[],T=w.length+1,E=Y(m,T),D=(0,X.useRef)(null);(0,X.useEffect)(()=>{let t=C?{runId:C.runId,status:C.status}:null,n=D.current;if(D.current=t,!ee(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[C?.runId,C?.status,e]);let O=E===0?void 0:w[E-1]?.title,M=C?A(C.agents,O):[],N=Y(v,M.length),F=e=>{d(e),p(`phases`),h(0),y(0)};q({nextTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e+1)%s.length];F(t.runId)},prevTab:()=>{if(s.length===0)return;let e=s.findIndex(e=>e.runId===l),t=s[(e-1+s.length)%s.length];F(t.runId)},focusLeft:()=>p(`phases`),focusRight:()=>p(`agents`),moveUp:()=>{f===`phases`?h(e=>Y(e-1,T)):y(e=>Y(e-1,M.length))},moveDown:()=>{f===`phases`?h(e=>Y(e+1,T)):y(e=>Y(e+1,M.length))},killAgent:()=>{f!==`agents`||!C||M[N]&&x(`agent`)},killWorkflow:()=>{C&&x(`workflow`)},resumeFocused:()=>{if(!C)return;let n=t.canUseTool;if(!n){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}i.launch({resumeFromRunId:C.runId,name:C.workflowName},t,n).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(b!==null){x(null);return}e()},confirmYes:()=>{if(b===`workflow`&&C){i.kill(C.runId),x(null),e();return}else if(b===`agent`&&C){let e=M[N];e&&i.killAgent(C.runId,e.id)}x(null)},confirmNo:()=>x(null)},b===null?`normal`:`confirm`);let L=a.filter(e=>e.status===`running`).length,R=a.length-L,z=O??`All`,B=C?C.agents.filter(e=>e.status===`done`).length:0,[H]=o(1e3),U=C?Date.now()-C.startedAt:0;return(0,Z.jsxs)(n,{ref:H,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,Z.jsxs)(n,{justifyContent:`space-between`,children:[(0,Z.jsx)(r,{bold:!0,children:C?.workflowName??`Workflows`}),C?(0,Z.jsxs)(r,{color:`subtle`,children:[B,`/`,C.agentCount,` agents · `,P(U),` ·`,` `,(0,Z.jsx)(r,{color:g[C.status],children:_[C.status]})]}):(0,Z.jsxs)(r,{color:`subtle`,children:[L,` running · `,R,` done`]})]}),C?.description?(0,Z.jsx)(r,{color:`subtle`,children:C.description}):null,s.length>1?(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(V,{runs:s,activeRunId:l})}):null,(0,Z.jsxs)(n,{flexDirection:`row`,marginTop:1,children:[(0,Z.jsxs)(n,{width:`25%`,flexDirection:`column`,children:[(0,Z.jsx)(r,{color:f===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,Z.jsx)(I,{phases:w,agents:C?.agents??[],selectedIndex:E,focused:f===`phases`})]}),(0,Z.jsx)(r,{color:`subtle`,children:`│`}),(0,Z.jsxs)(n,{flexGrow:1,flexDirection:`column`,children:[(0,Z.jsxs)(r,{color:f===`agents`?`claude`:`subtle`,bold:!0,children:[z,` · `,M.length,` agents`]}),(0,Z.jsx)(S,{agents:M,selectedIndex:N,focused:f===`agents`})]})]}),(0,Z.jsx)(n,{marginTop:1,children:(0,Z.jsx)(r,{color:`subtle`,children:b===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),b===null?null:(0,Z.jsx)(c,{title:b===`workflow`?`Kill workflow "${C?.workflowName??``}"?`:`Kill agent "${M[N]?.label??``}"?`,subtitle:b===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>x(null),color:`warning`,children:(0,Z.jsx)(r,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var X,Z,ne=e((()=>{X=t(i(),1),s(),d(),D(),B(),G(),b(),J(),F(),Z=l()})),Q,$;e((()=>{ne(),Q=l(),$=async(e,t,n)=>(0,Q.jsx)(te,{onDone:e,context:t})}))();export{$ as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Fr as t,Mi as n,Ni as r,Pr as i}from"./state-ix0xIunV.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Fr as t,Mi as n,Ni as r,Pr as i}from"./state-ix0xIunV.js";import{MD as a,ND as o}from"./loadAgentsDir-x3rlgED4.js";function s(e,t,n,r){for(var i=-1,a=e==null?0:e.length;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}var c=e((()=>{}));function l(e,t,n,r){return a(e,function(e,i,a){t(r,e,n(e),a)}),r}var u=e((()=>{o()}));function d(e,t){return function(n,a){var o=r(n)?s:l,c=t?t():{};return o(n,e,i(a,2),c)}}var f=e((()=>{c(),u(),t(),n()})),p,m=e((()=>{f(),p=d(function(e,t,n){e[+!n].push(t)},function(){return[[],[]]})}));export{p as n,m as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,dr as o,fi as s,hn as c,t as l,x as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,Lt as r,P as i,Wt as a,dr as o,fi as s,hn as c,t as l,x as u}from"./src-CDCSSo0U2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{Jt as f,vn as p,yn as m}from"./settings-BeLFUeie.js";import{b as h,c as g,g as _}from"./config-DRDuVyzE.js";import{o as v,s as y}from"./log-BMCygSzM.js";import{n as b,r as x}from"./analytics-BotDBGh0.js";import{i as S,n as C,o as w,r as T,s as E,u as D}from"./referral-CKmHHxj_.js";import{n as O,t as k}from"./useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js";function A({onDone:e}){let[t,s]=(0,j.useState)(!0),[l,d]=(0,j.useState)([]),[f,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(null),[_,v]=(0,j.useState)(void 0),b=O(()=>e(`Guest passes dialog dismissed`,{display:`system`}));if(a(`confirm:no`,(0,j.useCallback)(()=>{e(`Guest passes dialog dismissed`,{display:`system`})},[e]),{context:`Confirmation`}),c((t,n)=>{n.return&&h&&o(h).then(t=>{t&&process.stdout.write(t),x(`tengu_guest_passes_link_copied`,{}),e(`Referral link copied to clipboard!`)})}),(0,j.useEffect)(()=>{async function e(){try{let e=await S();if(!e||!e.eligible){m(!1),s(!1);return}m(!0),e.referral_code_details?.referral_link&&g(e.referral_code_details.referral_link),v(e.referrer_reward);let t=e.referral_code_details?.campaign??`claude_code_guest_pass`,n;try{n=await C(t)}catch(e){y(e),m(!1),s(!1);return}let r=n.redemptions||[],i=n.limit||3,a=[];for(let e=0;e<i;e++){let t=r[e];a.push({passNumber:e+1,isAvailable:!t})}d(a),s(!1)}catch(e){y(e),m(!1),s(!1)}}e()},[]),t)return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`Loading guest pass information…`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});if(!f)return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{children:`Guest passes are not currently available.`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});let w=p(l,e=>e.isAvailable),E=[...l].sort((e,t)=>t.isAvailable-+e.isAvailable),D=e=>e.isAvailable?(0,M.jsxs)(n,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{children:`┌──────────┐`}),(0,M.jsxs)(i,{children:[` ) CC `,(0,M.jsx)(i,{color:`claude`,children:`✻`}),` ┊ ( `]}),(0,M.jsx)(i,{children:`└──────────┘`})]},e.passNumber):(0,M.jsxs)(n,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`┌─────────╱`}),(0,M.jsx)(i,{dimColor:!0,children:` ) CC ✻ ┊╱`}),(0,M.jsx)(i,{dimColor:!0,children:`└───────╱`})]},e.passNumber);return(0,M.jsx)(u,{children:(0,M.jsxs)(n,{flexDirection:`column`,gap:1,children:[(0,M.jsxs)(i,{color:`permission`,children:[`Guest passes · `,w,` left`]}),(0,M.jsx)(n,{flexDirection:`row`,marginLeft:2,children:E.slice(0,3).map(e=>D(e))}),h&&(0,M.jsx)(n,{marginLeft:2,children:(0,M.jsx)(i,{children:h})}),(0,M.jsx)(n,{flexDirection:`column`,marginLeft:2,children:(0,M.jsxs)(i,{dimColor:!0,children:[_?`Share a free week of Claude Code with friends. If they love it and subscribe, you'll get ${T(_)} of extra usage to keep building. `:`Share a free week of Claude Code with friends. `,(0,M.jsx)(r,{url:_?`https://support.claude.com/en/articles/13456702-claude-code-guest-passes`:`https://support.claude.com/en/articles/12875061-claude-code-guest-passes`,children:`Terms apply.`})]})}),(0,M.jsx)(n,{children:(0,M.jsx)(i,{dimColor:!0,italic:!0,children:b.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,b.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Enter to copy link · Esc to cancel`})})})]})})}var j,M,N=e((()=>{s(),j=t(s(),1),f(),k(),l(),D(),b(),E(),m(),v(),M=d()}));async function P(e){let t=!g().hasVisitedPasses;if(t){let e=w();h(t=>({...t,hasVisitedPasses:!0,passesLastSeenRemaining:e??t.passesLastSeenRemaining}))}return x(`tengu_guest_passes_visited`,{is_first_visit:t}),(0,F.jsx)(A,{onDone:e})}var F;e((()=>{s(),N(),b(),E(),_(),F=d()}))();export{P as call};
|
|
@@ -0,0 +1,3 @@
|
|
|
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,Ex as S,FS as ae,G as C,H as oe,K as w,LS as se,Mo as T,PS as E,Tx as D,U as ce,V as le,XS as O,_w as k,ax as A,du as ue,ix as j,pD as M,pw as de,uD as N,uo as fe,uu as P,vw as pe}from"./loadAgentsDir-x3rlgED4.js";import{S as F,w as I}from"./debug-BrXObCdR.js";import{H as L,V as R,g as z,o as B,pn as V,sn as me,z as H}from"./settings-BeLFUeie.js";import{l as he,o as ge}from"./stringUtils-DGLPkqJ4.js";import{u as _e}from"./referral-CKmHHxj_.js";import{n as ve,t as ye}from"./useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js";import{n as be,t as xe}from"./AddWorkspaceDirectory-CFrrXnt9.js";import{t as Se}from"./SearchBox-vfLXEPed.js";import{n as Ce,t as we}from"./useSearchInput-C5OzQnX6.js";import{n as Te,t as Ee}from"./shadowedRuleDetection-C6R5zOUe.js";import{n as U,t as De}from"./autoModeDenials-BxNzGJdR.js";function Oe({ruleValue:e}){switch(e.toolName){case P.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(),_(),ue(),W=b()}));function Ae(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${B(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${B(`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=me.map(Ae),l=(0,Me.useCallback)(i=>{if(i===`cancel`){t();return}else if(me.includes(i)){let t=i,a=de(o,{type:`addRules`,rules:n,behavior:r,destination:t});pe({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:N.isSandboxingEnabled()&&N.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 ${he(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)(j,{options:c,onChange:l})]})]})}var Me,G,Ne=e((()=>{u(),Me=t(u(),1),A(),_(),k(),H(),Te(),M(),V(),z(),ge(),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:P.name})}),(0,K.jsx)(a,{bold:!1,children:` or `}),(0,K.jsx)(a,{bold:!0,children:L({toolName:P.name,ruleContent:`ls:*`})})]}),(0,K.jsx)(i,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,K.jsx)(D,{showCursor:!0,value:s,onChange:c,onSubmit:e=>{let r=e.trim();r.length!==0&&t(R(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),S(),ye(),O(),_(),_e(),ue(),H(),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)(j,{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(),A(),J=b()}));function ze({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:o}){let s=(0,Be.useCallback)(()=>{o(de(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)(j,{onChange:c,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var Be,Y,Ve=e((()=>{u(),Be=t(u(),1),A(),_(),k(),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)(j,{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(),A(),_(),Z=b()}));function Ge({rule:e}){return(0,$.jsx)(a,{dimColor:!0,children:`From ${w(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)(j,{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)(j,{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=ae(e=>e.toolPermissionContext),p=se(),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,w]=(0,Q.useState)(null),[T,E]=(0,Q.useState)(!1),[D,O]=(0,Q.useState)(null),[k,A]=(0,Q.useState)(!1),[ue,j]=(0,Q.useState)(!0),M=(0,Q.useCallback)(e=>{j(e)},[]),N=(0,Q.useMemo)(()=>{let e=new Map;return le(f).forEach(t=>{e.set(I(t),t)}),e},[f]),fe=(0,Q.useMemo)(()=>{let e=new Map;return ce(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]),F=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return N;case`deny`:return fe;case`ask`:return P;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}},[N,fe,P]),R=ve(),z=!_&&!x&&!C&&!T&&!D,{query:B,setQuery:V,cursorOffset:me}=Ce({isActive:z&&k,onExit:()=>{A(!1)}}),H=(0,Q.useCallback)(e=>{z&&(k||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),A(!0),V(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),A(!0),V(e.key))))},[z,k,V]),he=(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]),ge=(0,Q.useCallback)(()=>{S(null)},[]),_e=(0,Q.useCallback)((e,t)=>{w({ruleValue:e,ruleBehavior:t}),S(null)},[]),ye=(0,Q.useCallback)((e,t)=>{w(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)(()=>{w(null)},[]),Se=(0,Q.useCallback)(()=>E(!0),[]),we=(0,Q.useCallback)(e=>O(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&&!k});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:ge,onSubmit:_e,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(T)return(0,$.jsx)(xe,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=de(f,n);p(e=>({...e,toolPermissionContext:r})),t&&pe(n),d(n=>[...n,`Added directory ${v.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),E(!1)},onCancel:()=>E(!1),permissionContext:f});if(D)return(0,$.jsx)(ze,{directoryPath:D,onRemove:()=>{d(e=>[...e,`Removed directory ${v.bold(D)} from workspace`]),O(null)},onCancel:()=>O(null),permissionContext:f,setPermissionContext:e=>{p(t=>({...t,toolPermissionContext:e}))}});let U={searchQuery:B,isSearchMode:k,isFocused:ee,onCancel:Te,lastFocusedRuleKey:b,cursorOffset:me,getRulesOptions:F,handleToolSelect:he,onHeaderFocusChange:M};return(0,$.jsx)(i,{flexDirection:`column`,onKeyDown:H,children:(0,$.jsxs)(ne,{color:`permission`,children:[(0,$.jsxs)(g,{title:`Permissions:`,color:`permission`,defaultTab:l,hidden:!!_||!!x||!!C||T||!!D,initialHeaderFocused:!c,navFromContent:!k,children:[(0,$.jsx)(m,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Le,{onHeaderFocusChange:M,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:`Work Mate 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:M})]})})]}),(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`]}):ue?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):k?(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),E(),k(),A(),ye(),we(),_(),_e(),U(),H(),C(),F(),Se(),Ne(),be(),ke(),Ie(),Re(),Ve(),We(),$=b()})),Qe,$e;e((()=>{Ze(),T(),Qe=b(),$e=async(e,t)=>(0,Qe.jsx)(Xe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,fe(e)])}})}))();export{$e as call};
|
|
@@ -1,3 +1,3 @@
|
|
|
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{
|
|
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{$S as ee,pD as te,uD as ne}from"./loadAgentsDir-x3rlgED4.js";import{n as re}from"./cwd-CYmmnQVS.js";import{C as l,E as ie,H as ae,O as oe,S as u,V as se,W as ce,a as d,d as f,l as p,p as m,w as le,z as h}from"./debug-BrXObCdR.js";import{$t as ue,M as g,P as de,Xt as fe,en as pe,g as me,n as he,nn as ge}from"./settings-BeLFUeie.js";import{a as _e,c as _,g as v,i as ve}from"./config-DRDuVyzE.js";import{c as ye,n as y,o as be,r as b,t as x}from"./execFileNoThrow-D244NytW.js";import{o as S,s as C}from"./log-BMCygSzM.js";import{n as xe,t as Se}from"./which-CKQnSouy.js";import{i as w,o as T}from"./platform-BrYefG_2.js";import{n as E,t as Ce}from"./bundledMode--fG1S62b.js";import{i as we,r as Te}from"./genericProcessUtils-CdQTApYX.js";import{a as Ee,i as De}from"./ripgrep-BXmXjAzA.js";import{n as Oe,r as ke}from"./semver-BMRJYn3q.js";import{homedir as D}from"os";import{basename as Ae,delimiter as je,join as O,posix as k,win32 as A}from"path";import{constants as Me}from"fs";import{access as j,open as Ne,readFile as M,realpath as N,stat as Pe}from"fs/promises";function P(){return O(a(),`local`)}function Fe(){return O(P(),`claude`)}function Ie(){return(process.argv[1]||``).includes(`/.claude/local/node_modules/`)}async function F(){try{return await j(O(P(),`node_modules`,`.bin`,`claude`)),!0}catch{return!1}}function I(){let e=process.env.SHELL||``;return e.includes(`zsh`)?`zsh`:e.includes(`bash`)?`bash`:e.includes(`fish`)?`fish`:`unknown`}var L=e((()=>{v(),o(),h(),b(),m(),S(),u()}));function R(e){let t=e?.homedir??D();return{zsh:O((e?.env??process.env).ZDOTDIR||t,`.zshrc`),bash:O(t,`.bashrc`),fish:O(t,`.config/fish/config.fish`)}}function Le(e){let t=!1;return{filtered:e.filter(e=>{if(V.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()===Fe())return t=!0,!1}return!0}),hadAlias:t}}async function z(e){try{return(await M(e,{encoding:`utf8`})).split(`
|
|
2
2
|
`)}catch(e){if(ae(e))return null;throw e}}async function Re(e,t){let n=await Ne(e,`w`);try{await n.writeFile(t.join(`
|
|
3
|
-
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await B(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){let e=await Ve();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Ve(){try{return{}}catch(e){return C(e),{}}}function He(e){let t=ge()?.minimumVersion;if(!t)return!1;let n=!Oe(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ue(){let e=ue.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function We(){try{let e=await Ue();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Ye(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function Ge(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ke(e){try{return(await s.get(`${Je}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function qe(){let[e,t]=await Promise.all([Ke(`latest`),Ke(`stable`)]);return{latest:e,stable:t}}var Je,Ye,Xe=e((()=>{c(),v(),d(),pe(),o(),h(),b(),m(),te(),S(),ke(),he(),H(),u(),Je=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Ye=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function $e(){if(w()!==`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 p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,et,tt=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/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}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),et=t(async()=>W()?`homebrew`:$e()?`winget`:Ze()?`mise`:Qe()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function nt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function rt(){let[e]=nt();if(E())return W()||$e()||Ze()||Qe()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Ie())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 be(`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 it(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function at(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function ot(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(_().installMethod===`native`){let n=O(D(),`.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 st(e){let t=[];try{let e=l(await M(O(fe(),`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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.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: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(w()===`windows`){let e=n.split(k.sep).join(A.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=I(),n=R()[e],r=n?n.replace(D(),`~`):`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 F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`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 ct(){if(w()!==`linux`)return[];let e=[],t=ne.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 lt(){let e=await rt(),t=typeof MACRO<`u`?`0.0.6`:`unknown`,n=await it(),r=at(),i=await ot(),a=await st(e);if(a.push(...ct()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`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=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await We()).hasPermissions,!s&&!_e()&&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=De(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await et():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var ut=e((()=>{ye(),Xe(),Ce(),v(),re(),o(),b(),m(),L(),tt(),T(),Ee(),ee(),me(),de(),H(),u(),Se()}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Te(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Z(e){let t=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=f(),r=Ae(e);if(Q(t))return p(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(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 gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=f(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(se(e))return n;C(ce(e))}return n}function vt(e){let t=f(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,yt=e((()=>{d(),o(),h(),m(),we(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,gt as c,ut as d,qe as f,He as g,Xe as h,yt as i,rt as l,Ge as m,vt as n,dt as o,Be as p,_t as r,Z as s,ht as t,lt as u,R as v,Re as x,H as y};
|
|
3
|
+
`),{encoding:`utf8`}),await n.datasync()}finally{await n.close()}}async function B(e){let t=R(e);for(let e of Object.values(t)){let t=await z(e);if(t){for(let e of t)if(V.test(e)){let t=e.match(/alias\s+claude=["']?([^"'\s]+)/);if(t&&t[1])return t[1]}}}return null}async function ze(e){let t=await B(e);if(!t)return null;let n=e?.homedir??D(),r=t.startsWith(`~`)?t.replace(`~`,n):t;try{let e=await Pe(r);if(e.isFile()||e.isSymbolicLink())return t}catch{}return null}var V,H=e((()=>{h(),L(),V=/^\s*alias\s+claude\s*=/}));async function Be(){let e=await Ve();return process.env.USER_TYPE===`ant`?e.ant||void 0:e.external||void 0}async function Ve(){try{return{}}catch(e){return C(e),{}}}function He(e){let t=he()?.minimumVersion;if(!t)return!1;let n=!Oe(e,t);return n&&p(`Skipping update to ${e} - below minimumVersion ${t}`),n}async function Ue(){let e=fe.isRunningWithBun(),t=null;return t=e?await y(`bun`,[`pm`,`bin`,`-g`],{cwd:D()}):await y(`npm`,[`-g`,`config`,`get`,`prefix`],{cwd:D()}),t.code===0?t.stdout.trim():(C(Error(`Failed to check ${e?`bun`:`npm`} permissions`)),null)}async function We(){try{let e=await Ue();if(!e)return{hasPermissions:!1,npmPrefix:null};try{return await j(e,Me.W_OK),{hasPermissions:!0,npmPrefix:e}}catch{return C(new Ye(`Insufficient permissions for global npm install.`)),{hasPermissions:!1,npmPrefix:e}}}catch(e){return C(e),{hasPermissions:!1,npmPrefix:null}}}async function Ge(){let e=await y(`npm`,[`view`,``,`dist-tags`,`--json`,`--prefer-online`],{abortSignal:AbortSignal.timeout(5e3),cwd:D()});if(e.code!==0)return p(`npm view dist-tags failed with code ${e.code}`),{latest:null,stable:null};try{let t=l(e.stdout.trim());return{latest:typeof t.latest==`string`?t.latest:null,stable:typeof t.stable==`string`?t.stable:null}}catch(e){return p(`Failed to parse dist-tags: ${e}`),{latest:null,stable:null}}}async function Ke(e){try{return(await s.get(`${Je}/${e}`,{timeout:5e3,responseType:`text`})).data.trim()}catch(t){return p(`Failed to fetch ${e} from GCS: ${t}`),null}}async function qe(){let[e,t]=await Promise.all([Ke(`latest`),Ke(`stable`)]);return{latest:e,stable:t}}var Je,Ye,Xe=e((()=>{c(),v(),d(),ue(),o(),h(),b(),m(),ee(),S(),ke(),me(),H(),u(),Je=`https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases`,Ye=class extends oe{}}));function U(e,t){return t.includes(e.id)||e.idLike.some(e=>t.includes(e))}function Ze(){let e=process.execPath||process.argv[0]||``;return/[/\\]mise[/\\]installs[/\\]/i.test(e)?(p(`Detected mise installation: ${e}`),!0):!1}function Qe(){let e=process.execPath||process.argv[0]||``;return/[/\\]\.?asdf[/\\]installs[/\\]/i.test(e)?(p(`Detected asdf installation: ${e}`),!0):!1}function W(){let e=w();if(e!==`macos`&&e!==`linux`&&e!==`wsl`)return!1;let t=process.execPath||process.argv[0]||``;return t.includes(`/Caskroom/`)?(p(`Detected Homebrew cask installation: ${t}`),!0):!1}function $e(){if(w()!==`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 p(`Detected winget installation: ${e}`),!0;return!1}var G,K,q,J,Y,et,tt=e((()=>{n(),d(),b(),T(),G=t(async()=>{try{let e=await M(`/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}}),K=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`arch`]))return!1;let t=await x(`pacman`,[`-Qo`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected pacman installation: ${t.stdout.trim()}`),!0):!1}),q=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`debian`]))return!1;let t=await x(`dpkg`,[`-S`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected deb installation: ${t.stdout.trim()}`),!0):!1}),J=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`fedora`,`rhel`,`suse`]))return!1;let t=await x(`rpm`,[`-qf`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected rpm installation: ${t.stdout.trim()}`),!0):!1}),Y=t(async()=>{if(w()!==`linux`)return!1;let e=await G();if(e&&!U(e,[`alpine`]))return!1;let t=await x(`apk`,[`info`,`--who-owns`,process.execPath||process.argv[0]||``],{timeout:5e3,useCwd:!1});return t.code===0&&t.stdout?(p(`Detected apk installation: ${t.stdout.trim()}`),!0):!1}),et=t(async()=>W()?`homebrew`:$e()?`winget`:Ze()?`mise`:Qe()?`asdf`:await K()?`pacman`:await Y()?`apk`:await q()?`deb`:await J()?`rpm`:`unknown`)}));function nt(){let e=process.argv[1]||``,t=process.execPath||process.argv[0]||``;return w()===`windows`&&(e=e.split(A.sep).join(k.sep),t=t.split(A.sep).join(k.sep)),[e,t]}async function rt(){let[e]=nt();if(E())return W()||$e()||Ze()||Qe()||await K()||await q()||await J()||await Y()?`package-manager`:`native`;if(Ie())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 be(`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 it(){if(E()){try{return await N(process.execPath)}catch{}try{let e=await xe(`claude`);if(e)return e}catch{}try{return await f().stat(O(D(),`.local/bin/claude`)),O(D(),`.local/bin/claude`)}catch{}return`native`}try{return process.argv[0]||`unknown`}catch{return`unknown`}}function at(){try{return E()?process.execPath||`unknown`:process.argv[1]||`unknown`}catch{return`unknown`}}async function ot(){let e=f(),t=[],n=O(D(),`.claude`,`local`);await F()&&t.push({type:`npm-local`,path:n});let r=[`@anthropic-ai/claude-code`],i=await x(`npm`,[`-g`,`config`,`get`,`prefix`]);if(i.code===0&&i.stdout){let n=i.stdout.trim(),a=w()===`windows`,o=a?O(n,`claude`):O(n,`bin`,`claude`),s=!1;try{await e.stat(o),s=!0}catch{}if(s){let e=!1;try{(await N(o)).includes(`/Caskroom/`)&&(e=W())}catch{}e||t.push({type:`npm-global`,path:o})}else for(let i of r){let r=a?O(n,`node_modules`,i):O(n,`lib`,`node_modules`,i);try{await e.stat(r),t.push({type:`npm-global-orphan`,path:r})}catch{}}}let a=O(D(),`.local`,`bin`,`claude`);try{await e.stat(a),t.push({type:`native`,path:a})}catch{}if(_().installMethod===`native`){let n=O(D(),`.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 st(e){let t=[];try{let e=l(await M(O(pe(),`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: ${g.join(`, `)}.`});else{let e=n.filter(e=>typeof e==`string`&&!g.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: ${g.join(`, `)}. Either remove them, or this client is older than the managed-settings intended.`})}}catch{}let n=_();if(e===`development`)return t;if(e===`native`){let e=(process.env.PATH||``).split(je),n=O(D(),`.local`,`bin`),r=n;if(w()===`windows`&&(r=n.split(A.sep).join(k.sep)),!e.some(e=>{let t=e;w()===`windows`&&(t=e.split(A.sep).join(k.sep));let n=t.replace(/\/+$/,``),i=e.replace(/[/\\]+$/,``);return n===r||i===`~/.local/bin`||i===`$HOME/.local/bin`}))if(w()===`windows`){let e=n.split(k.sep).join(A.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=I(),n=R()[e],r=n?n.replace(D(),`~`):`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 F()&&t.push({issue:`Local installation exists but not being used`,fix:`Consider using native installation: claude install`});let r=await B(),a=await ze();return e===`npm-local`&&!await xe(`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 ct(){if(w()!==`linux`)return[];let e=[],t=ne.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 lt(){let e=await rt(),t=typeof MACRO<`u`?`0.0.7`:`unknown`,n=await it(),r=at(),i=await ot(),a=await st(e);if(a.push(...ct()),e===`native`){let e=i.filter(e=>e.type===`npm-global`||e.type===`npm-global-orphan`||e.type===`npm-local`),t=w()===`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=_().installMethod||`not set`,s=null;e===`npm-global`&&(s=(await We()).hasPermissions,!s&&!_e()&&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=De(),ee={working:c.working??!0,mode:c.mode,systemPath:c.mode===`system`?c.path:null,note:c.note??null},te=e===`package-manager`?await et():void 0;return{installationType:e,version:t,installationPath:n,invokedBinary:r,configInstallMethod:o,autoUpdates:(()=>{let e=_e();return e?`disabled (${ve(e)})`:`enabled`})(),hasUpdatePermissions:s,multipleInstallations:i,warnings:a,packageManager:te,ripgrepStatus:ee}}var ut=e((()=>{ye(),Xe(),Ce(),v(),re(),o(),b(),m(),L(),tt(),T(),Ee(),te(),ge(),de(),H(),u(),Se()}));function dt(){let e=process.env.ENABLE_PID_BASED_VERSION_LOCKING;return i(e)?!0:(r(e),!1)}function X(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}function ft(e,t){if(!X(e))return!1;if(e===process.pid)return!0;try{let n=Te(e);if(!n)return!0;let r=n.toLowerCase(),i=t.toLowerCase();return r.includes(`claude`)||r.includes(i)}catch{return!0}}function Z(e){let t=f();try{let n=t.readFileSync(e,{encoding:`utf8`});if(!n||n.trim()===``)return null;let r=l(n);return typeof r.pid!=`number`||!r.version||!r.execPath?null:r}catch{return null}}function Q(e){let t=Z(e);if(!t)return!1;let{pid:n,execPath:r}=t;if(!X(n))return!1;if(!ft(n,r))return p(`Lock PID ${n} is running but does not appear to be Claude - treating as stale`),!1;let i=f();try{let t=i.statSync(e);if(Date.now()-t.mtimeMs>$&&!X(n))return!1}catch{}return!0}function pt(e,t){let n=f(),r=`${e}.tmp.${process.pid}.${Date.now()}`;try{ie(r,le(t,null,2),{encoding:`utf8`,flush:!0}),n.renameSync(r,e)}catch(e){try{n.unlinkSync(r)}catch{}throw e}}async function mt(e,t){let n=f(),r=Ae(e);if(Q(t))return p(`Cannot acquire lock for ${r} - held by PID ${Z(t)?.pid}`),null;let i={pid:process.pid,version:r,execPath:process.execPath,acquiredAt:Date.now()};try{return pt(t,i),Z(t)?.pid===process.pid?(p(`Acquired PID lock for ${r} (PID ${process.pid})`),()=>{try{Z(t)?.pid===process.pid&&(n.unlinkSync(t),p(`Released PID lock for ${r}`))}catch(e){p(`Failed to release lock for ${r}: ${e}`)}}):null}catch(e){return p(`Failed to acquire lock for ${r}: ${e}`),null}}async function ht(e,t){let n=await mt(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 gt(e,t,n){let r=await mt(e,t);if(!r)return!1;try{return await n(),!0}finally{r()}}function _t(e){let t=f(),n=[];try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let t of r){let r=O(e,t),i=Z(r);i&&n.push({version:i.version,pid:i.pid,isProcessRunning:X(i.pid),execPath:i.execPath,acquiredAt:new Date(i.acquiredAt),lockFilePath:r})}}catch(e){if(se(e))return n;C(ce(e))}return n}function vt(e){let t=f(),n=0;try{let r=t.readdirStringSync(e).filter(e=>e.endsWith(`.lock`));for(let i of r){let r=O(e,i);try{t.lstatSync(r).isDirectory()?(t.rmSync(r,{recursive:!0,force:!0}),n++,p(`Cleaned up legacy directory lock: ${i}`)):Q(r)||(t.unlinkSync(r),n++,p(`Cleaned up stale lock: ${i}`))}catch{}}}catch(e){if(se(e))return 0;C(ce(e))}return n}var $,yt=e((()=>{d(),o(),h(),m(),we(),S(),u(),$=7200*1e3}));export{L as C,I as S,Le as _,Q as a,z as b,gt as c,ut as d,qe as f,He as g,Xe as h,yt as i,rt as l,Ge as m,vt as n,dt as o,Be as p,_t as r,Z as s,ht as t,lt as u,R as v,Re as x,H as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Yt as o,en as s}from"./state-ix0xIunV.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,fi as r,t as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Yt as o,en as s}from"./state-ix0xIunV.js";import{$y as c,A as l,C as u,Eg as d,_w as f,eb as p,pw as m,rb as h,vg as g}from"./loadAgentsDir-x3rlgED4.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-CyTzyjwG.js";import{r as x,t as S}from"./staticRender-BIxpgNUq.js";function C({planContent:e,planPath:r,editorName:i}){return(0,T.jsxs)(t,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:r}),(0,T.jsx)(t,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),i&&(0,T.jsxs)(t,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:i})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){o(a,`plan`),i(e=>({...e,toolPermissionContext:m(l(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let s=c(),u=p();if(!s)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(u);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${u}`),null}let f=v();return e(await x((0,T.jsx)(C,{planContent:s,planPath:u,editorName:f?d(f):void 0}))),null}var T;e((()=>{r(),s(),i(),_(),g(),f(),u(),h(),y(),S(),T=a()}))();export{w as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./PluginSettings-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./PluginSettings-uY5KTCtK.js";async function a(e,t,n){return(0,o.jsx)(i,{onComplete:e,args:n})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{As as t,Fs as n,Ps as r,QD as i,Rs as a,XD as o,ws as s,xs as c,ys as l}from"./loadAgentsDir-x3rlgED4.js";import{F as u,a as d,l as f,z as p}from"./debug-BrXObCdR.js";import{Dt as m,wt as h}from"./settings-BeLFUeie.js";import{g,x as _}from"./config-DRDuVyzE.js";import{o as v,s as y}from"./log-BMCygSzM.js";import{f as b,s as x}from"./pluginOperations-Cs_Z4C6O.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await n(),r=t(),i=new Set;for(let[t,n]of Object.entries(e)){let e=r[t]?.autoUpdate;(e===void 0?m(t,n):e)&&i.add(t.toLowerCase())}return i}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,f(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||f(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){f(`Plugin autoupdate: error updating ${e}: ${u(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=s(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=i(n);if(!r||!e.has(r.toLowerCase()))return null;let a=t.plugins[n];if(!a||a.length===0)return null;let o=a.filter(c);return o.length===0?null:w(n,o)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(_()){f(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await a(e,void 0,{disableCredentialHelper:!0})}catch(t){f(`Plugin autoupdate: failed to refresh marketplace ${e}: ${u(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&f(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),f(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){y(e)}})()}var O,k,A=e((()=>{x(),g(),d(),p(),v(),l(),r(),o(),h(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Is as e,Ps as t,Ts as n,js as r,ys as i}from"./loadAgentsDir-x3rlgED4.js";import{F as a,a as o,l as s,z as c}from"./debug-BrXObCdR.js";import{i as l,n as u,r as d,t as f}from"./pluginFlagging-CAdaFV_D.js";import{d as p,s as m}from"./pluginOperations-Cs_Z4C6O.js";m(),o(),c(),i(),t(),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 t=n(),i=u(),o=await e(),c=[];for(let e of Object.keys(o))try{let n=await r(e);if(!n.forceRemoveDeletedPlugins)continue;let o=h(t,n,e);for(let e of o){if(e in i)continue;let n=t.plugins[e]??[];if(n.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let t of n){let{scope:n}=t;if(!(n!==`user`&&n!==`project`&&n!==`local`))try{await p(e,n)}catch(t){s(`Failed to auto-uninstall delisted plugin ${e} from ${n}: ${a(t)}`,{level:`error`})}}await f(e),c.push(e)}}}catch(t){s(`Failed to check for delisted plugins in "${e}": ${a(t)}`,{level:`warn`})}return c}export{g as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./figures-5ThXQEtq.js";import{$S as n,QD as r,XD as i,ZS as a,_s as o,ay as s,iy as c,oy as l,vs as u}from"./loadAgentsDir-x3rlgED4.js";import{F as d,z as f}from"./debug-BrXObCdR.js";import{n as p,o as m}from"./process-gEbdy6uY.js";import{o as h,s as g}from"./log-BMCygSzM.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-Cs_Z4C6O.js";e(),f(),n(),h(),u(),i(),p(),l(),_(),T();function E(e,n,i){g(e);let a=i?`${n} plugin "${i}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${a}: ${d(e)}`);let l=i?(()=>{let{name:e,marketplace:t}=r(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...c(e,t,o())}})():{};v(`tengu_plugin_command_failed`,{command:n,error_category:s(e),...l}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let i=await b(e,n);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:s}=r(i.pluginId||e);v(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:i.scope||n,install_source:`cli-explicit`,...c(a,s,o())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,i=!1){try{let a=await x(e,n,!i);if(!a.success)throw Error(a.message);console.log(`${t.tick} ${a.message}`);let{name:s,marketplace:l}=r(a.pluginId||e);v(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:s,...l&&{_PROTO_marketplace_name:l},scope:a.scope||n,...c(s,l,o())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let i=await y(e,n);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:s}=r(i.pluginId||e);v(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:i.scope,...c(a,s,o())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let i=await C(e,n);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:a,marketplace:s}=r(i.pluginId||e);v(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:a,...s&&{_PROTO_marketplace_name:s},scope:i.scope,...c(a,s,o())}),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,n){try{m(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let i=await S(e,n);if(!i.success)throw Error(i.message);if(m(`${t.tick} ${i.message}\n`),!i.alreadyUpToDate){let{name:t,marketplace:n}=r(i.pluginId||e);v(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:i.oldVersion||`unknown`,new_version:i.newVersion||`unknown`,...c(t,n,o())})}await a(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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Br as r,Ci as i,Fi as a,Hr as o,Kr as s,Mi as ee,Ni as te,Pi as ne,Rr as c,Si as re,Ur as l,Vr as u,qr as ie,zr as ae}from"./state-ix0xIunV.js";import{
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,o as n}from"./isObject-C6qM3WEW.js";import{Br as r,Ci as i,Fi as a,Hr as o,Kr as s,Mi as ee,Ni as te,Pi as ne,Rr as c,Si as re,Ur as l,Vr as u,qr as ie,zr as ae}from"./state-ix0xIunV.js";import{ID as oe,LD as se,bO as ce,cD as le,lO as ue,sD as d,uO as de,yO as fe}from"./loadAgentsDir-x3rlgED4.js";import{C as f,S as p,a as m,d as h,l as g,p as _,w as v}from"./debug-BrXObCdR.js";import{An as y,Mn as b,Nn as x,On as S,Xn as C,Zn as w,jn as T,kn as E}from"./settings-BeLFUeie.js";import{R as D,z as O}from"./config-DRDuVyzE.js";import{o as k,s as A}from"./log-BMCygSzM.js";import{join as j}from"path";import{randomBytes as M}from"crypto";import{readFile as N,rename as P,unlink as F,writeFile as I}from"fs/promises";function L(e){return te(e)||i(e)||!!(R&&e&&e[R])}var R,z=e((()=>{n(),re(),ee(),R=t?t.isConcatSpreadable:void 0}));function B(e,t,n,r,i){var a=-1,o=e.length;for(n||(n=L),i||(i=[]);++a<o;){var s=e[a];t>0&&n(s)?t>1?B(s,t-1,n,r,i):ne(i,s):r||(i[i.length]=s)}return i}var V=e((()=>{a(),z()}));function pe(e){return e!=null&&e.length?B(e,1):[]}var me=e((()=>{V()}));function he(e){return E(T(e,void 0,pe),e+``)}var ge=e((()=>{me(),y(),S()}));function _e(e,t){return t.length<2?e:c(e,oe(t,0,-1))}var ve=e((()=>{ae(),se()}));function ye(e,t){t=o(t,e);var n=-1,r=t.length;if(!r)return!0;for(;++n<r;){var i=u(t[n]);if(i===`__proto__`&&!H.call(e,`__proto__`)||(i===`constructor`||i===`prototype`)&&n<r-1)return!1}var a=_e(e,t);return a==null||delete a[u(de(t))]}var H,be=e((()=>{l(),ue(),ve(),r(),H=Object.prototype.hasOwnProperty}));function xe(e){return x(e)?void 0:e}var Se=e((()=>{b()})),U,W,G,K,Ce=e((()=>{ie(),ce(),be(),l(),w(),Se(),ge(),O(),U=1,W=2,G=4,K=he(function(e,t){var n={};if(e==null)return n;var r=!1;t=s(t,function(t){return t=o(t,e),r||(r=t.length>1),t}),C(e,D(e),n),r&&(n=fe(n,U|W|G,xe));for(var i=t.length;i--;)ye(n,t[i]);return n})}));function q(){return j(d(),Z)}function we(e){let t=f(e);if(typeof t!=`object`||!t||!(`plugins`in t)||typeof t.plugins!=`object`||t.plugins===null)return{};let n=t.plugins,r={};for(let[e,t]of Object.entries(n))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),r[e]=n}return r}async function J(){try{return we(await N(q(),{encoding:`utf-8`}))}catch{return{}}}async function Y(e){let t=q(),n=`${t}.${M(8).toString(`hex`)}.tmp`;try{await h().mkdir(d()),await I(n,v({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await P(n,t),$=e}catch(e){A(e);try{await F(n)}catch{}}}async function Te(){let e=await J(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=Q&&(delete e[r],n=!0);$=e,n&&await Y(e)}function Ee(){return $??{}}async function X(e){$===null&&($=await J()),await Y({...$,[e]:{flaggedAt:new Date().toISOString()}}),g(`Flagged plugin: ${e}`)}async function De(e){$===null&&($=await J());let t=new Date().toISOString(),n=!1,r={...$};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await Y(r)}async function Oe(e){if($===null&&($=await J()),!(e in $))return;let{[e]:t,...n}=$;$=n,await Y(n)}var Z,Q,$,ke=e((()=>{m(),_(),k(),p(),le(),Z=`flagged-plugins.json`,Q=2880*60*1e3,$=null}));export{De as a,K as c,Te as i,Ee as n,Oe as o,ke as r,Ce as s,X as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,nt as n}from"./state-ix0xIunV.js";import{$D as r,$p as i,Ds as a,Es as o,Fs as s,G_ as c,JD as l,Ns as u,Ps as d,QD as f,Qp as p,Ts as m,XD as h,YD as g,as as _,cD as v,cs as y,ds as b,es as x,gs as S,hs as C,iD as ee,iO as w,ic as T,is as te,js as E,nc as D,ns as ne,os as O,ps as k,qD as A,q_ as j,rO as re,rc as ie,rs as M,us as ae,ws as N,ys as oe}from"./loadAgentsDir-x3rlgED4.js";import{V as P,W as se,d as ce,p as F,z as I}from"./debug-BrXObCdR.js";import{c as L,g as R,x as z}from"./settings-BeLFUeie.js";import{o as B,s as V}from"./log-BMCygSzM.js";import{l as H,o as U}from"./stringUtils-DGLPkqJ4.js";import{n as W,t as G}from"./pluginStartupCheck-KeU0efTj.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return L(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let i=L(r(n))?.enabledPlugins;if(i){for(let r of Object.keys(i))if(t?r===e:r.startsWith(`${e}@`))return{pluginId:r,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=f(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=f(e),n=m();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=f(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=m().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=f(e),i,a,o;if(r){let t=await u(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await s();for(let[t,r]of Object.entries(e))try{let e=(await E(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){V(se(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let c=i,l=`${c.name}@${a}`,d=await k({pluginId:l,entry:c,scope:t,marketplaceInstallLocation:o});if(!d.ok){let e=d;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:ae(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${l} (scope: ${t})${d.depNote}`,pluginId:l,pluginName:c.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:i,disabled:a}=await O(),s=[...i,...a],u=pe(e,s),d=r(t),f=L(d),p,h;if(u)p=Object.keys(f?.enabledPlugins??{}).find(t=>t===e||t===u.name||t.startsWith(`${u.name}@`))??(e.includes(`@`)?e:u.name),h=u.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};p=t.pluginId,h=t.pluginName}let g=J(t),_=m().plugins[p],v=_?.find(e=>e.scope===t&&e.projectPath===g);if(!v){let{scope:n}=Y(p);return n!==t&&_&&_.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let y=v.installPath,b={...f?.enabledPlugins};b[p]=void 0,z(d,{enabledPlugins:b}),D(),o(p,t,g);let x=m().plugins[p],S=!x||x.length===0;S&&y&&await T(y),S&&(c(p),n&&await ee(p));let C=A(p,s),w=l(C);return{success:!0,message:`Successfully uninstalled plugin: ${h} (scope: ${t})${w}`,pluginId:p,pluginName:h,scope:t,reverseDependents:C.length>0?C:void 0}}async function X(e,t,n){let a=t?`enable`:`disable`;if(w(e)){let{error:n}=z(`userSettings`,{enabledPlugins:{...L(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${a} built-in plugin: ${n.message}`};D();let{name:r}=f(e);return{success:!0,message:`Successfully ${a}d built-in plugin: ${r}`,pluginId:e,pluginName:r,scope:`user`}}n&&q(n);let o,s,c=fe(e);if(n)if(s=n,c)o=c.pluginId;else if(e.includes(`@`))o=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)o=c.pluginId,s=c.scope;else if(e.includes(`@`))o=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&i(o))return{success:!1,message:`Plugin "${o}" is blocked by your organization's policy and cannot be enabled`};let u=r(s),d=L(u)?.enabledPlugins?.[o],p={user:0,project:1,local:2},m=n&&c&&p[n]>p[c.scope];if(n&&d===void 0&&c&&c.scope!==n&&!m)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!m?d===!0:G().has(o)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let h;if(!t){let{enabled:e,disabled:t}=await O(),n=A(o,[...e,...t]);n.length>0&&(h=n)}let{error:g}=z(u,{enabledPlugins:{...L(u)?.enabledPlugins,[o]:t}});if(g)return{success:!1,message:`Failed to ${a} plugin: ${g.message}`};D();let{name:_}=f(o),v=l(h);return{success:!0,message:`Successfully ${a}d plugin: ${_} (scope: ${s})${v}`,pluginId:o,pluginName:_,scope:s,reverseDependents:h}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${H(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
|
|
2
|
+
`)}`}:{success:!0,message:`Disabled ${t.length} ${H(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=f(e),i=r?`${n}@${r}`:e,a=await u(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=N().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),d=c.find(e=>e.scope===t&&e.projectPath===l);return d?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:d,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:o,projectPath:s}){let c=ce(),l=i.version,u,d,f=!1,p;if(typeof n.source!=`string`){let t=await x(n.source,{manifest:{name:n.name}});u=t.path,f=!0,p=t.gitCommitSha,d=await C(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await c.stat(r)}catch(t){if(P(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:o};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await c.stat(u)}catch(t){if(P(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:o};throw t}let i,a=K(u,`.claude-plugin`,`plugin.json`);try{i=await y(a,n.name,n.source)}catch{}d=await C(e,n.source,i,u,n.version)}try{let r=M(e,d),c=te(e,d);if(i.version===d||i.installPath===r||i.installPath===c)return{success:!0,message:`${t} is already at the latest version (${d}).`,pluginId:e,newVersion:d,oldVersion:l,alreadyUpToDate:!0,scope:o};r=await ne(u,e,d,n);let f=i.installPath;if(a(e,o,s,r,d,p),f&&f!==r){let e=N();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===f))||await T(f)}let m=s?`${o} (${s})`:o;return{success:!0,message:`Plugin "${t}" updated from ${l||`unknown`} to ${d} for scope ${m}. Restart to apply changes.`,pluginId:e,newVersion:d,oldVersion:l,scope:o}}finally{f&&u!==M(e,d)&&await c.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),re(),I(),F(),B(),ie(),g(),oe(),d(),v(),h(),b(),_(),j(),p(),W(),S(),R(),U(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./pluginStartupCheck-KeU0efTj.js";e();export{t as getPluginEditableScopes};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$D as t,Ns as n,Ps as r,XD as i,ds as a,eO as o,ls as s,ms as c,tO as l,ys as u}from"./loadAgentsDir-x3rlgED4.js";import{n as d,t as f}from"./cwd-CYmmnQVS.js";import{a as p,l as m}from"./debug-BrXObCdR.js";import{Et as h,c as g,g as _,wt as v,x as y}from"./settings-BeLFUeie.js";import{o as b,s as x}from"./log-BMCygSzM.js";import{join as S}from"path";function C(){let e=new Map,t=o();for(let[n,r]of Object.entries(t))n.includes(`@`)&&(r===!0?e.set(n,`flag`):r===!1&&e.delete(n));for(let{scope:n,source:r}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let i=g(r);if(i?.enabledPlugins)for(let[a,o]of Object.entries(i.enabledPlugins))a.includes(`@`)&&(a in t&&t[a]!==o&&m(`Plugin ${a} from --add-dir (${t[a]}) overridden by ${r} (${o})`),o===!0?e.set(a,n):o===!1&&e.delete(a))}return m(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,r,i=`user`){let a=i===`user`?void 0:f(),o=t(i),l=g(o),u={...l?.enabledPlugins},d=[],p=[];for(let t=0;t<e.length;t++){let o=e[t];if(o){r&&r(o,t+1,e.length);try{let e=await n(o);if(!e){p.push({name:o,error:`Plugin not found in any marketplace`});continue}let{entry:t,marketplaceInstallLocation:r}=e;h(t.source)?c({pluginId:o,installPath:S(r,t.source),version:t.version},i,a):await s(o,t,i,a),u[o]=!0,d.push(o)}catch(e){let t=e instanceof Error?e.message:String(e);p.push({name:o,error:t}),x(e)}}}return y(o,{...l,enabledPlugins:u}),{installed:d,failed:p}}var T=e((()=>{d(),p(),b(),_(),l(),u(),r(),i(),a(),v()}));export{T as n,w as r,C as t};
|