@readmagic/workmate 0.0.13 → 0.0.14
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-m2d3nOQJ.js +1 -0
- package/dist/chunks/AgentsMdExternalIncludesDialog-BRXGkHO4.js +1 -0
- package/dist/chunks/{AgentsMdExternalIncludesDialog-CH9x1Ngp.js → AgentsMdExternalIncludesDialog-D58Vn3SK.js} +1 -1
- package/dist/chunks/App-CeC-2dzL.js +1 -0
- package/dist/chunks/ApproveApiKey-DFpddLyp.js +1 -0
- package/dist/chunks/ApproveApiKey-NXTWIAMj.js +1 -0
- package/dist/chunks/BackgroundTasksDialog-9ruzl1jm.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-B0BizN_J.js → BypassPermissionsModeDialog-C4QGpcBT.js} +1 -1
- package/dist/chunks/DiffDialog-LTdtTqsC.js +6 -0
- package/dist/chunks/Doctor-DmiDH-lg.js +1 -0
- package/dist/chunks/Doctor-Yvrzcrvx.js +3 -0
- package/dist/chunks/ExitFlow-DH0L3tyY.js +2 -0
- package/dist/chunks/{Grove-D0nn8zOV.js → Grove-BhhnrFX9.js} +1 -1
- package/dist/chunks/{HybridTransport-BQNLZNa_.js → HybridTransport-CEWG9ZRi.js} +2 -4
- package/dist/chunks/InvalidConfigDialog-Ue3kJUPJ.js +1 -0
- package/dist/chunks/InvalidSettingsDialog-BO2AOTVf.js +1 -0
- package/dist/chunks/MCPConnectionManager-Ciy9y9VV.js +1 -0
- package/dist/chunks/MCPToolListView-Ddmu2UcL.js +1 -0
- package/dist/chunks/{McpParsingWarnings-CUx2zexI.js → McpParsingWarnings-BsCDFWci.js} +1 -1
- package/dist/chunks/MessageSelector-DY5K0NHd.js +3 -0
- package/dist/chunks/Messages-LD6ZO301.js +10 -0
- package/dist/chunks/{Onboarding-t-P6Q5O6.js → Onboarding-w0-VVsDz.js} +1 -1
- package/dist/chunks/PermissionDialog-BPhvs5xH.js +1 -0
- package/dist/chunks/PressEnterToContinue-Dwoh6CaW.js +1 -0
- package/dist/chunks/{PromptInputFooterSuggestions-R12fbdmp.js → PromptInputFooterSuggestions-OEXx0Abp.js} +1 -1
- package/dist/chunks/PromptInputHelpMenu-DyaUsvNx.js +1 -0
- package/dist/chunks/QueryEngine-sH-KjJIq.js +1 -0
- package/dist/chunks/REPL-BMH_RItw.js +128 -0
- package/dist/chunks/REPL-DkPd3vk5.js +1 -0
- package/dist/chunks/RemoteSessionManager-DJhrR1dz.js +2 -0
- package/dist/chunks/ResumeConversation-BbNrpSFB.js +1 -0
- package/dist/chunks/SSETransport-CLiI2qnD.js +2 -0
- package/dist/chunks/{SearchBox-C9vUA4IM.js → SearchBox-CwwV0W-w.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DupzA6Vm.js +1 -0
- package/dist/chunks/Settings-B1EI5LOU.js +2 -0
- package/dist/chunks/{TeleportProgress-3hmIApkj.js → TeleportProgress-IB--CbqZ.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-BA1a66RK.js → TeleportRepoMismatchDialog-KjdlS_gA.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-BT4O-Wsi.js → TeleportResumeWrapper-DnHTI39O.js} +1 -1
- package/dist/chunks/ThemePicker-BrD_T7xF.js +1 -0
- package/dist/chunks/{TrustDialog-Dpk03V1Y.js → TrustDialog-L0rvvpit.js} +1 -1
- package/dist/chunks/ValidationErrorsList-QZvtUrAy.js +2 -0
- package/dist/chunks/add-dir-CpWXReCi.js +1 -0
- package/dist/chunks/{agentDisplay-D7bdOOG7.js → agentDisplay-CrQvGkTT.js} +1 -1
- package/dist/chunks/agents-BYQO6DbG.js +101 -0
- package/dist/chunks/{agents-22wiC58F.js → agents-C99yMsVF.js} +1 -1
- package/dist/chunks/allErrors-uyOMiF9U.js +1 -0
- package/dist/chunks/{api-f3GN2I_J.js → api-C5I2xwgd.js} +1 -1
- package/dist/chunks/api-j0iE1mkR.js +1 -0
- package/dist/chunks/attributionHooks-C0aXyx9L.js +1 -0
- package/dist/chunks/{auth-Czy7GoRh.js → auth-BYCRa_mb.js} +7 -12
- package/dist/chunks/auth-C9FUZzpW.js +1 -0
- package/dist/chunks/auth-DwPrlTHv.js +1 -0
- package/dist/chunks/backgroundHousekeeping-BxcVB3By.js +1 -0
- package/dist/chunks/backgroundHousekeeping-CjD8bACB.js +17 -0
- package/dist/chunks/{banner-BcAM7iSx.js → banner-HfMnBd03.js} +2 -2
- package/dist/chunks/{bg-Ci7pG4eo.js → bg-DltfF1_K.js} +2 -2
- package/dist/chunks/branch-BOWBZo5K.js +2 -0
- package/dist/chunks/{break-cache-4rlQORVk.js → break-cache-Cd1yQ-0h.js} +2 -3
- package/dist/chunks/bridgeConfig-Bxs5dqjH.js +1 -0
- package/dist/chunks/{bridgeConfig-B80T_lw7.js → bridgeConfig-CgAVrQfz.js} +1 -1
- package/dist/chunks/{bridgeMessaging-DyvHd16Z.js → bridgeMessaging-cOFtbkf_.js} +1 -1
- package/dist/chunks/{bridgePointer-DHWK3LEe.js → bridgePointer-CiHy2tTN.js} +1 -1
- package/dist/chunks/{bridgeStatusUtil-DStiD05t.js → bridgeStatusUtil-BQF0AJDO.js} +1 -1
- package/dist/chunks/btw-B0UmiVKl.js +1 -0
- package/dist/chunks/caches-C9--b9a7.js +1 -0
- package/dist/chunks/caches-wN3JyvNE.js +1 -0
- package/dist/chunks/{capacityWake-ByL6fM6I.js → capacityWake-LRiPhPeM.js} +1 -1
- package/dist/chunks/{ccrClient-BALhzhPF.js → ccrClient-wtUIz75R.js} +1 -1
- package/dist/chunks/{claudeDesktop-Ct_hyICL.js → claudeDesktop-DPIJpc1V.js} +1 -1
- package/dist/chunks/{clear-B_yVyJXP.js → clear-CNzBoL7O.js} +1 -1
- package/dist/chunks/{cliLaunch-OPOtzhvA.js → cliLaunch-xIVvtPZy.js} +1 -1
- package/dist/chunks/{client-BMA05FW8.js → client-B7WkO81L.js} +1 -1
- package/dist/chunks/client-BCzhAEd0.js +1 -0
- package/dist/chunks/client-Dr9AYB-r.js +1 -0
- package/dist/chunks/commands-DTB0Qzd5.js +1 -0
- package/dist/chunks/compact-Bj8mdDYN.js +2 -0
- package/dist/chunks/config-B1kYcRIP.js +1 -0
- package/dist/chunks/{config-9rLTDOYW.js → config-BkbL2e5Q.js} +1 -1
- package/dist/chunks/{config-DMKtiMzJ.js → config-WMxn2jLl.js} +1 -1
- package/dist/chunks/context-DB1Ar85E.js +1 -0
- package/dist/chunks/context-noninteractive-Bno2Xsmp.js +1 -0
- package/dist/chunks/{context-noninteractive-CHzerxnH.js → context-noninteractive-CqnJTDcI.js} +2 -2
- package/dist/chunks/conversation-DOgBzrm0.js +1 -0
- package/dist/chunks/conversation-hNXWaswI.js +1 -0
- package/dist/chunks/{createSSHSession-XkHMiGRN.js → createSSHSession-Cf2tOgK_.js} +3 -4
- package/dist/chunks/createSession-BZx-2UIB.js +1 -0
- package/dist/chunks/{createSession-BNGm9fL4.js → createSession-DD5YaQKM.js} +1 -1
- package/dist/chunks/crossProjectResume-CkiPQYYE.js +40 -0
- package/dist/chunks/{datadog-3WUWcCFn.js → datadog-DcLf1QpG.js} +1 -1
- package/dist/chunks/{debug-Dr1SjdXn.js → debug-BQj6h99Q.js} +1 -1
- package/dist/chunks/debugUtils-B86DM1Sp.js +1 -0
- package/dist/chunks/{detached-CqfQYVOi.js → detached--wGwkuHX.js} +1 -2
- package/dist/chunks/{detectRepository-CMEkS5_2.js → detectRepository-Qy3zKoyn.js} +1 -1
- package/dist/chunks/detectRepository-tRUoPOKy.js +1 -0
- package/dist/chunks/{diff-CKlLimGq.js → diff-dfXWiuLA.js} +1 -1
- package/dist/chunks/directoryCompletion-BtlRKLzw.js +1 -0
- package/dist/chunks/doctor-aKE2bG5C.js +1 -0
- package/dist/chunks/{entry-DCbq734V.js → entry-wISucmYc.js} +4 -5
- package/dist/chunks/esm-CrJVXrKW.js +1 -0
- package/dist/chunks/{execFileNoThrow-mXq4K0rl.js → execFileNoThrow-DYm1GeGn.js} +1 -1
- package/dist/chunks/{execSyncWrapper-Ne33rRiD.js → execSyncWrapper-CqvQqke-.js} +1 -1
- package/dist/chunks/exit-pjN4EJHV.js +1 -0
- package/dist/chunks/exit-s9XGerrH.js +1 -0
- package/dist/chunks/{extraUsage-C86bZVgt.js → extraUsage-CwDhpClH.js} +1 -1
- package/dist/chunks/extractMemories-WmPLOLUT.js +1 -0
- package/dist/chunks/fast-BVABmasw.js +1 -0
- package/dist/chunks/fast-Cuj3bfFm.js +1 -0
- package/dist/chunks/{fileSuggestions-BalHmi1-.js → fileSuggestions-Dy2BUZzd.js} +2 -2
- package/dist/chunks/firstPartyEventLogger-CabA8fu0.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-1RTgXHSz.js → firstPartyEventLogger-D4yuDP-n.js} +3 -5
- package/dist/chunks/flushGate-B6ecrC4j.js +1 -0
- package/dist/chunks/{fpsMetrics-DffAomdg.js → fpsMetrics-Dk_pnSHJ.js} +1 -1
- package/dist/chunks/gemini-BC-BxZmj.js +1 -0
- package/dist/chunks/generateSessionName-JTR8nPYD.js +1 -0
- package/dist/chunks/{genericProcessUtils-Dc1pfb7J.js → genericProcessUtils-Bbcbi11g.js} +1 -1
- package/dist/chunks/git-BaSq69E7.js +1 -0
- package/dist/chunks/{git-CoQQ6YEf.js → git-DplvjXEY.js} +2 -3
- package/dist/chunks/{githubRepoPathMapping-CmpEaQoo.js → githubRepoPathMapping-Bk4FZrng.js} +1 -1
- package/dist/chunks/goal-B09SOyra.js +3 -0
- package/dist/chunks/grok-BBo3jGfP.js +1 -0
- package/dist/chunks/{grove-b9gGKgu4.js → grove-DsAIY-rZ.js} +2 -2
- package/dist/chunks/help-CELr6oJZ.js +1 -0
- package/dist/chunks/hooks-9rkDD2iw.js +1 -0
- package/dist/chunks/{hooks-C-QMGvCg.js → hooks-BI4NY5IC.js} +2 -2
- package/dist/chunks/initReplBridge-BYrL6ou1.js +1 -0
- package/dist/chunks/{install-DGH_bjUh.js → install-Dn3_M1Ui.js} +1 -1
- package/dist/chunks/{instrumentation-DQ705pC7.js → instrumentation-5cSwEKaF.js} +4 -4
- package/dist/chunks/{job-BaMT6Lb2.js → job-rW1mEYtm.js} +1 -1
- package/dist/chunks/{jwtUtils-FQWtM6iM.js → jwtUtils-YCoZL0FW.js} +1 -1
- package/dist/chunks/keybindings-B5kUoxvg.js +1 -0
- package/dist/chunks/{launchLocalMemory-CtZrkmaw.js → launchLocalMemory-CPucX8Xj.js} +2 -2
- package/dist/chunks/launchOnboarding--GCJWeeS.js +8 -0
- package/dist/chunks/loadAgentsDir-D-a1uUb5.js +1 -0
- package/dist/chunks/{loadAgentsDir-mcRW90aq.js → loadAgentsDir-JrGMJN05.js} +656 -693
- package/dist/chunks/loadPluginHooks-C4zrlV0u.js +1 -0
- package/dist/chunks/localSearch-C-stDP9C.js +1 -0
- package/dist/chunks/localSearch-hOERAH9v.js +1 -0
- package/dist/chunks/{log-27kCA_9u.js → log-BlJ7CcKG.js} +1 -1
- package/dist/chunks/{logoV2Utils--8OUQQPd.js → logoV2Utils-J2Sqfube.js} +1 -1
- package/dist/chunks/{magicDocs-26J_l1De.js → magicDocs-Dpe3YhyL.js} +2 -2
- package/dist/chunks/main-C_PDzJdv.js +356 -0
- package/dist/chunks/{main-CGLCy2pM.js → main-Zh18lf2J.js} +2 -2
- package/dist/chunks/managedEnv-AEhH_HUs.js +1 -0
- package/dist/chunks/{managedEnv-Ds6MlFQE.js → managedEnv-C8SisyLk.js} +1 -1
- package/dist/chunks/{mappers-DwZw084m.js → mappers-CMJorgSL.js} +1 -1
- package/dist/chunks/mcp-B2mJmWKt.js +6 -0
- package/dist/chunks/mcp-SuAh71Ht.js +2 -0
- package/dist/chunks/mcp-_tBxhPV-.js +1 -0
- package/dist/chunks/{memoize-Co4vS6UF.js → memoize-_2f7NWDv.js} +1 -1
- package/dist/chunks/memory-DK8bOrUr.js +1 -0
- package/dist/chunks/{modalContext-CUThy6Ph.js → modalContext-wY9CeN4G.js} +1 -1
- package/dist/chunks/{mode-B80CHkqo.js → mode-BhfhEpnW.js} +2 -2
- package/dist/chunks/model-BCM7RpVk.js +1 -0
- package/dist/chunks/model-BWR43D3c.js +1 -0
- package/dist/chunks/model-CmDF8O9G.js +1 -0
- package/dist/chunks/modelOptions-DEQat7lU.js +1 -0
- package/dist/chunks/nativeInstaller-xxyUjXbl.js +1 -0
- package/dist/chunks/{omit-KEhe84f4.js → omit-od_CYp5o.js} +1 -1
- package/dist/chunks/{onChangeAppState-Dq1tIEJI.js → onChangeAppState-CqTb0yEa.js} +1 -1
- package/dist/chunks/openai-qW8mATAs.js +10 -0
- package/dist/chunks/{panel-CoF2a-h4.js → panel-Bg_0PHE6.js} +1 -1
- package/dist/chunks/{parser-CUUiH40T.js → parser-a2S_eFyE.js} +1 -1
- package/dist/chunks/parser-x-w3ikxt.js +1 -0
- package/dist/chunks/{partition-DeT341qu.js → partition-CYoWXLNU.js} +1 -1
- package/dist/chunks/permissions--iKUbWBw.js +3 -0
- package/dist/chunks/pidLock-BR4hzYgp.js +3 -0
- package/dist/chunks/plan-DiHCGXhM.js +1 -0
- package/dist/chunks/{platform-Dg1c9F_1.js → platform-DVeTi9mp.js} +2 -2
- package/dist/chunks/plugin-BeC4D7XF.js +17 -0
- package/dist/chunks/pluginAutoupdate-Bj-CrFuO.js +1 -0
- package/dist/chunks/{pluginBlocklist-BfoLN9a-.js → pluginBlocklist-DzOs-RS1.js} +1 -1
- package/dist/chunks/{pluginCliCommands-Bc2Iybhz.js → pluginCliCommands-DwIGn58t.js} +1 -1
- package/dist/chunks/{pluginFlagging-Cr0d0hBA.js → pluginFlagging-BzuymJuf.js} +1 -1
- package/dist/chunks/pluginOperations-CP1v-nu0.js +2 -0
- package/dist/chunks/pluginStartupCheck-BGN6Je6d.js +1 -0
- package/dist/chunks/{pluginStartupCheck-DiCDQQlr.js → pluginStartupCheck-BUeBiYVq.js} +1 -1
- package/dist/chunks/plugins-D1N31THW.js +4 -0
- package/dist/chunks/{poorMode-DxgO_bUb.js → poorMode-D4L_-yWS.js} +1 -1
- package/dist/chunks/poorMode-XDBnxTiF.js +1 -0
- package/dist/chunks/print-DaJi1wF_.js +14 -0
- package/dist/chunks/processBashCommand-BGCIqxc9.js +1 -0
- package/dist/chunks/processSlashCommand-qR_j1DE8.js +5 -0
- package/dist/chunks/prompt-B0gADAvI.js +1 -0
- package/dist/chunks/{prompt-DIlq8NTy.js → prompt-DnPppVz8.js} +21 -23
- package/dist/chunks/prompt-DqyEtC_I2.js +1 -0
- package/dist/chunks/{promptEditor-BILqOGl1.js → promptEditor-Cilc9N3L.js} +3 -3
- package/dist/chunks/protocolHandler-DdbiucQa.js +13 -0
- package/dist/chunks/{proxy-BEKNaTXI.js → proxy-C0j74LqT.js} +1 -1
- package/dist/chunks/reconciler-Bte4gdP-.js +1 -0
- package/dist/chunks/refresh-MiZ0acBm.js +1 -0
- package/dist/chunks/registerProtocol-Bpte9dly.js +1 -0
- package/dist/chunks/{reload-plugins-CGb0HTsH.js → reload-plugins-GdqFZblC.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BmteXmI9.js → remoteBridgeCore-CAl3_H-O.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-CwDGxL5p.js → remoteManagedSettings-BcLJLEr7.js} +1 -1
- package/dist/chunks/rename-BDo5qIK0.js +1 -0
- package/dist/chunks/{renderOptions-45A-EdsK.js → renderOptions-CkqTbz6d.js} +1 -1
- package/dist/chunks/resume-Bbweh2hA.js +2 -0
- package/dist/chunks/ripgrep-DrpZ79Pp.js +1 -0
- package/dist/chunks/{ripgrep-DQ_ILUJV.js → ripgrep-X5m4gJ-3.js} +1 -1
- package/dist/chunks/{runtimeObserver-CtNY8Al2.js → runtimeObserver-CxXxUcrm.js} +1 -1
- package/dist/chunks/{runtimeObserver-4ZqaCXYy.js → runtimeObserver-Hjbo43xj.js} +4 -4
- package/dist/chunks/sandbox-adapter-DQ_fJSIo.js +1 -0
- package/dist/chunks/sandbox-toggle-DmNSThQK.js +1 -0
- package/dist/chunks/searchExtraTools-C7b2x2p_.js +1 -0
- package/dist/chunks/{session-wb6X4Wrq.js → session-CkuTMD_4.js} +2 -2
- package/dist/chunks/sessionFileAccessHooks-CQvGAbvL.js +1 -0
- package/dist/chunks/{sessionIdCompat-DMayYBrf.js → sessionIdCompat-Dgp6PW_1.js} +1 -1
- package/dist/chunks/sessionObserver-BoQY7nOa.js +1 -0
- package/dist/chunks/{sessionObserver-BJQ5hwjU.js → sessionObserver-CvQ6oyoj.js} +2 -2
- package/dist/chunks/sessionState-C2REgUrs.js +11 -0
- package/dist/chunks/sessionStorage-BeaEgnaa.js +1 -0
- package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +3 -0
- package/dist/chunks/{sessionTitle-Cbzrb9jT.js → sessionTitle-2IWcNB8H.js} +2 -2
- package/dist/chunks/{sessionTracing-CEsm8pZL.js → sessionTracing-Bm7hQKHA.js} +2 -2
- package/dist/chunks/settings-Da6ax5aI.js +1 -0
- package/dist/chunks/{settings-DiBMs2gM.js → settings-aUygByiZ.js} +4 -5
- package/dist/chunks/settingsSync-DgzCU1BZ.js +1 -0
- package/dist/chunks/setup-CvaG4nl5.js +3 -0
- package/dist/chunks/{shadowedRuleDetection-D5X5fhzj.js → shadowedRuleDetection-CWCQ5dZ0.js} +1 -1
- package/dist/chunks/{shellQuote-C_I6DHLV.js → shellQuote-D3Ocv_U-.js} +1 -1
- package/dist/chunks/{sideQuestion-BHRtwhyj.js → sideQuestion-BoW-xYkh.js} +3 -3
- package/dist/chunks/sinks-B_ehGpvp.js +1 -0
- package/dist/chunks/sinks-ZHKfs6gv.js +1 -0
- package/dist/chunks/skillChangeDetector-C-HWR_8v.js +1 -0
- package/dist/chunks/{skillGapStore-BjQSSz2E.js → skillGapStore-CCNeSjIb.js} +2 -2
- package/dist/chunks/{skillLifecycle-Sp8strFv.js → skillLifecycle-wU4JDNYQ.js} +2 -2
- package/dist/chunks/{skillSearchPanel-3sYRez_Q.js → skillSearchPanel-Cxr1QQn4.js} +4 -4
- package/dist/chunks/skills-BghnKnNo.js +1 -0
- package/dist/chunks/{src-r6ZFgWPx2.js → src-D3yIF9I42.js} +1 -1
- package/dist/chunks/src-DL3w8VPk2.js +51 -0
- package/dist/chunks/{startupProfiler-Dc5r6LgE.js → startupProfiler-2sjXZkIP.js} +1 -1
- package/dist/chunks/startupProfiler-B2fyaBEa.js +1 -0
- package/dist/chunks/{staticRender-DrU6eWoq.js → staticRender-D9AbnQFr.js} +1 -1
- package/dist/chunks/{stats-BkadEKa-.js → stats-unp6R0Ah.js} +1 -1
- package/dist/chunks/status-BraYBx4N.js +2 -0
- package/dist/chunks/status-DwyWiaVc.js +1 -0
- package/dist/chunks/statusNoticeHelpers-Dm1aiibR.js +1 -0
- package/dist/chunks/{stringUtils-Df-Lnjxd.js → stringUtils-BjnclTLB.js} +3 -3
- package/dist/chunks/{switcher-uoQMHmEZ.js → switcher-BUNSEJ-7.js} +1 -1
- package/dist/chunks/switcher-DDUnWU_4.js +1 -0
- package/dist/chunks/{syncCache-BooMjgU6.js → syncCache-1s9xV8WV.js} +1 -1
- package/dist/chunks/tasks-BjFot03S.js +1 -0
- package/dist/chunks/teleport-Dj2Kvbmx.js +1 -0
- package/dist/chunks/{templateJobs-BYYfF4m5.js → templateJobs-CY7GNRo5.js} +1 -3
- package/dist/chunks/{terminalSetup-fwhFTxGi.js → terminalSetup-CpMNk6dc.js} +5 -6
- package/dist/chunks/{terminalSetup-CbXKCpWM.js → terminalSetup-Ty8T8ePM.js} +1 -1
- package/dist/chunks/theme-c6grxWNn.js +1 -0
- package/dist/chunks/{tmux-d3cNCIZA.js → tmux-g0cQ0Buz.js} +1 -1
- package/dist/chunks/{toolEventObserver-BFEl47bq.js → toolEventObserver-D7WbjgFR.js} +1 -1
- package/dist/chunks/toolPool-O5nkEFb1.js +1 -0
- package/dist/chunks/{trustedDevice-BLiKbGpG.js → trustedDevice-BF78PNK8.js} +1 -1
- package/dist/chunks/trustedDevice-D_z7bAQh.js +1 -0
- package/dist/chunks/{types-BJ7qTz75.js → types-BomO8WUz.js} +1 -1
- package/dist/chunks/{udsClient-CF8BmZgN.js → udsClient-DSvRPCvR.js} +1 -1
- package/dist/chunks/updateCCB-ts7Joyve.js +5 -0
- package/dist/chunks/upstreamproxy-DYoLvdM9.js +10 -0
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-qLfN0tc-.js +1 -0
- package/dist/chunks/useMainLoopModel-DkjG_ikT.js +1 -0
- package/dist/chunks/useManagePlugins-E0Qzj-ws.js +1 -0
- package/dist/chunks/useMergedTools-B7iYaNwM.js +1 -0
- package/dist/chunks/{useSearchInput-KFKh2ozY.js → useSearchInput-CsxiM9i0.js} +1 -1
- package/dist/chunks/useSettingsErrors-DdVTahNa.js +1 -0
- package/dist/chunks/{userAgent-DUrr02yh.js → userAgent-BggRZ-ZE.js} +1 -1
- package/dist/chunks/util-Xdy1nOjj.js +1 -0
- package/dist/chunks/validatePlugin-Be5aSSnP.js +1 -0
- package/dist/chunks/{vim-C4Hs5U2h.js → vim-cFcxfuac.js} +1 -1
- package/dist/chunks/{which-mplwBbc0.js → which-BR8YVCCW.js} +1 -1
- package/dist/chunks/{windowsPaths-C7Mdo9aU.js → windowsPaths-BmXyrasP.js} +1 -1
- package/dist/chunks/windowsPaths-BybjGW7e.js +1 -0
- package/dist/chunks/{workSecret-XLodD7tw.js → workSecret-BUd8cQ6-.js} +1 -1
- package/dist/chunks/workerRegistry-GrD7IAVQ.js +2 -0
- package/dist/chunks/worktree-V7xiUAtl.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/AddWorkspaceDirectory-BzNj9rS6.js +0 -1
- package/dist/chunks/AgentsMdExternalIncludesDialog-CDZPR488.js +0 -1
- package/dist/chunks/App-D-bYAYAl.js +0 -1
- package/dist/chunks/ApproveApiKey-BEGV9Zj9.js +0 -1
- package/dist/chunks/ApproveApiKey-CjacpIqq.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-A9hw_SV0.js +0 -2
- package/dist/chunks/DiffDialog-mQ-5_TSv.js +0 -6
- package/dist/chunks/Doctor-BC6IuQhd.js +0 -3
- package/dist/chunks/Doctor-i_5_AQd-.js +0 -1
- package/dist/chunks/ExitFlow-Bu2cVGpC.js +0 -2
- package/dist/chunks/InvalidConfigDialog-C5CIiSIE.js +0 -1
- package/dist/chunks/InvalidSettingsDialog-Dq7hKXcO.js +0 -1
- package/dist/chunks/MCPConnectionManager-aDDsYkGM.js +0 -1
- package/dist/chunks/MCPToolListView-Cr0MDkzT.js +0 -1
- package/dist/chunks/MessageSelector-DwGOWKKL.js +0 -3
- package/dist/chunks/Messages-C1jh4ixt.js +0 -11
- package/dist/chunks/PermissionDialog-Cb3z8OUP.js +0 -1
- package/dist/chunks/PressEnterToContinue-Dq0Imo9c.js +0 -1
- package/dist/chunks/PromptInputHelpMenu-BgADIzRj.js +0 -1
- package/dist/chunks/QueryEngine-HlLQJmsd.js +0 -1
- package/dist/chunks/REPL-Rs_JQkDc.js +0 -1
- package/dist/chunks/REPL-VKAmKkII.js +0 -133
- package/dist/chunks/RemoteSessionManager-BbgXeM-t.js +0 -2
- package/dist/chunks/ResumeConversation-66zbx12g.js +0 -1
- package/dist/chunks/SSETransport-BBQkdn4e.js +0 -4
- package/dist/chunks/SearchExtraToolsTool-Bq87I_vu.js +0 -1
- package/dist/chunks/Settings-BKdLcyXe.js +0 -2
- package/dist/chunks/ThemePicker-DUlhcoso.js +0 -1
- package/dist/chunks/ValidationErrorsList-DSSUWdgd.js +0 -2
- package/dist/chunks/add-dir-BUr0z-VU.js +0 -1
- package/dist/chunks/agents-8ELI8RJo.js +0 -103
- package/dist/chunks/allErrors-C1eMbHSv.js +0 -1
- package/dist/chunks/api-DgjIFdMn.js +0 -1
- package/dist/chunks/attributionHooks-CUAoGkU6.js +0 -1
- package/dist/chunks/auth-B73a4Cob.js +0 -1
- package/dist/chunks/auth-D_0waidQ.js +0 -1
- package/dist/chunks/autoModeDenials-BxNzGJdR.js +0 -1
- package/dist/chunks/backgroundHousekeeping-C_ArdTFX.js +0 -17
- package/dist/chunks/backgroundHousekeeping-YJhvZ0dh.js +0 -1
- package/dist/chunks/branch-bb4-bErF.js +0 -3
- package/dist/chunks/bridgeConfig-DywkIo_k.js +0 -1
- package/dist/chunks/btw-BRmV51bR.js +0 -1
- package/dist/chunks/caches-C5DIVdvI.js +0 -1
- package/dist/chunks/caches-zDZEgNKq.js +0 -1
- package/dist/chunks/client-7lIxWcaM.js +0 -1
- package/dist/chunks/client-DVg8PpFX.js +0 -1
- package/dist/chunks/commands-ByFXqW43.js +0 -1
- package/dist/chunks/compact-BUShp2eQ.js +0 -2
- package/dist/chunks/config-BwHNU_pI.js +0 -1
- package/dist/chunks/context-6Pk3iVhh.js +0 -1
- package/dist/chunks/context-noninteractive-DFwRQyFE.js +0 -1
- package/dist/chunks/conversation-5zb5XkSA.js +0 -1
- package/dist/chunks/conversation-JP2ZXrwu.js +0 -1
- package/dist/chunks/createSession-VTqzWAu6.js +0 -1
- package/dist/chunks/crossProjectResume-DxgQVYSi.js +0 -40
- package/dist/chunks/debugUtils-cK-iOsEV.js +0 -1
- package/dist/chunks/detectRepository-BsKZDRoI.js +0 -1
- package/dist/chunks/directoryCompletion-ByBTSuLu.js +0 -1
- package/dist/chunks/doctor-Bvx0u0sO.js +0 -1
- package/dist/chunks/esm-CtQkOk5D.js +0 -1
- package/dist/chunks/exit-BOhGfSlm.js +0 -2
- package/dist/chunks/exit-DTsz5Lcb.js +0 -1
- package/dist/chunks/extractMemories-6OnMgL2S.js +0 -1
- package/dist/chunks/fast-B2ziqJEA.js +0 -1
- package/dist/chunks/fast-BkhjaTkZ.js +0 -1
- package/dist/chunks/firstPartyEventLogger-CXMzhLrF.js +0 -1
- package/dist/chunks/flushGate-DWL05x7v.js +0 -1
- package/dist/chunks/gemini-BLpLJyli.js +0 -1
- package/dist/chunks/generateSessionName-CdbMksHi.js +0 -1
- package/dist/chunks/git-Bs1vtuvX.js +0 -1
- package/dist/chunks/goal-V3qix-i1.js +0 -3
- package/dist/chunks/grok-BLLATotv.js +0 -1
- package/dist/chunks/help-BR7UEr5R.js +0 -1
- package/dist/chunks/hooks-D6wtd0Qq.js +0 -1
- package/dist/chunks/initReplBridge-DyScxedy.js +0 -1
- package/dist/chunks/keybindings-CG292HS1.js +0 -2
- package/dist/chunks/launchOnboarding-CyOtdZkT.js +0 -8
- package/dist/chunks/loadAgentsDir-4UC4yLg1.js +0 -1
- package/dist/chunks/loadPluginHooks-CWI0RMUx.js +0 -1
- package/dist/chunks/localSearch-CCCDKpYx.js +0 -1
- package/dist/chunks/localSearch-D4hVR7-d.js +0 -1
- package/dist/chunks/main-DUjtDK1Q.js +0 -513
- package/dist/chunks/managedEnv-BuCurT_S.js +0 -1
- package/dist/chunks/mcp-CEKR7PjL.js +0 -6
- package/dist/chunks/mcp-DCAf2hHD.js +0 -1
- package/dist/chunks/mcp-mCuc8dNe.js +0 -2
- package/dist/chunks/memory-B5SkpC7u.js +0 -1
- package/dist/chunks/model-BqaneI4D.js +0 -1
- package/dist/chunks/model-C29_32BD.js +0 -1
- package/dist/chunks/model-NG8fvuT2.js +0 -1
- package/dist/chunks/modelOptions-CiZgZxZC.js +0 -1
- package/dist/chunks/nativeInstaller-DqbEfGSX.js +0 -1
- package/dist/chunks/openai-BvnsYTpQ.js +0 -10
- package/dist/chunks/parser-B2PlJg4C.js +0 -1
- package/dist/chunks/permissions-BPpeHxpk.js +0 -3
- package/dist/chunks/pidLock-DQGDoFQP.js +0 -3
- package/dist/chunks/plan-BRiC5ujG.js +0 -1
- package/dist/chunks/plugin-Dcg_GGR9.js +0 -17
- package/dist/chunks/pluginAutoupdate-ByH9IPC9.js +0 -1
- package/dist/chunks/pluginOperations-CKNyYjS-.js +0 -2
- package/dist/chunks/pluginStartupCheck-B48_cGgo.js +0 -1
- package/dist/chunks/plugins-BP_36tOl.js +0 -4
- package/dist/chunks/poorMode-Djw0P9Gu.js +0 -1
- package/dist/chunks/print-2uavraPq.js +0 -26
- package/dist/chunks/processBashCommand-g3sAMpHt.js +0 -1
- package/dist/chunks/processSlashCommand-tIbeCrv5.js +0 -5
- package/dist/chunks/prompt-DLv-Cd67.js +0 -1
- package/dist/chunks/prompt-DV5tCLRh.js +0 -1
- package/dist/chunks/protocolHandler-B83fCYI4.js +0 -13
- package/dist/chunks/reconciler-CDq6XgAS.js +0 -1
- package/dist/chunks/refresh-ysrhoWCo.js +0 -1
- package/dist/chunks/registerProtocol-DduKPsn_.js +0 -36
- package/dist/chunks/rename-1GLIUlYk.js +0 -1
- package/dist/chunks/resume-DWtlUiHW.js +0 -2
- package/dist/chunks/ripgrep-BLQnqPnE.js +0 -1
- package/dist/chunks/sandbox-adapter-BzjRQh_r.js +0 -1
- package/dist/chunks/sandbox-toggle-Bz49-F6e.js +0 -1
- package/dist/chunks/searchExtraTools-D6vj8qJ-.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-Da97UA2n.js +0 -1
- package/dist/chunks/sessionObserver-DXO4trhk.js +0 -1
- package/dist/chunks/sessionState-Bn3ESS5f.js +0 -11
- package/dist/chunks/sessionStorage-DlPVsQn9.js +0 -1
- package/dist/chunks/sessionStoragePortable-BhkGMZWp.js +0 -3
- package/dist/chunks/settings-3ionQKNv.js +0 -1
- package/dist/chunks/settingsSync-eHaSngKo.js +0 -1
- package/dist/chunks/setup-DeyiuGNX.js +0 -3
- package/dist/chunks/sinks-Bgy2UNK-.js +0 -2
- package/dist/chunks/sinks-CgzLmim2.js +0 -1
- package/dist/chunks/skillChangeDetector-BlSP16j6.js +0 -1
- package/dist/chunks/skills-CJhWI8t1.js +0 -1
- package/dist/chunks/src-P_wYS_NJ2.js +0 -53
- package/dist/chunks/startupProfiler-CUlV07MD.js +0 -1
- package/dist/chunks/status-CDCurOqs.js +0 -2
- package/dist/chunks/status-yoQIQ2Ni.js +0 -1
- package/dist/chunks/statusNoticeHelpers-Sl4jjauz.js +0 -1
- package/dist/chunks/switcher-C-m6MUwE.js +0 -1
- package/dist/chunks/tasks-CHG_6sXQ.js +0 -1
- package/dist/chunks/teleport-C9KRE4X8.js +0 -1
- package/dist/chunks/theme-MvX7hojJ.js +0 -1
- package/dist/chunks/toolPool-Cq74Cvjp.js +0 -1
- package/dist/chunks/trustedDevice-BGwujSqc.js +0 -1
- package/dist/chunks/updateCCB-CfckOy7T.js +0 -11
- package/dist/chunks/upstreamproxy-BuBFDFAD.js +0 -11
- package/dist/chunks/useExitOnCtrlCDWithKeybindings-CPLBDluY.js +0 -1
- package/dist/chunks/useMainLoopModel-C00PbZ1Q.js +0 -1
- package/dist/chunks/useManagePlugins-DFaGntzJ.js +0 -1
- package/dist/chunks/useMergedTools-DYobZ5N4.js +0 -1
- package/dist/chunks/useSettingsErrors-BRgjvaHd.js +0 -1
- package/dist/chunks/util-D7uwPgF1.js +0 -1
- package/dist/chunks/validatePlugin-VukX52bx.js +0 -1
- package/dist/chunks/windowsPaths-B8p9tFRF.js +0 -1
- package/dist/chunks/workerRegistry-BA37PVbv.js +0 -6
- package/dist/chunks/worktree-Lik8xuKd.js +0 -1
- package/dist/chunks/xdg-DcF9ejUM.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$u as i,Dp as a,F as o,N as s,Op as c,P as l,Qu as u,cd as d,hC as f,ld as p}from"./loadAgentsDir-JrGMJN05.js";import{D as m,I as h,P as g,T as _,Wt as v,ai as y,t as b,vn as x,y as S,yn as C}from"./src-DL3w8VPk2.js";import{t as w}from"./jsx-runtime-Bb4Xn-E0.js";import{r as T,t as E}from"./directoryCompletion-BtlRKLzw.js";import{r as D,t as O}from"./PromptInputFooterSuggestions-OEXx0Abp.js";function k(){return(0,P.jsx)(g,{dimColor:!0,children:`Claude Code will be able to read files in this directory and make edits when auto-accept edits is on.`})}function A({path:e}){return(0,P.jsxs)(h,{flexDirection:`column`,paddingX:2,gap:1,children:[(0,P.jsx)(g,{color:`permission`,children:e}),(0,P.jsx)(k,{})]})}function j({value:e,onChange:t,onSubmit:n,error:i,suggestions:a,selectedSuggestion:o}){return(0,P.jsxs)(h,{flexDirection:`column`,children:[(0,P.jsx)(g,{children:`Enter the path to the directory:`}),(0,P.jsx)(h,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,P.jsx)(d,{showCursor:!0,placeholder:`Directory path${r.ellipsis}`,value:e,onChange:t,onSubmit:n,columns:80,cursorOffset:e.length,onChangeCursorOffset:()=>{}})}),a.length>0&&(0,P.jsx)(h,{marginBottom:1,children:(0,P.jsx)(O,{suggestions:a,selectedSuggestion:o})}),i&&(0,P.jsx)(g,{color:`error`,children:i})]})}function M({onAddDirectory:e,onCancel:t,permissionContext:n,directoryPath:r}){let[i,c]=(0,N.useState)(``),[l,d]=(0,N.useState)(null),[f,p]=(0,N.useState)([]),[y,b]=(0,N.useState)(0),x=(0,N.useMemo)(()=>F,[]),w=C((0,N.useCallback)(async e=>{if(!e){p([]),b(0);return}let t=await E(e);p(t),b(0)},[]),100);(0,N.useEffect)(()=>{w(i)},[i,w]);let T=(0,N.useCallback)(e=>{let t=`${e.id}/`;c(t),d(null)},[]),D=(0,N.useCallback)(async t=>{let r=await o(t,n);r.resultType===`success`?e(r.absolutePath,!1):d(s(r))},[n,e]);v(`confirm:no`,t,{context:`Settings`});let O=(0,N.useCallback)(e=>{if(f.length>0){if(e.key===`tab`){e.preventDefault();let t=f[y];t&&T(t);return}if(e.key===`return`){e.preventDefault();let t=f[y];t&&D(`${t.id}/`);return}if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b(e=>e<=0?f.length-1:e-1);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),b(e=>e>=f.length-1?0:e+1);return}}},[f,y,T,D]),M=(0,N.useCallback)(n=>{if(r)switch(n){case`yes-session`:e(r,!1);break;case`yes-remember`:e(r,!0);break;case`no`:t();break}},[r,e,t]);return(0,P.jsx)(h,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:O,children:(0,P.jsx)(S,{title:`Add directory to workspace`,onCancel:t,color:`permission`,isCancelActive:!1,inputGuide:r?void 0:e=>e.pending?(0,P.jsxs)(g,{children:[`Press `,e.keyName,` again to exit`]}):(0,P.jsxs)(_,{children:[(0,P.jsx)(m,{shortcut:`Tab`,action:`complete`}),(0,P.jsx)(m,{shortcut:`Enter`,action:`add`}),(0,P.jsx)(a,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`})]}),children:r?(0,P.jsxs)(h,{flexDirection:`column`,gap:1,children:[(0,P.jsx)(A,{path:r}),(0,P.jsx)(u,{options:x,onChange:M,onCancel:()=>M(`no`)})]}):(0,P.jsxs)(h,{flexDirection:`column`,gap:1,marginX:2,children:[(0,P.jsx)(k,{}),(0,P.jsx)(j,{value:i,onChange:c,onSubmit:D,error:l,suggestions:f,selectedSuggestion:y})]})})})}var N,P,F,I=e((()=>{n(),N=t(y(),1),x(),l(),p(),b(),f(),T(),c(),i(),D(),P=w(),F=[{value:`yes-session`,label:`Yes, for this session`},{value:`yes-remember`,label:`Yes, and remember this directory`},{value:`no`,label:`No`}]}));export{I as n,M as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./AgentsMdExternalIncludesDialog-D58Vn3SK.js";e();export{t as AgentsMdExternalIncludesDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as n,Zu as r}from"./loadAgentsDir-JrGMJN05.js";import{I as i,Lt as a,P as o,ai as s,t as c,y as l}from"./src-DL3w8VPk2.js";import{t as u}from"./jsx-runtime-Bb4Xn-E0.js";import{h as d,v as f}from"./config-BkbL2e5Q.js";import{n as p,r as m}from"./analytics-DJobLaWP.js";function h({onDone:e,isStandaloneDialog:t,externalIncludes:r}){g.useEffect(()=>{m(`tengu_claude_md_includes_dialog_shown`,{})},[]);let s=(0,g.useCallback)(t=>{t===`no`?(m(`tengu_claude_md_external_includes_dialog_declined`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!1,hasAgentsMdExternalIncludesWarningShown:!0}))):(m(`tengu_claude_md_external_includes_dialog_accepted`,{}),f(e=>({...e,hasAgentsMdExternalIncludesApproved:!0,hasAgentsMdExternalIncludesWarningShown:!0}))),e()},[e]);return(0,_.jsxs)(l,{title:`Allow external AGENTS.md file imports?`,color:`warning`,onCancel:(0,g.useCallback)(()=>{s(`no`)},[s]),hideBorder:!t,hideInputGuide:!t,children:[(0,_.jsx)(o,{children:`This project's AGENTS.md imports files outside the current working directory. Never allow this for third-party repositories.`}),r&&r.length>0&&(0,_.jsxs)(i,{flexDirection:`column`,children:[(0,_.jsx)(o,{dimColor:!0,children:`External imports:`}),r.map((e,t)=>(0,_.jsxs)(o,{dimColor:!0,children:[` `,e.path]},t))]}),(0,_.jsxs)(o,{dimColor:!0,children:[`Important: Only use Claude Code with files you trust. Accessing untrusted files may pose security risks`,` `,(0,_.jsx)(a,{url:`https://code.workmate.com/docs/en/security`}),` `]}),(0,_.jsx)(n,{options:[{label:`Yes, allow external imports`,value:`yes`},{label:`No, disable external imports`,value:`no`}],onChange:e=>s(e)})]})}var g,_,v=e((()=>{g=t(s(),1),p(),c(),d(),r(),_=u()}));export{v as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Xh as e,Yh as t}from"./loadAgentsDir-JrGMJN05.js";import{R as n,t as r}from"./src-DL3w8VPk2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{c as a,h as o,y as s}from"./config-BkbL2e5Q.js";import{n as c}from"./onChangeAppState-CqTb0yEa.js";import{t as l}from"./fpsMetrics-Dk_pnSHJ.js";import{t as u}from"./stats-unp6R0Ah.js";e(),r(),o();var d=i();function f({getFpsMetrics:e,stats:r,initialState:i,children:o}){return(0,d.jsx)(l,{getFpsMetrics:e,children:(0,d.jsx)(u,{store:r,children:(0,d.jsx)(t,{initialState:i,onChangeAppState:c,children:(0,d.jsx)(n,{initialState:a().theme,onThemeSave:e=>s(t=>({...t,theme:e})),children:o})})})})}export{f as App};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qu as e,Zu as t}from"./loadAgentsDir-JrGMJN05.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{h as o,y as s}from"./config-BkbL2e5Q.js";r(),o(),t();var c=a();function l({customApiKeyTruncated:t,onDone:r}){function a(e){switch(e){case`yes`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,approved:[...e.customApiKeyResponses?.approved??[],t]}})),r(!0);break;case`no`:s(e=>({...e,customApiKeyResponses:{...e.customApiKeyResponses,rejected:[...e.customApiKeyResponses?.rejected??[],t]}})),r(!1);break}}return(0,c.jsxs)(i,{title:`Detected a custom API key in your environment`,color:`warning`,onCancel:()=>a(`no`),children:[(0,c.jsxs)(n,{children:[(0,c.jsx)(n,{bold:!0,children:`ANTHROPIC_API_KEY`}),(0,c.jsxs)(n,{children:[`: sk-ant-...`,t]})]}),(0,c.jsx)(n,{children:`Do you want to use this API key?`}),(0,c.jsx)(e,{defaultValue:`no`,defaultFocusValue:`no`,options:[{label:`Yes`,value:`yes`},{label:(0,c.jsxs)(n,{children:[`No (`,(0,c.jsx)(n,{bold:!0,children:`recommended`}),`)`]}),value:`no`}],onChange:e=>a(e),onCancel:()=>a(`no`)})]})}export{l as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./ApproveApiKey-DFpddLyp.js";export{e as ApproveApiKey};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,$u as a,Af as o,Ag as s,Dg as c,En as l,Ga as u,If as d,Is as f,Jh as p,Kc as m,La as h,Lf as g,Ls as _,Mf as v,On as y,Qu as b,Xh as ee,Zh as te,_C as ne,aS as x,ad as re,au as S,df as ie,dp as ae,ea as oe,fp as se,gC as ce,hC as C,iu as w,lu as T,nd as le,nu as ue,oS as de,op as fe,pu as pe,qc as me,qh as he,ru as ge,sp as _e,tu as ve,uf as ye,wa as be,xC as xe}from"./loadAgentsDir-JrGMJN05.js";import{D as E,Gt as D,H as Se,I as O,Lt as Ce,P as k,T as A,ai as j,mt as we,ot as Te,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{P as Ee,R as De,_ as Oe,f as ke}from"./debug-BQj6h99Q.js";import{Ln as F,Rn as Ae,Wt as je,zn as Me}from"./settings-aUygByiZ.js";import{C as Ne,b as I,f as Pe,l as Fe,u as Ie,v as L}from"./startupProfiler-2sjXZkIP.js";import{l as R,o as Le}from"./stringUtils-BjnclTLB.js";import{Nt as Re,_n as ze,vn as Be,yn as Ve}from"./prompt-DnPppVz8.js";import{i as He,n as Ue}from"./mappers-CMJorgSL.js";function z(e,t,n=1e3,r=0,i){let a=()=>Fe(Math.max(0,(i??Date.now())-e-r));return(0,We.useSyncExternalStore)((0,We.useCallback)(e=>{if(!t)return()=>{};let r=setInterval(e,n);return()=>clearInterval(r)},[t,n]),a,a)}var We,B=e((()=>{We=t(j(),1),L()}));function Ge(e,t,n){let r=ze(t,e.toolName);if(!r)return e.toolName;try{let t=r.inputSchema.safeParse(e.input),i=t.success?t.data:{},a=r.userFacingName(i);if(!a)return e.toolName;let o=r.renderToolUseMessage(i,{theme:n,verbose:!1});return o?(0,Ke.jsxs)(k,{children:[a,`(`,o,`)`]}):a}catch{return e.toolName}}var Ke,qe=e((()=>{M(),Ve(),Ke=P()}));function Je(e,t){let{isIdle:n,awaitingApproval:i,hasError:a,shutdownRequested:o}=t??{};return a?r.cross:i?r.questionMarkPrefix:o?r.warning:e===`running`?n?r.ellipsis:r.play:e===`completed`?r.tick:e===`failed`||e===`killed`?r.cross:r.bullet}function Ye(e,t){let{isIdle:n,awaitingApproval:r,hasError:i,shutdownRequested:a}=t??{};return i?`error`:r||a?`warning`:n?`background`:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:`background`}function Xe(e,t){if(!t)return!1;let n=!1;for(let t of Object.values(e))if(g(t))return n=!0,!1;return n}var Ze=e((()=>{n(),d()}));function Qe({agent:e,onDone:t,onKillAgent:n,onBack:r}){let[i]=Se(),a=(0,$e.useMemo)(()=>m(Be()),[]),o=z(e.startTime,e.status===`running`,1e3,e.totalPausedMs??0);D({"confirm:yes":t},{context:`Confirmation`});let s=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},c=be(e.prompt,`plan`),l=e.prompt.length>300?`${e.prompt.substring(0,297)}…`:e.prompt,u=e.result?.totalTokens??e.progress?.tokenCount,d=e.result?.totalToolUseCount??e.progress?.toolUseCount;return(0,V.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:s,children:(0,V.jsx)(N,{title:(0,V.jsxs)(k,{children:[e.selectedAgent?.agentType??`agent`,` › `,e.description||`Async agent`]}),subtitle:(0,V.jsxs)(k,{children:[e.status!==`running`&&(0,V.jsxs)(k,{color:Ye(e.status),children:[Je(e.status),` `,e.status===`completed`?`Completed`:e.status===`failed`?`Failed`:`Stopped`,` · `]}),(0,V.jsxs)(k,{dimColor:!0,children:[o,u!==void 0&&u>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,Pe(u),` tokens`]}),d!==void 0&&d>0&&(0,V.jsxs)(V.Fragment,{children:[` `,`· `,d,` `,d===1?`tool`:`tools`]})]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,V.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,V.jsxs)(A,{children:[r&&(0,V.jsx)(E,{shortcut:`←`,action:`go back`}),(0,V.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,V.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:(0,V.jsxs)(O,{flexDirection:`column`,children:[e.status===`running`&&e.progress?.recentActivities&&e.progress.recentActivities.length>0&&(0,V.jsxs)(O,{flexDirection:`column`,children:[(0,V.jsx)(k,{bold:!0,dimColor:!0,children:`Progress`}),e.progress.recentActivities.map((t,n)=>(0,V.jsxs)(k,{dimColor:n<e.progress.recentActivities.length-1,wrap:`truncate-end`,children:[n===e.progress.recentActivities.length-1?`› `:` `,Ge(t,a,i)]},n))]}),c?(0,V.jsx)(O,{marginTop:1,children:(0,V.jsx)(ae,{addMargin:!1,planContent:c})}):(0,V.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(k,{bold:!0,dimColor:!0,children:`Prompt`}),(0,V.jsx)(k,{wrap:`wrap`,children:l})]}),e.status===`failed`&&e.error&&(0,V.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,V.jsx)(k,{bold:!0,color:`error`,children:`Error`}),(0,V.jsx)(k,{color:`error`,wrap:`wrap`,children:e.error})]})]})})})}var $e,V,et=e((()=>{$e=t(j(),1),B(),M(),C(),Ve(),me(),L(),h(),se(),qe(),Ze(),V=P()}));function tt(e,t,n,r){if(!e)return`${t} found · ${n} verified`;if(e===`synthesizing`){let e=[`${n} verified`];return r>0&&e.push(`${r} refuted`),e.push(`deduping`),e.join(` · `)}if(e===`verifying`){let e=[`${t} found`,`${n} verified`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return t>0?`${t} found`:`finding`}function nt({text:e,phase:t=0}){return(0,H.jsx)(H.Fragment,{children:[...e].map((e,n)=>(0,H.jsx)(k,{color:fe(n+t),children:e},n))})}function rt(e,t,n){let r=(0,ot.useRef)(e),i=(0,ot.useRef)(t);return n||e<r.current?r.current=e:e>r.current&&t!==i.current&&(r.current+=1,i.current=t),r.current}function it({session:e}){let t=p().prefersReducedMotion??!1,n=e.reviewProgress,r=e.status===`running`,[,i]=we(r&&!t?st:null),a=n?.bugsFound??0,o=n?.bugsVerified??0,s=n?.bugsRefuted??0,c=t||!r,l=rt(a,i,c),u=rt(o,i,c),d=rt(s,i,c),f=Math.floor(i/(st*3))%7;if(e.status===`completed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsx)(k,{dimColor:!0,children:` ready · shift+↓ to view`})]});if(e.status===`failed`)return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◆`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:0}),(0,H.jsxs)(k,{color:`error`,dimColor:!0,children:[` · `,`error`]})]});let m=n?tt(n.stage,l,u,d):`setting up`;return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(k,{color:`background`,children:[`◇`,` `]}),(0,H.jsx)(nt,{text:`ultrareview`,phase:r?f:0}),(0,H.jsxs)(k,{dimColor:!0,children:[` · `,m]})]})}function at({session:e}){if(e.isRemoteReview)return(0,H.jsx)(it,{session:e});if(e.status===`completed`)return(0,H.jsx)(k,{bold:!0,color:`success`,dimColor:!0,children:`done`});if(e.status===`failed`)return(0,H.jsx)(k,{bold:!0,color:`error`,dimColor:!0,children:`error`});if(!e.todoList.length)return(0,H.jsxs)(k,{dimColor:!0,children:[e.status,`…`]});let t=F(e.todoList,e=>e.status===`completed`),n=e.todoList.length;return(0,H.jsxs)(k,{dimColor:!0,children:[t,`/`,n]})}var ot,H,st,ct=e((()=>{ot=t(j(),1),je(),he(),M(),Ae(),_e(),H=P(),st=80}));function U({status:e,label:t,suffix:n}){return(0,W.jsxs)(k,{color:e===`completed`?`success`:e===`failed`?`error`:e===`killed`?`warning`:void 0,dimColor:!0,children:[`(`,t??e,n,`)`]})}function lt({shell:e}){switch(e.status){case`completed`:return(0,W.jsx)(U,{status:`completed`,label:`done`});case`failed`:return(0,W.jsx)(U,{status:`failed`,label:`error`});case`killed`:return(0,W.jsx)(U,{status:`killed`,label:`stopped`});case`running`:case`pending`:return(0,W.jsx)(U,{status:`running`})}}var W,ut=e((()=>{M(),W=P()}));function dt({task:e,maxActivityWidth:t}){let n=t??40;switch(e.type){case`local_bash`:return(0,G.jsxs)(k,{children:[I(e.command,n,!0),` `,(0,G.jsx)(lt,{shell:e})]});case`remote_agent`:return e.isRemoteReview?(0,G.jsx)(k,{children:(0,G.jsx)(at,{session:e})}):(0,G.jsxs)(k,{children:[(0,G.jsxs)(k,{dimColor:!0,children:[e.status===`running`||e.status===`pending`?`◇`:`◆`,` `]}),I(e.title,n,!0),(0,G.jsx)(k,{dimColor:!0,children:` · `}),(0,G.jsx)(at,{session:e})]});case`local_agent`:return(0,G.jsxs)(k,{children:[I(e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]});case`local_workflow`:{let t=e;return(0,G.jsxs)(k,{children:[I(t.workflowName??e.summary??e.description,n,!0),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`running`?`${t.agentCount} ${R(t.agentCount,`agent`)}`:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}case`dream`:{let t=e.filesTouched.length,n=e.phase===`updating`&&t>0?`${t} ${R(t,`file`)}`:`${e.sessionsReviewing} ${R(e.sessionsReviewing,`session`)}`;return(0,G.jsxs)(k,{children:[e.description,` `,(0,G.jsxs)(k,{dimColor:!0,children:[`· `,e.phase,` · `,n]}),` `,(0,G.jsx)(U,{status:e.status,label:e.status===`completed`?`done`:void 0,suffix:e.status===`completed`&&!e.notified?`, unread`:void 0})]})}}}var G,ft=e((()=>{M(),L(),Le(),je(),ct(),ut(),G=P()}));function pt({task:e,onDone:t,onBack:n,onKill:r}){let i=z(e.startTime,e.status===`running`,1e3,0);D({"confirm:yes":t},{context:`Confirmation`});let a=i=>{i.key===` `?(i.preventDefault(),t()):i.key===`left`&&n?(i.preventDefault(),n()):i.key===`x`&&e.status===`running`&&r&&(i.preventDefault(),r())},o=e.turns.filter(e=>e.text!==``),s=o.slice(-6),c=o.length-s.length;return(0,K.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:a,children:(0,K.jsx)(N,{title:`Memory consolidation`,subtitle:(0,K.jsxs)(k,{dimColor:!0,children:[i,` · reviewing `,e.sessionsReviewing,` `,R(e.sessionsReviewing,`session`),e.filesTouched.length>0&&(0,K.jsxs)(K.Fragment,{children:[` `,`· `,e.filesTouched.length,` `,R(e.filesTouched.length,`file`),` touched`]})]}),onCancel:t,color:`background`,inputGuide:t=>t.pending?(0,K.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,K.jsxs)(A,{children:[n&&(0,K.jsx)(E,{shortcut:`←`,action:`go back`}),(0,K.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&r&&(0,K.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:(0,K.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,K.jsxs)(k,{children:[(0,K.jsx)(k,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,K.jsx)(k,{color:`background`,children:`running`}):e.status===`completed`?(0,K.jsx)(k,{color:`success`,children:e.status}):(0,K.jsx)(k,{color:`error`,children:e.status})]}),s.length===0?(0,K.jsx)(k,{dimColor:!0,children:e.status===`running`?`Starting…`:`(no text output)`}):(0,K.jsxs)(K.Fragment,{children:[c>0&&(0,K.jsxs)(k,{dimColor:!0,children:[`(`,c,` earlier `,R(c,`turn`),`)`]}),s.map((e,t)=>(0,K.jsxs)(O,{flexDirection:`column`,children:[(0,K.jsx)(k,{wrap:`wrap`,children:e.text}),e.toolUseCount>0&&(0,K.jsxs)(k,{dimColor:!0,children:[` `,`(`,e.toolUseCount,` `,R(e.toolUseCount,`tool`),`)`]})]},t))]})]})})})}var K,mt=e((()=>{B(),M(),C(),Le(),K=P()}));function ht({stage:e,completed:t,hasProgress:n}){let r=e?yt.indexOf(e):-1,i=!t&&!n;return(0,J.jsxs)(k,{children:[i?(0,J.jsx)(k,{color:`background`,children:`Setup`}):(0,J.jsx)(k,{dimColor:!0,children:`Setup`}),(0,J.jsx)(k,{dimColor:!0,children:` → `}),yt.map((e,n)=>{let a=!t&&!i&&n===r;return(0,J.jsxs)(q.Fragment,{children:[n>0&&(0,J.jsx)(k,{dimColor:!0,children:` → `}),a?(0,J.jsx)(k,{color:`background`,children:bt[e]}):(0,J.jsx)(k,{dimColor:!0,children:bt[e]})]},e)}),t&&(0,J.jsx)(k,{color:`success`,children:` ✓`})]})}function gt(e){let t=e.reviewProgress;if(!t)return e.status===`completed`?`done`:`setting up`;let n=t.bugsVerified,r=t.bugsRefuted??0;if(e.status===`completed`){let e=[`${n} ${R(n,`finding`)}`];return r>0&&e.push(`${r} refuted`),e.join(` · `)}return tt(t.stage,t.bugsFound,n,r)}function _t({session:e,onDone:t,onBack:n,onKill:r}){let i=e.status===`completed`,a=e.status===`running`||e.status===`pending`,[o,s]=(0,q.useState)(!1),c=z(e.startTime,a,1e3,0,e.endTime),l=()=>t(`Remote session details dismissed`,{display:`system`}),u=n??l,d=w(e.sessionId),f=i?`ready`:a?`running`:e.status;if(o)return(0,J.jsx)(N,{title:`Stop ultrareview?`,onCancel:()=>s(!1),color:`background`,children:(0,J.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(k,{dimColor:!0,children:`This archives the remote session and stops local tracking. The review will not complete and any findings so far are discarded.`}),(0,J.jsx)(b,{options:[{label:`Stop ultrareview`,value:`stop`},{label:`Back`,value:`back`}],onChange:e=>{e===`stop`?(r?.(),u()):s(!1)}})]})});let p=i?[{label:`Open in Claude Code on the web`,value:`open`},{label:`Dismiss`,value:`dismiss`}]:[{label:`Open in Claude Code on the web`,value:`open`},...r&&a?[{label:`Stop ultrareview`,value:`stop`}]:[],{label:`Back`,value:`back`}];return(0,J.jsx)(N,{title:(0,J.jsxs)(k,{children:[(0,J.jsxs)(k,{color:`background`,children:[i?`◆`:`◇`,` `]}),(0,J.jsx)(k,{bold:!0,children:`ultrareview`}),(0,J.jsxs)(k,{dimColor:!0,children:[` · `,c,` · `,f]})]}),onCancel:u,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(A,{children:[(0,J.jsx)(E,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(E,{shortcut:`Esc`,action:`go back`})]}),children:(0,J.jsxs)(O,{flexDirection:`column`,gap:1,children:[(0,J.jsx)(ht,{stage:e.reviewProgress?.stage,completed:i,hasProgress:!!e.reviewProgress}),(0,J.jsxs)(O,{flexDirection:`column`,children:[(0,J.jsx)(k,{children:gt(e)}),(0,J.jsx)(Ce,{url:d,children:(0,J.jsx)(k,{dimColor:!0,children:d})})]}),(0,J.jsx)(b,{options:p,onChange:e=>{switch(e){case`open`:de(d),t();break;case`stop`:s(!0);break;case`back`:u();break;case`dismiss`:l();break}}})]})})}function vt({session:e,toolUseContext:t,onDone:n,onBack:r,onKill:i}){let[a,s]=(0,q.useState)(!1),[c,l]=(0,q.useState)(null),d=(0,q.useMemo)(()=>e.isRemoteReview?[]:u(He(e.log)).filter(e=>e.type!==`progress`).slice(-3),[e]);if(e.isRemoteReview)return(0,J.jsx)(_t,{session:e,onDone:n,onBack:r,onKill:i});let f=()=>n(`Remote session details dismissed`,{display:`system`}),p=e=>{e.key===` `?(e.preventDefault(),n(`Remote session details dismissed`,{display:`system`})):e.key===`left`&&r?(e.preventDefault(),r()):e.key===`t`&&!a?(e.preventDefault(),m()):e.key===`return`&&(e.preventDefault(),f())};async function m(){s(!0),l(null);try{await pe(e.sessionId)}catch(e){l(Ee(e))}finally{s(!1)}}let h=Ne(e.title,50),g=e.status===`pending`?`starting`:e.status;return(0,J.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:p,children:(0,J.jsxs)(N,{title:`Remote session details`,onCancel:f,color:`background`,inputGuide:e=>e.pending?(0,J.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,J.jsxs)(A,{children:[r&&(0,J.jsx)(E,{shortcut:`←`,action:`go back`}),(0,J.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),!a&&(0,J.jsx)(E,{shortcut:`t`,action:`teleport`})]}),children:[(0,J.jsxs)(O,{flexDirection:`column`,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Status`}),`:`,` `,g===`running`||g===`starting`?(0,J.jsx)(k,{color:`background`,children:g}):g===`completed`?(0,J.jsx)(k,{color:`success`,children:g}):(0,J.jsx)(k,{color:`error`,children:g})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Runtime`}),`: `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,J.jsxs)(k,{wrap:`truncate-end`,children:[(0,J.jsx)(k,{bold:!0,children:`Title`}),`: `,h]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Progress`}),`: `,(0,J.jsx)(at,{session:e})]}),(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Session URL`}),`:`,` `,(0,J.jsx)(Ce,{url:w(e.sessionId),children:(0,J.jsx)(k,{dimColor:!0,children:w(e.sessionId)})})]})]}),e.log.length>0&&(0,J.jsxs)(O,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(k,{children:[(0,J.jsx)(k,{bold:!0,children:`Recent messages`}),`:`]}),(0,J.jsx)(O,{flexDirection:`column`,height:10,overflowY:`hidden`,children:d.map((e,n)=>(0,J.jsx)(o,{message:e,lookups:oe,addMargin:n>0,tools:t.options.tools,commands:t.options.commands,verbose:t.options.verbose,inProgressToolUseIDs:new Set,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,style:`condensed`,isTranscriptMode:!1,isStatic:!0},n))}),(0,J.jsx)(O,{marginTop:1,children:(0,J.jsxs)(k,{dimColor:!0,italic:!0,children:[`Showing last `,d.length,` of `,e.log.length,` messages`]})})]}),c&&(0,J.jsx)(O,{marginTop:1,children:(0,J.jsxs)(k,{color:`error`,children:[`Teleport failed: `,c]})}),a&&(0,J.jsx)(k,{color:`background`,children:`Teleporting to session…`})]})})}var q,J,yt,bt,xt=e((()=>{q=t(j(),1),je(),B(),M(),S(),Re(),x(),De(),L(),Ue(),h(),Le(),T(),a(),v(),ct(),J=P(),yt=[`finding`,`verifying`,`synthesizing`],bt={finding:`Find`,verifying:`Verify`,synthesizing:`Dedupe`}}));async function St(e){let t=l(e.id);try{let e=await Oe(t,Tt);return{content:e.content,bytesTotal:e.bytesTotal}}catch{return{content:``,bytesTotal:0}}}function Ct({shell:e,onDone:t,onKillShell:n,onBack:r}){let{columns:i}=Te(),[a,o]=(0,Y.useState)(()=>St(e)),s=(0,Y.useDeferredValue)(a);(0,Y.useEffect)(()=>{if(e.status!==`running`)return;let t=setInterval((e,t)=>e(St(t)),1e3,o,e);return()=>clearInterval(t)},[e.id,e.status]);let c=()=>t(`Shell details dismissed`,{display:`system`});D({"confirm:yes":c},{context:`Confirmation`});let l=i=>{i.key===` `?(i.preventDefault(),t(`Shell details dismissed`,{display:`system`})):i.key===`left`&&r?(i.preventDefault(),r()):i.key===`x`&&e.status===`running`&&n&&(i.preventDefault(),n())},u=Ne(e.command,280);return(0,X.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:l,children:(0,X.jsxs)(N,{title:`Shell details`,onCancel:c,color:`background`,inputGuide:t=>t.pending?(0,X.jsxs)(k,{children:[`Press `,t.keyName,` again to exit`]}):(0,X.jsxs)(A,{children:[r&&(0,X.jsx)(E,{shortcut:`←`,action:`go back`}),(0,X.jsx)(E,{shortcut:`Esc/Enter/Space`,action:`close`}),e.status===`running`&&n&&(0,X.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:[(0,X.jsxs)(O,{flexDirection:`column`,children:[(0,X.jsxs)(k,{children:[(0,X.jsx)(k,{bold:!0,children:`Status:`}),` `,e.status===`running`?(0,X.jsxs)(k,{color:`background`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):e.status===`completed`?(0,X.jsxs)(k,{color:`success`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]}):(0,X.jsxs)(k,{color:`error`,children:[e.status,e.result?.code!==void 0&&` (exit code: ${e.result.code})`]})]}),(0,X.jsxs)(k,{children:[(0,X.jsx)(k,{bold:!0,children:`Runtime:`}),` `,Fe((e.endTime??Date.now())-e.startTime)]}),(0,X.jsxs)(k,{wrap:`wrap`,children:[(0,X.jsx)(k,{bold:!0,children:`Command:`}),` `,u]})]}),(0,X.jsxs)(O,{flexDirection:`column`,children:[(0,X.jsx)(k,{bold:!0,children:`Output:`}),(0,X.jsx)(Y.Suspense,{fallback:(0,X.jsx)(k,{dimColor:!0,children:`Loading output…`}),children:(0,X.jsx)(wt,{outputPromise:s,columns:i})})]})]})})}function wt({outputPromise:e,columns:t}){let{content:n,bytesTotal:r}=(0,Y.use)(e);if(!n)return(0,X.jsx)(k,{dimColor:!0,children:`No output available`});let i=[],a=n.length;for(let e=0;e<10&&a>0;e++){let e=n.lastIndexOf(`
|
|
2
|
+
`,a-1);i.push(e+1),a=e}i.reverse();let o=r>n.length,s=[];for(let e=0;e<i.length;e++){let t=i[e],r=e<i.length-1?i[e+1]-1:n.length,a=n.slice(t,r);a&&s.push(a)}return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(O,{borderStyle:`round`,paddingX:1,flexDirection:`column`,height:12,maxWidth:t-6,children:s.map((e,t)=>(0,X.jsx)(k,{wrap:`truncate-end`,children:e},t))}),(0,X.jsxs)(k,{dimColor:!0,italic:!0,children:[`Showing ${s.length} lines`,o?` of ${Ie(r)}`:``]})]})}var Y,X,Tt,Et=e((()=>{Y=t(j(),1),xe(),M(),C(),L(),ke(),y(),X=P(),Tt=8192}));function Dt(e,t){return Object.values(e??{}).filter(g).filter(e=>!(e.type===`local_agent`&&e.id===t))}function Ot({onDone:e,toolUseContext:t,initialDetailTaskId:n}){let r=te(e=>e.tasks),a=te(e=>e.foregroundedTaskId),o=i(),s=ne(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),l=r,u=(0,Q.useRef)(!1),[d,p]=(0,Q.useState)(()=>{if(n)return u.current=!0,{mode:`detail`,itemId:n};let e=Dt(l,a);return e.length===1?(u.current=!0,{mode:`detail`,itemId:e[0].id}):{mode:`list`}}),[m,h]=(0,Q.useState)(0);re(`background-tasks-dialog`);let{bashTasks:_,remoteSessions:v,agentTasks:y,workflowTasks:b,dreamTasks:ee,allSelectableItems:x}=(0,Q.useMemo)(()=>{let e=Object.values(l??{}).filter(g).map(kt).sort((e,t)=>{let n=e.status,r=t.status;if(n===`running`&&r!==`running`)return-1;if(n!==`running`&&r===`running`)return 1;let i=`task`in e?e.task.startTime:0;return(`task`in t?t.task.startTime:0)-i}),t=e.filter(e=>e.type===`local_bash`),n=e.filter(e=>e.type===`remote_agent`),r=e.filter(e=>e.type===`local_agent`&&e.id!==a),i=e.filter(e=>e.type===`local_workflow`),o=e.filter(e=>e.type===`dream`);return{bashTasks:t,remoteSessions:n,agentTasks:r,workflowTasks:i,dreamTasks:o,allSelectableItems:[...t,...n,...r,...i,...o]}},[l,a]),S=x[m]??null;D({"confirm:previous":()=>h(e=>Math.max(0,e-1)),"confirm:next":()=>h(e=>Math.min(x.length-1,e+1)),"confirm:yes":()=>{let e=x[m];e&&p({mode:`detail`,itemId:e.id})}},{context:`Confirmation`,isActive:d.mode===`list`});let ie=t=>{if(d.mode!==`list`)return;if(t.key===`left`){t.preventDefault(),e(`Background tasks dialog dismissed`,{display:`system`});return}let n=x[m];n&&t.key===`x`&&(t.preventDefault(),n.type===`local_bash`&&n.status===`running`?ae(n.id):n.type===`local_agent`&&n.status===`running`?oe(n.id):n.type===`local_workflow`&&n.status===`running`?At(n.id,o):n.type===`dream`&&n.status===`running`?se(n.id):n.type===`remote_agent`&&n.status===`running`&&ce(n.id))};async function ae(e){await c.kill(e,o)}async function oe(e){await f.kill(e,o)}async function se(e){await ye.kill(e,o)}async function ce(e){await ge.kill(e,o)}let C=(0,Q.useEffectEvent)(e);(0,Q.useEffect)(()=>{if(d.mode!==`list`){let e=l?.[d.itemId];(!e||e.type!==`local_workflow`&&!g(e))&&(u.current?C(`Background tasks dialog dismissed`,{display:`system`}):p({mode:`list`}))}let e=x.length;m>=e&&e>0&&h(e-1)},[d,l,m,x,C]);let w=()=>{u.current&&x.length<=1?e(`Background tasks dialog dismissed`,{display:`system`}):(u.current=!1,p({mode:`list`}))};if(d.mode!==`list`&&l){let n=l[d.itemId];if(!n)return null;switch(n.type){case`local_bash`:return(0,$.jsx)(Ct,{shell:n,onDone:e,onKillShell:()=>void ae(n.id),onBack:w},`shell-${n.id}`);case`local_agent`:return(0,$.jsx)(Qe,{agent:n,onDone:e,onKillAgent:()=>void oe(n.id),onBack:w},`agent-${n.id}`);case`remote_agent`:return(0,$.jsx)(vt,{session:n,onDone:e,toolUseContext:t,onBack:w,onKill:n.status===`running`?()=>void ce(n.id):void 0},`session-${n.id}`);case`local_workflow`:{let e=n.status===`running`?()=>At(n.id,o):void 0;return(0,$.jsx)(O,{flexDirection:`column`,tabIndex:0,borderStyle:`round`,onKeyDown:t=>{t.key===`left`?(t.preventDefault(),w()):t.key===`x`&&e&&(t.preventDefault(),e())},children:(0,$.jsx)(N,{title:n.workflowName,subtitle:(0,$.jsxs)(k,{dimColor:!0,children:[n.status,n.summary?` · ${n.summary}`:``]}),onCancel:w,inputGuide:()=>(0,$.jsxs)(A,{children:[(0,$.jsx)(E,{shortcut:`←`,action:`go back`}),(0,$.jsx)(E,{shortcut:`Esc`,action:`close`}),e&&(0,$.jsx)(E,{shortcut:`x`,action:`stop`})]}),children:n.status===`failed`&&n.error?(0,$.jsxs)(k,{color:`error`,children:[`失败原因:`,n.error]}):null})},`workflow-${n.id}`)}case`dream`:return(0,$.jsx)(pt,{task:n,onDone:()=>e(`Background tasks dialog dismissed`,{display:`system`}),onBack:w,onKill:n.status===`running`?()=>void se(n.id):void 0},`dream-${n.id}`)}}let T=F(_,e=>e.status===`running`),le=F(v,e=>e.status===`running`||e.status===`pending`)+F(y,e=>e.status===`running`),ue=Me([...T>0?[(0,$.jsxs)(k,{children:[T,` `,T===1?`active shell`:`active shells`]},`shells`)]:[],...le>0?[(0,$.jsxs)(k,{children:[le,` `,le===1?`active agent`:`active agents`]},`agents`)]:[]],e=>(0,$.jsx)(k,{children:` · `},`separator-${e}`)),de=[(0,$.jsx)(E,{shortcut:`↑/↓`,action:`select`},`upDown`),(0,$.jsx)(E,{shortcut:`Enter`,action:`view`},`enter`),...(S?.type===`local_bash`||S?.type===`local_agent`||S?.type===`local_workflow`||S?.type===`dream`||S?.type===`remote_agent`)&&S.status===`running`?[(0,$.jsx)(E,{shortcut:`x`,action:`stop`},`kill`)]:[],...y.some(e=>e.status===`running`)?[(0,$.jsx)(E,{shortcut:s,action:`stop all agents`},`kill-all`)]:[],(0,$.jsx)(E,{shortcut:`←/Esc`,action:`close`},`esc`)],fe=()=>e(`Background tasks dialog dismissed`,{display:`system`});function pe(e){return e.pending?(0,$.jsxs)(k,{children:[`Press `,e.keyName,` again to exit`]}):(0,$.jsx)(A,{children:de})}return(0,$.jsx)(O,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:ie,children:(0,$.jsx)(N,{title:`Background tasks`,subtitle:ue,onCancel:fe,color:`background`,inputGuide:pe,children:x.length===0?(0,$.jsx)(k,{dimColor:!0,children:`No tasks currently running`}):(0,$.jsxs)(O,{flexDirection:`column`,children:[_.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,children:[(v.length>0||y.length>0)&&(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Shells`]}),` (`,_.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:_.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),v.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,marginTop:+(_.length>0),children:[(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Remote agents`]}),` (`,v.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:v.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),y.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0),children:[(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Local agents`]}),` (`,y.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:y.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),b.length>0&&(0,$.jsxs)(O,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0||y.length>0),children:[(0,$.jsxs)(k,{dimColor:!0,children:[(0,$.jsxs)(k,{bold:!0,children:[` `,`Workflows`]}),` (`,b.length,`)`]}),(0,$.jsx)(O,{flexDirection:`column`,children:b.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})]}),ee.length>0&&(0,$.jsx)(O,{flexDirection:`column`,marginTop:+(_.length>0||v.length>0||y.length>0||b.length>0),children:(0,$.jsx)(O,{flexDirection:`column`,children:ee.map(e=>(0,$.jsx)(Z,{item:e,isSelected:e.id===S?.id},e.id))})})]})})})}function kt(e){switch(e.type){case`local_bash`:return{id:e.id,type:`local_bash`,label:e.command,status:e.status,task:e};case`remote_agent`:return{id:e.id,type:`remote_agent`,label:e.title,status:e.status,task:e};case`local_agent`:return{id:e.id,type:`local_agent`,label:e.description,status:e.status,task:e};case`local_workflow`:return{id:e.id,type:`local_workflow`,label:e.summary??e.description,status:e.status,task:e};case`dream`:return{id:e.id,type:`dream`,label:e.description,status:e.status,task:e}}}function Z({item:e,isSelected:t}){let{columns:n}=Te(),i=Math.max(30,n-26);return(0,$.jsxs)(O,{flexDirection:`row`,children:[(0,$.jsx)(k,{children:t?`${r.pointer} `:` `}),(0,$.jsx)(k,{color:t?`suggestion`:void 0,children:(0,$.jsx)(dt,{task:e.task,maxActivityWidth:i})})]})}var Q,$,At,jt=e((()=>{n(),Q=t(j(),1),xe(),ee(),ie(),_(),s(),S(),d(),Ae(),le(),M(),C(),ce(),et(),ft(),mt(),xt(),Et(),ve(),$=P(),At=ue}));export{B as a,Xe as i,jt as n,z as o,Ze as r,Ot as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Qd as n,Qu as r,Zu as i}from"./loadAgentsDir-JrGMJN05.js";import{I as a,Lt as o,P as s,ai as c,kt as l,t as u,y as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{g as p,x as m}from"./settings-aUygByiZ.js";import{n as h,r as g}from"./analytics-DJobLaWP.js";var _=e(c(),1);h(),u(),t(),p(),i();var v=f();function y({onAccept:e}){let[t,i]=_.useState(null);_.useEffect(()=>{if(t!==null){let e=t,r=setTimeout(()=>n(e));return()=>clearTimeout(r)}},[t]),_.useEffect(()=>{g(`tengu_bypass_permissions_mode_dialog_shown`,{})},[]);function c(t){switch(t){case`accept`:g(`tengu_bypass_permissions_mode_dialog_accept`,{}),m(`userSettings`,{skipDangerousModePermissionPrompt:!0}),e();break;case`decline`:i(1);break}}let u=(0,_.useCallback)(()=>{i(0)},[]);return t===null?(0,v.jsxs)(d,{title:`WARNING: Claude Code running in Bypass Permissions mode`,color:`error`,onCancel:u,children:[(0,v.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,v.jsxs)(s,{children:[`In Bypass Permissions mode, Claude Code will not ask for your approval before running potentially dangerous commands.`,(0,v.jsx)(l,{}),`This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be restored if damaged.`]}),(0,v.jsx)(s,{children:`By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.`}),(0,v.jsx)(o,{url:`https://code.workmate.com/docs/en/security`})]}),(0,v.jsx)(r,{options:[{label:`No, exit`,value:`decline`},{label:`Yes, I accept`,value:`accept`}],onChange:e=>c(e)})]}):null}export{y as BypassPermissionsModeDialog};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Nh as i,Ph as a,_C as o,ad as s,gC as c,hC as l,nd as u,xC as d}from"./loadAgentsDir-JrGMJN05.js";import{C as f,Gt as ee,I as p,P as m,T as h,ai as g,ot as _,t as v,y as te}from"./src-DL3w8VPk2.js";import{t as y}from"./jsx-runtime-Bb4Xn-E0.js";import{n as b,t as x}from"./cwd-Besi3Os3.js";import{jn as S,wn as C}from"./settings-aUygByiZ.js";import{l as w,m as T,p as E,s as D}from"./git-DplvjXEY.js";import{r as O,t as k}from"./execFileNoThrow-DYm1GeGn.js";import{S as ne,v as re}from"./startupProfiler-2sjXZkIP.js";import{l as A,o as j}from"./stringUtils-BjnclTLB.js";import{i as ie}from"./detectRepository-Qy3zKoyn.js";import{join as M,resolve as ae}from"path";import{access as oe}from"fs/promises";async function se(){if(!await w()||await P())return null;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--shortstat`],{timeout:F,preserveOutputOnError:!1});if(t===0){let t=de(e);if(t&&t.filesCount>z)return{stats:t,perFileStats:new Map,hunks:new Map}}let{stdout:n,code:r}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`,`--numstat`],{timeout:F,preserveOutputOnError:!1});if(r!==0)return null;let{stats:i,perFileStats:a}=ce(n),o=I-a.size;if(o>0){let e=await ue(o);if(e){i.filesCount+=e.size;for(let[t,n]of e)a.set(t,n)}}return{stats:i,perFileStats:a,hunks:new Map}}async function N(){if(!await w()||await P())return new Map;let{stdout:e,code:t}=await k(E(),[`--no-optional-locks`,`diff`,`HEAD`],{timeout:F,preserveOutputOnError:!1});return t===0?le(e):new Map}function ce(e){let t=e.trim().split(`
|
|
2
|
+
`).filter(Boolean),n=0,r=0,i=0,a=new Map;for(let e of t){let t=e.split(` `);if(t.length<3)continue;i++;let o=t[0],s=t[1],c=t.slice(2).join(` `),l=o===`-`||s===`-`,u=l?0:parseInt(o??`0`,10)||0,d=l?0:parseInt(s??`0`,10)||0;n+=u,r+=d,a.size<I&&a.set(c,{added:u,removed:d,isBinary:l})}return{stats:{filesCount:i,linesAdded:n,linesRemoved:r},perFileStats:a}}function le(e){let t=new Map;if(!e.trim())return t;let n=e.split(/^diff --git /m).filter(Boolean);for(let e of n){if(t.size>=I)break;if(e.length>L)continue;let n=e.split(`
|
|
3
|
+
`),r=n[0]?.match(/^a\/(.+?) b\/(.+)$/);if(!r)continue;let i=r[2]??r[1]??``,a=[],o=null,s=0;for(let e=1;e<n.length;e++){let t=n[e]??``,r=t.match(/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/);if(r){o&&a.push(o),o={oldStart:parseInt(r[1]??`0`,10),oldLines:parseInt(r[2]??`1`,10),newStart:parseInt(r[3]??`0`,10),newLines:parseInt(r[4]??`1`,10),lines:[]};continue}if(!(t.startsWith(`index `)||t.startsWith(`---`)||t.startsWith(`+++`)||t.startsWith(`new file`)||t.startsWith(`deleted file`)||t.startsWith(`old mode`)||t.startsWith(`new mode`)||t.startsWith(`Binary files`))&&o&&(t.startsWith(`+`)||t.startsWith(`-`)||t.startsWith(` `)||t===``)){if(s>=R)continue;o.lines.push(`${t}`),s++}}o&&a.push(o),a.length>0&&t.set(i,a)}return t}async function P(){let e=await D(x());return e?(await Promise.all([`MERGE_HEAD`,`REBASE_HEAD`,`CHERRY_PICK_HEAD`,`REVERT_HEAD`].map(t=>oe(M(e,t)).then(()=>!0).catch(()=>!1)))).some(Boolean):!1}async function ue(e){let{stdout:t,code:n}=await k(E(),[`--no-optional-locks`,`ls-files`,`--others`,`--exclude-standard`],{timeout:F,preserveOutputOnError:!1});if(n!==0||!t.trim())return null;let r=t.trim().split(`
|
|
4
|
+
`).filter(Boolean);if(r.length===0)return null;let i=new Map;for(let t of r.slice(0,e))i.set(t,{added:0,removed:0,isBinary:!1,isUntracked:!0});return i}function de(e){let t=e.match(/(\d+)\s+files?\s+changed(?:,\s+(\d+)\s+insertions?\(\+\))?(?:,\s+(\d+)\s+deletions?\(-\))?/);return t?{filesCount:parseInt(t[1]??`0`,10),linesAdded:parseInt(t[2]??`0`,10),linesRemoved:parseInt(t[3]??`0`,10)}:null}var F,I,L,R,z,B=e((()=>{b(),ie(),O(),C(),T(),F=5e3,I=50,L=1e6,R=400,z=500}));function V(){let[e,t]=(0,H.useState)(null),[n,r]=(0,H.useState)(new Map),[i,a]=(0,H.useState)(!0);return(0,H.useEffect)(()=>{let e=!1;async function n(){try{let[n,i]=await Promise.all([se(),N()]);e||(t(n),r(i),a(!1))}catch{e||(t(null),r(new Map),a(!1))}}return n(),()=>{e=!0}},[]),(0,H.useMemo)(()=>{if(!e)return{stats:null,files:[],hunks:new Map,loading:i};let{stats:t,perFileStats:r}=e,a=[];for(let[e,t]of r){let r=n.get(e),i=t.isUntracked??!1,o=!t.isBinary&&!i&&!r,s=t.added+t.removed,c=!o&&!t.isBinary&&s>U;a.push({path:e,linesAdded:t.added,linesRemoved:t.removed,isBinary:t.isBinary,isLargeFile:o,isTruncated:c,isUntracked:i})}return a.sort((e,t)=>e.path.localeCompare(t.path)),{stats:t,files:a,hunks:n,loading:!1}},[e,n,i])}var H,U,W=e((()=>{H=t(g(),1),B(),U=400}));function fe(e){if(!e||typeof e!=`object`)return!1;let t=e,n=typeof t.filePath==`string`,r=Array.isArray(t.structuredPatch)&&t.structuredPatch.length>0,i=t.type===`create`&&typeof t.content==`string`;return n&&(r||i)}function pe(e){return`type`in e&&(e.type===`create`||e.type===`update`)}function me(e){let t=0,n=0;for(let r of e)for(let e of r.lines)e.startsWith(`+`)?t++:e.startsWith(`-`)&&n++;return{added:t,removed:n}}function he(e){if(e.type!==`user`)return``;let t=e.message.content,n=typeof t==`string`?t:``;return n.length<=30?n:`${n.slice(0,29)}…`}function G(e){let t=0,n=0;for(let r of e.files.values())t+=r.linesAdded,n+=r.linesRemoved;e.stats={filesChanged:e.files.size,linesAdded:t,linesRemoved:n}}function ge(e){let t=(0,K.useRef)({completedTurns:[],currentTurn:null,lastProcessedIndex:0,lastTurnIndex:0});return(0,K.useMemo)(()=>{let n=t.current;e.length<n.lastProcessedIndex&&(n.completedTurns=[],n.currentTurn=null,n.lastProcessedIndex=0,n.lastTurnIndex=0);for(let t=n.lastProcessedIndex;t<e.length;t++){let r=e[t];if(r?.type===`user`){if(!(r.toolUseResult||Array.isArray(r.message.content)&&r.message.content[0]?.type===`tool_result`)&&!r.isMeta)n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),n.completedTurns.push(n.currentTurn)),n.lastTurnIndex++,n.currentTurn={turnIndex:n.lastTurnIndex,userPromptPreview:he(r),timestamp:r.timestamp,files:new Map,stats:{filesChanged:0,linesAdded:0,linesRemoved:0}};else if(n.currentTurn&&r.toolUseResult){let e=r.toolUseResult;if(fe(e)){let{filePath:t,structuredPatch:r}=e,i=`type`in e&&e.type===`create`,a=n.currentTurn.files.get(t);if(a||(a={filePath:t,hunks:[],isNewFile:i,linesAdded:0,linesRemoved:0},n.currentTurn.files.set(t,a)),i&&r.length===0&&pe(e)){let t=e.content.split(`
|
|
5
|
+
`),n={oldStart:0,oldLines:0,newStart:1,newLines:t.length,lines:t.map(e=>`+${e}`)};a.hunks.push(n),a.linesAdded+=t.length}else{a.hunks.push(...r);let{added:e,removed:t}=me(r);a.linesAdded+=e,a.linesRemoved+=t}i&&(a.isNewFile=!0)}}}}n.lastProcessedIndex=e.length;let r=[...n.completedTurns];return n.currentTurn&&n.currentTurn.files.size>0&&(G(n.currentTurn),r.push(n.currentTurn)),r.reverse()},[e])}var K,_e=e((()=>{K=t(g(),1)}));function ve({filePath:e,hunks:t,isLargeFile:n,isBinary:r,isTruncated:a,isUntracked:o}){let{columns:s}=_(),{firstLine:c,fileContent:l}=(0,q.useMemo)(()=>{if(!e)return{firstLine:null,fileContent:void 0};let t=S(ae(x(),e));return{firstLine:t?.split(`
|
|
6
|
+
`)[0]??null,fileContent:t??void 0}},[e]);return o?(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(m,{bold:!0,children:e}),(0,J.jsx)(m,{dimColor:!0,children:` (untracked)`})]}),(0,J.jsx)(f,{padding:4}),(0,J.jsxs)(p,{flexDirection:`column`,children:[(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`New file not yet staged.`}),(0,J.jsxs)(m,{dimColor:!0,italic:!0,children:["Run `git add ",e,"` to see line counts."]})]})]}):r?(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(p,{children:(0,J.jsx)(m,{bold:!0,children:e})}),(0,J.jsx)(f,{padding:4}),(0,J.jsx)(p,{flexDirection:`column`,children:(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`Binary file - cannot display diff`})})]}):n?(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsx)(p,{children:(0,J.jsx)(m,{bold:!0,children:e})}),(0,J.jsx)(f,{padding:4}),(0,J.jsx)(p,{flexDirection:`column`,children:(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`Large file - diff exceeds 1 MB limit`})})]}):(0,J.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,J.jsxs)(p,{children:[(0,J.jsx)(m,{bold:!0,children:e}),a&&(0,J.jsx)(m,{dimColor:!0,children:` (truncated)`})]}),(0,J.jsx)(f,{padding:4}),(0,J.jsx)(p,{flexDirection:`column`,children:t.length===0?(0,J.jsx)(m,{dimColor:!0,children:`No diff content`}):t.map((t,n)=>(0,J.jsx)(i,{patch:t,filePath:e,firstLine:c,fileContent:l,dim:!1,width:s-2-2},n))}),a&&(0,J.jsx)(m,{dimColor:!0,italic:!0,children:`… diff truncated (exceeded 400 line limit)`})]})}var q,J,ye=e((()=>{q=t(g(),1),d(),v(),b(),C(),a(),J=y()}));function be({files:e,selectedIndex:t}){let{columns:n}=_(),{startIndex:r,endIndex:i}=(0,Y.useMemo)(()=>{if(e.length===0||e.length<=Z)return{startIndex:0,endIndex:e.length};let n=Math.max(0,t-Math.floor(Z/2)),r=n+Z;return r>e.length&&(r=e.length,n=Math.max(0,r-Z)),{startIndex:n,endIndex:r}},[e.length,t]);if(e.length===0)return(0,X.jsx)(m,{dimColor:!0,children:`No changed files`});let a=e.slice(r,i),o=r>0,s=i<e.length,c=e.length>Z,l=Math.max(20,n-16-3-4);return(0,X.jsxs)(p,{flexDirection:`column`,children:[c&&(0,X.jsx)(m,{dimColor:!0,children:o?` ↑ ${r} more ${A(r,`file`)}`:` `}),a.map((e,n)=>(0,X.jsx)(xe,{file:e,isSelected:r+n===t,maxPathWidth:l},e.path)),c&&(0,X.jsx)(m,{dimColor:!0,children:s?` ↓ ${e.length-i} more ${A(e.length-i,`file`)}`:` `})]})}function xe({file:e,isSelected:t,maxPathWidth:n}){let i=ne(e.path,n),a=`${t?`${r.pointer} `:` `}${i}`;return(0,X.jsxs)(p,{flexDirection:`row`,children:[(0,X.jsx)(m,{bold:t,color:t?`background`:void 0,inverse:t,children:a}),(0,X.jsx)(p,{flexGrow:1}),(0,X.jsx)(Se,{file:e,isSelected:t})]})}function Se({file:e,isSelected:t}){return e.isUntracked?(0,X.jsx)(m,{dimColor:!t,italic:!0,children:`untracked`}):e.isBinary?(0,X.jsx)(m,{dimColor:!t,italic:!0,children:`Binary file`}):e.isLargeFile?(0,X.jsx)(m,{dimColor:!t,italic:!0,children:`Large file modified`}):(0,X.jsxs)(m,{children:[e.linesAdded>0&&(0,X.jsxs)(m,{color:`diffAddedWord`,bold:t,children:[`+`,e.linesAdded]}),e.linesAdded>0&&e.linesRemoved>0&&` `,e.linesRemoved>0&&(0,X.jsxs)(m,{color:`diffRemovedWord`,bold:t,children:[`-`,e.linesRemoved]}),e.isTruncated&&(0,X.jsx)(m,{dimColor:!t,children:` (truncated)`})]})}var Y,X,Z,Ce=e((()=>{n(),Y=t(g(),1),d(),v(),re(),j(),X=y(),Z=5}));function we(e){let t=Array.from(e.files.values()).map(e=>({path:e.filePath,linesAdded:e.linesAdded,linesRemoved:e.linesRemoved,isBinary:!1,isLargeFile:!1,isTruncated:!1,isNewFile:e.isNewFile})).sort((e,t)=>e.path.localeCompare(t.path)),n=new Map;for(let t of e.files.values())n.set(t.filePath,t.hunks);return{stats:{filesCount:e.stats.filesChanged,linesAdded:e.stats.linesAdded,linesRemoved:e.stats.linesRemoved},files:t,hunks:n,loading:!1}}function Te({messages:e,onDone:t}){let n=V(),r=ge(e),[i,a]=(0,Q.useState)(`list`),[c,l]=(0,Q.useState)(0),[u,d]=(0,Q.useState)(0),f=(0,Q.useMemo)(()=>[{type:`current`},...r.map(e=>({type:`turn`,turn:e}))],[r]),g=f[u],_=g?.type===`turn`?g.turn:null,v=(0,Q.useMemo)(()=>_?we(_):n,[_,n]),y=v.files[c],b=(0,Q.useMemo)(()=>y&&v.hunks.get(y.path)||[],[y,v.hunks]);(0,Q.useEffect)(()=>{u>=f.length&&d(Math.max(0,f.length-1))},[f.length,u]);let x=(0,Q.useRef)(u);(0,Q.useEffect)(()=>{x.current!==u&&(l(0),x.current=u)},[u]),s(`diff-dialog`),ee({"diff:previousSource":()=>{i===`detail`?a(`list`):i===`list`&&f.length>1&&d(e=>Math.max(0,e-1))},"diff:nextSource":()=>{i===`list`&&f.length>1&&d(e=>Math.min(f.length-1,e+1))},"diff:back":()=>{i===`detail`&&a(`list`)},"diff:viewDetails":()=>{i===`list`&&y&&a(`detail`)},"diff:previousFile":()=>{i===`list`&&l(e=>Math.max(0,e-1))},"diff:nextFile":()=>{i===`list`&&l(e=>Math.min(v.files.length-1,e+1))}},{context:`DiffDialog`});let S=v.stats?(0,$.jsxs)(m,{dimColor:!0,children:[v.stats.filesCount,` `,A(v.stats.filesCount,`file`),` changed`,v.stats.linesAdded>0&&(0,$.jsxs)(m,{color:`diffAddedWord`,children:[` +`,v.stats.linesAdded]}),v.stats.linesRemoved>0&&(0,$.jsxs)(m,{color:`diffRemovedWord`,children:[` -`,v.stats.linesRemoved]})]}):null,C=_?`Turn ${_.turnIndex}`:`Uncommitted changes`,w=_?_.userPromptPreview?`"${_.userPromptPreview}"`:``:`(git diff HEAD)`,T=f.length>1?(0,$.jsxs)(p,{children:[u>0&&(0,$.jsx)(m,{dimColor:!0,children:`◀ `}),f.map((e,t)=>{let n=t===u,r=e.type===`current`?`Current`:`T${e.turn.turnIndex}`;return(0,$.jsxs)(m,{dimColor:!n,bold:n,children:[t>0?` · `:``,r]},t)}),u<f.length-1&&(0,$.jsx)(m,{dimColor:!0,children:` ▶`})]}):null,E=o(`diff:dismiss`,`DiffDialog`,`esc`),D=v.loading?`Loading diff…`:_?`No file changes in this turn`:v.stats&&v.stats.filesCount>0&&v.files.length===0?`Too many files to display details`:`Working tree is clean`,O=(0,$.jsxs)(m,{children:[C,w&&(0,$.jsxs)(m,{dimColor:!0,children:[` `,w]})]});function k(){i===`detail`?a(`list`):t(`Diff dialog dismissed`,{display:`system`})}return(0,$.jsxs)(te,{title:O,onCancel:k,color:`background`,inputGuide:e=>e.pending?(0,$.jsxs)(m,{children:[`Press `,e.keyName,` again to exit`]}):i===`list`?(0,$.jsxs)(h,{children:[f.length>1&&(0,$.jsx)(m,{children:`←/→ source`}),(0,$.jsx)(m,{children:`↑/↓ select`}),(0,$.jsx)(m,{children:`Enter view`}),(0,$.jsxs)(m,{children:[E,` close`]})]}):(0,$.jsxs)(h,{children:[(0,$.jsx)(m,{children:`← back`}),(0,$.jsxs)(m,{children:[E,` close`]})]}),children:[T,S,v.files.length===0?(0,$.jsx)(p,{marginTop:1,children:(0,$.jsx)(m,{dimColor:!0,children:D})}):i===`list`?(0,$.jsx)(p,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(be,{files:v.files,selectedIndex:c})}):(0,$.jsx)(p,{flexDirection:`column`,marginTop:1,children:(0,$.jsx)(ve,{filePath:y?.path||``,hunks:b,isLargeFile:y?.isLargeFile,isBinary:y?.isBinary,isTruncated:y?.isTruncated,isUntracked:y?.isUntracked})})]})}var Q,$;e((()=>{Q=t(g(),1),u(),W(),_e(),v(),l(),c(),j(),ye(),Ce(),$=y()}))();export{Te as DiffDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./Doctor-Yvrzcrvx.js";e();export{t as Doctor};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{$i as o,By as s,FT as c,H_ as l,Hw as u,IT as d,JC as f,Jl as p,Ky as m,LT as h,Qi as g,RT as _,U_ as v,Uw as y,Uy as b,Wy as x,XC as S,Xh as ee,Xl as te,YC as ne,Yl as re,ZC as ie,Zh as C,aT as w,cT as T,hC as ae,qC as oe}from"./loadAgentsDir-JrGMJN05.js";import{Gt as se,I as E,P as D,ai as ce,t as O,x as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as j,et as M}from"./state-BPFYBqm1.js";import{H as N,kn as P,wn as F,z as I}from"./settings-aUygByiZ.js";import{l as L,o as R}from"./stringUtils-BjnclTLB.js";import{Kn as z,Un as B,_ as V,u as H}from"./model-CmDF8O9G.js";import{n as U,t as W}from"./ValidationErrorsList-QZvtUrAy.js";import{f as G,g as le,h as ue,i as de,n as fe,o as pe,p as me,r as he}from"./pidLock-BR4hzYgp.js";import{n as ge,t as _e}from"./useExitOnCtrlCDWithKeybindings-qLfN0tc-.js";import{n as ve,t as ye}from"./McpParsingWarnings-BsCDFWci.js";import{n as be,t as xe}from"./PressEnterToContinue-Dwoh6CaW.js";import{n as Se,t as Ce}from"./useSettingsErrors-DdVTahNa.js";import{n as we,t as Te}from"./shadowedRuleDetection-CWCQ5dZ0.js";import{n as Ee,r as De,t as K}from"./statusNoticeHelpers-Dm1aiibR.js";import{join as q}from"path";function Oe(){if(!_())return null;let e=c();if(e.length===0)return null;let t=e.filter(e=>e.severity===`error`),n=e.filter(e=>e.severity===`warning`);return(0,J.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,J.jsx)(D,{bold:!0,color:t.length>0?`error`:`warning`,children:`Keybinding Configuration Issues`}),(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`Location: `}),(0,J.jsx)(D,{dimColor:!0,children:d()})]}),(0,J.jsxs)(E,{marginLeft:1,flexDirection:`column`,marginTop:1,children:[t.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`error`,children:`[Error]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`error-${t}`)),n.map((e,t)=>(0,J.jsxs)(E,{flexDirection:`column`,children:[(0,J.jsxs)(E,{children:[(0,J.jsx)(D,{dimColor:!0,children:`└ `}),(0,J.jsx)(D,{color:`warning`,children:`[Warning]`}),(0,J.jsxs)(D,{dimColor:!0,children:[` `,e.message]})]}),e.suggestion&&(0,J.jsx)(E,{marginLeft:3,children:(0,J.jsxs)(D,{dimColor:!0,children:[`→ `,e.suggestion]})})]},`warning-${t}`))]})]})}var J,ke=e((()=>{O(),h(),J=A()}));function Ae(){if(!w.isSupportedPlatform()||!w.isSandboxEnabledInSettings())return null;let e=w.checkDependencies(),t=e.errors.length>0,n=e.warnings.length>0;return!t&&!n?null:(0,Y.jsxs)(E,{flexDirection:`column`,children:[(0,Y.jsx)(D,{bold:!0,children:`Sandbox`}),(0,Y.jsxs)(D,{children:[`└ Status: `,(0,Y.jsx)(D,{color:t?`error`:`warning`,children:t?`Missing dependencies`:`Available (with warnings)`})]}),e.errors.map((e,t)=>(0,Y.jsxs)(D,{color:`error`,children:[`└ `,e]},t)),e.warnings.map((e,t)=>(0,Y.jsxs)(D,{color:`warning`,children:[`└ `,e]},t)),t&&(0,Y.jsx)(D,{dimColor:!0,children:`└ Run /sandbox for install instructions`})]})}var Y,je=e((()=>{O(),T(),Y=A()}));async function Me(){let e=b(await x());if(e.length===0)return null;let t=e.sort((e,t)=>t.content.length-e.content.length).map(e=>`${e.path}: ${e.content.length.toLocaleString()} chars`);return{type:`agentsmd_files`,severity:`warning`,message:e.length===1?`Large AGENTS.md file detected (${e[0].content.length.toLocaleString()} chars > ${s.toLocaleString()})`:`${e.length} large AGENTS.md files detected (each > ${s.toLocaleString()} chars)`,details:t,currentValue:e.length,threshold:s}}async function Ne(e){if(!e)return null;let t=Ee(e);if(t<=15e3)return null;let n=e.activeAgents.filter(e=>e.source!==`built-in`).map(e=>{let t=`${e.agentType}: ${e.whenToUse}`;return{name:e.agentType,tokens:o(t)}}).sort((e,t)=>t.tokens-e.tokens),r=n.slice(0,5).map(e=>`${e.name}: ~${e.tokens.toLocaleString()} tokens`);return n.length>5&&r.push(`(${n.length-5} more custom agents)`),{type:`agent_descriptions`,severity:`warning`,message:`Large agent descriptions (~${t.toLocaleString()} tokens > ${K.toLocaleString()})`,details:r,currentValue:t,threshold:K}}async function X(e,t,n){let r=e.filter(e=>e.isMcp);if(r.length===0)return null;try{let{mcpToolTokens:r,mcpToolDetails:i}=await l(e,t,n,H());if(r<=Z)return null;let a=new Map;for(let e of i){let t=e.name.split(`__`)[1]||`unknown`,n=a.get(t)||{count:0,tokens:0};a.set(t,{count:n.count+1,tokens:n.tokens+e.tokens})}let o=Array.from(a.entries()).sort((e,t)=>t[1].tokens-e[1].tokens),s=o.slice(0,5).map(([e,t])=>`${e}: ${t.count} tools (~${t.tokens.toLocaleString()} tokens)`);return o.length>5&&s.push(`(${o.length-5} more servers)`),{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${r.toLocaleString()} tokens > ${Z.toLocaleString()})`,details:s,currentValue:r,threshold:Z}}catch{let e=r.reduce((e,t)=>e+o(((t.name?.length||0)+t.description.length).toString()),0);return e<=Z?null:{type:`mcp_tools`,severity:`warning`,message:`Large MCP tools context (~${e.toLocaleString()} tokens estimated > ${Z.toLocaleString()})`,details:[`${r.length} MCP tools detected (token count estimated)`],currentValue:e,threshold:Z}}}async function Pe(e){let t=Te(await e(),{sandboxAutoAllowEnabled:w.isSandboxingEnabled()&&w.isAutoAllowBashIfSandboxedEnabled()});if(t.length===0)return null;let n=t.flatMap(e=>[`${N(e.rule.ruleValue)}: ${e.reason}`,` Fix: ${e.fix}`]);return{type:`unreachable_rules`,severity:`warning`,message:`${t.length} ${L(t.length,`unreachable permission rule`)} detected`,details:n,currentValue:t.length,threshold:0}}async function Fe(e,t,n){let[r,i,a,o]=await Promise.all([Me(),Ne(t),X(e,n,t),Pe(n)]);return{agentsMdWarning:r,agentWarning:i,mcpWarning:a,unreachableRulesWarning:o}}var Z,Ie=e((()=>{g(),v(),m(),V(),I(),we(),T(),De(),R(),Z=25e3}));function Le({onDone:e}){let t=C(e=>e.agentDefinitions),r=C(e=>e.mcp.tools),i=C(e=>e.toolPermissionContext),o=C(e=>e.plugins.errors);ge();let s=(0,Q.useMemo)(()=>r||[],[r]),[c,l]=(0,Q.useState)(null),[d,m]=(0,Q.useState)(null),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),y=Se().filter(e=>e.mcpErrorMetadata===void 0),b=(0,Q.useMemo)(()=>[{name:`BASH_MAX_OUTPUT_LENGTH`,default:oe,upperLimit:f},{name:`TASK_MAX_OUTPUT_LENGTH`,default:p,upperLimit:re},{name:`CLAUDE_CODE_MAX_OUTPUT_TOKENS`,...B(`claude-opus-4-7`)}].map(e=>{let t=process.env[e.name],n=ie(e.name,t,e.default,e.upperLimit);return{name:e.name,...n}}).filter(e=>e.status!==`valid`),[]);(0,Q.useEffect)(()=>{ue().then(l),(async()=>{let e=q(n(),`agents`),r=q(M(),`.workmate`,`agents`),{activeAgents:a,allAgents:o,failedFiles:c}=t,[l,u]=await Promise.all([P(e),P(r)]),d={activeAgents:a.map(e=>({agentType:e.agentType,source:e.source})),userAgentsDir:e,projectAgentsDir:r,userDirExists:l,projectDirExists:u,failedFiles:c};m(d);let f=await Fe(s,{activeAgents:a,allAgents:o,failedFiles:c},async()=>i);if(g(f),pe()){let e=q(G(),`claude`,`locks`),t=fe(e),n=he(e);v({enabled:!0,locks:n,locksDir:e,staleLocksCleaned:t})}else v({enabled:!1,locks:[],locksDir:``,staleLocksCleaned:0})})()},[i,s,t]);let x=(0,Q.useCallback)(()=>{e(`Claude Code diagnostics dismissed`,{display:`system`})},[e]);return se({"confirm:yes":x,"confirm:no":x},{context:`Confirmation`}),c?(0,$.jsxs)(k,{children:[(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Diagnostics`}),(0,$.jsxs)(D,{children:[`└ Currently running: `,c.installationType,` (`,c.version,`)`]}),c.packageManager&&(0,$.jsxs)(D,{children:[`└ Package manager: `,c.packageManager]}),(0,$.jsxs)(D,{children:[`└ Path: `,c.installationPath]}),(0,$.jsxs)(D,{children:[`└ Invoked: `,c.invokedBinary]}),(0,$.jsxs)(D,{children:[`└ Config install method: `,c.configInstallMethod]}),(0,$.jsxs)(D,{children:[`└ Search: `,c.ripgrepStatus.working?`OK`:`Not working`,` (`,c.ripgrepStatus.mode===`embedded`?`bundled`:c.ripgrepStatus.mode===`builtin`?`vendor`:c.ripgrepStatus.systemPath||`system`,`)`]}),c.ripgrepStatus.note&&(0,$.jsxs)(D,{color:`warning`,children:[`└ Note: `,c.ripgrepStatus.note]}),c.recommendation&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsxs)(D,{color:`warning`,children:[`Recommendation: `,c.recommendation.split(`
|
|
2
|
+
`)[0]]}),(0,$.jsx)(D,{dimColor:!0,children:c.recommendation.split(`
|
|
3
|
+
`)[1]})]}),c.multipleInstallations.length>1&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),(0,$.jsx)(D,{color:`warning`,children:`Warning: Multiple installations found`}),c.multipleInstallations.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.type,` at `,e.path]},t))]}),c.warnings.length>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(D,{}),c.warnings.map((e,t)=>(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsxs)(D,{color:`warning`,children:[`Warning: `,e.issue]}),(0,$.jsxs)(D,{children:[`Fix: `,e.fix]})]},t))]}),y.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,$.jsx)(D,{bold:!0,children:`Invalid Settings`}),(0,$.jsx)(W,{errors:y})]})]}),(0,$.jsx)(Ae,{}),(0,$.jsx)(ye,{}),(0,$.jsx)(Oe,{}),b.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Environment Variables`}),b.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.name,`:`,` `,(0,$.jsx)(D,{color:e.status===`capped`?`warning`:`error`,children:e.message})]},t))]}),_?.enabled&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Version Locks`}),_.staleLocksCleaned>0&&(0,$.jsxs)(D,{dimColor:!0,children:[`└ Cleaned `,_.staleLocksCleaned,` stale lock(s)`]}),_.locks.length===0?(0,$.jsx)(D,{dimColor:!0,children:`└ No active version locks`}):_.locks.map((e,t)=>(0,$.jsxs)(D,{children:[`└ `,e.version,`: PID `,e.pid,` `,e.isProcessRunning?(0,$.jsx)(D,{children:`(running)`}):(0,$.jsx)(D,{color:`warning`,children:`(stale)`})]},t))]}),d?.failedFiles&&d.failedFiles.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Agent Parse Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ Failed to parse `,d.failedFiles.length,` agent file(s):`]}),d.failedFiles.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.path,`: `,e.error]},t))]}),o.length>0&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`error`,children:`Plugin Errors`}),(0,$.jsxs)(D,{color:`error`,children:[`└ `,o.length,` plugin error(s) detected:`]}),o.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e.source||`unknown`,`plugin`in e&&e.plugin?` [${e.plugin}]`:``,`: `,u(e)]},t))]}),h?.unreachableRulesWarning&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,color:`warning`,children:`Unreachable Permission Rules`}),(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.unreachableRulesWarning.message]})]}),h.unreachableRulesWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h&&(h.agentsMdWarning||h.agentWarning||h.mcpWarning)&&(0,$.jsxs)(E,{flexDirection:`column`,children:[(0,$.jsx)(D,{bold:!0,children:`Context Usage Warnings`}),h.agentsMdWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentsMdWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Files:`]}),h.agentsMdWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.agentWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.agentWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ Top contributors:`]}),h.agentWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]}),h.mcpWarning&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(D,{children:[`└`,` `,(0,$.jsxs)(D,{color:`warning`,children:[a.warning,` `,h.mcpWarning.message]})]}),(0,$.jsxs)(D,{children:[` `,`└ MCP servers:`]}),h.mcpWarning.details.map((e,t)=>(0,$.jsxs)(D,{dimColor:!0,children:[` `,`└ `,e]},t))]})]}),(0,$.jsx)(E,{children:(0,$.jsx)(xe,{})})]}):(0,$.jsx)(k,{children:(0,$.jsx)(D,{dimColor:!0,children:`Checking installation status…`})})}var Q,$,Re=e((()=>{i(),Q=t(ce(),1),ke(),ve(),z(),r(),j(),O(),be(),je(),U(),Ce(),_e(),ae(),ee(),y(),Ie(),le(),S(),F(),de(),ne(),te(),me(),$=A()}));export{Re as n,Le as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as e,n as t,o as n}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as r,$u as i,FC as a,Mu as o,PC as s,Pu as c,Qu as l,St as u,Tt as d,Zd as f,bT as p,br as m,ft as h,mi as g,nE as _,tE as v,wt as y,yT as b,yt as x}from"./loadAgentsDir-JrGMJN05.js";import{I as S,P as C,ai as w,t as T,y as E}from"./src-DL3w8VPk2.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{c as O,i as k}from"./debug-BQj6h99Q.js";import{r as A,t as j}from"./execFileNoThrow-DYm1GeGn.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";function P(){(m(),e(g)).saveWorktreeState(null)}function F({onDone:e,onCancel:t}){let[n,r]=(0,I.useState)(`loading`),[i,s]=(0,I.useState)([]),[c,u]=(0,I.useState)(0),[f,p]=(0,I.useState)(),m=x();if((0,I.useEffect)(()=>{async function e(){let e=[],t=await j(`git`,[`status`,`--porcelain`]);if(t.stdout&&(e=t.stdout.split(`
|
|
2
|
+
`).filter(e=>e.trim()!==``),s(e)),m){let{stdout:t}=await j(`git`,[`rev-list`,`--count`,`${m.originalHeadCommit}..HEAD`]),n=parseInt(t.trim(),10)||0;if(u(n),e.length===0&&n===0){r(`removing`),h().then(()=>{process.chdir(m.originalCwd),a(m.originalCwd),P(),v.cache.clear?.(),p(`Worktree removed (no changes)`)}).catch(e=>{O(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`)}).then(()=>{r(`done`)});return}else r(`asking`)}}e()},[m]),(0,I.useEffect)(()=>{n===`done`&&e(f)},[n,e,f]),!m)return e(`No active worktree session found`,{display:`system`}),null;if(n===`loading`||n===`done`)return null;async function g(e){if(!m)return;let t=!!m.tmuxSessionName;if(e===`keep`||e===`keep-with-tmux`)r(`keeping`),N(`tengu_worktree_kept`,{commits:c,changed_files:i.length}),await y(),process.chdir(m.originalCwd),a(m.originalCwd),P(),v.cache.clear?.(),p(t?`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}. Reattach to tmux session with: tmux attach -t ${m.tmuxSessionName}`:`Worktree kept. Your work is saved at ${m.worktreePath} on branch ${m.worktreeBranch}`),r(`done`);else if(e===`keep-kill-tmux`)r(`keeping`),N(`tengu_worktree_kept`,{commits:c,changed_files:i.length}),m.tmuxSessionName&&await d(m.tmuxSessionName),await y(),process.chdir(m.originalCwd),a(m.originalCwd),P(),v.cache.clear?.(),p(`Worktree kept at ${m.worktreePath} on branch ${m.worktreeBranch}. Tmux session terminated.`),r(`done`);else if(e===`remove`||e===`remove-with-tmux`){r(`removing`),N(`tengu_worktree_removed`,{commits:c,changed_files:i.length}),m.tmuxSessionName&&await d(m.tmuxSessionName);try{await h(),process.chdir(m.originalCwd),a(m.originalCwd),P(),v.cache.clear?.()}catch(e){O(`Failed to clean up worktree: ${e}`,{level:`error`}),p(`Worktree cleanup failed, exiting anyway`),r(`done`);return}let e=t?` Tmux session terminated.`:``;c>0&&i.length>0?p(`Worktree removed. ${c} ${c===1?`commit`:`commits`} and uncommitted changes were discarded.${e}`):c>0?p(`Worktree removed. ${c} ${c===1?`commit`:`commits`} on ${m.worktreeBranch} ${c===1?`was`:`were`} discarded.${e}`):i.length>0?p(`Worktree removed. Uncommitted changes were discarded.${e}`):p(`Worktree removed.${e}`),r(`done`)}}if(n===`keeping`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(o,{}),(0,L.jsx)(C,{children:`Keeping worktree…`})]});if(n===`removing`)return(0,L.jsxs)(S,{flexDirection:`row`,marginY:1,children:[(0,L.jsx)(o,{}),(0,L.jsx)(C,{children:`Removing worktree…`})]});let _=m.worktreeBranch,b=i.length>0,w=c>0,T=``;T=b&&w?`You have ${i.length} uncommitted ${i.length===1?`file`:`files`} and ${c} ${c===1?`commit`:`commits`} on ${_}. All will be lost if you remove.`:b?`You have ${i.length} uncommitted ${i.length===1?`file`:`files`}. These will be lost if you remove the worktree.`:w?`You have ${c} ${c===1?`commit`:`commits`} on ${_}. The branch will be deleted if you remove the worktree.`:`You are working in a worktree. Keep it to continue working there, or remove it to clean up.`;function D(){if(t){t();return}g(`keep`)}let k=b||w?`All changes and commits will be lost.`:`Clean up the worktree directory.`,A=!!m.tmuxSessionName,M=A?[{label:`Keep worktree and tmux session`,value:`keep-with-tmux`,description:`Stays at ${m.worktreePath}. Reattach with: tmux attach -t ${m.tmuxSessionName}`},{label:`Keep worktree, kill tmux session`,value:`keep-kill-tmux`,description:`Keeps worktree at ${m.worktreePath}, terminates tmux session.`},{label:`Remove worktree and tmux session`,value:`remove-with-tmux`,description:k}]:[{label:`Keep worktree`,value:`keep`,description:`Stays at ${m.worktreePath}`},{label:`Remove worktree`,value:`remove`,description:k}];return(0,L.jsx)(E,{title:`Exiting worktree session`,subtitle:T,onCancel:D,children:(0,L.jsx)(l,{defaultFocusValue:A?`keep-with-tmux`:`keep`,options:M,onChange:g})})}var I,L,R=t((()=>{I=n(w(),1),M(),k(),T(),A(),_(),s(),u(),i(),c(),L=D()}));function z(){return p(H)??`Goodbye!`}function B({showWorktree:e,onDone:t,onCancel:n}){async function r(e){t(e??z()),await f(0,`prompt_input_exit`)}return e?(0,V.jsx)(F,{onDone:r,onCancel:n}):null}var V,H,U=t((()=>{b(),r(),R(),V=D(),H=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}));export{U as n,B as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Qu as t,Zu as n}from"./loadAgentsDir-JrGMJN05.js";import{D as r,I as i,Lt as a,P as o,T as s,ai as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{n as f,r as p}from"./analytics-DJobLaWP.js";import{i as m,o as h,r as g,s as _,t as v}from"./grove-DsAIY-rZ.js";var y=e(c(),1);f(),l(),n();var b=d(),x=` _____________
|
|
2
2
|
| \\ \\
|
|
3
3
|
| NEW TERMS \\__\\
|
|
4
4
|
| |
|
|
@@ -1,4 +1,2 @@
|
|
|
1
|
-
import{l as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{
|
|
2
|
-
`,A=1e3,j=1e3,M=3e4,N=6e5,P=1e4,F=12e4,I=M*2,L=new Set([1002,4001,4003]),R=class{constructor(e,t={},n,i,a){r(this,`ws`,null),r(this,`lastSentId`,null),r(this,`url`,void 0),r(this,`state`,`idle`),r(this,`onData`,void 0),r(this,`onCloseCallback`,void 0),r(this,`onConnectCallback`,void 0),r(this,`headers`,void 0),r(this,`sessionId`,void 0),r(this,`autoReconnect`,void 0),r(this,`isBridge`,void 0),r(this,`reconnectAttempts`,0),r(this,`reconnectStartTime`,null),r(this,`reconnectTimer`,null),r(this,`lastReconnectAttemptTime`,null),r(this,`lastActivityTime`,0),r(this,`pingInterval`,null),r(this,`pongReceived`,!0),r(this,`keepAliveInterval`,null),r(this,`messageBuffer`,void 0),r(this,`isBunWs`,!1),r(this,`connectStartTime`,0),r(this,`refreshHeaders`,void 0),r(this,`onBunOpen`,()=>{this.handleOpenEvent(),this.lastSentId&&this.replayBufferedMessages(``)}),r(this,`onBunMessage`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onBunError`,()=>{l(`WebSocketTransport: Error`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onBunClose`,e=>{let t=e.code===1e3||e.code===1001;l(`WebSocketTransport: Closed: ${e.code}`,t?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e.code)}),r(this,`onNodeOpen`,()=>{let e=this.ws;if(this.handleOpenEvent(),!e)return;let t=e.upgradeReq;if(t?.headers?.[`x-last-request-id`]){let e=t.headers[`x-last-request-id`];this.replayBufferedMessages(e)}}),r(this,`onNodeMessage`,e=>{let t=e.toString();this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onNodeError`,e=>{l(`WebSocketTransport: Error: ${e.message}`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onNodeClose`,(e,t)=>{let n=e===1e3||e===1001;l(`WebSocketTransport: Closed: ${e}`,n?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e)}),r(this,`onPong`,()=>{this.pongReceived=!0}),this.url=e,this.headers=t,this.sessionId=n,this.refreshHeaders=i,this.autoReconnect=a?.autoReconnect??!0,this.isBridge=a?.isBridge??!1,this.messageBuffer=new o(A)}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_websocket_connect_failed`);return}this.state=`reconnecting`,this.connectStartTime=Date.now(),l(`WebSocketTransport: Opening ${this.url.href}`),p(`info`,`cli_websocket_connect_opening`);let e={...this.headers};if(this.lastSentId&&(e[`X-Last-Request-Id`]=this.lastSentId,l(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`)),typeof Bun<`u`){let t=new globalThis.WebSocket(this.url.href,{headers:e,proxy:g(this.url.href),tls:y()||void 0});this.ws=t,this.isBunWs=!0,t.addEventListener(`open`,this.onBunOpen),t.addEventListener(`message`,this.onBunMessage),t.addEventListener(`error`,this.onBunError),t.addEventListener(`close`,this.onBunClose),t.addEventListener(`pong`,this.onPong)}else{let{default:t}=await import(`./wrapper-K8ZapJVu.js`),n=new t(this.url.href,{headers:e,agent:b(this.url.href),...y()});this.ws=n,this.isBunWs=!1,n.on(`open`,this.onNodeOpen),n.on(`message`,this.onNodeMessage),n.on(`error`,this.onNodeError),n.on(`close`,this.onNodeClose),n.on(`pong`,this.onPong)}}handleOpenEvent(){let e=Date.now()-this.connectStartTime;l(`WebSocketTransport: Connected`),p(`info`,`cli_websocket_connect_connected`,{duration_ms:e}),this.isBridge&&this.reconnectStartTime!==null&&h(`tengu_ws_transport_reconnected`,{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime}),this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state=`connected`,this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),S(()=>{this.write({type:`keep_alive`})})}sendLine(e){if(!this.ws||this.state!==`connected`)return l(`WebSocketTransport: Not connected`),p(`info`,`cli_websocket_send_not_connected`),!1;try{return this.ws.send(e),this.lastActivityTime=Date.now(),!0}catch(e){return l(`WebSocketTransport: Failed to send: ${e}`,{level:`error`}),p(`error`,`cli_websocket_send_error`),this.handleConnectionError(),!1}}removeWsListeners(e){if(this.isBunWs){let t=e;t.removeEventListener(`open`,this.onBunOpen),t.removeEventListener(`message`,this.onBunMessage),t.removeEventListener(`error`,this.onBunError),t.removeEventListener(`close`,this.onBunClose),t.removeEventListener(`pong`,this.onPong)}else{let t=e;t.off(`open`,this.onNodeOpen),t.off(`message`,this.onNodeMessage),t.off(`error`,this.onNodeError),t.off(`close`,this.onNodeClose),t.off(`pong`,this.onPong)}}doDisconnect(){this.stopPingInterval(),this.stopKeepaliveInterval(),C(),this.ws&&(this.removeWsListeners(this.ws),this.ws.close(),this.ws=null)}handleConnectionError(e){if(E(`WS handleConnectionError: code=${e} state=${this.state} url=${this.url.href.replace(/token=[^&]+/,`token=***`)} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1} reconnectAttempts=${this.reconnectAttempts}`),l(`WebSocketTransport: Disconnected from ${this.url.href}`+(e==null?``:` (code ${e})`)),p(`info`,`cli_websocket_disconnected`),this.isBridge&&h(`tengu_ws_transport_closed`,{closeCode:e,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state===`connected`,reconnectAttempts:this.reconnectAttempts}),this.doDisconnect(),this.state===`closing`||this.state===`closed`)return;let t=!1;if(e===4003&&this.refreshHeaders){let e=this.refreshHeaders();e.Authorization!==this.headers.Authorization&&(Object.assign(this.headers,e),t=!0,l(`WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect`),p(`info`,`cli_websocket_4003_token_refreshed`))}if(e!=null&&L.has(e)&&!t){l(`WebSocketTransport: Permanent close code ${e}, not reconnecting`,{level:`error`}),p(`error`,`cli_websocket_permanent_close`,{closeCode:e}),this.state=`closed`,this.onCloseCallback?.(e);return}if(!this.autoReconnect){this.state=`closed`,this.onCloseCallback?.(e);return}let n=Date.now();this.reconnectStartTime||(this.reconnectStartTime=n),this.lastReconnectAttemptTime!==null&&n-this.lastReconnectAttemptTime>I&&(l(`WebSocketTransport: Detected system sleep (${Math.round((n-this.lastReconnectAttemptTime)/1e3)}s gap), resetting reconnection budget`),p(`info`,`cli_websocket_sleep_detected`,{gapMs:n-this.lastReconnectAttemptTime}),this.reconnectStartTime=n,this.reconnectAttempts=0),this.lastReconnectAttemptTime=n;let r=n-this.reconnectStartTime;if(r<N){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!t&&this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`WebSocketTransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(j*2**(this.reconnectAttempts-1),M),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`WebSocketTransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(r/1e3)}s elapsed)`),p(`error`,`cli_websocket_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.isBridge&&h(`tengu_ws_transport_reconnecting`,{attempt:this.reconnectAttempts,elapsedMs:r,delayMs:Math.round(n)}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(r/1e3)}s for ${this.url.href}`,{level:`error`}),p(`error`,`cli_websocket_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:r}),this.state=`closed`,this.onCloseCallback&&this.onCloseCallback(e)}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopPingInterval(),this.stopKeepaliveInterval(),C(),this.state=`closing`,this.doDisconnect()}replayBufferedMessages(e){let t=this.messageBuffer.toArray();if(t.length===0)return;let n=0;if(e){let r=t.findIndex(t=>`uuid`in t&&t.uuid===e);if(r>=0){n=r+1;let e=t.slice(n);this.messageBuffer.clear(),this.messageBuffer.addAll(e),e.length===0&&(this.lastSentId=null),l(`WebSocketTransport: Evicted ${n} confirmed messages, ${e.length} remaining`),p(`info`,`cli_websocket_evicted_confirmed_messages`,{evicted:n,remaining:e.length})}}let r=t.slice(n);if(r.length===0){l(`WebSocketTransport: No new messages to replay`),p(`info`,`cli_websocket_no_messages_to_replay`);return}l(`WebSocketTransport: Replaying ${r.length} buffered messages`),p(`info`,`cli_websocket_messages_to_replay`,{count:r.length});for(let e of r){let t=c(e)+`
|
|
3
|
-
`;if(!this.sendLine(t)){this.handleConnectionError();break}}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnConnect(e){this.onConnectCallback=e}setOnClose(e){this.onCloseCallback=e}getStateLabel(){return this.state}async write(e){`uuid`in e&&typeof e.uuid==`string`&&(this.messageBuffer.add(e),this.lastSentId=e.uuid);let t=c(e)+`
|
|
4
|
-
`;if(this.state!==`connected`)return;let n=this.sessionId?` session=${this.sessionId}`:``,r=this.getControlMessageDetailLabel(e);l(`WebSocketTransport: Sending message type=${e.type}${n}${r}`),this.sendLine(t)}getControlMessageDetailLabel(e){if(e.type===`control_request`){let{request_id:t,request:n}=e,r=n.subtype===`can_use_tool`?n.tool_name:``;return` subtype=${n.subtype} request_id=${t}${r?` tool=${r}`:``}`}if(e.type===`control_response`){let{subtype:t,request_id:n}=e.response;return` subtype=${t} request_id=${n}`}return``}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let e=Date.now();this.pingInterval=setInterval(()=>{if(this.state===`connected`&&this.ws){let t=Date.now(),n=t-e;if(e=t,n>I){l(`WebSocketTransport: ${Math.round(n/1e3)}s tick gap detected — process was suspended, forcing reconnect`),p(`info`,`cli_websocket_sleep_detected_on_ping`,{gapMs:n}),this.handleConnectionError();return}if(!this.pongReceived){l(`WebSocketTransport: No pong received, connection appears dead`,{level:`error`}),p(`error`,`cli_websocket_pong_timeout`),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(e){l(`WebSocketTransport: Ping failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_ping_failed`)}}},P)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}startKeepaliveInterval(){this.stopKeepaliveInterval(),!e(process.env.CLAUDE_CODE_REMOTE)&&(this.keepAliveInterval=setInterval(()=>{if(this.state===`connected`&&this.ws)try{this.ws.send(k),this.lastActivityTime=Date.now(),l(`WebSocketTransport: Sent periodic keep_alive data frame`)}catch(e){l(`WebSocketTransport: Periodic keep_alive failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_keepalive_failed`)}},F))}stopKeepaliveInterval(){this.keepAliveInterval&&(clearInterval(this.keepAliveInterval),this.keepAliveInterval=null)}};u(),D(),f(),n();var z=100,B=15e3,V=3e3,H=class extends R{constructor(e,t={},n,i,a){super(e,t,n,i,a),r(this,`postUrl`,void 0),r(this,`uploader`,void 0),r(this,`streamEventBuffer`,[]),r(this,`streamEventTimer`,null);let{maxConsecutiveFailures:o,onBatchDropped:s}=a??{};this.postUrl=U(e),this.uploader=new O({maxBatchSize:500,maxQueueSize:1e4,baseDelayMs:500,maxDelayMs:8e3,jitterMs:1e3,maxConsecutiveFailures:o,onBatchDropped:(e,t)=>{p(`error`,`cli_hybrid_batch_dropped_max_failures`,{batchSize:e,failures:t}),s?.(e,t)},send:e=>this.postOnce(e)}),l(`HybridTransport: POST URL = ${this.postUrl}`),p(`info`,`cli_hybrid_transport_initialized`)}async write(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),z));return}return await this.uploader.enqueue([...this.takeStreamEvents(),e]),this.uploader.flush()}async writeBatch(e){return await this.uploader.enqueue([...this.takeStreamEvents(),...e]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null);let e=this.streamEventBuffer;return this.streamEventBuffer=[],e}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[];let e=this.uploader,t;Promise.race([e.flush(),new Promise(e=>{t=setTimeout(e,V)})]).finally(()=>{clearTimeout(t),e.close()}),super.close()}async postOnce(e){let t=w();if(!t){l(`HybridTransport: No session token available for POST`),p(`warn`,`cli_hybrid_post_no_token`);return}let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`},r;try{r=await i.post(this.postUrl,{events:e},{headers:n,validateStatus:()=>!0,timeout:B})}catch(e){throw l(`HybridTransport: POST error: ${e.message}`),p(`warn`,`cli_hybrid_post_network_error`),e}if(r.status>=200&&r.status<300){l(`HybridTransport: POST success count=${e.length}`);return}if(r.status>=400&&r.status<500&&r.status!==429){E(`Hybrid POST ${r.status}: url=${this.postUrl.replace(/token=[^&]+/,`token=***`)} events=${e.length} body=${JSON.stringify(r.data).slice(0,200)}`),l(`HybridTransport: POST returned ${r.status} (permanent), dropping`),p(`warn`,`cli_hybrid_post_client_error`,{status:r.status});return}throw l(`HybridTransport: POST returned ${r.status} (retryable)`),p(`warn`,`cli_hybrid_post_retryable_error`,{status:r.status}),Error(`POST failed with ${r.status}`)}};function U(e){let t=e.protocol===`wss:`?`https:`:`http:`,n=e.pathname;return n=n.replace(`/ws/`,`/session/`),n.endsWith(`/events`)||(n=n.endsWith(`/`)?n+`events`:n+`/events`),`${t}//${e.host}${n}${e.search}`}export{R as n,H as t};
|
|
1
|
+
import{l as e,o as t}from"./envUtils-DcaKZlRU.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{$C as o,QC as s}from"./loadAgentsDir-JrGMJN05.js";import{C as c,c as l,i as u,x as d}from"./debug-BQj6h99Q.js";import{O as f,k as p}from"./git-DplvjXEY.js";import{n as m,r as h}from"./analytics-DJobLaWP.js";import{c as g,h as _,l as v,m as y,s as b}from"./proxy-C0j74LqT.js";import{C as x,S,f as C,g as w,u as T}from"./sessionState-C2REgUrs.js";import{n as E,t as D}from"./rcDebugLog-DSchf3Hs.js";import{r as O}from"./ccrClient-wtUIz75R.js";a(),x(),m(),o(),u(),D(),f(),t(),_(),v(),T(),d(),n();var k=`{"type":"keep_alive"}
|
|
2
|
+
`,A=1e3,j=1e3,M=3e4,N=6e5,P=1e4,F=12e4,I=M*2,L=new Set([1002,4001,4003]),R=class{constructor(e,t={},n,i,a){r(this,`ws`,null),r(this,`lastSentId`,null),r(this,`url`,void 0),r(this,`state`,`idle`),r(this,`onData`,void 0),r(this,`onCloseCallback`,void 0),r(this,`onConnectCallback`,void 0),r(this,`headers`,void 0),r(this,`sessionId`,void 0),r(this,`autoReconnect`,void 0),r(this,`isBridge`,void 0),r(this,`reconnectAttempts`,0),r(this,`reconnectStartTime`,null),r(this,`reconnectTimer`,null),r(this,`lastReconnectAttemptTime`,null),r(this,`lastActivityTime`,0),r(this,`pingInterval`,null),r(this,`pongReceived`,!0),r(this,`keepAliveInterval`,null),r(this,`messageBuffer`,void 0),r(this,`isBunWs`,!1),r(this,`connectStartTime`,0),r(this,`refreshHeaders`,void 0),r(this,`onBunOpen`,()=>{this.handleOpenEvent(),this.lastSentId&&this.replayBufferedMessages(``)}),r(this,`onBunMessage`,e=>{let t=typeof e.data==`string`?e.data:String(e.data);this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onBunError`,()=>{l(`WebSocketTransport: Error`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onBunClose`,e=>{let t=e.code===1e3||e.code===1001;l(`WebSocketTransport: Closed: ${e.code}`,t?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e.code)}),r(this,`onNodeOpen`,()=>{let e=this.ws;if(this.handleOpenEvent(),!e)return;let t=e.upgradeReq;if(t?.headers?.[`x-last-request-id`]){let e=t.headers[`x-last-request-id`];this.replayBufferedMessages(e)}}),r(this,`onNodeMessage`,e=>{let t=e.toString();this.lastActivityTime=Date.now(),p(`info`,`cli_websocket_message_received`,{length:t.length}),this.onData&&this.onData(t)}),r(this,`onNodeError`,e=>{l(`WebSocketTransport: Error: ${e.message}`,{level:`error`}),p(`error`,`cli_websocket_connect_error`)}),r(this,`onNodeClose`,(e,t)=>{let n=e===1e3||e===1001;l(`WebSocketTransport: Closed: ${e}`,n?void 0:{level:`error`}),p(`error`,`cli_websocket_connect_closed`),this.handleConnectionError(e)}),r(this,`onPong`,()=>{this.pongReceived=!0}),this.url=e,this.headers=t,this.sessionId=n,this.refreshHeaders=i,this.autoReconnect=a?.autoReconnect??!0,this.isBridge=a?.isBridge??!1,this.messageBuffer=new s(A)}async connect(){if(this.state!==`idle`&&this.state!==`reconnecting`){l(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:`error`}),p(`error`,`cli_websocket_connect_failed`);return}this.state=`reconnecting`,this.connectStartTime=Date.now(),l(`WebSocketTransport: Opening ${this.url.href}`),p(`info`,`cli_websocket_connect_opening`);let e={...this.headers};if(this.lastSentId&&(e[`X-Last-Request-Id`]=this.lastSentId,l(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`)),typeof Bun<`u`){let t=new globalThis.WebSocket(this.url.href,{headers:e,proxy:g(this.url.href),tls:y()||void 0});this.ws=t,this.isBunWs=!0,t.addEventListener(`open`,this.onBunOpen),t.addEventListener(`message`,this.onBunMessage),t.addEventListener(`error`,this.onBunError),t.addEventListener(`close`,this.onBunClose),t.addEventListener(`pong`,this.onPong)}else{let{default:t}=await import(`./wrapper-K8ZapJVu.js`),n=new t(this.url.href,{headers:e,agent:b(this.url.href),...y()});this.ws=n,this.isBunWs=!1,n.on(`open`,this.onNodeOpen),n.on(`message`,this.onNodeMessage),n.on(`error`,this.onNodeError),n.on(`close`,this.onNodeClose),n.on(`pong`,this.onPong)}}handleOpenEvent(){let e=Date.now()-this.connectStartTime;l(`WebSocketTransport: Connected`),p(`info`,`cli_websocket_connect_connected`,{duration_ms:e}),this.isBridge&&this.reconnectStartTime!==null&&h(`tengu_ws_transport_reconnected`,{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime}),this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state=`connected`,this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),C(()=>{this.write({type:`keep_alive`})})}sendLine(e){if(!this.ws||this.state!==`connected`)return l(`WebSocketTransport: Not connected`),p(`info`,`cli_websocket_send_not_connected`),!1;try{return this.ws.send(e),this.lastActivityTime=Date.now(),!0}catch(e){return l(`WebSocketTransport: Failed to send: ${e}`,{level:`error`}),p(`error`,`cli_websocket_send_error`),this.handleConnectionError(),!1}}removeWsListeners(e){if(this.isBunWs){let t=e;t.removeEventListener(`open`,this.onBunOpen),t.removeEventListener(`message`,this.onBunMessage),t.removeEventListener(`error`,this.onBunError),t.removeEventListener(`close`,this.onBunClose),t.removeEventListener(`pong`,this.onPong)}else{let t=e;t.off(`open`,this.onNodeOpen),t.off(`message`,this.onNodeMessage),t.off(`error`,this.onNodeError),t.off(`close`,this.onNodeClose),t.off(`pong`,this.onPong)}}doDisconnect(){this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.ws&&(this.removeWsListeners(this.ws),this.ws.close(),this.ws=null)}handleConnectionError(e){if(E(`WS handleConnectionError: code=${e} state=${this.state} url=${this.url.href.replace(/token=[^&]+/,`token=***`)} msSinceLastActivity=${this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1} reconnectAttempts=${this.reconnectAttempts}`),l(`WebSocketTransport: Disconnected from ${this.url.href}`+(e==null?``:` (code ${e})`)),p(`info`,`cli_websocket_disconnected`),this.isBridge&&h(`tengu_ws_transport_closed`,{closeCode:e,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state===`connected`,reconnectAttempts:this.reconnectAttempts}),this.doDisconnect(),this.state===`closing`||this.state===`closed`)return;let t=!1;if(e===4003&&this.refreshHeaders){let e=this.refreshHeaders();e.Authorization!==this.headers.Authorization&&(Object.assign(this.headers,e),t=!0,l(`WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect`),p(`info`,`cli_websocket_4003_token_refreshed`))}if(e!=null&&L.has(e)&&!t){l(`WebSocketTransport: Permanent close code ${e}, not reconnecting`,{level:`error`}),p(`error`,`cli_websocket_permanent_close`,{closeCode:e}),this.state=`closed`,this.onCloseCallback?.(e);return}if(!this.autoReconnect){this.state=`closed`,this.onCloseCallback?.(e);return}let n=Date.now();this.reconnectStartTime||(this.reconnectStartTime=n),this.lastReconnectAttemptTime!==null&&n-this.lastReconnectAttemptTime>I&&(l(`WebSocketTransport: Detected system sleep (${Math.round((n-this.lastReconnectAttemptTime)/1e3)}s gap), resetting reconnection budget`),p(`info`,`cli_websocket_sleep_detected`,{gapMs:n-this.lastReconnectAttemptTime}),this.reconnectStartTime=n,this.reconnectAttempts=0),this.lastReconnectAttemptTime=n;let r=n-this.reconnectStartTime;if(r<N){if(this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),!t&&this.refreshHeaders){let e=this.refreshHeaders();Object.assign(this.headers,e),l(`WebSocketTransport: Refreshed headers for reconnect`)}this.state=`reconnecting`,this.reconnectAttempts++;let e=Math.min(j*2**(this.reconnectAttempts-1),M),n=Math.max(0,e+e*.25*(2*Math.random()-1));l(`WebSocketTransport: Reconnecting in ${Math.round(n)}ms (attempt ${this.reconnectAttempts}, ${Math.round(r/1e3)}s elapsed)`),p(`error`,`cli_websocket_reconnect_attempt`,{reconnectAttempts:this.reconnectAttempts}),this.isBridge&&h(`tengu_ws_transport_reconnecting`,{attempt:this.reconnectAttempts,elapsedMs:r,delayMs:Math.round(n)}),this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},n)}else l(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(r/1e3)}s for ${this.url.href}`,{level:`error`}),p(`error`,`cli_websocket_reconnect_exhausted`,{reconnectAttempts:this.reconnectAttempts,elapsedMs:r}),this.state=`closed`,this.onCloseCallback&&this.onCloseCallback(e)}close(){this.reconnectTimer&&(clearTimeout(this.reconnectTimer),this.reconnectTimer=null),this.stopPingInterval(),this.stopKeepaliveInterval(),w(),this.state=`closing`,this.doDisconnect()}replayBufferedMessages(e){let t=this.messageBuffer.toArray();if(t.length===0)return;let n=0;if(e){let r=t.findIndex(t=>`uuid`in t&&t.uuid===e);if(r>=0){n=r+1;let e=t.slice(n);this.messageBuffer.clear(),this.messageBuffer.addAll(e),e.length===0&&(this.lastSentId=null),l(`WebSocketTransport: Evicted ${n} confirmed messages, ${e.length} remaining`),p(`info`,`cli_websocket_evicted_confirmed_messages`,{evicted:n,remaining:e.length})}}let r=t.slice(n);if(r.length===0){l(`WebSocketTransport: No new messages to replay`),p(`info`,`cli_websocket_no_messages_to_replay`);return}l(`WebSocketTransport: Replaying ${r.length} buffered messages`),p(`info`,`cli_websocket_messages_to_replay`,{count:r.length});for(let e of r){let t=`${c(e)}\n`;if(!this.sendLine(t)){this.handleConnectionError();break}}}isConnectedStatus(){return this.state===`connected`}isClosedStatus(){return this.state===`closed`}setOnData(e){this.onData=e}setOnConnect(e){this.onConnectCallback=e}setOnClose(e){this.onCloseCallback=e}getStateLabel(){return this.state}async write(e){`uuid`in e&&typeof e.uuid==`string`&&(this.messageBuffer.add(e),this.lastSentId=e.uuid);let t=`${c(e)}\n`;if(this.state!==`connected`)return;let n=this.sessionId?` session=${this.sessionId}`:``,r=this.getControlMessageDetailLabel(e);l(`WebSocketTransport: Sending message type=${e.type}${n}${r}`),this.sendLine(t)}getControlMessageDetailLabel(e){if(e.type===`control_request`){let{request_id:t,request:n}=e,r=n.subtype===`can_use_tool`?n.tool_name:``;return` subtype=${n.subtype} request_id=${t}${r?` tool=${r}`:``}`}if(e.type===`control_response`){let{subtype:t,request_id:n}=e.response;return` subtype=${t} request_id=${n}`}return``}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let e=Date.now();this.pingInterval=setInterval(()=>{if(this.state===`connected`&&this.ws){let t=Date.now(),n=t-e;if(e=t,n>I){l(`WebSocketTransport: ${Math.round(n/1e3)}s tick gap detected — process was suspended, forcing reconnect`),p(`info`,`cli_websocket_sleep_detected_on_ping`,{gapMs:n}),this.handleConnectionError();return}if(!this.pongReceived){l(`WebSocketTransport: No pong received, connection appears dead`,{level:`error`}),p(`error`,`cli_websocket_pong_timeout`),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(e){l(`WebSocketTransport: Ping failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_ping_failed`)}}},P)}stopPingInterval(){this.pingInterval&&(clearInterval(this.pingInterval),this.pingInterval=null)}startKeepaliveInterval(){this.stopKeepaliveInterval(),!e(process.env.CLAUDE_CODE_REMOTE)&&(this.keepAliveInterval=setInterval(()=>{if(this.state===`connected`&&this.ws)try{this.ws.send(k),this.lastActivityTime=Date.now(),l(`WebSocketTransport: Sent periodic keep_alive data frame`)}catch(e){l(`WebSocketTransport: Periodic keep_alive failed: ${e}`,{level:`error`}),p(`error`,`cli_websocket_keepalive_failed`)}},F))}stopKeepaliveInterval(){this.keepAliveInterval&&(clearInterval(this.keepAliveInterval),this.keepAliveInterval=null)}};u(),D(),f(),n();var z=100,B=15e3,V=3e3,H=class extends R{constructor(e,t={},n,i,a){super(e,t,n,i,a),r(this,`postUrl`,void 0),r(this,`uploader`,void 0),r(this,`streamEventBuffer`,[]),r(this,`streamEventTimer`,null);let{maxConsecutiveFailures:o,onBatchDropped:s}=a??{};this.postUrl=U(e),this.uploader=new O({maxBatchSize:500,maxQueueSize:1e4,baseDelayMs:500,maxDelayMs:8e3,jitterMs:1e3,maxConsecutiveFailures:o,onBatchDropped:(e,t)=>{p(`error`,`cli_hybrid_batch_dropped_max_failures`,{batchSize:e,failures:t}),s?.(e,t)},send:e=>this.postOnce(e)}),l(`HybridTransport: POST URL = ${this.postUrl}`),p(`info`,`cli_hybrid_transport_initialized`)}async write(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),z));return}return await this.uploader.enqueue([...this.takeStreamEvents(),e]),this.uploader.flush()}async writeBatch(e){return await this.uploader.enqueue([...this.takeStreamEvents(),...e]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null);let e=this.streamEventBuffer;return this.streamEventBuffer=[],e}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[];let e=this.uploader,t;Promise.race([e.flush(),new Promise(e=>{t=setTimeout(e,V)})]).finally(()=>{clearTimeout(t),e.close()}),super.close()}async postOnce(e){let t=S();if(!t){l(`HybridTransport: No session token available for POST`),p(`warn`,`cli_hybrid_post_no_token`);return}let n={Authorization:`Bearer ${t}`,"Content-Type":`application/json`},r;try{r=await i.post(this.postUrl,{events:e},{headers:n,validateStatus:()=>!0,timeout:B})}catch(e){throw l(`HybridTransport: POST error: ${e.message}`),p(`warn`,`cli_hybrid_post_network_error`),e}if(r.status>=200&&r.status<300){l(`HybridTransport: POST success count=${e.length}`);return}if(r.status>=400&&r.status<500&&r.status!==429){E(`Hybrid POST ${r.status}: url=${this.postUrl.replace(/token=[^&]+/,`token=***`)} events=${e.length} body=${JSON.stringify(r.data).slice(0,200)}`),l(`HybridTransport: POST returned ${r.status} (permanent), dropping`),p(`warn`,`cli_hybrid_post_client_error`,{status:r.status});return}throw l(`HybridTransport: POST returned ${r.status} (retryable)`),p(`warn`,`cli_hybrid_post_retryable_error`,{status:r.status}),Error(`POST failed with ${r.status}`)}};function U(e){let t=e.protocol===`wss:`?`https:`:`http:`,n=e.pathname;return n=n.replace(`/ws/`,`/session/`),n.endsWith(`/events`)||(n=n.endsWith(`/`)?`${n}events`:`${n}/events`),`${t}//${e.host}${n}${e.search}`}export{R as n,H as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Ou as e,Qu as t,Xh as n,Yh as r,Zu as i,ku as a}from"./loadAgentsDir-JrGMJN05.js";import{I as o,P as s,kn as c,t as l,y as u}from"./src-DL3w8VPk2.js";import{t as d}from"./jsx-runtime-Bb4Xn-E0.js";import{C as f,T as p,x as m}from"./debug-BQj6h99Q.js";import{t as h}from"./renderOptions-CkqTbz6d.js";l(),a(),n(),m(),i();var g=d();function _({filePath:e,errorDescription:n,onExit:r,onReset:i}){return(0,g.jsxs)(u,{title:`Configuration Error`,color:`error`,onCancel:r,children:[(0,g.jsxs)(o,{flexDirection:`column`,gap:1,children:[(0,g.jsxs)(s,{children:[`The configuration file at `,(0,g.jsx)(s,{bold:!0,children:e}),` contains invalid JSON.`]}),(0,g.jsx)(s,{children:n})]}),(0,g.jsxs)(o,{flexDirection:`column`,children:[(0,g.jsx)(s,{bold:!0,children:`Choose an option:`}),(0,g.jsx)(t,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Reset with default configuration`,value:`reset`}],onChange:e=>{e===`exit`?r():i()},onCancel:r})]})]})}var v=`dark`;async function y({error:t}){let n={...h(!1),theme:v};await new Promise(async i=>{let{unmount:a}=await c((0,g.jsx)(r,{children:(0,g.jsx)(e,{children:(0,g.jsx)(_,{filePath:t.filePath,errorDescription:t.message,onExit:()=>{a(),i(),process.exit(1)},onReset:()=>{p(t.filePath,f(t.defaultConfig,null,2),{flush:!1,encoding:`utf8`}),a(),i(),process.exit(0)}})})}),n)})}export{y as showInvalidConfigDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qu as e,Zu as t}from"./loadAgentsDir-JrGMJN05.js";import{P as n,t as r,y as i}from"./src-DL3w8VPk2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{n as o,t as s}from"./ValidationErrorsList-QZvtUrAy.js";r(),t(),o();var c=a();function l({settingsErrors:t,onContinue:r,onExit:a}){function o(e){e===`exit`?a():r()}return(0,c.jsxs)(i,{title:`Settings Error`,onCancel:a,color:`warning`,children:[(0,c.jsx)(s,{errors:t}),(0,c.jsx)(n,{dimColor:!0,children:`Files with errors are skipped entirely, not just the invalid settings.`}),(0,c.jsx)(e,{options:[{label:`Exit and fix manually`,value:`exit`},{label:`Continue without these settings`,value:`continue`}],onChange:o})]})}export{l as InvalidSettingsDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Ab as r,Ax as i,Cx as a,Db as o,Eb as s,Fb as c,Fx as l,GS as u,Gx as d,HS as f,Hx as p,Ib as m,Ix as h,KS as g,Lx as _,Nb as v,Ob as y,Ox as ee,Qh as te,ST as b,Ux as x,VS as S,Vx as C,Xd as ne,Xh as w,Yd as T,Zh as E,gx as re,jb as D,kx as ie,ux as ae,wb as O,xT as k}from"./loadAgentsDir-JrGMJN05.js";import{ai as A}from"./src-DL3w8VPk2.js";import{t as j}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as M,pt as N}from"./state-BPFYBqm1.js";import{P,R as oe,c as se,i as ce}from"./debug-BQj6h99Q.js";import{it as le,nt as F}from"./settings-aUygByiZ.js";import{c as I,l as L,o as R}from"./log-BlJ7CcKG.js";import{n as z,r as B}from"./analytics-DJobLaWP.js";import{o as V,t as H}from"./localSearch-C-stDP9C.js";import{n as U,t as ue}from"./omit-od_CYp5o.js";function W(e){let t=`plugin`in e?e.plugin:`no-plugin`;return`${e.type}:${e.source}:${t}`}function G(e,t){t.length!==0&&e(e=>{let n=new Set(e.plugins.errors.map(e=>W(e))),r=t.filter(e=>!n.has(W(e)));return r.length===0?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,...r]}}})}function de(e,t=!1){let a=te(),c=E(e=>e.authVersion),d=E(e=>e.mcp.pluginReconnectKey),h=n(),g=(0,K.useRef)(new Map),{addNotification:w}=ne(),T=(0,K.useRef)([]),D=(0,K.useRef)(null),k=(0,K.useCallback)(()=>{D.current=null;let e=T.current;e.length!==0&&(T.current=[],h(t=>{let n=t.mcp;for(let t of e){let{tools:e,commands:r,resources:i,...a}=t,o=a.type===`disabled`||a.type===`failed`?e??[]:e,s=a.type===`disabled`||a.type===`failed`?r??[]:r,c=a.type===`disabled`||a.type===`failed`?i??[]:i,l=F(a.name),u=n.clients.findIndex(e=>e.name===a.name)===-1?[...n.clients,a]:n.clients.map(e=>e.name===a.name?a:e),d=o===void 0?n.tools:[...b(n.tools,e=>e.name?.startsWith(l)),...o],f=s===void 0?n.commands:[...b(n.commands,e=>ae(e,a.name)),...s],p=c===void 0?n.resources:{...n.resources,...c.length>0?{[a.name]:c}:U(n.resources,a.name)};n={...n,clients:u,tools:d,commands:f,resources:p}}return{...t,mcp:n}}))},[h]),A=(0,K.useCallback)(e=>{T.current.push(e),D.current===null&&(D.current=setTimeout(k,16))},[k]),j=(0,K.useCallback)(({client:e,tools:t,commands:n,resources:r})=>{switch(A({...e,tools:t,commands:n,resources:r}),e.type){case`connected`:m(e.client,e.name,h),e.client.onclose=()=>{let t=e.config.type??`stdio`;if(O(e.name,e.config).catch(()=>{se(`Failed to invalidate the server cache: ${e.name}`)}),_(e.name)){I(e.name,`Server is disabled, skipping automatic reconnection`);return}if(t!==`stdio`&&t!==`sdk`){let n=fe(t);I(e.name,`${n} transport closed/disconnected, attempting automatic reconnection`);let r=g.current.get(e.name);r&&(clearTimeout(r),g.current.delete(e.name)),(async()=>{for(let t=1;t<=q;t++){if(_(e.name)){I(e.name,`Server disabled during reconnection, stopping retry`),g.current.delete(e.name);return}A({...e,type:`pending`,reconnectAttempt:t,maxReconnectAttempts:q});let r=Date.now();try{let i=await v(e.name,e.config),a=Date.now()-r;if(i.client.type===`connected`){I(e.name,`${n} reconnection successful after ${a}ms (attempt ${t})`),g.current.delete(e.name),j(i);return}if(I(e.name,`${n} reconnection attempt ${t} completed with status: ${i.client.type}`),t===q){I(e.name,`Max reconnection attempts (${q}) reached, giving up`),g.current.delete(e.name),j(i);return}}catch(i){let a=Date.now()-r;if(L(e.name,`${n} reconnection attempt ${t} failed after ${a}ms: ${i}`),t===q){I(e.name,`Max reconnection attempts (${q}) reached, giving up`),g.current.delete(e.name),A({...e,type:`failed`});return}}let i=Math.min(J*2**(t-1),Y);I(e.name,`Scheduling reconnection attempt ${t+1} in ${i}ms`),await new Promise(t=>{let n=setTimeout(t,i);g.current.set(e.name,n)})}})()}else A({...e,type:`failed`})},e.capabilities?.tools?.listChanged&&e.client.setNotificationHandler(u,async()=>{I(e.name,`Received tools/list_changed notification, refreshing tools`);try{let t=y.cache.get(e.name);y.cache.delete(e.name);let n=await y(e),r=n.length;t?t.then(e=>{B(`tengu_mcp_list_changed`,{type:`tools`,previousCount:e.length,newCount:r})},()=>{B(`tengu_mcp_list_changed`,{type:`tools`,newCount:r})}):B(`tengu_mcp_list_changed`,{type:`tools`,newCount:r}),A({...e,tools:n})}catch(t){L(e.name,`Failed to refresh tools after list_changed notification: ${P(t)}`)}}),e.capabilities?.prompts?.listChanged&&e.client.setNotificationHandler(S,async()=>{I(e.name,`Received prompts/list_changed notification, refreshing prompts`),B(`tengu_mcp_list_changed`,{type:`prompts`});try{s.cache.delete(e.name);let[t,n]=await Promise.all([s(e),Promise.resolve([])]);A({...e,commands:[...t,...n]}),H()}catch(t){L(e.name,`Failed to refresh prompts after list_changed notification: ${P(t)}`)}}),e.capabilities?.resources?.listChanged&&e.client.setNotificationHandler(f,async()=>{I(e.name,`Received resources/list_changed notification, refreshing resources`),B(`tengu_mcp_list_changed`,{type:`resources`});try{o.cache.delete(e.name);{let t=await o(e);A({...e,resources:t})}}catch(t){L(e.name,`Failed to refresh resources after list_changed notification: ${P(t)}`)}});break;case`needs-auth`:case`failed`:case`pending`:case`disabled`:break}},[A]),M=N();return(0,K.useEffect)(()=>{async function n(){let{servers:n,errors:r}=t?{servers:{},errors:[]}:await l(e),i={...n,...e};G(h,r),h(e=>{let{stale:t,...n}=re(e.mcp,i);for(let e of t){let t=g.current.get(e.name);t&&(clearTimeout(t),g.current.delete(e.name)),e.type===`connected`&&(e.client.onclose=void 0,O(e.name,e.config).catch(()=>{}))}let r=new Set(n.clients.map(e=>e.name)),a=Object.entries(i).filter(([e])=>!r.has(e)).map(([e,t])=>({name:e,type:_(e)?`disabled`:`pending`,config:t}));return a.length===0&&t.length===0?e:{...e,mcp:{...e.mcp,...n,clients:[...n.clients,...a]}}})}n().catch(e=>{L(`useManageMCPConnections`,`Failed to initialize servers as pending: ${P(e)}`)})},[t,e,h,M,d]),(0,K.useEffect)(()=>{let n=!1;async function a(){let a;t||ie()?a=Promise.resolve({}):(p(),a=x());let{servers:o,errors:s}=t?{servers:{},errors:[]}:await l(e,a);if(n)return;G(h,s);let c={...o,...e},u=Object.fromEntries(Object.entries(c).filter(([e])=>!_(e)));r(j,u).catch(e=>{L(`useManageMcpConnections`,`Failed to get MCP resources: ${P(e)}`)});let d={};if(!t){if(d=i(await a).allowed,n)return;if(Object.keys(d).length>0){let{servers:e}=ee(d,c);d=e}if(Object.keys(d).length>0){h(e=>{let t=new Set(e.mcp.clients.map(e=>e.name)),n=Object.entries(d).filter(([e])=>!t.has(e)).map(([e,t])=>({name:e,type:_(e)?`disabled`:`pending`,config:t}));return n.length===0?e:{...e,mcp:{...e.mcp,clients:[...e.mcp.clients,...n]}}});let e=Object.fromEntries(Object.entries(d).filter(([e])=>!_(e)));r(j,e).catch(e=>{L(`useManageMcpConnections`,`Failed to get claude.ai MCP resources: ${P(e)}`)})}}let f={...c,...d},m={enterprise:0,global:0,project:0,user:0,plugin:0,claudeai:0};for(let[e,t]of Object.entries(f))t.scope===`enterprise`?m.enterprise++:t.scope===`user`?m.global++:t.scope===`project`?m.project++:t.scope===`local`?m.user++:t.scope===`dynamic`?m.plugin++:t.scope===`claudeai`&&m.claudeai++;B(`tengu_mcp_servers`,{...m})}return a(),()=>{n=!0}},[t,e,j,h,c,M,d]),(0,K.useEffect)(()=>{let e=g.current;return()=>{for(let t of e.values())clearTimeout(t);e.clear(),D.current!==null&&(clearTimeout(D.current),D.current=null,k())}},[k]),{reconnectMcpServer:(0,K.useCallback)(async e=>{let t=a.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);let n=g.current.get(e);n&&(clearTimeout(n),g.current.delete(e));let r=await v(e,t.config);return j(r),r},[a,j]),toggleMcpServer:(0,K.useCallback)(async e=>{let t=a.getState().mcp.clients.find(t=>t.name===e);if(!t)throw Error(`MCP server ${e} not found`);if(t.type!==`disabled`){let n=g.current.get(e);n&&(clearTimeout(n),g.current.delete(e)),C(e,!1),t.type===`connected`&&await O(e,t.config),A({name:e,type:`disabled`,config:t.config})}else{C(e,!0),A({name:e,type:`pending`,config:t.config});let n=await v(e,t.config);j(n)}},[a,A,j])}}function fe(e){switch(e){case`http`:return`HTTP`;case`ws`:case`ws-ide`:return`WebSocket`;default:return`SSE`}}var K,q,J,Y,X=e((()=>{K=t(A(),1),M(),D(),V(),g(),ue(),k(),z(),h(),ce(),T(),w(),oe(),R(),c(),d(),le(),a(),q=5,J=1e3,Y=3e4}));function pe(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpReconnect must be used within MCPConnectionManager`);return e.reconnectMcpServer}function me(){let e=(0,Z.useContext)($);if(!e)throw Error(`useMcpToggleEnabled must be used within MCPConnectionManager`);return e.toggleMcpServer}function he({children:e,dynamicMcpConfig:t,isStrictMcpConfig:n}){let{reconnectMcpServer:r,toggleMcpServer:i}=de(t,n),a=(0,Z.useMemo)(()=>({reconnectMcpServer:r,toggleMcpServer:i}),[r,i]);return(0,Q.jsx)($.Provider,{value:a,children:e})}var Z,Q,$,ge=e((()=>{Z=t(A(),1),X(),Q=j(),$=(0,Z.createContext)(null)}));export{me as i,ge as n,pe as r,he as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{$h as i,Cx as a,Dp as o,Ix as s,Jb as c,Mu as l,Mx as u,Op as d,Pu as f,Qu as ee,Ub as te,Xh as p,Yb as ne,Zb as m,Zh as re,Zu as h,_x as g,aS as _,bx as v,cd as ie,dx as ae,hC as oe,hx as se,jb as y,ld as b,mx as ce,oS as le,wb as ue,xC as de,yx as fe}from"./loadAgentsDir-JrGMJN05.js";import{D as x,H as pe,I as S,Lt as C,P as w,T,Wt as me,ai as E,dr as he,hn as ge,j as D,ot as _e,t as O,y as k}from"./src-DL3w8VPk2.js";import{t as A}from"./jsx-runtime-Bb4Xn-E0.js";import{P as ve,R as j}from"./debug-BQj6h99Q.js";import{et as M,it as N,tt as P}from"./settings-aUygByiZ.js";import{c as ye,o as F}from"./log-BlJ7CcKG.js";import{n as I,r as L}from"./analytics-DJobLaWP.js";import{l as be,u as R}from"./oauth-D38aRTUb.js";import{l as xe,n as Se,o as z}from"./stringUtils-BjnclTLB.js";import{Bt as B,jt as Ce}from"./model-CmDF8O9G.js";import{i as we,n as V,r as Te}from"./MCPConnectionManager-Ciy9y9VV.js";import{n as Ee,t as H}from"./useExitOnCtrlCDWithKeybindings-qLfN0tc-.js";function De({serverToolsCount:e,serverPromptsCount:t,serverResourcesCount:n}){let r=[];return e>0&&r.push(`tools`),n>0&&r.push(`resources`),t>0&&r.push(`prompts`),(0,U.jsxs)(S,{children:[(0,U.jsx)(w,{bold:!0,children:`Capabilities: `}),(0,U.jsx)(w,{color:`text`,children:r.length>0?(0,U.jsx)(T,{children:r}):`none`})]})}var U,Oe=e((()=>{O(),U=A()}));function ke(e,t){switch(e.client.type){case`connected`:return{message:`Reconnected to ${t}.`,success:!0};case`needs-auth`:return{message:`${t} requires authentication. Use the 'Authenticate' option.`,success:!1};case`failed`:return{message:`Failed to reconnect to ${t}.`,success:!1};default:return{message:`Unknown result when reconnecting to ${t}.`,success:!1}}}function Ae(e,t){return`Error reconnecting to ${t}: ${e instanceof Error?e.message:String(e)}`}var W=e((()=>{}));function je({server:e,serverToolsCount:t,onViewTools:n,onCancel:a,onComplete:s,borderless:c=!1}){let[u]=pe(),d=Ee(),{columns:f}=_e(),[p,h]=G.useState(!1),[_,v]=G.useState(null),oe=re(e=>e.mcp),y=i(),[b,de]=G.useState(null),[E,O]=(0,G.useState)(!1),k=(0,G.useRef)(null),[A,j]=(0,G.useState)(!1),[M,N]=(0,G.useState)(null),[P,F]=(0,G.useState)(!1),[I,R]=(0,G.useState)(null),[xe,z]=(0,G.useState)(!1),[B,V]=(0,G.useState)(!1),H=(0,G.useRef)(void 0),U=(0,G.useRef)(!1),[Oe,W]=(0,G.useState)(``),[je,Me]=(0,G.useState)(0),[Ne,q]=(0,G.useState)(null);(0,G.useEffect)(()=>()=>{U.current=!0,k.current?.abort(),H.current!==void 0&&clearTimeout(H.current)},[]);let J=e.isAuthenticated||e.client.type===`connected`&&t>0,Y=Te(),Pe=G.useCallback(async()=>{j(!1),N(null),O(!0);try{let t=await Y(e.name),n=t.client.type===`connected`;L(`tengu_claudeai_mcp_auth_completed`,{success:n}),n?s?.(`Authentication successful. Connected to ${e.name}.`):t.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`)}catch(t){L(`tengu_claudeai_mcp_auth_completed`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}},[Y,e.name,s]),X=G.useCallback(async()=>{await ue(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`needs-auth`}:t),r=g(t.mcp.tools,e.name),i=ce(t.mcp.commands,e.name),a=se(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),L(`tengu_claudeai_mcp_clear_auth_completed`,{}),s?.(`Disconnected from ${e.name}.`),F(!1),R(null),z(!1)},[e.name,e.config,e.scope,y,s]);me(`confirm:no`,()=>{k.current?.abort(),k.current=null,h(!1),de(null)},{context:`Confirmation`,isActive:p}),me(`confirm:no`,()=>{j(!1),N(null)},{context:`Confirmation`,isActive:A}),me(`confirm:no`,()=>{F(!1),R(null),z(!1)},{context:`Confirmation`,isActive:P}),ge((e,t)=>{if(t.return&&A&&Pe(),t.return&&P)if(xe)X();else{let e=`${be().CLAUDE_AI_ORIGIN}/settings/connectors`;R(e),z(!0),le(e)}if(e===`c`&&!B){let e=b||M||I;e&&he(e).then(e=>{U.current||(e&&process.stdout.write(e),V(!0),H.current!==void 0&&clearTimeout(H.current),H.current=setTimeout(V,2e3,!1))})}});let Z=Se(String(e.name)),Fe=fe(oe.commands,e.name).length,Ie=we(),Le=G.useCallback(async()=>{let t=be().CLAUDE_AI_ORIGIN,n=Ce()?.organizationUuid,r;r=n&&e.config.type===`claudeai-proxy`&&e.config.id?`${t}/api/organizations/${n}/mcp/start-auth/${e.config.id.startsWith(`mcprs`)?`mcpsrv${e.config.id.slice(5)}`:e.config.id}?product_surface=${encodeURIComponent(process.env.CLAUDE_CODE_ENTRYPOINT||`cli`)}`:`${t}/settings/connectors`,N(r),j(!0),L(`tengu_claudeai_mcp_auth_started`,{}),await le(r)},[e.config]),Q=G.useCallback(()=>{F(!0),L(`tengu_claudeai_mcp_clear_auth_started`,{})},[]),Re=G.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await Ie(e.name),e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_toggle`,{new_state:t?`disabled`:`enabled`}),a()}catch(n){s?.(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.config.type,e.name,Ie,a,s]),ze=G.useCallback(async()=>{if(e.config.type===`claudeai-proxy`)return;h(!0),v(null);let t=new AbortController;k.current=t;try{if(e.isAuthenticated&&e.config&&await m(e.name,e.config,{preserveStepUpState:!0}),e.config){await ne(e.name,e.config,de,t.signal,{onWaitingForCallback:e=>{q(()=>e)}}),L(`tengu_mcp_auth_config_authenticate`,{wasAuthenticated:e.isAuthenticated});let n=await Y(e.name);if(n.client.type===`connected`){let t=J?`Authentication successful. Reconnected to ${e.name}.`:`Authentication successful. Connected to ${e.name}.`;s?.(t)}else n.client.type===`needs-auth`?s?.(`Authentication successful, but server still requires authentication. You may need to manually restart Claude Code.`):(ye(e.name,`Reconnection failed after authentication`),s?.(`Authentication successful, but server reconnection failed. You may need to manually restart Claude Code for the changes to take effect.`))}}catch(e){e instanceof Error&&!(e instanceof te)&&v(e.message)}finally{h(!1),k.current=null,q(null),W(``)}},[e.isAuthenticated,e.config,e.name,s,Y,J]),Be=async()=>{e.config.type!==`claudeai-proxy`&&e.config&&(await m(e.name,e.config),L(`tengu_mcp_auth_config_clear`,{}),await ue(e.name,{...e.config,scope:e.scope}),y(t=>{let n=t.mcp.clients.map(t=>t.name===e.name?{...t,type:`failed`}:t),r=g(t.mcp.tools,e.name),i=ce(t.mcp.commands,e.name),a=se(t.mcp.resources,e.name);return{...t,mcp:{...t.mcp,clients:n,tools:r,commands:i,resources:a}}}),s?.(`Authentication cleared for ${e.name}.`))};if(p){let t=e.config.type!==`claudeai-proxy`&&e.config.oauth?.xaa?` Authenticating via your identity provider`:` A browser window will open for authentication`;return(0,K.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:t})]}),b&&(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(x,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(C,{url:b})]}),p&&b&&Ne&&(0,K.jsxs)(S,{flexDirection:`column`,marginTop:1,children:[(0,K.jsx)(w,{dimColor:!0,children:`If the redirect page shows a connection error, paste the URL from your browser's address bar:`}),(0,K.jsxs)(S,{children:[(0,K.jsxs)(w,{dimColor:!0,children:[`URL `,`>`,` `]}),(0,K.jsx)(ie,{value:Oe,onChange:W,onSubmit:e=>{Ne(e.trim()),W(``)},cursorOffset:je,onChangeCursorOffset:Me,columns:f-8})]})]}),(0,K.jsx)(S,{marginLeft:3,children:(0,K.jsx)(w,{dimColor:!0,children:`Return here after authenticating in your browser. Press Esc to go back.`})})]})}if(A)return(0,K.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` A browser window will open for authentication`})]}),M&&(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(x,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(C,{url:M})]}),(0,K.jsxs)(S,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` after authenticating in your browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]});if(P)return(0,K.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`claude`,children:[`Clear authentication for `,e.name]}),xe?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`Find the MCP server in the browser and click "Disconnect".`}),I&&(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{dimColor:!0,children:`If your browser didn't open automatically, copy this URL manually `}),B?(0,K.jsx)(w,{color:`success`,children:`(Copied!)`}):(0,K.jsx)(w,{dimColor:!0,children:(0,K.jsx)(x,{shortcut:`c`,action:`copy`,parens:!0})})]}),(0,K.jsx)(C,{url:I})]}),(0,K.jsxs)(S,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` when done.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]}):(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{children:`This will open claude.ai in the browser. Find the MCP server in the list and click "Disconnect".`}),(0,K.jsxs)(S,{marginLeft:3,flexDirection:`column`,children:[(0,K.jsxs)(w,{color:`permission`,children:[`Press `,(0,K.jsx)(w,{bold:!0,children:`Enter`}),` to open the browser.`]}),(0,K.jsx)(w,{dimColor:!0,italic:!0,children:(0,K.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})})]})]})]});if(E)return(0,K.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,K.jsxs)(w,{color:`text`,children:[`Connecting to `,(0,K.jsx)(w,{bold:!0,children:e.name}),`…`]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(l,{}),(0,K.jsx)(w,{children:` Establishing connection to MCP server`})]}),(0,K.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]});let $=[];return e.client.type===`disabled`&&$.push({label:`Enable`,value:`toggle-enabled`}),e.client.type===`connected`&&t>0&&$.push({label:`View tools`,value:`tools`}),e.config.type===`claudeai-proxy`?e.client.type===`connected`?$.push({label:`Clear authentication`,value:`claudeai-clear-auth`}):e.client.type!==`disabled`&&$.push({label:`Authenticate`,value:`claudeai-auth`}):(J&&($.push({label:`Re-authenticate`,value:`reauth`}),$.push({label:`Clear authentication`,value:`clear-auth`})),J||$.push({label:`Authenticate`,value:`auth`})),e.client.type!==`disabled`&&(e.client.type!==`needs-auth`&&$.push({label:`Reconnect`,value:`reconnectMcpServer`}),$.push({label:`Disable`,value:`toggle-enabled`})),$.length===0&&$.push({label:`Back`,value:`back`}),(0,K.jsxs)(S,{flexDirection:`column`,children:[(0,K.jsxs)(S,{flexDirection:`column`,paddingX:1,borderStyle:c?void 0:`round`,children:[(0,K.jsx)(S,{marginBottom:1,children:(0,K.jsxs)(w,{bold:!0,children:[Z,` MCP Server`]})}),(0,K.jsxs)(S,{flexDirection:`column`,gap:0,children:[(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,K.jsxs)(w,{children:[D(`inactive`,u)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,K.jsxs)(w,{children:[D(`success`,u)(r.tick),` connected`]}):e.client.type===`pending`?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,K.jsx)(w,{children:` connecting…`})]}):e.client.type===`needs-auth`?(0,K.jsxs)(w,{children:[D(`warning`,u)(r.triangleUpOutline),` needs authentication`]}):(0,K.jsxs)(w,{children:[D(`error`,u)(r.cross),` failed`]})]}),e.transport!==`claudeai-proxy`&&(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Auth: `}),J?(0,K.jsxs)(w,{children:[D(`success`,u)(r.tick),` authenticated`]}):(0,K.jsxs)(w,{children:[D(`error`,u)(r.cross),` not authenticated`]})]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`URL: `}),(0,K.jsx)(w,{dimColor:!0,children:e.config.url})]}),(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Config location: `}),(0,K.jsx)(w,{dimColor:!0,children:ae(e.scope)})]}),e.client.type===`connected`&&(0,K.jsx)(De,{serverToolsCount:t,serverPromptsCount:Fe,serverResourcesCount:oe.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,K.jsxs)(S,{children:[(0,K.jsx)(w,{bold:!0,children:`Tools: `}),(0,K.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),_&&(0,K.jsx)(S,{marginTop:1,children:(0,K.jsxs)(w,{color:`error`,children:[`Error: `,_]})}),$.length>0&&(0,K.jsx)(S,{marginTop:1,children:(0,K.jsx)(ee,{options:$,onChange:async t=>{switch(t){case`tools`:n();break;case`auth`:case`reauth`:await ze();break;case`clear-auth`:await Be();break;case`claudeai-auth`:await Le();break;case`claudeai-clear-auth`:Q();break;case`reconnectMcpServer`:O(!0);try{let t=await Y(e.name);e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:t.client.type===`connected`});let{message:n}=ke(t,e.name);s?.(n)}catch(t){e.config.type===`claudeai-proxy`&&L(`tengu_claudeai_mcp_reconnect`,{success:!1}),s?.(Ae(t,e.name))}finally{O(!1)}break;case`toggle-enabled`:await Re();break;case`back`:a();break}},onCancel:a})})]}),(0,K.jsx)(S,{marginTop:1,children:(0,K.jsx)(w,{dimColor:!0,italic:!0,children:d.pending?(0,K.jsxs)(K.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,K.jsxs)(T,{children:[(0,K.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(x,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var G,K,Me=e((()=>{n(),G=t(E(),1),I(),R(),H(),de(),O(),oe(),c(),y(),V(),a(),p(),B(),_(),j(),F(),z(),d(),h(),f(),b(),Oe(),W(),K=A()}));function Ne({server:e,serverToolsCount:t,onViewTools:n,onCancel:i,onComplete:a,borderless:s=!1}){let[c]=pe(),d=Ee(),f=re(e=>e.mcp),te=Te(),p=we(),[ne,m]=(0,q.useState)(!1),h=q.useCallback(async()=>{let t=e.client.type!==`disabled`;try{await p(e.name),i()}catch(n){a(`Failed to ${t?`disable`:`enable`} MCP server '${e.name}': ${ve(n)}`)}},[e.client.type,e.name,p,i,a]),g=Se(String(e.name)),_=fe(f.commands,e.name).length,v=[];return e.client.type!==`disabled`&&t>0&&v.push({label:`View tools`,value:`tools`}),e.client.type!==`disabled`&&v.push({label:`Reconnect`,value:`reconnectMcpServer`}),v.push({label:e.client.type===`disabled`?`Enable`:`Disable`,value:`toggle-enabled`}),v.length===0&&v.push({label:`Back`,value:`back`}),ne?(0,J.jsxs)(S,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(w,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(w,{bold:!0,children:e.name})]}),(0,J.jsxs)(S,{children:[(0,J.jsx)(l,{}),(0,J.jsx)(w,{children:` Restarting MCP server process`})]}),(0,J.jsx)(w,{dimColor:!0,children:`This may take a few moments.`})]}):(0,J.jsxs)(S,{flexDirection:`column`,children:[(0,J.jsxs)(S,{flexDirection:`column`,paddingX:1,borderStyle:s?void 0:`round`,children:[(0,J.jsx)(S,{marginBottom:1,children:(0,J.jsxs)(w,{bold:!0,children:[g,` MCP Server`]})}),(0,J.jsxs)(S,{flexDirection:`column`,gap:0,children:[(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Status: `}),e.client.type===`disabled`?(0,J.jsxs)(w,{children:[D(`inactive`,c)(r.radioOff),` disabled`]}):e.client.type===`connected`?(0,J.jsxs)(w,{children:[D(`success`,c)(r.tick),` connected`]}):e.client.type===`pending`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(w,{dimColor:!0,children:r.radioOff}),(0,J.jsx)(w,{children:` connecting…`})]}):(0,J.jsxs)(w,{children:[D(`error`,c)(r.cross),` failed`]})]}),(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Command: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.command})]}),e.config.args&&e.config.args.length>0&&(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Args: `}),(0,J.jsx)(w,{dimColor:!0,children:e.config.args.join(` `)})]}),(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Config location: `}),(0,J.jsx)(w,{dimColor:!0,children:ae(u(e.name)?.scope??`dynamic`)})]}),e.client.type===`connected`&&(0,J.jsx)(De,{serverToolsCount:t,serverPromptsCount:_,serverResourcesCount:f.resources[e.name]?.length||0}),e.client.type===`connected`&&t>0&&(0,J.jsxs)(S,{children:[(0,J.jsx)(w,{bold:!0,children:`Tools: `}),(0,J.jsxs)(w,{dimColor:!0,children:[t,` tools`]})]})]}),v.length>0&&(0,J.jsx)(S,{marginTop:1,children:(0,J.jsx)(ee,{options:v,onChange:async t=>{if(t===`tools`)n();else if(t===`reconnectMcpServer`){m(!0);try{let{message:t}=ke(await te(e.name),e.name);a?.(t)}catch(t){a?.(Ae(t,e.name))}finally{m(!1)}}else t===`toggle-enabled`?await h():t===`back`&&i()},onCancel:i})})]}),(0,J.jsx)(S,{marginTop:1,children:(0,J.jsx)(w,{dimColor:!0,italic:!0,children:d.pending?(0,J.jsxs)(J.Fragment,{children:[`Press `,d.keyName,` again to exit`]}):(0,J.jsxs)(T,{children:[(0,J.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(x,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]})})})]})}var q,J,Y=e((()=>{n(),q=t(E(),1),H(),O(),s(),V(),a(),p(),j(),z(),d(),h(),f(),Oe(),W(),J=A()}));function Pe({tool:e,server:t,onBack:n}){let[r,i]=X.useState(``),a=P(e.name,t.name),s=M(e.userFacingName?e.userFacingName({}):a),c=e.isReadOnly?.({})??!1,l=e.isDestructive?.({})??!1,u=e.isOpenWorld?.({})??!1;return X.useEffect(()=>{async function t(){try{let t=await e.description({},{isNonInteractiveSession:!1,toolPermissionContext:{mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!1},tools:[]});i(t)}catch{i(`Failed to load description`)}}t()},[e]),(0,Z.jsx)(k,{title:(0,Z.jsxs)(Z.Fragment,{children:[s,c&&(0,Z.jsx)(w,{color:`success`,children:` [read-only]`}),l&&(0,Z.jsx)(w,{color:`error`,children:` [destructive]`}),u&&(0,Z.jsx)(w,{dimColor:!0,children:` [open-world]`})]}),subtitle:t.name,onCancel:n,inputGuide:e=>e.pending?(0,Z.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Z.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`}),children:(0,Z.jsxs)(S,{flexDirection:`column`,children:[(0,Z.jsxs)(S,{children:[(0,Z.jsx)(w,{bold:!0,children:`Tool name: `}),(0,Z.jsx)(w,{dimColor:!0,children:a})]}),(0,Z.jsxs)(S,{children:[(0,Z.jsx)(w,{bold:!0,children:`Full name: `}),(0,Z.jsx)(w,{dimColor:!0,children:e.name})]}),r&&(0,Z.jsxs)(S,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Description:`}),(0,Z.jsx)(w,{wrap:`wrap`,children:r})]}),e.inputJSONSchema?.properties&&Object.keys(e.inputJSONSchema.properties).length>0&&(0,Z.jsxs)(S,{flexDirection:`column`,marginTop:1,children:[(0,Z.jsx)(w,{bold:!0,children:`Parameters:`}),(0,Z.jsx)(S,{marginLeft:2,flexDirection:`column`,children:Object.entries(e.inputJSONSchema.properties).map(([t,n])=>{let r=(e.inputJSONSchema?.required)?.includes(t);return(0,Z.jsxs)(w,{children:[`• `,t,r&&(0,Z.jsx)(w,{dimColor:!0,children:` (required)`}),`:`,` `,(0,Z.jsx)(w,{dimColor:!0,children:typeof n==`object`&&n&&`type`in n?String(n.type):`unknown`}),typeof n==`object`&&n&&`description`in n&&(0,Z.jsxs)(w,{dimColor:!0,children:[` - `,String(n.description)]})]},t)})})]})]})})}var X,Z,Fe=e((()=>{X=t(E(),1),O(),N(),d(),Z=A()}));function Ie({server:e,onSelectTool:t,onBack:n}){let r=re(e=>e.mcp.tools),i=Le.useMemo(()=>e.client.type===`connected`?v(r,e.name):[],[e,r]),a=i.map((t,n)=>{let r=P(t.name,e.name),i=M(t.userFacingName?t.userFacingName({}):r),a=t.isReadOnly?.({})??!1,o=t.isDestructive?.({})??!1,s=t.isOpenWorld?.({})??!1,c=[];return a&&c.push(`read-only`),o&&c.push(`destructive`),s&&c.push(`open-world`),{label:i,value:n.toString(),description:c.length>0?c.join(`, `):void 0,descriptionColor:o?`error`:a?`success`:void 0}});return(0,Q.jsx)(k,{title:`Tools for ${e.name}`,subtitle:`${i.length} ${xe(i.length,`tool`)}`,onCancel:n,inputGuide:e=>e.pending?(0,Q.jsxs)(w,{children:[`Press `,e.keyName,` again to exit`]}):(0,Q.jsxs)(T,{children:[(0,Q.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,Q.jsx)(x,{shortcut:`Enter`,action:`select`}),(0,Q.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`back`})]}),children:i.length===0?(0,Q.jsx)(w,{dimColor:!0,children:`No tools available`}):(0,Q.jsx)(ee,{options:a,onChange:e=>{let n=parseInt(e,10),r=i[n];r&&t(r,n)},onCancel:n})})}var Le,Q,Re=e((()=>{Le=t(E(),1),O(),N(),a(),p(),z(),d(),h(),Q=A()}));export{Ne as a,Me as c,Fe as i,Re as n,Y as o,Pe as r,je as s,Ie as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Cx as n,Ix as r,Nx as i,Sx as a,dx as o}from"./loadAgentsDir-JrGMJN05.js";import{I as s,Lt as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({scope:e,parsingErrors:t,warnings:n}){let r=t.length>0,i=n.length>0;return!r&&!i?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,children:[(0,_.jsxs)(s,{children:[(r||i)&&(0,_.jsxs)(l,{color:r?`error`:`warning`,children:[`[`,r?`Failed to parse`:`Contains warnings`,`] `]}),(0,_.jsx)(l,{children:a(e)})]}),(0,_.jsxs)(s,{children:[(0,_.jsx)(l,{dimColor:!0,children:`Location: `}),(0,_.jsx)(l,{dimColor:!0,children:o(e)})]}),(0,_.jsxs)(s,{marginLeft:1,flexDirection:`column`,children:[t.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`error`,children:`[Error]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`error-${t}`)}),n.map((e,t)=>{let n=e.mcpErrorMetadata?.serverName;return(0,_.jsx)(s,{children:(0,_.jsxs)(l,{children:[(0,_.jsx)(l,{dimColor:!0,children:`└ `}),(0,_.jsx)(l,{color:`warning`,children:`[Warning]`}),(0,_.jsxs)(l,{dimColor:!0,children:[` `,n&&`[${n}] `,e.path&&e.path!==``?`${e.path}: `:``,e.message]})]})},`warning-${t}`)})]})]})}function m(){let e=(0,g.useMemo)(()=>[{scope:`user`,config:i(`user`)},{scope:`project`,config:i(`project`)},{scope:`local`,config:i(`local`)},{scope:`enterprise`,config:i(`enterprise`)}],[]),t=e.some(({config:e})=>h(e.errors,`fatal`).length>0),n=e.some(({config:e})=>h(e.errors,`warning`).length>0);return!t&&!n?null:(0,_.jsxs)(s,{flexDirection:`column`,marginTop:1,marginBottom:1,children:[(0,_.jsx)(l,{bold:!0,children:`MCP Config Diagnostics`}),(0,_.jsx)(s,{marginTop:1,children:(0,_.jsxs)(l,{dimColor:!0,children:[`For help configuring MCP servers, see:`,` `,(0,_.jsx)(c,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`})]})}),e.map(({scope:e,config:t})=>(0,_.jsx)(p,{scope:e,parsingErrors:h(t.errors,`fatal`),warnings:h(t.errors,`warning`)},e))]})}function h(e,t){return e.filter(e=>e.mcpErrorMetadata?.severity===t)}var g,_,v=e((()=>{g=t(u(),1),r(),n(),d(),_=f()}));export{v as n,m as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{n as e,o as t,r as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./figures-5ThXQEtq.js";import{$u as a,Da as o,Ds as s,Fc as c,Ic as l,Iy as u,La as d,Lc as f,Ly as p,Mu as m,Pu as h,Qu as g,Sa as _,Ts as v,Ua as y,Va as b,Xh as x,Zh as S,bg as C,dn as w,ep as T,hC as E,hg as D,hn as O,iw as k,mg as A,nn as j,np as ee,pg as te,rw as M,tw as N,wa as P,ws as ne,xC as re,ya as F,za as ie,zc as I}from"./loadAgentsDir-JrGMJN05.js";import{C as ae,Gt as oe,I as L,P as R,Wt as se,ai as ce,ot as le,t as ue}from"./src-DL3w8VPk2.js";import{t as de}from"./jsx-runtime-Bb4Xn-E0.js";import{Gn as fe,Wt as pe}from"./state-BPFYBqm1.js";import{Ln as z,Rn as me}from"./settings-aUygByiZ.js";import{h as B,m as he,o as ge,q as _e,s as V,w as ve}from"./log-BlJ7CcKG.js";import{n as H,r as U}from"./analytics-DJobLaWP.js";import{b as ye,m as be,v as xe}from"./startupProfiler-2sjXZkIP.js";import{E as Se,T as Ce,c as we,d as Te,w as Ee}from"./sessionTracing-Bm7hQKHA.js";import{n as De,t as Oe}from"./useExitOnCtrlCDWithKeybindings-qLfN0tc-.js";import*as W from"path";import{randomUUID as G}from"crypto";var K=t(ce(),1),q=de();ue(),pe(),_e(),he(),ge(),me(),H(),xe(),M(),u(),Ee(),T(),we(),f(),c(),s(),d(),O();function ke(e){let t=e.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(t)}function Ae(e){let t=e.toLowerCase().trim();return t===`continue`||/\b(keep going|go on)\b/.test(t)}function je(e,t,n,r,i,a,o){let s=G();fe(s);let c=typeof e==`string`?e:e.find(e=>e.type===`text`)?.text||``;Te(c);let l=typeof e==`string`?e:e.findLast(e=>e.type===`text`)?.text||``;return l&&Ce(`user_prompt`,{prompt_length:String(l.length),prompt:Se(l),"prompt.id":s}),U(`tengu_input_prompt`,{is_negative:ke(c),is_keep_going:Ae(c)}),t.length>0?{messages:[_({content:[...typeof e==`string`?e.trim()?[{type:`text`,text:e}]:[]:e,...t],uuid:i,imagePasteIds:n.length>0?n:void 0,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}:{messages:[_({content:e,uuid:i,permissionMode:a,isMeta:o||void 0}),...r],shouldQuery:!0}}H(),d();async function Me({input:e,preExpansionInput:t,mode:n,setToolJSX:r,context:i,pastedContents:a,ideSelection:s,messages:c,setUserInputOnProcessing:l,uuid:u,isAlreadyProcessing:d,querySource:f,canUseTool:p,skipSlashCommands:m,bridgeOrigin:h,isMeta:g,skipAttachments:v,autonomy:y}){let b=typeof e==`string`?e:null,x=b?.startsWith(`/`)&&!m;n===`prompt`&&b!==null&&!g&&!x&&l?.(b),I(`query_process_user_input_base_start`);let S=i.getAppState(),C=await Pe(e,n,r,i,a,s,c,u,d,f,p,S.toolPermissionContext.mode,m,h,g,v,t,y);if(I(`query_process_user_input_base_end`),!C.shouldQuery)return C;I(`query_hooks_start`);let T=o(e)||``;for await(let t of j(T,S.toolPermissionContext.mode,i,i.requestPrompt))if(t.message?.type!==`progress`){if(t.blockingError)return{messages:[F(`${w(t.blockingError)}\n\nOriginal prompt: ${e}`,`warning`)],shouldQuery:!1,allowedTools:C.allowedTools};if(t.preventContinuation){let e=t.stopReason?`Operation stopped by hook: ${t.stopReason}`:`Operation stopped by hook`;return C.messages.push(_({content:e})),C.shouldQuery=!1,C}if(t.additionalContexts&&t.additionalContexts.length>0&&C.messages.push(ne({type:`hook_additional_context`,content:t.additionalContexts.map(Ne),hookName:`UserPromptSubmit`,toolUseID:`hook-${G()}`,hookEvent:`UserPromptSubmit`})),t.message)switch(t.message.attachment.type){case`hook_success`:if(!t.message.attachment.content)break;C.messages.push({...t.message,attachment:{...t.message.attachment,content:Ne(t.message.attachment.content)}});break;default:C.messages.push(t.message);break}}return I(`query_hooks_end`),C}var J=1e4;function Ne(e){return e.length>J?`${e.substring(0,J)}… [output truncated - exceeded ${J} characters]`:e}async function Pe(e,t,n,r,i,a,o,s,c,u,d,f,m,h,g,_,y,b){let x=null,S=[],C=[],w=e;if(typeof e==`string`)x=e;else if(e.length>0){I(`query_image_processing_start`);let t=[];for(let n of e)if(n.type===`image`){let e=await k(n);if(e.dimensions){let t=N(e.dimensions);t&&C.push(t)}t.push(e.block)}else t.push(n);w=t,I(`query_image_processing_end`);let n=t[t.length-1];n?.type===`text`?(x=n.text,S=t.slice(0,-1)):S=t}if(x===null&&t!==`prompt`)throw Error(`Mode: ${t} requires a string input.`);let T=i?Object.values(i).filter(p):[],E=T.map(e=>e.id),D=i?await ee(i):new Map;I(`query_pasted_image_processing_start`);let O=await Promise.all(T.map(async e=>{let t={type:`image`,source:{type:`base64`,media_type:e.mediaType||`image/png`,data:e.content}};return U(`tengu_pasted_image_resize_attempt`,{original_size_bytes:e.content.length}),{resized:await k(t),originalDimensions:e.dimensions,sourcePath:e.sourcePath??D.get(e.id)}})),A=[];for(let{resized:e,originalDimensions:t,sourcePath:n}of O){if(e.dimensions){let t=N(e.dimensions,n);t&&C.push(t)}else if(t){let e=N(t,n);e&&C.push(e)}else n&&C.push(`[Image source: ${n}]`);A.push(e.block)}I(`query_pasted_image_processing_end`);let j=m,te=!_&&x!==null&&(t!==`prompt`||j||!x.startsWith(`/`));I(`query_attachment_loading_start`);let M=te?await l(v(x,r,a??null,[],o,u)):[];if(I(`query_attachment_loading_end`),x!==null&&t===`bash`){let{processBashCommand:e}=await import(`./processBashCommand-BGCIqxc9.js`);return Y(await e(x,S,M,r,n),C)}if(x!==null&&!j&&x.startsWith(`/`)){let{processSlashCommand:e}=await import(`./processSlashCommand-qR_j1DE8.js`);return Y(await e(x,S,A,M,r,n,s,c,d,b),C)}if(x!==null&&t===`prompt`){let e=x.trim(),t=M.find(e=>e.attachment.type===`agent_mention`);if(t){let n=`@agent-${t.attachment.agentType}`,r=e===n;U(`tengu_subagent_at_mention`,{is_subagent_only:r,is_prefix:e.startsWith(n)&&!r})}}return Y(je(w,A,E,M,s,f,g),C)}function Y(e,t){return t.length>0&&e.messages.push(_({content:t.map(e=>({type:`text`,text:e})),isMeta:!0})),e}var Fe=n({MessageSelector:()=>Z,messagesAfterAreOnlySynthetic:()=>Ue,selectableUserMessagesFilter:()=>Q});function Ie(e){return e.type===`text`}function X(e){return e===`summarize`}function Z({messages:e,onPreRestore:t,onRestoreMessage:n,onRestoreCode:r,onSummarize:a,onClose:o,preselectedMessage:s}){let c=S(e=>e.fileHistory),[l,u]=(0,K.useState)(void 0),d=A(),f=(0,K.useMemo)(G,[]),p=(0,K.useMemo)(()=>[...e.filter(Q),{..._({content:``}),uuid:f}],[e,f]),[h,v]=(0,K.useState)(p.length-1),y=Math.max(0,Math.min(h-Math.floor($/2),p.length-$)),b=p.length>1,[x,C]=(0,K.useState)(s),[w,T]=(0,K.useState)(void 0);(0,K.useEffect)(()=>{if(!s||!d)return;let e=!1;return D(c,s.uuid).then(t=>{e||T(t)}),()=>{e=!0}},[s,d,c]);let[E,O]=(0,K.useState)(!1),[k,j]=(0,K.useState)(null),[ee,M]=(0,K.useState)(`both`),[N,P]=(0,K.useState)(``);function ne(e){let t=e?[{value:`both`,label:`Restore code and conversation`},{value:`conversation`,label:`Restore conversation`},{value:`code`,label:`Restore code`}]:[{value:`conversation`,label:`Restore conversation`}];return t.push({value:`summarize`,label:`Summarize from here`,type:`input`,placeholder:`add context (optional)`,initialValue:``,allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:`: `,onChange:P}),t.push({value:`nevermind`,label:`Never mind`}),t}(0,K.useEffect)(()=>{U(`tengu_message_selector_opened`,{})},[]);async function re(e){t(),O(!0);try{await n(e),O(!1),o()}catch(e){V(e),O(!1),u(`Failed to restore the conversation:\n${e}`)}}async function F(t){let n=e.indexOf(t);if(U(`tengu_message_selector_selected`,{index_from_end:e.length-1-n,message_type:t.type,is_current_prompt:!1}),!e.includes(t)){o();return}if(!d){await re(t);return}let r=await D(c,t.uuid);C(t),T(r)}async function ie(e){if(U(`tengu_message_selector_restore_option_selected`,{option:e}),!x){u(`Message not found.`);return}if(e===`nevermind`){s?o():C(void 0);return}if(X(e)){t(),O(!0),j(e),u(void 0);try{let e=N.trim()||void 0;await a(x,e,`from`),O(!1),j(null),C(void 0),o()}catch(e){V(e),O(!1),j(null),C(void 0),u(`Failed to summarize:\n${e}`)}return}t(),O(!0),u(void 0);let i=null,c=null;if(e===`code`||e===`both`)try{await r(x)}catch(e){i=e,V(i)}if(e===`conversation`||e===`both`)try{await n(x)}catch(e){c=e,V(c)}O(!1),C(void 0),c&&i?u(`Failed to restore the conversation and code:\n${c}\n${i}`):c?u(`Failed to restore the conversation:\n${c}`):i?u(`Failed to restore the code:\n${i}`):o()}let I=De(),ce=(0,K.useCallback)(()=>{if(x&&!s){C(void 0);return}U(`tengu_message_selector_cancelled`,{}),o()},[o,x,s]),le=(0,K.useCallback)(()=>v(e=>Math.max(0,e-1)),[]),ue=(0,K.useCallback)(()=>v(e=>Math.min(p.length-1,e+1)),[p.length]),de=(0,K.useCallback)(()=>v(0),[]),fe=(0,K.useCallback)(()=>v(p.length-1),[p.length]),pe=(0,K.useCallback)(()=>{let e=p[h];e&&F(e)},[p,h,F]);se(`confirm:no`,ce,{context:`Confirmation`,isActive:!x}),oe({"messageSelector:up":le,"messageSelector:down":ue,"messageSelector:top":de,"messageSelector:bottom":fe,"messageSelector:select":pe},{context:`MessageSelector`,isActive:!E&&!l&&!x&&b});let[z,me]=(0,K.useState)({});(0,K.useEffect)(()=>{async function t(){d&&Promise.all(p.map(async(t,n)=>{if(t.uuid!==f){let r=te(c,t.uuid),i=p.at(n+1),a=r?He(e,t.uuid,i?.uuid===f?void 0:i?.uuid):void 0;me(a===void 0?e=>({...e,[n]:void 0}):e=>({...e,[n]:a}))}}))}t()},[p,e,f,c,d]);let B=d&&w?.filesChanged&&w.filesChanged.length>0,he=!l&&!x&&!s&&b;return(0,q.jsxs)(L,{flexDirection:`column`,width:`100%`,children:[(0,q.jsx)(ae,{color:`suggestion`}),(0,q.jsxs)(L,{flexDirection:`column`,marginX:1,gap:1,children:[(0,q.jsx)(R,{bold:!0,color:`suggestion`,children:`Rewind`}),l&&(0,q.jsxs)(R,{color:`error`,children:[`Error: `,l]}),!b&&(0,q.jsx)(R,{children:`Nothing to rewind to yet.`}),!l&&x&&b&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(R,{children:[`Confirm you want to restore `,!w&&`the conversation `,`to the point before you sent this message:`]}),(0,q.jsxs)(L,{flexDirection:`column`,paddingLeft:1,borderStyle:`single`,borderRight:!1,borderTop:!1,borderBottom:!1,borderLeft:!0,borderLeftDimColor:!0,children:[(0,q.jsx)(Ve,{userMessage:x,color:`text`,isCurrent:!1}),(0,q.jsxs)(R,{dimColor:!0,children:[`(`,be(new Date(x.timestamp)),`)`]})]}),(0,q.jsx)(Re,{selectedRestoreOption:ee,canRestoreCode:!!B,diffStatsForRestore:w}),E&&X(k)?(0,q.jsxs)(L,{flexDirection:`row`,gap:1,children:[(0,q.jsx)(m,{}),(0,q.jsx)(R,{children:`Summarizing…`})]}):(0,q.jsx)(g,{isDisabled:E,options:ne(!!B),defaultFocusValue:B?`both`:`conversation`,onFocus:e=>M(e),onChange:e=>ie(e),onCancel:()=>s?o():C(void 0)}),B&&(0,q.jsx)(L,{marginBottom:1,children:(0,q.jsxs)(R,{dimColor:!0,children:[i.warning,` Rewinding does not affect files edited manually or via bash.`]})})]}),he&&(0,q.jsxs)(q.Fragment,{children:[d?(0,q.jsx)(R,{children:`Restore the code and/or conversation to the point before…`}):(0,q.jsx)(R,{children:`Restore and fork the conversation to the point before…`}),(0,q.jsx)(L,{width:`100%`,flexDirection:`column`,children:p.slice(y,y+$).map((e,t)=>{let n=y+t,r=n===h,a=e.uuid===f,o=n in z,s=z[n],c=s?.filesChanged?.length;return(0,q.jsxs)(L,{height:d?3:2,overflow:`hidden`,width:`100%`,flexDirection:`row`,children:[(0,q.jsx)(L,{width:2,minWidth:2,children:r?(0,q.jsxs)(R,{color:`permission`,bold:!0,children:[i.pointer,` `]}):(0,q.jsx)(R,{children:` `})}),(0,q.jsxs)(L,{flexDirection:`column`,children:[(0,q.jsx)(L,{flexShrink:1,height:1,overflow:`hidden`,children:(0,q.jsx)(Ve,{userMessage:e,color:r?`suggestion`:void 0,isCurrent:a,paddingRight:10})}),d&&o&&(0,q.jsx)(L,{height:1,flexDirection:`row`,children:s?(0,q.jsx)(R,{dimColor:!r,color:`inactive`,children:c?(0,q.jsxs)(q.Fragment,{children:[c===1&&s.filesChanged[0]?`${W.basename(s.filesChanged[0])} `:`${c} files changed `,(0,q.jsx)(Be,{diffStats:s})]}):(0,q.jsx)(q.Fragment,{children:`No code changes`})}):(0,q.jsxs)(R,{dimColor:!0,color:`warning`,children:[i.warning,` No code restore`]})})]})]},e.uuid)})})]}),!x&&(0,q.jsx)(R,{dimColor:!0,italic:!0,children:I.pending?(0,q.jsxs)(q.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):(0,q.jsxs)(q.Fragment,{children:[!l&&b&&`Enter to continue · `,`Esc to exit`]})})]})]})}function Le(e){switch(e){case`summarize`:return`Messages after this point will be summarized.`;case`both`:case`conversation`:return`The conversation will be forked.`;case`code`:case`nevermind`:return`The conversation will be unchanged.`}}function Re({selectedRestoreOption:e,canRestoreCode:t,diffStatsForRestore:n}){let r=t&&(e===`both`||e===`code`);return(0,q.jsxs)(L,{flexDirection:`column`,children:[(0,q.jsx)(R,{dimColor:!0,children:Le(e)}),!X(e)&&(r?(0,q.jsx)(ze,{diffStatsForRestore:n}):(0,q.jsx)(R,{dimColor:!0,children:`The code will be unchanged.`}))]})}function ze({diffStatsForRestore:e}){if(e===void 0)return;if(!e.filesChanged?.[0])return(0,q.jsx)(R,{dimColor:!0,children:`The code has not changed (nothing will be restored).`});let t=e.filesChanged.length,n=``;return n=t===1?W.basename(e.filesChanged[0]||``):t===2?`${W.basename(e.filesChanged[0]||``)} and ${W.basename(e.filesChanged[1]||``)}`:`${W.basename(e.filesChanged[0]||``)} and ${e.filesChanged.length-1} other files`,(0,q.jsxs)(R,{dimColor:!0,children:[`The code will be restored `,(0,q.jsx)(Be,{diffStats:e}),` in `,n,`.`]})}function Be({diffStats:e}){if(e?.filesChanged)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(R,{color:`diffAddedWord`,children:[`+`,e.insertions,` `]}),(0,q.jsxs)(R,{color:`diffRemovedWord`,children:[`-`,e.deletions]})]})}function Ve({userMessage:e,color:t,dimColor:n,isCurrent:r,paddingRight:i}){let{columns:a}=le();if(r)return(0,q.jsx)(L,{width:`100%`,children:(0,q.jsx)(R,{italic:!0,color:t,dimColor:n,children:`(current)`})});let o=e.message.content,s=typeof o==`string`?null:o[o.length-1],c=B(typeof o==`string`?o.trim():s&&Ie(s)?s.text.trim():`(no prompt)`);if(ie(c))return(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsx)(R,{italic:!0,color:t,dimColor:n,children:`((empty message))`})});if(c.includes(`<bash-input>`)){let e=P(c,`bash-input`);if(e)return(0,q.jsxs)(L,{flexDirection:`row`,width:`100%`,children:[(0,q.jsx)(R,{color:`bashBorder`,children:`!`}),(0,q.jsxs)(R,{color:t,dimColor:n,children:[` `,e]})]})}if(c.includes(`<command-message>`)){let e=P(c,ve),r=P(c,`command-args`),i=P(c,`skill-format`)===`true`;if(e)return i?(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsxs)(R,{color:t,dimColor:n,children:[`Skill(`,e,`)`]})}):(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsxs)(R,{color:t,dimColor:n,children:[`/`,e,` `,r]})})}return(0,q.jsx)(L,{flexDirection:`row`,width:`100%`,children:(0,q.jsx)(R,{color:t,dimColor:n,children:i?ye(c,a-i,!0):c.slice(0,500).split(`
|
|
2
|
+
`).slice(0,4).join(`
|
|
3
|
+
`)})})}function He(e,t,n){let r=e.findIndex(e=>e.uuid===t);if(r===-1)return;let i=n?e.findIndex(e=>e.uuid===n):e.length;i===-1&&(i=e.length);let a=[],o=0,s=0;for(let t=r+1;t<i;t++){let n=e[t];if(!n||!y(n))continue;let r=n.toolUseResult;if(!(!r?.filePath||!r.structuredPatch)){a.includes(r.filePath)||a.push(r.filePath);try{if(`type`in r&&r.type===`create`)o+=r.content.split(/\r?\n/).length;else for(let e of r.structuredPatch){let t=z(e.lines,e=>e.startsWith(`+`)),n=z(e.lines,e=>e.startsWith(`-`));o+=t,s+=n}}catch{}}}return{filesChanged:a,insertions:o,deletions:s}}function Q(e){if(e.type!==`user`||Array.isArray(e.message.content)&&e.message.content[0]?.type===`tool_result`||b(e)||e.isMeta||e.isCompactSummary||e.isVisibleInTranscriptOnly)return!1;let t=e.message.content,n=typeof t==`string`?null:t[t.length-1],r=typeof t==`string`?t.trim():n&&Ie(n)?n.text.trim():``;return!(r.indexOf(`<local-command-stdout>`)!==-1||r.indexOf(`<local-command-stderr>`)!==-1||r.indexOf(`<bash-stdout>`)!==-1||r.indexOf(`<bash-stderr>`)!==-1||r.indexOf(`<task-notification>`)!==-1||r.indexOf(`<tick>`)!==-1)}function Ue(e,t){for(let n=t+1;n<e.length;n++){let t=e[n];if(t&&!b(t)&&!y(t)&&t.type!==`progress`&&t.type!==`system`&&t.type!==`attachment`&&!(t.type===`user`&&t.isMeta)){if(t.type===`assistant`){let e=t.message.content;if(Array.isArray(e)&&e.some(e=>e.type===`text`&&e.text.trim()||e.type===`tool_use`))return!1;continue}if(t.type===`user`)return!1}}return!0}var $,We=e((()=>{r(),H(),x(),C(),Oe(),E(),d(),a(),h(),re(),$=7}));export{Q as a,Ue as i,Fe as n,Me as o,We as r,Z as t};
|