claude-code-best 2.8.1 → 2.8.2
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-CNyPaerF.js → AddWorkspaceDirectory-BCCbaWoh.js} +1 -1
- package/dist/chunks/{App-hiKxO6UA.js → App-BIAYUFvT.js} +1 -1
- package/dist/chunks/{ApproveApiKey-Cd43j9Wa.js → ApproveApiKey-DRARgWX3.js} +1 -1
- package/dist/chunks/ApproveApiKey-Do-Qth0X.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-C8OxwSGM.js → AssistantSessionChooser-eUrEGDlX.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-VKhuyQLe.js → BackgroundTasksDialog-DSeAqhMC.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-Ddjzluka.js → BypassPermissionsModeDialog-8z7R5EpU.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-BhvrEJlm.js → ClaudeInChromeOnboarding-B7mDm5Hb.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-DoNd72PS.js → ClaudeMdExternalIncludesDialog-DE9dpWtg.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DTZS-dek.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-UcQCmIWd.js +1 -0
- package/dist/chunks/{DesktopHandoff-DVUOZjb0.js → DesktopHandoff-Ce0nE7D6.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-DJbRHAIy.js → DevChannelsDialog-mt0lA5wR.js} +1 -1
- package/dist/chunks/{DiffDialog-D0RK4t-9.js → DiffDialog-BfSnz8L-.js} +1 -1
- package/dist/chunks/{Doctor-0Nv3L1Oy.js → Doctor-BOVjkAKn.js} +1 -1
- package/dist/chunks/Doctor-osWC5WVY.js +1 -0
- package/dist/chunks/{ExitFlow-BPbtGcEg.js → ExitFlow-C3BGvwv-.js} +1 -1
- package/dist/chunks/{Feedback-BSagYjmf.js → Feedback-BtZb1A8b.js} +1 -1
- package/dist/chunks/Grove-DyC_Wrfx.js +1 -0
- package/dist/chunks/{Grove-BrP9JNpK.js → Grove-HpMLktXp.js} +1 -1
- package/dist/chunks/{HybridTransport-DLaxmXCR.js → HybridTransport-COk7jAC7.js} +1 -1
- package/dist/chunks/{ITermBackend-tXN55G2D.js → ITermBackend-BlwyeN8U.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-BzFQdfwu.js → InvalidConfigDialog-QVIRDXwA.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-KFg61s41.js → InvalidSettingsDialog-CZRZm0oa.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-N-oJu3qn.js → MCPConnectionManager-2Fulnp8q.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-DsHSSgsx.js → McpParsingWarnings-DWMO0bV6.js} +1 -1
- package/dist/chunks/{MessageSelector-D10JMnsc.js → MessageSelector-B4jJQ-KQ.js} +1 -1
- package/dist/chunks/{Messages-CQdQJ2AA.js → Messages-ltcn1Qkf.js} +2 -2
- package/dist/chunks/{Onboarding-DBJX6Cnf.js → Onboarding-CHcND5Tt.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-B4beCEX2.js → OverageCreditUpsell-CMBqZrnz.js} +1 -1
- package/dist/chunks/{PluginSettings-BBrFCSpQ.js → PluginSettings-DIS_qrVA.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-Bjjr3tYl.js → PromptInputHelpMenu-CAwbW7z2.js} +1 -1
- package/dist/chunks/{QueryEngine-BSk8-8vB.js → QueryEngine-BQs519Rb.js} +1 -1
- package/dist/chunks/REPL-DJh_wVWI.js +1 -0
- package/dist/chunks/{REPL-CXcCBQuz.js → REPL-Dx3SPe95.js} +6 -6
- package/dist/chunks/{RemoteCallout-CuxqarhC.js → RemoteCallout-CwI1mLQ9.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-BhPF41Wn.js → RemoteSessionManager-BXMBhfQD.js} +1 -1
- package/dist/chunks/{ResumeConversation-hmIOkZ2U.js → ResumeConversation-BK7L_YBI.js} +1 -1
- package/dist/chunks/{SSETransport-8yaTbdSK.js → SSETransport-Co-0nMlR.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DVi-ggud.js +1 -0
- package/dist/chunks/SentryErrorBoundary-DLML64E_.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-ydwbrVTx.js → SentryErrorBoundary-kEgE7qeH.js} +1 -1
- package/dist/chunks/{Settings-BSbzT25q.js → Settings-DOve7mW1.js} +2 -2
- package/dist/chunks/{TeleportProgress-CNcl_DxR.js → TeleportProgress--n-u7MYY.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-DJc8_mjE.js → TeleportRepoMismatchDialog-CzQzdYb2.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-Cw438s-J.js → TeleportResumeWrapper-CtANoO1Z.js} +1 -1
- package/dist/chunks/{ThemePicker-8X6yAwuQ.js → ThemePicker-kBt6obJb.js} +1 -1
- package/dist/chunks/{TmuxBackend-CqAnVFoI.js → TmuxBackend-Q5xdOkW4.js} +1 -1
- package/dist/chunks/{TrustDialog-Ch1FJzxi.js → TrustDialog-CoCFqyRD.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-sgfvJPWZ.js → ValidationErrorsList-CL42YlaS.js} +1 -1
- package/dist/chunks/{WelcomeV2-Bu8l3w90.js → WelcomeV2-B0d9sH1c.js} +1 -1
- package/dist/chunks/{WindowsTerminalBackend-Bvq7nHOp.js → WindowsTerminalBackend-CLSeqqHh.js} +1 -1
- package/dist/chunks/{add-dir-DqrRNnxe.js → add-dir-IrADCHV-.js} +1 -1
- package/dist/chunks/{agentDisplay-DcxzWi1v.js → agentDisplay-BUXpQhYh.js} +1 -1
- package/dist/chunks/{agents-QqLm1wcM.js → agents-BqQtaTaM.js} +1 -1
- package/dist/chunks/{agents-Do1ynqiW.js → agents-Cx0f6suK.js} +1 -1
- package/dist/chunks/{ant-D5gD6O-r.js → ant-BUkS8Em4.js} +1 -1
- package/dist/chunks/api-CoBZPEi-.js +1 -0
- package/dist/chunks/{api-hcsOinLV.js → api-Cy1N7XAQ.js} +1 -1
- package/dist/chunks/assistant-B2_c5C4T.js +1 -0
- package/dist/chunks/{assistant-DkECAILU.js → assistant-BGzd9a5x.js} +1 -1
- package/dist/chunks/{assistant-CemNvrYr.js → assistant-C3dP-BSJ.js} +1 -1
- package/dist/chunks/auth-CRVuUNwf.js +1 -0
- package/dist/chunks/{auth-Dm8aWPRh.js → auth-DVtMm7Hj.js} +1 -1
- package/dist/chunks/{autoMode-dygqoN_C.js → autoMode-ThlM20qr.js} +1 -1
- package/dist/chunks/{autonomy-BdxnxJnk.js → autonomy-B637YdCF.js} +1 -1
- package/dist/chunks/{autonomy-DPeEmb00.js → autonomy-B_vxYZbV.js} +1 -1
- package/dist/chunks/{autonomyPanel-Bocl2taZ.js → autonomyPanel-BM2VhTsn.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BWAfdRVf.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-zf-tDimg.js → backgroundHousekeeping-Cll7XHG1.js} +2 -2
- package/dist/chunks/{branch-DwdVgun5.js → branch-BlH5WYNu.js} +1 -1
- package/dist/chunks/{bridge-DkkMogD_.js → bridge-QRFJRzVG.js} +2 -2
- package/dist/chunks/{bridgeConfig-l6Ldi_hk.js → bridgeConfig-Di9LziJ3.js} +1 -1
- package/dist/chunks/bridgeConfig-pVTHa_ED.js +1 -0
- package/dist/chunks/bridgeEnabled-c_BeJX3S.js +1 -0
- package/dist/chunks/{bridgeEnabled-DYclTb9d.js → bridgeEnabled-z1fPRzzV.js} +1 -1
- package/dist/chunks/bridgeMain-CHk_DCxy.js +1 -0
- package/dist/chunks/{bridgeMain-Ct5oDosG.js → bridgeMain-DVoobI7G.js} +6 -6
- package/dist/chunks/{bridgeMessaging-CYe1Cixl.js → bridgeMessaging-BG8fNZac.js} +1 -1
- package/dist/chunks/{btw-CyOlY5R-.js → btw-DpeWZQbf.js} +1 -1
- package/dist/chunks/{buddy-q-utA1_5.js → buddy-Bni2g0Km.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-CTrRxzdz.js → bypassPermissionsKillswitch-7e56Rquc.js} +1 -1
- package/dist/chunks/caches-3byHT6VF.js +1 -0
- package/dist/chunks/{caches-Bz4yVQyE.js → caches-CzEBsMvP.js} +2 -2
- package/dist/chunks/{ccrClient-DXiEw9xU.js → ccrClient-iR6zwGb1.js} +1 -1
- package/dist/chunks/changeDetector-Cg75mKOu.js +1 -0
- package/dist/chunks/channelNotification-BSmZprUZ.js +1 -0
- package/dist/chunks/{channelNotification-CLPdvxGZ.js → channelNotification-CSmLgwtO.js} +1 -1
- package/dist/chunks/{chrome-DxbhLWDW.js → chrome-BO1vbvZ0.js} +1 -1
- package/dist/chunks/clear-CTOCrXv_.js +1 -0
- package/dist/chunks/client-BgdjJNnC.js +1 -0
- package/dist/chunks/{color-DiLtK8_L.js → color-BP4FmcMn.js} +1 -1
- package/dist/chunks/commands-CkfOhzGE.js +1 -0
- package/dist/chunks/commitAttribution-DKvggTZx.js +1 -0
- package/dist/chunks/{commitAttribution-CJXF8wMs.js → commitAttribution-Djh1ZpYH.js} +1 -1
- package/dist/chunks/{compact-C6xm1N5a.js → compact-BtAvCkY0.js} +1 -1
- package/dist/chunks/{companion-rXSt0nmz.js → companion-C-jfFhlz.js} +1 -1
- package/dist/chunks/{config-CzC08IjE.js → config-CloXpblh.js} +1 -1
- package/dist/chunks/{config-BE3jrcr-.js → config-DwsIX0hc.js} +1 -1
- package/dist/chunks/{context-BHE99SMA.js → context-DdwMoH4j.js} +1 -1
- package/dist/chunks/{context-noninteractive-BZQIUH_y.js → context-noninteractive-BWbEqad6.js} +1 -1
- package/dist/chunks/context-noninteractive-DNOyQYnM.js +1 -0
- package/dist/chunks/{conversation-CBPRFDod.js → conversation-DR4MFYYi.js} +1 -1
- package/dist/chunks/conversation-DVhyJA1O.js +1 -0
- package/dist/chunks/{copy-TgphIVzy.js → copy-tl-41wwU.js} +1 -1
- package/dist/chunks/{createSSHSession-CSKEZ4ic.js → createSSHSession-B_IyqOll.js} +1 -1
- package/dist/chunks/createSession-CIM50iEU.js +1 -0
- package/dist/chunks/{createSession-Ce218tQj.js → createSession-Csaqw8kb.js} +1 -1
- package/dist/chunks/{cronJitterConfig-CnKed5Gi.js → cronJitterConfig-2sHTXBLu.js} +1 -1
- package/dist/chunks/{crossProjectResume-BFlsTYOq.js → crossProjectResume-C1I0X__e.js} +1 -1
- package/dist/chunks/{datadog-D5jSRybW.js → datadog-BzkFYNcv.js} +1 -1
- package/dist/chunks/datadog-vQKKqB6Z.js +1 -0
- package/dist/chunks/{desktop-cjA0tGOa.js → desktop-oTXppB2O.js} +1 -1
- package/dist/chunks/{diff-DMd61IjE.js → diff-B23DUoT8.js} +1 -1
- package/dist/chunks/{doctor-ueUYyjyL.js → doctor-o2MJvjAE.js} +1 -1
- package/dist/chunks/{effort-B9IvAstG.js → effort-B1X_S_oa.js} +1 -1
- package/dist/chunks/{entry-Bq_KRMWs.js → entry-BAXMpXJ0.js} +5 -5
- package/dist/chunks/envLessBridgeConfig-Dj0umjOo.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-CpjlwmvF.js → envLessBridgeConfig-YNTOVEqU.js} +1 -1
- package/dist/chunks/{exit-DtjFIrvJ.js → exit-CwGJifQF.js} +1 -1
- package/dist/chunks/{export-CP638-TO.js → export-CqbYdFmJ.js} +1 -1
- package/dist/chunks/{exportRenderer-B5emJDvn.js → exportRenderer-DP_z8YD1.js} +1 -1
- package/dist/chunks/extra-usage-1FUBiJOE.js +1 -0
- package/dist/chunks/{extra-usage-DIm8nrKj.js → extra-usage-BQ5Z1wJb.js} +1 -1
- package/dist/chunks/{extra-usage-core-DERKSEe1.js → extra-usage-core-B1oJoxYa.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-Dq5dog_-.js → extra-usage-noninteractive-BV_6cpdd.js} +1 -1
- package/dist/chunks/{extraUsage-BMvDY0Sk.js → extraUsage-Ca_6qcke.js} +1 -1
- package/dist/chunks/extractMemories-B-yrLjpP.js +1 -0
- package/dist/chunks/{fast-BP2t1xDM.js → fast-BJMGfO_S.js} +1 -1
- package/dist/chunks/fast-CFtN26up.js +1 -0
- package/dist/chunks/{feedback-C-mR6zJr.js → feedback-O0Gushxg.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-sMmHdYjg.js → firstPartyEventLogger-0s2WJ6SR.js} +1 -1
- package/dist/chunks/{flushGate-C18XwNsa.js → flushGate-CLjpgnG6.js} +1 -1
- package/dist/chunks/gates-4fq2Ws2D.js +1 -0
- package/dist/chunks/{gates-Be5r2kKS.js → gates-C5y8P5t9.js} +1 -1
- package/dist/chunks/{gemini-BberPcp1.js → gemini-D6lfJRGH.js} +1 -1
- package/dist/chunks/{generateRecap-B76UcVUS.js → generateRecap-AYujRzfu.js} +1 -1
- package/dist/chunks/{generateSessionName-BwtXd8TC.js → generateSessionName-CXg1uVLN.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-5IlVgR2l.js → githubRepoPathMapping-CdjkMIX3.js} +1 -1
- package/dist/chunks/{goal-DQ0jNcLO.js → goal-BGr-SlcA.js} +1 -1
- package/dist/chunks/{grok-Dh_thT2_.js → grok-DxyRt4Jq.js} +1 -1
- package/dist/chunks/{growthbook-4ADV3CAt.js → growthbook-D93ZmHUL.js} +1 -1
- package/dist/chunks/{heapdump-Dwqmh4SX.js → heapdump-DZz5qnZg.js} +1 -1
- package/dist/chunks/{help-Bznaywoi.js → help-C8HhaC70.js} +1 -1
- package/dist/chunks/hooks-CmW7bdtz.js +1 -0
- package/dist/chunks/{hooks-F-82cg6M.js → hooks-De2yBPig.js} +1 -1
- package/dist/chunks/{hostAdapter-DpfLr3hX.js → hostAdapter-CZdJUeS1.js} +1 -1
- package/dist/chunks/{ide-BfAKWufQ.js → ide-GnSLasRI.js} +1 -1
- package/dist/chunks/{inboundAttachments-CFV_eqMu.js → inboundAttachments-C8y3D5mp.js} +1 -1
- package/dist/chunks/inboundAttachments-DZiITyN8.js +1 -0
- package/dist/chunks/{initReplBridge-DV9KhSic.js → initReplBridge-YGXqLbNZ.js} +1 -1
- package/dist/chunks/{insights-BNsCwNYa.js → insights-23tyPxXV.js} +1 -1
- package/dist/chunks/{install-Bszzs98N.js → install-BXi4d63r.js} +1 -1
- package/dist/chunks/{install-github-app-DVxGR2rp.js → install-github-app-D2X7BgzJ.js} +1 -1
- package/dist/chunks/{install-slack-app-CjlRL19o.js → install-slack-app-_J1t0kSP.js} +1 -1
- package/dist/chunks/{instrumentation-BOYPOtyu.js → instrumentation-C9WDRy-K.js} +3 -3
- package/dist/chunks/{job-BvD5_lGz.js → job-DXX7dNN_.js} +1 -1
- package/dist/chunks/{keybindings-RPmPPGhp.js → keybindings-CChhkkE0.js} +1 -1
- package/dist/chunks/{lang-9VNaOJMz.js → lang-COIVItM_.js} +1 -1
- package/dist/chunks/language-CiMwEWO-.js +1 -0
- package/dist/chunks/{language-Ct5Nkqm6.js → language-DzWvcLCu.js} +1 -1
- package/dist/chunks/{launchAgentsPlatform-CnoxFIXV.js → launchAgentsPlatform-Du_WvKeU.js} +1 -1
- package/dist/chunks/{launchAutofixPr-ChaDUtvx.js → launchAutofixPr-CypNniKH.js} +1 -1
- package/dist/chunks/{launchLocalMemory-MwZfEJxz.js → launchLocalMemory-GkqB_Gcr.js} +1 -1
- package/dist/chunks/{launchLocalVault-B6Ib5WXx.js → launchLocalVault-CBihJDzq.js} +1 -1
- package/dist/chunks/{launchMemoryStores-D6xyGwQ1.js → launchMemoryStores-BkK0wwq0.js} +1 -1
- package/dist/chunks/{launchOnboarding-BtdAOO3p.js → launchOnboarding-BubTG5vY.js} +1 -1
- package/dist/chunks/{launchSchedule-XVljzNKg.js → launchSchedule-CkV6Ai-0.js} +1 -1
- package/dist/chunks/{launchSkillStore-QT8Qcc5N.js → launchSkillStore-DIrFg_WZ.js} +1 -1
- package/dist/chunks/{launchTeleport-DwxPesKQ.js → launchTeleport-DFrgN9sU.js} +1 -1
- package/dist/chunks/{launchVault-Dbti6pph.js → launchVault-CIiNsg91.js} +1 -1
- package/dist/chunks/loadAgentsDir-CjhNkoq0.js +1 -0
- package/dist/chunks/{loadAgentsDir-BYWykYwn.js → loadAgentsDir-DC4jN6-f.js} +53 -53
- package/dist/chunks/{loadPluginHooks-2U3UO__Q.js → loadPluginHooks-DukITDP2.js} +1 -1
- package/dist/chunks/{localSearch-eWjZxMc8.js → localSearch-But4wyLg.js} +1 -1
- package/dist/chunks/localSearch-D8FFon8N.js +1 -0
- package/dist/chunks/login-B3TV33p4.js +1 -0
- package/dist/chunks/{login-D1aQCqp0.js → login-ajsn1Sg7.js} +1 -1
- package/dist/chunks/{logoV2Utils-CPNvLtol.js → logoV2Utils-CpeUvaOM.js} +1 -1
- package/dist/chunks/logout-BqbTEPv9.js +1 -0
- package/dist/chunks/{magicDocs-DAvjAbAJ.js → magicDocs-TF6U6QoB.js} +1 -1
- package/dist/chunks/{main-BKlQiSuc.js → main-bjQRqaUr.js} +15 -15
- package/dist/chunks/mappers-Bg-xtimK.js +1 -0
- package/dist/chunks/{mcp-Cmw8ecKk.js → mcp-DtHGTZUo.js} +1 -1
- package/dist/chunks/{mcp-C3jlClk0.js → mcp-Vj0ijoSq.js} +2 -2
- package/dist/chunks/{mcp-ya96irNP.js → mcp-i8lqdWTr.js} +1 -1
- package/dist/chunks/{mcpServer-B1q9blAc.js → mcpServer-CuqaXxiJ.js} +1 -1
- package/dist/chunks/{mcpServer-BJB5g6j2.js → mcpServer-Dr9UfcEd.js} +1 -1
- package/dist/chunks/{memory-CxiukAGg.js → memory-DVJxsbcO.js} +1 -1
- package/dist/chunks/{mode-DqAJ2y6R.js → mode-C9yWWppB.js} +1 -1
- package/dist/chunks/model-BYSyXf9-.js +1 -0
- package/dist/chunks/{model-C8TW-qjl.js → model-Dq-13vaB.js} +1 -1
- package/dist/chunks/{onChangeAppState-BG1pF7ht.js → onChangeAppState-Cc4zOnqx.js} +1 -1
- package/dist/chunks/{openai-CHoRhRtf.js → openai-DMCGGZts.js} +1 -1
- package/dist/chunks/{overageCreditGrant-DYMg1lV4.js → overageCreditGrant-CzkWDmsQ.js} +1 -1
- package/dist/chunks/{panelCall-SYrmrKt9.js → panelCall-D36EWzwF.js} +1 -1
- package/dist/chunks/{passes-CSV-SZJc.js → passes-CPAwB9_F.js} +1 -1
- package/dist/chunks/{paths-BZjPDxMm.js → paths-CEAy4QCs.js} +2 -2
- package/dist/chunks/{permissions-DBddT2NP.js → permissions-B39hfy0O.js} +1 -1
- package/dist/chunks/{pipeTransport-uK7GxbSG.js → pipeTransport-7auNUakO.js} +1 -1
- package/dist/chunks/{plan-DEbo-Adi.js → plan-pCEs76NM.js} +1 -1
- package/dist/chunks/{plugin-Cops24hg.js → plugin-BSC-7wQh.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-Bg7JMOHN.js → pluginAutoupdate-Cre72Rtf.js} +1 -1
- package/dist/chunks/{pluginBlocklist-DEM_RWc2.js → pluginBlocklist-D2Cj4TR2.js} +1 -1
- package/dist/chunks/{pluginCliCommands-DyYEg7Cv.js → pluginCliCommands-CTxmCPph.js} +1 -1
- package/dist/chunks/{pluginFlagging-DwChUZMJ.js → pluginFlagging-C5EGcjZe.js} +1 -1
- package/dist/chunks/{pluginOperations-COyT4tHs.js → pluginOperations-DDI1CG0K.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DCxJJkYs.js → pluginStartupCheck-B3QqfRt6.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DYC8CWxw.js +1 -0
- package/dist/chunks/{plugins-BanQjHmw.js → plugins-Bz7JxD43.js} +1 -1
- package/dist/chunks/policyLimits-C-oHygGe.js +1 -0
- package/dist/chunks/{pollConfig-DBNHhvHf.js → pollConfig-CyO4Ycwc.js} +1 -1
- package/dist/chunks/{poor-aPQce502.js → poor-eRoBwI0Z.js} +1 -1
- package/dist/chunks/{poorMode-CFRuV-nB.js → poorMode-BdNsLBQ-.js} +1 -1
- package/dist/chunks/poorMode-D2-4vRxb.js +1 -0
- package/dist/chunks/{print-Cf2tY__0.js → print-Ogibzjap.js} +4 -4
- package/dist/chunks/{privacy-settings-CYkM3Aem.js → privacy-settings-Dd7PtKbY.js} +1 -1
- package/dist/chunks/{processBashCommand-BLSC8o8M.js → processBashCommand-BjdUo_Na.js} +1 -1
- package/dist/chunks/{processSlashCommand-Ch9B-6nh.js → processSlashCommand-tetvMLMl.js} +1 -1
- package/dist/chunks/prompt-BHI7PZe4.js +227 -0
- package/dist/chunks/prompt-DZ1EAUlC.js +1 -0
- package/dist/chunks/prompt-DeRHlPn1.js +1 -0
- package/dist/chunks/{promptEditor-U03qQWbq.js → promptEditor-DoJ-xPi4.js} +1 -1
- package/dist/chunks/{protocolHandler-3yBj9w5N.js → protocolHandler-Dgzu5UWb.js} +1 -1
- package/dist/chunks/{rate-limit-options-D-xl_9PO.js → rate-limit-options-B6QH2-xn.js} +1 -1
- package/dist/chunks/{rcDebugLog-ClX1msJX.js → rcDebugLog-C0Bam8V9.js} +1 -1
- package/dist/chunks/{referral-qe-yqXJE.js → referral-B10JtHMk.js} +1 -1
- package/dist/chunks/{refresh-CO_P3WKA.js → refresh-DmEsCaJ0.js} +1 -1
- package/dist/chunks/{registerProtocol-CClQph00.js → registerProtocol-CQjmvg7a.js} +1 -1
- package/dist/chunks/{registry-C0zdU2Hb.js → registry-CLaXh4Gk.js} +1 -1
- package/dist/chunks/{release-notes-CyZHxWTF.js → release-notes-dxng0ob_.js} +1 -1
- package/dist/chunks/{releaseNotes-BtxL5R5Q.js → releaseNotes-CS5L5W0H.js} +2 -2
- package/dist/chunks/{reload-plugins-B0eR8JHH.js → reload-plugins-CgzAjBDp.js} +1 -1
- package/dist/chunks/{remote-env-B_sIjY87.js → remote-env-BasfU8Ra.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-C3WRaLpU.js → remoteBridgeCore-IJI5koHz.js} +1 -1
- package/dist/chunks/{remoteControlServer-BOj9qmgH.js → remoteControlServer-BBCt7ySV.js} +1 -1
- package/dist/chunks/{rename-BFAC3WLD.js → rename-eEdSZsJ2.js} +1 -1
- package/dist/chunks/{resume-CpivBr9S.js → resume-DjnfattK.js} +1 -1
- package/dist/chunks/{runtimeObserver-sOnfVR7t.js → runtimeObserver-ByTBtmBf.js} +2 -2
- package/dist/chunks/{runtimeObserver-C2_7Vsnd.js → runtimeObserver-COpkJmg-.js} +1 -1
- package/dist/chunks/sandbox-adapter-DagBhoTC.js +1 -0
- package/dist/chunks/{sandbox-toggle-Bv68-Ca7.js → sandbox-toggle-CQohaYND.js} +1 -1
- package/dist/chunks/searchExtraTools-kk-wV-cC.js +1 -0
- package/dist/chunks/{sentry-BBCn6RGP.js → sentry-C0bQlih_.js} +1 -1
- package/dist/chunks/{session-DfvxYP8o.js → session-Dx_ODOHl.js} +1 -1
- package/dist/chunks/{sessionDiscovery-CyuRBTAm.js → sessionDiscovery-DAqs0Ra6.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-C-Ic-0Ry.js +1 -0
- package/dist/chunks/sessionMemory-BMtFup-Y.js +1 -0
- package/dist/chunks/{sessionMemory-kYQnpcyG.js → sessionMemory-Bq3ECr1S.js} +1 -1
- package/dist/chunks/sessionMemoryUtils-BU7N_IQG.js +1 -0
- package/dist/chunks/sessionObserver-BwAfzGUg.js +1 -0
- package/dist/chunks/{sessionObserver-CTkIYplM.js → sessionObserver-rd6RRTzc.js} +1 -1
- package/dist/chunks/sessionStorage-X2u45U9z.js +1 -0
- package/dist/chunks/{sessionTitle-ePQRpeV2.js → sessionTitle-1k_2BhFL.js} +1 -1
- package/dist/chunks/{sessionTracing-81-RIJBo.js → sessionTracing-DNSDPYdR.js} +1 -1
- package/dist/chunks/{settingsSync-DEFWnE1o.js → settingsSync-3xG2A_wN.js} +1 -1
- package/dist/chunks/{setup-BJSk1czd.js → setup-C2V4elOv.js} +2 -2
- package/dist/chunks/{setup-2611vmGJ.js → setup-CY808VaY.js} +1 -1
- package/dist/chunks/{setup-CTfYsKsz.js → setup-Hlga8GJ_.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-CGD7Nx03.js → shadowedRuleDetection-BdBNo5eP.js} +1 -1
- package/dist/chunks/{sideQuestion-BcP9Mm-5.js → sideQuestion-DWOCUKMh.js} +1 -1
- package/dist/chunks/{sink-D_t1TIt9.js → sink-DCh0VJ4g.js} +1 -1
- package/dist/chunks/sink-nZmawD5W.js +1 -0
- package/dist/chunks/sinks-BTZnXPr_.js +1 -0
- package/dist/chunks/{sinks-DXsozhmS.js → sinks-_9T2oPB_.js} +2 -2
- package/dist/chunks/{skill-learning-CZm2iMik.js → skill-learning-CzZFGFZO.js} +1 -1
- package/dist/chunks/{skillChangeDetector-1aFn40GC.js → skillChangeDetector-345QNWDp.js} +1 -1
- package/dist/chunks/{skillGapStore-cWo6Ra90.js → skillGapStore-Bz_qbwI1.js} +2 -2
- package/dist/chunks/{skillGapStore-DzHv8v-D.js → skillGapStore-DJm3SULe.js} +1 -1
- package/dist/chunks/{skillGenerator-D_W1IeP3.js → skillGenerator-BcNv-VZ5.js} +2 -2
- package/dist/chunks/skillLearning-BJAfTX2G.js +1 -0
- package/dist/chunks/skillLearning-DPhuKS4j.js +1 -0
- package/dist/chunks/{skillPanel-ChmOZu4F.js → skillPanel-Q85P-Gg4.js} +3 -3
- package/dist/chunks/{skillSearchPanel-CVx2b4Pr.js → skillSearchPanel-CMCQDAcX.js} +2 -2
- package/dist/chunks/{skills-CWX1SydA.js → skills-D3eUg3HG.js} +1 -1
- package/dist/chunks/{sprites-BuvEFwW6.js → sprites-ChoMSqpa.js} +1 -1
- package/dist/chunks/{stats-wjMQA-CA.js → stats-DdhEa_6-.js} +1 -1
- package/dist/chunks/{status-CyU7IQhO.js → status-CX7Kgn21.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-JNibsI_v.js → statusNoticeHelpers-AibXOONm.js} +1 -1
- package/dist/chunks/{tag-opEEZI5B.js → tag-BJ_u3aJm.js} +1 -1
- package/dist/chunks/{tasks-CCtnU5u1.js → tasks-DeEWOchP.js} +1 -1
- package/dist/chunks/teamHelpers-CxoQp7OY.js +1 -0
- package/dist/chunks/{teamHelpers-BJJs8taN.js → teamHelpers-WmWa_h3B.js} +1 -1
- package/dist/chunks/{teammateModeSnapshot-CLiiOCkO.js → teammateModeSnapshot-DZ6ulELC.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-KWxn1jxl.js +1 -0
- package/dist/chunks/{teleport-ClxQigSQ.js → teleport-CuDXJj_f.js} +1 -1
- package/dist/chunks/{templateJobs-C6D7GC-Q.js → templateJobs-nFBp68za.js} +1 -1
- package/dist/chunks/{terminalSetup-B3bN4Cj8.js → terminalSetup-BORjK3qH.js} +1 -1
- package/dist/chunks/{terminalSetup-2ioFcRAA.js → terminalSetup-DULcnnWe.js} +1 -1
- package/dist/chunks/{theme-Dgq_Og2P.js → theme-Bf2QD0ja.js} +1 -1
- package/dist/chunks/thinkback-C1nnGg5r.js +1 -0
- package/dist/chunks/{thinkback-C43WBHis.js → thinkback-DZEhr3Ii.js} +1 -1
- package/dist/chunks/{thinkback-play-D2_n_aoQ.js → thinkback-play-BtEBESXM.js} +1 -1
- package/dist/chunks/{toolEventObserver-BG_3sGCL.js → toolEventObserver-CNZy5TpN.js} +1 -1
- package/dist/chunks/{toolEventObserver-B7EA-nNa.js → toolEventObserver-DMdrez6V.js} +1 -1
- package/dist/chunks/toolPool-DDj2TbY6.js +1 -0
- package/dist/chunks/{toolPool-HYKCHxDA.js → toolPool-DHQyHmDY.js} +1 -1
- package/dist/chunks/{trustedDevice-DeNxe6bl.js → trustedDevice-DWb5CPB_.js} +1 -1
- package/dist/chunks/{trustedDevice-S34i6Jc9.js → trustedDevice-Dw2crViN.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-C45bmZqN.js → ultrareviewCommand-BfN25zni.js} +1 -1
- package/dist/chunks/undercover-DSp7SB7e.js +1 -0
- package/dist/chunks/{undercover-DoUSM8d6.js → undercover-rcR56jZx.js} +1 -1
- package/dist/chunks/{updateCCB-BuAm25MX.js → updateCCB-DlTAqQJq.js} +1 -1
- package/dist/chunks/{upgrade-BDKg286g.js → upgrade-ClLcX7zy.js} +1 -1
- package/dist/chunks/upgrade-kf1QWUo7.js +1 -0
- package/dist/chunks/{upload-CMptZXZs.js → upload-BqEzK59v.js} +1 -1
- package/dist/chunks/{usage-Bw_LK9YI.js → usage-BgKDh8pQ.js} +1 -1
- package/dist/chunks/{usage-DEWsKPXj.js → usage-DW-akzSR.js} +1 -1
- package/dist/chunks/{useMainLoopModel-D0PmGDuy.js → useMainLoopModel-BTpZ8k3k.js} +1 -1
- package/dist/chunks/{useManagePlugins-B-ejJsXy.js → useManagePlugins-z0qezP5r.js} +1 -1
- package/dist/chunks/{useMergedTools-B6x9qtfj.js → useMergedTools-B78rAreW.js} +1 -1
- package/dist/chunks/{useSearchInput-BpMLsxaS.js → useSearchInput-CwxF3CHN.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DUe4k_RK.js → useSettingsErrors-CjDaon07.js} +1 -1
- package/dist/chunks/{useVoice-C3ryR2HE.js → useVoice-X5WSnyed.js} +1 -1
- package/dist/chunks/{util-DWl5gjmI.js → util-CP-_gsEO.js} +1 -1
- package/dist/chunks/utils-CULcnflj.js +1 -0
- package/dist/chunks/{validatePlugin-8EMSASvV.js → validatePlugin-DUuaprqR.js} +1 -1
- package/dist/chunks/{vim-CaZ20SrQ.js → vim-BfmsdxOa.js} +1 -1
- package/dist/chunks/{voice-BrnKguEV.js → voice-B3GIfFlB.js} +1 -1
- package/dist/chunks/voiceModeEnabled-BrA5ZhH4.js +1 -0
- package/dist/chunks/{voiceModeEnabled-3eg8vSqy.js → voiceModeEnabled-C1Q9j5q6.js} +1 -1
- package/dist/chunks/{voiceStreamSTT-D7jWIYwz.js → voiceStreamSTT-BguyxdrW.js} +1 -1
- package/dist/chunks/voiceStreamSTT-Dmp7Vm1S.js +1 -0
- package/dist/chunks/{web-tools-BT3TbzG5.js → web-tools-qf_VwWRn.js} +1 -1
- package/dist/chunks/{workerRegistry-C_i5wwjL.js → workerRegistry-SbiLJIsG.js} +1 -1
- package/dist/chunks/worktree-Djga1wtm.js +1 -0
- package/dist/chunks/{xml-DOXio8vw.js → xml-D7-jJqSA.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-DUoUTxFp.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-COO2W0ij.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-CPWq7O57.js +0 -1
- package/dist/chunks/Doctor-Ba9zhV0V.js +0 -1
- package/dist/chunks/Grove-DyvIToPa.js +0 -1
- package/dist/chunks/REPL-D-akKdFc.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-wDSdfnRo.js +0 -1
- package/dist/chunks/SentryErrorBoundary-Duyg6HeT.js +0 -1
- package/dist/chunks/api-VMfJpk1G.js +0 -1
- package/dist/chunks/assistant-D7D1sqTB.js +0 -1
- package/dist/chunks/auth-CGdLe3rq.js +0 -1
- package/dist/chunks/backgroundHousekeeping-4H6yTjsj.js +0 -1
- package/dist/chunks/bridgeConfig-CTJBoASk.js +0 -1
- package/dist/chunks/bridgeEnabled-SMuWz3Is.js +0 -1
- package/dist/chunks/bridgeMain-UqwOi37W.js +0 -1
- package/dist/chunks/caches-DKMoKTAZ.js +0 -1
- package/dist/chunks/changeDetector--KPj2maX.js +0 -1
- package/dist/chunks/channelNotification-fJgjqRMx.js +0 -1
- package/dist/chunks/clear-CYVCwiwu.js +0 -1
- package/dist/chunks/client-DvWRsIpi.js +0 -1
- package/dist/chunks/commands-BT2_ICaW.js +0 -1
- package/dist/chunks/commitAttribution-Bpbro1a4.js +0 -1
- package/dist/chunks/context-noninteractive-BQDOgVUW.js +0 -1
- package/dist/chunks/conversation-Bt6QdGd-.js +0 -1
- package/dist/chunks/createSession-BaHXBnfG.js +0 -1
- package/dist/chunks/datadog-DgYqUGa-.js +0 -1
- package/dist/chunks/envLessBridgeConfig-D_GCqhTu.js +0 -1
- package/dist/chunks/extra-usage-C4dUWLhg.js +0 -1
- package/dist/chunks/extractMemories-DS7XXeEo.js +0 -1
- package/dist/chunks/fast-D1xIHYaN.js +0 -1
- package/dist/chunks/gates-CUAwAhPL.js +0 -1
- package/dist/chunks/hooks-DynUngv2.js +0 -1
- package/dist/chunks/inboundAttachments-Cug-8Xdy.js +0 -1
- package/dist/chunks/language-CjFs6_la.js +0 -1
- package/dist/chunks/loadAgentsDir-tPgCg0WD.js +0 -1
- package/dist/chunks/localSearch-CxwxzM8W.js +0 -1
- package/dist/chunks/login-CVVFklZw.js +0 -1
- package/dist/chunks/logout-BYsszpXx.js +0 -1
- package/dist/chunks/mappers-BBkM1aA5.js +0 -1
- package/dist/chunks/model-VB4ItNVB.js +0 -1
- package/dist/chunks/pluginStartupCheck-DjfIaOch.js +0 -1
- package/dist/chunks/policyLimits-D-Y_soHx.js +0 -1
- package/dist/chunks/poorMode-DQagHYWe.js +0 -1
- package/dist/chunks/prompt-BGNhFY1n.js +0 -227
- package/dist/chunks/prompt-CrNwH5kr.js +0 -1
- package/dist/chunks/prompt-dH0MMivt.js +0 -1
- package/dist/chunks/sandbox-adapter-jX_WzvnK.js +0 -1
- package/dist/chunks/searchExtraTools-xPuOKDpi.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DiKsr7H7.js +0 -1
- package/dist/chunks/sessionMemory-C34-eFnJ.js +0 -1
- package/dist/chunks/sessionMemoryUtils-CcJcgftx.js +0 -1
- package/dist/chunks/sessionObserver-B73s6yu8.js +0 -1
- package/dist/chunks/sessionStorage-BHi7PKs-.js +0 -1
- package/dist/chunks/sink-i8NmYch9.js +0 -1
- package/dist/chunks/sinks-3w0mLszx.js +0 -1
- package/dist/chunks/skillLearning-Bddmbx8E.js +0 -1
- package/dist/chunks/skillLearning-C-uI_jZB.js +0 -1
- package/dist/chunks/teamHelpers-D41zdxpl.js +0 -1
- package/dist/chunks/teammateModeSnapshot-q-bARbLL.js +0 -1
- package/dist/chunks/thinkback-BE8NNmAo.js +0 -1
- package/dist/chunks/toolPool-BLshLuvo.js +0 -1
- package/dist/chunks/undercover-B4sdXe12.js +0 -1
- package/dist/chunks/upgrade-BiWGhm2d.js +0 -1
- package/dist/chunks/utils-DP3EtI6F.js +0 -1
- package/dist/chunks/voiceModeEnabled-B1ARFTcz.js +0 -1
- package/dist/chunks/voiceStreamSTT-CONK4g-B.js +0 -1
- package/dist/chunks/worktree-CFNQKVGn.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{f as i,l as a,n as o,s,u as c}from"./envUtils-BWeoiL4Y.js";import{g as l}from"./client-_sjL0I7A.js";import{n as u,t as d}from"./defineProperty-80gRi2ZW.js";import{n as f,t as p}from"./figures-gfT9mM8P.js";import{n as m,t as h}from"./axios-DhfaybwJ.js";import{Cn as g,Ln as _,un as v,vt as y,wn as b,yn as x}from"./schemas-BGAvj1T4.js";import{i as S,r as C,t as w}from"./v4-f1i_CNUT.js";import{A as T,B as E,Cn as D,Ct as O,F as k,Ft as A,I as j,In as M,K as N,Kt as P,L as ee,Ln as F,Lt as te,M as ne,O as I,Q as re,Rn as L,St as ie,T as ae,Tn as oe,Tt as se,U as ce,Ut as le,Wt as ue,Yt as de,Z as fe,at as pe,b as R,ct as me,en as z,f as B,g as he,gn as ge,h as _e,k as ve,m as ye,nt as V,ot as be,p as xe,qt as Se,t as H,tn as Ce,tt as we,v as Te,wn as Ee,wt as De,x as U,xt as Oe,z as ke,zt as Ae}from"./src-Di342QoJ.js";import{t as je}from"./jsx-runtime-D-D469L8.js";import{A as Me,Ar as Ne,Bt as Pe,Ct as Fe,Dt as Ie,Fr as Le,G as Re,Ht as ze,Jt as Be,K as Ve,Kt as He,Lt as Ue,Mr as We,Nt as Ge,Pr as Ke,Qt as qe,Rt as Je,S as Ye,Sn as Xe,U as Ze,Vt as Qe,W as $e,X as et,Xt as tt,Yt as nt,Zt as rt,an as it,bn as at,cn as ot,er as st,jn as ct,jr as lt,ln as ut,or as dt,ot as ft,qt as pt,rn as mt,sr as ht,tr as gt,tt as _t,ut as vt,vt as yt,xn as bt,y as xt,yn as St,zn as Ct,zt as wt}from"./state-sIHsFpDu.js";import{Ao as Tt,As as Et,Bc as Dt,Br as Ot,Cc as kt,Ci as At,Cs as jt,Da as Mt,Do as Nt,Dr as Pt,Ei as Ft,Et as It,Fa as Lt,Gs as Rt,Hr as zt,Hs as Bt,Ht as Vt,J as Ht,Ka as Ut,Ki as Wt,Kt as Gt,Lr as Kt,Mr as qt,Ms as Jt,Na as Yt,Oa as Xt,Os as Zt,Ot as Qt,Pr as $t,Ps as en,Pt as tn,Qa as nn,Rr as rn,S as an,Si as on,Ss as sn,St as cn,Ti as ln,Ts as un,Uc as dn,Ut as fn,Wr as pn,Xt as mn,Z as hn,_ as gn,_a as _n,a as vn,ac as W,ar as yn,bi as bn,bt as xn,cl as Sn,cn as Cn,ct as wn,d as Tn,dc as En,dn as Dn,dr as On,es as kn,fc as An,gn as jn,h as Mn,it as Nn,jr as Pn,js as Fn,ka as In,ks as Ln,kt as Rn,ll as zn,lo as Bn,mi as Vn,nl as Hn,no as Un,on as Wn,oo as Gn,or as Kn,qi as qn,rl as Jn,rt as Yn,s as Xn,tl as Zn,tn as Qn,us as $n,ut as er,vi as tr,w as nr,wi as rr,wt as ir,xi as ar,xn as or,xs as sr,ya as cr,yc as lr,yi as ur,yn as dr}from"./paths-BZjPDxMm.js";import{D as G,E as fr,G as pr,J as mr,O as hr,Q as K,U as gr,Z as _r,_ as vr,h as yr,j as br,l as q,p as J,x as xr,z as Sr}from"./debug-otxXY3j-.js";import{n as Cr,r as Y}from"./analytics-DqMQntaB.js";import{n as wr,t as Tr}from"./cwd--iizewsn.js";import{t as Er}from"./sdk-DEtgRZvI.js";import{F as Dr,P as Or,a as kr,f as Ar,i as jr,v as Mr}from"./git-C0IuvuIy.js";import{l as Nr,u as Pr}from"./oauth-CdZEzMww.js";import{n as Fr,t as Ir}from"./bundledMode-kSQejuY4.js";import{n as Lr,t as Rr}from"./which-BnEnzWhs.js";import{a as zr,i as Br,n as Vr}from"./env-C2A9gV_G.js";import{E as Hr,H as Ur,J as Wr,K as Gr,L as Kr,N as qr,V as Jr,W as Yr,et as Xr,o as Zr,s as Qr}from"./log-DSV4Ht5l.js";import{i as $r,o as ei}from"./platform-mh9ypxS8.js";import{n as ti,t as ni}from"./memoize-DJ1XCN-z.js";import{i as ri,n as ii,o as ai,r as oi}from"./path-BE28AJwZ.js";import{r as si,t as ci}from"./execFileNoThrow-azCkYhmF.js";import{s as li,u as ui}from"./types-KeqFPzY5.js";import{S as di,_ as fi,a as pi,b as mi,d as hi,f as gi,l as _i,n as vi,o as yi,r as bi,u as xi,v as Si,x as Ci}from"./teammate-CbskW5G9.js";import{c as wi,n as Ti,s as Ei,t as Di}from"./intl-CLeE9DsD.js";import{T as Oi,b as ki,d as Ai,f as ji,p as Mi,u as Ni,y as Pi}from"./startupProfiler-CBcN1Chw.js";import{n as Fi,t as Ii}from"./lazySchema-B0QShMaQ.js";import{a as Li,c as Ri,d as zi,l as Bi,o as Vi,r as Hi,s as Ui}from"./stringUtils-KZoO4GUd.js";import{$ as Wi,$A as Gi,$D as Ki,$E as qi,$S as Ji,$d as Yi,$f as Xi,$m as Zi,$n as Qi,$p as $i,$t as ea,$u as ta,$v as na,$y as ra,AD as ia,AS as aa,AT as oa,Ab as sa,Ah as ca,Ai as la,Ao as ua,Ar as da,Au as fa,Av as pa,Ax as ma,Ay as ha,BD as ga,BO as _a,BS as va,Bh as ya,Bm as ba,Bo as xa,Bp as Sa,Br as Ca,Bx as wa,CC as Ta,CE as Ea,CS as Da,Cb as Oa,Cg as ka,Cl as Aa,Cm as ja,Cn as Ma,Co as Na,Cy as Pa,D as Fa,DC as Ia,DO as La,DS as Ra,DT as za,Dd as Ba,Dg as Va,Dh as Ha,Di as Ua,Dm as Wa,Dp as Ga,Du as Ka,Dy as qa,EC as Ja,EO as Ya,ES as Xa,ET as Za,Eb as Qa,Ed as $a,Eg as eo,Eh as to,Em as no,Eo as ro,Eu as io,Ex as ao,F as oo,FA as so,FC as co,FD as lo,Fb as uo,Fc as fo,Fh as po,Fj as mo,Fm as ho,Fr as go,Fu as _o,Fx as vo,Fy as yo,G as bo,GD as xo,GE as So,GO as Co,GS as wo,GT as To,Gb as Eo,Gc as Do,Gd as Oo,Gf as ko,Gi as Ao,Gl as jo,Gn as Mo,Gp as No,Gs as Po,Gy as Fo,HE as Io,HO as Lo,HS as Ro,Ha as zo,Hf as Bo,Hi as Vo,Hk as Ho,Hl as Uo,Hn as Wo,Hp as Go,Hs as Ko,Hx as qo,ID as Jo,IE as Yo,IO as Xo,Ih as Zo,Ij as Qo,Ik as $o,Ir as es,Is as ts,Ix as ns,J as rs,JA as is,JD as as,JE as os,JO as ss,JS as cs,Jd as ls,Jf as us,Jg as ds,Jh as fs,Ji as ps,Jl as ms,Js as hs,Jv as gs,Jy as _s,K as vs,KC as ys,KD as bs,KE as xs,KO as Ss,KS as Cs,Ka as ws,Kc as Ts,Kd as Es,Kl as Ds,Kp as Os,Ks as ks,Ky as As,LD as js,LE as Ms,LO as Ns,Lb as Ps,Lc as Fs,Lh as Is,Lj as Ls,Lm as Rs,Lt as zs,MA as Bs,MC as Vs,MD as Hs,MS as Us,MT as Ws,Mb as Gs,Mc as Ks,Mh as qs,Mn as Js,Mo as Ys,Ms as Xs,Mu as Zs,N as Qs,ND as $s,NS as ec,N_ as tc,Nd as nc,Nh as rc,Nj as ic,No as ac,Nu as oc,Nv as sc,Nx as cc,O as lc,OC as uc,OS as dc,OT as fc,Ob as pc,Od as mc,Og as hc,Oi as gc,Om as _c,Op as vc,Ot as yc,Oy as bc,P as xc,PC as Sc,PD as Cc,P_ as wc,Pb as Tc,Pc as Ec,Pd as Dc,Ph as Oc,Pj as kc,Pk as Ac,Po as jc,Pu as Mc,Py as Nc,Q as Pc,QD as Fc,QE as Ic,QO as Lc,QS as Rc,QT as zc,Q_ as Bc,Qd as Vc,Qf as Hc,Qh as Uc,Qk as Wc,Qo as Gc,Qp as Kc,Qr as qc,Qs as Jc,Qu as Yc,Qv as Xc,Qy as Zc,RA as Qc,RD as $c,RE as el,RO as tl,R_ as nl,Rb as rl,Rc as il,Rh as al,Rk as ol,Rm as sl,Rn as cl,Rr as ll,Ry as ul,S as dl,SC as fl,SD as pl,SE as ml,SS as hl,ST as gl,Sb as _l,Sd as vl,Sg as yl,Si as bl,Sl as xl,Sm as Sl,Ss as Cl,Sx as wl,TC as Tl,TS as El,Tb as Dl,Tg as Ol,Th as kl,Tj as Al,Tk as jl,Ts as Ml,Tt as Nl,Tu as Pl,Tv as Fl,Tx as Il,Ty as Ll,UC as Rl,UD as zl,UE as Bl,UO as Vl,US as Hl,Uf as Ul,Uk as Wl,Ul as Gl,Un as Kl,Uo as ql,Up as Jl,Us as Yl,Uu as Xl,Ux as Zl,Uy as Ql,VD as $l,VE as eu,VO as tu,VS as nu,Va as ru,Vf as iu,Vl as au,Vm as ou,Vp as su,Vs as cu,Vx as lu,WC as uu,WD as du,WE as fu,WS as pu,Wa as mu,Wb as hu,Wc as gu,Wd as _u,Wf as vu,Wi as yu,Wk as bu,Wl as xu,Wn as Su,Wo as Cu,Wp as wu,Ws as Tu,Wu as Eu,Wy as Du,XD as Ou,XE as ku,XO as Au,X_ as ju,Xf as Mu,Xi as Nu,Xk as Pu,Xp as Fu,Xu as Iu,Xw as Lu,Xy as Ru,Y as zu,YA as Bu,YD as Vu,YO as Hu,YS as Uu,Yd as Wu,Yf as Gu,Yg as Ku,Yh as qu,Yl as Ju,Yu,Yw as Xu,Yy as Zu,Z as Qu,ZD as $u,ZE as ed,ZO as td,ZT as nd,Zd as rd,Zf as id,Zi as ad,Zm as od,Zo as sd,Zp as cd,Zu as ld,Zy as ud,_O as dd,_S as fd,_T as pd,__ as md,_b as hd,_d as gd,_g as _d,_i as vd,_j as yd,_o as bd,_u as xd,aA as Sd,aC as Cd,aS as wd,aa as Td,ad as Ed,af as Dd,ag as Od,ah as kd,am as Ad,ao as jd,au as Md,bC as Nd,bS as Pd,bT as Fd,ba as Id,bb as Ld,bd as Rd,bg as zd,br as Bd,cD as Vd,cS as Hd,c_ as Ud,ca as Wd,cb as Gd,cd as Kd,cf as qd,cg as Jd,ch as Yd,ck as Xd,cm as Zd,cu as Qd,cy as $d,dC as ef,dS as tf,d_ as nf,db as rf,dc as af,dd as of,df as sf,dg as cf,di as lf,dk as uf,dm as df,dr as ff,dt as pf,du as mf,dx as hf,eC as gf,eD as _f,eO as vf,e_ as yf,ea as bf,eb as xf,ec as Sf,ef as Cf,eg as wf,eh as Tf,ej as Ef,em as Df,eo as Of,ep as kf,fC as Af,fS as jf,fa as Mf,fb as Nf,fc as Pf,fd as Ff,fg as If,fh as Lf,fk as Rf,fl as zf,fm as Bf,fo as Vf,fp as Hf,fs as Uf,ft as Wf,fv as Gf,fy as Kf,gO as qf,gS as Jf,g_ as Yf,ga as Xf,gb as Zf,gd as Qf,gg as $f,gi as ep,gl as tp,go as np,gr as rp,gu as ip,gy as ap,hO as op,hS as sp,h_ as cp,ha as lp,hb as up,hf as dp,hg as fp,hl as pp,ho as mp,hu as hp,hy as gp,iC as _p,iD as vp,i_ as yp,ib as bp,ic as xp,id as Sp,if as Cp,ig as wp,ih as Tp,ii as Ep,ik as Dp,io as Op,is as kp,jC as Ap,jD as jp,jS as Mp,jT as Np,jb as Pp,jh as Fp,jl as Ip,jm as Lp,jn as Rp,jo as zp,ju as Bp,jv as Vp,jx as Hp,jy as Up,kD as Wp,kT as Gp,kb as Kp,kd as qp,kg as Jp,kl as Yp,km as Xp,ko as Zp,kr as Qp,ku as $p,kx as em,ky as tm,lC as X,lD as nm,lS as rm,la as im,lb as am,lf as om,lg as sm,lh as cm,lm,lu as um,mO as dm,mS as fm,m_ as pm,ma as mm,md as hm,mf as gm,mg as _m,ml as vm,mm as ym,mn as bm,ms as xm,mu as Sm,my as Cm,nC as wm,nD as Tm,n_ as Em,na as Dm,nb as Om,nf as km,ng as Am,nh as jm,nm as Mm,nn as Nm,np as Pm,nt as Fm,o as Im,oA as Lm,oC as Rm,oS as zm,oa as Bm,of as Vm,og as Hm,oh as Um,ok as Wm,om as Gm,oo as Km,os as qm,ot as Jm,pD as Ym,pO as Xm,p_ as Zm,pa as Qm,pd as $m,pg as eh,ph as th,pi as nh,pl as rh,pm as ih,po as ah,pp as oh,pv as sh,py as ch,qA as lh,qC as uh,qD as dh,qE as fh,qO as ph,qS as mh,qT as hh,qc as gh,qd as _h,ql as vh,qs as yh,qt as bh,qu as xh,qv as Sh,qx as Ch,qy as wh,rA as Th,rC as Eh,r_ as Dh,ra as Oh,rb as kh,rc as Ah,rd as jh,rf as Mh,rg as Nh,rh as Ph,rk as Fh,rm as Ih,rr as Lh,rt as Rh,sA as zh,sC as Bh,sD as Vh,sS as Hh,s_ as Uh,sa as Wh,sb as Gh,sd as Kh,sf as qh,sg as Jh,sh as Yh,sk as Xh,sm as Zh,so as Qh,sr as $h,tC as eg,tD as tg,tS as ng,t_ as rg,ta as ig,tb as ag,tf as og,tg as sg,th as cg,tj as lg,tm as ug,tp as dg,tt as fg,u as pg,uC as Z,uS as mg,ua as hg,ub as gg,ud as _g,uf as vg,ug as yg,um as bg,uu as xg,ux as Sg,uy as Cg,vO as wg,vS as Tg,vT as Eg,vb as Dg,vg as Og,vj as kg,vo as Ag,vs as jg,vu as Mg,vy as Ng,w as Pg,wC as Fg,wD as Ig,wE as Lg,wO as Rg,wS as zg,wb as Bg,wd as Vg,wg as Hg,wh as Ug,wj as Wg,wm as Gg,wo as Kg,ws as qg,x as Jg,xC as Yg,xD as Xg,xS as Zg,xb as Qg,xg as $g,xk as e_,xl as t_,xm as n_,xo as r_,xx as i_,yO as a_,yS as o_,ya as s_,yb as c_,yd as l_,yg as u_,yi as d_,yu as f_,yy as p_,zE as m_,zO as h_,z_ as g_,zb as __,zh as v_,zk as y_,zm as b_,zn as x_,zo as S_,zp as C_,zx as w_,zy as T_}from"./loadAgentsDir-BYWykYwn.js";import{Hn as E_,Ht as D_,J as O_,Jt as k_,Kn as A_,M as j_,Mn as M_,P as N_,Qn as P_,Rn as F_,Tt as I_,Ut as L_,V as R_,Vn as z_,Xn as B_,Zn as V_,dn as H_,fn as U_,hn as W_,qn as G_,qt as K_,zn as q_}from"./prompt-BGNhFY1n.js";import{a as J_,n as Y_,r as X_,v as Z_}from"./companion-rXSt0nmz.js";import{r as Q_,t as $_}from"./xml-DOXio8vw.js";import{a as ev,i as tv,r as nv}from"./shellQuote-CBjhlaFO.js";import{a as rv}from"./ripgrep-Bzwdi5-K.js";import{a as iv,o as av,s as ov}from"./fileStateCache-BhVfo23e.js";import{C as sv,N as cv,S as lv,T as uv,X as dv,b as fv,d as pv,f as mv,j as hv,w as gv,x as _v,y as vv}from"./rcDebugLog-ClX1msJX.js";import{T as yv,c as bv,r as xv,w as Sv}from"./sessionTracing-81-RIJBo.js";import{i as Cv,n as wv,r as Tv}from"./parser-aIWfAYnt.js";import{c as Ev,l as Dv}from"./commitAttribution-CJXF8wMs.js";import{n as Ov,t as kv}from"./poorMode-CFRuV-nB.js";import{A as Av,E as jv,H as Mv,I as Nv,L as Pv,M as Fv,N as Iv,P as Lv,V as Rv,_ as zv,a as Bv,b as Vv,d as Hv,g as Uv,h as Wv,m as Gv,o as Kv,u as qv,x as Jv}from"./teamHelpers-BJJs8taN.js";import{a as Yv,f as Xv,l as Zv,o as Qv}from"./api-hcsOinLV.js";import{n as $v,t as ey}from"./browser-Bt-ckCaU.js";import{t as ty}from"./useKeybinding-DPOUuymz.js";import{t as ny}from"./useTerminalSize-Du-EamDN.js";import{c as ry,u as iy}from"./common-Da57Qwms.js";import{i as ay,m as oy,n as sy,p as cy}from"./terminalSetup-2ioFcRAA.js";import{n as ly,r as uy,t as dy}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{a as fy,c as py,o as my,s as hy}from"./constants-BljlAJOX.js";import{n as gy,t as _y}from"./SentryErrorBoundary-ydwbrVTx.js";import{i as vy,r as yy}from"./bridgeEnabled-DYclTb9d.js";import{i as by,n as xy,t as Sy}from"./voiceModeEnabled-3eg8vSqy.js";import{o as Cy,r as wy,s as Ty}from"./detection-95TCHkW8.js";import{n as Ey,r as Dy}from"./undercover-DoUSM8d6.js";import{t as Oy}from"./lib-Cf16LgKj.js";import{t as ky}from"./Dialog-91X6ZGg9.js";import{n as Ay,t as jy}from"./mappers-BBkM1aA5.js";import{n as My,r as Ny}from"./sessionTitle-ePQRpeV2.js";import{t as Py}from"./bridgeMessaging-CYe1Cixl.js";import{a as Fy,i as Iy,r as Ly,t as Ry}from"./pipeTransport-uK7GxbSG.js";import{t as zy}from"./useManagePlugins-B-ejJsXy.js";import{c as By,n as Vy,o as Hy}from"./channelNotification-CLPdvxGZ.js";import{a as Uy,c as Wy,n as Gy,o as Ky,s as qy,t as Jy}from"./MCPConnectionManager-N-oJu3qn.js";import{c as Yy,i as Xy,l as Zy,n as Qy,o as $y,r as eb,s as tb,u as nb}from"./cronJitterConfig-CnKed5Gi.js";import{i as rb,n as ib}from"./toolPool-HYKCHxDA.js";import{a as ab,c as ob,i as sb,l as cb,o as lb,r as ub,t as db,u as fb}from"./MessageSelector-D10JMnsc.js";import{n as pb,t as mb}from"./sideQuestion-BcP9Mm-5.js";import{a as hb,n as gb,o as _b,r as vb,s as yb,t as bb}from"./skillChangeDetector-1aFn40GC.js";import{n as xb,t as Sb}from"./refresh-CO_P3WKA.js";import{i as Cb,n as wb,r as Tb,t as Eb}from"./directoryCompletion-DqtWZsoW.js";import{r as Db,t as Ob}from"./PromptInputFooterSuggestions-DAFZfAT0.js";import{n as kb,t as Ab}from"./useMergedTools-B6x9qtfj.js";import{a as jb,i as Mb,n as Nb,o as Pb,r as Fb,t as Ib}from"./promptEditor-U03qQWbq.js";import{n as Lb,t as Rb}from"./useMainLoopModel-D0PmGDuy.js";import{i as zb,n as Bb,r as Vb,t as Hb}from"./PermissionDialog-R-Vl4Tk-.js";import{n as Ub,t as Wb}from"./RemoteCallout-CuxqarhC.js";import{i as Gb,n as Kb,r as qb,t as Jb}from"./sprites-BuvEFwW6.js";import{a as Yb,n as Xb,t as Zb}from"./setup-CTfYsKsz.js";import{a as Qb,c as $b,i as ex,o as tx,r as nx,s as rx}from"./caches-Bz4yVQyE.js";import{n as ix,t as ax}from"./conversation-CBPRFDod.js";import{a as ox,i as sx,n as cx,o as lx,r as ux,s as dx,t as fx}from"./extraUsage-BMvDY0Sk.js";import{n as px,t as mx}from"./useSearchInput-BpMLsxaS.js";import{n as hx,t as gx}from"./useSettingsErrors-DUe4k_RK.js";import{n as _x,t as vx}from"./shadowedRuleDetection-CGD7Nx03.js";import{n as yx,t as bx}from"./ExitFlow-BPbtGcEg.js";import{a as xx,c as Sx,i as Cx,l as wx,n as Tx,o as Ex,r as Dx,s as Ox,t as kx}from"./Messages-CQdQJ2AA.js";import{n as Ax,t as jx}from"./exportRenderer-B5emJDvn.js";import{i as Mx,n as Nx,t as Px}from"./bypassPermissionsKillswitch-CTrRxzdz.js";import{a as Fx,i as Ix,r as Lx,t as Rx}from"./fast-BP2t1xDM.js";import{n as zx,r as Bx}from"./Feedback-BSagYjmf.js";import{a as Vx,i as Hx,n as Ux,r as Wx,t as Gx}from"./PromptInputHelpMenu-Bjjr3tYl.js";import{n as Kx,r as qx}from"./language-Ct5Nkqm6.js";import{n as Jx,r as Yx}from"./pluginAutoupdate-Bg7JMOHN.js";import{n as Xx,r as Zx}from"./autoModeDenials-BDpcFLb7.js";import{n as Qx,t as $x}from"./generateSessionName-BwtXd8TC.js";import{n as eS,t as tS}from"./fuse-D7icKomM.js";import{a as nS,c as rS,i as iS,l as aS,n as oS,o as sS,r as cS,s as lS,t as uS}from"./BackgroundTasksDialog-VKhuyQLe.js";import{r as dS,t as fS}from"./useVoice-C3ryR2HE.js";import{n as pS}from"./fpsMetrics-DH78PzGr.js";import{t as mS}from"./earlyInput-B3U01GAm.js";import{a as hS,c as gS,f as _S,i as vS,l as yS,o as bS,r as xS,s as SS,t as CS}from"./RemoteSessionManager-BhPF41Wn.js";import{n as wS,t as TS}from"./backgroundHousekeeping-zf-tDimg.js";import{homedir as ES,tmpdir as DS}from"os";import*as OS from"path";import{basename as kS,dirname as AS,extname as jS,join as MS,relative as NS,sep as PS}from"path";import{dirname as FS,join as IS}from"node:path";import{watch as LS}from"fs";import{createHash as RS}from"node:crypto";import{randomUUID as zS}from"crypto";import{readFile as BS,stat as VS,writeFile as HS}from"fs/promises";import{spawn as US,spawnSync as WS}from"child_process";import{mkdir as GS,readFile as KS,rename as qS,writeFile as JS}from"node:fs/promises";s(),u(),h(),w(),F(),Ee(),O(),f(),Le(),ot(),Sn(),Cr(),wr(),_r(),Er(),gr(),fr(),vr(),q(),Or(),Pr(),Ir(),Rr(),zr(),Hn(),Xr(),Zr(),ei(),ni(),ri(),dn(),si(),Mr(),li(),lr(),Ci(),Ei(),ki(),Rt(),Ii(),en(),sn(),$n(),Nt(),Vi(),Gn(),Lt(),In(),cr(),qn(),tr(),$t(),On(),Wn(),Qt(),ir(),Yn(),fi(),_i(),Ht(),an(),vn(),Qo(),Al(),P_(),G_(),E_(),M_(),lg(),is(),W_(),rv(),so(),U_(),k_(),L_(),I_(),R_(),j_(),zh(),Th(),av(),Wc(),bu(),ol(),jl(),uf(),Xd(),Dp(),Ss(),Rg(),qf(),vf(),Fc(),Sv(),Tv(),nv(),bs(),ga(),lo(),Wp(),pl(),Vh(),vp(),_f(),cv(),ku(),Q_(),fh(),Io(),Ms(),Lv(),Lg(),ey(),Ws(),Np(),Gp(),za(),ty(),gl(),ny(),ry(),Lu(),uu(),co(),Ia(),fl(),Nd(),X(),Rm(),_p(),wm(),gf(),cy(),ay(),Cs(),aa(),Da(),uy(),Zg(),Tg(),fm(),jf(),Hh(),zm(),ng(),Zl(),ma(),pc(),Qa(),_l(),Zf(),Vv(),py(),Bv(),kh(),ud(),Up(),Ng(),$d(),Xc(),sh(),Bc(),cp(),Zm(),Dh(),gy(),fp(),sm(),Am(),qu(),ya(),qs(),kl(),th(),Yd(),ba(),Xp(),Gg(),Ih(),$i(),cd(),Os(),wu(),su(),Sa(),vc(),yy(),Pm(),id(),Gu(),vu(),Bo(),xy(),vv(),l_(),$m(),Sp(),ld(),Xl(),fa(),Ka(),f_(),xd(),bv(),Qd(),Md(),ms(),au(),Yp(),t_(),pp(),rh(),gh(),gu(),Fs(),fo(),af(),xp(),yh(),Xs(),qg(),jg(),Uf(),ql(),mu(),Id(),Dm(),go(),Wo(),Rp(),Ma(),fg(),Pc(),rs(),vs(),Pg(),$y(),eb(),jb(),zb(),Bb(),mx(),Tx(),jx(),zx();var Q=n(L(),1);H(),ul();var $=je();function YS({onDone:e}){return(0,$.jsxs)(B,{title:`You've spent $5 on the Anthropic API this session.`,onCancel:e,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{children:`Learn more about how to monitor your spending:`}),(0,$.jsx)(re,{url:`https://code.claude.com/docs/en/costs`})]}),(0,$.jsx)(wd,{options:[{value:`ok`,label:`Got it, thanks!`}],onChange:e})]})}H(),ul();function XS({idleMinutes:e,totalInputTokens:t,onDone:n}){return(0,$.jsxs)(B,{title:`You've been away ${ZS(e)} and this conversation is ${Pi(t)} tokens.`,onCancel:()=>n(`dismiss`),children:[(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(R,{children:`If this is a new task, clearing context will save usage and be faster.`})}),(0,$.jsx)(wd,{options:[{value:`continue`,label:`Continue this conversation`},{value:`clear`,label:`Send message as a new conversation`},{value:`never`,label:`Don't ask me again`}],onChange:e=>n(e)})]})}function ZS(e){if(e<1)return`< 1m`;if(e<60)return`${Math.floor(e)}m`;let t=Math.floor(e/60),n=Math.floor(e%60);return n===0?`${t}h`:`${t}h ${n}m`}hu();var QS=300,$S=240*1e3,eC=null,tC=null,nC=0,rC=!1;function iC(){nC++,nC===1&&(lC(),sC())}function aC(){nC>0&&nC--,nC===0&&(cC(),uC())}function oC(){nC=0,cC(),uC()}function sC(){process.platform===`darwin`&&tC===null&&(tC=setInterval(()=>{nC>0&&(J(`Restarting caffeinate to maintain sleep prevention`),uC(),lC())},$S),tC.unref())}function cC(){tC!==null&&(clearInterval(tC),tC=null)}function lC(){if(process.platform===`darwin`&&eC===null){rC||(rC=!0,K(async()=>{oC()}));try{eC=US(`caffeinate`,[`-i`,`-t`,String(QS)],{stdio:`ignore`}),eC.unref();let e=eC;eC.on(`error`,t=>{J(`caffeinate spawn error: ${t.message}`),eC===e&&(eC=null)}),eC.on(`exit`,()=>{eC===e&&(eC=null)}),J(`Started caffeinate to prevent sleep`)}catch{eC=null}}}function uC(){if(eC!==null){let e=eC;eC=null;try{e.kill(`SIGKILL`),J(`Stopped caffeinate, allowing sleep`)}catch{}}}var dC=class{constructor(){d(this,`_status`,`idle`),d(this,`_generation`,0),d(this,`_changed`,Ke()),d(this,`subscribe`,this._changed.subscribe),d(this,`getSnapshot`,()=>this._status!==`idle`)}reserve(){return this._status===`idle`?(this._status=`dispatching`,this._notify(),!0):!1}cancelReservation(){this._status===`dispatching`&&(this._status=`idle`,this._notify())}tryStart(){return this._status===`running`?null:(this._status=`running`,++this._generation,this._notify(),this._generation)}end(e){return this._generation!==e||this._status!==`running`?!1:(this._status=`idle`,this._notify(),!0)}forceEnd(){this._status!==`idle`&&(this._status=`idle`,++this._generation,this._notify())}get isActive(){return this._status!==`idle`}get generation(){return this._generation}_notify(){this._changed.emit()}};__(),Pp(),Qg(),hd(),Gh(),As(),Vm(),Yi(),H(),am();function fC({name:e,color:t}){return(0,$.jsx)(U,{flexDirection:`row`,gap:1,children:(0,$.jsxs)(R,{color:gg(t),children:[Fn,` `,(0,$.jsxs)(R,{bold:!0,children:[`@`,e]})]})})}H();function pC({toolName:e,description:t}){let n=pi(),r=vi(),i=yi();return(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`warning`,paddingX:1,children:[(0,$.jsxs)(U,{marginBottom:1,children:[(0,$.jsx)(Du,{}),(0,$.jsxs)(R,{color:`warning`,bold:!0,children:[` `,`Waiting for team lead approval`]})]}),r&&i&&(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(fC,{name:r,color:i})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Tool: `}),(0,$.jsx)(R,{children:e})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Action: `}),(0,$.jsx)(R,{children:t})]}),n&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Permission request sent to team `,`"`,n,`"`,` leader`]})})]})}Oo();function mC(e,t=!1){let n=Z(e=>e.teamContext),r=(0,Q.useRef)(0),i=(0,Q.useRef)(void 0),a=(0,Q.useRef)(void 0),o=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(t)return;let s=e[0]?.uuid,c=r.current,l=a.current===void 0,u=s!==void 0&&!l&&s===a.current&&c<=e.length,d=s!==void 0&&!l&&s===a.current&&c>e.length,f=u?c:0;if(f===e.length)return;let p=f===0?e:e.slice(f),m=u?i.current:void 0,h=++o.current;if(lf(p,Nn()?{teamName:n?.teamName,agentName:n?.selfAgentName}:{},m,e).then(e=>{h===o.current&&e&&!u&&(i.current=e)}),u||l||d){let t=Lh(p,e).findLast(es);t&&(i.current=t.uuid)}r.current=e.length,a.current=s},[e,t,n?.teamName,n?.selfAgentName])}function hC(e){return!e||typeof e!=`object`?!1:`behavior`in e&&(e.behavior===`allow`||e.behavior===`deny`)}function gC(e,t){if(typeof e.message==`string`&&e.message)return e.message;if(typeof t?.message==`string`&&t.message)return t.message;if(typeof e.error==`string`&&e.error)return e.error}function _C(e){let t=e.response;if(!t||typeof t!=`object`)return null;if(t.subtype===`success`&&`response`in t&&hC(t.response))return t.response;if(t.subtype!==`error`)return null;let n=`response`in t&&hC(t.response)?t.response:void 0,r=gC(t,n);return n?r?{...n,message:r}:n:r?{behavior:`deny`,message:r}:null}function vC(t){{let{pauseProactive:t}=(vv(),e(sv));t()}t?.abort()}function yC(e,t){return e<t}function bC(e,t){return e&&t===0}function xC({hasHandle:e,isConnected:t,lastWrittenIndex:n,messageCount:r}){return!e||!t?!0:yC(n,r)}Qf();function SC(e){return{id:e.id,subject:e.subject,description:e.description,activeForm:e.activeForm,status:e.status,owner:e.owner,blocks:[...e.blocks],blockedBy:[...e.blockedBy]}}function CC(e,t){return e.id.localeCompare(t.id)}function wC(e,t){return{task_list_id:e,tasks:t.filter(e=>!e.metadata?._internal).map(SC).sort(CC)}}function TC(e,t){return JSON.stringify(wC(e,t))}function EC(e,t){let n=wC(e,t);return{type:`task_state`,uuid:zS(),...n}}H(),X(),q();var DC=50,OC=5e3,kC=1e4,AC=3;function jC(e,t,n,r,i){let a=(0,Q.useRef)(null),o=(0,Q.useRef)(void 0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(void 0),f=(0,Q.useRef)(0),p=Af(),m=(0,Q.useRef)(r);m.current=r;let h=(0,Q.useRef)(i);h.current=i;let g=(0,Q.useRef)(e);g.current=e;let _=ef(),{addNotification:v}=Bh(),y=Z(e=>e.replBridgeEnabled),b=Z(e=>e.replBridgeConnected),x=Z(e=>e.replBridgeSessionActive),S=Z(e=>e.replBridgeOutboundOnly),C=Z(e=>e.replBridgeInitialName);return(0,Q.useEffect)(()=>{{if(!y)return;let r=S;function i(e){r||v({key:`bridge-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`error`,children:`Remote Control failed`}),e&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,e]})]}),priority:`immediate`})}if(f.current>=AC){J(`[bridge:repl] Hook: ${f.current} consecutive init failures, not retrying this session`);let e=`disabled after repeated failures · restart to retry`;i(e),p(t=>t.replBridgeError===e&&!t.replBridgeEnabled?t:{...t,replBridgeError:e,replBridgeEnabled:!1});return}let b=!1,x=e.length;return(async()=>{try{if(o.current&&(J(`[bridge:repl] Hook: waiting for previous teardown to complete before re-init`),await o.current,o.current=void 0,J(`[bridge:repl] Hook: previous teardown complete, proceeding with re-init`)),b)return;let{initReplBridge:v}=await import(`./initReplBridge-DV9KhSic.js`),{shouldShowAppUpgradeMessage:y}=await import(`./envLessBridgeConfig-D_GCqhTu.js`),S=!1;{let{isAssistantMode:e}=await import(`./assistant-D7D1sqTB.js`);S=e()}async function w(e){try{let t=Zy(e);if(!t)return;let{uuid:n}=t,{resolveAndPrepend:r}=await import(`./inboundAttachments-Cug-8Xdy.js`),i=t.content,a=await r(e,i);J(`[bridge:repl] Injecting inbound user message: ${typeof a==`string`?a.slice(0,80):`[${a.length} content blocks]`}${n?` uuid=${n}`:``}`),h_({value:a,mode:`prompt`,uuid:n,skipSlashCommands:!0,bridgeOrigin:!0})}catch(e){J(`[bridge:repl] handleInboundMessage failed: ${e}`,{level:`error`})}}function T(e,n){if(b)return;if(r){J(`[bridge:repl] Mirror state=${e}${n?` detail=${n}`:``}`),e===`failed`?p(e=>e.replBridgeConnected?{...e,replBridgeConnected:!1}:e):(e===`ready`||e===`connected`)&&p(e=>e.replBridgeConnected?e:{...e,replBridgeConnected:!0});return}let o=a.current;switch(e){case`ready`:p(e=>{let t=o&&o.environmentId!==``?uo(o.environmentId,o.sessionIngressUrl):e.replBridgeConnectUrl,n=o?Yo(o.bridgeSessionId,o.sessionIngressUrl):e.replBridgeSessionUrl,r=o?.environmentId,i=o?.bridgeSessionId;return e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeReconnecting&&e.replBridgeConnectUrl===t&&e.replBridgeSessionUrl===n&&e.replBridgeEnvironmentId===r&&e.replBridgeSessionId===i?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:t,replBridgeSessionUrl:n,replBridgeEnvironmentId:r,replBridgeSessionId:i,replBridgeError:void 0}});break;case`connected`:{let e=_.getState().replBridgeSessionActive;p(e=>e.replBridgeSessionActive?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!0,replBridgeReconnecting:!1,replBridgeError:void 0}),e||t(e=>[...e,Na(`Remote Control 已连接。现在可以使用 PushNotification、SendUserFile、Brief 工具,请使用 SearchExtraTools 搜索发现。`,`info`)]),gn(`tengu_bridge_system_init`,!1)&&(async()=>{try{let e=await bf(Tr());if(b)return;let t=_.getState();a.current?.writeSdkMessages([lb({tools:[],mcpClients:[],model:h.current,permissionMode:t.toolPermissionContext.mode,commands:m.current.filter(Oh),agents:t.agentDefinitions.activeAgents,skills:e,plugins:[],fastMode:t.fastMode})])}catch(e){J(`[bridge:repl] Failed to send system/init: ${Sr(e)}`,{level:`error`})}})();break}case`reconnecting`:p(e=>e.replBridgeReconnecting?e:{...e,replBridgeReconnecting:!0,replBridgeSessionActive:!1});break;case`failed`:clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n,replBridgeReconnecting:!1,replBridgeSessionActive:!1,replBridgeConnected:!1})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},kC);break}}let E=new Map;function D(e){let t=e.response?.request_id;if(!t)return;let n=E.get(t);if(!n){J(`[bridge:repl] No handler for control_response request_id=${t}`);return}let r=_C(e);if(!r){J(`[bridge:repl] Ignoring unrecognized control_response request_id=${t}`);return}E.delete(t),n(r)}let O=await v({outboundOnly:r,tags:r?[`ccr-mirror`]:void 0,onInboundMessage:w,onPermissionResponse:D,onInterrupt(){vC(n.current)},onSetModel(e){let t=e===`default`?null:e??null;gt(t),p(e=>e.mainLoopModelForSession===t?e:{...e,mainLoopModelForSession:t})},onSetMaxThinkingTokens(e){let t=e!==null;p(e=>e.thinkingEnabled===t?e:{...e,thinkingEnabled:t})},onSetPermissionMode(e){if(e===`bypassPermissions`){if(lc())return{ok:!1,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`};if(!_.getState().toolPermissionContext.isBypassPermissionsModeAvailable)return{ok:!1,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}if(e===`auto`&&!Fa()){let e=dl();return{ok:!1,error:e?`Cannot set permission mode to auto: ${Jg(e)}`:`Cannot set permission mode to auto`}}return p(t=>{let n=t.toolPermissionContext.mode;if(n===e)return t;let r=oo(n,e,t.toolPermissionContext);return{...t,toolPermissionContext:{...r,mode:e}}}),setImmediate(()=>{_u()?.(e=>(e.forEach(e=>{e.recheckPermission()}),e))}),{ok:!0}},onStateChange:T,initialMessages:e.length>0?e:void 0,getMessages:()=>g.current,previouslyFlushedUUIDs:u.current,initialName:C,perpetual:S}),k=O?{...O,markTranscriptReset(){l.current=!0,c.current=!1,s.current=0}}:null;if(b){J(`[bridge:repl] Hook: init cancelled during flight, tearing down${k?` env=${k.environmentId}`:``}`),k&&k.teardown();return}if(!k){f.current++,J(`[bridge:repl] Init returned null (precondition or session creation failed); consecutive failures: ${f.current}`),clearTimeout(d.current),p(e=>({...e,replBridgeError:e.replBridgeError??`check debug logs for details`})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},kC);return}if(a.current=k,gd(k),f.current=0,s.current=x,r)p(e=>e.replBridgeConnected&&e.replBridgeSessionId===k.bridgeSessionId?e:{...e,replBridgeConnected:!0,replBridgeSessionId:k.bridgeSessionId,replBridgeSessionUrl:void 0,replBridgeConnectUrl:void 0,replBridgeError:void 0}),J(`[bridge:repl] Mirror initialized, session=${k.bridgeSessionId}`);else{let e={sendRequest(e,t,n,r,i,a,o){k.sendControlRequest({type:`control_request`,request_id:e,request:{subtype:`can_use_tool`,tool_name:t,input:n,tool_use_id:r,description:i,...a?{permission_suggestions:a}:{},...o?{blocked_path:o}:{}}})},sendResponse(e,t){let n={...t};k.sendControlResponse({type:`control_response`,response:{subtype:`success`,request_id:e,response:n}})},cancelRequest(e){k.sendControlCancelRequest(e)},onResponse(e,t){return E.set(e,t),()=>{E.delete(e)}}};p(t=>({...t,replBridgePermissionCallbacks:e}));let n=Yo(k.bridgeSessionId,k.sessionIngressUrl),r=k.environmentId===``?void 0:uo(k.environmentId,k.sessionIngressUrl);p(e=>e.replBridgeConnected&&e.replBridgeSessionUrl===n?e:{...e,replBridgeConnected:!0,replBridgeSessionUrl:n,replBridgeConnectUrl:r??e.replBridgeConnectUrl,replBridgeEnvironmentId:k.environmentId,replBridgeSessionId:k.bridgeSessionId,replBridgeError:void 0});let i=S?!1:await y().catch(()=>!1);if(b)return;t(e=>[...e,bd(n,i?`Please upgrade to the latest version of the Claude mobile app to see your Remote Control sessions.`:void 0)]),J(`[bridge:repl] Hook initialized, session=${k.bridgeSessionId}`)}}catch(e){if(b)return;f.current++;let n=Sr(e);J(`[bridge:repl] Init failed: ${n}; consecutive failures: ${f.current}`),clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},kC),r||t(e=>[...e,Na(`Remote Control failed to connect: ${n}`,`warning`)])}})(),()=>{b=!0,clearTimeout(d.current),d.current=void 0,a.current&&(J(`[bridge:repl] Hook cleanup: starting teardown for env=${a.current.environmentId} session=${a.current.bridgeSessionId}`),o.current=a.current.teardown(),a.current=null,gd(null)),p(e=>!e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeError?e:{...e,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgePermissionCallbacks:void 0}),s.current=0,c.current=!1,l.current=!1}}},[y,S,p,t,v]),(0,Q.useEffect)(()=>{{if(!b)return;let t=a.current;if(!t)return;s.current>e.length&&J(`[bridge:repl] Compaction detected: lastWrittenIndex=${s.current} > messages.length=${e.length}, clamping`);let n=Math.min(s.current,e.length),r=[];for(let t=n;t<e.length;t++){let n=e[t];n&&(n.type===`user`||n.type===`assistant`||n.type===`system`&&n.subtype===`local_command`)&&r.push(n)}if(s.current=e.length,r.length>0&&(t.writeMessages(r),l.current=!1),c.current&&bC(l.current,e.length)){l.current=!1,c.current=!1,t.sendResult();return}c.current&&!l.current&&(c.current=!1,t.sendResult())}},[e,b]),(0,Q.useEffect)(()=>{{if(!x||S)return;let e=!1,t,n,r=null,i=null,o=null,s=null,c=e=>{if(!(e===i&&r!==null)){r?.close(),r=null,i=e;try{r=LS(e,u),r.unref()}catch{}}},l=async()=>{let t=a.current;if(!t)return;let n=Fv();c(Iv(n));try{let r=await Nv(n);if(e||a.current!==t)return;let i=TC(n,r);if(i===o&&t===s)return;t.writeSdkMessages([EC(n,r)]),o=i,s=t}catch(e){J(`[bridge:repl] Failed to publish task_state: ${Sr(e)}`,{level:`error`})}},u=()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,l()},DC),t.unref?.()};l();let d=Pv(u);return n=setInterval(()=>{l()},OC),n.unref?.(),()=>{e=!0,d(),t&&clearTimeout(t),n&&clearInterval(n),r?.close()}}},[x,S]),{sendBridgeResult:(0,Q.useCallback)(()=>{{let e=a.current;if(!e){c.current=!0;return}if(bC(l.current,g.current.length)){l.current=!1,c.current=!1,e.sendResult();return}if(l.current||xC({hasHandle:!0,isConnected:b,lastWrittenIndex:s.current,messageCount:g.current.length})){c.current=!0;return}e.sendResult()}},[b])}}dy(),ub();var MC=Fi(()=>b({method:v(`log_event`),params:b({eventName:_(),eventData:b({}).passthrough()})}));function NC(e){(0,Q.useEffect)(()=>{if(!e.length)return;let t=Il(e);t&&t.client.setNotificationHandler(MC(),e=>{let{eventName:t,eventData:n}=e.params;Y(`tengu_ide_${t}`,n)})},[e])}ot(),H();var PC=6e3;function FC(){return Date.now()-et()}function IC(e){return FC()<e}function LC(e){return!IC(e)}function RC(e,t){let n=A();(0,Q.useEffect)(()=>{We(!0)},[]),(0,Q.useEffect)(()=>{let r=!1,i=setInterval(()=>{LC(6e3)&&!r&&(r=!0,clearInterval(i),Eo({message:e,notificationType:t},n))},PC);return()=>clearInterval(i)},[e,t,n])}Ap(),rg(),kd(),jm(),Zi(),Fb(),H(),pd();var zC={topLeft:`┌`,topRight:`┐`,bottomLeft:`└`,bottomRight:`┘`,horizontal:`─`,vertical:`│`,teeLeft:`├`,teeRight:`┤`};function BC(e){return Eh().syntaxHighlightingDisabled?(0,$.jsx)(HC,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(HC,{...e,highlight:null}),children:(0,$.jsx)(VC,{...e})})}function VC(e){let t=(0,Q.use)(Ou());return(0,$.jsx)(HC,{...e,highlight:t})}function HC({content:e,maxLines:t,minHeight:n,minWidth:r=40,maxWidth:i,highlight:a}){let{columns:o}=k(),[s]=ae(),c=i??o-4,l=t??20,u=(0,Q.useMemo)(()=>pm(e,s,a),[e,s,a]).split(`
|
|
1
|
+
import{a as e,n as t,o as n,r}from"./chunk-DR8-3Aex.js";import{f as i,l as a,n as o,s,u as c}from"./envUtils-BWeoiL4Y.js";import{g as l}from"./client-_sjL0I7A.js";import{n as u,t as d}from"./defineProperty-80gRi2ZW.js";import{n as f,t as p}from"./figures-gfT9mM8P.js";import{n as m,t as h}from"./axios-DhfaybwJ.js";import{Cn as g,Ln as _,un as v,vt as y,wn as b,yn as x}from"./schemas-BGAvj1T4.js";import{i as S,r as C,t as w}from"./v4-f1i_CNUT.js";import{A as T,B as E,Cn as D,Ct as O,F as k,Ft as A,I as j,In as M,K as N,Kt as P,L as ee,Ln as F,Lt as te,M as ne,O as I,Q as re,Rn as L,St as ie,T as ae,Tn as oe,Tt as se,U as ce,Ut as le,Wt as ue,Yt as de,Z as fe,at as pe,b as R,ct as me,en as z,f as B,g as he,gn as ge,h as _e,k as ve,m as ye,nt as V,ot as be,p as xe,qt as Se,t as H,tn as Ce,tt as we,v as Te,wn as Ee,wt as De,x as U,xt as Oe,z as ke,zt as Ae}from"./src-Di342QoJ.js";import{t as je}from"./jsx-runtime-D-D469L8.js";import{A as Me,Ar as Ne,Bt as Pe,Ct as Fe,Dt as Ie,Fr as Le,G as Re,Ht as ze,Jt as Be,K as Ve,Kt as He,Lt as Ue,Mr as We,Nt as Ge,Pr as Ke,Qt as qe,Rt as Je,S as Ye,Sn as Xe,U as Ze,Vt as Qe,W as $e,X as et,Xt as tt,Yt as nt,Zt as rt,an as it,bn as at,cn as ot,er as st,jn as ct,jr as lt,ln as ut,or as dt,ot as ft,qt as pt,rn as mt,sr as ht,tr as gt,tt as _t,ut as vt,vt as yt,xn as bt,y as xt,yn as St,zn as Ct,zt as wt}from"./state-sIHsFpDu.js";import{Ao as Tt,As as Et,Bc as Dt,Br as Ot,Cc as kt,Ci as At,Cs as jt,Da as Mt,Do as Nt,Dr as Pt,Ei as Ft,Et as It,Fa as Lt,Gs as Rt,Hr as zt,Hs as Bt,Ht as Vt,J as Ht,Ka as Ut,Ki as Wt,Kt as Gt,Lr as Kt,Mr as qt,Ms as Jt,Na as Yt,Oa as Xt,Os as Zt,Ot as Qt,Pr as $t,Ps as en,Pt as tn,Qa as nn,Rr as rn,S as an,Si as on,Ss as sn,St as cn,Ti as ln,Ts as un,Uc as dn,Ut as fn,Wr as pn,Xt as mn,Z as hn,_ as gn,_a as _n,a as vn,ac as W,ar as yn,bi as bn,bt as xn,cl as Sn,cn as Cn,ct as wn,d as Tn,dc as En,dn as Dn,dr as On,es as kn,fc as An,gn as jn,h as Mn,it as Nn,jr as Pn,js as Fn,ka as In,ks as Ln,kt as Rn,ll as zn,lo as Bn,mi as Vn,nl as Hn,no as Un,on as Wn,oo as Gn,or as Kn,qi as qn,rl as Jn,rt as Yn,s as Xn,tl as Zn,tn as Qn,us as $n,ut as er,vi as tr,w as nr,wi as rr,wt as ir,xi as ar,xn as or,xs as sr,ya as cr,yc as lr,yi as ur,yn as dr}from"./paths-CEAy4QCs.js";import{D as G,E as fr,G as pr,J as mr,O as hr,Q as K,U as gr,Z as _r,_ as vr,h as yr,j as br,l as q,p as J,x as xr,z as Sr}from"./debug-otxXY3j-.js";import{n as Cr,r as Y}from"./analytics-DqMQntaB.js";import{n as wr,t as Tr}from"./cwd--iizewsn.js";import{t as Er}from"./sdk-DEtgRZvI.js";import{F as Dr,P as Or,a as kr,f as Ar,i as jr,v as Mr}from"./git-C0IuvuIy.js";import{l as Nr,u as Pr}from"./oauth-CdZEzMww.js";import{n as Fr,t as Ir}from"./bundledMode-kSQejuY4.js";import{n as Lr,t as Rr}from"./which-BnEnzWhs.js";import{a as zr,i as Br,n as Vr}from"./env-C2A9gV_G.js";import{E as Hr,H as Ur,J as Wr,K as Gr,L as Kr,N as qr,V as Jr,W as Yr,et as Xr,o as Zr,s as Qr}from"./log-DSV4Ht5l.js";import{i as $r,o as ei}from"./platform-mh9ypxS8.js";import{n as ti,t as ni}from"./memoize-DJ1XCN-z.js";import{i as ri,n as ii,o as ai,r as oi}from"./path-BE28AJwZ.js";import{r as si,t as ci}from"./execFileNoThrow-azCkYhmF.js";import{s as li,u as ui}from"./types-KeqFPzY5.js";import{S as di,_ as fi,a as pi,b as mi,d as hi,f as gi,l as _i,n as vi,o as yi,r as bi,u as xi,v as Si,x as Ci}from"./teammate-CbskW5G9.js";import{c as wi,n as Ti,s as Ei,t as Di}from"./intl-CLeE9DsD.js";import{T as Oi,b as ki,d as Ai,f as ji,p as Mi,u as Ni,y as Pi}from"./startupProfiler-CBcN1Chw.js";import{n as Fi,t as Ii}from"./lazySchema-B0QShMaQ.js";import{a as Li,c as Ri,d as zi,l as Bi,o as Vi,r as Hi,s as Ui}from"./stringUtils-KZoO4GUd.js";import{$ as Wi,$A as Gi,$D as Ki,$E as qi,$S as Ji,$d as Yi,$f as Xi,$m as Zi,$n as Qi,$p as $i,$t as ea,$u as ta,$v as na,$y as ra,AD as ia,AS as aa,AT as oa,Ab as sa,Ah as ca,Ai as la,Ao as ua,Ar as da,Au as fa,Av as pa,Ax as ma,Ay as ha,BD as ga,BO as _a,BS as va,Bh as ya,Bm as ba,Bo as xa,Bp as Sa,Br as Ca,Bx as wa,CC as Ta,CE as Ea,CS as Da,Cb as Oa,Cg as ka,Cl as Aa,Cm as ja,Cn as Ma,Co as Na,Cy as Pa,D as Fa,DC as Ia,DO as La,DS as Ra,DT as za,Dd as Ba,Dg as Va,Dh as Ha,Di as Ua,Dm as Wa,Dp as Ga,Du as Ka,Dy as qa,EC as Ja,EO as Ya,ES as Xa,ET as Za,Eb as Qa,Ed as $a,Eg as eo,Eh as to,Em as no,Eo as ro,Eu as io,Ex as ao,F as oo,FA as so,FC as co,FD as lo,Fb as uo,Fc as fo,Fh as po,Fj as mo,Fm as ho,Fr as go,Fu as _o,Fx as vo,Fy as yo,G as bo,GD as xo,GE as So,GO as Co,GS as wo,GT as To,Gb as Eo,Gc as Do,Gd as Oo,Gf as ko,Gi as Ao,Gl as jo,Gn as Mo,Gp as No,Gs as Po,Gy as Fo,HE as Io,HO as Lo,HS as Ro,Ha as zo,Hf as Bo,Hi as Vo,Hk as Ho,Hl as Uo,Hn as Wo,Hp as Go,Hs as Ko,Hx as qo,ID as Jo,IE as Yo,IO as Xo,Ih as Zo,Ij as Qo,Ik as $o,Ir as es,Is as ts,Ix as ns,J as rs,JA as is,JD as as,JE as os,JO as ss,JS as cs,Jd as ls,Jf as us,Jg as ds,Jh as fs,Ji as ps,Jl as ms,Js as hs,Jv as gs,Jy as _s,K as vs,KC as ys,KD as bs,KE as xs,KO as Ss,KS as Cs,Ka as ws,Kc as Ts,Kd as Es,Kl as Ds,Kp as Os,Ks as ks,Ky as As,LD as js,LE as Ms,LO as Ns,Lb as Ps,Lc as Fs,Lh as Is,Lj as Ls,Lm as Rs,Lt as zs,MA as Bs,MC as Vs,MD as Hs,MS as Us,MT as Ws,Mb as Gs,Mc as Ks,Mh as qs,Mn as Js,Mo as Ys,Ms as Xs,Mu as Zs,N as Qs,ND as $s,NS as ec,N_ as tc,Nd as nc,Nh as rc,Nj as ic,No as ac,Nu as oc,Nv as sc,Nx as cc,O as lc,OC as uc,OS as dc,OT as fc,Ob as pc,Od as mc,Og as hc,Oi as gc,Om as _c,Op as vc,Ot as yc,Oy as bc,P as xc,PC as Sc,PD as Cc,P_ as wc,Pb as Tc,Pc as Ec,Pd as Dc,Ph as Oc,Pj as kc,Pk as Ac,Po as jc,Pu as Mc,Py as Nc,Q as Pc,QD as Fc,QE as Ic,QO as Lc,QS as Rc,QT as zc,Q_ as Bc,Qd as Vc,Qf as Hc,Qh as Uc,Qk as Wc,Qo as Gc,Qp as Kc,Qr as qc,Qs as Jc,Qu as Yc,Qv as Xc,Qy as Zc,RA as Qc,RD as $c,RE as el,RO as tl,R_ as nl,Rb as rl,Rc as il,Rh as al,Rk as ol,Rm as sl,Rn as cl,Rr as ll,Ry as ul,S as dl,SC as fl,SD as pl,SE as ml,SS as hl,ST as gl,Sb as _l,Sd as vl,Sg as yl,Si as bl,Sl as xl,Sm as Sl,Ss as Cl,Sx as wl,TC as Tl,TS as El,Tb as Dl,Tg as Ol,Th as kl,Tj as Al,Tk as jl,Ts as Ml,Tt as Nl,Tu as Pl,Tv as Fl,Tx as Il,Ty as Ll,UC as Rl,UD as zl,UE as Bl,UO as Vl,US as Hl,Uf as Ul,Uk as Wl,Ul as Gl,Un as Kl,Uo as ql,Up as Jl,Us as Yl,Uu as Xl,Ux as Zl,Uy as Ql,VD as $l,VE as eu,VO as tu,VS as nu,Va as ru,Vf as iu,Vl as au,Vm as ou,Vp as su,Vs as cu,Vx as lu,WC as uu,WD as du,WE as fu,WS as pu,Wa as mu,Wb as hu,Wc as gu,Wd as _u,Wf as vu,Wi as yu,Wk as bu,Wl as xu,Wn as Su,Wo as Cu,Wp as wu,Ws as Tu,Wu as Eu,Wy as Du,XD as Ou,XE as ku,XO as Au,X_ as ju,Xf as Mu,Xi as Nu,Xk as Pu,Xp as Fu,Xu as Iu,Xw as Lu,Xy as Ru,Y as zu,YA as Bu,YD as Vu,YO as Hu,YS as Uu,Yd as Wu,Yf as Gu,Yg as Ku,Yh as qu,Yl as Ju,Yu,Yw as Xu,Yy as Zu,Z as Qu,ZD as $u,ZE as ed,ZO as td,ZT as nd,Zd as rd,Zf as id,Zi as ad,Zm as od,Zo as sd,Zp as cd,Zu as ld,Zy as ud,_O as dd,_S as fd,_T as pd,__ as md,_b as hd,_d as gd,_g as _d,_i as vd,_j as yd,_o as bd,_u as xd,aA as Sd,aC as Cd,aS as wd,aa as Td,ad as Ed,af as Dd,ag as Od,ah as kd,am as Ad,ao as jd,au as Md,bC as Nd,bS as Pd,bT as Fd,ba as Id,bb as Ld,bd as Rd,bg as zd,br as Bd,cD as Vd,cS as Hd,c_ as Ud,ca as Wd,cb as Gd,cd as Kd,cf as qd,cg as Jd,ch as Yd,ck as Xd,cm as Zd,cu as Qd,cy as $d,dC as ef,dS as tf,d_ as nf,db as rf,dc as af,dd as of,df as sf,dg as cf,di as lf,dk as uf,dm as df,dr as ff,dt as pf,du as mf,dx as hf,eC as gf,eD as _f,eO as vf,e_ as yf,ea as bf,eb as xf,ec as Sf,ef as Cf,eg as wf,eh as Tf,ej as Ef,em as Df,eo as Of,ep as kf,fC as Af,fS as jf,fa as Mf,fb as Nf,fc as Pf,fd as Ff,fg as If,fh as Lf,fk as Rf,fl as zf,fm as Bf,fo as Vf,fp as Hf,fs as Uf,ft as Wf,fv as Gf,fy as Kf,gO as qf,gS as Jf,g_ as Yf,ga as Xf,gb as Zf,gd as Qf,gg as $f,gi as ep,gl as tp,go as np,gr as rp,gu as ip,gy as ap,hO as op,hS as sp,h_ as cp,ha as lp,hb as up,hf as dp,hg as fp,hl as pp,ho as mp,hu as hp,hy as gp,iC as _p,iD as vp,i_ as yp,ib as bp,ic as xp,id as Sp,if as Cp,ig as wp,ih as Tp,ii as Ep,ik as Dp,io as Op,is as kp,jC as Ap,jD as jp,jS as Mp,jT as Np,jb as Pp,jh as Fp,jl as Ip,jm as Lp,jn as Rp,jo as zp,ju as Bp,jv as Vp,jx as Hp,jy as Up,kD as Wp,kT as Gp,kb as Kp,kd as qp,kg as Jp,kl as Yp,km as Xp,ko as Zp,kr as Qp,ku as $p,kx as em,ky as tm,lC as X,lD as nm,lS as rm,la as im,lb as am,lf as om,lg as sm,lh as cm,lm,lu as um,mO as dm,mS as fm,m_ as pm,ma as mm,md as hm,mf as gm,mg as _m,ml as vm,mm as ym,mn as bm,ms as xm,mu as Sm,my as Cm,nC as wm,nD as Tm,n_ as Em,na as Dm,nb as Om,nf as km,ng as Am,nh as jm,nm as Mm,nn as Nm,np as Pm,nt as Fm,o as Im,oA as Lm,oC as Rm,oS as zm,oa as Bm,of as Vm,og as Hm,oh as Um,ok as Wm,om as Gm,oo as Km,os as qm,ot as Jm,pD as Ym,pO as Xm,p_ as Zm,pa as Qm,pd as $m,pg as eh,ph as th,pi as nh,pl as rh,pm as ih,po as ah,pp as oh,pv as sh,py as ch,qA as lh,qC as uh,qD as dh,qE as fh,qO as ph,qS as mh,qT as hh,qc as gh,qd as _h,ql as vh,qs as yh,qt as bh,qu as xh,qv as Sh,qx as Ch,qy as wh,rA as Th,rC as Eh,r_ as Dh,ra as Oh,rb as kh,rc as Ah,rd as jh,rf as Mh,rg as Nh,rh as Ph,rk as Fh,rm as Ih,rr as Lh,rt as Rh,sA as zh,sC as Bh,sD as Vh,sS as Hh,s_ as Uh,sa as Wh,sb as Gh,sd as Kh,sf as qh,sg as Jh,sh as Yh,sk as Xh,sm as Zh,so as Qh,sr as $h,tC as eg,tD as tg,tS as ng,t_ as rg,ta as ig,tb as ag,tf as og,tg as sg,th as cg,tj as lg,tm as ug,tp as dg,tt as fg,u as pg,uC as Z,uS as mg,ua as hg,ub as gg,ud as _g,uf as vg,ug as yg,um as bg,uu as xg,ux as Sg,uy as Cg,vO as wg,vS as Tg,vT as Eg,vb as Dg,vg as Og,vj as kg,vo as Ag,vs as jg,vu as Mg,vy as Ng,w as Pg,wC as Fg,wD as Ig,wE as Lg,wO as Rg,wS as zg,wb as Bg,wd as Vg,wg as Hg,wh as Ug,wj as Wg,wm as Gg,wo as Kg,ws as qg,x as Jg,xC as Yg,xD as Xg,xS as Zg,xb as Qg,xg as $g,xk as e_,xl as t_,xm as n_,xo as r_,xx as i_,yO as a_,yS as o_,ya as s_,yb as c_,yd as l_,yg as u_,yi as d_,yu as f_,yy as p_,zE as m_,zO as h_,z_ as g_,zb as __,zh as v_,zk as y_,zm as b_,zn as x_,zo as S_,zp as C_,zx as w_,zy as T_}from"./loadAgentsDir-DC4jN6-f.js";import{Hn as E_,Ht as D_,J as O_,Jt as k_,Kn as A_,M as j_,Mn as M_,P as N_,Qn as P_,Rn as F_,Tt as I_,Ut as L_,V as R_,Vn as z_,Xn as B_,Zn as V_,dn as H_,fn as U_,hn as W_,qn as G_,qt as K_,zn as q_}from"./prompt-BHI7PZe4.js";import{a as J_,n as Y_,r as X_,v as Z_}from"./companion-C-jfFhlz.js";import{r as Q_,t as $_}from"./xml-D7-jJqSA.js";import{a as ev,i as tv,r as nv}from"./shellQuote-CBjhlaFO.js";import{a as rv}from"./ripgrep-Bzwdi5-K.js";import{a as iv,o as av,s as ov}from"./fileStateCache-BhVfo23e.js";import{C as sv,N as cv,S as lv,T as uv,X as dv,b as fv,d as pv,f as mv,j as hv,w as gv,x as _v,y as vv}from"./rcDebugLog-C0Bam8V9.js";import{T as yv,c as bv,r as xv,w as Sv}from"./sessionTracing-DNSDPYdR.js";import{i as Cv,n as wv,r as Tv}from"./parser-aIWfAYnt.js";import{c as Ev,l as Dv}from"./commitAttribution-Djh1ZpYH.js";import{n as Ov,t as kv}from"./poorMode-BdNsLBQ-.js";import{A as Av,E as jv,H as Mv,I as Nv,L as Pv,M as Fv,N as Iv,P as Lv,V as Rv,_ as zv,a as Bv,b as Vv,d as Hv,g as Uv,h as Wv,m as Gv,o as Kv,u as qv,x as Jv}from"./teamHelpers-WmWa_h3B.js";import{a as Yv,f as Xv,l as Zv,o as Qv}from"./api-Cy1N7XAQ.js";import{n as $v,t as ey}from"./browser-Bt-ckCaU.js";import{t as ty}from"./useKeybinding-DPOUuymz.js";import{t as ny}from"./useTerminalSize-Du-EamDN.js";import{c as ry,u as iy}from"./common-Da57Qwms.js";import{i as ay,m as oy,n as sy,p as cy}from"./terminalSetup-DULcnnWe.js";import{n as ly,r as uy,t as dy}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{a as fy,c as py,o as my,s as hy}from"./constants-BljlAJOX.js";import{n as gy,t as _y}from"./SentryErrorBoundary-kEgE7qeH.js";import{i as vy,r as yy}from"./bridgeEnabled-z1fPRzzV.js";import{i as by,n as xy,t as Sy}from"./voiceModeEnabled-C1Q9j5q6.js";import{o as Cy,r as wy,s as Ty}from"./detection-95TCHkW8.js";import{n as Ey,r as Dy}from"./undercover-rcR56jZx.js";import{t as Oy}from"./lib-Cf16LgKj.js";import{t as ky}from"./Dialog-91X6ZGg9.js";import{n as Ay,t as jy}from"./mappers-Bg-xtimK.js";import{n as My,r as Ny}from"./sessionTitle-1k_2BhFL.js";import{t as Py}from"./bridgeMessaging-BG8fNZac.js";import{a as Fy,i as Iy,r as Ly,t as Ry}from"./pipeTransport-7auNUakO.js";import{t as zy}from"./useManagePlugins-z0qezP5r.js";import{c as By,n as Vy,o as Hy}from"./channelNotification-CSmLgwtO.js";import{a as Uy,c as Wy,n as Gy,o as Ky,s as qy,t as Jy}from"./MCPConnectionManager-2Fulnp8q.js";import{c as Yy,i as Xy,l as Zy,n as Qy,o as $y,r as eb,s as tb,u as nb}from"./cronJitterConfig-2sHTXBLu.js";import{i as rb,n as ib}from"./toolPool-DHQyHmDY.js";import{a as ab,c as ob,i as sb,l as cb,o as lb,r as ub,t as db,u as fb}from"./MessageSelector-B4jJQ-KQ.js";import{n as pb,t as mb}from"./sideQuestion-DWOCUKMh.js";import{a as hb,n as gb,o as _b,r as vb,s as yb,t as bb}from"./skillChangeDetector-345QNWDp.js";import{n as xb,t as Sb}from"./refresh-DmEsCaJ0.js";import{i as Cb,n as wb,r as Tb,t as Eb}from"./directoryCompletion-DqtWZsoW.js";import{r as Db,t as Ob}from"./PromptInputFooterSuggestions-DAFZfAT0.js";import{n as kb,t as Ab}from"./useMergedTools-B78rAreW.js";import{a as jb,i as Mb,n as Nb,o as Pb,r as Fb,t as Ib}from"./promptEditor-DoJ-xPi4.js";import{n as Lb,t as Rb}from"./useMainLoopModel-BTpZ8k3k.js";import{i as zb,n as Bb,r as Vb,t as Hb}from"./PermissionDialog-R-Vl4Tk-.js";import{n as Ub,t as Wb}from"./RemoteCallout-CwI1mLQ9.js";import{i as Gb,n as Kb,r as qb,t as Jb}from"./sprites-ChoMSqpa.js";import{a as Yb,n as Xb,t as Zb}from"./setup-Hlga8GJ_.js";import{a as Qb,c as $b,i as ex,o as tx,r as nx,s as rx}from"./caches-CzEBsMvP.js";import{n as ix,t as ax}from"./conversation-DR4MFYYi.js";import{a as ox,i as sx,n as cx,o as lx,r as ux,s as dx,t as fx}from"./extraUsage-Ca_6qcke.js";import{n as px,t as mx}from"./useSearchInput-CwxF3CHN.js";import{n as hx,t as gx}from"./useSettingsErrors-CjDaon07.js";import{n as _x,t as vx}from"./shadowedRuleDetection-BdBNo5eP.js";import{n as yx,t as bx}from"./ExitFlow-C3BGvwv-.js";import{a as xx,c as Sx,i as Cx,l as wx,n as Tx,o as Ex,r as Dx,s as Ox,t as kx}from"./Messages-ltcn1Qkf.js";import{n as Ax,t as jx}from"./exportRenderer-DP_z8YD1.js";import{i as Mx,n as Nx,t as Px}from"./bypassPermissionsKillswitch-7e56Rquc.js";import{a as Fx,i as Ix,r as Lx,t as Rx}from"./fast-BJMGfO_S.js";import{n as zx,r as Bx}from"./Feedback-BtZb1A8b.js";import{a as Vx,i as Hx,n as Ux,r as Wx,t as Gx}from"./PromptInputHelpMenu-CAwbW7z2.js";import{n as Kx,r as qx}from"./language-DzWvcLCu.js";import{n as Jx,r as Yx}from"./pluginAutoupdate-Cre72Rtf.js";import{n as Xx,r as Zx}from"./autoModeDenials-BDpcFLb7.js";import{n as Qx,t as $x}from"./generateSessionName-CXg1uVLN.js";import{n as eS,t as tS}from"./fuse-D7icKomM.js";import{a as nS,c as rS,i as iS,l as aS,n as oS,o as sS,r as cS,s as lS,t as uS}from"./BackgroundTasksDialog-DSeAqhMC.js";import{r as dS,t as fS}from"./useVoice-X5WSnyed.js";import{n as pS}from"./fpsMetrics-DH78PzGr.js";import{t as mS}from"./earlyInput-B3U01GAm.js";import{a as hS,c as gS,f as _S,i as vS,l as yS,o as bS,r as xS,s as SS,t as CS}from"./RemoteSessionManager-BXMBhfQD.js";import{n as wS,t as TS}from"./backgroundHousekeeping-Cll7XHG1.js";import{homedir as ES,tmpdir as DS}from"os";import*as OS from"path";import{basename as kS,dirname as AS,extname as jS,join as MS,relative as NS,sep as PS}from"path";import{dirname as FS,join as IS}from"node:path";import{watch as LS}from"fs";import{createHash as RS}from"node:crypto";import{randomUUID as zS}from"crypto";import{readFile as BS,stat as VS,writeFile as HS}from"fs/promises";import{spawn as US,spawnSync as WS}from"child_process";import{mkdir as GS,readFile as KS,rename as qS,writeFile as JS}from"node:fs/promises";s(),u(),h(),w(),F(),Ee(),O(),f(),Le(),ot(),Sn(),Cr(),wr(),_r(),Er(),gr(),fr(),vr(),q(),Or(),Pr(),Ir(),Rr(),zr(),Hn(),Xr(),Zr(),ei(),ni(),ri(),dn(),si(),Mr(),li(),lr(),Ci(),Ei(),ki(),Rt(),Ii(),en(),sn(),$n(),Nt(),Vi(),Gn(),Lt(),In(),cr(),qn(),tr(),$t(),On(),Wn(),Qt(),ir(),Yn(),fi(),_i(),Ht(),an(),vn(),Qo(),Al(),P_(),G_(),E_(),M_(),lg(),is(),W_(),rv(),so(),U_(),k_(),L_(),I_(),R_(),j_(),zh(),Th(),av(),Wc(),bu(),ol(),jl(),uf(),Xd(),Dp(),Ss(),Rg(),qf(),vf(),Fc(),Sv(),Tv(),nv(),bs(),ga(),lo(),Wp(),pl(),Vh(),vp(),_f(),cv(),ku(),Q_(),fh(),Io(),Ms(),Lv(),Lg(),ey(),Ws(),Np(),Gp(),za(),ty(),gl(),ny(),ry(),Lu(),uu(),co(),Ia(),fl(),Nd(),X(),Rm(),_p(),wm(),gf(),cy(),ay(),Cs(),aa(),Da(),uy(),Zg(),Tg(),fm(),jf(),Hh(),zm(),ng(),Zl(),ma(),pc(),Qa(),_l(),Zf(),Vv(),py(),Bv(),kh(),ud(),Up(),Ng(),$d(),Xc(),sh(),Bc(),cp(),Zm(),Dh(),gy(),fp(),sm(),Am(),qu(),ya(),qs(),kl(),th(),Yd(),ba(),Xp(),Gg(),Ih(),$i(),cd(),Os(),wu(),su(),Sa(),vc(),yy(),Pm(),id(),Gu(),vu(),Bo(),xy(),vv(),l_(),$m(),Sp(),ld(),Xl(),fa(),Ka(),f_(),xd(),bv(),Qd(),Md(),ms(),au(),Yp(),t_(),pp(),rh(),gh(),gu(),Fs(),fo(),af(),xp(),yh(),Xs(),qg(),jg(),Uf(),ql(),mu(),Id(),Dm(),go(),Wo(),Rp(),Ma(),fg(),Pc(),rs(),vs(),Pg(),$y(),eb(),jb(),zb(),Bb(),mx(),Tx(),jx(),zx();var Q=n(L(),1);H(),ul();var $=je();function YS({onDone:e}){return(0,$.jsxs)(B,{title:`You've spent $5 on the Anthropic API this session.`,onCancel:e,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{children:`Learn more about how to monitor your spending:`}),(0,$.jsx)(re,{url:`https://code.claude.com/docs/en/costs`})]}),(0,$.jsx)(wd,{options:[{value:`ok`,label:`Got it, thanks!`}],onChange:e})]})}H(),ul();function XS({idleMinutes:e,totalInputTokens:t,onDone:n}){return(0,$.jsxs)(B,{title:`You've been away ${ZS(e)} and this conversation is ${Pi(t)} tokens.`,onCancel:()=>n(`dismiss`),children:[(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(R,{children:`If this is a new task, clearing context will save usage and be faster.`})}),(0,$.jsx)(wd,{options:[{value:`continue`,label:`Continue this conversation`},{value:`clear`,label:`Send message as a new conversation`},{value:`never`,label:`Don't ask me again`}],onChange:e=>n(e)})]})}function ZS(e){if(e<1)return`< 1m`;if(e<60)return`${Math.floor(e)}m`;let t=Math.floor(e/60),n=Math.floor(e%60);return n===0?`${t}h`:`${t}h ${n}m`}hu();var QS=300,$S=240*1e3,eC=null,tC=null,nC=0,rC=!1;function iC(){nC++,nC===1&&(lC(),sC())}function aC(){nC>0&&nC--,nC===0&&(cC(),uC())}function oC(){nC=0,cC(),uC()}function sC(){process.platform===`darwin`&&tC===null&&(tC=setInterval(()=>{nC>0&&(J(`Restarting caffeinate to maintain sleep prevention`),uC(),lC())},$S),tC.unref())}function cC(){tC!==null&&(clearInterval(tC),tC=null)}function lC(){if(process.platform===`darwin`&&eC===null){rC||(rC=!0,K(async()=>{oC()}));try{eC=US(`caffeinate`,[`-i`,`-t`,String(QS)],{stdio:`ignore`}),eC.unref();let e=eC;eC.on(`error`,t=>{J(`caffeinate spawn error: ${t.message}`),eC===e&&(eC=null)}),eC.on(`exit`,()=>{eC===e&&(eC=null)}),J(`Started caffeinate to prevent sleep`)}catch{eC=null}}}function uC(){if(eC!==null){let e=eC;eC=null;try{e.kill(`SIGKILL`),J(`Stopped caffeinate, allowing sleep`)}catch{}}}var dC=class{constructor(){d(this,`_status`,`idle`),d(this,`_generation`,0),d(this,`_changed`,Ke()),d(this,`subscribe`,this._changed.subscribe),d(this,`getSnapshot`,()=>this._status!==`idle`)}reserve(){return this._status===`idle`?(this._status=`dispatching`,this._notify(),!0):!1}cancelReservation(){this._status===`dispatching`&&(this._status=`idle`,this._notify())}tryStart(){return this._status===`running`?null:(this._status=`running`,++this._generation,this._notify(),this._generation)}end(e){return this._generation!==e||this._status!==`running`?!1:(this._status=`idle`,this._notify(),!0)}forceEnd(){this._status!==`idle`&&(this._status=`idle`,++this._generation,this._notify())}get isActive(){return this._status!==`idle`}get generation(){return this._generation}_notify(){this._changed.emit()}};__(),Pp(),Qg(),hd(),Gh(),As(),Vm(),Yi(),H(),am();function fC({name:e,color:t}){return(0,$.jsx)(U,{flexDirection:`row`,gap:1,children:(0,$.jsxs)(R,{color:gg(t),children:[Fn,` `,(0,$.jsxs)(R,{bold:!0,children:[`@`,e]})]})})}H();function pC({toolName:e,description:t}){let n=pi(),r=vi(),i=yi();return(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`warning`,paddingX:1,children:[(0,$.jsxs)(U,{marginBottom:1,children:[(0,$.jsx)(Du,{}),(0,$.jsxs)(R,{color:`warning`,bold:!0,children:[` `,`Waiting for team lead approval`]})]}),r&&i&&(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(fC,{name:r,color:i})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Tool: `}),(0,$.jsx)(R,{children:e})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Action: `}),(0,$.jsx)(R,{children:t})]}),n&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Permission request sent to team `,`"`,n,`"`,` leader`]})})]})}Oo();function mC(e,t=!1){let n=Z(e=>e.teamContext),r=(0,Q.useRef)(0),i=(0,Q.useRef)(void 0),a=(0,Q.useRef)(void 0),o=(0,Q.useRef)(0);(0,Q.useEffect)(()=>{if(t)return;let s=e[0]?.uuid,c=r.current,l=a.current===void 0,u=s!==void 0&&!l&&s===a.current&&c<=e.length,d=s!==void 0&&!l&&s===a.current&&c>e.length,f=u?c:0;if(f===e.length)return;let p=f===0?e:e.slice(f),m=u?i.current:void 0,h=++o.current;if(lf(p,Nn()?{teamName:n?.teamName,agentName:n?.selfAgentName}:{},m,e).then(e=>{h===o.current&&e&&!u&&(i.current=e)}),u||l||d){let t=Lh(p,e).findLast(es);t&&(i.current=t.uuid)}r.current=e.length,a.current=s},[e,t,n?.teamName,n?.selfAgentName])}function hC(e){return!e||typeof e!=`object`?!1:`behavior`in e&&(e.behavior===`allow`||e.behavior===`deny`)}function gC(e,t){if(typeof e.message==`string`&&e.message)return e.message;if(typeof t?.message==`string`&&t.message)return t.message;if(typeof e.error==`string`&&e.error)return e.error}function _C(e){let t=e.response;if(!t||typeof t!=`object`)return null;if(t.subtype===`success`&&`response`in t&&hC(t.response))return t.response;if(t.subtype!==`error`)return null;let n=`response`in t&&hC(t.response)?t.response:void 0,r=gC(t,n);return n?r?{...n,message:r}:n:r?{behavior:`deny`,message:r}:null}function vC(t){{let{pauseProactive:t}=(vv(),e(sv));t()}t?.abort()}function yC(e,t){return e<t}function bC(e,t){return e&&t===0}function xC({hasHandle:e,isConnected:t,lastWrittenIndex:n,messageCount:r}){return!e||!t?!0:yC(n,r)}Qf();function SC(e){return{id:e.id,subject:e.subject,description:e.description,activeForm:e.activeForm,status:e.status,owner:e.owner,blocks:[...e.blocks],blockedBy:[...e.blockedBy]}}function CC(e,t){return e.id.localeCompare(t.id)}function wC(e,t){return{task_list_id:e,tasks:t.filter(e=>!e.metadata?._internal).map(SC).sort(CC)}}function TC(e,t){return JSON.stringify(wC(e,t))}function EC(e,t){let n=wC(e,t);return{type:`task_state`,uuid:zS(),...n}}H(),X(),q();var DC=50,OC=5e3,kC=1e4,AC=3;function jC(e,t,n,r,i){let a=(0,Q.useRef)(null),o=(0,Q.useRef)(void 0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(!1),l=(0,Q.useRef)(!1),u=(0,Q.useRef)(new Set),d=(0,Q.useRef)(void 0),f=(0,Q.useRef)(0),p=Af(),m=(0,Q.useRef)(r);m.current=r;let h=(0,Q.useRef)(i);h.current=i;let g=(0,Q.useRef)(e);g.current=e;let _=ef(),{addNotification:v}=Bh(),y=Z(e=>e.replBridgeEnabled),b=Z(e=>e.replBridgeConnected),x=Z(e=>e.replBridgeSessionActive),S=Z(e=>e.replBridgeOutboundOnly),C=Z(e=>e.replBridgeInitialName);return(0,Q.useEffect)(()=>{{if(!y)return;let r=S;function i(e){r||v({key:`bridge-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`error`,children:`Remote Control failed`}),e&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,e]})]}),priority:`immediate`})}if(f.current>=AC){J(`[bridge:repl] Hook: ${f.current} consecutive init failures, not retrying this session`);let e=`disabled after repeated failures · restart to retry`;i(e),p(t=>t.replBridgeError===e&&!t.replBridgeEnabled?t:{...t,replBridgeError:e,replBridgeEnabled:!1});return}let b=!1,x=e.length;return(async()=>{try{if(o.current&&(J(`[bridge:repl] Hook: waiting for previous teardown to complete before re-init`),await o.current,o.current=void 0,J(`[bridge:repl] Hook: previous teardown complete, proceeding with re-init`)),b)return;let{initReplBridge:v}=await import(`./initReplBridge-YGXqLbNZ.js`),{shouldShowAppUpgradeMessage:y}=await import(`./envLessBridgeConfig-Dj0umjOo.js`),S=!1;{let{isAssistantMode:e}=await import(`./assistant-B2_c5C4T.js`);S=e()}async function w(e){try{let t=Zy(e);if(!t)return;let{uuid:n}=t,{resolveAndPrepend:r}=await import(`./inboundAttachments-DZiITyN8.js`),i=t.content,a=await r(e,i);J(`[bridge:repl] Injecting inbound user message: ${typeof a==`string`?a.slice(0,80):`[${a.length} content blocks]`}${n?` uuid=${n}`:``}`),h_({value:a,mode:`prompt`,uuid:n,skipSlashCommands:!0,bridgeOrigin:!0})}catch(e){J(`[bridge:repl] handleInboundMessage failed: ${e}`,{level:`error`})}}function T(e,n){if(b)return;if(r){J(`[bridge:repl] Mirror state=${e}${n?` detail=${n}`:``}`),e===`failed`?p(e=>e.replBridgeConnected?{...e,replBridgeConnected:!1}:e):(e===`ready`||e===`connected`)&&p(e=>e.replBridgeConnected?e:{...e,replBridgeConnected:!0});return}let o=a.current;switch(e){case`ready`:p(e=>{let t=o&&o.environmentId!==``?uo(o.environmentId,o.sessionIngressUrl):e.replBridgeConnectUrl,n=o?Yo(o.bridgeSessionId,o.sessionIngressUrl):e.replBridgeSessionUrl,r=o?.environmentId,i=o?.bridgeSessionId;return e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeReconnecting&&e.replBridgeConnectUrl===t&&e.replBridgeSessionUrl===n&&e.replBridgeEnvironmentId===r&&e.replBridgeSessionId===i?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:t,replBridgeSessionUrl:n,replBridgeEnvironmentId:r,replBridgeSessionId:i,replBridgeError:void 0}});break;case`connected`:{let e=_.getState().replBridgeSessionActive;p(e=>e.replBridgeSessionActive?e:{...e,replBridgeConnected:!0,replBridgeSessionActive:!0,replBridgeReconnecting:!1,replBridgeError:void 0}),e||t(e=>[...e,Na(`Remote Control 已连接。现在可以使用 PushNotification、SendUserFile、Brief 工具,请使用 SearchExtraTools 搜索发现。`,`info`)]),gn(`tengu_bridge_system_init`,!1)&&(async()=>{try{let e=await bf(Tr());if(b)return;let t=_.getState();a.current?.writeSdkMessages([lb({tools:[],mcpClients:[],model:h.current,permissionMode:t.toolPermissionContext.mode,commands:m.current.filter(Oh),agents:t.agentDefinitions.activeAgents,skills:e,plugins:[],fastMode:t.fastMode})])}catch(e){J(`[bridge:repl] Failed to send system/init: ${Sr(e)}`,{level:`error`})}})();break}case`reconnecting`:p(e=>e.replBridgeReconnecting?e:{...e,replBridgeReconnecting:!0,replBridgeSessionActive:!1});break;case`failed`:clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n,replBridgeReconnecting:!1,replBridgeSessionActive:!1,replBridgeConnected:!1})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},kC);break}}let E=new Map;function D(e){let t=e.response?.request_id;if(!t)return;let n=E.get(t);if(!n){J(`[bridge:repl] No handler for control_response request_id=${t}`);return}let r=_C(e);if(!r){J(`[bridge:repl] Ignoring unrecognized control_response request_id=${t}`);return}E.delete(t),n(r)}let O=await v({outboundOnly:r,tags:r?[`ccr-mirror`]:void 0,onInboundMessage:w,onPermissionResponse:D,onInterrupt(){vC(n.current)},onSetModel(e){let t=e===`default`?null:e??null;gt(t),p(e=>e.mainLoopModelForSession===t?e:{...e,mainLoopModelForSession:t})},onSetMaxThinkingTokens(e){let t=e!==null;p(e=>e.thinkingEnabled===t?e:{...e,thinkingEnabled:t})},onSetPermissionMode(e){if(e===`bypassPermissions`){if(lc())return{ok:!1,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`};if(!_.getState().toolPermissionContext.isBypassPermissionsModeAvailable)return{ok:!1,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}if(e===`auto`&&!Fa()){let e=dl();return{ok:!1,error:e?`Cannot set permission mode to auto: ${Jg(e)}`:`Cannot set permission mode to auto`}}return p(t=>{let n=t.toolPermissionContext.mode;if(n===e)return t;let r=oo(n,e,t.toolPermissionContext);return{...t,toolPermissionContext:{...r,mode:e}}}),setImmediate(()=>{_u()?.(e=>(e.forEach(e=>{e.recheckPermission()}),e))}),{ok:!0}},onStateChange:T,initialMessages:e.length>0?e:void 0,getMessages:()=>g.current,previouslyFlushedUUIDs:u.current,initialName:C,perpetual:S}),k=O?{...O,markTranscriptReset(){l.current=!0,c.current=!1,s.current=0}}:null;if(b){J(`[bridge:repl] Hook: init cancelled during flight, tearing down${k?` env=${k.environmentId}`:``}`),k&&k.teardown();return}if(!k){f.current++,J(`[bridge:repl] Init returned null (precondition or session creation failed); consecutive failures: ${f.current}`),clearTimeout(d.current),p(e=>({...e,replBridgeError:e.replBridgeError??`check debug logs for details`})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},kC);return}if(a.current=k,gd(k),f.current=0,s.current=x,r)p(e=>e.replBridgeConnected&&e.replBridgeSessionId===k.bridgeSessionId?e:{...e,replBridgeConnected:!0,replBridgeSessionId:k.bridgeSessionId,replBridgeSessionUrl:void 0,replBridgeConnectUrl:void 0,replBridgeError:void 0}),J(`[bridge:repl] Mirror initialized, session=${k.bridgeSessionId}`);else{let e={sendRequest(e,t,n,r,i,a,o){k.sendControlRequest({type:`control_request`,request_id:e,request:{subtype:`can_use_tool`,tool_name:t,input:n,tool_use_id:r,description:i,...a?{permission_suggestions:a}:{},...o?{blocked_path:o}:{}}})},sendResponse(e,t){let n={...t};k.sendControlResponse({type:`control_response`,response:{subtype:`success`,request_id:e,response:n}})},cancelRequest(e){k.sendControlCancelRequest(e)},onResponse(e,t){return E.set(e,t),()=>{E.delete(e)}}};p(t=>({...t,replBridgePermissionCallbacks:e}));let n=Yo(k.bridgeSessionId,k.sessionIngressUrl),r=k.environmentId===``?void 0:uo(k.environmentId,k.sessionIngressUrl);p(e=>e.replBridgeConnected&&e.replBridgeSessionUrl===n?e:{...e,replBridgeConnected:!0,replBridgeSessionUrl:n,replBridgeConnectUrl:r??e.replBridgeConnectUrl,replBridgeEnvironmentId:k.environmentId,replBridgeSessionId:k.bridgeSessionId,replBridgeError:void 0});let i=S?!1:await y().catch(()=>!1);if(b)return;t(e=>[...e,bd(n,i?`Please upgrade to the latest version of the Claude mobile app to see your Remote Control sessions.`:void 0)]),J(`[bridge:repl] Hook initialized, session=${k.bridgeSessionId}`)}}catch(e){if(b)return;f.current++;let n=Sr(e);J(`[bridge:repl] Init failed: ${n}; consecutive failures: ${f.current}`),clearTimeout(d.current),i(n),p(e=>({...e,replBridgeError:n})),d.current=setTimeout(()=>{b||(d.current=void 0,p(e=>e.replBridgeError?{...e,replBridgeEnabled:!1,replBridgeError:void 0}:e))},kC),r||t(e=>[...e,Na(`Remote Control failed to connect: ${n}`,`warning`)])}})(),()=>{b=!0,clearTimeout(d.current),d.current=void 0,a.current&&(J(`[bridge:repl] Hook cleanup: starting teardown for env=${a.current.environmentId} session=${a.current.bridgeSessionId}`),o.current=a.current.teardown(),a.current=null,gd(null)),p(e=>!e.replBridgeConnected&&!e.replBridgeSessionActive&&!e.replBridgeError?e:{...e,replBridgeConnected:!1,replBridgeSessionActive:!1,replBridgeReconnecting:!1,replBridgeConnectUrl:void 0,replBridgeSessionUrl:void 0,replBridgeEnvironmentId:void 0,replBridgeSessionId:void 0,replBridgeError:void 0,replBridgePermissionCallbacks:void 0}),s.current=0,c.current=!1,l.current=!1}}},[y,S,p,t,v]),(0,Q.useEffect)(()=>{{if(!b)return;let t=a.current;if(!t)return;s.current>e.length&&J(`[bridge:repl] Compaction detected: lastWrittenIndex=${s.current} > messages.length=${e.length}, clamping`);let n=Math.min(s.current,e.length),r=[];for(let t=n;t<e.length;t++){let n=e[t];n&&(n.type===`user`||n.type===`assistant`||n.type===`system`&&n.subtype===`local_command`)&&r.push(n)}if(s.current=e.length,r.length>0&&(t.writeMessages(r),l.current=!1),c.current&&bC(l.current,e.length)){l.current=!1,c.current=!1,t.sendResult();return}c.current&&!l.current&&(c.current=!1,t.sendResult())}},[e,b]),(0,Q.useEffect)(()=>{{if(!x||S)return;let e=!1,t,n,r=null,i=null,o=null,s=null,c=e=>{if(!(e===i&&r!==null)){r?.close(),r=null,i=e;try{r=LS(e,u),r.unref()}catch{}}},l=async()=>{let t=a.current;if(!t)return;let n=Fv();c(Iv(n));try{let r=await Nv(n);if(e||a.current!==t)return;let i=TC(n,r);if(i===o&&t===s)return;t.writeSdkMessages([EC(n,r)]),o=i,s=t}catch(e){J(`[bridge:repl] Failed to publish task_state: ${Sr(e)}`,{level:`error`})}},u=()=>{t&&clearTimeout(t),t=setTimeout(()=>{t=void 0,l()},DC),t.unref?.()};l();let d=Pv(u);return n=setInterval(()=>{l()},OC),n.unref?.(),()=>{e=!0,d(),t&&clearTimeout(t),n&&clearInterval(n),r?.close()}}},[x,S]),{sendBridgeResult:(0,Q.useCallback)(()=>{{let e=a.current;if(!e){c.current=!0;return}if(bC(l.current,g.current.length)){l.current=!1,c.current=!1,e.sendResult();return}if(l.current||xC({hasHandle:!0,isConnected:b,lastWrittenIndex:s.current,messageCount:g.current.length})){c.current=!0;return}e.sendResult()}},[b])}}dy(),ub();var MC=Fi(()=>b({method:v(`log_event`),params:b({eventName:_(),eventData:b({}).passthrough()})}));function NC(e){(0,Q.useEffect)(()=>{if(!e.length)return;let t=Il(e);t&&t.client.setNotificationHandler(MC(),e=>{let{eventName:t,eventData:n}=e.params;Y(`tengu_ide_${t}`,n)})},[e])}ot(),H();var PC=6e3;function FC(){return Date.now()-et()}function IC(e){return FC()<e}function LC(e){return!IC(e)}function RC(e,t){let n=A();(0,Q.useEffect)(()=>{We(!0)},[]),(0,Q.useEffect)(()=>{let r=!1,i=setInterval(()=>{LC(6e3)&&!r&&(r=!0,clearInterval(i),Eo({message:e,notificationType:t},n))},PC);return()=>clearInterval(i)},[e,t,n])}Ap(),rg(),kd(),jm(),Zi(),Fb(),H(),pd();var zC={topLeft:`┌`,topRight:`┐`,bottomLeft:`└`,bottomRight:`┘`,horizontal:`─`,vertical:`│`,teeLeft:`├`,teeRight:`┤`};function BC(e){return Eh().syntaxHighlightingDisabled?(0,$.jsx)(HC,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(HC,{...e,highlight:null}),children:(0,$.jsx)(VC,{...e})})}function VC(e){let t=(0,Q.use)(Ou());return(0,$.jsx)(HC,{...e,highlight:t})}function HC({content:e,maxLines:t,minHeight:n,minWidth:r=40,maxWidth:i,highlight:a}){let{columns:o}=k(),[s]=ae(),c=i??o-4,l=t??20,u=(0,Q.useMemo)(()=>pm(e,s,a),[e,s,a]).split(`
|
|
2
2
|
`),d=u.length>l,f=d?u.slice(0,l):u,p=Math.max(0,Math.min(n??0,l)-f.length-+!!d),m=p>0?[...f,...Array(p).fill(``)]:f,h=Math.max(r,...m.map(e=>D(e))),g=Math.min(h+4,c),_=g-4,v=`${zC.topLeft}${zC.horizontal.repeat(g-2)}${zC.topRight}`,y=`${zC.bottomLeft}${zC.horizontal.repeat(g-2)}${zC.bottomRight}`,b=d?(()=>{let e=u.length-l,t=`${zC.horizontal.repeat(3)} \u2702 ${zC.horizontal.repeat(3)} ${e} lines hidden `,n=D(t),r=Math.max(0,g-2-n);return`${zC.teeLeft}${t}${zC.horizontal.repeat(r)}${zC.teeRight}`})():null;return(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{dimColor:!0,children:v}),m.map((e,t)=>{let n=D(e)>_?Eg(e,0,_):e,r=` `.repeat(Math.max(0,_-D(n)));return(0,$.jsxs)(U,{flexDirection:`row`,children:[(0,$.jsxs)(R,{dimColor:!0,children:[zC.vertical,` `]}),(0,$.jsx)(fe,{children:n}),(0,$.jsxs)(R,{dimColor:!0,children:[r,` `,zC.vertical]})]},t)}),b&&(0,$.jsx)(R,{color:`warning`,children:b}),(0,$.jsx)(R,{dimColor:!0,children:y})]})}ny(),H(),ki();function UC({questions:e,currentQuestionIndex:t,answers:n,hideSubmitTab:r=!1}){let{columns:i}=k(),a=(0,Q.useMemo)(()=>{let n=r?``:` ${p.tick} Submit `,a=i-(D(`← `)+D(` →`)+D(n));if(a<=0)return e.map((e,n)=>{let r=e?.header||`Q${n+1}`;return n===t?r.slice(0,3):``});let o=e.map((e,t)=>e?.header||`Q${t+1}`);if(o.map(e=>4+D(e)).reduce((e,t)=>e+t,0)<=a)return o;let s=4+D(o[t]||``),c=Math.min(s,a/2),l=a-c,u=e.length-1,d=Math.max(6,Math.floor(l/Math.max(u,1)));return o.map((e,n)=>n===t?Oi(e,c-2-2):Oi(e,d-2-2))},[e,t,i,r]),o=e.length===1&&r;return(0,$.jsxs)(U,{flexDirection:`row`,marginBottom:1,children:[!o&&(0,$.jsx)(R,{color:t===0?`inactive`:void 0,children:`← `}),e.map((e,r)=>{let i=r===t,o=e?.question&&n[e.question]?p.checkboxOn:p.checkboxOff,s=a[r]||e?.header||`Q${r+1}`;return(0,$.jsx)(U,{children:i?(0,$.jsxs)(R,{backgroundColor:`permission`,color:`inverseText`,children:[` `,o,` `,s,` `]}):(0,$.jsxs)(R,{children:[` `,o,` `,s,` `]})},e?.question||`question-${r}`)}),!r&&(0,$.jsx)(U,{children:t===e.length?(0,$.jsxs)(R,{backgroundColor:`permission`,color:`inverseText`,children:[` `,p.tick,` Submit`,` `]}):(0,$.jsxs)(R,{children:[` `,p.tick,` Submit `]})},`submit`),!o&&(0,$.jsx)(R,{color:t===e.length?`inactive`:void 0,children:` →`})]})}f(),ny(),H(),X(),ma();function WC({question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a=!1,minContentHeight:o,minContentWidth:s,onUpdateQuestionState:c,onAnswer:l,onTextInputFocus:u,onCancel:d,onTabPrev:f,onTabNext:m,onRespondToClaude:h,onFinishPlanInterview:g}){let _=Z(e=>e.toolPermissionContext.mode)===`plan`,[v,y]=(0,Q.useState)(!1),[b,x]=(0,Q.useState)(0),[S,C]=(0,Q.useState)(!1),[w,T]=(0,Q.useState)(0),E=Mb(),D=E?w_(E):null,O=e.question,A=i[O],j=e.options,[M,N]=(0,Q.useState)(0),P=(0,Q.useRef)(O);if(P.current!==O){P.current=O;let e=A?.selectedValue,t=e?j.findIndex(t=>t.label===e):-1;N(t>=0?t:0)}let ee=j[M],F=A?.selectedValue,te=A?.textInputValue||``,ne=(0,Q.useCallback)(e=>{let t=j[e];t&&(N(e),c(O,{selectedValue:t.label},!1),l(O,t.label))},[j,O,c,l]),I=(0,Q.useCallback)(e=>{if(S)return;let t;t=typeof e==`number`?e:e===`up`?M>0?M-1:M:M<j.length-1?M+1:M,t>=0&&t<j.length&&N(t)},[M,j.length,S]);we(`chat:externalEditor`,async()=>{let e=A?.textInputValue||``,t=await Nb(e);t.content!==null&&t.content!==e&&c(O,{textInputValue:t.content},!1)},{context:`Chat`,isActive:S&&!!E}),V({"tabs:previous":()=>f?.(),"tabs:next":()=>m?.()},{context:`Tabs`,isActive:!S&&!v});let re=(0,Q.useCallback)(()=>{C(!1),u(!1),F&&l(O,F)},[F,O,l,u]),L=(0,Q.useCallback)(()=>{y(!0)},[]),ie=(0,Q.useCallback)(()=>{y(!1)},[]),ae=(0,Q.useCallback)(e=>{if(v){if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),b===0?ie():x(0);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),_&&b===0&&x(1);return}if(e.key===`return`){e.preventDefault(),b===0?h():g();return}e.key===`escape`&&(e.preventDefault(),d());return}if(S){e.key===`escape`&&(e.preventDefault(),re());return}if(e.key===`up`||e.ctrl&&e.key===`p`)e.preventDefault(),M>0&&I(`up`);else if(e.key===`down`||e.ctrl&&e.key===`n`)e.preventDefault(),M===j.length-1?L():I(`down`);else if(e.key===`return`)e.preventDefault(),ne(M);else if(e.key===`n`&&!e.ctrl&&!e.meta)e.preventDefault(),C(!0),u(!0);else if(e.key===`escape`)e.preventDefault(),d();else if(e.key.length===1&&e.key>=`1`&&e.key<=`9`){e.preventDefault();let t=parseInt(e.key,10)-1;t<j.length&&I(t)}},[v,b,_,S,M,j.length,ie,L,I,ne,re,h,g,d,u]),oe=ee?.preview||null,{columns:se}=k(),ce=se-30-4,le=(0,Q.useMemo)(()=>o?Math.max(1,o-11):void 0,[o]);return(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:ae,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`column`,paddingTop:0,children:[(0,$.jsx)(UC,{questions:t,currentQuestionIndex:n,answers:r,hideSubmitTab:a}),(0,$.jsx)(Vb,{title:e.question,color:`text`}),(0,$.jsxs)(U,{flexDirection:`column`,minHeight:o,children:[(0,$.jsxs)(U,{marginTop:1,flexDirection:`row`,gap:4,children:[(0,$.jsx)(U,{flexDirection:`column`,width:30,children:j.map((e,t)=>{let n=M===t,r=F===e.label;return(0,$.jsxs)(U,{flexDirection:`row`,children:[n?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsxs)(R,{dimColor:!0,children:[` `,t+1,`.`]}),(0,$.jsxs)(R,{color:r?`success`:n?`suggestion`:void 0,bold:n,children:[` `,e.label]}),r&&(0,$.jsxs)(R,{color:`success`,children:[` `,p.tick]})]},e.label)})}),(0,$.jsxs)(U,{flexDirection:`column`,flexGrow:1,children:[(0,$.jsx)(BC,{content:oe||`No preview available`,maxLines:le,minWidth:s,maxWidth:ce}),(0,$.jsxs)(U,{marginTop:1,flexDirection:`row`,gap:1,children:[(0,$.jsx)(R,{color:`suggestion`,children:`Notes:`}),S?(0,$.jsx)(tf,{value:te,placeholder:`Add notes on this design…`,onChange:e=>{c(O,{textInputValue:e},!1)},onSubmit:re,onExit:re,focus:!0,showCursor:!0,columns:60,cursorOffset:w,onChangeCursorOffset:T}):(0,$.jsx)(R,{dimColor:!0,italic:!0,children:te||`press n to add notes`})]})]})]}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[v&&b===0?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsx)(R,{color:v&&b===0?`suggestion`:void 0,children:`Chat about this`})]}),_&&(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[v&&b===1?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsx)(R,{color:v&&b===1?`suggestion`:void 0,children:`Skip interview and plan immediately`})]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`inactive`,dimColor:!0,children:[`Enter to select · `,p.arrowUp,`/`,p.arrowDown,` to navigate · n to add notes`,t.length>1&&(0,$.jsx)($.Fragment,{children:` · Tab to switch questions`}),S&&D&&(0,$.jsxs)($.Fragment,{children:[` · ctrl+g to edit in `,D]}),` · Esc to cancel`]})})]})]})]})}f(),H(),X(),jb(),ma(),Fb(),ul(),zb();function GC({question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a=!1,planFilePath:o,minContentHeight:s,minContentWidth:c,onUpdateQuestionState:l,onAnswer:u,onTextInputFocus:d,onCancel:f,onSubmit:m,onTabPrev:h,onTabNext:g,onRespondToClaude:_,onFinishPlanInterview:v,onImagePaste:y,pastedContents:b,onRemoveImage:x}){let S=Z(e=>e.toolPermissionContext.mode)===`plan`,[C,w]=(0,Q.useState)(!1),[T,E]=(0,Q.useState)(0),[D,O]=(0,Q.useState)(!1),k=Mb(),A=k?w_(k):null,j=(0,Q.useCallback)(e=>{let t=e===`__other__`;O(t),d(t)},[d]),M=(0,Q.useCallback)(()=>{w(!0)},[]),N=(0,Q.useCallback)(()=>{w(!1)},[]),P=(0,Q.useCallback)(e=>{if(C){if(e.key===`up`||e.ctrl&&e.key===`p`){e.preventDefault(),T===0?N():E(0);return}if(e.key===`down`||e.ctrl&&e.key===`n`){e.preventDefault(),S&&T===0&&E(1);return}if(e.key===`return`){e.preventDefault(),T===0?_():v();return}e.key===`escape`&&(e.preventDefault(),f())}},[C,T,S,N,_,v,f]),ee=e.options.map(e=>({type:`text`,value:e.label,label:e.label,description:e.description})),F=e.question,te=i[F],ne=(0,Q.useCallback)(async(t,n)=>{let r=await Nb(t);r.content!==null&&r.content!==t&&(n(r.content),l(F,{textInputValue:r.content},e.multiSelect??!1))},[F,l,e.multiSelect]),I={type:`input`,value:`__other__`,label:`Other`,placeholder:e.multiSelect?`Type something`:`Type something.`,initialValue:te?.textInputValue??``,onChange:t=>{l(F,{textInputValue:t},e.multiSelect??!1)}},re=[...ee,I];return!e.multiSelect&&e.options.some(e=>e.preview)?(0,$.jsx)(WC,{question:e,questions:t,currentQuestionIndex:n,answers:r,questionStates:i,hideSubmitTab:a,minContentHeight:s,minContentWidth:c,onUpdateQuestionState:l,onAnswer:u,onTextInputFocus:d,onCancel:f,onTabPrev:h,onTabNext:g,onRespondToClaude:_,onFinishPlanInterview:v}):(0,$.jsxs)(U,{flexDirection:`column`,marginTop:0,tabIndex:0,autoFocus:!0,onKeyDown:P,children:[S&&o&&(0,$.jsxs)(U,{flexDirection:`column`,gap:0,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(R,{color:`inactive`,children:[`Planning: `,(0,$.jsx)(yf,{filePath:o})]})]}),(0,$.jsx)(U,{marginTop:-1,children:(0,$.jsx)(ye,{color:`inactive`})}),(0,$.jsxs)(U,{flexDirection:`column`,paddingTop:0,children:[(0,$.jsx)(UC,{questions:t,currentQuestionIndex:n,answers:r,hideSubmitTab:a}),(0,$.jsx)(Vb,{title:e.question,color:`text`}),(0,$.jsxs)(U,{flexDirection:`column`,minHeight:s,children:[(0,$.jsx)(U,{marginTop:1,children:e.multiSelect?(0,$.jsx)(T_,{options:re,defaultValue:i[e.question]?.selectedValue,onChange:e=>{l(F,{selectedValue:e},!0);let t=e.includes(`__other__`)?i[F]?.textInputValue:void 0;u(F,e.filter(e=>e!==`__other__`).concat(t?[t]:[]),void 0,!1)},onFocus:j,onCancel:f,submitButtonText:n===t.length-1?`Submit`:`Next`,onSubmit:m,onDownFromLastItem:M,isDisabled:C,onOpenEditor:ne,onImagePaste:y,pastedContents:b,onRemoveImage:x},e.question):(0,$.jsx)(wd,{options:re,defaultValue:i[e.question]?.selectedValue,onChange:e=>{l(F,{selectedValue:e},!1),u(F,e,e===`__other__`?i[F]?.textInputValue:void 0)},onFocus:j,onCancel:f,onDownFromLastItem:M,isDisabled:C,layout:`compact-vertical`,onOpenEditor:ne,onImagePaste:y,pastedContents:b,onRemoveImage:x},e.question)}),(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[C&&T===0?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsxs)(R,{color:C&&T===0?`suggestion`:void 0,children:[re.length+1,`. Chat about this`]})]}),S&&(0,$.jsxs)(U,{flexDirection:`row`,gap:1,children:[C&&T===1?(0,$.jsx)(R,{color:`suggestion`,children:p.pointer}):(0,$.jsx)(R,{children:` `}),(0,$.jsxs)(R,{color:C&&T===1?`suggestion`:void 0,children:[re.length+2,`. Skip interview and plan immediately`]})]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`inactive`,dimColor:!0,children:[`Enter to select ·`,` `,t.length===1?(0,$.jsxs)($.Fragment,{children:[p.arrowUp,`/`,p.arrowDown,` to navigate`]}):`Tab/Arrow keys to navigate`,D&&A&&(0,$.jsxs)($.Fragment,{children:[` · ctrl+g to edit in `,A]}),` · Esc to cancel`]})})]})]})]})}function KC(e,t){if(!e)return null;if(e.type===`classifier`)return e.classifier===`auto-mode`?{reasonString:`Auto mode classifier requires confirmation for this ${t}.\n${e.reason}`,configString:void 0,themeColor:`error`}:{reasonString:`Classifier ${M.bold(e.classifier)} requires confirmation for this ${t}.\n${e.reason}`,configString:void 0};switch(e.type){case`rule`:return{reasonString:`Permission rule ${M.bold(Tt(e.rule.ruleValue))} requires confirmation for this ${t}.`,configString:e.rule.source===`policySettings`?void 0:`/permissions to update rules`};case`hook`:{let n=e.reason?`:\n${e.reason}`:`.`,r=e.hookSource?` ${M.dim(`[${e.hookSource}]`)}`:``;return{reasonString:`Hook ${M.bold(e.hookName)} requires confirmation for this ${t}${n}${r}`,configString:`/hooks to update`}}case`safetyCheck`:case`other`:return{reasonString:e.reason,configString:void 0};case`workingDir`:return{reasonString:e.reason,configString:`/permissions to update rules`};default:return null}}function qC({permissionResult:e,toolType:t}){let n=Z(e=>e.toolPermissionContext.mode),r=KC(e?.decisionReason,t);if(!r)return null;let i=r.themeColor??(e?.decisionReason?.type===`hook`&&n===`auto`?`warning`:void 0);return(0,JC.jsxs)(U,{marginBottom:1,flexDirection:`column`,children:[i?(0,JC.jsx)(R,{color:i,children:r.reasonString}):(0,JC.jsx)(R,{children:(0,JC.jsx)(fe,{children:r.reasonString})}),r.configString&&(0,JC.jsx)(R,{dimColor:!0,children:r.configString})]})}var JC,YC=t((()=>{L(),H(),X(),JC=je()}));f(),H(),ul(),zb(),YC();function XC({questions:e,currentQuestionIndex:t,answers:n,allQuestionsAnswered:r,permissionResult:i,minContentHeight:a,onFinalResponse:o}){return(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(ye,{color:`inactive`}),(0,$.jsxs)(U,{flexDirection:`column`,borderTop:!0,borderColor:`inactive`,paddingTop:0,children:[(0,$.jsx)(UC,{questions:e,currentQuestionIndex:t,answers:n}),(0,$.jsx)(Vb,{title:`Review your answers`,color:`text`}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,minHeight:a,children:[!r&&(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{color:`warning`,children:[p.warning,` You have not answered all questions`]})}),Object.keys(n).length>0&&(0,$.jsx)(U,{flexDirection:`column`,marginBottom:1,children:e.filter(e=>e?.question&&n[e.question]).map(e=>{let t=n[e?.question];return(0,$.jsxs)(U,{flexDirection:`column`,marginLeft:1,children:[(0,$.jsxs)(R,{children:[p.bullet,` `,e?.question||`Question`]}),(0,$.jsx)(U,{marginLeft:2,children:(0,$.jsxs)(R,{color:`success`,children:[p.arrowRight,` `,t]})})]},e?.question||`answer`)})}),(0,$.jsx)(qC,{permissionResult:i,toolType:`tool`}),(0,$.jsx)(R,{color:`inactive`,children:`Ready to submit your answers?`}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(wd,{options:[{type:`text`,label:`Submit answers`,value:`submit`},{type:`text`,label:`Cancel`,value:`cancel`}],onChange:e=>o(e),onCancel:()=>o(`cancel`)})})]})]})]})}function ZC(e,t){switch(t.type){case`next-question`:return{...e,currentQuestionIndex:e.currentQuestionIndex+1,isInTextInput:!1};case`prev-question`:return{...e,currentQuestionIndex:Math.max(0,e.currentQuestionIndex-1),isInTextInput:!1};case`update-question-state`:{let n=e.questionStates[t.questionText],r={selectedValue:t.updates.selectedValue??n?.selectedValue??(t.isMultiSelect?[]:void 0),textInputValue:t.updates.textInputValue??n?.textInputValue??``};return{...e,questionStates:{...e.questionStates,[t.questionText]:r}}}case`set-answer`:{let n={...e,answers:{...e.answers,[t.questionText]:t.answer}};return t.shouldAdvance?{...n,currentQuestionIndex:n.currentQuestionIndex+1,isInTextInput:!1}:n}case`set-text-input-mode`:return{...e,isInTextInput:t.isInInput}}}var QC={currentQuestionIndex:0,answers:{},questionStates:{},isInTextInput:!1};function $C(){let[e,t]=(0,Q.useReducer)(ZC,QC),n=(0,Q.useCallback)(()=>{t({type:`next-question`})},[]),r=(0,Q.useCallback)(()=>{t({type:`prev-question`})},[]),i=(0,Q.useCallback)((e,n,r)=>{t({type:`update-question-state`,questionText:e,updates:n,isMultiSelect:r})},[]),a=(0,Q.useCallback)((e,n,r=!0)=>{t({type:`set-answer`,questionText:e,answer:n,shouldAdvance:r})},[]),o=(0,Q.useCallback)(e=>{t({type:`set-text-input-mode`,isInInput:e})},[]);return{currentQuestionIndex:e.currentQuestionIndex,answers:e.answers,questionStates:e.questionStates,isInTextInput:e.isInTextInput,nextQuestion:n,prevQuestion:r,updateQuestionState:i,setAnswer:a,setTextInputMode:o}}wm(),ny(),H(),ty(),Cr(),X(),Fc(),cp();var ew=12,tw=40,nw=15;function rw(e){return Eh().syntaxHighlightingDisabled?(0,$.jsx)(aw,{...e,highlight:null}):(0,$.jsx)(Q.Suspense,{fallback:(0,$.jsx)(aw,{...e,highlight:null}),children:(0,$.jsx)(iw,{...e})})}function iw(e){let t=(0,Q.use)(Ou());return(0,$.jsx)(aw,{...e,highlight:t})}function aw({toolUseConfirm:e,onDone:t,onReject:n,highlight:r}){let i=(0,Q.useMemo)(()=>us.inputSchema.safeParse(e.input),[e.input]),a=i.success&&i.data.questions||[],{rows:o}=k(),[s]=ae(),{globalContentHeight:c,globalContentWidth:l}=(0,Q.useMemo)(()=>{let e=0,t=0,n=Math.max(ew,o-nw);for(let i of a)if(i.options.some(e=>e.preview)){let a=Math.max(1,n-11),o=0;for(let e of i.options)if(e.preview){let n=pm(e.preview,s,r).split(`
|
|
3
3
|
`),i=n.length>a,c=i?a:n.length;o=Math.max(o,c+ +!!i+2);for(let e of n)t=Math.max(t,D(e))}let c=o+2,l=i.options.length+2;e=Math.max(e,Math.max(l,c)+7)}else e=Math.max(e,i.options.length+3+7);return{globalContentHeight:Math.min(Math.max(e,ew),n),globalContentWidth:Math.max(t,tw)}},[a,o,s,r]),u=i.success?i.data.metadata?.source:void 0,[d,f]=(0,Q.useState)({}),p=(0,Q.useRef)(0);function m(e,t,n,r,i,a){let o=p.current++,s={id:o,type:`image`,content:t,mediaType:n||`image/png`,filename:r||`Pasted image`,dimensions:i};uc(s),Vs(s),f(t=>({...t,[e]:{...t[e]??{},[o]:s}}))}let h=(0,Q.useCallback)((e,t)=>{f(n=>{let r={...n[e]??{}};return delete r[t],{...n,[e]:r}})},[]),g=Object.values(d).flatMap(e=>Object.values(e)).filter(e=>e.type===`image`),_=Z(e=>e.toolPermissionContext.mode)===`plan`,v=_?gp():void 0,{currentQuestionIndex:y,answers:b,questionStates:x,isInTextInput:S,nextQuestion:C,prevQuestion:w,updateQuestionState:T,setAnswer:E,setTextInputMode:O}=$C(),A=y<(a?.length||0)?a?.[y]:null,j=y===(a?.length||0),M=a?.every(e=>e?.question&&!!b[e.question])??!1,N=a.length===1&&!a[0]?.multiSelect,P=(0,Q.useCallback)(()=>{u&&Y(`tengu_ask_user_question_rejected`,{source:u,questionCount:a.length,isInPlanMode:_,interviewPhaseEnabled:_&&ko()}),t(),n(),e.onReject()},[t,n,e,u,a.length,_]),ee=(0,Q.useCallback)(async()=>{let n=`The user wants to clarify these questions.
|
|
4
4
|
This means they may have additional information, context or questions for you.
|
|
@@ -68,7 +68,7 @@ Parse the user's input into ISO 8601 format. Return ONLY the formatted string, o
|
|
|
68
68
|
`)&&(a+=`
|
|
69
69
|
`),r.setRegister(a,i),e===`yank`)r.setOffset(t);else if(e===`delete`){let e=r.text.slice(0,t)+r.text.slice(n);r.setText(e);let i=Math.max(0,e.length-(wi(e).length||1));r.setOffset(Math.min(t,i))}else if(e===`change`){let e=r.text.slice(0,t)+r.text.slice(n);r.setText(e),r.enterInsert(t)}}function zA(e,t,n){let r=t===1?n.cursor.startOfLastLine():n.cursor.goToLine(t);if(r.equals(n.cursor))return;let i=IA(n.cursor,r,`G`,e,t);RA(e,i.from,i.to,n,i.linewise),n.recordChange({type:`operator`,op:e,motion:`G`,count:t})}function BA(e,t,n){let r=t===1?n.cursor.startOfFirstLine():n.cursor.goToLine(t);if(r.equals(n.cursor))return;let i=IA(n.cursor,r,`gg`,e,t);RA(e,i.from,i.to,n,i.linewise),n.recordChange({type:`operator`,op:e,motion:`gg`,count:t})}var VA={d:`delete`,c:`change`,y:`yank`};function HA(e){return e in VA}var UA=new Set([`h`,`l`,`j`,`k`,`w`,`b`,`e`,`W`,`B`,`E`,`0`,`^`,`$`]),WA=new Set([`f`,`F`,`t`,`T`]),GA={i:`inner`,a:`around`};function KA(e){return e in GA}var qA=new Set([`w`,`W`,`"`,`'`,"`",`(`,`)`,`b`,`[`,`]`,`{`,`}`,`B`,`<`,`>`]),JA=1e4;function YA(){return{mode:`INSERT`,insertedText:``}}function XA(){return{lastChange:null,lastFind:null,register:``,registerIsLinewise:!1}}function ZA(e,t,n){switch(e.type){case`idle`:return ej(t,n);case`count`:return tj(e,t,n);case`operator`:return nj(e,t,n);case`operatorCount`:return rj(e,t,n);case`operatorFind`:return ij(e,t,n);case`operatorTextObj`:return aj(e,t,n);case`find`:return oj(e,t,n);case`g`:return sj(e,t,n);case`operatorG`:return cj(e,t,n);case`replace`:return lj(e,t,n);case`indent`:return uj(e,t,n)}}function QA(e,t,n){return HA(e)?{next:{type:`operator`,op:VA[e],count:t}}:UA.has(e)?{execute:()=>{let r=hA(e,n.cursor,t);n.setOffset(r.offset)}}:WA.has(e)?{next:{type:`find`,find:e,count:t}}:e===`g`?{next:{type:`g`,count:t}}:e===`r`?{next:{type:`replace`,count:t}}:e===`>`||e===`<`?{next:{type:`indent`,dir:e,count:t}}:e===`~`?{execute:()=>AA(t,n)}:e===`x`?{execute:()=>OA(t,n)}:e===`J`?{execute:()=>jA(t,n)}:e===`p`||e===`P`?{execute:()=>MA(e===`p`,t,n)}:e===`D`?{execute:()=>wA(`delete`,`$`,1,n)}:e===`C`?{execute:()=>wA(`change`,`$`,1,n)}:e===`Y`?{execute:()=>DA(`yank`,t,n)}:e===`G`?{execute:()=>{t===1?n.setOffset(n.cursor.startOfLastLine().offset):n.setOffset(n.cursor.goToLine(t).offset)}}:e===`.`?{execute:()=>n.onDotRepeat?.()}:e===`;`||e===`,`?{execute:()=>dj(e===`,`,t,n)}:e===`u`?{execute:()=>n.onUndo?.()}:e===`i`?{execute:()=>n.enterInsert(n.cursor.offset)}:e===`I`?{execute:()=>n.enterInsert(n.cursor.firstNonBlankInLogicalLine().offset)}:e===`a`?{execute:()=>{let e=n.cursor.isAtEnd()?n.cursor.offset:n.cursor.right().offset;n.enterInsert(e)}}:e===`A`?{execute:()=>n.enterInsert(n.cursor.endOfLogicalLine().offset)}:e===`o`?{execute:()=>PA(`below`,n)}:e===`O`?{execute:()=>PA(`above`,n)}:null}function $A(e,t,n,r){return KA(n)?{next:{type:`operatorTextObj`,op:e,count:t,scope:GA[n]}}:WA.has(n)?{next:{type:`operatorFind`,op:e,count:t,find:n}}:UA.has(n)?{execute:()=>wA(e,n,t,r)}:n===`G`?{execute:()=>zA(e,t,r)}:n===`g`?{next:{type:`operatorG`,op:e,count:t}}:null}function ej(e,t){return/[1-9]/.test(e)?{next:{type:`count`,digits:e}}:e===`0`?{execute:()=>t.setOffset(t.cursor.startOfLogicalLine().offset)}:QA(e,1,t)||{}}function tj(e,t,n){if(/[0-9]/.test(t)){let n=e.digits+t;return{next:{type:`count`,digits:String(Math.min(parseInt(n,10),JA))}}}return QA(t,parseInt(e.digits,10),n)||{next:{type:`idle`}}}function nj(e,t,n){return t===e.op[0]?{execute:()=>DA(e.op,e.count,n)}:/[0-9]/.test(t)?{next:{type:`operatorCount`,op:e.op,count:e.count,digits:t}}:$A(e.op,e.count,t,n)||{next:{type:`idle`}}}function rj(e,t,n){if(/[0-9]/.test(t)){let n=e.digits+t,r=Math.min(parseInt(n,10),JA);return{next:{...e,digits:String(r)}}}let r=parseInt(e.digits,10),i=e.count*r;return $A(e.op,i,t,n)||{next:{type:`idle`}}}function ij(e,t,n){return{execute:()=>TA(e.op,e.find,t,e.count,n)}}function aj(e,t,n){return qA.has(t)?{execute:()=>EA(e.op,e.scope,t,e.count,n)}:{next:{type:`idle`}}}function oj(e,t,n){return{execute:()=>{let r=n.cursor.findCharacter(t,e.find,e.count);r!==null&&(n.setOffset(r),n.setLastFind(e.find,t))}}}function sj(e,t,n){return t===`j`||t===`k`?{execute:()=>{let r=hA(`g${t}`,n.cursor,e.count);n.setOffset(r.offset)}}:t===`g`?e.count>1?{execute:()=>{let t=n.text.split(`
|
|
70
70
|
`),r=Math.min(e.count-1,t.length-1),i=0;for(let e=0;e<r;e++)i+=(t[e]?.length??0)+1;n.setOffset(i)}}:{execute:()=>n.setOffset(n.cursor.startOfFirstLine().offset)}:{next:{type:`idle`}}}function cj(e,t,n){return t===`j`||t===`k`?{execute:()=>wA(e.op,`g${t}`,e.count,n)}:t===`g`?{execute:()=>BA(e.op,e.count,n)}:{next:{type:`idle`}}}function lj(e,t,n){return t===``?{next:{type:`idle`}}:{execute:()=>kA(t,e.count,n)}}function uj(e,t,n){return t===e.dir?{execute:()=>NA(e.dir,e.count,n)}:{next:{type:`idle`}}}function dj(e,t,n){let r=n.getLastFind();if(!r)return;let i=r.type;e&&(i={f:`F`,F:`f`,t:`T`,T:`t`}[i]);let a=n.cursor.findCharacter(r.char,i,t);a!==null&&n.setOffset(a)}aa(),Ei();function fj(e){let t=Q.useRef(YA()),[n,r]=(0,Q.useState)(`INSERT`),i=Q.useRef(XA()),a=hl({...e,inputFilter:void 0}),{onModeChange:o,inputFilter:s}=e,c=(0,Q.useCallback)(e=>{e!==void 0&&a.setOffset(e),t.current={mode:`INSERT`,insertedText:``},r(`INSERT`),o?.(`INSERT`)},[a,o]),l=(0,Q.useCallback)(()=>{let n=t.current;n.mode===`INSERT`&&n.insertedText&&(i.current.lastChange={type:`insert`,text:n.insertedText});let s=a.offset;s>0&&e.value[s-1]!==`
|
|
71
|
-
`&&a.setOffset(s-1),t.current={mode:`NORMAL`,command:{type:`idle`}},r(`NORMAL`),o?.(`NORMAL`)},[o,a,e.value]);function u(t,n=!1){return{cursor:t,text:e.value,setText:t=>e.onChange(t),setOffset:e=>a.setOffset(e),enterInsert:e=>c(e),getRegister:()=>i.current.register,setRegister:(e,t)=>{i.current.register=e,i.current.registerIsLinewise=t},getLastFind:()=>i.current.lastFind,setLastFind:(e,t)=>{i.current.lastFind={type:e,char:t}},recordChange:n?()=>{}:e=>{i.current.lastChange=e}}}function d(){let t=i.current.lastChange;if(!t)return;let n=dc.fromText(e.value,e.columns,a.offset),r=u(n,!0);switch(t.type){case`insert`:if(t.text){let r=n.insert(t.text);e.onChange(r.text),a.setOffset(r.offset)}break;case`x`:OA(t.count,r);break;case`replace`:kA(t.char,t.count,r);break;case`toggleCase`:AA(t.count,r);break;case`indent`:NA(t.dir,t.count,r);break;case`join`:jA(t.count,r);break;case`openLine`:PA(t.direction,r);break;case`operator`:wA(t.op,t.motion,t.count,r);break;case`operatorFind`:TA(t.op,t.find,t.char,t.count,r);break;case`operatorTextObj`:EA(t.op,t.scope,t.objType,t.count,r);break}}function f(n,r){let i=t.current,o=s?s(n,r):n,c=i.mode===`INSERT`?o:n,f=dc.fromText(e.value,e.columns,a.offset);if(r.ctrl){a.onInput(c,r);return}if(r.escape&&i.mode===`INSERT`){l();return}if(r.escape&&i.mode===`NORMAL`){t.current={mode:`NORMAL`,command:{type:`idle`}};return}if(r.return){a.onInput(c,r);return}if(i.mode===`INSERT`){r.backspace||r.delete?i.insertedText.length>0&&(t.current={mode:`INSERT`,insertedText:i.insertedText.slice(0,-(wi(i.insertedText).length||1))}):t.current={mode:`INSERT`,insertedText:i.insertedText+c},a.onInput(c,r);return}if(i.mode!==`NORMAL`)return;if(i.command.type===`idle`&&(r.upArrow||r.downArrow||r.leftArrow||r.rightArrow)){a.onInput(c,r);return}let p={...u(f,!1),onUndo:e.onUndo,onDotRepeat:d},m=i.command.type===`idle`||i.command.type===`count`||i.command.type===`operator`||i.command.type===`operatorCount`,h=c;r.leftArrow?h=`h`:r.rightArrow?h=`l`:r.upArrow?h=`k`:r.downArrow?h=`j`:m&&r.backspace?h=`h`:m&&i.command.type!==`count`&&r.delete&&(h=`x`);let g=ZA(i.command,h,p);g.execute&&g.execute(),t.current.mode===`NORMAL`&&(g.next?t.current={mode:`NORMAL`,command:g.next}:g.execute&&(t.current={mode:`NORMAL`,command:{type:`idle`}})),c===`?`&&i.mode===`NORMAL`&&i.command.type===`idle`&&e.onChange(`?`)}let p=(0,Q.useCallback)(e=>{e===`INSERT`?t.current={mode:`INSERT`,insertedText:``}:t.current={mode:`NORMAL`,command:{type:`idle`}},r(e),o?.(e)},[o]);return{...a,onInput:f,mode:n,setMode:p}}F(),H();function pj(e){let[t]=ae(),n=le();Cd(n,!!e.onImagePaste);let r=fj({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:n?M.inverse:e=>e,themeText:Te(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,onModeChange:e.onModeChange,onUndo:e.onUndo}),{mode:i,setMode:a}=r;return Q.useEffect(()=>{e.initialMode&&e.initialMode!==i&&a(e.initialMode)},[e.initialMode,i,a]),(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(fd,{inputState:r,terminalFocus:n,highlights:e.highlights,...e})})}Dv(),Ey(),yc(),Ly(),Wx(),s();function mj(e){if(!e)return null;let t=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;return t===0?null:Math.round(e.cache_read_input_tokens/t*100)}function hj(e){return`${e.input_tokens}|${e.cache_creation_input_tokens}|${e.cache_read_input_tokens}`}function gj(e){let t=RS(`sha256`).update(e).digest(`hex`).slice(0,16);return IS(o(),`cache-stats`,`${t}.json`)}var _j={version:1,signature:null,lastResetAt:null,lastHitRate:null};function vj(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===1&&(t.signature===null||typeof t.signature==`string`)&&(t.lastResetAt===null||typeof t.lastResetAt==`number`)&&(t.lastHitRate===null||typeof t.lastHitRate==`number`)}async function yj(e){try{let t=await KS(e,`utf8`),n=JSON.parse(t);return vj(n)?n:{..._j}}catch{return{..._j}}}async function bj(e,t){await GS(FS(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;try{await JS(n,JSON.stringify(t),`utf8`),await qS(n,e)}catch{}}var xj={signature:null,lastResetAt:null,lastHitRate:null},Sj=null;async function Cj(e){Sj=e;let t=await yj(gj(e));xj={signature:t.signature,lastResetAt:t.lastResetAt,lastHitRate:t.lastHitRate}}function wj(e){let t=hj(e),n=mj(e);return t!==xj.signature&&(xj={signature:t,lastResetAt:Date.now(),lastHitRate:n},Sj!==null&&bj(gj(Sj),{version:1,signature:t,lastResetAt:xj.lastResetAt,lastHitRate:n})),{...xj}}function Tj(){return{...xj}}H(),ki(),ny();function Ej(e){let t=e-Date.now()/1e3;if(t<=0)return`now`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>=1?`${n}d${r}h`:r>=1?`${r}h${i}m`:`${i}m`}function Dj(){return(0,$.jsx)(R,{dimColor:!0,children:` │ `})}function Oj({modelName:e,contextUsedPct:t,usedTokens:n,contextWindowSize:r,totalCostUsd:i,rateLimits:a}){let{columns:o}=k(),[s,c]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!((a.five_hour?.resets_at??0)||(a.seven_day?.resets_at??0)))return;let e=setInterval(()=>c(e=>e+1),6e4);return()=>clearInterval(e)},[a.five_hour?.resets_at,a.seven_day?.resets_at]);let l=e.split(` `),u=l.length>=2?`${l[0]} ${l[1]}`:e,d=o<60,f=a.five_hour!=null,p=a.seven_day!=null,m=f?Math.round(a.five_hour.utilization*100):0,h=p?Math.round(a.seven_day.utilization*100):0,g=`${Pi(n)}/${Pi(r)}`;return(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{children:u}),(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Context `}),(0,$.jsxs)(R,{children:[t,`%`]}),!d&&(0,$.jsxs)(R,{dimColor:!0,children:[` (`,g,`)`]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Session `}),(0,$.jsxs)(R,{children:[m,`%`]}),!d&&a.five_hour.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,Ej(a.five_hour.resets_at)]})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Weekly `}),(0,$.jsxs)(R,{children:[h,`%`]}),!d&&a.seven_day.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,Ej(a.seven_day.resets_at)]})]}),i>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{children:no(i)})]})]})}var kj=Q.memo(Oj);Cr(),X(),ot(),Rm(),Xp(),Rb(),wm(),H(),lr(),On(),wr(),q(),Da(),ql(),$t(),go(),ol(),ki();var Aj=3600*1e3;function jj(e){return String(Math.floor(e)).padStart(2,`0`)}function Mj(e){if(e<=0)return`exp`;let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${jj(t)}:${jj(n)}`}function Nj({messages:e}){let[t,n]=(0,Q.useState)(()=>Date.now()),[r,i]=(0,Q.useState)(!0),a=$o(e),o=(0,Q.useRef)(null);if(a!==null){let e=hj(a);e!==o.current&&(o.current=e,wj(a))}let{lastResetAt:s,lastHitRate:c}=Tj(),l=s===null?null:t-s,u=l===null?null:Aj-l,d=l===null?null:l/6e4,f=u!==null&&u<=0;(0,Q.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=d!==null&&d>=55&&!f;(0,Q.useEffect)(()=>{if(!p){i(!0);return}let e=setInterval(()=>i(e=>!e),500);return()=>clearInterval(e)},[p]);let m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(m.current=!0,Cj(Fe()))},[]);let h=a===null?c:mj(a);if(h===null&&s===null)return(0,$.jsx)(R,{dimColor:!0,children:` Cache --% --:--`});let g=u===null?`--:--`:Mj(u),_=h===null?`--%`:`${h}%`,v;return v=f||d===null?`inactive`:d<20?`success`:d<40?`warning`:`error`,(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:` Cache `}),(0,$.jsx)(R,{color:h!==null&&h>=50?`success`:`inactive`,children:_}),(0,$.jsxs)(R,{color:v,dimColor:p&&!r,children:[` `,g]})]})}function Pj(){let{getGoal:t,formatGoalStatusLabel:n}=(ba(),e(sl)),r=t();if(!r)return null;let i=r.objective.length>30?`${r.objective.slice(0,27)}…`:r.objective,a=r.tokenBudget===null?Pi(r.tokensUsed):`${Pi(r.tokensUsed)}/${Pi(r.tokenBudget)}`,o=n(r.status),s;switch(r.status){case`active`:s=(0,$.jsx)(R,{color:`ansi:green`,children:o});break;case`paused`:case`budget_limited`:case`usage_limited`:s=(0,$.jsx)(R,{color:`ansi:yellow`,children:o});break;case`blocked`:s=(0,$.jsx)(R,{color:`ansi:red`,children:o});break;case`complete`:s=(0,$.jsx)(R,{color:`ansi:cyan`,children:o});break;default:s=(0,$.jsx)(R,{children:o})}return(0,$.jsxs)(R,{children:[s,(0,$.jsx)(R,{dimColor:!0,children:` · `}),(0,$.jsx)(R,{dimColor:!0,children:i}),(0,$.jsx)(R,{dimColor:!0,children:` · `}),(0,$.jsx)(R,{children:a})]})}function Fj(e){return Ve()||e?.statusLineEnabled===!1?!1:e?.statusLineEnabled===!0||!!e?.statusLine?.command}function Ij(e,t,n,r,i,a,o){let s=_t(),c=Nl(),l=Pn({permissionMode:e,mainLoopModel:a,exceeds200kTokens:t}),u=n?.outputStyle||`default`,d=$o(r),f=Kn(l,yt()),p=yn(d,f),m=Bd(Fe()),h=Fh(),g={...h.five_hour&&{five_hour:{used_percentage:h.five_hour.utilization*100,resets_at:h.five_hour.resets_at}},...h.seven_day&&{seven_day:{used_percentage:h.seven_day.utilization*100,resets_at:h.seven_day.resets_at}}};return{...zs(),...m&&{session_name:m},model:{id:l,display_name:zt(l)},workspace:{current_dir:Tr(),project_dir:ft(),added_dirs:i},version:`2.8.1`,output_style:{name:u},cost:{total_cost_usd:Ue(),total_duration_ms:Je(),total_api_duration_ms:Ge(),total_lines_added:Pe(),total_lines_removed:Qe()},context_window:{total_input_tokens:wt(),total_output_tokens:ze(),context_window_size:f,current_usage:d,used_percentage:p.used,remaining_percentage:p.remaining},exceeds_200k_tokens:t,...(g.five_hour||g.seven_day)&&{rate_limits:g},...Vx()&&{vim:{mode:o??`INSERT`}},...s&&{agent:{name:s}},...$e()&&{remote:{session_id:Fe()}},...c&&{worktree:{name:c.worktreeName,path:c.worktreePath,branch:c.worktreeBranch,original_cwd:c.originalCwd,original_branch:c.originalBranch}}}}function Lj(e){return ac(e)?.uuid??null}function Rj({messagesRef:e,lastAssistantMessageId:t,vimMode:n}){let r=(0,Q.useRef)(void 0),i=Z(e=>e.toolPermissionContext.mode),a=Z(e=>e.toolPermissionContext.additionalWorkingDirectories),o=Z(e=>e.statusLineText),s=Af(),c=Eh(),{addNotification:l}=Bh(),u=Lb(),d=(0,Q.useRef)(c);d.current=c;let f=(0,Q.useRef)(n);f.current=n;let p=(0,Q.useRef)(i);p.current=i;let m=(0,Q.useRef)(a);m.current=a;let h=(0,Q.useRef)(u);h.current=u;let g=(0,Q.useRef)({messageId:null,exceeds200kTokens:!1,permissionMode:i,vimMode:n,mainLoopModel:u}),_=(0,Q.useRef)(void 0),v=(0,Q.useRef)(!0),y=(0,Q.useCallback)(async()=>{r.current?.abort();let t=new AbortController;r.current=t;let n=e.current,i=v.current;if(v.current=!1,d.current?.statusLine?.command)try{let e=g.current.exceeds200kTokens,r=Lj(n);r!==g.current.messageId&&(e=Ac(n),g.current.messageId=r,g.current.exceeds200kTokens=e);let a=await Nm(Ij(p.current,e,d.current,n,Array.from(m.current.keys()),h.current,f.current),t.signal,void 0,i);t.signal.aborted||s(e=>e.statusLineText===a?e:{...e,statusLineText:a})}catch{}},[e,s]),b=(0,Q.useCallback)(()=>{_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout((e,t)=>{e.current=void 0,t()},300,_,y)},[y]);(0,Q.useEffect)(()=>{(t!==g.current.messageId||i!==g.current.permissionMode||n!==g.current.vimMode||u!==g.current.mainLoopModel)&&(g.current.permissionMode=i,g.current.vimMode=n,g.current.mainLoopModel=u,b())},[t,i,n,u,b]);let x=c?.statusLine?.command,S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{if(S.current){S.current=!1;return}v.current=!0,y()},[x,y]),(0,Q.useEffect)(()=>{let e=c?.statusLine;e&&(Y(`tengu_status_line_mount`,{command_length:e.command.length,padding:e.padding}),c.disableAllHooks===!0&&J(`Status line is configured but disableAllHooks is true`,{level:`warn`}),W()||(l({key:`statusline-trust-blocked`,text:`statusline skipped · restart to fix`,color:`warning`,priority:`low`}),J(`Status line command skipped: workspace trust not accepted`,{level:`warn`})))},[]),(0,Q.useEffect)(()=>(y(),()=>{r.current?.abort(),_.current!==void 0&&clearTimeout(_.current)}),[]);let C=c?.statusLine?.padding??0,w=Pn({permissionMode:i,mainLoopModel:u,exceeds200kTokens:g.current.exceeds200kTokens}),T=Kn(w,yt()),E=$o(e.current),D=E?E.input_tokens+E.cache_creation_input_tokens+E.cache_read_input_tokens:0,O=E?Math.round(yn(E,T).used??0):0,k=Fh(),A={...k.five_hour&&{five_hour:{utilization:k.five_hour.utilization,resets_at:k.five_hour.resets_at}},...k.seven_day&&{seven_day:{utilization:k.seven_day.utilization,resets_at:k.seven_day.resets_at}}},j=c?.statusLineEnabled===!0,M=!!c?.statusLine?.command;return(0,$.jsxs)(U,{flexDirection:`column`,paddingX:C,children:[j&&(0,$.jsxs)(U,{gap:2,children:[(0,$.jsx)(kj,{modelName:zt(w),contextUsedPct:O,usedTokens:D,contextWindowSize:T,totalCostUsd:Ue(),rateLimits:A}),(0,$.jsx)(Pj,{}),(0,$.jsx)(Nj,{messages:e.current})]}),o?(0,$.jsx)(R,{dimColor:!0,wrap:`truncate`,children:(0,$.jsx)(fe,{children:o})}):M&&El()?(0,$.jsx)(R,{children:` `}):null]})}var zj=(0,Q.memo)(Rj);wp();function Bj(e,t,n,r,i=!0){let a=e.length;if(a===0)return{startIndex:0,endIndex:0,showLeftArrow:!1,showRightArrow:!1};let o=Math.max(0,Math.min(r,a-1));if(e.reduce((e,t)=>e+t,0)<=t)return{startIndex:0,endIndex:a,showLeftArrow:!1,showRightArrow:!1};let s=[0];for(let t=0;t<a;t++)s.push(s[t]+e[t]);function c(e,t){let n=s[t]-s[e];return i&&e>0?n-1:n}function l(e,r){let i=t;return e>0&&(i-=n),r<a&&(i-=n),i}let u=0,d=1;for(;d<a&&c(u,d+1)<=l(u,d+1);)d++;if(o>=u&&o<d)return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a};if(o>=d)for(d=o+1,u=o;u>0&&c(u-1,d)<=l(u-1,d);)u--;else for(u=o,d=o+1;d<a&&c(u,d+1)<=l(u,d+1);)d++;return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a}}f(),ny(),H(),X(),rS(),fa(),Qa(),cS();function Vj({tasksSelected:e,isViewingTeammate:t,teammateFooterIndex:n=0,isLeaderIdle:r=!1,onOpenDialog:i}){let a=Af(),{columns:o}=k(),s=Z(e=>e.tasks),c=Z(e=>e.viewingAgentTaskId),l=(0,Q.useMemo)(()=>Object.values(s??{}).filter(e=>Gd(e)&&!(process.env.USER_TYPE===`ant`&&Zs(e))),[s]),u=Z(e=>e.expandedView)===`teammates`,d=!u&&l.length>0&&l.every(e=>e.type===`in_process_teammate`),f=(0,Q.useMemo)(()=>l.filter(e=>e.type===`in_process_teammate`).sort((e,t)=>e.identity.agentName.localeCompare(t.identity.agentName)),[l]),m=(0,Q.useMemo)(()=>{let t={name:`main`,color:void 0,isIdle:r,taskId:void 0},n=f.map(e=>({name:e.identity.agentName,color:Wj(e.identity.color),isIdle:e.isIdle,taskId:e.id}));return e||n.sort((e,t)=>e.isIdle===t.isIdle?0:e.isIdle?1:-1),[t,...n].map((e,t)=>({...e,idx:t}))},[f,r,e]),h=(0,Q.useMemo)(()=>m.map((e,t)=>D(`@${e.name}`)+ +(t>0)),[m]);if(d||!u&&t){let t=e?n:-1,r=c?f.findIndex(e=>e.id===c)+1:0,{startIndex:i,endIndex:s,showLeftArrow:l,showRightArrow:u}=Bj(h,Math.max(20,o-20-4),2,t>=0?t:0),d=m.slice(i,s);return(0,$.jsxs)($.Fragment,{children:[l&&(0,$.jsxs)(R,{dimColor:!0,children:[p.arrowLeft,` `]}),d.map((e,n)=>{let i=n>0;return(0,$.jsxs)(Q.Fragment,{children:[i&&(0,$.jsx)(R,{children:` `}),(0,$.jsx)(Hj,{name:e.name,color:e.color,isSelected:t===e.idx,isViewed:r===e.idx,isIdle:e.isIdle,onClick:()=>e.taskId?sS(e.taskId,a):lS(a)})]},e.name)}),u&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,p.arrowRight]}),(0,$.jsxs)(R,{dimColor:!0,children:[` · `,(0,$.jsx)(he,{shortcut:`shift + ↓`,action:`expand`})]})]})}return nS(s??{},u)||l.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Uj,{selected:e,onClick:i,children:Nh(l)}),Od(l)&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,p.arrowDown,` to view`]})]})}function Hj({name:e,color:t,isSelected:n,isViewed:r,isIdle:i,onClick:a}){let[o,s]=(0,Q.useState)(!1),c=n||o,l;return l=c?t?(0,$.jsxs)(R,{backgroundColor:t,color:`inverseText`,bold:r,children:[`@`,e]}):(0,$.jsxs)(R,{color:`background`,inverse:!0,bold:r,children:[`@`,e]}):i?(0,$.jsxs)(R,{dimColor:!0,bold:r,children:[`@`,e]}):r?(0,$.jsxs)(R,{color:t,bold:!0,children:[`@`,e]}):(0,$.jsxs)(R,{color:t,dimColor:!t,children:[`@`,e]}),a?(0,$.jsx)(U,{onClick:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:l}):l}function Uj({selected:e,onClick:t,children:n}){let[r,i]=(0,Q.useState)(!1),a=(0,$.jsx)(R,{color:`background`,inverse:e||r,children:n});return t?(0,$.jsx)(U,{onClick:t,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:a}):a}function Wj(e){if(e&&Oa.includes(e))return Bg[e]}H(),X();function Gj({teamsSelected:e,showHint:t}){let n=Z(e=>e.teamContext),r=n?Object.values(n.teammates).filter(e=>e.name!==`team-lead`).length:0;if(r===0)return null;let i=t&&e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{dimColor:!0,children:`· `}),(0,$.jsx)(R,{dimColor:!0,children:`Enter to view`})]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`background`,inverse:e,children:`${r} ${r===1?`teammate`:`teammates`}`},e?`selected`:`normal`),i?(0,$.jsxs)(R,{children:[` `,i]}):null]})}H(),jf();function Kj({value:e,onChange:t,historyFailedMatch:n}){return(0,$.jsxs)(U,{gap:1,children:[(0,$.jsx)(R,{dimColor:!0,children:n?`no matching prompt:`:`search prompts:`}),(0,$.jsx)(tf,{value:e,onChange:t,cursorOffset:e.length,onChangeCursorOffset:()=>{},columns:D(e)+1,focus:!0,showCursor:!0,multiline:!1,dimColor:!0})]})}si(),Mr(),fr();var qj=5e3;function Jj(e,t){if(e)return`draft`;switch(t){case`APPROVED`:return`approved`;case`CHANGES_REQUESTED`:return`changes_requested`;default:return`pending`}}async function Yj(){if(!await Ar())return null;let[e,t]=await Promise.all([jr(),kr()]);if(e===t)return null;let{stdout:n,code:r}=await ci(`gh`,[`pr`,`view`,`--json`,`number,url,reviewDecision,isDraft,headRefName,state`],{timeout:qj,preserveOutputOnError:!1});if(r!==0||!n.trim())return null;try{let e=G(n);return e.headRefName===t||e.headRefName===`main`||e.headRefName===`master`||e.state===`MERGED`||e.state===`CLOSED`?null:{number:e.number,url:e.url,reviewState:Jj(e.isDraft,e.reviewDecision)}}catch{return null}}ot();var Xj=6e4,Zj=4e3,Qj=60*6e4,$j={number:null,url:null,reviewState:null,lastUpdated:0};function eM(e,t=!0){let[n,r]=(0,Q.useState)($j),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!t||a.current)return;let e=!1,n=-1,s=Date.now();async function c(){if(e)return;let t=et();if(n!==t)n=t,s=Date.now();else if(Date.now()-s>=Qj)return;let l=Date.now(),u=await Yj();if(!e){if(o.current=l,r(e=>{let t=u?.number??null,n=u?.reviewState??null;return e.number===t&&e.reviewState===n?e:{number:t,url:u?.url??null,reviewState:n,lastUpdated:Date.now()}}),Date.now()-l>Zj){a.current=!0;return}e||(i.current=setTimeout(c,Xj))}}let l=Date.now()-o.current;return l>=Xj?c():i.current=setTimeout(c,Xj-l),()=>{e=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[e,t]),n}H(),f(),Wx(),za(),sn(),Gh(),fa(),Ci(),cS(),Yn(),nc(),X(),ot(),ny(),ki(),nO(),RD(),fl(),Da(),lr(),ei(),Jh();var tM=(m_(),e(el)),nM=(vv(),e(sv)),rM=e=>()=>{},iM=()=>null,aM=3,oM=5e3,sM=1e3;function cM(){let[e,t]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{function e(){let e=process.memoryUsage().rss/(1024*1024),n=e>=1024?`error`:e>=512?`warning`:`normal`,r=Ai(e*1024*1024);t(e=>e?.text===r?e:{text:r,level:n})}e();let n=setInterval(e,oM);return()=>clearInterval(n)},[]),e}function lM(){let e=(0,Q.useSyncExternalStore)(nM?.subscribeToProactiveChanges??rM,nM?.getNextTickAt??iM,iM),[t,n]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(e===null){n(null);return}function t(){n(Math.max(0,Math.ceil((e-Date.now())/1e3)))}t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t===null?null:(0,$.jsxs)(R,{dimColor:!0,children:[`waiting `,Ni(t*1e3,{mostSignificantOnly:!0})]})}function uM(){let[t,n]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),sM);return()=>clearInterval(e)},[]);let r=(ba(),e(sl)),i=r.getGoal();if(!i)return null;let a=r.getActiveElapsedMs(i),o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60,u;u=s>=1?`${s}h${c}min`:c>=1?`${c}min`:`${l}s`;let d;switch(i.status){case`active`:d=`ansi:green`;break;case`paused`:case`budget_limited`:case`usage_limited`:d=`ansi:yellow`;break;case`blocked`:d=`ansi:red`;break;case`complete`:d=`ansi:cyan`;break}return(0,$.jsxs)(R,{color:d,children:[`goal (`,u,`)`]})}function dM({exitMessage:e,vimMode:t,mode:n,toolPermissionContext:r,suppressHint:i,isLoading:a,tasksSelected:o,teamsSelected:s,tmuxSelected:c,teammateFooterIndex:l,isPasting:u,isSearching:d,historyQuery:f,setHistoryQuery:p,historyFailedMatch:m,onOpenTasksDialog:h}){if(e.show)return(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,e.key,` again to exit`]},`exit-message`);if(u)return(0,$.jsx)(R,{dimColor:!0,children:`Pasting text…`},`pasting-message`);let g=Vx()&&t===`INSERT`&&!d;return(0,$.jsxs)(U,{justifyContent:`flex-start`,gap:1,children:[d&&(0,$.jsx)(Kj,{value:f,onChange:p,historyFailedMatch:m}),g?(0,$.jsx)(R,{dimColor:!0,children:`-- INSERT --`},`vim-insert`):null,(0,$.jsx)(fM,{mode:n,toolPermissionContext:r,showHint:!i&&!g,isLoading:a,tasksSelected:o,teamsSelected:s,teammateFooterIndex:l,tmuxSelected:c,onOpenTasksDialog:h})]})}function fM({mode:t,toolPermissionContext:n,showHint:r,isLoading:i,tasksSelected:a,teamsSelected:o,tmuxSelected:s,teammateFooterIndex:c,onOpenTasksDialog:l}){let{columns:u}=k(),d=fc(`chat:cycleMode`,`Chat`,`shift+tab`),f=Z(e=>e.tasks),m=Z(e=>e.teamContext),h=ef(),[g]=(0,Q.useState)(()=>h.getState().remoteSessionUrl),_=Z(e=>e.viewSelectionMode),v=Z(e=>e.viewingAgentTaskId),y=Z(e=>e.expandedView),b=y===`teammates`,x=eM(i,mM()),S=Z(e=>process.env.USER_TYPE===`ant`&&e.tungstenActiveSession!==void 0),C=(0,Q.useSyncExternalStore)(nM?.subscribeToProactiveChanges??rM,nM?.getNextTickAt??iM,iM),w=ID(),T=Tl(e=>e.voiceState),E=Tl(e=>e.voiceWarmingUp),D=j(),O=ee().getState,A=C!==null,M=tM?.isCoordinatorMode()===!0,N=(0,Q.useMemo)(()=>mi(Object.values(f),e=>Gd(e)&&!(process.env.USER_TYPE===`ant`&&Zs(e))),[f]),P=Dg(),F=P!==void 0&&P.length>0,te=fc(`chat:cancel`,`Chat`,`esc`).toLowerCase(),ne=fc(`app:toggleTodos`,`Global`,`ctrl+t`),I=fc(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),L=fc(`voice:pushToTalk`,`Chat`,`Space`),[ie]=(0,Q.useState)(()=>(En().voiceFooterHintSeenCount??0)<aM),ae=ie,oe=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(!w||!ae||oe?.current)return;oe&&(oe.current=!0);let e=(En().voiceFooterHintSeenCount??0)+1;kt(t=>(t.voiceFooterHintSeenCount??0)>=e?t:{...t,voiceFooterHintSeenCount:e})}},[w,ae]);let se=Z(e=>e.notifications.current?.key===`kill-agents-confirm`),ce=cM(),le=Nn()&&!Dc()&&m!==void 0&&mi(Object.values(m.teammates),e=>e.name!==`team-lead`)>0;if(t===`bash`)return(0,$.jsx)(R,{color:`bashBorder`,children:`! for bash mode`});let ue=n?.mode,fe=!jt(ue),pe=v?f[v]:void 0,me=_===`viewing-agent`&&pe?.type===`in_process_teammate`,z=me&&pe!=null&&pe.status!==`running`,B=N>0||me,ge=(M||fe?1:0)+ +!!B+ +!!le,ve=mM()&&x.number!==null&&x.reviewState!==null&&x.url!==null&&ge<2&&(ge===0||u>=80),ye=ge<2,V=!b&&B&&Object.values(f).some(e=>e.type===`in_process_teammate`)||!b&&me,be=ue&&fe&&!$e()?(0,$.jsxs)(R,{color:sr(ue),children:[Zt(ue),` `,Ln(ue).toLowerCase(),` on`,ye&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,(0,$.jsx)(he,{shortcut:d,action:`cycle`,parens:!0})]})]},`mode`):null,xe=[...g?[(0,$.jsx)(re,{url:g,children:(0,$.jsxs)(R,{color:`ide`,children:[p.circleDouble,` remote`]})},`remote`)]:[],...process.env.USER_TYPE===`ant`&&S?[(0,$.jsx)(TungstenPill,{selected:s},`tmux`)]:[],...Nn()&&le?[(0,$.jsx)(Gj,{teamsSelected:o,showHint:r&&!B},`teams`)]:[],...ve?[(0,$.jsx)(Hm,{number:x.number,url:x.url,reviewState:x.reviewState},`pr-status`)]:[],...ce?[(0,$.jsxs)(R,{dimColor:ce.level===`normal`,color:ce.level===`error`?`error`:ce.level===`warning`?`warning`:void 0,children:[ce.text,` · pid:`,process.pid]},`rss`)]:[],...(ba(),e(sl)).getGoal()?[(0,$.jsx)(uM,{},`goal-elapsed`)]:[]],Se=Object.values(f).some(e=>e.type===`in_process_teammate`&&e.status===`running`),H=Object.values(f).some(e=>e.type===`local_agent`&&e.status===`running`),Ce=r?pM(i,te,ne,I,F,y,Se,H,se):[];if(z?xe.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:te,action:`return to team lead`})},`esc-return`)):A?xe.push((0,$.jsx)(lM,{},`proactive`)):!V&&r&&xe.push(...Ce),V){let e=[...be?[be]:[],...xe,...z?[]:Ce];return(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(U,{children:(0,$.jsx)(Vj,{tasksSelected:a,isViewingTeammate:me,teammateFooterIndex:c,isLeaderIdle:!i,onOpenDialog:l})}),e.length>0&&(0,$.jsx)(U,{children:(0,$.jsx)(_e,{children:e})})]})}let we=process.env.USER_TYPE===`ant`&&Zk(f).length>0,Te=B&&!V&&!nS(f,b)?(0,$.jsx)(Vj,{tasksSelected:a,isViewingTeammate:me,teammateFooterIndex:c,isLeaderIdle:!i,onOpenDialog:l}):null;xe.length===0&&!Te&&!be&&r&&xe.push((0,$.jsx)(R,{dimColor:!0,children:`? for shortcuts`},`shortcuts-hint`));let Ee=En().copyOnSelect??!0,De=D&&(!Ee||de());if(w&&E)xe.push((0,$.jsx)(XD,{},`voice-warmup`));else if(El()&&De){let e=$r()===`macos`,t=e&&(O()?.lastPressHadAlt??!1);xe.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsxs)(_e,{children:[!Ee&&(0,$.jsx)(he,{shortcut:`ctrl+c`,action:`copy`}),de()&&(t?(0,$.jsx)(R,{children:`set macOptionClickForcesSelection in VS Code settings`}):(0,$.jsx)(he,{shortcut:e?`option+click`:`shift+click`,action:`native select`}))]})},`selection-copy`))}else xe.length>0&&r&&w&&T===`idle`&&Ce.length===0&&ae&&xe.push((0,$.jsxs)(R,{dimColor:!0,children:[`hold `,L,` to speak`]},`voice-hint`));return(Te||we)&&r&&!le&&xe.push((0,$.jsx)(R,{dimColor:!0,children:a?(0,$.jsx)(he,{shortcut:`Enter`,action:`view tasks`}):(0,$.jsx)(he,{shortcut:`↓`,action:`manage`})},`manage-tasks`)),xe.length===0&&!Te&&!be?El()?(0,$.jsx)(R,{children:` `}):null:(0,$.jsxs)(U,{height:1,overflow:`hidden`,children:[be&&(0,$.jsxs)(U,{flexShrink:0,children:[be,(Te||xe.length>0)&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),Te&&(0,$.jsxs)(U,{flexShrink:0,children:[Te,xe.length>0&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),xe.length>0&&(0,$.jsx)(R,{wrap:`truncate`,children:(0,$.jsx)(_e,{children:xe})})]})}function pM(e,t,n,r,i,a,o,s,c){let l;if(o)switch(a){case`none`:l=`show tasks`;break;case`tasks`:l=`show teammates`;break;case`teammates`:l=`hide`;break}else l=a===`tasks`?`hide tasks`:`show tasks`;let u=i||o;return[...e?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:t,action:`interrupt`})},`esc`)]:[],...!e&&s&&!c?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:r,action:`stop agents`})},`kill-agents`)]:[],...u?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:n,action:l})},`toggle-tasks`)]:[]]}function mM(){return En().prStatusFooterEnabled??!0}__(),wm(),ny(),H(),Hh(),X(),Da(),Db(),Ux();function hM({apiKeyStatus:e,debug:t,exitMessage:n,vimMode:r,mode:i,autoUpdaterResult:a,isAutoUpdating:o,verbose:s,onAutoUpdaterResult:c,onChangeIsUpdating:l,suggestions:u,selectedSuggestion:d,maxColumnWidth:f,toolPermissionContext:p,helpOpen:m,suppressHint:h,isLoading:g,tasksSelected:_,teamsSelected:v,bridgeSelected:y,tmuxSelected:b,teammateFooterIndex:x,ideSelection:S,mcpClients:C,isPasting:w=!1,isInputWrapped:T=!1,messages:E,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M}){let N=Eh(),{columns:P,rows:ee}=k(),F=(0,Q.useRef)(E);F.current=E;let te=(0,Q.useMemo)(()=>Lj(E),[E]),ne=P<80,I=El(),re=I&&ee<24,L=$k(),ie=Z(e=>e.coordinatorTaskIndex),ae=_&&(L===0||ie<0),oe=h||Fj(N)||D;return Sx((0,Q.useMemo)(()=>I&&u.length?{suggestions:u,selectedSuggestion:d,maxColumnWidth:f}:null,[I,u,d,f])),u.length&&!I?(0,$.jsx)(U,{paddingX:2,paddingY:0,children:(0,$.jsx)(Ob,{suggestions:u,selectedSuggestion:d,maxColumnWidth:f})}):m?(0,$.jsx)(Gx,{dimColor:!0,fixedWidth:!0,paddingX:2}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{flexDirection:ne?`column`:`row`,justifyContent:ne?`flex-start`:`space-between`,paddingX:2,gap:+!ne,children:[(0,$.jsxs)(U,{flexDirection:`column`,flexShrink:+!ne,children:[i===`prompt`&&!re&&!n.show&&!w&&Fj(N)&&(0,$.jsx)(zj,{messagesRef:F,lastAssistantMessageId:te,vimMode:r}),(0,$.jsx)(vM,{}),(0,$.jsx)(dM,{exitMessage:n,vimMode:r,mode:i,toolPermissionContext:p,suppressHint:oe,isLoading:g,tasksSelected:ae,teamsSelected:v,teammateFooterIndex:x,tmuxSelected:b,isPasting:w,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M})]}),(0,$.jsxs)(U,{flexShrink:1,gap:1,children:[I?null:(0,$.jsx)(aO,{apiKeyStatus:e,autoUpdaterResult:a,debug:t,isAutoUpdating:o,verbose:s,messages:E,onAutoUpdaterResult:c,onChangeIsUpdating:l,ideSelection:S,mcpClients:C,isInputWrapped:T,isNarrow:ne}),process.env.USER_TYPE===`ant`&&Dy()&&(0,$.jsx)(R,{dimColor:!0,children:`undercover`}),(0,$.jsx)(_M,{bridgeSelected:y})]})]}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(Qk,{})]})}var gM=(0,Q.memo)(hM);function _M({bridgeSelected:e}){let t=Z(e=>e.replBridgeEnabled),n=Z(e=>e.replBridgeConnected),r=Z(e=>e.replBridgeSessionActive),i=Z(e=>e.replBridgeReconnecting),a=Z(e=>e.replBridgeExplicit);if(!vy()||!t)return null;let o=rl({error:void 0,connected:n,sessionActive:r,reconnecting:i});return!a&&o.label!==`Remote Control reconnecting`?null:(0,$.jsxs)(R,{color:e?`background`:o.color,inverse:e,wrap:`truncate`,children:[o.label,e&&(0,$.jsx)(R,{dimColor:!0,children:` · Enter to view`})]})}function vM(){return null}f(),H(),Qa(),_i(),Yn();function yM(){if(!Nn())return;let e=yi();if(e&&Oa.includes(e))return Bg[e]}function bM({isLoading:e,themeColor:t}){let n=t,r=process.env.USER_TYPE===`ant`;return(0,$.jsxs)(R,{color:n??(r?`subtle`:void 0),dimColor:e,children:[p.pointer,`\xA0`]})}function xM({mode:e,isLoading:t,viewingAgentName:n,viewingAgentColor:r}){let i=yM(),a=r?Bg[r]:void 0;return(0,$.jsx)(U,{alignItems:`flex-start`,alignSelf:`flex-start`,flexWrap:`nowrap`,justifyContent:`flex-start`,children:n?(0,$.jsx)(bM,{isLoading:t,themeColor:a}):e===`bash`?(0,$.jsx)(R,{color:`bashBorder`,dimColor:t,children:`!\xA0`}):(0,$.jsx)(bM,{isLoading:t,themeColor:Nn()?i:void 0})})}H(),X(),Ku(),Ss(),ql(),fr(),wf();var SM=new Set;function CM(e){try{return G(e)?.type===`idle_notification`}catch{return!1}}var wM=3;function TM(e){return`<${Yr}>
|
|
71
|
+
`&&a.setOffset(s-1),t.current={mode:`NORMAL`,command:{type:`idle`}},r(`NORMAL`),o?.(`NORMAL`)},[o,a,e.value]);function u(t,n=!1){return{cursor:t,text:e.value,setText:t=>e.onChange(t),setOffset:e=>a.setOffset(e),enterInsert:e=>c(e),getRegister:()=>i.current.register,setRegister:(e,t)=>{i.current.register=e,i.current.registerIsLinewise=t},getLastFind:()=>i.current.lastFind,setLastFind:(e,t)=>{i.current.lastFind={type:e,char:t}},recordChange:n?()=>{}:e=>{i.current.lastChange=e}}}function d(){let t=i.current.lastChange;if(!t)return;let n=dc.fromText(e.value,e.columns,a.offset),r=u(n,!0);switch(t.type){case`insert`:if(t.text){let r=n.insert(t.text);e.onChange(r.text),a.setOffset(r.offset)}break;case`x`:OA(t.count,r);break;case`replace`:kA(t.char,t.count,r);break;case`toggleCase`:AA(t.count,r);break;case`indent`:NA(t.dir,t.count,r);break;case`join`:jA(t.count,r);break;case`openLine`:PA(t.direction,r);break;case`operator`:wA(t.op,t.motion,t.count,r);break;case`operatorFind`:TA(t.op,t.find,t.char,t.count,r);break;case`operatorTextObj`:EA(t.op,t.scope,t.objType,t.count,r);break}}function f(n,r){let i=t.current,o=s?s(n,r):n,c=i.mode===`INSERT`?o:n,f=dc.fromText(e.value,e.columns,a.offset);if(r.ctrl){a.onInput(c,r);return}if(r.escape&&i.mode===`INSERT`){l();return}if(r.escape&&i.mode===`NORMAL`){t.current={mode:`NORMAL`,command:{type:`idle`}};return}if(r.return){a.onInput(c,r);return}if(i.mode===`INSERT`){r.backspace||r.delete?i.insertedText.length>0&&(t.current={mode:`INSERT`,insertedText:i.insertedText.slice(0,-(wi(i.insertedText).length||1))}):t.current={mode:`INSERT`,insertedText:i.insertedText+c},a.onInput(c,r);return}if(i.mode!==`NORMAL`)return;if(i.command.type===`idle`&&(r.upArrow||r.downArrow||r.leftArrow||r.rightArrow)){a.onInput(c,r);return}let p={...u(f,!1),onUndo:e.onUndo,onDotRepeat:d},m=i.command.type===`idle`||i.command.type===`count`||i.command.type===`operator`||i.command.type===`operatorCount`,h=c;r.leftArrow?h=`h`:r.rightArrow?h=`l`:r.upArrow?h=`k`:r.downArrow?h=`j`:m&&r.backspace?h=`h`:m&&i.command.type!==`count`&&r.delete&&(h=`x`);let g=ZA(i.command,h,p);g.execute&&g.execute(),t.current.mode===`NORMAL`&&(g.next?t.current={mode:`NORMAL`,command:g.next}:g.execute&&(t.current={mode:`NORMAL`,command:{type:`idle`}})),c===`?`&&i.mode===`NORMAL`&&i.command.type===`idle`&&e.onChange(`?`)}let p=(0,Q.useCallback)(e=>{e===`INSERT`?t.current={mode:`INSERT`,insertedText:``}:t.current={mode:`NORMAL`,command:{type:`idle`}},r(e),o?.(e)},[o]);return{...a,onInput:f,mode:n,setMode:p}}F(),H();function pj(e){let[t]=ae(),n=le();Cd(n,!!e.onImagePaste);let r=fj({value:e.value,onChange:e.onChange,onSubmit:e.onSubmit,onExit:e.onExit,onExitMessage:e.onExitMessage,onHistoryReset:e.onHistoryReset,onHistoryUp:e.onHistoryUp,onHistoryDown:e.onHistoryDown,onClearInput:e.onClearInput,focus:e.focus,mask:e.mask,multiline:e.multiline,cursorChar:e.showCursor?` `:``,highlightPastedText:e.highlightPastedText,invert:n?M.inverse:e=>e,themeText:Te(`text`,t),columns:e.columns,maxVisibleLines:e.maxVisibleLines,onImagePaste:e.onImagePaste,disableCursorMovementForUpDownKeys:e.disableCursorMovementForUpDownKeys,disableEscapeDoublePress:e.disableEscapeDoublePress,externalOffset:e.cursorOffset,onOffsetChange:e.onChangeCursorOffset,inputFilter:e.inputFilter,onModeChange:e.onModeChange,onUndo:e.onUndo}),{mode:i,setMode:a}=r;return Q.useEffect(()=>{e.initialMode&&e.initialMode!==i&&a(e.initialMode)},[e.initialMode,i,a]),(0,$.jsx)(U,{flexDirection:`column`,children:(0,$.jsx)(fd,{inputState:r,terminalFocus:n,highlights:e.highlights,...e})})}Dv(),Ey(),yc(),Ly(),Wx(),s();function mj(e){if(!e)return null;let t=e.input_tokens+e.cache_creation_input_tokens+e.cache_read_input_tokens;return t===0?null:Math.round(e.cache_read_input_tokens/t*100)}function hj(e){return`${e.input_tokens}|${e.cache_creation_input_tokens}|${e.cache_read_input_tokens}`}function gj(e){let t=RS(`sha256`).update(e).digest(`hex`).slice(0,16);return IS(o(),`cache-stats`,`${t}.json`)}var _j={version:1,signature:null,lastResetAt:null,lastHitRate:null};function vj(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.version===1&&(t.signature===null||typeof t.signature==`string`)&&(t.lastResetAt===null||typeof t.lastResetAt==`number`)&&(t.lastHitRate===null||typeof t.lastHitRate==`number`)}async function yj(e){try{let t=await KS(e,`utf8`),n=JSON.parse(t);return vj(n)?n:{..._j}}catch{return{..._j}}}async function bj(e,t){await GS(FS(e),{recursive:!0});let n=`${e}.${process.pid}.tmp`;try{await JS(n,JSON.stringify(t),`utf8`),await qS(n,e)}catch{}}var xj={signature:null,lastResetAt:null,lastHitRate:null},Sj=null;async function Cj(e){Sj=e;let t=await yj(gj(e));xj={signature:t.signature,lastResetAt:t.lastResetAt,lastHitRate:t.lastHitRate}}function wj(e){let t=hj(e),n=mj(e);return t!==xj.signature&&(xj={signature:t,lastResetAt:Date.now(),lastHitRate:n},Sj!==null&&bj(gj(Sj),{version:1,signature:t,lastResetAt:xj.lastResetAt,lastHitRate:n})),{...xj}}function Tj(){return{...xj}}H(),ki(),ny();function Ej(e){let t=e-Date.now()/1e3;if(t<=0)return`now`;let n=Math.floor(t/86400),r=Math.floor(t%86400/3600),i=Math.floor(t%3600/60);return n>=1?`${n}d${r}h`:r>=1?`${r}h${i}m`:`${i}m`}function Dj(){return(0,$.jsx)(R,{dimColor:!0,children:` │ `})}function Oj({modelName:e,contextUsedPct:t,usedTokens:n,contextWindowSize:r,totalCostUsd:i,rateLimits:a}){let{columns:o}=k(),[s,c]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(!((a.five_hour?.resets_at??0)||(a.seven_day?.resets_at??0)))return;let e=setInterval(()=>c(e=>e+1),6e4);return()=>clearInterval(e)},[a.five_hour?.resets_at,a.seven_day?.resets_at]);let l=e.split(` `),u=l.length>=2?`${l[0]} ${l[1]}`:e,d=o<60,f=a.five_hour!=null,p=a.seven_day!=null,m=f?Math.round(a.five_hour.utilization*100):0,h=p?Math.round(a.seven_day.utilization*100):0,g=`${Pi(n)}/${Pi(r)}`;return(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{children:u}),(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Context `}),(0,$.jsxs)(R,{children:[t,`%`]}),!d&&(0,$.jsxs)(R,{dimColor:!0,children:[` (`,g,`)`]}),f&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Session `}),(0,$.jsxs)(R,{children:[m,`%`]}),!d&&a.five_hour.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,Ej(a.five_hour.resets_at)]})]}),p&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{dimColor:!0,children:`Weekly `}),(0,$.jsxs)(R,{children:[h,`%`]}),!d&&a.seven_day.resets_at>0&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,Ej(a.seven_day.resets_at)]})]}),i>0&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Dj,{}),(0,$.jsx)(R,{children:no(i)})]})]})}var kj=Q.memo(Oj);Cr(),X(),ot(),Rm(),Xp(),Rb(),wm(),H(),lr(),On(),wr(),q(),Da(),ql(),$t(),go(),ol(),ki();var Aj=3600*1e3;function jj(e){return String(Math.floor(e)).padStart(2,`0`)}function Mj(e){if(e<=0)return`exp`;let t=Math.floor(e/6e4),n=Math.floor(e%6e4/1e3);return`${jj(t)}:${jj(n)}`}function Nj({messages:e}){let[t,n]=(0,Q.useState)(()=>Date.now()),[r,i]=(0,Q.useState)(!0),a=$o(e),o=(0,Q.useRef)(null);if(a!==null){let e=hj(a);e!==o.current&&(o.current=e,wj(a))}let{lastResetAt:s,lastHitRate:c}=Tj(),l=s===null?null:t-s,u=l===null?null:Aj-l,d=l===null?null:l/6e4,f=u!==null&&u<=0;(0,Q.useEffect)(()=>{let e=setInterval(()=>n(Date.now()),1e3);return()=>clearInterval(e)},[]);let p=d!==null&&d>=55&&!f;(0,Q.useEffect)(()=>{if(!p){i(!0);return}let e=setInterval(()=>i(e=>!e),500);return()=>clearInterval(e)},[p]);let m=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{m.current||(m.current=!0,Cj(Fe()))},[]);let h=a===null?c:mj(a);if(h===null&&s===null)return(0,$.jsx)(R,{dimColor:!0,children:` Cache --% --:--`});let g=u===null?`--:--`:Mj(u),_=h===null?`--%`:`${h}%`,v;return v=f||d===null?`inactive`:d<20?`success`:d<40?`warning`:`error`,(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:` Cache `}),(0,$.jsx)(R,{color:h!==null&&h>=50?`success`:`inactive`,children:_}),(0,$.jsxs)(R,{color:v,dimColor:p&&!r,children:[` `,g]})]})}function Pj(){let{getGoal:t,formatGoalStatusLabel:n}=(ba(),e(sl)),r=t();if(!r)return null;let i=r.objective.length>30?`${r.objective.slice(0,27)}…`:r.objective,a=r.tokenBudget===null?Pi(r.tokensUsed):`${Pi(r.tokensUsed)}/${Pi(r.tokenBudget)}`,o=n(r.status),s;switch(r.status){case`active`:s=(0,$.jsx)(R,{color:`ansi:green`,children:o});break;case`paused`:case`budget_limited`:case`usage_limited`:s=(0,$.jsx)(R,{color:`ansi:yellow`,children:o});break;case`blocked`:s=(0,$.jsx)(R,{color:`ansi:red`,children:o});break;case`complete`:s=(0,$.jsx)(R,{color:`ansi:cyan`,children:o});break;default:s=(0,$.jsx)(R,{children:o})}return(0,$.jsxs)(R,{children:[s,(0,$.jsx)(R,{dimColor:!0,children:` · `}),(0,$.jsx)(R,{dimColor:!0,children:i}),(0,$.jsx)(R,{dimColor:!0,children:` · `}),(0,$.jsx)(R,{children:a})]})}function Fj(e){return Ve()||e?.statusLineEnabled===!1?!1:e?.statusLineEnabled===!0||!!e?.statusLine?.command}function Ij(e,t,n,r,i,a,o){let s=_t(),c=Nl(),l=Pn({permissionMode:e,mainLoopModel:a,exceeds200kTokens:t}),u=n?.outputStyle||`default`,d=$o(r),f=Kn(l,yt()),p=yn(d,f),m=Bd(Fe()),h=Fh(),g={...h.five_hour&&{five_hour:{used_percentage:h.five_hour.utilization*100,resets_at:h.five_hour.resets_at}},...h.seven_day&&{seven_day:{used_percentage:h.seven_day.utilization*100,resets_at:h.seven_day.resets_at}}};return{...zs(),...m&&{session_name:m},model:{id:l,display_name:zt(l)},workspace:{current_dir:Tr(),project_dir:ft(),added_dirs:i},version:`2.8.2`,output_style:{name:u},cost:{total_cost_usd:Ue(),total_duration_ms:Je(),total_api_duration_ms:Ge(),total_lines_added:Pe(),total_lines_removed:Qe()},context_window:{total_input_tokens:wt(),total_output_tokens:ze(),context_window_size:f,current_usage:d,used_percentage:p.used,remaining_percentage:p.remaining},exceeds_200k_tokens:t,...(g.five_hour||g.seven_day)&&{rate_limits:g},...Vx()&&{vim:{mode:o??`INSERT`}},...s&&{agent:{name:s}},...$e()&&{remote:{session_id:Fe()}},...c&&{worktree:{name:c.worktreeName,path:c.worktreePath,branch:c.worktreeBranch,original_cwd:c.originalCwd,original_branch:c.originalBranch}}}}function Lj(e){return ac(e)?.uuid??null}function Rj({messagesRef:e,lastAssistantMessageId:t,vimMode:n}){let r=(0,Q.useRef)(void 0),i=Z(e=>e.toolPermissionContext.mode),a=Z(e=>e.toolPermissionContext.additionalWorkingDirectories),o=Z(e=>e.statusLineText),s=Af(),c=Eh(),{addNotification:l}=Bh(),u=Lb(),d=(0,Q.useRef)(c);d.current=c;let f=(0,Q.useRef)(n);f.current=n;let p=(0,Q.useRef)(i);p.current=i;let m=(0,Q.useRef)(a);m.current=a;let h=(0,Q.useRef)(u);h.current=u;let g=(0,Q.useRef)({messageId:null,exceeds200kTokens:!1,permissionMode:i,vimMode:n,mainLoopModel:u}),_=(0,Q.useRef)(void 0),v=(0,Q.useRef)(!0),y=(0,Q.useCallback)(async()=>{r.current?.abort();let t=new AbortController;r.current=t;let n=e.current,i=v.current;if(v.current=!1,d.current?.statusLine?.command)try{let e=g.current.exceeds200kTokens,r=Lj(n);r!==g.current.messageId&&(e=Ac(n),g.current.messageId=r,g.current.exceeds200kTokens=e);let a=await Nm(Ij(p.current,e,d.current,n,Array.from(m.current.keys()),h.current,f.current),t.signal,void 0,i);t.signal.aborted||s(e=>e.statusLineText===a?e:{...e,statusLineText:a})}catch{}},[e,s]),b=(0,Q.useCallback)(()=>{_.current!==void 0&&clearTimeout(_.current),_.current=setTimeout((e,t)=>{e.current=void 0,t()},300,_,y)},[y]);(0,Q.useEffect)(()=>{(t!==g.current.messageId||i!==g.current.permissionMode||n!==g.current.vimMode||u!==g.current.mainLoopModel)&&(g.current.permissionMode=i,g.current.vimMode=n,g.current.mainLoopModel=u,b())},[t,i,n,u,b]);let x=c?.statusLine?.command,S=(0,Q.useRef)(!0);(0,Q.useEffect)(()=>{if(S.current){S.current=!1;return}v.current=!0,y()},[x,y]),(0,Q.useEffect)(()=>{let e=c?.statusLine;e&&(Y(`tengu_status_line_mount`,{command_length:e.command.length,padding:e.padding}),c.disableAllHooks===!0&&J(`Status line is configured but disableAllHooks is true`,{level:`warn`}),W()||(l({key:`statusline-trust-blocked`,text:`statusline skipped · restart to fix`,color:`warning`,priority:`low`}),J(`Status line command skipped: workspace trust not accepted`,{level:`warn`})))},[]),(0,Q.useEffect)(()=>(y(),()=>{r.current?.abort(),_.current!==void 0&&clearTimeout(_.current)}),[]);let C=c?.statusLine?.padding??0,w=Pn({permissionMode:i,mainLoopModel:u,exceeds200kTokens:g.current.exceeds200kTokens}),T=Kn(w,yt()),E=$o(e.current),D=E?E.input_tokens+E.cache_creation_input_tokens+E.cache_read_input_tokens:0,O=E?Math.round(yn(E,T).used??0):0,k=Fh(),A={...k.five_hour&&{five_hour:{utilization:k.five_hour.utilization,resets_at:k.five_hour.resets_at}},...k.seven_day&&{seven_day:{utilization:k.seven_day.utilization,resets_at:k.seven_day.resets_at}}},j=c?.statusLineEnabled===!0,M=!!c?.statusLine?.command;return(0,$.jsxs)(U,{flexDirection:`column`,paddingX:C,children:[j&&(0,$.jsxs)(U,{gap:2,children:[(0,$.jsx)(kj,{modelName:zt(w),contextUsedPct:O,usedTokens:D,contextWindowSize:T,totalCostUsd:Ue(),rateLimits:A}),(0,$.jsx)(Pj,{}),(0,$.jsx)(Nj,{messages:e.current})]}),o?(0,$.jsx)(R,{dimColor:!0,wrap:`truncate`,children:(0,$.jsx)(fe,{children:o})}):M&&El()?(0,$.jsx)(R,{children:` `}):null]})}var zj=(0,Q.memo)(Rj);wp();function Bj(e,t,n,r,i=!0){let a=e.length;if(a===0)return{startIndex:0,endIndex:0,showLeftArrow:!1,showRightArrow:!1};let o=Math.max(0,Math.min(r,a-1));if(e.reduce((e,t)=>e+t,0)<=t)return{startIndex:0,endIndex:a,showLeftArrow:!1,showRightArrow:!1};let s=[0];for(let t=0;t<a;t++)s.push(s[t]+e[t]);function c(e,t){let n=s[t]-s[e];return i&&e>0?n-1:n}function l(e,r){let i=t;return e>0&&(i-=n),r<a&&(i-=n),i}let u=0,d=1;for(;d<a&&c(u,d+1)<=l(u,d+1);)d++;if(o>=u&&o<d)return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a};if(o>=d)for(d=o+1,u=o;u>0&&c(u-1,d)<=l(u-1,d);)u--;else for(u=o,d=o+1;d<a&&c(u,d+1)<=l(u,d+1);)d++;return{startIndex:u,endIndex:d,showLeftArrow:u>0,showRightArrow:d<a}}f(),ny(),H(),X(),rS(),fa(),Qa(),cS();function Vj({tasksSelected:e,isViewingTeammate:t,teammateFooterIndex:n=0,isLeaderIdle:r=!1,onOpenDialog:i}){let a=Af(),{columns:o}=k(),s=Z(e=>e.tasks),c=Z(e=>e.viewingAgentTaskId),l=(0,Q.useMemo)(()=>Object.values(s??{}).filter(e=>Gd(e)&&!(process.env.USER_TYPE===`ant`&&Zs(e))),[s]),u=Z(e=>e.expandedView)===`teammates`,d=!u&&l.length>0&&l.every(e=>e.type===`in_process_teammate`),f=(0,Q.useMemo)(()=>l.filter(e=>e.type===`in_process_teammate`).sort((e,t)=>e.identity.agentName.localeCompare(t.identity.agentName)),[l]),m=(0,Q.useMemo)(()=>{let t={name:`main`,color:void 0,isIdle:r,taskId:void 0},n=f.map(e=>({name:e.identity.agentName,color:Wj(e.identity.color),isIdle:e.isIdle,taskId:e.id}));return e||n.sort((e,t)=>e.isIdle===t.isIdle?0:e.isIdle?1:-1),[t,...n].map((e,t)=>({...e,idx:t}))},[f,r,e]),h=(0,Q.useMemo)(()=>m.map((e,t)=>D(`@${e.name}`)+ +(t>0)),[m]);if(d||!u&&t){let t=e?n:-1,r=c?f.findIndex(e=>e.id===c)+1:0,{startIndex:i,endIndex:s,showLeftArrow:l,showRightArrow:u}=Bj(h,Math.max(20,o-20-4),2,t>=0?t:0),d=m.slice(i,s);return(0,$.jsxs)($.Fragment,{children:[l&&(0,$.jsxs)(R,{dimColor:!0,children:[p.arrowLeft,` `]}),d.map((e,n)=>{let i=n>0;return(0,$.jsxs)(Q.Fragment,{children:[i&&(0,$.jsx)(R,{children:` `}),(0,$.jsx)(Hj,{name:e.name,color:e.color,isSelected:t===e.idx,isViewed:r===e.idx,isIdle:e.isIdle,onClick:()=>e.taskId?sS(e.taskId,a):lS(a)})]},e.name)}),u&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,p.arrowRight]}),(0,$.jsxs)(R,{dimColor:!0,children:[` · `,(0,$.jsx)(he,{shortcut:`shift + ↓`,action:`expand`})]})]})}return nS(s??{},u)||l.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Uj,{selected:e,onClick:i,children:Nh(l)}),Od(l)&&(0,$.jsxs)(R,{dimColor:!0,children:[` · `,p.arrowDown,` to view`]})]})}function Hj({name:e,color:t,isSelected:n,isViewed:r,isIdle:i,onClick:a}){let[o,s]=(0,Q.useState)(!1),c=n||o,l;return l=c?t?(0,$.jsxs)(R,{backgroundColor:t,color:`inverseText`,bold:r,children:[`@`,e]}):(0,$.jsxs)(R,{color:`background`,inverse:!0,bold:r,children:[`@`,e]}):i?(0,$.jsxs)(R,{dimColor:!0,bold:r,children:[`@`,e]}):r?(0,$.jsxs)(R,{color:t,bold:!0,children:[`@`,e]}):(0,$.jsxs)(R,{color:t,dimColor:!t,children:[`@`,e]}),a?(0,$.jsx)(U,{onClick:a,onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),children:l}):l}function Uj({selected:e,onClick:t,children:n}){let[r,i]=(0,Q.useState)(!1),a=(0,$.jsx)(R,{color:`background`,inverse:e||r,children:n});return t?(0,$.jsx)(U,{onClick:t,onMouseEnter:()=>i(!0),onMouseLeave:()=>i(!1),children:a}):a}function Wj(e){if(e&&Oa.includes(e))return Bg[e]}H(),X();function Gj({teamsSelected:e,showHint:t}){let n=Z(e=>e.teamContext),r=n?Object.values(n.teammates).filter(e=>e.name!==`team-lead`).length:0;if(r===0)return null;let i=t&&e?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{dimColor:!0,children:`· `}),(0,$.jsx)(R,{dimColor:!0,children:`Enter to view`})]}):null;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`background`,inverse:e,children:`${r} ${r===1?`teammate`:`teammates`}`},e?`selected`:`normal`),i?(0,$.jsxs)(R,{children:[` `,i]}):null]})}H(),jf();function Kj({value:e,onChange:t,historyFailedMatch:n}){return(0,$.jsxs)(U,{gap:1,children:[(0,$.jsx)(R,{dimColor:!0,children:n?`no matching prompt:`:`search prompts:`}),(0,$.jsx)(tf,{value:e,onChange:t,cursorOffset:e.length,onChangeCursorOffset:()=>{},columns:D(e)+1,focus:!0,showCursor:!0,multiline:!1,dimColor:!0})]})}si(),Mr(),fr();var qj=5e3;function Jj(e,t){if(e)return`draft`;switch(t){case`APPROVED`:return`approved`;case`CHANGES_REQUESTED`:return`changes_requested`;default:return`pending`}}async function Yj(){if(!await Ar())return null;let[e,t]=await Promise.all([jr(),kr()]);if(e===t)return null;let{stdout:n,code:r}=await ci(`gh`,[`pr`,`view`,`--json`,`number,url,reviewDecision,isDraft,headRefName,state`],{timeout:qj,preserveOutputOnError:!1});if(r!==0||!n.trim())return null;try{let e=G(n);return e.headRefName===t||e.headRefName===`main`||e.headRefName===`master`||e.state===`MERGED`||e.state===`CLOSED`?null:{number:e.number,url:e.url,reviewState:Jj(e.isDraft,e.reviewDecision)}}catch{return null}}ot();var Xj=6e4,Zj=4e3,Qj=60*6e4,$j={number:null,url:null,reviewState:null,lastUpdated:0};function eM(e,t=!0){let[n,r]=(0,Q.useState)($j),i=(0,Q.useRef)(null),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(0);return(0,Q.useEffect)(()=>{if(!t||a.current)return;let e=!1,n=-1,s=Date.now();async function c(){if(e)return;let t=et();if(n!==t)n=t,s=Date.now();else if(Date.now()-s>=Qj)return;let l=Date.now(),u=await Yj();if(!e){if(o.current=l,r(e=>{let t=u?.number??null,n=u?.reviewState??null;return e.number===t&&e.reviewState===n?e:{number:t,url:u?.url??null,reviewState:n,lastUpdated:Date.now()}}),Date.now()-l>Zj){a.current=!0;return}e||(i.current=setTimeout(c,Xj))}}let l=Date.now()-o.current;return l>=Xj?c():i.current=setTimeout(c,Xj-l),()=>{e=!0,i.current&&(clearTimeout(i.current),i.current=null)}},[e,t]),n}H(),f(),Wx(),za(),sn(),Gh(),fa(),Ci(),cS(),Yn(),nc(),X(),ot(),ny(),ki(),nO(),RD(),fl(),Da(),lr(),ei(),Jh();var tM=(m_(),e(el)),nM=(vv(),e(sv)),rM=e=>()=>{},iM=()=>null,aM=3,oM=5e3,sM=1e3;function cM(){let[e,t]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{function e(){let e=process.memoryUsage().rss/(1024*1024),n=e>=1024?`error`:e>=512?`warning`:`normal`,r=Ai(e*1024*1024);t(e=>e?.text===r?e:{text:r,level:n})}e();let n=setInterval(e,oM);return()=>clearInterval(n)},[]),e}function lM(){let e=(0,Q.useSyncExternalStore)(nM?.subscribeToProactiveChanges??rM,nM?.getNextTickAt??iM,iM),[t,n]=(0,Q.useState)(null);return(0,Q.useEffect)(()=>{if(e===null){n(null);return}function t(){n(Math.max(0,Math.ceil((e-Date.now())/1e3)))}t();let r=setInterval(t,1e3);return()=>clearInterval(r)},[e]),t===null?null:(0,$.jsxs)(R,{dimColor:!0,children:[`waiting `,Ni(t*1e3,{mostSignificantOnly:!0})]})}function uM(){let[t,n]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=setInterval(()=>n(e=>e+1),sM);return()=>clearInterval(e)},[]);let r=(ba(),e(sl)),i=r.getGoal();if(!i)return null;let a=r.getActiveElapsedMs(i),o=Math.floor(a/1e3),s=Math.floor(o/3600),c=Math.floor(o%3600/60),l=o%60,u;u=s>=1?`${s}h${c}min`:c>=1?`${c}min`:`${l}s`;let d;switch(i.status){case`active`:d=`ansi:green`;break;case`paused`:case`budget_limited`:case`usage_limited`:d=`ansi:yellow`;break;case`blocked`:d=`ansi:red`;break;case`complete`:d=`ansi:cyan`;break}return(0,$.jsxs)(R,{color:d,children:[`goal (`,u,`)`]})}function dM({exitMessage:e,vimMode:t,mode:n,toolPermissionContext:r,suppressHint:i,isLoading:a,tasksSelected:o,teamsSelected:s,tmuxSelected:c,teammateFooterIndex:l,isPasting:u,isSearching:d,historyQuery:f,setHistoryQuery:p,historyFailedMatch:m,onOpenTasksDialog:h}){if(e.show)return(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,e.key,` again to exit`]},`exit-message`);if(u)return(0,$.jsx)(R,{dimColor:!0,children:`Pasting text…`},`pasting-message`);let g=Vx()&&t===`INSERT`&&!d;return(0,$.jsxs)(U,{justifyContent:`flex-start`,gap:1,children:[d&&(0,$.jsx)(Kj,{value:f,onChange:p,historyFailedMatch:m}),g?(0,$.jsx)(R,{dimColor:!0,children:`-- INSERT --`},`vim-insert`):null,(0,$.jsx)(fM,{mode:n,toolPermissionContext:r,showHint:!i&&!g,isLoading:a,tasksSelected:o,teamsSelected:s,teammateFooterIndex:l,tmuxSelected:c,onOpenTasksDialog:h})]})}function fM({mode:t,toolPermissionContext:n,showHint:r,isLoading:i,tasksSelected:a,teamsSelected:o,tmuxSelected:s,teammateFooterIndex:c,onOpenTasksDialog:l}){let{columns:u}=k(),d=fc(`chat:cycleMode`,`Chat`,`shift+tab`),f=Z(e=>e.tasks),m=Z(e=>e.teamContext),h=ef(),[g]=(0,Q.useState)(()=>h.getState().remoteSessionUrl),_=Z(e=>e.viewSelectionMode),v=Z(e=>e.viewingAgentTaskId),y=Z(e=>e.expandedView),b=y===`teammates`,x=eM(i,mM()),S=Z(e=>process.env.USER_TYPE===`ant`&&e.tungstenActiveSession!==void 0),C=(0,Q.useSyncExternalStore)(nM?.subscribeToProactiveChanges??rM,nM?.getNextTickAt??iM,iM),w=ID(),T=Tl(e=>e.voiceState),E=Tl(e=>e.voiceWarmingUp),D=j(),O=ee().getState,A=C!==null,M=tM?.isCoordinatorMode()===!0,N=(0,Q.useMemo)(()=>mi(Object.values(f),e=>Gd(e)&&!(process.env.USER_TYPE===`ant`&&Zs(e))),[f]),P=Dg(),F=P!==void 0&&P.length>0,te=fc(`chat:cancel`,`Chat`,`esc`).toLowerCase(),ne=fc(`app:toggleTodos`,`Global`,`ctrl+t`),I=fc(`chat:killAgents`,`Chat`,`ctrl+x ctrl+k`),L=fc(`voice:pushToTalk`,`Chat`,`Space`),[ie]=(0,Q.useState)(()=>(En().voiceFooterHintSeenCount??0)<aM),ae=ie,oe=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(!w||!ae||oe?.current)return;oe&&(oe.current=!0);let e=(En().voiceFooterHintSeenCount??0)+1;kt(t=>(t.voiceFooterHintSeenCount??0)>=e?t:{...t,voiceFooterHintSeenCount:e})}},[w,ae]);let se=Z(e=>e.notifications.current?.key===`kill-agents-confirm`),ce=cM(),le=Nn()&&!Dc()&&m!==void 0&&mi(Object.values(m.teammates),e=>e.name!==`team-lead`)>0;if(t===`bash`)return(0,$.jsx)(R,{color:`bashBorder`,children:`! for bash mode`});let ue=n?.mode,fe=!jt(ue),pe=v?f[v]:void 0,me=_===`viewing-agent`&&pe?.type===`in_process_teammate`,z=me&&pe!=null&&pe.status!==`running`,B=N>0||me,ge=(M||fe?1:0)+ +!!B+ +!!le,ve=mM()&&x.number!==null&&x.reviewState!==null&&x.url!==null&&ge<2&&(ge===0||u>=80),ye=ge<2,V=!b&&B&&Object.values(f).some(e=>e.type===`in_process_teammate`)||!b&&me,be=ue&&fe&&!$e()?(0,$.jsxs)(R,{color:sr(ue),children:[Zt(ue),` `,Ln(ue).toLowerCase(),` on`,ye&&(0,$.jsxs)(R,{dimColor:!0,children:[` `,(0,$.jsx)(he,{shortcut:d,action:`cycle`,parens:!0})]})]},`mode`):null,xe=[...g?[(0,$.jsx)(re,{url:g,children:(0,$.jsxs)(R,{color:`ide`,children:[p.circleDouble,` remote`]})},`remote`)]:[],...process.env.USER_TYPE===`ant`&&S?[(0,$.jsx)(TungstenPill,{selected:s},`tmux`)]:[],...Nn()&&le?[(0,$.jsx)(Gj,{teamsSelected:o,showHint:r&&!B},`teams`)]:[],...ve?[(0,$.jsx)(Hm,{number:x.number,url:x.url,reviewState:x.reviewState},`pr-status`)]:[],...ce?[(0,$.jsxs)(R,{dimColor:ce.level===`normal`,color:ce.level===`error`?`error`:ce.level===`warning`?`warning`:void 0,children:[ce.text,` · pid:`,process.pid]},`rss`)]:[],...(ba(),e(sl)).getGoal()?[(0,$.jsx)(uM,{},`goal-elapsed`)]:[]],Se=Object.values(f).some(e=>e.type===`in_process_teammate`&&e.status===`running`),H=Object.values(f).some(e=>e.type===`local_agent`&&e.status===`running`),Ce=r?pM(i,te,ne,I,F,y,Se,H,se):[];if(z?xe.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:te,action:`return to team lead`})},`esc-return`)):A?xe.push((0,$.jsx)(lM,{},`proactive`)):!V&&r&&xe.push(...Ce),V){let e=[...be?[be]:[],...xe,...z?[]:Ce];return(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(U,{children:(0,$.jsx)(Vj,{tasksSelected:a,isViewingTeammate:me,teammateFooterIndex:c,isLeaderIdle:!i,onOpenDialog:l})}),e.length>0&&(0,$.jsx)(U,{children:(0,$.jsx)(_e,{children:e})})]})}let we=process.env.USER_TYPE===`ant`&&Zk(f).length>0,Te=B&&!V&&!nS(f,b)?(0,$.jsx)(Vj,{tasksSelected:a,isViewingTeammate:me,teammateFooterIndex:c,isLeaderIdle:!i,onOpenDialog:l}):null;xe.length===0&&!Te&&!be&&r&&xe.push((0,$.jsx)(R,{dimColor:!0,children:`? for shortcuts`},`shortcuts-hint`));let Ee=En().copyOnSelect??!0,De=D&&(!Ee||de());if(w&&E)xe.push((0,$.jsx)(XD,{},`voice-warmup`));else if(El()&&De){let e=$r()===`macos`,t=e&&(O()?.lastPressHadAlt??!1);xe.push((0,$.jsx)(R,{dimColor:!0,children:(0,$.jsxs)(_e,{children:[!Ee&&(0,$.jsx)(he,{shortcut:`ctrl+c`,action:`copy`}),de()&&(t?(0,$.jsx)(R,{children:`set macOptionClickForcesSelection in VS Code settings`}):(0,$.jsx)(he,{shortcut:e?`option+click`:`shift+click`,action:`native select`}))]})},`selection-copy`))}else xe.length>0&&r&&w&&T===`idle`&&Ce.length===0&&ae&&xe.push((0,$.jsxs)(R,{dimColor:!0,children:[`hold `,L,` to speak`]},`voice-hint`));return(Te||we)&&r&&!le&&xe.push((0,$.jsx)(R,{dimColor:!0,children:a?(0,$.jsx)(he,{shortcut:`Enter`,action:`view tasks`}):(0,$.jsx)(he,{shortcut:`↓`,action:`manage`})},`manage-tasks`)),xe.length===0&&!Te&&!be?El()?(0,$.jsx)(R,{children:` `}):null:(0,$.jsxs)(U,{height:1,overflow:`hidden`,children:[be&&(0,$.jsxs)(U,{flexShrink:0,children:[be,(Te||xe.length>0)&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),Te&&(0,$.jsxs)(U,{flexShrink:0,children:[Te,xe.length>0&&(0,$.jsx)(R,{dimColor:!0,children:` · `})]}),xe.length>0&&(0,$.jsx)(R,{wrap:`truncate`,children:(0,$.jsx)(_e,{children:xe})})]})}function pM(e,t,n,r,i,a,o,s,c){let l;if(o)switch(a){case`none`:l=`show tasks`;break;case`tasks`:l=`show teammates`;break;case`teammates`:l=`hide`;break}else l=a===`tasks`?`hide tasks`:`show tasks`;let u=i||o;return[...e?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:t,action:`interrupt`})},`esc`)]:[],...!e&&s&&!c?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:r,action:`stop agents`})},`kill-agents`)]:[],...u?[(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:n,action:l})},`toggle-tasks`)]:[]]}function mM(){return En().prStatusFooterEnabled??!0}__(),wm(),ny(),H(),Hh(),X(),Da(),Db(),Ux();function hM({apiKeyStatus:e,debug:t,exitMessage:n,vimMode:r,mode:i,autoUpdaterResult:a,isAutoUpdating:o,verbose:s,onAutoUpdaterResult:c,onChangeIsUpdating:l,suggestions:u,selectedSuggestion:d,maxColumnWidth:f,toolPermissionContext:p,helpOpen:m,suppressHint:h,isLoading:g,tasksSelected:_,teamsSelected:v,bridgeSelected:y,tmuxSelected:b,teammateFooterIndex:x,ideSelection:S,mcpClients:C,isPasting:w=!1,isInputWrapped:T=!1,messages:E,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M}){let N=Eh(),{columns:P,rows:ee}=k(),F=(0,Q.useRef)(E);F.current=E;let te=(0,Q.useMemo)(()=>Lj(E),[E]),ne=P<80,I=El(),re=I&&ee<24,L=$k(),ie=Z(e=>e.coordinatorTaskIndex),ae=_&&(L===0||ie<0),oe=h||Fj(N)||D;return Sx((0,Q.useMemo)(()=>I&&u.length?{suggestions:u,selectedSuggestion:d,maxColumnWidth:f}:null,[I,u,d,f])),u.length&&!I?(0,$.jsx)(U,{paddingX:2,paddingY:0,children:(0,$.jsx)(Ob,{suggestions:u,selectedSuggestion:d,maxColumnWidth:f})}):m?(0,$.jsx)(Gx,{dimColor:!0,fixedWidth:!0,paddingX:2}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(U,{flexDirection:ne?`column`:`row`,justifyContent:ne?`flex-start`:`space-between`,paddingX:2,gap:+!ne,children:[(0,$.jsxs)(U,{flexDirection:`column`,flexShrink:+!ne,children:[i===`prompt`&&!re&&!n.show&&!w&&Fj(N)&&(0,$.jsx)(zj,{messagesRef:F,lastAssistantMessageId:te,vimMode:r}),(0,$.jsx)(vM,{}),(0,$.jsx)(dM,{exitMessage:n,vimMode:r,mode:i,toolPermissionContext:p,suppressHint:oe,isLoading:g,tasksSelected:ae,teamsSelected:v,teammateFooterIndex:x,tmuxSelected:b,isPasting:w,isSearching:D,historyQuery:O,setHistoryQuery:A,historyFailedMatch:j,onOpenTasksDialog:M})]}),(0,$.jsxs)(U,{flexShrink:1,gap:1,children:[I?null:(0,$.jsx)(aO,{apiKeyStatus:e,autoUpdaterResult:a,debug:t,isAutoUpdating:o,verbose:s,messages:E,onAutoUpdaterResult:c,onChangeIsUpdating:l,ideSelection:S,mcpClients:C,isInputWrapped:T,isNarrow:ne}),process.env.USER_TYPE===`ant`&&Dy()&&(0,$.jsx)(R,{dimColor:!0,children:`undercover`}),(0,$.jsx)(_M,{bridgeSelected:y})]})]}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(Qk,{})]})}var gM=(0,Q.memo)(hM);function _M({bridgeSelected:e}){let t=Z(e=>e.replBridgeEnabled),n=Z(e=>e.replBridgeConnected),r=Z(e=>e.replBridgeSessionActive),i=Z(e=>e.replBridgeReconnecting),a=Z(e=>e.replBridgeExplicit);if(!vy()||!t)return null;let o=rl({error:void 0,connected:n,sessionActive:r,reconnecting:i});return!a&&o.label!==`Remote Control reconnecting`?null:(0,$.jsxs)(R,{color:e?`background`:o.color,inverse:e,wrap:`truncate`,children:[o.label,e&&(0,$.jsx)(R,{dimColor:!0,children:` · Enter to view`})]})}function vM(){return null}f(),H(),Qa(),_i(),Yn();function yM(){if(!Nn())return;let e=yi();if(e&&Oa.includes(e))return Bg[e]}function bM({isLoading:e,themeColor:t}){let n=t,r=process.env.USER_TYPE===`ant`;return(0,$.jsxs)(R,{color:n??(r?`subtle`:void 0),dimColor:e,children:[p.pointer,`\xA0`]})}function xM({mode:e,isLoading:t,viewingAgentName:n,viewingAgentColor:r}){let i=yM(),a=r?Bg[r]:void 0;return(0,$.jsx)(U,{alignItems:`flex-start`,alignSelf:`flex-start`,flexWrap:`nowrap`,justifyContent:`flex-start`,children:n?(0,$.jsx)(bM,{isLoading:t,themeColor:a}):e===`bash`?(0,$.jsx)(R,{color:`bashBorder`,dimColor:t,children:`!\xA0`}):(0,$.jsx)(bM,{isLoading:t,themeColor:Nn()?i:void 0})})}H(),X(),Ku(),Ss(),ql(),fr(),wf();var SM=new Set;function CM(e){try{return G(e)?.type===`idle_notification`}catch{return!1}}var wM=3;function TM(e){return`<${Yr}>
|
|
72
72
|
<${Ur}>+${e} more tasks completed</${Ur}>
|
|
73
73
|
<${Jr}>completed</${Jr}>
|
|
74
74
|
</${Yr}>`}function EM(e){let t=e.filter(e=>typeof e.value!=`string`||!CM(e.value)),n=t.filter(e=>e.mode===`task-notification`),r=t.filter(e=>e.mode!==`task-notification`);if(n.length<=wM)return[...r,...n];let i=n.slice(0,wM-1),a={value:TM(n.length-(wM-1)),mode:`task-notification`};return[...r,...i,a]}function DM(){let e=pD(),t=Z(e=>!!e.viewingAgentTaskId),n=Z(e=>e.isBriefOnly),r=(0,Q.useMemo)(()=>{if(e.length===0)return null;let t=e.filter(ss);return t.length===0?null:sd(EM(t).map(e=>{let t=e.value;return e.mode===`bash`&&typeof t==`string`&&(t=`<bash-input>${t}</bash-input>`),ro({content:t})}))},[e]);return t||r===null?null:(0,$.jsx)(U,{marginTop:1,flexDirection:`column`,children:r.map((e,t)=>(0,$.jsx)(ds,{isFirst:t===0,useBriefLayout:n,children:(0,$.jsx)(Uc,{message:e,lookups:Of,addMargin:!1,tools:[],commands:[],verbose:!1,inProgressToolUseIDs:SM,progressMessagesForMessage:[],shouldAnimate:!1,shouldShowDot:!1,isTranscriptMode:!1,isStatic:!0})},t))})}var OM=Q.memo(DM);cf(),f(),H();function kM({hasStash:e}){return e?(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[p.pointerSmall,` Stashed (auto-restores after submit)`]})}):null}Cs();var AM=1e4,jM=1e3;function MM(e,t){if(e.length<=AM)return{truncatedText:e,placeholderContent:``};let n=Math.floor(jM/2),r=Math.floor(jM/2),i=e.slice(0,n),a=e.slice(-r),o=e.slice(n,-r);return{truncatedText:i+NM(t,wo(o))+a,placeholderContent:o}}function NM(e,t){return`[...Truncated text #${e} +${t} lines...]`}function PM(e,t){let n=Object.keys(t).map(Number),r=n.length>0?Math.max(...n)+1:1,{truncatedText:i,placeholderContent:a}=MM(e,r);return a?{newInput:i,newPastedContents:{...t,[r]:{id:r,type:`text`,content:a}}}:{newInput:e,newPastedContents:t}}function FM({input:e,pastedContents:t,onInputChange:n,setCursorOffset:r,setPastedContents:i}){let[a,o]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{if(a||e.length<=1e4)return;let{newInput:s,newPastedContents:c}=PM(e,t);n(s),r(s.length),i(c),o(!0)},[e,a,t,n,i,r]),(0,Q.useEffect)(()=>{e===``&&o(!1)},[e])}X(),lr(),Ss();var IM=(vv(),e(sv)),LM=3,RM=20;function zM({input:e,submitCount:t,viewingAgentName:n}){let r=pD(),i=Z(e=>e.promptSuggestionEnabled);return(0,Q.useMemo)(()=>{if(e===``){if(n)return`Message @${n.length>RM?n.slice(0,RM-3)+`...`:n}…`;if(r.some(ph)&&(En().queuedCommandUpHintCount||0)<LM)return`Press up to edit queued messages`;if(t<1&&i&&!IM?.isProactiveActive())return yS()}},[e,r,t,i,n])}var BM=5e3,VM=!1;function HM(e){let[t,n]=(0,Q.useState)(!1);return(0,Q.useEffect)(()=>{if(VM||!e)return;VM=!0,n(!0);let t=setTimeout(n,BM,!1);return()=>{clearTimeout(t),n(!1)}},[e]),t}_i();function UM(e){if(!pi())return e.standaloneAgentContext?.name}X(),Qa(),wy(),nc(),py(),_i();function WM(){let e=Z(e=>e.teamContext),t=Z(e=>e.standaloneAgentContext),n=Z(e=>e.agent);Z(e=>e.viewingAgentTaskId);let r=ef(),[i,a]=Q.useState(null);Q.useEffect(()=>{Cy().then(a)},[]);let o=r.getState();if(gi()&&!Si()){let t=vi();if(t&&pi())return{text:`@${t}`,bgColor:GM(e?.selfAgentColor??yi())}}if(e?.teamName&&e.teammates&&Object.keys(e.teammates).length>0){let e=Ru(o),t=GM(e?.identity.color),n=Dc(),r=qp(),a=r?.isNative??!1,s=r?.backend.type;if(i===!1&&!n&&!a)return{text:s===`windows-terminal`?`View teammates in the Windows Terminal tabs spawned for each teammate`:`View teammates: \`tmux -L ${hy()} a\``,bgColor:t};if((i===!0||n||a)&&e)return{text:`@${e.identity.agentName}`,bgColor:t}}let s=Zu(o);if(s.type===`named_agent`){let e=s.task,t;for(let[n,r]of o.agentNameRegistry)if(r===e.id){t=n;break}return{text:t?`@${t}`:e.description,bgColor:Dl(e.agentType)??`cyan_FOR_SUBAGENTS_ONLY`}}let c=UM(o),l=t?.color;return c||l?{text:c??``,bgColor:GM(l)}:n?{text:n,bgColor:GM(o.agentDefinitions.activeAgents.find(e=>e.agentType===n)?.color,`promptBorder`)}:null}function GM(e,t=`cyan_FOR_SUBAGENTS_ONLY`){return e&&Oa.includes(e)?Bg[e]:t}F(),Rm(),Cr(),X(),wr(),Ss(),Dm(),Hh(),Ox(),Cs(),Rb(),ny(),H(),Gp(),Np(),ty(),_f(),ud(),rS(),fa(),Gh(),Qa(),Yn(),Ci(),aa(),lr(),q(),zr(),gr(),Da(),Ap(),Zr(),$t(),ei(),Fb(),nc(),Bv(),_i(),fi(),fp(),Ia(),jf(),cS(),gf(),Wx();var KM=5,qM=3;function JM({debug:e,ideSelection:t,toolPermissionContext:n,setToolPermissionContext:r,apiKeyStatus:i,commands:a,agents:o,isLoading:s,verbose:c,messages:l,onAutoUpdaterResult:u,autoUpdaterResult:d,input:f,onInputChange:p,mode:m,onModeChange:h,stashedPrompt:g,setStashedPrompt:_,submitCount:v,onShowMessageSelector:y,onMessageActionsEnter:b,mcpClients:x,pastedContents:S,setPastedContents:C,vimMode:w,setVimMode:T,showBashesDialog:E,setShowBashesDialog:O,onExit:A,getToolUseContext:j,onSubmit:M,onAgentSubmit:N,isSearchingHistory:P,setIsSearchingHistory:ee,onDismissSideQuestion:F,isSideQuestionVisible:te,helpOpen:I,setHelpOpen:re,hasSuppressedDialogs:L,isLocalJSXCommandActive:ie=!1,insertTextRef:ae,voiceInterimRange:se}){let ce=Lb(),le=Hd()||ie,[ue,de]=(0,Q.useState)(!1),[fe,me]=(0,Q.useState)({show:!1}),[z,B]=(0,Q.useState)(f.length),he=Q.useRef(f);f!==he.current&&(B(f.length),he.current=f);let ge=Q.useCallback(e=>{he.current=e,p(e)},[p]);ae&&(ae.current={cursorOffset:z,insert:e=>{let t=z===f.length&&f.length>0&&!/\s$/.test(f)?` `+e:e,n=f.slice(0,z)+t+f.slice(z);he.current=n,p(n),B(z+t.length)},setInputWithCursor:(e,t)=>{he.current=e,p(e),B(t)}});let _e=ef(),ve=Af(),ye=Z(e=>e.tasks),be=Z(e=>e.replBridgeConnected),xe=Z(e=>e.replBridgeExplicit),Se=Z(e=>e.replBridgeReconnecting),H=be&&(xe||Se),Ce=Z(e=>process.env.USER_TYPE===`ant`&&e.tungstenActiveSession!==void 0),Te=process.env.USER_TYPE===`ant`&&Ce,Ee=Z(e=>!1),De=Z(e=>e.teamContext),ke=pD(),Ae=Z(e=>e.promptSuggestion),je=Z(e=>e.speculation),Me=Z(e=>e.speculationSessionTimeSavedMs),Ne=Z(e=>e.viewingAgentTaskId),Pe=Z(e=>e.viewSelectionMode),Fe=Z(e=>e.expandedView)===`teammates`,{companion:Ie,companionMuted:Le}=En(),Re=!!Ie&&!Le,ze=Z(e=>e.isBriefOnly)&&!Ne,Be=Z(e=>e.mainLoopModel),Ve=Z(e=>e.mainLoopModelForSession),He=Z(e=>e.thinkingEnabled),Ue=Z(e=>ar()?e.fastMode:!1),We=Z(e=>e.effortValue),Ge=Ru(_e.getState()),Ke=Ge?.identity.agentName,qe=Ge?.identity.color&&Oa.includes(Ge.identity.color)?Ge.identity.color:void 0,Je=(0,Q.useMemo)(()=>Om(ye),[ye]),Ye=Je.length>0||Ge!==void 0,Xe=(0,Q.useMemo)(()=>Ge?{...n,mode:Ge.permissionMode}:n,[Ge,n]),{historyQuery:Ze,setHistoryQuery:Qe,historyMatch:$e,historyFailedMatch:et}=mO(e=>{C(e.pastedContents),Hn(e.display)},f,ge,B,z,h,m,P,ee,C,S),tt=(0,Q.useRef)(-1);tt.current===-1&&(tt.current=YM(l));let nt=(0,Q.useRef)(!1),[rt,it]=(0,Q.useState)(!1),[at,ot]=(0,Q.useState)(!1),[st,ct]=(0,Q.useState)(0),lt=Z(e=>e.coordinatorTaskIndex),ut=Z(e=>e.selectedBgAgentIndex),dt=(0,Q.useCallback)(e=>ve(t=>{let n=typeof e==`function`?e(t.selectedBgAgentIndex):e;return n===t.selectedBgAgentIndex?t:{...t,selectedBgAgentIndex:n}}),[ve]),ft=(0,Q.useCallback)(e=>ve(t=>{let n=typeof e==`function`?e(t.coordinatorTaskIndex):e;return n===t.coordinatorTaskIndex?t:{...t,coordinatorTaskIndex:n}}),[ve]),pt=$k(),mt=(0,Q.useMemo)(()=>Object.values(ye).some(e=>Gd(e)&&!(process.env.USER_TYPE===`ant`&&Zs(e))),[ye])?-1:0;(0,Q.useEffect)(()=>{lt>=pt?ft(Math.max(mt,pt-1)):lt<mt&&ft(mt)},[pt,lt,mt]);let[ht,gt]=(0,Q.useState)(!1),[_t,vt]=(0,Q.useState)(!1),[yt,bt]=(0,Q.useState)(!1),[xt,St]=(0,Q.useState)(!1),[Ct,wt]=(0,Q.useState)(!1),[Tt,Et]=(0,Q.useState)(!1),[Dt,Ot]=(0,Q.useState)(!1),[At,jt]=(0,Q.useState)(!1),Mt=(0,Q.useMemo)(()=>{let e=f.indexOf(`
|
|
@@ -86,7 +86,7 @@ Server disconnected.
|
|
|
86
86
|
|
|
87
87
|
`),S=()=>{o(e=>({...e,inbox:{messages:[...e.inbox.messages,...b.map(e=>({id:zS(),from:e.from,text:e.text,timestamp:e.timestamp,status:`pending`,color:e.color,summary:e.summary}))]}}))};!t&&!n?(J(`[InboxPoller] Session idle, submitting immediately`),i(x)||(J(`[InboxPoller] Submission rejected, queuing for later delivery`),S())):(J(`[InboxPoller] Session busy, queuing for later delivery`),S()),u()},[e,t,n,i,o,c,a]);(0,Q.useEffect)(()=>{if(!e||t||n)return;let r=a.getState();if(!PP(r))return;let s=r.inbox.messages.filter(e=>e.status===`pending`),c=r.inbox.messages.filter(e=>e.status===`processed`);if(c.length>0){J(`[InboxPoller] Cleaning up ${c.length} processed message(s) that were delivered mid-turn`);let e=new Set(c.map(e=>e.id));o(t=>({...t,inbox:{messages:t.inbox.messages.filter(t=>!e.has(t.id))}}))}if(s.length!==0)if(J(`[InboxPoller] Session idle, delivering ${s.length} pending message(s)`),i(s.map(e=>{let t=e.color?` color="${e.color}"`:``,n=e.summary?` summary="${e.summary}"`:``;return`<teammate-message teammate_id="${e.from}"${t}${n}>\n${e.text}\n</teammate-message>`}).join(`
|
|
88
88
|
|
|
89
|
-
`))){let e=new Set(s.map(e=>e.id));o(t=>({...t,inbox:{messages:t.inbox.messages.filter(t=>!e.has(t.id))}}))}else J(`[InboxPoller] Submission rejected, keeping messages queued`)},[e,t,n,i,o,s,a]),se(()=>void l(),e&&PP(a.getState())?FP:null);let u=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{e&&(u.current||PP(a.getState())&&(u.current=!0,l()))},[e,l,a])}q(),Lv();var LP=1e3;function RP({taskListId:e,isLoading:t,onSubmitTask:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(t);a.current=t;let o=(0,Q.useRef)(n);o.current=n;let s=e!==void 0,c=e??`tasklist`,l=(0,Q.useRef)(async()=>{});l.current=async()=>{if(!s||a.current)return;let t=await Nv(e);if(r.current!==null){let e=t.find(e=>e.id===r.current);if(!e||e.status===`completed`)J(`[TaskListWatcher] Task #${r.current} is marked complete, ready for next task`),r.current=null;else return}let n=zP(t);if(!n)return;J(`[TaskListWatcher] Found available task #${n.id}: ${n.subject}`);let i=await jv(e,n.id,c);if(!i.success){J(`[TaskListWatcher] Failed to claim task #${n.id}: ${i.reason}`);return}r.current=n.id;let l=BP(n);J(`[TaskListWatcher] Submitting task #${n.id} as prompt`),o.current(l)||(J(`[TaskListWatcher] Failed to submit task #${n.id}, releasing claim`),await Mv(e,n.id,{owner:void 0}),r.current=null)};let u=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!s)return;Av(e);let t=Iv(e),n=null,r=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(e=>void e.current(),LP,l)};u.current=r;try{n=LS(t,r),n.unref(),J(`[TaskListWatcher] Watching for tasks in ${t}`)}catch(e){J(`[TaskListWatcher] Failed to watch ${t}: ${e}`)}return r(),()=>{u.current=()=>{},n&&n.close(),i.current&&clearTimeout(i.current)}},[s,e]),(0,Q.useEffect)(()=>{s&&(t||u.current())},[s,t])}function zP(e){let t=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return e.find(e=>e.status!==`pending`||e.owner?!1:e.blockedBy.every(e=>!t.has(e)))}function BP(e){let t=`Complete all open tasks. Start with task #${e.id}: \n\n ${e.subject}`;return e.description&&(t+=`\n\n${e.description}`),t}lr(),s(),ma();function VP({autoConnectIdeFlag:e,ideToInstallExtension:t,setDynamicMcpConfig:n,setShowIdeOnboarding:r,setIDEInstallationState:i}){(0,Q.useEffect)(()=>{function o(r){r&&(En().autoConnectIde||e||vo()||process.env.CLAUDE_CODE_SSE_PORT||t||c(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE))&&!a(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE)&&n(e=>e?.ide?e:{...e,ide:{type:r.url.startsWith(`ws:`)?`ws-ide`:`sse-ide`,url:r.url,ideName:r.name,authToken:r.authToken,ideRunningInWindows:r.ideRunningInWindows,scope:`dynamic`}})}Hp(o,t,()=>r(!0),e=>i(e))},[e,t,n,r,i])}yx(),uy(),H(),ty(),za(),X(),lr(),zr(),s();function HP({onBackgroundSession:e,isLoading:t}){let n=Af(),r=ef(),[i,a]=(0,Q.useState)(!1),o=ne(a,e,()=>{}),s=(0,Q.useCallback)(()=>{c(process.env.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS)||(io(r.getState())?(Pl(()=>r.getState(),n),En().hasUsedBackgroundTask||kt(e=>e.hasUsedBackgroundTask?e:{...e,hasUsedBackgroundTask:!0})):c(`false`)&&t&&o())},[n,r,t,o]),l=Z(io),u=c(`false`);we(`task:background`,s,{context:`Task`,isActive:l||u&&t});let d=fc(`task:background`,`Task`,`ctrl+b`),f=Vr.terminal===`tmux`&&d===`ctrl+b`?`ctrl+b ctrl+b`:d;return!t||!i?null:(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:f,action:`background`})})})}X();function UP({setMessages:e,setIsLoading:t,resetLoadingState:n,setAbortController:r,onBackgroundQuery:i}){let a=Z(e=>e.foregroundedTaskId),o=Z(e=>e.foregroundedTaskId?e.tasks[e.foregroundedTaskId]:void 0),s=Af(),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(()=>{if(a){s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),e([]),n(),r(null);return}i()},[a,s,e,n,r,i]);return(0,Q.useEffect)(()=>{if(!a){c.current=0;return}if(!o||o.type!==`local_agent`){s(e=>({...e,foregroundedTaskId:void 0})),n(),c.current=0;return}let i=o.messages??[];if(i.length!==c.current&&(c.current=i.length,e([...i])),o.status===`running`){let e=o.abortController;if(e?.signal.aborted){s(e=>{if(!e.foregroundedTaskId)return e;let t=e.tasks[e.foregroundedTaskId];return t?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[e.foregroundedTaskId]:{...t,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0;return}t(!0),e&&r(e)}else s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0},[a,o,s,e,t,n,r]),{handleBackgroundSession:l}}lu(),H(),Wn(),lr(),$t(),Gn(),zm(),dx(),Bb();var WP=3e4;function GP({model:e,onDone:t}){let n=Wg(),r=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{r.current=t});let i=(0,Q.useCallback)(()=>{r.current(`dismiss`)},[]);(0,Q.useEffect)(()=>{YP()},[]),(0,Q.useEffect)(()=>{let e=setTimeout(i,WP);return()=>clearTimeout(e)},[i]);let a=kg(e),o=a?yd(a):`high`,s=(0,Q.useCallback)(e=>{Bn(`userSettings`,{effortLevel:ic(e===o?void 0:e)}),r.current(e)},[o]),c=[{label:(0,$.jsx)(qP,{level:`medium`,text:`Medium (recommended)`}),value:`medium`},{label:(0,$.jsx)(qP,{level:`high`,text:`High`}),value:`high`},{label:(0,$.jsx)(qP,{level:`low`,text:`Low`}),value:`low`}];return(0,$.jsx)(Hb,{title:n.dialogTitle,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(R,{children:n.dialogDescription})}),(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[(0,$.jsx)(KP,{level:`low`}),` low `,`·`,` `,(0,$.jsx)(KP,{level:`medium`}),` medium `,`·`,` `,(0,$.jsx)(KP,{level:`high`}),` high`]})}),(0,$.jsx)(wd,{options:c,onChange:s,onCancel:i})]})})}function KP({level:e}){return(0,$.jsx)(R,{color:`suggestion`,children:ox(e)})}function qP({level:e,text:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(KP,{level:e}),` `,t]})}function JP(e){if(!Ot(e).toLowerCase().includes(`opus-4-6`))return!1;let t=En();return t.effortCalloutV2Dismissed?!1:t.numStartups<=1?(YP(),!1):dr()?t.effortCalloutDismissed?(YP(),!1):Wg().enabled:jn()||or()?Wg().enabled:(YP(),!1)}function YP(){kt(e=>e.effortCalloutV2Dismissed?e:{...e,effortCalloutV2Dismissed:!0})}Gy(),Ub(),an();function XP(e,t){let[n,r]=Q.useState(t);return Q.useEffect(()=>{Mn(e,t).then(r)},[e,t]),n}async function ZP(e,t,n){try{J(`Collecting transcript for sharing`,{level:`info`});let r=Gc(e),i=await qc(ff(e)),a;try{let e=da(),{size:t}=await VS(e);t<=52428800?a=await BS(e,`utf-8`):J(`Skipping raw transcript read: file too large (${t} bytes)`,{level:`warn`})}catch{}let o=Bx(hr({trigger:t,version:`2.8.1`,platform:process.platform,transcript:r,subagentTranscripts:Object.keys(i).length>0?i:void 0,rawTranscriptJsonl:a}));await tn();let s=xn();if(s.error)return{success:!1};let c={"Content-Type":`application/json`,"User-Agent":cn(),...s.headers},l=await m.post(`https://api.anthropic.com/api/claude_code_shared_session_transcripts`,{content:o,appearance_id:n},{headers:c,timeout:3e4});if(l.status===200||l.status===201){let e=l.data;return J(`Transcript shared successfully`,{level:`info`}),{success:!0,transcriptId:e?.transcript_id}}return{success:!1}}catch(e){return J(Sr(e),{level:`error`}),{success:!1}}}var QP=t((()=>{h(),Wn(),q(),gr(),ql(),go(),fr()}));wn(),QP();function $P({hideThanksAfterMs:e,onOpen:t,onSelect:n,shouldShowTranscriptPrompt:r,onTranscriptPromptShown:i,onTranscriptSelect:a}){let[o,s]=(0,Q.useState)(`closed`),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(zS()),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(()=>{s(`thanks`),setTimeout((e,t)=>{e(`closed`),t(null)},e,s,l)},[e]),p=(0,Q.useCallback)(()=>{s(`submitted`),setTimeout(s,e,`closed`)},[e]);return{state:o,lastResponse:c,open:(0,Q.useCallback)(()=>{o===`closed`&&(s(`open`),u.current=zS(),t(u.current))},[o,t]),handleSelect:(0,Q.useCallback)(e=>{if(l(e),d.current=e,n(u.current,e),e===`dismissed`)s(`closed`),l(null);else if(r?.(e))return s(`transcript_prompt`),i?.(u.current,e),!0;else f();return!1},[f,n,r,i]),handleTranscriptSelect:(0,Q.useCallback)(e=>{switch(e){case`yes`:s(`submitting`),(async()=>{try{await a?.(u.current,e,d.current)?p():f()}catch{f()}})();break;case`no`:case`dont_ask_again`:a?.(u.current,e,d.current),f();break}},[f,p,a])}}Cr(),lr(),s(),ql(),$t(),Gn();var eF={minTimeBeforeFeedbackMs:6e5,minTimeBetweenFeedbackMs:36e5,minTimeBetweenGlobalFeedbackMs:1e8,minUserTurnsBeforeFeedback:5,minUserTurnsBetweenFeedback:10,hideThanksAfterMs:3e3,onForModels:[`*`],probability:.005},tF={probability:0};function nF(e,t,n,r=`session`,i=!1){let a=(0,Q.useRef)(`unknown`);a.current=ac(e)?.message?.id||`unknown`;let[o,s]=(0,Q.useState)(()=>({timeLastShown:null,submitCountAtLastAppearance:null})),l=XP(`tengu_feedback_survey_config`,eF),u=XP(`tengu_bad_survey_transcript_ask_config`,tF),d=XP(`tengu_good_survey_transcript_ask_config`,tF),f=Ut().feedbackSurveyRate,p=(0,Q.useRef)(Date.now()),m=(0,Q.useRef)(n),h=(0,Q.useRef)(n);h.current=n;let g=(0,Q.useRef)(e);g.current=e;let _=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useCallback)((e,t)=>{s(n=>n.timeLastShown===e&&n.submitCountAtLastAppearance===t?n:{timeLastShown:e,submitCountAtLastAppearance:t}),En().feedbackSurveyState?.lastShownTime!==e&&kt(t=>({...t,feedbackSurveyState:{lastShownTime:e}}))},[]),b=(0,Q.useCallback)(e=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r}),yv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:r})},[y,r]),x=(0,Q.useCallback)((e,t)=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`responded`,appearance_id:e,response:t,last_assistant_message_id:a.current,survey_type:r}),yv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:r})},[y,r]),S=(0,Q.useCallback)(e=>{if(e!==`bad`&&e!==`good`||En().transcriptShareDismissed||!ws(`allow_product_feedback`))return!1;let t=e===`bad`?u.probability:d.probability;return Math.random()<=t},[u.probability,d.probability]),C=(0,Q.useCallback)((e,t)=>{let n=t===`good`?`good_feedback_survey`:`bad_feedback_survey`;Y(`tengu_feedback_survey_event`,{event_type:`transcript_prompt_appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:n}),yv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:r})},[r]),w=(0,Q.useCallback)(async(e,t,n)=>{let i=n===`good`?`good_feedback_survey`:`bad_feedback_survey`;if(Y(`tengu_feedback_survey_event`,{event_type:`transcript_share_${t}`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:i}),t===`dont_ask_again`&&kt(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await ZP(g.current,i,e);return Y(`tengu_feedback_survey_event`,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:i}),t.success}return!1},[r]),{state:T,lastResponse:E,open:D,handleSelect:O,handleTranscriptSelect:k}=$P({hideThanksAfterMs:l.hideThanksAfterMs,onOpen:b,onSelect:x,shouldShowTranscriptPrompt:S,onTranscriptPromptShown:C,onTranscriptSelect:w}),A=Pt(),j=(0,Q.useMemo)(()=>l.onForModels.length===0?!1:l.onForModels.includes(`*`)?!0:l.onForModels.includes(A),[l.onForModels,A]),M=(0,Q.useMemo)(()=>{if(T!==`closed`||t||i)return!1;if(process.env.CLAUDE_FORCE_DISPLAY_SURVEY&&!o.timeLastShown)return!0;if(!j||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||er()||!ws(`allow_product_feedback`))return!1;if(o.timeLastShown){if(Date.now()-o.timeLastShown<l.minTimeBetweenFeedbackMs||o.submitCountAtLastAppearance!==null&&n<o.submitCountAtLastAppearance+l.minUserTurnsBetweenFeedback)return!1}else if(Date.now()-p.current<l.minTimeBeforeFeedbackMs||n<m.current+l.minUserTurnsBeforeFeedback)return!1;if(v.current!==n&&(v.current=n,_.current=Math.random()<=(f??l.probability)),!_.current)return!1;let e=En().feedbackSurveyState;return!(e?.lastShownTime&&Date.now()-e.lastShownTime<l.minTimeBetweenGlobalFeedbackMs)},[T,t,i,j,o.timeLastShown,o.submitCountAtLastAppearance,n,l.minTimeBetweenFeedbackMs,l.minTimeBetweenGlobalFeedbackMs,l.minUserTurnsBetweenFeedback,l.minTimeBeforeFeedbackMs,l.minUserTurnsBeforeFeedback,l.probability,f]);return(0,Q.useEffect)(()=>{M&&D()},[M,D]),{state:T,lastResponse:E,handleSelect:O,handleTranscriptSelect:k}}wn(),an(),Cr(),mu(),lr(),s(),ql(),Sv(),QP();var rF=3e3,iF=`tengu_dunwich_bell`,aF=`tengu_memory_survey_event`,oF=.2,sF=`memory_survey`,cF=/\bmemor(?:y|ies)\b/i;function lF(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||t.name!==`Read`)continue;let e=t.input;if(typeof e.file_path==`string`&&Eu(e.file_path))return!0}}return!1}function uF(e,t,n=!1,{enabled:r=!0}={}){let i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(e);o.current=e;let{state:s,lastResponse:l,open:u,handleSelect:d,handleTranscriptSelect:f}=$P({hideThanksAfterMs:rF,onOpen:(0,Q.useCallback)(e=>{Y(aF,{event_type:`appeared`,appearance_id:e}),yv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`memory`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(aF,{event_type:`responded`,appearance_id:e,response:t}),yv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`memory`})},[]),shouldShowTranscriptPrompt:(0,Q.useCallback)(e=>!(process.env.USER_TYPE!==`ant`||e!==`bad`&&e!==`good`||En().transcriptShareDismissed||!ws(`allow_product_feedback`)),[]),onTranscriptPromptShown:(0,Q.useCallback)(e=>{Y(aF,{event_type:`transcript_prompt_appeared`,appearance_id:e,trigger:sF}),yv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:`memory`})},[]),onTranscriptSelect:(0,Q.useCallback)(async(e,t)=>{if(Y(aF,{event_type:`transcript_share_${t}`,appearance_id:e,trigger:sF}),t===`dont_ask_again`&&kt(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await ZP(o.current,sF,e);return Y(aF,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:sF}),t.success}return!1},[])}),p=(0,Q.useMemo)(()=>ac(e),[e]);return(0,Q.useEffect)(()=>{if(!r)return;if(e.length===0){a.current=!1,i.current.clear();return}if(s!==`closed`||t||n||!gn(iF,!1)||!Xn()||er()||!ws(`allow_product_feedback`)||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||!p||i.current.has(p.uuid))return;let o=Zp(Array.isArray(p.message.content)?p.message.content:[],` `);cF.test(o)&&(i.current.add(p.uuid),a.current||(a.current=lF(e)),a.current&&Math.random()<oF&&u())},[r,s,t,n,p,e,u]),{state:s,lastResponse:l,handleSelect:d,handleTranscriptSelect:f}}wn(),an(),Cr(),s(),ql(),Sv();var dF=3e3,fF=`tengu_post_compact_survey`,pF=.2;function mF(e,t){let n=e.findIndex(e=>e.uuid===t);if(n===-1)return!1;for(let t=n+1;t<e.length;t++){let n=e[t];if(n&&(n.type===`user`||n.type===`assistant`))return!0}return!1}function hF(e,t,n=!1,{enabled:r=!0}={}){let[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(new Set),s=(0,Q.useRef)(null),{state:l,lastResponse:u,open:d,handleSelect:f}=$P({hideThanksAfterMs:dF,onOpen:(0,Q.useCallback)(e=>{Y(`tengu_post_compact_survey_event`,{event_type:`appeared`,appearance_id:e,session_memory_compaction_enabled:tp()}),yv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`post_compact`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(`tengu_post_compact_survey_event`,{event_type:`responded`,appearance_id:e,response:t,session_memory_compaction_enabled:tp()}),yv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`post_compact`})},[])});(0,Q.useEffect)(()=>{r&&a(Tn(fF))},[r]);let p=(0,Q.useMemo)(()=>new Set(e.filter(e=>Cu(e)).map(e=>e.uuid)),[e]);return(0,Q.useEffect)(()=>{if(!r||l!==`closed`||t||n||i!==!0||er()||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY))return;if(s.current!==null&&mF(e,s.current)){s.current=null,Math.random()<pF&&d();return}let a=Array.from(p).filter(e=>!o.current.has(e));a.length>0&&(o.current=new Set(p),s.current=a[a.length-1])},[r,p,l,t,n,i,e,d]),{state:l,lastResponse:u,handleSelect:f}}en(),H();var gF=[`1`,`2`,`3`],_F={1:`yes`,2:`no`,3:`dont_ask_again`},vF=e=>gF.includes(e);function yF({onSelect:e,inputValue:t,setInputValue:n}){return ON({inputValue:t,setInputValue:n,isValidDigit:vF,onDigit:t=>e(_F[t])}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsxs)(R,{color:`ansi:cyan`,children:[Fn,` `]}),(0,$.jsx)(R,{bold:!0,children:`Can Anthropic look at your session transcript to help us improve Claude Code?`})]}),(0,$.jsx)(U,{marginLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/data-usage#session-quality-surveys`})}),(0,$.jsxs)(U,{marginLeft:2,children:[(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`: Yes`]})}),(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`2`}),`: No`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`3`}),`: Don't ask again`]})})]})]})}Cr(),H();function bF({state:e,lastResponse:t,handleSelect:n,handleTranscriptSelect:r,inputValue:i,setInputValue:a,onRequestFeedback:o,message:s}){return e===`closed`?null:e===`thanks`?(0,$.jsx)(SF,{lastResponse:t,inputValue:i,setInputValue:a,onRequestFeedback:o}):e===`submitted`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`success`,children:[`✓`,` Thanks for sharing your transcript!`]})}):e===`submitting`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Sharing transcript`,`…`]})}):e===`transcript_prompt`?!r||i&&![`1`,`2`,`3`].includes(i)?null:(0,$.jsx)(yF,{onSelect:r,inputValue:i,setInputValue:a}):i&&!jN(i)?null:(0,$.jsx)(NN,{onSelect:n,inputValue:i,setInputValue:a,message:s})}var xF=e=>e===`1`;function SF({lastResponse:e,inputValue:t,setInputValue:n,onRequestFeedback:r}){let i=r&&e===`good`;ON({inputValue:t,setInputValue:n,isValidDigit:xF,enabled:!!i,once:!0,onDigit:()=>{Y(`tengu_feedback_survey_event`,{event_type:`followup_accepted`,response:e}),r?.()}});let a=process.env.USER_TYPE===`ant`?`/issue`:`/feedback`;return(0,$.jsxs)(U,{marginTop:1,flexDirection:`column`,children:[(0,$.jsx)(R,{color:`success`,children:`Thanks for the feedback!`}),i?(0,$.jsxs)(R,{dimColor:!0,children:[`(Optional) Press [`,(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`] to tell us what went well `,` · `,a]}):e===`bad`?(0,$.jsx)(R,{dimColor:!0,children:`Use /issue to report model behavior issues.`}):(0,$.jsxs)(R,{dimColor:!0,children:[`Use `,a,` to share detailed feedback anytime.`]})]})}hh(),Sg(),ot(),Rm(),Zr();function CF(e){let{addNotification:t}=Bh(),n=(0,Q.useRef)(!1),r=(0,Q.useRef)(e);r.current=e,(0,Q.useEffect)(()=>{$e()||n.current||(n.current=!0,Promise.resolve().then(()=>r.current()).then(e=>{if(e)for(let n of Array.isArray(e)?e:[e])t(n)}).catch(Qr))},[t])}function wF(){CF(async()=>(await hf()).map((e,t)=>{let n=`low`;return e.type===`error`||e.userActionRequired?n=`high`:(e.type===`path`||e.type===`alias`)&&(n=`medium`),{key:`install-message-${t}-${e.type}`,text:e.message,priority:n,color:e.type===`error`?`error`:`warning`}}))}Er(),P_(),q(),ql(),$t(),Xd(),qx(),fg(),ot();var TF=30,EF=`The user stepped away and is coming back. Write exactly 1-3 short sentences. Start by stating the high-level task — what they are building or debugging, not implementation details. Next: the concrete next step. Skip status reports and commit recaps.`,DF=`用户离开后回来了。用中文写 1-3 句话。先说明用户在做什么(高层目标,不是实现细节),然后说明下一步具体操作。不要写状态报告或提交总结。`;function OF(e){return`${e?`Session memory (broader context):\n${e}\n\n`:``}${Kx()===`zh`?DF:EF}`}async function kF(e,t){if(e.length===0)return null;let n=qt(),r=Ym()?Vd({sessionId:Fe(),model:n,provider:Yt(),name:`away-summary`}):null;try{let i=await e_(),a=e.slice(-TF);a.push(ro({content:OF(i)}));let o=await Rh({messages:a,systemPrompt:dv([]),thinkingConfig:{type:`disabled`},tools:[],signal:t,options:{getToolPermissionContext:async()=>V_(),model:n,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,agents:[],querySource:`away_summary`,mcpTools:[],skipCacheWrite:!0,langfuseTrace:r}});return o.isApiErrorMessage?(J(`[awaySummary] API error: ${zp(o)}`),nm(r,void 0,`error`),null):(nm(r),zp(o))}catch(e){return e instanceof l||t.aborted?null:(J(`[awaySummary] generation failed: ${e}`),nm(r,void 0,`error`),null)}}H(),an(),ql();var AF=5*6e4;function jF(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`user`&&!n.isMeta&&!n.isCompactSummary)return!1;if(n.type===`system`&&n.subtype===`away_summary`)return!0}return!1}function MF(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(e),o=(0,Q.useRef)(n),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(null);a.current=e,o.current=n;let l=gn(`tengu_sedge_lantern`,!1);(0,Q.useEffect)(()=>{if(!l)return;function e(){r.current!==null&&(clearTimeout(r.current),r.current=null)}function n(){i.current?.abort(),i.current=null}async function u(){if(s.current=!1,jF(a.current))return;n();let e=new AbortController;i.current=e;let r=await kF(a.current,e.signal);e.signal.aborted||r===null||t(e=>[...e,np(r)])}function d(){if(r.current=null,o.current){s.current=!0;return}u()}function f(){let t=ue();t===`blurred`||t===`unknown`?(e(),r.current=setTimeout(d,AF)):t===`focused`&&(e(),n(),s.current=!1)}let p=P(f);return f(),c.current=u,()=>{p(),e(),n(),c.current=null}},[l,t]),(0,Q.useEffect)(()=>{if(n||!s.current)return;let e=ue();e!==`blurred`&&e!==`unknown`||c.current?.()},[n]),(0,Q.useEffect)(()=>{ue()===`unknown`&&l&&(n?(r.current!==null&&(clearTimeout(r.current),r.current=null),i.current?.abort(),i.current=null,s.current=!1):(r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{if(r.current=null,o.current){s.current=!0;return}c.current?.()},AF)))},[n,l])}H(),Wn(),Zb(),s();function NF(){if(process.argv.includes(`--chrome`))return!0;if(process.argv.includes(`--no-chrome`))return!1}function PF(){CF(async()=>{let e=NF();return Yb(e)?process.env.USER_TYPE!==`ant`&&!Dn()?{key:`chrome-requires-subscription`,jsx:(0,$.jsx)(R,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription`}),priority:`immediate`,timeoutMs:5e3}:!await Xb()&&!i()?{key:`chrome-extension-not-detected`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Chrome extension not detected · https://claude.ai/chrome to install`}),priority:`immediate`,timeoutMs:3e3}:e===void 0?{key:`claude-in-chrome-default-enabled`,text:`Claude in Chrome enabled · /chrome`,priority:`low`}:null:null})}an(),Cr(),lr(),q(),s(),gr(),Zr();function FF(){return c(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)}var IF={MAX_ATTEMPTS:10,INITIAL_DELAY_MS:3600*1e3,BACKOFF_MULTIPLIER:2,MAX_DELAY_MS:10080*60*1e3};function LF(e){let t=IF.INITIAL_DELAY_MS*IF.BACKOFF_MULTIPLIER**e;return Math.min(t,IF.MAX_DELAY_MS)}function RF(e){if(!e.officialMarketplaceAutoInstallAttempted)return!0;if(e.officialMarketplaceAutoInstalled)return!1;let t=e.officialMarketplaceAutoInstallFailReason,n=e.officialMarketplaceAutoInstallRetryCount||0,r=e.officialMarketplaceAutoInstallNextRetryTime,i=Date.now();return n>=IF.MAX_ATTEMPTS||t===`policy_blocked`||r&&i<r?!1:t===`unknown`||t===`git_unavailable`||t===`gcs_unavailable`||t===void 0}async function zF(){let e=En();if(!RF(e)){let t=e.officialMarketplaceAutoInstallFailReason??`already_attempted`;return J(`Official marketplace auto-install skipped: ${t}`),{installed:!1,skipped:!0,reason:t}}try{if(FF())return J(`Official marketplace auto-install disabled via env var, skipping`),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};if((await hs())[`claude-plugins-official`])return J(`Official marketplace '${Gi}' already installed, skipping`),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0})),{installed:!1,skipped:!0,reason:`already_installed`};if(!Pf(Ef))return J(`Official marketplace blocked by enterprise policy, skipping`),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};let t=Po(),n=MS(t,Gi);if(await Ah(n,t)!==null){let e=await hs();return e[Gi]={source:Ef,installLocation:n,lastUpdated:new Date().toISOString()},await Sf(e),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,via_gcs:!0}),{installed:!0,skipped:!1}}if(!gn(`tengu_plugin_official_mkt_git_fallback`,!0)){J(`Official marketplace GCS failed; git fallback disabled by flag — skipping install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+LF(t);return kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`gcs_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,gcs_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`gcs_unavailable`}}if(!await lh()){J(`Git not available, skipping official marketplace auto-install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+LF(t),i=!1;try{kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`git_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r}))}catch(e){i=!0,Qr(mr(e)),J(`Failed to save marketplace auto-install git_unavailable state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`git_unavailable`,configSaveFailed:i}}J(`Attempting to auto-install official marketplace`),await cu(Ef),J(`Successfully auto-installed official marketplace`);let r=e.officialMarketplaceAutoInstallRetryCount||0;return kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,retry_count:r}),{installed:!0,skipped:!1}}catch(t){let n=t instanceof Error?t.message:String(t);if(n.includes(`xcrun: error:`))return Bu(),J(`Official marketplace auto-install: git is a non-functional macOS xcrun shim, treating as git_unavailable`),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,macos_xcrun_shim:!0}),{installed:!1,skipped:!0,reason:`git_unavailable`};J(`Failed to auto-install official marketplace: ${n}`,{level:`error`}),Qr(mr(t));let r=(e.officialMarketplaceAutoInstallRetryCount||0)+1,i=Date.now(),a=i+LF(r),o=!1;try{kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`unknown`,officialMarketplaceAutoInstallRetryCount:r,officialMarketplaceAutoInstallLastAttemptTime:i,officialMarketplaceAutoInstallNextRetryTime:a}))}catch(e){o=!0,Qr(mr(e)),J(`Failed to save marketplace auto-install failure state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,failed:!0,retry_count:r}),{installed:!1,skipped:!0,reason:`unknown`,configSaveFailed:o}}}H(),q();function BF(){CF(async()=>{let e=await zF(),t=[];return e.configSaveFailed&&(J(`Showing marketplace config save failure notification`),t.push({key:`marketplace-config-save-failed`,jsx:(0,$.jsx)(R,{color:`error`,children:`Failed to save marketplace retry info · Check ~/.claude.json permissions`}),priority:`immediate`,timeoutMs:1e4})),e.installed?(J(`Showing marketplace installation success notification`),t.push({key:`marketplace-installed`,jsx:(0,$.jsx)(R,{color:`success`,children:`✓ Anthropic marketplace installed · /plugin to see available plugins`}),priority:`immediate`,timeoutMs:7e3})):e.skipped&&e.reason===`unknown`&&(J(`Showing marketplace installation failure notification`),t.push({key:`marketplace-install-failed`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Failed to install Anthropic marketplace · Will retry on next startup`}),priority:`immediate`,timeoutMs:8e3})),t})}Zr(),w(),Ii(),Ss();var VF=Fi(()=>b({method:v(`notifications/message`),params:b({prompt:_(),image:b({type:v(`base64`),media_type:y([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),data:_()}).optional(),tabId:g().optional()})}));function HF(e,t){let n=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{if(process.env.USER_TYPE!==`ant`)return;let t=UF(e);n.current!==t&&(n.current=t),t&&t.client.setNotificationHandler(VF(),e=>{if(n.current!==t)return;let{tabId:r,prompt:i,image:a}=e.params;if(!(typeof r!=`number`||!iy(r)))try{_a(a?{value:[{type:`text`,text:i},{type:`image`,source:{type:a.type,media_type:a.media_type,data:a.data}}],mode:`prompt`}:{value:i,mode:`prompt`})}catch(e){Qr(e)}})},[e]),(0,Q.useEffect)(()=>{let n=UF(e);n&&Ch(`set_permission_mode`,{mode:t===`bypassPermissions`?`skip_all_permission_checks`:`ask`},n)},[e,t])}function UF(e){return e.find(e=>e.type===`connected`&&e.name===`claude-in-chrome`)}Gn(),Cr();function WF(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.map(e=>({tip:e,sessions:vS(e.id)}));return t.sort((e,t)=>t.sessions-e.sessions),t[0]?.tip}async function GF(e){if(Un().spinnerTipsEnabled===!1)return;let t=await xS(e);if(t.length!==0)return WF(t)}function KF(e){hS(e.id),Y(`tengu_tip_shown`,{tipIdLength:e.id,cooldownSessions:e.cooldownSessions})}Nx(),Up();function qF(e,t,n){let r=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!Ll()||r.current||(r.current=!0,e&&tm(e,n))},[t,e,n])}H(),so(),Cr(),zm(),Bb();function JF({hostPattern:{host:e},onUserResponse:t}){function n(n){switch(process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:n}),n){case`yes`:t({allow:!0,persistToSettings:!1});break;case`yes-dont-ask-again`:t({allow:!0,persistToSettings:!0});break;case`no`:t({allow:!1,persistToSettings:!1});break}}let r=[{label:`Yes`,value:`yes`},...Qc()?[]:[{label:(0,$.jsxs)(R,{children:[`Yes, and don't ask again for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes-dont-ask-again`}],{label:(0,$.jsxs)(R,{children:[`No, and tell Claude what to do differently `,(0,$.jsx)(R,{bold:!0,children:`(esc)`})]}),value:`no`}];return(0,$.jsx)(Hb,{title:`Network request outside of sandbox`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Host:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Do you want to allow this connection?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(wd,{options:r,onChange:n,onCancel:()=>{process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:`cancel`}),t({allow:!1,persistToSettings:!1})}})})]})})}H(),so(),ei();function YF(e){return`${e.getHours()%12||12}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}${e.getHours()<12?`am`:`pm`}`}function XF(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(0);return(0,Q.useEffect)(()=>{let e=Bs.getSandboxViolationStore();return e.subscribe(n=>{t(n.slice(-10)),r(e.getTotalCount())})},[]),!Bs.isSandboxingEnabled()||$r()===`linux`||n===0?null:(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{marginLeft:0,children:(0,$.jsxs)(R,{color:`permission`,children:[`⧈ Sandbox blocked `,n,` total `,n===1?`operation`:`operations`]})}),e.map((e,t)=>(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[YF(e.timestamp),e.command?` ${e.command}:`:``,` `,e.line]})},`${e.timestamp.getTime()}-${t}`)),(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[`… showing last `,Math.min(10,e.length),` of `,n]})})]})}gx(),Rm(),ot(),H();var ZF=[];function QF({mcpClients:e=ZF}){let{addNotification:t}=Bh();(0,Q.useEffect)(()=>{if($e())return;let n=e.filter(e=>e.type===`failed`&&e.config.type!==`sse-ide`&&e.config.type!==`ws-ide`&&e.config.type!==`claudeai-proxy`),r=e.filter(e=>e.type===`failed`&&e.config.type===`claudeai-proxy`&&Xu(e.name)),i=e.filter(e=>e.type===`needs-auth`&&e.config.type!==`claudeai-proxy`),a=e.filter(e=>e.type===`needs-auth`&&e.config.type===`claudeai-proxy`&&Xu(e.name));n.length===0&&r.length===0&&i.length===0&&a.length===0||(n.length>0&&t({key:`mcp-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n.length,` MCP `,n.length===1?`server`:`servers`,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),r.length>0&&t({key:`mcp-claudeai-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[r.length,` claude.ai `,r.length===1?`connector`:`connectors`,` `,`unavailable`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),i.length>0&&t({key:`mcp-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[i.length,` MCP `,i.length===1?`server needs`:`servers need`,` `,`auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),a.length>0&&t({key:`mcp-claudeai-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[a.length,` claude.ai`,` `,a.length===1?`connector needs`:`connectors need`,` auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}))},[t,e])}H(),Gn(),ul();var $F=`Auto mode lets Claude handle permission prompts automatically — Claude checks each tool call for risky actions and prompt injection before executing. Actions Claude identifies as safe are executed, while actions Claude identifies as risky are blocked and Claude may try a different approach. Ideal for long-running tasks. Sessions are slightly more expensive. Claude can make mistakes that allow harmful commands to run, it's recommended to only use in isolated environments. Shift+Tab to change mode.`;O(),ot(),Rm(),H(),X(),q(),s();var eI=5e3;function tI(){let{addNotification:e}=Bh(),t=Af(),[n,r]=Q.useState(()=>c(`true`)),i=Q.useRef(new Set),a=Q.useCallback((n,r)=>{let a=`${n}:${r}`;if(i.current.has(a))return;i.current.add(a),J(`LSP error: ${n} - ${r}`),t(e=>{let t=new Set(e.plugins.errors.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),i=`generic-error:${n}:${r}`;return t.has(i)?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,{type:`generic-error`,source:n,error:r}]}}});let o=n.startsWith(`plugin:`)?n.split(`:`)[1]??n:n;e({key:`lsp-error-${n}`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[`LSP for `,o,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`,timeoutMs:8e3})},[e,t]),o=Q.useCallback(()=>{if($e()||Re())return;let e=al();if(e.status===`failed`){a(`lsp-manager`,e.error.message),r(!1);return}if(e.status===`pending`||e.status===`not-started`)return;let t=v_();if(t){let e=t.getAllServers();for(let[t,n]of e)n.state===`error`&&n.lastError&&a(t,n.lastError.message)}},[a]);se(o,n?eI:null),Q.useEffect(()=>{$e()||!n||o()},[o,n])}q();var nI=new Map;async function rI(e){if(!e||!e.trim())return J(`[binaryCheck] Empty command provided, returning false`),!1;let t=e.trim(),n=nI.get(t);if(n!==void 0)return J(`[binaryCheck] Cache hit for '${t}': ${n}`),n;let r=!1;return await Lr(t).catch(()=>null)&&(r=!0),nI.set(t,r),J(`[binaryCheck] Binary '${t}' ${r?`found`:`not found`}`),r}lr(),q(),yh();var iI=5;function aI(e){return kn.has(e.toLowerCase())}function oI(e){if(!e)return null;if(typeof e==`string`)return J(`[lspRecommendation] Skipping string path lspServers (not readable from marketplace)`),null;if(Array.isArray(e)){for(let t of e){if(typeof t==`string`)continue;let e=cI(t);if(e)return e}return null}return cI(e)}function sI(e){return typeof e==`object`&&!!e}function cI(e){let t=new Set,n=null;for(let[r,i]of Object.entries(e)){if(!sI(i))continue;!n&&typeof i.command==`string`&&(n=i.command);let e=i.extensionToLanguage;if(sI(e))for(let n of Object.keys(e))t.add(n.toLowerCase())}return!n||t.size===0?null:{extensions:t,command:n}}async function lI(){let e=new Map;try{let t=await hs();for(let n of Object.keys(t))try{let t=await Tu(n),r=aI(n);for(let i of t.plugins){if(!i.lspServers)continue;let t=oI(i.lspServers);if(!t)continue;let a=`${i.name}@${n}`;e.set(a,{entry:i,marketplaceName:n,extensions:t.extensions,command:t.command,isOfficial:r})}}catch(e){J(`[lspRecommendation] Failed to load marketplace ${n}: ${e}`)}}catch(e){J(`[lspRecommendation] Failed to load marketplaces config: ${e}`)}return e}async function uI(e){if(pI())return J(`[lspRecommendation] Recommendations are disabled`),[];let t=jS(e).toLowerCase();if(!t)return J(`[lspRecommendation] No file extension found`),[];J(`[lspRecommendation] Looking for LSP plugins for ${t}`);let n=await lI(),r=En().lspRecommendationNeverPlugins??[],i=[];for(let[e,a]of n)if(a.extensions.has(t)){if(r.includes(e)){J(`[lspRecommendation] Skipping ${e} (in never suggest list)`);continue}if(ts(e)){J(`[lspRecommendation] Skipping ${e} (already installed)`);continue}i.push({info:a,pluginId:e})}let a=[];for(let{info:e,pluginId:t}of i)await rI(e.command)?(a.push({info:e,pluginId:t}),J(`[lspRecommendation] Binary '${e.command}' found for ${t}`)):J(`[lspRecommendation] Skipping ${t} (binary '${e.command}' not found)`);return a.sort((e,t)=>e.info.isOfficial&&!t.info.isOfficial?-1:!e.info.isOfficial&&t.info.isOfficial?1:0),a.map(({info:e,pluginId:t})=>({pluginId:t,pluginName:e.entry.name,marketplaceName:e.marketplaceName,description:e.entry.description,isOfficial:e.isOfficial,extensions:Array.from(e.extensions),command:e.command}))}function dI(e){kt(t=>{let n=t.lspRecommendationNeverPlugins??[];return n.includes(e)?t:{...t,lspRecommendationNeverPlugins:[...n,e]}}),J(`[lspRecommendation] Added ${e} to never suggest`)}function fI(){kt(e=>{let t=(e.lspRecommendationIgnoredCount??0)+1;return{...e,lspRecommendationIgnoredCount:t}}),J(`[lspRecommendation] Incremented ignored count`)}function pI(){let e=En();return e.lspRecommendationDisabled===!0||(e.lspRecommendationIgnoredCount??0)>=iI}f(),ot(),H(),Zr(),yh();function mI(){let[e,t]=Q.useState(null),n=Q.useRef(!1),r=Q.useCallback(r=>{$e()||e||n.current||(n.current=!0,r().then(e=>{e&&t(e)}).catch(Qr).finally(()=>{n.current=!1}))},[e]);return{recommendation:e,clearRecommendation:Q.useCallback(()=>t(null),[]),tryResolve:r}}async function hI(e,t,n,r,i){try{let a=await ks(e);if(!a)throw Error(`Plugin ${e} not found in marketplace`);await i(a),r({key:`${n}-installed`,jsx:(0,$.jsxs)(R,{color:`success`,children:[p.tick,` `,t,` installed · restart to apply`]}),priority:`immediate`,timeoutMs:5e3})}catch(e){Qr(e),r({key:`${n}-install-failed`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to install `,t]}),priority:`immediate`,timeoutMs:5e3})}}ot(),Rm(),X(),lr(),q(),Zr(),Gn();var gI=28e3;function _I(){let e=Z(e=>e.fileHistory.trackedFiles),{addNotification:t}=Bh(),n=Q.useRef(new Set),{recommendation:r,clearRecommendation:i,tryResolve:a}=mI();return Q.useEffect(()=>{a(async()=>{if(it())return null;let t=[];for(let r of e)n.current.has(r)||(n.current.add(r),t.push(r));for(let e of t)try{let t=(await uI(e))[0];if(t)return J(`[useLspPluginRecommendation] Found match: ${t.pluginName} for ${e}`),st(!0),{pluginId:t.pluginId,pluginName:t.pluginName,pluginDescription:t.description,fileExtension:jS(e),shownAt:Date.now()}}catch(e){Qr(e)}return null})},[e,a]),{recommendation:r,handleResponse:Q.useCallback(e=>{if(!r)return;let{pluginId:n,pluginName:a,shownAt:o}=r;switch(J(`[useLspPluginRecommendation] User response: ${e} for ${a}`),e){case`yes`:hI(n,a,`lsp-plugin`,t,async e=>{J(`[useLspPluginRecommendation] Installing plugin: ${n}`);let t=typeof e.entry.source==`string`?MS(e.marketplaceInstallLocation,e.entry.source):void 0;await Cl(n,e.entry,`user`,void 0,t),Bn(`userSettings`,{enabledPlugins:{...nn(`userSettings`)?.enabledPlugins,[n]:!0}}),J(`[useLspPluginRecommendation] Plugin installed: ${n}`)});break;case`no`:{let e=Date.now()-o;e>=gI&&(J(`[useLspPluginRecommendation] Timeout detected (${e}ms), incrementing ignored count`),fI());break}case`never`:dI(n);break;case`disable`:kt(e=>e.lspRecommendationDisabled?e:{...e,lspRecommendationDisabled:!0});break}i()},[r,t,i])}}H(),zm(),Bb();var vI=3e4;function yI({pluginName:e,pluginDescription:t,fileExtension:n,onResponse:r}){let i=Q.useRef(r);i.current=r,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),vI,i);return()=>clearTimeout(e)},[]);function a(e){switch(e){case`yes`:r(`yes`);break;case`no`:r(`no`);break;case`never`:r(`never`);break;case`disable`:r(`disable`);break}}return(0,$.jsx)(Hb,{title:`LSP Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(R,{dimColor:!0,children:`LSP provides code intelligence like go-to-definition and error checking`})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Triggered by:`}),(0,$.jsxs)(R,{children:[` `,n,` files`]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install this LSP plugin?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(wd,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No, not now`,value:`no`},{label:(0,$.jsxs)(R,{children:[`Never for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`never`},{label:`Disable all LSP recommendations`,value:`disable`}],onChange:a,onCancel:()=>r(`no`)})})]})})}Rm(),Cr(),q(),qg();function bI(){let e=Q.useSyncExternalStore(Oc,Fp),{addNotification:t}=Bh(),{recommendation:n,clearRecommendation:r,tryResolve:i}=mI();return Q.useEffect(()=>{e&&i(async()=>{let t=await Ha(e);return t&&(J(`[useClaudeCodeHintRecommendation] surfacing ${t.pluginId} from ${t.sourceCommand}`),rc()),Fp()===e&&ca(),t})},[e,i]),{recommendation:n,handleResponse:Q.useCallback(e=>{if(n){switch(to(n.pluginId),Y(`tengu_plugin_hint_response`,{_PROTO_plugin_name:n.pluginName,_PROTO_marketplace_name:n.marketplaceName,response:e}),e){case`yes`:{let{pluginId:e,pluginName:r,marketplaceName:i}=n;hI(e,r,`hint-plugin`,t,async t=>{let n=await Ml({pluginId:e,entry:t.entry,marketplaceName:i,scope:`user`,trigger:`hint`});if(!n.success)throw Error(n.success?`Unknown error`:n.error)});break}case`disable`:Ug();break;case`no`:break}r()}},[n,t,r])}}H(),zm(),Bb();var xI=3e4;function SI({pluginName:e,pluginDescription:t,marketplaceName:n,sourceCommand:r,onResponse:i}){let a=Q.useRef(i);a.current=i,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),xI,a);return()=>clearTimeout(e)},[]);function o(e){switch(e){case`yes`:i(`yes`);break;case`disable`:i(`disable`);break;default:i(`no`)}}return(0,$.jsx)(Hb,{title:`Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`The `,(0,$.jsx)(R,{bold:!0,children:r}),` command suggests installing a plugin.`]})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Marketplace:`}),(0,$.jsxs)(R,{children:[` `,n]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install it?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(wd,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No`,value:`no`},{label:`No, and don't show plugin installation hints again`,value:`disable`}],onChange:o,onCancel:()=>i(`no`)})})]})})}zm(),Bb();var CI=3e4;function wI({tools:e,onSelect:t,onDismiss:n}){let r=Q.useRef(t),i=Q.useRef(n);r.current=t,i.current=n,Q.useEffect(()=>{let e=setTimeout(e=>e.current(),CI,i);return()=>clearTimeout(e)},[]);let a=e.map(e=>({label:`${e.name} — ${e.description.slice(0,60)} (score: ${e.score.toFixed(2)})`,value:e.name}));return a.push({label:`Dismiss`,value:`__dismiss__`}),(0,$.jsx)(Hb,{title:`Tool Recommendation`,children:(0,$.jsx)(wd,{options:a,onChange:e=>{e===`__dismiss__`?i.current():(i.current(),r.current(e))}})})}jo();var TI=.15,EI=3;function DI(){let e=Q.useSyncExternalStore(Ds,xu),t=Q.useMemo(()=>e.length===0?[]:e.slice(0,EI).map(e=>({name:e.name,description:e.description.slice(0,60),score:e.score})),[e]);return{tools:t,visible:t.length>0&&(t[0]?.score??0)>=TI,handleSelect:Q.useCallback(e=>{Gl()},[]),handleDismiss:Q.useCallback(()=>{Gl()},[])}}ot(),Rm(),H(),X(),q(),Vi();function OI(){let{addNotification:e}=Bh(),t=Z(e=>e.plugins.installationStatus),{totalFailed:n,failedMarketplacesCount:r,failedPluginsCount:i}=(0,Q.useMemo)(()=>{if(!t)return{totalFailed:0,failedMarketplacesCount:0,failedPluginsCount:0};let e=t.marketplaces.filter(e=>e.status===`failed`),n=t.plugins.filter(e=>e.status===`failed`);return{totalFailed:e.length+n.length,failedMarketplacesCount:e.length,failedPluginsCount:n.length}},[t]);(0,Q.useEffect)(()=>{if(!$e()){if(!t){J(`No installation status to monitor`);return}n!==0&&(J(`Plugin installation status: ${r} failed marketplaces, ${i} failed plugins`),n!==0&&(J(`Adding notification for ${n} failed installations`),e({key:`plugin-install-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n,` `,Bi(n,`plugin`),` failed to install`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`})))}},[e,n,r,i])}ot(),Rm(),H(),q(),Jx();function kI(){let{addNotification:e}=Bh(),[t,n]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{if(!$e())return Yx(e=>{J(`Plugin autoupdate notification: ${e.length} plugin(s) updated`),n(e)})},[]),(0,Q.useEffect)(()=>{if($e()||t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`@`);return t>0?e.substring(0,t):e}),r=n.length<=2?n.join(` and `):`${n.length} plugins`;e({key:`plugin-autoupdate-restart`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`success`,children:[n.length===1?`Plugin`:`Plugins`,` updated: `,r]}),(0,$.jsx)(R,{dimColor:!0,children:` · Run /reload-plugins to apply`})]}),priority:`low`,timeoutMs:1e4}),J(`Showing plugin autoupdate notification for: ${n.join(`, `)}`)},[t,e])}q(),Zr(),yh(),Sb(),Cr();function AI(e,t,n,r){e(e=>({...e,plugins:{...e.plugins,installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.map(e=>e.name===t?{...e,status:n,error:r}:e)}}}))}async function jI(e){J(`performBackgroundPluginInstallations called`);try{let t=tb(Yl(),await hs().catch(()=>({}))),n=[...t.missing,...t.sourceChanged.map(e=>e.name)];if(e(e=>({...e,plugins:{...e.plugins,installationStatus:{marketplaces:n.map(e=>({name:e,status:`pending`})),plugins:[]}}})),n.length===0)return;J(`Installing ${n.length} marketplace(s) in background`);let r=await Yy({onProgress:t=>{switch(t.type){case`installing`:AI(e,t.name,`installing`);break;case`installed`:AI(e,t.name,`installed`);break;case`failed`:AI(e,t.name,`failed`,t.error);break}}}),i={installed_count:r.installed.length,updated_count:r.updated.length,failed_count:r.failed.length,up_to_date_count:r.upToDate.length};if(Y(`tengu_marketplace_background_install`,i),Dr(`info`,`tengu_marketplace_background_install`,i),r.installed.length>0){Ko(),J(`Auto-refreshing plugins after ${r.installed.length} new marketplace(s) installed`);try{await xb(e)}catch(t){Qr(t),J(`Auto-refresh failed, falling back to needsRefresh: ${t}`,{level:`warn`}),xm(`performBackgroundPluginInstallations: auto-refresh failed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})}}else r.updated.length>0&&(Ko(),xm(`performBackgroundPluginInstallations: marketplaces reconciled`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}}))}catch(e){Qr(e)}}lr(),q(),yh(),jg();async function MI(e){if(J(`performStartupChecks called`),!W()){J(`Trust not accepted for current directory - skipping plugin installations`);return}try{J(`Starting background plugin installations`),await Jc()&&(Ko(),xm(`performStartupChecks: seed marketplaces changed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})),await jI(e)}catch(e){J(`Error initiating background plugin installations: ${e}`)}}H();var NI=/https?:\/\/\S+/;function PI(){let[e,t]=(0,Q.useState)(Wt.getInstance().getStatus());return(0,Q.useEffect)(()=>Wt.getInstance().subscribe(t),[]),!e.isAuthenticating&&!e.error&&e.output.length===0||!e.isAuthenticating&&!e.error?null:(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`permission`,paddingX:1,marginY:1,children:[(0,$.jsx)(R,{bold:!0,color:`permission`,children:`Cloud Authentication`}),e.output.length>0&&(0,$.jsx)(U,{flexDirection:`column`,marginTop:1,children:e.output.slice(-5).map((e,t)=>{let n=e.match(NI);if(!n)return(0,$.jsx)(R,{dimColor:!0,children:e},t);let r=n[0],i=n.index??0,a=e.slice(0,i),o=e.slice(i+r.length);return(0,$.jsxs)(R,{dimColor:!0,children:[a,(0,$.jsx)(re,{url:r,children:r}),o]},t)})}),e.error&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{color:`error`,children:e.error})})]})}Rm(),H(),Dp(),Uh(),Wn(),In(),ot();function FI(e){let{addNotification:t}=Bh(),n=Ud(),r=(0,Q.useMemo)(()=>Wm(n,e),[n,e]),i=(0,Q.useMemo)(()=>Xh(n),[n]),a=(0,Q.useRef)(null),o=Qn(),s=Mt(),c=o===`team`||o===`enterprise`,[l,u]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{$e()||(n.isUsingOverage&&!l&&(!c||s)?(t({key:`limit-reached`,text:i,priority:`immediate`}),u(!0)):!n.isUsingOverage&&l&&u(!1))},[n.isUsingOverage,i,l,t,s,c]),(0,Q.useEffect)(()=>{$e()||r&&r!==a.current&&(a.current=r,t({key:`rate-limit-warning`,jsx:(0,$.jsx)(R,{children:(0,$.jsx)(R,{color:`warning`,children:r})}),priority:`high`}))},[r,t])}Rm(),ot();function II(e){let{addNotification:t}=Bh(),n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if($e())return;let r=gS(e);r&&r!==n.current&&(n.current=r,t({key:`model-deprecation-warning`,text:r,color:`warning`,priority:`high`})),r||(n.current=null)},[e,t])}s();var LI=``;function RI(){CF(async()=>Fr()||c(process.env.DISABLE_INSTALLATION_CHECKS)||await To()===`development`?null:{timeoutMs:15e3,key:`npm-deprecation-warning`,text:LI,color:`warning`,priority:`high`})}Rm(),H(),lr(),ma(),ot();var zI=5;function BI({ideSelection:e,mcpClients:t,ideInstallationStatus:n}){let{addNotification:r,removeNotification:i}=Bh(),{status:a,ideName:o}=FD(t),s=(0,Q.useRef)(!1),c=n?cc(n?.ideType):!1,l=n?.error||c,u=a===`connected`&&(e?.filePath||e?.text&&e.lineCount>0),d=a===`connected`&&!u,f=l&&!c&&!d&&!u,p=l&&c&&!d&&!u;(0,Q.useEffect)(()=>{if($e())return;if(vo()||a!==null||p){i(`ide-status-hint`);return}if(s.current||(En().ideHintShownCount??0)>=zI)return;let e=setTimeout((e,t)=>{wl(!0).then(n=>{let r=n[0]?.name;r&&!e.current&&(e.current=!0,kt(e=>({...e,ideHintShownCount:(e.ideHintShownCount??0)+1})),t({key:`ide-status-hint`,jsx:(0,$.jsxs)(R,{dimColor:!0,children:[`/ide for `,(0,$.jsx)(R,{color:`ide`,children:r})]}),priority:`low`}))})},3e3,s,r);return()=>clearTimeout(e)},[r,i,a,p]),(0,Q.useEffect)(()=>{if(!$e()){if(f||p||a!==`disconnected`||!o){i(`ide-status-disconnected`);return}r({key:`ide-status-disconnected`,text:`${o} disconnected`,color:`error`,priority:`medium`})}},[r,i,a,o,f,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!p){i(`ide-status-jetbrains-disconnected`);return}r({key:`ide-status-jetbrains-disconnected`,text:`IDE plugin not connected · /status for info`,priority:`medium`})}},[r,i,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!f){i(`ide-status-install-error`);return}r({key:`ide-status-install-error`,text:`IDE extension install failed (see /status for info)`,color:`error`,priority:`medium`})}},[r,i,f])}lr();var VI=[e=>{if(UI(e.sonnet45To46MigrationTimestamp))return{key:`sonnet-46-update`,text:`Model updated to Sonnet 4.6`,color:`suggestion`,priority:`high`,timeoutMs:3e3}},e=>{let t=!!e.legacyOpusMigrationTimestamp;if(UI(e.legacyOpusMigrationTimestamp??e.opusProMigrationTimestamp))return{key:`opus-pro-update`,text:t?`Model updated to Opus 4.7 · Set CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP=1 to opt out`:`Model updated to Opus 4.7`,color:`suggestion`,priority:`high`,timeoutMs:t?8e3:3e3}}];function HI(){CF(()=>{let e=En(),t=[];for(let n of VI){let r=n(e);r&&t.push(r)}return t.length>0?t:null})}function UI(e){return e!==void 0&&Date.now()-e<3e3}Wn(),H(),Cr(),lr();var WI=3;function GI(){CF(async()=>{if((En().subscriptionNoticeCount??0)>=WI)return null;let e=await KI();return e===null?null:(kt(e=>({...e,subscriptionNoticeCount:(e.subscriptionNoticeCount??0)+1})),Y(`tengu_switch_to_subscription_notice_shown`,{}),{key:`switch-to-subscription`,jsx:(0,$.jsxs)(R,{color:`suggestion`,children:[`Use your existing Claude `,e,` plan with Claude Code`,(0,$.jsxs)(R,{color:`text`,dimColor:!0,children:[` `,`· /login to activate`]})]}),priority:`low`})})}async function KI(){if(Dn())return null;let e=await _n();return e?e.account.has_claude_max?`Max`:e.account.has_claude_pro?`Pro`:null:null}ot(),Rm(),X(),pc();function qI(e){if(!(`text`in e))return 1;let t=e.text.match(/^(\d+)/);return t?.[1]?parseInt(t[1],10):1}function JI(e,t){return YI(qI(e)+1)}function YI(e){return{key:`teammate-spawn`,text:e===1?`1 agent spawned`:`${e} agents spawned`,priority:`low`,timeoutMs:5e3,fold:JI}}function XI(e,t){return ZI(qI(e)+1)}function ZI(e){return{key:`teammate-shutdown`,text:e===1?`1 agent shut down`:`${e} agents shut down`,priority:`low`,timeoutMs:5e3,fold:XI}}function QI(){let e=Z(e=>e.tasks),{addNotification:t}=Bh(),n=(0,Q.useRef)(new Set),r=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(!$e())for(let[i,a]of Object.entries(e))Kp(a)&&(a.status===`running`&&!n.current.has(i)&&(n.current.add(i),t(YI(1))),a.status===`completed`&&!r.current.has(i)&&(r.current.add(i),t(ZI(1))))},[e,t])}Rm(),X(),tr(),ki(),ot();var $I=`fast-mode-cooldown-started`,eL=`fast-mode-cooldown-expired`,tL=`fast-mode-org-changed`,nL=`fast-mode-overage-rejected`;function rL(){let{addNotification:e}=Bh(),t=Z(e=>e.fastMode),n=Af();(0,Q.useEffect)(()=>{if(!$e()&&ar())return Ft(r=>{r?e({key:tL,color:`fastMode`,priority:`immediate`,text:`Fast mode is now available · /fast to turn on`}):t&&(n(e=>({...e,fastMode:!1})),e({key:tL,color:`warning`,priority:`immediate`,text:`Fast mode has been disabled by your organization`}))})},[e,t,n]),(0,Q.useEffect)(()=>{if(!$e()&&ar())return ln(t=>{n(e=>({...e,fastMode:!1})),e({key:nL,color:`warning`,priority:`immediate`,text:t})})},[e,n]),(0,Q.useEffect)(()=>{if($e()||!t)return;let n=rr((t,n)=>{let r=iL(n,Ni(t-Date.now(),{hideTrailingZeros:!0}));e({key:$I,invalidates:[eL],text:r,color:`warning`,priority:`immediate`})}),r=At(()=>{e({key:eL,invalidates:[$I],color:`fastMode`,text:`Fast limit reset · now using fast mode`,priority:`immediate`})});return()=>{n(),r()}},[e,t])}function iL(e,t){switch(e){case`overloaded`:return`Fast mode overloaded and is temporarily unavailable · resets in ${t}`;case`rate_limit`:return`Fast limit reached and temporarily disabled · resets in ${t}`}}H(),ty();function aL({onRun:e,onCancel:t,reason:n}){let r=(0,Q.useRef)(!1);return we(`confirm:no`,t,{context:`Confirmation`}),(0,Q.useEffect)(()=>{r.current||(r.current=!0,e())},[e]),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{children:(0,$.jsx)(R,{bold:!0,children:`Running feedback capture...`})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,(0,$.jsx)(he,{shortcut:`Esc`,action:`cancel`}),` anytime`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Reason: `,n]})})]})}function oL(e){if(process.env.USER_TYPE!==`ant`)return!1;switch(e){case`feedback_survey_bad`:return!1;case`feedback_survey_good`:return!1;default:return!1}}function sL(e){return process.env.USER_TYPE===`ant`&&e===`feedback_survey_good`?`/good-claude`:`/issue`}function cL(e){switch(e){case`feedback_survey_bad`:return`You responded "Bad" to the feedback survey`;case`feedback_survey_good`:return`You responded "Good" to the feedback survey`;default:return`Unknown reason`}}var lL=()=>null;en(),H();function uL(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(U,{flexDirection:`row`,marginTop:1,width:`100%`,children:[(0,$.jsx)(U,{minWidth:2,children:(0,$.jsx)(R,{color:`warning`,children:`⚑`})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:`[ANT-ONLY] `}),(0,$.jsx)(R,{color:`warning`,bold:!0,children:`Something off with Claude?`}),(0,$.jsx)(R,{dimColor:!0,children:` /issue to report it`})]})]}):null}G_(),ql();var dL=[/\bcurl\b/,/\bwget\b/,/\bssh\b/,/\bkubectl\b/,/\bsrun\b/,/\bdocker\b/,/\bbq\b/,/\bgsutil\b/,/\bgcloud\b/,/\baws\b/,/\bgit\s+push\b/,/\bgit\s+pull\b/,/\bgit\s+fetch\b/,/\bgh\s+(pr|issue)\b/,/\bnc\b/,/\bncat\b/,/\btelnet\b/,/\bftp\b/],fL=[/^no[,!]\s/i,/\bthat'?s (wrong|incorrect|not (what|right|correct))\b/i,/\bnot what I (asked|wanted|meant|said)\b/i,/\bI (said|asked|wanted|told you|already said)\b/i,/\bwhy did you\b/i,/\byou should(n'?t| not)? have\b/i,/\byou were supposed to\b/i,/\btry again\b/i,/\b(undo|revert) (that|this|it|what you)\b/i];function pL(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||!(`name`in t))continue;let e=t.name;if(e.startsWith(`mcp__`))return!1;if(e===`Bash`){let e=t.input?.command||``;if(dL.some(t=>t.test(e)))return!1}}}return!0}function mL(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type!==`user`)continue;let r=S_(n);if(r)return fL.some(e=>e.test(r))}return!1}var hL=3,gL=1800*1e3;function _L(e,t){let n=(0,Q.useRef)(0),r=(0,Q.useRef)(-1),i=(0,Q.useMemo)(()=>pL(e)&&mL(e),[e]);return process.env.USER_TYPE===`ant`?r.current===t?!0:Date.now()-n.current<gL||t<hL||!i?!1:(n.current=Date.now(),r.current=t,!0):!1}ot(),H();function vL(){return process.env.USER_TYPE===`ant`}function yL(){let[e,t]=(0,Q.useState)(Ie);return ke(()=>{t(Ie())},vL()?500:null),!vL()||e.length===0?null:(0,$.jsxs)(R,{wrap:`truncate-end`,color:`warning`,children:[`[ANT-ONLY] slow sync: `,e.slice(-3).map(e=>`${e.operation} (${Math.round(e.durationMs)}ms)`).join(` · `)]})}f(),H(),ny(),zm(),ky(),X(),ot(),ix(),ql(),Ss(),ku(),wr(),ri(),go(),Hh();var bL=24,xL=11;function SL(){return new Date().toISOString().split(`T`)[0]}function CL({plan:e,sessionId:t,taskId:n,setMessages:r,readFileState:i,memorySelector:a,getAppState:o,setConversationId:s,resultDedupState:c}){mg(`ultraplan-choice`);let l=Af(),{rows:u,columns:d}=k(),f=Q.useMemo(()=>Math.min(bL,Math.max(1,Math.floor(u/2)-xL)),[u]),m=Q.useMemo(()=>ge(e,Math.max(1,d-4),`wrap`).split(`
|
|
89
|
+
`))){let e=new Set(s.map(e=>e.id));o(t=>({...t,inbox:{messages:t.inbox.messages.filter(t=>!e.has(t.id))}}))}else J(`[InboxPoller] Submission rejected, keeping messages queued`)},[e,t,n,i,o,s,a]),se(()=>void l(),e&&PP(a.getState())?FP:null);let u=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{e&&(u.current||PP(a.getState())&&(u.current=!0,l()))},[e,l,a])}q(),Lv();var LP=1e3;function RP({taskListId:e,isLoading:t,onSubmitTask:n}){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(t);a.current=t;let o=(0,Q.useRef)(n);o.current=n;let s=e!==void 0,c=e??`tasklist`,l=(0,Q.useRef)(async()=>{});l.current=async()=>{if(!s||a.current)return;let t=await Nv(e);if(r.current!==null){let e=t.find(e=>e.id===r.current);if(!e||e.status===`completed`)J(`[TaskListWatcher] Task #${r.current} is marked complete, ready for next task`),r.current=null;else return}let n=zP(t);if(!n)return;J(`[TaskListWatcher] Found available task #${n.id}: ${n.subject}`);let i=await jv(e,n.id,c);if(!i.success){J(`[TaskListWatcher] Failed to claim task #${n.id}: ${i.reason}`);return}r.current=n.id;let l=BP(n);J(`[TaskListWatcher] Submitting task #${n.id} as prompt`),o.current(l)||(J(`[TaskListWatcher] Failed to submit task #${n.id}, releasing claim`),await Mv(e,n.id,{owner:void 0}),r.current=null)};let u=(0,Q.useRef)(()=>{});(0,Q.useEffect)(()=>{if(!s)return;Av(e);let t=Iv(e),n=null,r=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(e=>void e.current(),LP,l)};u.current=r;try{n=LS(t,r),n.unref(),J(`[TaskListWatcher] Watching for tasks in ${t}`)}catch(e){J(`[TaskListWatcher] Failed to watch ${t}: ${e}`)}return r(),()=>{u.current=()=>{},n&&n.close(),i.current&&clearTimeout(i.current)}},[s,e]),(0,Q.useEffect)(()=>{s&&(t||u.current())},[s,t])}function zP(e){let t=new Set(e.filter(e=>e.status!==`completed`).map(e=>e.id));return e.find(e=>e.status!==`pending`||e.owner?!1:e.blockedBy.every(e=>!t.has(e)))}function BP(e){let t=`Complete all open tasks. Start with task #${e.id}: \n\n ${e.subject}`;return e.description&&(t+=`\n\n${e.description}`),t}lr(),s(),ma();function VP({autoConnectIdeFlag:e,ideToInstallExtension:t,setDynamicMcpConfig:n,setShowIdeOnboarding:r,setIDEInstallationState:i}){(0,Q.useEffect)(()=>{function o(r){r&&(En().autoConnectIde||e||vo()||process.env.CLAUDE_CODE_SSE_PORT||t||c(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE))&&!a(process.env.CLAUDE_CODE_AUTO_CONNECT_IDE)&&n(e=>e?.ide?e:{...e,ide:{type:r.url.startsWith(`ws:`)?`ws-ide`:`sse-ide`,url:r.url,ideName:r.name,authToken:r.authToken,ideRunningInWindows:r.ideRunningInWindows,scope:`dynamic`}})}Hp(o,t,()=>r(!0),e=>i(e))},[e,t,n,r,i])}yx(),uy(),H(),ty(),za(),X(),lr(),zr(),s();function HP({onBackgroundSession:e,isLoading:t}){let n=Af(),r=ef(),[i,a]=(0,Q.useState)(!1),o=ne(a,e,()=>{}),s=(0,Q.useCallback)(()=>{c(process.env.CLAUDE_CODE_DISABLE_BACKGROUND_TASKS)||(io(r.getState())?(Pl(()=>r.getState(),n),En().hasUsedBackgroundTask||kt(e=>e.hasUsedBackgroundTask?e:{...e,hasUsedBackgroundTask:!0})):c(`false`)&&t&&o())},[n,r,t,o]),l=Z(io),u=c(`false`);we(`task:background`,s,{context:`Task`,isActive:l||u&&t});let d=fc(`task:background`,`Task`,`ctrl+b`),f=Vr.terminal===`tmux`&&d===`ctrl+b`?`ctrl+b ctrl+b`:d;return!t||!i?null:(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:(0,$.jsx)(he,{shortcut:f,action:`background`})})})}X();function UP({setMessages:e,setIsLoading:t,resetLoadingState:n,setAbortController:r,onBackgroundQuery:i}){let a=Z(e=>e.foregroundedTaskId),o=Z(e=>e.foregroundedTaskId?e.tasks[e.foregroundedTaskId]:void 0),s=Af(),c=(0,Q.useRef)(0),l=(0,Q.useCallback)(()=>{if(a){s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),e([]),n(),r(null);return}i()},[a,s,e,n,r,i]);return(0,Q.useEffect)(()=>{if(!a){c.current=0;return}if(!o||o.type!==`local_agent`){s(e=>({...e,foregroundedTaskId:void 0})),n(),c.current=0;return}let i=o.messages??[];if(i.length!==c.current&&(c.current=i.length,e([...i])),o.status===`running`){let e=o.abortController;if(e?.signal.aborted){s(e=>{if(!e.foregroundedTaskId)return e;let t=e.tasks[e.foregroundedTaskId];return t?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[e.foregroundedTaskId]:{...t,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0;return}t(!0),e&&r(e)}else s(e=>{let t=e.foregroundedTaskId;if(!t)return e;let n=e.tasks[t];return n?{...e,foregroundedTaskId:void 0,tasks:{...e.tasks,[t]:{...n,isBackgrounded:!0}}}:{...e,foregroundedTaskId:void 0}}),n(),r(null),c.current=0},[a,o,s,e,t,n,r]),{handleBackgroundSession:l}}lu(),H(),Wn(),lr(),$t(),Gn(),zm(),dx(),Bb();var WP=3e4;function GP({model:e,onDone:t}){let n=Wg(),r=(0,Q.useRef)(t);(0,Q.useEffect)(()=>{r.current=t});let i=(0,Q.useCallback)(()=>{r.current(`dismiss`)},[]);(0,Q.useEffect)(()=>{YP()},[]),(0,Q.useEffect)(()=>{let e=setTimeout(i,WP);return()=>clearTimeout(e)},[i]);let a=kg(e),o=a?yd(a):`high`,s=(0,Q.useCallback)(e=>{Bn(`userSettings`,{effortLevel:ic(e===o?void 0:e)}),r.current(e)},[o]),c=[{label:(0,$.jsx)(qP,{level:`medium`,text:`Medium (recommended)`}),value:`medium`},{label:(0,$.jsx)(qP,{level:`high`,text:`High`}),value:`high`},{label:(0,$.jsx)(qP,{level:`low`,text:`Low`}),value:`low`}];return(0,$.jsx)(Hb,{title:n.dialogTitle,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(R,{children:n.dialogDescription})}),(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[(0,$.jsx)(KP,{level:`low`}),` low `,`·`,` `,(0,$.jsx)(KP,{level:`medium`}),` medium `,`·`,` `,(0,$.jsx)(KP,{level:`high`}),` high`]})}),(0,$.jsx)(wd,{options:c,onChange:s,onCancel:i})]})})}function KP({level:e}){return(0,$.jsx)(R,{color:`suggestion`,children:ox(e)})}function qP({level:e,text:t}){return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(KP,{level:e}),` `,t]})}function JP(e){if(!Ot(e).toLowerCase().includes(`opus-4-6`))return!1;let t=En();return t.effortCalloutV2Dismissed?!1:t.numStartups<=1?(YP(),!1):dr()?t.effortCalloutDismissed?(YP(),!1):Wg().enabled:jn()||or()?Wg().enabled:(YP(),!1)}function YP(){kt(e=>e.effortCalloutV2Dismissed?e:{...e,effortCalloutV2Dismissed:!0})}Gy(),Ub(),an();function XP(e,t){let[n,r]=Q.useState(t);return Q.useEffect(()=>{Mn(e,t).then(r)},[e,t]),n}async function ZP(e,t,n){try{J(`Collecting transcript for sharing`,{level:`info`});let r=Gc(e),i=await qc(ff(e)),a;try{let e=da(),{size:t}=await VS(e);t<=52428800?a=await BS(e,`utf-8`):J(`Skipping raw transcript read: file too large (${t} bytes)`,{level:`warn`})}catch{}let o=Bx(hr({trigger:t,version:`2.8.2`,platform:process.platform,transcript:r,subagentTranscripts:Object.keys(i).length>0?i:void 0,rawTranscriptJsonl:a}));await tn();let s=xn();if(s.error)return{success:!1};let c={"Content-Type":`application/json`,"User-Agent":cn(),...s.headers},l=await m.post(`https://api.anthropic.com/api/claude_code_shared_session_transcripts`,{content:o,appearance_id:n},{headers:c,timeout:3e4});if(l.status===200||l.status===201){let e=l.data;return J(`Transcript shared successfully`,{level:`info`}),{success:!0,transcriptId:e?.transcript_id}}return{success:!1}}catch(e){return J(Sr(e),{level:`error`}),{success:!1}}}var QP=t((()=>{h(),Wn(),q(),gr(),ql(),go(),fr()}));wn(),QP();function $P({hideThanksAfterMs:e,onOpen:t,onSelect:n,shouldShowTranscriptPrompt:r,onTranscriptPromptShown:i,onTranscriptSelect:a}){let[o,s]=(0,Q.useState)(`closed`),[c,l]=(0,Q.useState)(null),u=(0,Q.useRef)(zS()),d=(0,Q.useRef)(null),f=(0,Q.useCallback)(()=>{s(`thanks`),setTimeout((e,t)=>{e(`closed`),t(null)},e,s,l)},[e]),p=(0,Q.useCallback)(()=>{s(`submitted`),setTimeout(s,e,`closed`)},[e]);return{state:o,lastResponse:c,open:(0,Q.useCallback)(()=>{o===`closed`&&(s(`open`),u.current=zS(),t(u.current))},[o,t]),handleSelect:(0,Q.useCallback)(e=>{if(l(e),d.current=e,n(u.current,e),e===`dismissed`)s(`closed`),l(null);else if(r?.(e))return s(`transcript_prompt`),i?.(u.current,e),!0;else f();return!1},[f,n,r,i]),handleTranscriptSelect:(0,Q.useCallback)(e=>{switch(e){case`yes`:s(`submitting`),(async()=>{try{await a?.(u.current,e,d.current)?p():f()}catch{f()}})();break;case`no`:case`dont_ask_again`:a?.(u.current,e,d.current),f();break}},[f,p,a])}}Cr(),lr(),s(),ql(),$t(),Gn();var eF={minTimeBeforeFeedbackMs:6e5,minTimeBetweenFeedbackMs:36e5,minTimeBetweenGlobalFeedbackMs:1e8,minUserTurnsBeforeFeedback:5,minUserTurnsBetweenFeedback:10,hideThanksAfterMs:3e3,onForModels:[`*`],probability:.005},tF={probability:0};function nF(e,t,n,r=`session`,i=!1){let a=(0,Q.useRef)(`unknown`);a.current=ac(e)?.message?.id||`unknown`;let[o,s]=(0,Q.useState)(()=>({timeLastShown:null,submitCountAtLastAppearance:null})),l=XP(`tengu_feedback_survey_config`,eF),u=XP(`tengu_bad_survey_transcript_ask_config`,tF),d=XP(`tengu_good_survey_transcript_ask_config`,tF),f=Ut().feedbackSurveyRate,p=(0,Q.useRef)(Date.now()),m=(0,Q.useRef)(n),h=(0,Q.useRef)(n);h.current=n;let g=(0,Q.useRef)(e);g.current=e;let _=(0,Q.useRef)(!1),v=(0,Q.useRef)(null),y=(0,Q.useCallback)((e,t)=>{s(n=>n.timeLastShown===e&&n.submitCountAtLastAppearance===t?n:{timeLastShown:e,submitCountAtLastAppearance:t}),En().feedbackSurveyState?.lastShownTime!==e&&kt(t=>({...t,feedbackSurveyState:{lastShownTime:e}}))},[]),b=(0,Q.useCallback)(e=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r}),yv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:r})},[y,r]),x=(0,Q.useCallback)((e,t)=>{y(Date.now(),h.current),Y(`tengu_feedback_survey_event`,{event_type:`responded`,appearance_id:e,response:t,last_assistant_message_id:a.current,survey_type:r}),yv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:r})},[y,r]),S=(0,Q.useCallback)(e=>{if(e!==`bad`&&e!==`good`||En().transcriptShareDismissed||!ws(`allow_product_feedback`))return!1;let t=e===`bad`?u.probability:d.probability;return Math.random()<=t},[u.probability,d.probability]),C=(0,Q.useCallback)((e,t)=>{let n=t===`good`?`good_feedback_survey`:`bad_feedback_survey`;Y(`tengu_feedback_survey_event`,{event_type:`transcript_prompt_appeared`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:n}),yv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:r})},[r]),w=(0,Q.useCallback)(async(e,t,n)=>{let i=n===`good`?`good_feedback_survey`:`bad_feedback_survey`;if(Y(`tengu_feedback_survey_event`,{event_type:`transcript_share_${t}`,appearance_id:e,last_assistant_message_id:a.current,survey_type:r,trigger:i}),t===`dont_ask_again`&&kt(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await ZP(g.current,i,e);return Y(`tengu_feedback_survey_event`,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:i}),t.success}return!1},[r]),{state:T,lastResponse:E,open:D,handleSelect:O,handleTranscriptSelect:k}=$P({hideThanksAfterMs:l.hideThanksAfterMs,onOpen:b,onSelect:x,shouldShowTranscriptPrompt:S,onTranscriptPromptShown:C,onTranscriptSelect:w}),A=Pt(),j=(0,Q.useMemo)(()=>l.onForModels.length===0?!1:l.onForModels.includes(`*`)?!0:l.onForModels.includes(A),[l.onForModels,A]),M=(0,Q.useMemo)(()=>{if(T!==`closed`||t||i)return!1;if(process.env.CLAUDE_FORCE_DISPLAY_SURVEY&&!o.timeLastShown)return!0;if(!j||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||er()||!ws(`allow_product_feedback`))return!1;if(o.timeLastShown){if(Date.now()-o.timeLastShown<l.minTimeBetweenFeedbackMs||o.submitCountAtLastAppearance!==null&&n<o.submitCountAtLastAppearance+l.minUserTurnsBetweenFeedback)return!1}else if(Date.now()-p.current<l.minTimeBeforeFeedbackMs||n<m.current+l.minUserTurnsBeforeFeedback)return!1;if(v.current!==n&&(v.current=n,_.current=Math.random()<=(f??l.probability)),!_.current)return!1;let e=En().feedbackSurveyState;return!(e?.lastShownTime&&Date.now()-e.lastShownTime<l.minTimeBetweenGlobalFeedbackMs)},[T,t,i,j,o.timeLastShown,o.submitCountAtLastAppearance,n,l.minTimeBetweenFeedbackMs,l.minTimeBetweenGlobalFeedbackMs,l.minUserTurnsBetweenFeedback,l.minTimeBeforeFeedbackMs,l.minUserTurnsBeforeFeedback,l.probability,f]);return(0,Q.useEffect)(()=>{M&&D()},[M,D]),{state:T,lastResponse:E,handleSelect:O,handleTranscriptSelect:k}}wn(),an(),Cr(),mu(),lr(),s(),ql(),Sv(),QP();var rF=3e3,iF=`tengu_dunwich_bell`,aF=`tengu_memory_survey_event`,oF=.2,sF=`memory_survey`,cF=/\bmemor(?:y|ies)\b/i;function lF(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||t.name!==`Read`)continue;let e=t.input;if(typeof e.file_path==`string`&&Eu(e.file_path))return!0}}return!1}function uF(e,t,n=!1,{enabled:r=!0}={}){let i=(0,Q.useRef)(new Set),a=(0,Q.useRef)(!1),o=(0,Q.useRef)(e);o.current=e;let{state:s,lastResponse:l,open:u,handleSelect:d,handleTranscriptSelect:f}=$P({hideThanksAfterMs:rF,onOpen:(0,Q.useCallback)(e=>{Y(aF,{event_type:`appeared`,appearance_id:e}),yv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`memory`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(aF,{event_type:`responded`,appearance_id:e,response:t}),yv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`memory`})},[]),shouldShowTranscriptPrompt:(0,Q.useCallback)(e=>!(process.env.USER_TYPE!==`ant`||e!==`bad`&&e!==`good`||En().transcriptShareDismissed||!ws(`allow_product_feedback`)),[]),onTranscriptPromptShown:(0,Q.useCallback)(e=>{Y(aF,{event_type:`transcript_prompt_appeared`,appearance_id:e,trigger:sF}),yv(`feedback_survey`,{event_type:`transcript_prompt_appeared`,appearance_id:e,survey_type:`memory`})},[]),onTranscriptSelect:(0,Q.useCallback)(async(e,t)=>{if(Y(aF,{event_type:`transcript_share_${t}`,appearance_id:e,trigger:sF}),t===`dont_ask_again`&&kt(e=>({...e,transcriptShareDismissed:!0})),t===`yes`){let t=await ZP(o.current,sF,e);return Y(aF,{event_type:t.success?`transcript_share_submitted`:`transcript_share_failed`,appearance_id:e,trigger:sF}),t.success}return!1},[])}),p=(0,Q.useMemo)(()=>ac(e),[e]);return(0,Q.useEffect)(()=>{if(!r)return;if(e.length===0){a.current=!1,i.current.clear();return}if(s!==`closed`||t||n||!gn(iF,!1)||!Xn()||er()||!ws(`allow_product_feedback`)||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY)||!p||i.current.has(p.uuid))return;let o=Zp(Array.isArray(p.message.content)?p.message.content:[],` `);cF.test(o)&&(i.current.add(p.uuid),a.current||(a.current=lF(e)),a.current&&Math.random()<oF&&u())},[r,s,t,n,p,e,u]),{state:s,lastResponse:l,handleSelect:d,handleTranscriptSelect:f}}wn(),an(),Cr(),s(),ql(),Sv();var dF=3e3,fF=`tengu_post_compact_survey`,pF=.2;function mF(e,t){let n=e.findIndex(e=>e.uuid===t);if(n===-1)return!1;for(let t=n+1;t<e.length;t++){let n=e[t];if(n&&(n.type===`user`||n.type===`assistant`))return!0}return!1}function hF(e,t,n=!1,{enabled:r=!0}={}){let[i,a]=(0,Q.useState)(null),o=(0,Q.useRef)(new Set),s=(0,Q.useRef)(null),{state:l,lastResponse:u,open:d,handleSelect:f}=$P({hideThanksAfterMs:dF,onOpen:(0,Q.useCallback)(e=>{Y(`tengu_post_compact_survey_event`,{event_type:`appeared`,appearance_id:e,session_memory_compaction_enabled:tp()}),yv(`feedback_survey`,{event_type:`appeared`,appearance_id:e,survey_type:`post_compact`})},[]),onSelect:(0,Q.useCallback)((e,t)=>{Y(`tengu_post_compact_survey_event`,{event_type:`responded`,appearance_id:e,response:t,session_memory_compaction_enabled:tp()}),yv(`feedback_survey`,{event_type:`responded`,appearance_id:e,response:t,survey_type:`post_compact`})},[])});(0,Q.useEffect)(()=>{r&&a(Tn(fF))},[r]);let p=(0,Q.useMemo)(()=>new Set(e.filter(e=>Cu(e)).map(e=>e.uuid)),[e]);return(0,Q.useEffect)(()=>{if(!r||l!==`closed`||t||n||i!==!0||er()||c(process.env.CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY))return;if(s.current!==null&&mF(e,s.current)){s.current=null,Math.random()<pF&&d();return}let a=Array.from(p).filter(e=>!o.current.has(e));a.length>0&&(o.current=new Set(p),s.current=a[a.length-1])},[r,p,l,t,n,i,e,d]),{state:l,lastResponse:u,handleSelect:f}}en(),H();var gF=[`1`,`2`,`3`],_F={1:`yes`,2:`no`,3:`dont_ask_again`},vF=e=>gF.includes(e);function yF({onSelect:e,inputValue:t,setInputValue:n}){return ON({inputValue:t,setInputValue:n,isValidDigit:vF,onDigit:t=>e(_F[t])}),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsxs)(R,{color:`ansi:cyan`,children:[Fn,` `]}),(0,$.jsx)(R,{bold:!0,children:`Can Anthropic look at your session transcript to help us improve Claude Code?`})]}),(0,$.jsx)(U,{marginLeft:2,children:(0,$.jsx)(R,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/data-usage#session-quality-surveys`})}),(0,$.jsxs)(U,{marginLeft:2,children:[(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`: Yes`]})}),(0,$.jsx)(U,{width:10,children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`2`}),`: No`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{color:`ansi:cyan`,children:`3`}),`: Don't ask again`]})})]})]})}Cr(),H();function bF({state:e,lastResponse:t,handleSelect:n,handleTranscriptSelect:r,inputValue:i,setInputValue:a,onRequestFeedback:o,message:s}){return e===`closed`?null:e===`thanks`?(0,$.jsx)(SF,{lastResponse:t,inputValue:i,setInputValue:a,onRequestFeedback:o}):e===`submitted`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{color:`success`,children:[`✓`,` Thanks for sharing your transcript!`]})}):e===`submitting`?(0,$.jsx)(U,{marginTop:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`Sharing transcript`,`…`]})}):e===`transcript_prompt`?!r||i&&![`1`,`2`,`3`].includes(i)?null:(0,$.jsx)(yF,{onSelect:r,inputValue:i,setInputValue:a}):i&&!jN(i)?null:(0,$.jsx)(NN,{onSelect:n,inputValue:i,setInputValue:a,message:s})}var xF=e=>e===`1`;function SF({lastResponse:e,inputValue:t,setInputValue:n,onRequestFeedback:r}){let i=r&&e===`good`;ON({inputValue:t,setInputValue:n,isValidDigit:xF,enabled:!!i,once:!0,onDigit:()=>{Y(`tengu_feedback_survey_event`,{event_type:`followup_accepted`,response:e}),r?.()}});let a=process.env.USER_TYPE===`ant`?`/issue`:`/feedback`;return(0,$.jsxs)(U,{marginTop:1,flexDirection:`column`,children:[(0,$.jsx)(R,{color:`success`,children:`Thanks for the feedback!`}),i?(0,$.jsxs)(R,{dimColor:!0,children:[`(Optional) Press [`,(0,$.jsx)(R,{color:`ansi:cyan`,children:`1`}),`] to tell us what went well `,` · `,a]}):e===`bad`?(0,$.jsx)(R,{dimColor:!0,children:`Use /issue to report model behavior issues.`}):(0,$.jsxs)(R,{dimColor:!0,children:[`Use `,a,` to share detailed feedback anytime.`]})]})}hh(),Sg(),ot(),Rm(),Zr();function CF(e){let{addNotification:t}=Bh(),n=(0,Q.useRef)(!1),r=(0,Q.useRef)(e);r.current=e,(0,Q.useEffect)(()=>{$e()||n.current||(n.current=!0,Promise.resolve().then(()=>r.current()).then(e=>{if(e)for(let n of Array.isArray(e)?e:[e])t(n)}).catch(Qr))},[t])}function wF(){CF(async()=>(await hf()).map((e,t)=>{let n=`low`;return e.type===`error`||e.userActionRequired?n=`high`:(e.type===`path`||e.type===`alias`)&&(n=`medium`),{key:`install-message-${t}-${e.type}`,text:e.message,priority:n,color:e.type===`error`?`error`:`warning`}}))}Er(),P_(),q(),ql(),$t(),Xd(),qx(),fg(),ot();var TF=30,EF=`The user stepped away and is coming back. Write exactly 1-3 short sentences. Start by stating the high-level task — what they are building or debugging, not implementation details. Next: the concrete next step. Skip status reports and commit recaps.`,DF=`用户离开后回来了。用中文写 1-3 句话。先说明用户在做什么(高层目标,不是实现细节),然后说明下一步具体操作。不要写状态报告或提交总结。`;function OF(e){return`${e?`Session memory (broader context):\n${e}\n\n`:``}${Kx()===`zh`?DF:EF}`}async function kF(e,t){if(e.length===0)return null;let n=qt(),r=Ym()?Vd({sessionId:Fe(),model:n,provider:Yt(),name:`away-summary`}):null;try{let i=await e_(),a=e.slice(-TF);a.push(ro({content:OF(i)}));let o=await Rh({messages:a,systemPrompt:dv([]),thinkingConfig:{type:`disabled`},tools:[],signal:t,options:{getToolPermissionContext:async()=>V_(),model:n,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,agents:[],querySource:`away_summary`,mcpTools:[],skipCacheWrite:!0,langfuseTrace:r}});return o.isApiErrorMessage?(J(`[awaySummary] API error: ${zp(o)}`),nm(r,void 0,`error`),null):(nm(r),zp(o))}catch(e){return e instanceof l||t.aborted?null:(J(`[awaySummary] generation failed: ${e}`),nm(r,void 0,`error`),null)}}H(),an(),ql();var AF=5*6e4;function jF(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type===`user`&&!n.isMeta&&!n.isCompactSummary)return!1;if(n.type===`system`&&n.subtype===`away_summary`)return!0}return!1}function MF(e,t,n){let r=(0,Q.useRef)(null),i=(0,Q.useRef)(null),a=(0,Q.useRef)(e),o=(0,Q.useRef)(n),s=(0,Q.useRef)(!1),c=(0,Q.useRef)(null);a.current=e,o.current=n;let l=gn(`tengu_sedge_lantern`,!1);(0,Q.useEffect)(()=>{if(!l)return;function e(){r.current!==null&&(clearTimeout(r.current),r.current=null)}function n(){i.current?.abort(),i.current=null}async function u(){if(s.current=!1,jF(a.current))return;n();let e=new AbortController;i.current=e;let r=await kF(a.current,e.signal);e.signal.aborted||r===null||t(e=>[...e,np(r)])}function d(){if(r.current=null,o.current){s.current=!0;return}u()}function f(){let t=ue();t===`blurred`||t===`unknown`?(e(),r.current=setTimeout(d,AF)):t===`focused`&&(e(),n(),s.current=!1)}let p=P(f);return f(),c.current=u,()=>{p(),e(),n(),c.current=null}},[l,t]),(0,Q.useEffect)(()=>{if(n||!s.current)return;let e=ue();e!==`blurred`&&e!==`unknown`||c.current?.()},[n]),(0,Q.useEffect)(()=>{ue()===`unknown`&&l&&(n?(r.current!==null&&(clearTimeout(r.current),r.current=null),i.current?.abort(),i.current=null,s.current=!1):(r.current!==null&&clearTimeout(r.current),r.current=setTimeout(()=>{if(r.current=null,o.current){s.current=!0;return}c.current?.()},AF)))},[n,l])}H(),Wn(),Zb(),s();function NF(){if(process.argv.includes(`--chrome`))return!0;if(process.argv.includes(`--no-chrome`))return!1}function PF(){CF(async()=>{let e=NF();return Yb(e)?process.env.USER_TYPE!==`ant`&&!Dn()?{key:`chrome-requires-subscription`,jsx:(0,$.jsx)(R,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription`}),priority:`immediate`,timeoutMs:5e3}:!await Xb()&&!i()?{key:`chrome-extension-not-detected`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Chrome extension not detected · https://claude.ai/chrome to install`}),priority:`immediate`,timeoutMs:3e3}:e===void 0?{key:`claude-in-chrome-default-enabled`,text:`Claude in Chrome enabled · /chrome`,priority:`low`}:null:null})}an(),Cr(),lr(),q(),s(),gr(),Zr();function FF(){return c(process.env.CLAUDE_CODE_DISABLE_OFFICIAL_MARKETPLACE_AUTOINSTALL)}var IF={MAX_ATTEMPTS:10,INITIAL_DELAY_MS:3600*1e3,BACKOFF_MULTIPLIER:2,MAX_DELAY_MS:10080*60*1e3};function LF(e){let t=IF.INITIAL_DELAY_MS*IF.BACKOFF_MULTIPLIER**e;return Math.min(t,IF.MAX_DELAY_MS)}function RF(e){if(!e.officialMarketplaceAutoInstallAttempted)return!0;if(e.officialMarketplaceAutoInstalled)return!1;let t=e.officialMarketplaceAutoInstallFailReason,n=e.officialMarketplaceAutoInstallRetryCount||0,r=e.officialMarketplaceAutoInstallNextRetryTime,i=Date.now();return n>=IF.MAX_ATTEMPTS||t===`policy_blocked`||r&&i<r?!1:t===`unknown`||t===`git_unavailable`||t===`gcs_unavailable`||t===void 0}async function zF(){let e=En();if(!RF(e)){let t=e.officialMarketplaceAutoInstallFailReason??`already_attempted`;return J(`Official marketplace auto-install skipped: ${t}`),{installed:!1,skipped:!0,reason:t}}try{if(FF())return J(`Official marketplace auto-install disabled via env var, skipping`),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};if((await hs())[`claude-plugins-official`])return J(`Official marketplace '${Gi}' already installed, skipping`),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0})),{installed:!1,skipped:!0,reason:`already_installed`};if(!Pf(Ef))return J(`Official marketplace blocked by enterprise policy, skipping`),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`policy_blocked`})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,policy_blocked:!0}),{installed:!1,skipped:!0,reason:`policy_blocked`};let t=Po(),n=MS(t,Gi);if(await Ah(n,t)!==null){let e=await hs();return e[Gi]={source:Ef,installLocation:n,lastUpdated:new Date().toISOString()},await Sf(e),kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,via_gcs:!0}),{installed:!0,skipped:!1}}if(!gn(`tengu_plugin_official_mkt_git_fallback`,!0)){J(`Official marketplace GCS failed; git fallback disabled by flag — skipping install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+LF(t);return kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`gcs_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r})),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,gcs_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`gcs_unavailable`}}if(!await lh()){J(`Git not available, skipping official marketplace auto-install`);let t=(e.officialMarketplaceAutoInstallRetryCount||0)+1,n=Date.now(),r=n+LF(t),i=!1;try{kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`git_unavailable`,officialMarketplaceAutoInstallRetryCount:t,officialMarketplaceAutoInstallLastAttemptTime:n,officialMarketplaceAutoInstallNextRetryTime:r}))}catch(e){i=!0,Qr(mr(e)),J(`Failed to save marketplace auto-install git_unavailable state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,retry_count:t}),{installed:!1,skipped:!0,reason:`git_unavailable`,configSaveFailed:i}}J(`Attempting to auto-install official marketplace`),await cu(Ef),J(`Successfully auto-installed official marketplace`);let r=e.officialMarketplaceAutoInstallRetryCount||0;return kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!0,officialMarketplaceAutoInstallFailReason:void 0,officialMarketplaceAutoInstallRetryCount:void 0,officialMarketplaceAutoInstallLastAttemptTime:void 0,officialMarketplaceAutoInstallNextRetryTime:void 0})),Y(`tengu_official_marketplace_auto_install`,{installed:!0,skipped:!1,retry_count:r}),{installed:!0,skipped:!1}}catch(t){let n=t instanceof Error?t.message:String(t);if(n.includes(`xcrun: error:`))return Bu(),J(`Official marketplace auto-install: git is a non-functional macOS xcrun shim, treating as git_unavailable`),Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,git_unavailable:!0,macos_xcrun_shim:!0}),{installed:!1,skipped:!0,reason:`git_unavailable`};J(`Failed to auto-install official marketplace: ${n}`,{level:`error`}),Qr(mr(t));let r=(e.officialMarketplaceAutoInstallRetryCount||0)+1,i=Date.now(),a=i+LF(r),o=!1;try{kt(e=>({...e,officialMarketplaceAutoInstallAttempted:!0,officialMarketplaceAutoInstalled:!1,officialMarketplaceAutoInstallFailReason:`unknown`,officialMarketplaceAutoInstallRetryCount:r,officialMarketplaceAutoInstallLastAttemptTime:i,officialMarketplaceAutoInstallNextRetryTime:a}))}catch(e){o=!0,Qr(mr(e)),J(`Failed to save marketplace auto-install failure state: ${e}`,{level:`error`})}return Y(`tengu_official_marketplace_auto_install`,{installed:!1,skipped:!0,failed:!0,retry_count:r}),{installed:!1,skipped:!0,reason:`unknown`,configSaveFailed:o}}}H(),q();function BF(){CF(async()=>{let e=await zF(),t=[];return e.configSaveFailed&&(J(`Showing marketplace config save failure notification`),t.push({key:`marketplace-config-save-failed`,jsx:(0,$.jsx)(R,{color:`error`,children:`Failed to save marketplace retry info · Check ~/.claude.json permissions`}),priority:`immediate`,timeoutMs:1e4})),e.installed?(J(`Showing marketplace installation success notification`),t.push({key:`marketplace-installed`,jsx:(0,$.jsx)(R,{color:`success`,children:`✓ Anthropic marketplace installed · /plugin to see available plugins`}),priority:`immediate`,timeoutMs:7e3})):e.skipped&&e.reason===`unknown`&&(J(`Showing marketplace installation failure notification`),t.push({key:`marketplace-install-failed`,jsx:(0,$.jsx)(R,{color:`warning`,children:`Failed to install Anthropic marketplace · Will retry on next startup`}),priority:`immediate`,timeoutMs:8e3})),t})}Zr(),w(),Ii(),Ss();var VF=Fi(()=>b({method:v(`notifications/message`),params:b({prompt:_(),image:b({type:v(`base64`),media_type:y([`image/jpeg`,`image/png`,`image/gif`,`image/webp`]),data:_()}).optional(),tabId:g().optional()})}));function HF(e,t){let n=(0,Q.useRef)(void 0);(0,Q.useEffect)(()=>{if(process.env.USER_TYPE!==`ant`)return;let t=UF(e);n.current!==t&&(n.current=t),t&&t.client.setNotificationHandler(VF(),e=>{if(n.current!==t)return;let{tabId:r,prompt:i,image:a}=e.params;if(!(typeof r!=`number`||!iy(r)))try{_a(a?{value:[{type:`text`,text:i},{type:`image`,source:{type:a.type,media_type:a.media_type,data:a.data}}],mode:`prompt`}:{value:i,mode:`prompt`})}catch(e){Qr(e)}})},[e]),(0,Q.useEffect)(()=>{let n=UF(e);n&&Ch(`set_permission_mode`,{mode:t===`bypassPermissions`?`skip_all_permission_checks`:`ask`},n)},[e,t])}function UF(e){return e.find(e=>e.type===`connected`&&e.name===`claude-in-chrome`)}Gn(),Cr();function WF(e){if(e.length===0)return;if(e.length===1)return e[0];let t=e.map(e=>({tip:e,sessions:vS(e.id)}));return t.sort((e,t)=>t.sessions-e.sessions),t[0]?.tip}async function GF(e){if(Un().spinnerTipsEnabled===!1)return;let t=await xS(e);if(t.length!==0)return WF(t)}function KF(e){hS(e.id),Y(`tengu_tip_shown`,{tipIdLength:e.id,cooldownSessions:e.cooldownSessions})}Nx(),Up();function qF(e,t,n){let r=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{!Ll()||r.current||(r.current=!0,e&&tm(e,n))},[t,e,n])}H(),so(),Cr(),zm(),Bb();function JF({hostPattern:{host:e},onUserResponse:t}){function n(n){switch(process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:n}),n){case`yes`:t({allow:!0,persistToSettings:!1});break;case`yes-dont-ask-again`:t({allow:!0,persistToSettings:!0});break;case`no`:t({allow:!1,persistToSettings:!1});break}}let r=[{label:`Yes`,value:`yes`},...Qc()?[]:[{label:(0,$.jsxs)(R,{children:[`Yes, and don't ask again for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes-dont-ask-again`}],{label:(0,$.jsxs)(R,{children:[`No, and tell Claude what to do differently `,(0,$.jsx)(R,{bold:!0,children:`(esc)`})]}),value:`no`}];return(0,$.jsx)(Hb,{title:`Network request outside of sandbox`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Host:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Do you want to allow this connection?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(wd,{options:r,onChange:n,onCancel:()=>{process.env.USER_TYPE===`ant`&&Y(`tengu_sandbox_network_dialog_result`,{host:e,result:`cancel`}),t({allow:!1,persistToSettings:!1})}})})]})})}H(),so(),ei();function YF(e){return`${e.getHours()%12||12}:${String(e.getMinutes()).padStart(2,`0`)}:${String(e.getSeconds()).padStart(2,`0`)}${e.getHours()<12?`am`:`pm`}`}function XF(){let[e,t]=(0,Q.useState)([]),[n,r]=(0,Q.useState)(0);return(0,Q.useEffect)(()=>{let e=Bs.getSandboxViolationStore();return e.subscribe(n=>{t(n.slice(-10)),r(e.getTotalCount())})},[]),!Bs.isSandboxingEnabled()||$r()===`linux`||n===0?null:(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{marginLeft:0,children:(0,$.jsxs)(R,{color:`permission`,children:[`⧈ Sandbox blocked `,n,` total `,n===1?`operation`:`operations`]})}),e.map((e,t)=>(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[YF(e.timestamp),e.command?` ${e.command}:`:``,` `,e.line]})},`${e.timestamp.getTime()}-${t}`)),(0,$.jsx)(U,{paddingLeft:2,children:(0,$.jsxs)(R,{dimColor:!0,children:[`… showing last `,Math.min(10,e.length),` of `,n]})})]})}gx(),Rm(),ot(),H();var ZF=[];function QF({mcpClients:e=ZF}){let{addNotification:t}=Bh();(0,Q.useEffect)(()=>{if($e())return;let n=e.filter(e=>e.type===`failed`&&e.config.type!==`sse-ide`&&e.config.type!==`ws-ide`&&e.config.type!==`claudeai-proxy`),r=e.filter(e=>e.type===`failed`&&e.config.type===`claudeai-proxy`&&Xu(e.name)),i=e.filter(e=>e.type===`needs-auth`&&e.config.type!==`claudeai-proxy`),a=e.filter(e=>e.type===`needs-auth`&&e.config.type===`claudeai-proxy`&&Xu(e.name));n.length===0&&r.length===0&&i.length===0&&a.length===0||(n.length>0&&t({key:`mcp-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n.length,` MCP `,n.length===1?`server`:`servers`,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),r.length>0&&t({key:`mcp-claudeai-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[r.length,` claude.ai `,r.length===1?`connector`:`connectors`,` `,`unavailable`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),i.length>0&&t({key:`mcp-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[i.length,` MCP `,i.length===1?`server needs`:`servers need`,` `,`auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}),a.length>0&&t({key:`mcp-claudeai-needs-auth`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`warning`,children:[a.length,` claude.ai`,` `,a.length===1?`connector needs`:`connectors need`,` auth`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /mcp`})]}),priority:`medium`}))},[t,e])}H(),Gn(),ul();var $F=`Auto mode lets Claude handle permission prompts automatically — Claude checks each tool call for risky actions and prompt injection before executing. Actions Claude identifies as safe are executed, while actions Claude identifies as risky are blocked and Claude may try a different approach. Ideal for long-running tasks. Sessions are slightly more expensive. Claude can make mistakes that allow harmful commands to run, it's recommended to only use in isolated environments. Shift+Tab to change mode.`;O(),ot(),Rm(),H(),X(),q(),s();var eI=5e3;function tI(){let{addNotification:e}=Bh(),t=Af(),[n,r]=Q.useState(()=>c(`true`)),i=Q.useRef(new Set),a=Q.useCallback((n,r)=>{let a=`${n}:${r}`;if(i.current.has(a))return;i.current.add(a),J(`LSP error: ${n} - ${r}`),t(e=>{let t=new Set(e.plugins.errors.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),i=`generic-error:${n}:${r}`;return t.has(i)?e:{...e,plugins:{...e.plugins,errors:[...e.plugins.errors,{type:`generic-error`,source:n,error:r}]}}});let o=n.startsWith(`plugin:`)?n.split(`:`)[1]??n:n;e({key:`lsp-error-${n}`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[`LSP for `,o,` failed`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`,timeoutMs:8e3})},[e,t]),o=Q.useCallback(()=>{if($e()||Re())return;let e=al();if(e.status===`failed`){a(`lsp-manager`,e.error.message),r(!1);return}if(e.status===`pending`||e.status===`not-started`)return;let t=v_();if(t){let e=t.getAllServers();for(let[t,n]of e)n.state===`error`&&n.lastError&&a(t,n.lastError.message)}},[a]);se(o,n?eI:null),Q.useEffect(()=>{$e()||!n||o()},[o,n])}q();var nI=new Map;async function rI(e){if(!e||!e.trim())return J(`[binaryCheck] Empty command provided, returning false`),!1;let t=e.trim(),n=nI.get(t);if(n!==void 0)return J(`[binaryCheck] Cache hit for '${t}': ${n}`),n;let r=!1;return await Lr(t).catch(()=>null)&&(r=!0),nI.set(t,r),J(`[binaryCheck] Binary '${t}' ${r?`found`:`not found`}`),r}lr(),q(),yh();var iI=5;function aI(e){return kn.has(e.toLowerCase())}function oI(e){if(!e)return null;if(typeof e==`string`)return J(`[lspRecommendation] Skipping string path lspServers (not readable from marketplace)`),null;if(Array.isArray(e)){for(let t of e){if(typeof t==`string`)continue;let e=cI(t);if(e)return e}return null}return cI(e)}function sI(e){return typeof e==`object`&&!!e}function cI(e){let t=new Set,n=null;for(let[r,i]of Object.entries(e)){if(!sI(i))continue;!n&&typeof i.command==`string`&&(n=i.command);let e=i.extensionToLanguage;if(sI(e))for(let n of Object.keys(e))t.add(n.toLowerCase())}return!n||t.size===0?null:{extensions:t,command:n}}async function lI(){let e=new Map;try{let t=await hs();for(let n of Object.keys(t))try{let t=await Tu(n),r=aI(n);for(let i of t.plugins){if(!i.lspServers)continue;let t=oI(i.lspServers);if(!t)continue;let a=`${i.name}@${n}`;e.set(a,{entry:i,marketplaceName:n,extensions:t.extensions,command:t.command,isOfficial:r})}}catch(e){J(`[lspRecommendation] Failed to load marketplace ${n}: ${e}`)}}catch(e){J(`[lspRecommendation] Failed to load marketplaces config: ${e}`)}return e}async function uI(e){if(pI())return J(`[lspRecommendation] Recommendations are disabled`),[];let t=jS(e).toLowerCase();if(!t)return J(`[lspRecommendation] No file extension found`),[];J(`[lspRecommendation] Looking for LSP plugins for ${t}`);let n=await lI(),r=En().lspRecommendationNeverPlugins??[],i=[];for(let[e,a]of n)if(a.extensions.has(t)){if(r.includes(e)){J(`[lspRecommendation] Skipping ${e} (in never suggest list)`);continue}if(ts(e)){J(`[lspRecommendation] Skipping ${e} (already installed)`);continue}i.push({info:a,pluginId:e})}let a=[];for(let{info:e,pluginId:t}of i)await rI(e.command)?(a.push({info:e,pluginId:t}),J(`[lspRecommendation] Binary '${e.command}' found for ${t}`)):J(`[lspRecommendation] Skipping ${t} (binary '${e.command}' not found)`);return a.sort((e,t)=>e.info.isOfficial&&!t.info.isOfficial?-1:!e.info.isOfficial&&t.info.isOfficial?1:0),a.map(({info:e,pluginId:t})=>({pluginId:t,pluginName:e.entry.name,marketplaceName:e.marketplaceName,description:e.entry.description,isOfficial:e.isOfficial,extensions:Array.from(e.extensions),command:e.command}))}function dI(e){kt(t=>{let n=t.lspRecommendationNeverPlugins??[];return n.includes(e)?t:{...t,lspRecommendationNeverPlugins:[...n,e]}}),J(`[lspRecommendation] Added ${e} to never suggest`)}function fI(){kt(e=>{let t=(e.lspRecommendationIgnoredCount??0)+1;return{...e,lspRecommendationIgnoredCount:t}}),J(`[lspRecommendation] Incremented ignored count`)}function pI(){let e=En();return e.lspRecommendationDisabled===!0||(e.lspRecommendationIgnoredCount??0)>=iI}f(),ot(),H(),Zr(),yh();function mI(){let[e,t]=Q.useState(null),n=Q.useRef(!1),r=Q.useCallback(r=>{$e()||e||n.current||(n.current=!0,r().then(e=>{e&&t(e)}).catch(Qr).finally(()=>{n.current=!1}))},[e]);return{recommendation:e,clearRecommendation:Q.useCallback(()=>t(null),[]),tryResolve:r}}async function hI(e,t,n,r,i){try{let a=await ks(e);if(!a)throw Error(`Plugin ${e} not found in marketplace`);await i(a),r({key:`${n}-installed`,jsx:(0,$.jsxs)(R,{color:`success`,children:[p.tick,` `,t,` installed · restart to apply`]}),priority:`immediate`,timeoutMs:5e3})}catch(e){Qr(e),r({key:`${n}-install-failed`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to install `,t]}),priority:`immediate`,timeoutMs:5e3})}}ot(),Rm(),X(),lr(),q(),Zr(),Gn();var gI=28e3;function _I(){let e=Z(e=>e.fileHistory.trackedFiles),{addNotification:t}=Bh(),n=Q.useRef(new Set),{recommendation:r,clearRecommendation:i,tryResolve:a}=mI();return Q.useEffect(()=>{a(async()=>{if(it())return null;let t=[];for(let r of e)n.current.has(r)||(n.current.add(r),t.push(r));for(let e of t)try{let t=(await uI(e))[0];if(t)return J(`[useLspPluginRecommendation] Found match: ${t.pluginName} for ${e}`),st(!0),{pluginId:t.pluginId,pluginName:t.pluginName,pluginDescription:t.description,fileExtension:jS(e),shownAt:Date.now()}}catch(e){Qr(e)}return null})},[e,a]),{recommendation:r,handleResponse:Q.useCallback(e=>{if(!r)return;let{pluginId:n,pluginName:a,shownAt:o}=r;switch(J(`[useLspPluginRecommendation] User response: ${e} for ${a}`),e){case`yes`:hI(n,a,`lsp-plugin`,t,async e=>{J(`[useLspPluginRecommendation] Installing plugin: ${n}`);let t=typeof e.entry.source==`string`?MS(e.marketplaceInstallLocation,e.entry.source):void 0;await Cl(n,e.entry,`user`,void 0,t),Bn(`userSettings`,{enabledPlugins:{...nn(`userSettings`)?.enabledPlugins,[n]:!0}}),J(`[useLspPluginRecommendation] Plugin installed: ${n}`)});break;case`no`:{let e=Date.now()-o;e>=gI&&(J(`[useLspPluginRecommendation] Timeout detected (${e}ms), incrementing ignored count`),fI());break}case`never`:dI(n);break;case`disable`:kt(e=>e.lspRecommendationDisabled?e:{...e,lspRecommendationDisabled:!0});break}i()},[r,t,i])}}H(),zm(),Bb();var vI=3e4;function yI({pluginName:e,pluginDescription:t,fileExtension:n,onResponse:r}){let i=Q.useRef(r);i.current=r,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),vI,i);return()=>clearTimeout(e)},[]);function a(e){switch(e){case`yes`:r(`yes`);break;case`no`:r(`no`);break;case`never`:r(`never`);break;case`disable`:r(`disable`);break}}return(0,$.jsx)(Hb,{title:`LSP Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsx)(R,{dimColor:!0,children:`LSP provides code intelligence like go-to-definition and error checking`})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Triggered by:`}),(0,$.jsxs)(R,{children:[` `,n,` files`]})]}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install this LSP plugin?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(wd,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No, not now`,value:`no`},{label:(0,$.jsxs)(R,{children:[`Never for `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`never`},{label:`Disable all LSP recommendations`,value:`disable`}],onChange:a,onCancel:()=>r(`no`)})})]})})}Rm(),Cr(),q(),qg();function bI(){let e=Q.useSyncExternalStore(Oc,Fp),{addNotification:t}=Bh(),{recommendation:n,clearRecommendation:r,tryResolve:i}=mI();return Q.useEffect(()=>{e&&i(async()=>{let t=await Ha(e);return t&&(J(`[useClaudeCodeHintRecommendation] surfacing ${t.pluginId} from ${t.sourceCommand}`),rc()),Fp()===e&&ca(),t})},[e,i]),{recommendation:n,handleResponse:Q.useCallback(e=>{if(n){switch(to(n.pluginId),Y(`tengu_plugin_hint_response`,{_PROTO_plugin_name:n.pluginName,_PROTO_marketplace_name:n.marketplaceName,response:e}),e){case`yes`:{let{pluginId:e,pluginName:r,marketplaceName:i}=n;hI(e,r,`hint-plugin`,t,async t=>{let n=await Ml({pluginId:e,entry:t.entry,marketplaceName:i,scope:`user`,trigger:`hint`});if(!n.success)throw Error(n.success?`Unknown error`:n.error)});break}case`disable`:Ug();break;case`no`:break}r()}},[n,t,r])}}H(),zm(),Bb();var xI=3e4;function SI({pluginName:e,pluginDescription:t,marketplaceName:n,sourceCommand:r,onResponse:i}){let a=Q.useRef(i);a.current=i,Q.useEffect(()=>{let e=setTimeout(e=>e.current(`no`),xI,a);return()=>clearTimeout(e)},[]);function o(e){switch(e){case`yes`:i(`yes`);break;case`disable`:i(`disable`);break;default:i(`no`)}}return(0,$.jsx)(Hb,{title:`Plugin Recommendation`,children:(0,$.jsxs)(U,{flexDirection:`column`,paddingX:2,paddingY:1,children:[(0,$.jsx)(U,{marginBottom:1,children:(0,$.jsxs)(R,{dimColor:!0,children:[`The `,(0,$.jsx)(R,{bold:!0,children:r}),` command suggests installing a plugin.`]})}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Plugin:`}),(0,$.jsxs)(R,{children:[` `,e]})]}),(0,$.jsxs)(U,{children:[(0,$.jsx)(R,{dimColor:!0,children:`Marketplace:`}),(0,$.jsxs)(R,{children:[` `,n]})]}),t&&(0,$.jsx)(U,{children:(0,$.jsx)(R,{dimColor:!0,children:t})}),(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{children:`Would you like to install it?`})}),(0,$.jsx)(U,{children:(0,$.jsx)(wd,{options:[{label:(0,$.jsxs)(R,{children:[`Yes, install `,(0,$.jsx)(R,{bold:!0,children:e})]}),value:`yes`},{label:`No`,value:`no`},{label:`No, and don't show plugin installation hints again`,value:`disable`}],onChange:o,onCancel:()=>i(`no`)})})]})})}zm(),Bb();var CI=3e4;function wI({tools:e,onSelect:t,onDismiss:n}){let r=Q.useRef(t),i=Q.useRef(n);r.current=t,i.current=n,Q.useEffect(()=>{let e=setTimeout(e=>e.current(),CI,i);return()=>clearTimeout(e)},[]);let a=e.map(e=>({label:`${e.name} — ${e.description.slice(0,60)} (score: ${e.score.toFixed(2)})`,value:e.name}));return a.push({label:`Dismiss`,value:`__dismiss__`}),(0,$.jsx)(Hb,{title:`Tool Recommendation`,children:(0,$.jsx)(wd,{options:a,onChange:e=>{e===`__dismiss__`?i.current():(i.current(),r.current(e))}})})}jo();var TI=.15,EI=3;function DI(){let e=Q.useSyncExternalStore(Ds,xu),t=Q.useMemo(()=>e.length===0?[]:e.slice(0,EI).map(e=>({name:e.name,description:e.description.slice(0,60),score:e.score})),[e]);return{tools:t,visible:t.length>0&&(t[0]?.score??0)>=TI,handleSelect:Q.useCallback(e=>{Gl()},[]),handleDismiss:Q.useCallback(()=>{Gl()},[])}}ot(),Rm(),H(),X(),q(),Vi();function OI(){let{addNotification:e}=Bh(),t=Z(e=>e.plugins.installationStatus),{totalFailed:n,failedMarketplacesCount:r,failedPluginsCount:i}=(0,Q.useMemo)(()=>{if(!t)return{totalFailed:0,failedMarketplacesCount:0,failedPluginsCount:0};let e=t.marketplaces.filter(e=>e.status===`failed`),n=t.plugins.filter(e=>e.status===`failed`);return{totalFailed:e.length+n.length,failedMarketplacesCount:e.length,failedPluginsCount:n.length}},[t]);(0,Q.useEffect)(()=>{if(!$e()){if(!t){J(`No installation status to monitor`);return}n!==0&&(J(`Plugin installation status: ${r} failed marketplaces, ${i} failed plugins`),n!==0&&(J(`Adding notification for ${n} failed installations`),e({key:`plugin-install-failed`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`error`,children:[n,` `,Bi(n,`plugin`),` failed to install`]}),(0,$.jsx)(R,{dimColor:!0,children:` · /plugin for details`})]}),priority:`medium`})))}},[e,n,r,i])}ot(),Rm(),H(),q(),Jx();function kI(){let{addNotification:e}=Bh(),[t,n]=(0,Q.useState)([]);(0,Q.useEffect)(()=>{if(!$e())return Yx(e=>{J(`Plugin autoupdate notification: ${e.length} plugin(s) updated`),n(e)})},[]),(0,Q.useEffect)(()=>{if($e()||t.length===0)return;let n=t.map(e=>{let t=e.indexOf(`@`);return t>0?e.substring(0,t):e}),r=n.length<=2?n.join(` and `):`${n.length} plugins`;e({key:`plugin-autoupdate-restart`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(R,{color:`success`,children:[n.length===1?`Plugin`:`Plugins`,` updated: `,r]}),(0,$.jsx)(R,{dimColor:!0,children:` · Run /reload-plugins to apply`})]}),priority:`low`,timeoutMs:1e4}),J(`Showing plugin autoupdate notification for: ${n.join(`, `)}`)},[t,e])}q(),Zr(),yh(),Sb(),Cr();function AI(e,t,n,r){e(e=>({...e,plugins:{...e.plugins,installationStatus:{...e.plugins.installationStatus,marketplaces:e.plugins.installationStatus.marketplaces.map(e=>e.name===t?{...e,status:n,error:r}:e)}}}))}async function jI(e){J(`performBackgroundPluginInstallations called`);try{let t=tb(Yl(),await hs().catch(()=>({}))),n=[...t.missing,...t.sourceChanged.map(e=>e.name)];if(e(e=>({...e,plugins:{...e.plugins,installationStatus:{marketplaces:n.map(e=>({name:e,status:`pending`})),plugins:[]}}})),n.length===0)return;J(`Installing ${n.length} marketplace(s) in background`);let r=await Yy({onProgress:t=>{switch(t.type){case`installing`:AI(e,t.name,`installing`);break;case`installed`:AI(e,t.name,`installed`);break;case`failed`:AI(e,t.name,`failed`,t.error);break}}}),i={installed_count:r.installed.length,updated_count:r.updated.length,failed_count:r.failed.length,up_to_date_count:r.upToDate.length};if(Y(`tengu_marketplace_background_install`,i),Dr(`info`,`tengu_marketplace_background_install`,i),r.installed.length>0){Ko(),J(`Auto-refreshing plugins after ${r.installed.length} new marketplace(s) installed`);try{await xb(e)}catch(t){Qr(t),J(`Auto-refresh failed, falling back to needsRefresh: ${t}`,{level:`warn`}),xm(`performBackgroundPluginInstallations: auto-refresh failed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})}}else r.updated.length>0&&(Ko(),xm(`performBackgroundPluginInstallations: marketplaces reconciled`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}}))}catch(e){Qr(e)}}lr(),q(),yh(),jg();async function MI(e){if(J(`performStartupChecks called`),!W()){J(`Trust not accepted for current directory - skipping plugin installations`);return}try{J(`Starting background plugin installations`),await Jc()&&(Ko(),xm(`performStartupChecks: seed marketplaces changed`),e(e=>e.plugins.needsRefresh?e:{...e,plugins:{...e.plugins,needsRefresh:!0}})),await jI(e)}catch(e){J(`Error initiating background plugin installations: ${e}`)}}H();var NI=/https?:\/\/\S+/;function PI(){let[e,t]=(0,Q.useState)(Wt.getInstance().getStatus());return(0,Q.useEffect)(()=>Wt.getInstance().subscribe(t),[]),!e.isAuthenticating&&!e.error&&e.output.length===0||!e.isAuthenticating&&!e.error?null:(0,$.jsxs)(U,{flexDirection:`column`,borderStyle:`round`,borderColor:`permission`,paddingX:1,marginY:1,children:[(0,$.jsx)(R,{bold:!0,color:`permission`,children:`Cloud Authentication`}),e.output.length>0&&(0,$.jsx)(U,{flexDirection:`column`,marginTop:1,children:e.output.slice(-5).map((e,t)=>{let n=e.match(NI);if(!n)return(0,$.jsx)(R,{dimColor:!0,children:e},t);let r=n[0],i=n.index??0,a=e.slice(0,i),o=e.slice(i+r.length);return(0,$.jsxs)(R,{dimColor:!0,children:[a,(0,$.jsx)(re,{url:r,children:r}),o]},t)})}),e.error&&(0,$.jsx)(U,{marginTop:1,children:(0,$.jsx)(R,{color:`error`,children:e.error})})]})}Rm(),H(),Dp(),Uh(),Wn(),In(),ot();function FI(e){let{addNotification:t}=Bh(),n=Ud(),r=(0,Q.useMemo)(()=>Wm(n,e),[n,e]),i=(0,Q.useMemo)(()=>Xh(n),[n]),a=(0,Q.useRef)(null),o=Qn(),s=Mt(),c=o===`team`||o===`enterprise`,[l,u]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{$e()||(n.isUsingOverage&&!l&&(!c||s)?(t({key:`limit-reached`,text:i,priority:`immediate`}),u(!0)):!n.isUsingOverage&&l&&u(!1))},[n.isUsingOverage,i,l,t,s,c]),(0,Q.useEffect)(()=>{$e()||r&&r!==a.current&&(a.current=r,t({key:`rate-limit-warning`,jsx:(0,$.jsx)(R,{children:(0,$.jsx)(R,{color:`warning`,children:r})}),priority:`high`}))},[r,t])}Rm(),ot();function II(e){let{addNotification:t}=Bh(),n=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{if($e())return;let r=gS(e);r&&r!==n.current&&(n.current=r,t({key:`model-deprecation-warning`,text:r,color:`warning`,priority:`high`})),r||(n.current=null)},[e,t])}s();var LI=``;function RI(){CF(async()=>Fr()||c(process.env.DISABLE_INSTALLATION_CHECKS)||await To()===`development`?null:{timeoutMs:15e3,key:`npm-deprecation-warning`,text:LI,color:`warning`,priority:`high`})}Rm(),H(),lr(),ma(),ot();var zI=5;function BI({ideSelection:e,mcpClients:t,ideInstallationStatus:n}){let{addNotification:r,removeNotification:i}=Bh(),{status:a,ideName:o}=FD(t),s=(0,Q.useRef)(!1),c=n?cc(n?.ideType):!1,l=n?.error||c,u=a===`connected`&&(e?.filePath||e?.text&&e.lineCount>0),d=a===`connected`&&!u,f=l&&!c&&!d&&!u,p=l&&c&&!d&&!u;(0,Q.useEffect)(()=>{if($e())return;if(vo()||a!==null||p){i(`ide-status-hint`);return}if(s.current||(En().ideHintShownCount??0)>=zI)return;let e=setTimeout((e,t)=>{wl(!0).then(n=>{let r=n[0]?.name;r&&!e.current&&(e.current=!0,kt(e=>({...e,ideHintShownCount:(e.ideHintShownCount??0)+1})),t({key:`ide-status-hint`,jsx:(0,$.jsxs)(R,{dimColor:!0,children:[`/ide for `,(0,$.jsx)(R,{color:`ide`,children:r})]}),priority:`low`}))})},3e3,s,r);return()=>clearTimeout(e)},[r,i,a,p]),(0,Q.useEffect)(()=>{if(!$e()){if(f||p||a!==`disconnected`||!o){i(`ide-status-disconnected`);return}r({key:`ide-status-disconnected`,text:`${o} disconnected`,color:`error`,priority:`medium`})}},[r,i,a,o,f,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!p){i(`ide-status-jetbrains-disconnected`);return}r({key:`ide-status-jetbrains-disconnected`,text:`IDE plugin not connected · /status for info`,priority:`medium`})}},[r,i,p]),(0,Q.useEffect)(()=>{if(!$e()){if(!f){i(`ide-status-install-error`);return}r({key:`ide-status-install-error`,text:`IDE extension install failed (see /status for info)`,color:`error`,priority:`medium`})}},[r,i,f])}lr();var VI=[e=>{if(UI(e.sonnet45To46MigrationTimestamp))return{key:`sonnet-46-update`,text:`Model updated to Sonnet 4.6`,color:`suggestion`,priority:`high`,timeoutMs:3e3}},e=>{let t=!!e.legacyOpusMigrationTimestamp;if(UI(e.legacyOpusMigrationTimestamp??e.opusProMigrationTimestamp))return{key:`opus-pro-update`,text:t?`Model updated to Opus 4.7 · Set CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP=1 to opt out`:`Model updated to Opus 4.7`,color:`suggestion`,priority:`high`,timeoutMs:t?8e3:3e3}}];function HI(){CF(()=>{let e=En(),t=[];for(let n of VI){let r=n(e);r&&t.push(r)}return t.length>0?t:null})}function UI(e){return e!==void 0&&Date.now()-e<3e3}Wn(),H(),Cr(),lr();var WI=3;function GI(){CF(async()=>{if((En().subscriptionNoticeCount??0)>=WI)return null;let e=await KI();return e===null?null:(kt(e=>({...e,subscriptionNoticeCount:(e.subscriptionNoticeCount??0)+1})),Y(`tengu_switch_to_subscription_notice_shown`,{}),{key:`switch-to-subscription`,jsx:(0,$.jsxs)(R,{color:`suggestion`,children:[`Use your existing Claude `,e,` plan with Claude Code`,(0,$.jsxs)(R,{color:`text`,dimColor:!0,children:[` `,`· /login to activate`]})]}),priority:`low`})})}async function KI(){if(Dn())return null;let e=await _n();return e?e.account.has_claude_max?`Max`:e.account.has_claude_pro?`Pro`:null:null}ot(),Rm(),X(),pc();function qI(e){if(!(`text`in e))return 1;let t=e.text.match(/^(\d+)/);return t?.[1]?parseInt(t[1],10):1}function JI(e,t){return YI(qI(e)+1)}function YI(e){return{key:`teammate-spawn`,text:e===1?`1 agent spawned`:`${e} agents spawned`,priority:`low`,timeoutMs:5e3,fold:JI}}function XI(e,t){return ZI(qI(e)+1)}function ZI(e){return{key:`teammate-shutdown`,text:e===1?`1 agent shut down`:`${e} agents shut down`,priority:`low`,timeoutMs:5e3,fold:XI}}function QI(){let e=Z(e=>e.tasks),{addNotification:t}=Bh(),n=(0,Q.useRef)(new Set),r=(0,Q.useRef)(new Set);(0,Q.useEffect)(()=>{if(!$e())for(let[i,a]of Object.entries(e))Kp(a)&&(a.status===`running`&&!n.current.has(i)&&(n.current.add(i),t(YI(1))),a.status===`completed`&&!r.current.has(i)&&(r.current.add(i),t(ZI(1))))},[e,t])}Rm(),X(),tr(),ki(),ot();var $I=`fast-mode-cooldown-started`,eL=`fast-mode-cooldown-expired`,tL=`fast-mode-org-changed`,nL=`fast-mode-overage-rejected`;function rL(){let{addNotification:e}=Bh(),t=Z(e=>e.fastMode),n=Af();(0,Q.useEffect)(()=>{if(!$e()&&ar())return Ft(r=>{r?e({key:tL,color:`fastMode`,priority:`immediate`,text:`Fast mode is now available · /fast to turn on`}):t&&(n(e=>({...e,fastMode:!1})),e({key:tL,color:`warning`,priority:`immediate`,text:`Fast mode has been disabled by your organization`}))})},[e,t,n]),(0,Q.useEffect)(()=>{if(!$e()&&ar())return ln(t=>{n(e=>({...e,fastMode:!1})),e({key:nL,color:`warning`,priority:`immediate`,text:t})})},[e,n]),(0,Q.useEffect)(()=>{if($e()||!t)return;let n=rr((t,n)=>{let r=iL(n,Ni(t-Date.now(),{hideTrailingZeros:!0}));e({key:$I,invalidates:[eL],text:r,color:`warning`,priority:`immediate`})}),r=At(()=>{e({key:eL,invalidates:[$I],color:`fastMode`,text:`Fast limit reset · now using fast mode`,priority:`immediate`})});return()=>{n(),r()}},[e,t])}function iL(e,t){switch(e){case`overloaded`:return`Fast mode overloaded and is temporarily unavailable · resets in ${t}`;case`rate_limit`:return`Fast limit reached and temporarily disabled · resets in ${t}`}}H(),ty();function aL({onRun:e,onCancel:t,reason:n}){let r=(0,Q.useRef)(!1);return we(`confirm:no`,t,{context:`Confirmation`}),(0,Q.useEffect)(()=>{r.current||(r.current=!0,e())},[e]),(0,$.jsxs)(U,{flexDirection:`column`,marginTop:1,children:[(0,$.jsx)(U,{children:(0,$.jsx)(R,{bold:!0,children:`Running feedback capture...`})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Press `,(0,$.jsx)(he,{shortcut:`Esc`,action:`cancel`}),` anytime`]})}),(0,$.jsx)(U,{children:(0,$.jsxs)(R,{dimColor:!0,children:[`Reason: `,n]})})]})}function oL(e){if(process.env.USER_TYPE!==`ant`)return!1;switch(e){case`feedback_survey_bad`:return!1;case`feedback_survey_good`:return!1;default:return!1}}function sL(e){return process.env.USER_TYPE===`ant`&&e===`feedback_survey_good`?`/good-claude`:`/issue`}function cL(e){switch(e){case`feedback_survey_bad`:return`You responded "Bad" to the feedback survey`;case`feedback_survey_good`:return`You responded "Good" to the feedback survey`;default:return`Unknown reason`}}var lL=()=>null;en(),H();function uL(){return process.env.USER_TYPE===`ant`?(0,$.jsxs)(U,{flexDirection:`row`,marginTop:1,width:`100%`,children:[(0,$.jsx)(U,{minWidth:2,children:(0,$.jsx)(R,{color:`warning`,children:`⚑`})}),(0,$.jsxs)(R,{children:[(0,$.jsx)(R,{dimColor:!0,children:`[ANT-ONLY] `}),(0,$.jsx)(R,{color:`warning`,bold:!0,children:`Something off with Claude?`}),(0,$.jsx)(R,{dimColor:!0,children:` /issue to report it`})]})]}):null}G_(),ql();var dL=[/\bcurl\b/,/\bwget\b/,/\bssh\b/,/\bkubectl\b/,/\bsrun\b/,/\bdocker\b/,/\bbq\b/,/\bgsutil\b/,/\bgcloud\b/,/\baws\b/,/\bgit\s+push\b/,/\bgit\s+pull\b/,/\bgit\s+fetch\b/,/\bgh\s+(pr|issue)\b/,/\bnc\b/,/\bncat\b/,/\btelnet\b/,/\bftp\b/],fL=[/^no[,!]\s/i,/\bthat'?s (wrong|incorrect|not (what|right|correct))\b/i,/\bnot what I (asked|wanted|meant|said)\b/i,/\bI (said|asked|wanted|told you|already said)\b/i,/\bwhy did you\b/i,/\byou should(n'?t| not)? have\b/i,/\byou were supposed to\b/i,/\btry again\b/i,/\b(undo|revert) (that|this|it|what you)\b/i];function pL(e){for(let t of e){if(t.type!==`assistant`)continue;let e=t.message.content;if(Array.isArray(e))for(let t of e){if(t.type!==`tool_use`||!(`name`in t))continue;let e=t.name;if(e.startsWith(`mcp__`))return!1;if(e===`Bash`){let e=t.input?.command||``;if(dL.some(t=>t.test(e)))return!1}}}return!0}function mL(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type!==`user`)continue;let r=S_(n);if(r)return fL.some(e=>e.test(r))}return!1}var hL=3,gL=1800*1e3;function _L(e,t){let n=(0,Q.useRef)(0),r=(0,Q.useRef)(-1),i=(0,Q.useMemo)(()=>pL(e)&&mL(e),[e]);return process.env.USER_TYPE===`ant`?r.current===t?!0:Date.now()-n.current<gL||t<hL||!i?!1:(n.current=Date.now(),r.current=t,!0):!1}ot(),H();function vL(){return process.env.USER_TYPE===`ant`}function yL(){let[e,t]=(0,Q.useState)(Ie);return ke(()=>{t(Ie())},vL()?500:null),!vL()||e.length===0?null:(0,$.jsxs)(R,{wrap:`truncate-end`,color:`warning`,children:[`[ANT-ONLY] slow sync: `,e.slice(-3).map(e=>`${e.operation} (${Math.round(e.durationMs)}ms)`).join(` · `)]})}f(),H(),ny(),zm(),ky(),X(),ot(),ix(),ql(),Ss(),ku(),wr(),ri(),go(),Hh();var bL=24,xL=11;function SL(){return new Date().toISOString().split(`T`)[0]}function CL({plan:e,sessionId:t,taskId:n,setMessages:r,readFileState:i,memorySelector:a,getAppState:o,setConversationId:s,resultDedupState:c}){mg(`ultraplan-choice`);let l=Af(),{rows:u,columns:d}=k(),f=Q.useMemo(()=>Math.min(bL,Math.max(1,Math.floor(u/2)-xL)),[u]),m=Q.useMemo(()=>ge(e,Math.max(1,d-4),`wrap`).split(`
|
|
90
90
|
`),[e,d]),h=Math.max(0,m.length-f),[g,_]=Q.useState(0);Q.useEffect(()=>{_(e=>Math.min(e,h))},[h]);let v=m.length>f;Oe((e,t)=>{if(!v)return;let n=Math.max(1,Math.floor(f/2));if(t.ctrl&&e===`d`||t.wheelDown){let e=t.wheelDown?3:n;_(t=>Math.min(t+e,h))}else if(t.ctrl&&e===`u`||t.wheelUp){let e=t.wheelUp?3:n;_(t=>Math.max(t-e,0))}});let y=m.slice(g,g+f).join(`
|
|
91
91
|
`),b=g>0,x=g<h,S=Q.useCallback(async a=>{switch(a){case`here`:_a({value:[`Ultraplan approved in browser. Here is the plan:`,``,`<ultraplan>`,e,`</ultraplan>`,``,`The user approved this plan in the remote session. Give them a brief summary, then start implementing.`].join(`
|
|
92
92
|
`),mode:`task-notification`});break;case`fresh`:let t=Fe(),n=await VS(da()).then(()=>!0,()=>!1);await ax({setMessages:r,readFileState:i,getAppState:o,setAppState:l,setConversationId:s}),n&&r(e=>[...e,Na(`Previous session saved · resume with: claude --resume ${t}`,`suggestion`)]),_a({value:`Here is the approved implementation plan:\n\n${e}\n\nImplement this plan.`,mode:`prompt`});break;case`cancel`:{let t=MS(Tr(),`${SL()}-ultraplan.md`);await HS(t,e,{encoding:`utf-8`}),r(e=>[...e,Na(`Ultraplan rejected · Plan saved to ${ai(t)}`,`suggestion`)]);break}}ed(n,l,e=>e.status===`running`?{...e,status:`completed`,endTime:Date.now()}:e),l(e=>e.ultraplanPendingChoice?{...e,ultraplanPendingChoice:void 0,ultraplanSessionUrl:void 0}:e),Vp(t)},[e,t,n,r,o,l,i,s]),C=Q.useMemo(()=>[{label:`Implement here`,value:`here`,description:`Inject plan into the current conversation`},{label:`Start new session`,value:`fresh`,description:`Clear conversation and start with only the plan`},{label:`Cancel`,value:`cancel`,description:`Don't implement — save plan and return`}],[]);return(0,$.jsx)(B,{title:`Ultraplan approved`,subtitle:`How should the plan be implemented?`,onCancel:()=>{},hideInputGuide:!0,children:(0,$.jsxs)(U,{flexDirection:`column`,marginBottom:1,children:[(0,$.jsxs)(U,{flexDirection:`column`,marginBottom:1,children:[(0,$.jsx)(R,{children:y}),v&&(0,$.jsxs)(R,{dimColor:!0,children:[b?p.arrowUp:` `,x?p.arrowDown:` `,` `,g+1,`–`,Math.min(g+f,m.length),` of `,m.length,` · ctrl+u/ctrl+d to scroll`]})]}),(0,$.jsx)(wd,{options:C,onChange:e=>void S(e)})]})})}H(),zm(),ky(),X(),lr(),im();function wL(){return!En().hasSeenUltraplanTerms}function TL(){return Qm()}function EL({onChoice:e}){let[t]=Q.useState(wL),[n]=Q.useState(TL),r=Q.useMemo(()=>Mf(n),[n]),i=Z(e=>e.replBridgeEnabled),a=Af(),o=Q.useCallback(r=>{let o=r===`run`&&i;o&&a(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),r!==`cancel`&&t&&kt(e=>e.hasSeenUltraplanTerms?e:{...e,hasSeenUltraplanTerms:!0}),e(r,{disconnectedBridge:o,promptIdentifier:n})},[e,i,a,t]),s=Q.useCallback(()=>{o(`cancel`)},[o]),c=[{label:`Run ultraplan`,value:`run`,description:i?`Disable remote control and launch in Claude Code on the web`:`launch in Claude Code on the web`},{label:`Not now`,value:`cancel`}];return(0,$.jsx)(B,{title:`Run ultraplan in the cloud?`,subtitle:r.timeEstimate,onCancel:s,children:(0,$.jsxs)(U,{flexDirection:`column`,gap:1,children:[(0,$.jsxs)(U,{flexDirection:`column`,children:[(0,$.jsx)(R,{dimColor:!0,children:r.dialogBody}),t?(0,$.jsxs)(R,{dimColor:!0,children:[`For more information on Claude Code on the web:`,(0,$.jsx)(re,{url:Wd,children:Wd})]}):null]}),(0,$.jsx)(R,{dimColor:!0,children:i?`This will disable Remote Control for this session.`:r.dialogPipeline}),(0,$.jsx)(wd,{options:c,onChange:o})]})})}xx(),H(),lr(),Zf();function DL(e,t,n){let r=(0,Q.useRef)(!1),i=(0,Q.useRef)(n);i.current=n,(0,Q.useEffect)(()=>{if(t)return e.subscribe(()=>{let t=e.getState(),n=e.hasSelection();if(t?.isDragging){r.current=!1;return}if(!n){r.current=!1;return}if(r.current||!(En().copyOnSelect??!0))return;let a=e.copySelectionNoClear();if(!a||!a.trim()){r.current=!0;return}r.current=!0,i.current?.(a)})},[t,e])}function OL(e){let[t]=ae();(0,Q.useEffect)(()=>{e.setSelectionBgColor(up(t).selectionBg)},[e,t])}Rm(),H(),ty(),q();var kL=40,AL=.3,jL=6,ML=200,NL=15,PL=15,FL=3,IL=1500,LL=150,RL=5,zL=5,BL=80,VL=3,HL=6,UL=500;function WL(e){return!(e.wheelUp||e.wheelDown||(e.leftArrow||e.rightArrow||e.upArrow||e.downArrow||e.home||e.end||e.pageUp||e.pageDown)&&(e.shift||e.meta||e.super))}function GL(e){return!e.shift||e.meta?null:e.leftArrow?`left`:e.rightArrow?`right`:e.upArrow?`up`:e.downArrow?`down`:e.home?`lineStart`:e.end?`lineEnd`:null}function KL(e,t,n){if(!e.xtermJs){if(e.wheelMode&&n-e.time>IL&&(e.wheelMode=!1,e.burstCount=0,e.mult=e.base),e.pendingFlip){if(e.pendingFlip=!1,t!==e.dir||n-e.time>ML)return e.dir=t,e.time=n,e.mult=e.base,Math.floor(e.mult);e.wheelMode=!0}let r=n-e.time;if(t!==e.dir&&e.dir!==0)return e.pendingFlip=!0,e.time=n,0;if(e.dir=t,e.time=n,e.wheelMode)if(r<zL)if(++e.burstCount>=5)e.wheelMode=!1,e.burstCount=0,e.mult=e.base;else return 1;else e.burstCount=0;if(e.wheelMode){let t=.5**(r/LL),n=Math.max(PL,e.base*2),i=1+(e.mult-1)*t+NL*t;return e.mult=Math.min(n,i,e.mult+FL),Math.floor(e.mult)}if(r>kL)e.mult=e.base;else{let t=Math.max(jL,e.base*2);e.mult=Math.min(t,e.mult+AL)}return Math.floor(e.mult)}let r=n-e.time,i=t===e.dir;if(e.time=n,e.dir=t,i&&r<zL)return 1;if(!i||r>UL)e.mult=2,e.frac=0;else{let t=.5**(r/LL);e.mult=Math.min(r>=BL?VL:HL,1+(e.mult-1)*t+RL*t)}let a=e.mult+e.frac,o=Math.floor(a);return e.frac=a-o,o}function qL(){let e=process.env.CLAUDE_CODE_SCROLL_SPEED;if(!e)return 1;let t=parseFloat(e);return Number.isNaN(t)||t<=0?1:Math.min(t,20)}function JL(e=!1,t=1){return{time:0,mult:t,dir:0,xtermJs:e,frac:0,base:t,pendingFlip:!1,wheelMode:!1,burstCount:0}}function YL(){let e=de(),t=qL();return J(`wheel accel: ${e?`decay (xterm.js)`:`window (native)`} · base=${t} · TERM_PROGRAM=${process.env.TERM_PROGRAM??`unset`}`),JL(e,t)}var XL=2,ZL=50,QL=200;function $L({scrollRef:e,isActive:t,onScroll:n,isModal:r=!1}){let i=ee(),{addNotification:a}=Bh(),o=(0,Q.useRef)(null);function s(e){let t=z(),n=e.length,r;switch(t){case`native`:r=`copied ${n} chars to clipboard`;break;case`tmux-buffer`:r=`copied ${n} chars to tmux buffer · paste with prefix + ]`;break;case`osc52`:r=`sent ${n} chars via OSC 52 · check terminal clipboard settings if paste fails`;break}a({key:`selection-copied`,text:r,color:`suggestion`,priority:`immediate`,timeoutMs:t===`native`?2e3:4e3})}function c(){let e=i.copySelection();e&&s(e)}function l(e,t){let n=i.getState();if(!n?.anchor||!n.focus)return;let r=e.getViewportTop(),a=r+e.getViewportHeight()-1;if(n.anchor.row<r||n.anchor.row>a||n.focus.row<r||n.focus.row>a)return;let o=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),s=e.getScrollTop()+e.getPendingDelta(),c=Math.max(0,Math.min(o,s+t))-s;if(c!==0)if(c>0)i.captureScrolledRows(r,r+c-1,`above`),i.shiftSelection(-c,r,a);else{let e=-c;i.captureScrolledRows(a-e+1,a,`below`),i.shiftSelection(e,r,a)}}return V({"scroll:pageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=nR(t,r);n?.(i,t)},"scroll:pageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=nR(t,r);n?.(i,t)},"scroll:lineUp":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=YL()),iR(t,KL(o.current,-1,performance.now())),n?.(!1,t)},"scroll:lineDown":()=>{i.clearSelection();let t=e.current;if(!t||t.getScrollHeight()<=t.getViewportHeight())return!1;o.current??(o.current=YL());let r=rR(t,KL(o.current,1,performance.now()));n?.(r,t)},"scroll:top":()=>{let t=e.current;t&&(l(t,-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(0),n?.(!1,t))},"scroll:bottom":()=>{let t=e.current;if(!t)return;let r=Math.max(0,t.getScrollHeight()-t.getViewportHeight());l(t,r-(t.getScrollTop()+t.getPendingDelta())),t.scrollTo(r),t.scrollToBottom(),n?.(!0,t)},"selection:copy":c},{context:`Scroll`,isActive:t}),V({"scroll:halfPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=nR(t,r);n?.(i,t)},"scroll:halfPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,Math.floor(t.getViewportHeight()/2));l(t,r);let i=nR(t,r);n?.(i,t)},"scroll:fullPageUp":()=>{let t=e.current;if(!t)return;let r=-Math.max(1,t.getViewportHeight());l(t,r);let i=nR(t,r);n?.(i,t)},"scroll:fullPageDown":()=>{let t=e.current;if(!t)return;let r=Math.max(1,t.getViewportHeight());l(t,r);let i=nR(t,r);n?.(i,t)}},{context:`Scroll`,isActive:t}),Oe((t,r,i)=>{let a=e.current;if(!a)return;let o=oR(a,aR(t,r),e=>l(a,e));o!==null&&(n?.(o,a),i.stopImmediatePropagation())},{isActive:t&&r}),Oe((e,t,n)=>{if(!i.hasSelection())return;if(t.escape){i.clearSelection(),n.stopImmediatePropagation();return}if(t.ctrl&&!t.shift&&!t.meta&&e===`c`){c(),n.stopImmediatePropagation();return}let r=GL(t);if(r){i.moveFocus(r),n.stopImmediatePropagation();return}WL(t)&&i.clearSelection()},{isActive:t}),eR(e,i,t,n),DL(i,t,s),OL(i),null}function eR(e,t,n,r){let i=(0,Q.useRef)(null),a=(0,Q.useRef)(0),o=(0,Q.useRef)(0),s=(0,Q.useRef)(0),c=(0,Q.useRef)(r);c.current=r,(0,Q.useEffect)(()=>{if(!n)return;function r(){a.current=0,i.current&&(clearInterval(i.current),i.current=null)}function l(){let n=t.getState(),i=e.current,o=a.current;if(!n?.isDragging||!n.focus||!i||o===0||++s.current>QL){r();return}if(i.getPendingDelta()!==0)return;let l=i.getViewportTop(),u=l+i.getViewportHeight()-1;if(o<0){if(i.getScrollTop()<=0){r();return}let e=Math.min(XL,i.getScrollTop());t.captureScrolledRows(u-e+1,u,`below`),t.shiftAnchor(e,0,u),i.scrollBy(-XL)}else{let e=Math.max(0,i.getScrollHeight()-i.getViewportHeight());if(i.getScrollTop()>=e){r();return}let n=Math.min(XL,e-i.getScrollTop());t.captureScrolledRows(l,l+n-1,`above`),t.shiftAnchor(-n,l,u),i.scrollBy(XL)}c.current?.(!1,i)}function u(e){o.current=e,a.current!==e&&(r(),a.current=e,s.current=0,l(),a.current===e&&(i.current=setInterval(l,ZL)))}function d(){let n=e.current;if(!n){r();return}let i=n.getViewportTop(),a=i+n.getViewportHeight()-1,s=t.getState();(!s?.isDragging||s.scrolledOffAbove.length===0&&s.scrolledOffBelow.length===0)&&(o.current=0);let c=tR(s,i,a,o.current);if(c===0){if(o.current!==0&&s?.focus){let e=s.focus.row<i?-1:+(s.focus.row>a);e!==0&&e!==o.current&&(s.scrolledOffAbove=[],s.scrolledOffBelow=[],s.scrolledOffAboveSW=[],s.scrolledOffBelowSW=[],o.current=0)}r()}else u(c)}let f=t.subscribe(d);return()=>{f(),r(),o.current=0}},[n,e,t])}function tR(e,t,n,r=0){if(!e?.isDragging||!e.anchor||!e.focus)return 0;let i=e.focus.row,a=i<t?-1:+(i>n);return r===0?e.anchor.row<t||e.anchor.row>n?0:a:a===r?a:0}function nR(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight()),r=e.getScrollTop()+e.getPendingDelta()+t;return r>=n?(e.scrollTo(n),e.scrollToBottom(),!0):(e.scrollTo(Math.max(0,r)),!1)}function rR(e,t){let n=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return e.getScrollTop()+e.getPendingDelta()+t>=n?(e.scrollToBottom(),!0):(e.scrollBy(t),!1)}function iR(e,t){if(e.getScrollTop()+e.getPendingDelta()-t<=0){e.scrollTo(0);return}e.scrollBy(-t)}function aR(e,t){if(t.meta)return null;if(!t.ctrl&&!t.shift){if(t.upArrow)return`lineUp`;if(t.downArrow)return`lineDown`;if(t.home)return`top`;if(t.end)return`bottom`}if(t.ctrl){if(t.shift)return null;switch(e){case`u`:return`halfPageUp`;case`d`:return`halfPageDown`;case`b`:return`fullPageUp`;case`f`:return`fullPageDown`;case`n`:return`lineDown`;case`p`:return`lineUp`;default:return null}}let n=e[0];if(!n||e!==n.repeat(e.length))return null;if(n===`G`||n===`g`&&t.shift)return`bottom`;if(t.shift)return null;switch(n){case`g`:return`top`;case`j`:return`lineDown`;case`k`:return`lineUp`;case` `:return`fullPageDown`;case`b`:return`fullPageUp`;default:return null}}function oR(e,t,n){switch(t){case null:return null;case`lineUp`:case`lineDown`:{let r=t===`lineDown`?1:-1;return n(r),nR(e,r)}case`halfPageUp`:case`halfPageDown`:{let r=Math.max(1,Math.floor(e.getViewportHeight()/2)),i=t===`halfPageDown`?r:-r;return n(i),nR(e,i)}case`fullPageUp`:case`fullPageDown`:{let r=Math.max(1,e.getViewportHeight()),i=t===`fullPageDown`?r:-r;return n(i),nR(e,i)}case`top`:return n(-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(0),!1;case`bottom`:{let t=Math.max(0,e.getScrollHeight()-e.getViewportHeight());return n(t-(e.getScrollTop()+e.getPendingDelta())),e.scrollTo(t),e.scrollToBottom(),!0}}}var sR=r({VoiceKeybindingHandler:()=>dR,useVoiceIntegration:()=>lR,useVoiceKeybindingHandler:()=>uR});function cR(e,t){return!((e.key===`space`?` `:e.key===`return`?`enter`:e.key.toLowerCase())!==t.key||e.ctrl!==t.ctrl||e.shift!==t.shift||e.meta!==(t.alt||t.meta)||e.superKey!==t.super)}function lR({setInputValueRaw:e,inputValueRef:t,insertTextRef:n}){let{addNotification:r}=Bh(),i=(0,fR.useRef)(null),a=(0,fR.useRef)(``),o=(0,fR.useRef)(null),s=(0,fR.useCallback)((r,{char:s=` `,anchor:c=!1,floor:l=0}={})=>{let u=t.current,d=n.current?.cursorOffset??u.length,f=u.slice(0,d),p=u.slice(d),m=s===` `?Ri(f):f,h=0;for(;h<m.length&&m[m.length-1-h]===s;)h++;let g=Math.max(0,Math.min(h-l,r)),_=h-g,v=f.slice(0,f.length-g),y=``;c&&(i.current=v,a.current=p,p.length>0&&!/^\s/.test(p)&&(y=` `));let b=v+y+p;return c&&(o.current=b),b===u&&g===0||(n.current?n.current.setInputWithCursor(b,v.length):e(b)),_},[e,t,n]),c=(0,fR.useCallback)(()=>{let t=i.current;if(t===null)return;let r=a.current;i.current=null,a.current=``;let o=t+r;n.current?n.current.setInputWithCursor(o,t.length):e(o)},[e,n]),l=ID(),u=Tl(e=>e.voiceState),d=Tl(e=>e.voiceInterimTranscript);(0,fR.useEffect)(()=>{if(u===`recording`&&i.current===null){let e=t.current,r=n.current?.cursorOffset??e.length;i.current=e.slice(0,r),a.current=e.slice(r),o.current=e}u===`idle`&&(i.current=null,a.current=``,o.current=null)},[u,t,n]),(0,fR.useEffect)(()=>{if(i.current===null)return;let r=i.current,s=a.current;if(t.current!==o.current)return;let c=r.length>0&&!/\s$/.test(r)&&d.length>0,l=s.length>0&&!/^\s/.test(s),u=c?` `:``,f=l?` `:``,p=r+u+d+f+s,m=r.length+u.length+d.length;n.current?n.current.setInputWithCursor(p,m):e(p),o.current=p},[d,e,t,n]);let f=(0,fR.useCallback)(r=>{let s=i.current;if(s===null)return;let c=a.current;if(t.current!==o.current)return;let l=s.length>0&&!/\s$/.test(s)&&r.length>0,u=c.length>0&&!/^\s/.test(c)&&r.length>0,d=l?` `:``,f=u?` `:``,p=s+d+r+f+c,m=s.length+d.length+r.length;n.current?n.current.setInputWithCursor(p,m):e(p),o.current=p,i.current=s+d+r},[e,t,n]),p=pR.useVoice({onTranscript:f,onError:e=>{r({key:`voice-error`,text:e,color:`error`,priority:`immediate`,timeoutMs:1e4})},enabled:l,focusMode:!1}),m=(0,fR.useMemo)(()=>{if(i.current===null||d.length===0)return null;let e=i.current,t=e.length>0&&!/\s$/.test(e)&&d.length>0,n=e.length+ +!!t;return{start:n,end:n+d.length}},[d]);return{stripTrailing:s,resetAnchor:c,handleKeyEvent:p.handleKeyEvent,interimRange:m}}function uR({voiceHandleKeyEvent:e,stripTrailing:t,resetAnchor:n,isActive:r}){let i=Ta(),a=Fg(),o=pe(),s=Hd(),c=ID(),l=Tl(e=>e.voiceState),u=(0,fR.useMemo)(()=>{if(!o)return vR;let e=null;for(let t of o.bindings){if(t.context!==`Chat`||t.chord.length!==1)continue;let n=t.chord[0];n&&(t.action===`voice:pushToTalk`?e=n:e!==null&&me(n,e)&&(e=null))}return e},[o]),d=u!==null&&u.key.length===1&&!u.ctrl&&!u.alt&&!u.shift&&!u.meta&&!u.super?u.key:null,f=(0,fR.useRef)(0),p=(0,fR.useRef)(0),m=(0,fR.useRef)(0),h=(0,fR.useRef)(!1),g=(0,fR.useRef)(null);(0,fR.useEffect)(()=>{l!==`recording`&&(h.current=!1,f.current=0,p.current=0,m.current=0,a(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e))},[l,a]);let _=o=>{if(!c||!r||s||u===null)return;let l;if(d!==null){if(o.ctrl||o.meta||o.shift)return;let e=d===` `?Ri(o.key):o.key;if(e[0]!==d||e.length>1&&e!==d.repeat(e.length))return;l=e.length}else{if(!cR(o,u))return;l=1}let _=i().voiceState;if(h.current&&_!==`idle`){o.stopImmediatePropagation(),d!==null&&t(l,{char:d,floor:m.current}),e();return}if(_!==`idle`){d===null&&o.stopImmediatePropagation();return}let v=f.current;if(f.current+=l,d===null||f.current>=gR){o.stopImmediatePropagation(),g.current&&(clearTimeout(g.current),g.current=null),f.current=0,h.current=!0,a(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e),d===null?(t(0,{anchor:!0}),e(hR)):(m.current=t(p.current+l,{char:d,anchor:!0}),p.current=0,e()),i().voiceState===`idle`&&(h.current=!1,n());return}v>=_R?(o.stopImmediatePropagation(),t(l,{char:d,floor:p.current})):p.current+=l,f.current>=_R&&a(e=>e.voiceWarmingUp?e:{...e,voiceWarmingUp:!0}),g.current&&clearTimeout(g.current),g.current=setTimeout((e,t,n,r)=>{e.current=null,t.current=0,n.current=0,r(e=>e.voiceWarmingUp?{...e,voiceWarmingUp:!1}:e)},mR,g,f,p,a)};return Oe((e,t,n)=>{let r=new Ae(n.keypress);_(r),r.didStopImmediatePropagation()&&n.stopImmediatePropagation()},{isActive:r}),{handleKeyDown:_}}function dR(e){return uR(e),null}var fR,pR,mR,hR,gR,_R,vR,yR=t((()=>{fR=n(L(),1),Rm(),Hh(),fl(),H(),Gp(),Vi(),RD(),pR=(fS(),e(dS)),mR=120,hR=2e3,gR=5,_R=2,vR={key:` `,ctrl:!1,alt:!1,shift:!1,meta:!1,super:!1}})),bR=r({useFrustrationDetection:()=>SR});function xR(e){return e.filter(e=>`isApiErrorMessage`in e&&e.isApiErrorMessage===!0).length>=2}function SR(e,t,n,r){let[i,a]=(0,CR.useState)(`closed`),o=En(),s=ws(`product_feedback`),c=o.transcriptShareDismissed||!s||t||n||r,l=xR(e);return{state:c?`closed`:l&&i===`closed`?`transcript_prompt`:i,handleTranscriptSelect:t=>{c||(t===`yes`?(ZP(e,`frustration`,crypto.randomUUID()),a(`submitted`)):(kt(e=>({...e,transcriptShareDismissed:!0})),a(`closed`)))}}}var CR,wR=t((()=>{CR=n(L(),1),lr(),mu(),QP()})),TR=r({useAntOrgWarningNotification:()=>ER});function ER(){}var DR=t((()=>{})),OR=r({useProactive:()=>kR});function kR(e){let t=(0,AR.useRef)(e);t.current=e,(0,AR.useEffect)(()=>{if(!_v())return;let e=null,n=!1,r=!1;function i(){gv(Date.now()+jR),e=setTimeout(()=>{if(e=null,!uv()){i();return}let{isLoading:a,queuedCommandsLength:o,hasActiveLocalJsxUI:s,isInPlanMode:c}=t.current;if(a||c||s||o>0||r){i();return}r=!0,(async()=>{let e=await a_({basePrompt:`<${Wr}>${new Date().toLocaleTimeString()}</${Wr}>`,currentDir:Tr(),shouldCreate:()=>!n});if(n){await Xm({commands:e});return}let r=[];try{for(let n of e)t.current.onQueueTick(n),r.push(n)}catch(t){throw await Xm({commands:e.filter(e=>!r.includes(e))}),t}})().catch(e=>J(`[Proactive] failed to create tick: ${e}`,{level:`error`})).finally(()=>{r=!1}),i()},jR)}return i(),()=>{n=!0,e!==null&&(clearTimeout(e),e=null),gv(null)}},[_v(),lv(),fv()])}var AR,jR,MR=t((()=>{AR=n(L(),1),Xr(),wr(),qf(),q(),jR=3e4})),NR=r({createScheduledTaskQueuedCommand:()=>PR,useScheduledTasks:()=>FR});async function PR(e,t){let n=await wg({basePrompt:e.prompt,trigger:`scheduled-task`,rootDir:t?.rootDir,currentDir:t?.currentDir??Tr(),sourceId:e.id,sourceLabel:e.prompt,workload:It,shouldCreate:t?.shouldCreate});return n||J(`[ScheduledTasks] skipping ${e.id}: previous run still queued or running`),n}function FR({isLoading:e,assistantMode:t=!1,setMessages:n}){let r=(0,LR.useRef)(e);r.current=e;let i=ef(),a=Af();(0,LR.useEffect)(()=>{if(!N_())return;let e=!1,o=async t=>{let n=await dd({basePrompt:t,trigger:`scheduled-task`,currentDir:Tr(),workload:It,shouldCreate:()=>!e});if(n){if(e){await Ya(n.autonomy.runId,n.autonomy.rootDir);return}_a(n)}},s=Xy({onFire:e=>{o(e).catch(e=>J(`[ScheduledTasks] failed to enqueue missed task prompt: ${e}`,{level:`error`}))},onFireTask:t=>{(async()=>{if(t.agentId){let n=xf(t.agentId,i.getState().tasks);if(n&&!Js(n.status)){let r=await PR(t,{shouldCreate:()=>!e});if(!r)return;if(e){await Ya(r.autonomy.runId,r.autonomy.rootDir);return}!bp(n.id,r.value,{autonomyRunId:r.autonomy?.runId,autonomyRootDir:r.autonomy?.rootDir,origin:r.origin},a)&&r.autonomy?.runId&&await La(r.autonomy.runId,`Teammate ${t.agentId} exited before the scheduled message could be delivered.`,r.autonomy.rootDir);return}J(`[ScheduledTasks] teammate ${t.agentId} gone, removing orphaned cron ${t.id}`),O_([t.id]);return}let r=await PR(t,{shouldCreate:()=>!e});if(!r)return;if(e){await Ya(r.autonomy.runId,r.autonomy.rootDir);return}let o=r_(`Running scheduled task (${IR(new Date)})`);n(e=>[...e,o]),_a(r)})().catch(e=>J(`[ScheduledTasks] failed to enqueue task ${t.id}: ${e}`,{level:`error`}))},isLoading:()=>r.current,assistantMode:t,getJitterConfig:Qy,isKilled:()=>!N_()});return s.start(),()=>{e=!0,s.stop()}},[t])}function IR(e){return e.toLocaleString(`en-US`,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}).replace(/,? at |, /,` `).replace(/ ([AP]M)/,(e,t)=>t.toLowerCase())}var LR,RR=t((()=>{LR=n(L(),1),X(),kh(),wr(),Rg(),q(),Ss(),ql(),Qt()}));function zR(e){if(e.tokenBudget!==null){let t=Math.max(0,e.tokenBudget-e.tokensUsed);return`Tokens used: ${e.tokensUsed} / ${e.tokenBudget} (${t} remaining)`}return`Tokens used: ${e.tokensUsed}`}function BR(e){let t=ho(e),n=zR(e),r=`Continuation turns executed: ${e.turnsExecuted}`;return`<goal-steering type="continuation">
|
|
@@ -139,9 +139,9 @@ Instead, provide a brief summary:
|
|
|
139
139
|
3. Any blockers or issues encountered.
|
|
140
140
|
|
|
141
141
|
Then use the GoalTool to mark the goal as complete (if truly done) or leave it in its current state for the user to decide.
|
|
142
|
-
</goal-steering>`}var HR=t((()=>{})),UR=r({useGoalContinuation:()=>GR});function WR(e){J(`[goal] hook: ${e}`)}function GR(e){let t=(0,KR.useRef)(e);t.current=e;let n=(0,KR.useRef)(!1),r=(0,KR.useRef)(!1);(0,KR.useLayoutEffect)(()=>{if(e.isLoading){n.current=!1;return}if(e.isQueryActiveNow?.()){WR(`skip: queryActiveNow=true`);return}if(e.wasAborted){WR(`skip: wasAborted=true`);return}if(n.current)return;if(Vl().length>0){WR(`skip: yielding to queued user messages`);return}if(e.hasActiveLocalJsxUI){WR(`skip: activeLocalJsxUI`);return}if(e.isInPlanMode){WR(`skip: planMode`);return}let t=Rs();if(!t){r.current=!1;return}if(t.status===`active`&&(r.current=!1),t.status===`budget_limited`&&!r.current){r.current=!0,n.current=!0;let e=VR(t);J(`[goal] hook: budget limit reached, injecting wrap-up prompt`),h_({value:e,mode:`prompt`,priority:`now`,isMeta:!0,origin:`goal-budget-limit`,skipSlashCommands:!0});return}if(t.status!==`active`){WR(`skip: status="${t.status}" (not active)`);return}if(t.turnsExecuted>=150){ou()&&(Ed(),e.onMaxTurnsReached?.()),J(`[goal] hook: MAX_GOAL_TURNS (150) reached, stopping`);return}n.current=!0;let i=b_();Ed();let a=BR(t);J(`[goal] hook: enqueuing turn ${i} for "${t.objective.slice(0,60)}"`),h_({value:a,mode:`prompt`,priority:`now`,isMeta:!0,origin:`goal-continuation`,skipSlashCommands:!0}),e.onContinuationEnqueued?.({turn:i,objective:t.objective})},[e.isLoading,e.wasAborted,e.queuedCommandsLength,e.hasActiveLocalJsxUI,e.isInPlanMode])}var KR,qR=t((()=>{KR=n(L(),1),q(),ba(),HR(),Ss()})),JR=r({AntModelSwitchCallout:()=>YR,shouldShowModelSwitchCallout:()=>XR});function YR(e){return null}function XR(){return!1}var ZR=t((()=>{})),QR=r({UndercoverAutoCallout:()=>$R});function $R({onDone:e}){return(0,ez.useEffect)(()=>{e()},[e]),null}var ez,tz=t((()=>{ez=n(L(),1)}));ot(),ms(),Ci(),f(),H(),ny(),jb(),Rm(),hu(),q(),s(),ki(),qf(),Bv(),Vm(),Yi(),_i(),kh(),fa(),Oo(),Dm(),ub(),As(),Xp(),Cs(),gf(),za(),Np(),gr(),Zr(),wr(),lo(),Pg(),Wo(),xd(),lr(),In(),Cr(),an(),ql(),Ny(),Xr(),Lg(),Qd(),Ly(),hd(),Ma(),ld(),Rb(),X(),Ng(),go(),Up(),pc(),Yn(),ma(),yc(),Ss(),_f(),vf(),so(),im(),Da();var nz=(yR(),e(sR)).useVoiceIntegration,rz=(yR(),e(sR)).VoiceKeybindingHandler,iz=process.env.USER_TYPE===`ant`?(wR(),e(bR)).useFrustrationDetection:()=>({state:`closed`,handleTranscriptSelect:()=>{}}),az=process.env.USER_TYPE===`ant`?(DR(),e(TR)).useAntOrgWarningNotification:()=>{},oz=(m_(),e(el)).getCoordinatorUserContext,sz=(vv(),e(sv)),cz=e=>()=>{},lz=()=>!1,uz=()=>null,dz=(e,t)=>!1,fz=(MR(),e(OR)).useProactive,pz=(RR(),e(NR)).useScheduledTasks,mz=(qR(),e(UR)).useGoalContinuation,hz=()=>({relayPipeMessage:()=>!1,pipeReturnHadErrorRef:{current:!1}}),gz=()=>({routeToSelectedPipes:()=>!1}),_z=process.env.USER_TYPE===`ant`?(ZR(),e(JR)).AntModelSwitchCallout:null,vz=process.env.USER_TYPE===`ant`?(ZR(),e(JR)).shouldShowModelSwitchCallout:()=>!1,yz=process.env.USER_TYPE===`ant`?(tz(),e(QR)).UndercoverAutoCallout:null,bz=[],xz=3e3;function Sz(e){let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?Math.round((t[n-1]+t[n])/2):t[n]}function Cz({showAllInTranscript:e,virtualScroll:t,searchBadge:n,suppressShowAll:r=!1,status:i}){let a=fc(`app:toggleTranscript`,`Global`,`ctrl+o`),o=fc(`transcript:toggleShowAll`,`Transcript`,`ctrl+e`);return(0,$.jsxs)(U,{noSelect:!0,alignItems:`center`,alignSelf:`center`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,children:[(0,$.jsxs)(R,{dimColor:!0,children:[`Showing detailed transcript · `,a,` to toggle`,n?` · n/N to navigate`:t?` · ${p.arrowUp}${p.arrowDown} scroll · home/end top/bottom`:r?``:` · ${o} to ${e?`collapse`:`show all`}`]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{children:[i,` `]})]}):n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{dimColor:!0,children:[n.current,`/`,n.count,` `]})]}):null]})}function wz({jumpRef:e,count:t,current:n,onClose:r,onCancel:i,setHighlight:a,initialQuery:o}){let{query:s,cursorOffset:c}=px({isActive:!0,initialQuery:o,onExit:()=>r(s),onCancel:i}),[l,u]=Q.useState(`building`);Q.useEffect(()=>{let t=!0,n,r=e.current?.warmSearchIndex;if(!r){u(null);return}return u(`building`),r().then(e=>{t&&(e<20?u(null):(u({ms:e}),n=setTimeout(()=>t&&u(null),2e3)))}),()=>{t=!1,n&&clearTimeout(n)}},[e]);let d=l!==`building`;(0,Q.useEffect)(()=>{d&&(e.current?.setSearchQuery(s),a(s))},[e,s,a,d]);let f=c,p=f<s.length?s[f]:` `;return(0,$.jsxs)(U,{borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,noSelect:!0,children:[(0,$.jsx)(R,{children:`/`}),(0,$.jsx)(R,{children:s.slice(0,f)}),(0,$.jsx)(R,{inverse:!0,children:p}),f<s.length&&(0,$.jsx)(R,{children:s.slice(f+1)}),(0,$.jsx)(U,{flexGrow:1}),l===`building`?(0,$.jsx)(R,{dimColor:!0,children:`indexing… `}):l?(0,$.jsxs)(R,{dimColor:!0,children:[`indexed in `,l.ms,`ms `]}):t===0&&s?(0,$.jsx)(R,{color:`error`,children:`no matches `}):t>0?(0,$.jsxs)(R,{dimColor:!0,children:[n,`/`,t,` `]}):null]})}var Tz=[`⠂`,`⠐`],Ez=`✳`,Dz=960;function Oz({isAnimating:e,title:t,disabled:n,noPrefix:r}){let i=le(),[a,o]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(n||r||!e||!i)return;let t=setInterval(e=>e(e=>(e+1)%Tz.length),Dz,o);return()=>clearInterval(t)},[n,r,e,i]);let s=e?Tz[a]??Ez:Ez;return ve(n?null:r?t:`${s} ${t}`),null}var kz=`<${qr}>`;function Az(e){return e.type===`text`&&typeof e.text==`string`&&e.text.includes(kz)}function jz({commands:t,debug:n,initialTools:r,initialMessages:i,pendingHookMessages:a,initialFileHistorySnapshots:o,initialContentReplacements:s,initialAgentName:l,initialAgentColor:u,mcpClients:d,dynamicMcpConfig:f,autoConnectIdeFlag:p,strictMcpConfig:m=!1,systemPrompt:h,appendSystemPrompt:g,onBeforeQuery:_,onTurnComplete:v,disabled:y=!1,mainThreadAgentDefinition:b,disableSlashCommands:x=!1,taskListId:S,remoteSessionConfig:C,directConnectConfig:w,sshSession:E,thinkingConfig:D}){let O=!!C,j=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE),[]),M=(0,Q.useMemo)(()=>process.env.USER_TYPE===`ant`&&c(process.env.CLAUDE_MORERIGHT),[]),N=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]);(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_MESSAGE_ACTIONS),[]),(0,Q.useEffect)(()=>(J(`[REPL:mount] REPL mounted, disabled=${y}`),()=>J(`[REPL:unmount] REPL unmounting`)),[y]);let[P,ee]=(0,Q.useState)(b),F=Z(e=>e.toolPermissionContext),te=Z(e=>e.verbose),ne=Z(e=>e.mcp),re=Z(e=>e.plugins),L=Z(e=>e.agentDefinitions),oe=Z(e=>e.fileHistory),se=Z(e=>e.initialMessage),ue=pD(),de=Z(e=>e.spinnerTip),fe=Z(e=>e.expandedView)===`tasks`,pe=Z(e=>e.pendingWorkerRequest),me=Z(e=>e.pendingSandboxRequest),z=Z(e=>e.teamContext),B=Z(e=>e.tasks),he=Z(e=>e.workerSandboxPermissions),ge=Z(e=>e.elicitation),_e=Z(e=>e.ultraplanPendingChoice),ve=Z(e=>e.ultraplanLaunchPending),ye=Z(e=>e.viewingAgentTaskId),V=Af(),be=ye?B[ye]:void 0,xe=Bp(be)&&be.retain&&!be.diskLoaded;(0,Q.useEffect)(()=>{if(!ye||!xe)return;let e=ye;rp(So(e)).then(t=>{V(n=>{let r=n.tasks[e];if(!Bp(r)||r.diskLoaded||!r.retain)return n;let i=r.messages??[],a=new Set(i.map(e=>e.uuid)),o=t?t.messages.filter(e=>!a.has(e.uuid)):[];return{...n,tasks:{...n.tasks,[e]:{...r,messages:[...o,...i],diskLoaded:!0}}}})})},[ye,xe,V]);let H=ef(),we=A(),Te=Lb(),[Ee,De]=(0,Q.useState)(t);DP(O?void 0:vt(),De);let ke=Q.useSyncExternalStore(sz?.subscribeToProactiveChanges??cz,sz?.isProactiveActive??lz),Ae=Q.useSyncExternalStore(sz?.subscribeToProactiveChanges??cz,sz?.getNextTickAt??uz),je=Z(e=>e.isBriefOnly),Pe=(0,Q.useMemo)(()=>Iu(F),[F,ke,je]);Mx();let[Ie,Le]=(0,Q.useState)(f),Re=(0,Q.useCallback)(e=>{Le(e)},[Le]),[ze,Ve]=(0,Q.useState)(`prompt`),[Ge,Ke]=(0,Q.useState)(!1),[Je,Ze]=(0,Q.useState)(!1),[Qe,$e]=(0,Q.useState)(``),it=(0,Q.useRef)(0),ot=(0,Q.useRef)(void 0),st=(0,Q.useRef)(!1),{addNotification:ut,removeNotification:dt}=Bh(),mt=dz,ht=TP(d,ne.clients),[gt,_t]=(0,Q.useState)(void 0),[yt,xt]=(0,Q.useState)(null),[Ct,Tt]=(0,Q.useState)(null),[Et,Dt]=(0,Q.useState)(!1),[Ot,At]=(0,Q.useState)(()=>process.env.USER_TYPE===`ant`?vz():!1),[jt,Mt]=(0,Q.useState)(()=>JP(Te)),Nt=Z(e=>e.showRemoteCallout),[Pt,Ft]=(0,Q.useState)(()=>SS());HI(),GI(),BI({ideSelection:gt,mcpClients:ht,ideInstallationStatus:Ct}),QF({mcpClients:ht}),OI(),kI(),hx(),FI(Te),rL(),II(Te),RI(),az(),wF(),PF(),BF(),tI(),QI();let{recommendation:It,handleResponse:Lt}=_I(),{recommendation:Rt,handleResponse:zt}=bI(),Bt=DI(),Vt=(0,Q.useMemo)(()=>[...Pe,...r],[Pe,r]);zy({enabled:!O});let Ht=c_();(0,Q.useEffect)(()=>{O||MI(V)},[V,O]),HF(O?bz:ht,F.mode),QN(V,i,{enabled:!O});let Ut=kb(Vt,ne.tools,F),{tools:Wt,allowedAgentTypes:Gt}=(0,Q.useMemo)(()=>{if(!P)return{tools:Ut,allowedAgentTypes:void 0};let e=wc(P,Ut,!1,!0);return{tools:e.resolvedTools,allowedAgentTypes:e.allowedAgentTypes}},[P,Ut]),Kt=EP(EP(Ee,re.commands),ne.commands),qt=(0,Q.useMemo)(()=>x?[]:Kt,[x,Kt]);NC(O?bz:ne.clients),AP(O?bz:ne.clients,_t);let[Jt,Yt]=(0,Q.useState)(`responding`),Zt=(0,Q.useRef)(Jt);Zt.current=Jt;let[Qt,$t]=(0,Q.useState)([]),[en,tn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(en&&!en.isStreaming&&en.streamingEndedAt){let e=3e4-(Date.now()-en.streamingEndedAt);if(e>0){let t=setTimeout(tn,e,null);return()=>clearTimeout(t)}else tn(null)}},[en]);let[nn,rn]=(0,Q.useState)(null),an=(0,Q.useRef)(null);an.current=nn;let on=(0,Q.useRef)(0),[sn,cn]=(0,Q.useState)(!1),ln=(0,Q.useRef)(()=>{}),un=(0,Q.useRef)(()=>{}),dn=(0,Q.useRef)(null),fn=(0,Q.useRef)(null),pn=(0,Q.useRef)(0),mn=Q.useRef(new dC).current,hn=Q.useSyncExternalStore(mn.subscribe,mn.getSnapshot),[_n,vn]=Q.useState(C?.hasInitialPrompt??!1),W=hn||_n,[yn,bn]=Q.useState(void 0),xn=Q.useRef(0),Sn=Q.useRef(!1),Cn=Q.useRef(0),wn=Q.useRef(0),Tn=Q.useRef(null),Dn=Q.useCallback(()=>{Cn.current=Date.now(),wn.current=0,Tn.current=null},[]),On=Q.useRef(!1);hn&&!On.current&&Dn(),On.current=hn;let kn=Q.useCallback(e=>{vn(e),e&&Dn()},[Dn]),jn=Q.useRef(null),Mn=Q.useRef(void 0),Pn=Q.useRef(void 0),[Fn,In]=Q.useState(!1),[Ln,Rn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{Ln?.notifications&&Ln.notifications.forEach(e=>{ut({key:`auto-updater-notification`,text:e,priority:`low`})})},[Ln,ut]),(0,Q.useEffect)(()=>{El()&&Ra().then(e=>{e&&ut({key:`tmux-mouse-hint`,text:e,priority:`low`})})},[]);let[zn,Bn]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{process.env.USER_TYPE===`ant`&&(async()=>{let{isInternalModelRepo:e}=await import(`./commitAttribution-Bpbro1a4.js`);await e();let{shouldShowUndercoverAutoNotice:t}=await import(`./undercover-B4sdXe12.js`);t()&&Bn(!0)})()},[]);let[Vn,Hn]=(0,Q.useState)(null),Un=(0,Q.useRef)(null),Wn=(0,Q.useCallback)(e=>{if(e?.isLocalJSXCommand){let{clearLocalJSX:t,...n}=e;Un.current={...n,isLocalJSXCommand:!0},Hn(n);return}if(Un.current){if(e?.clearLocalJSX){Un.current=null,Hn(null),on.current=Date.now();return}return}if(e?.clearLocalJSX){Hn(null);return}Hn(e)},[]),[Gn,Kn]=(0,Q.useState)([]),[qn,Jn]=(0,Q.useState)(null),[Yn,Xn]=(0,Q.useState)([]),[Zn,Qn]=(0,Q.useState)([]),$n=(0,Q.useRef)(new Map),er=Z(e=>e.settings.terminalTitleFromRename)===!1?void 0:Bd(Fe()),[tr,nr]=(0,Q.useState)(),rr=(0,Q.useRef)((i?.length??0)>0),ir=P?.agentType,ar=er??ir??tr??`Claude Code`,or=Gn.length>0||Zn.length>0||pe||me,sr=Vn?.isLocalJSXCommand===!0&&Vn?.jsx!=null,cr=W&&!or&&!sr;(0,Q.useEffect)(()=>{if(W&&!or&&!sr)return iC(),()=>aC()},[W,or,sr]);let lr=or||sr?`waiting`:W?`busy`:`idle`,ur=lr===`waiting`?Gn.length>0?`approve ${Gn[0].tool.name}`:pe?`worker request`:me?`sandbox request`:sr?`dialog open`:`input needed`:void 0;(0,Q.useEffect)(()=>{vl({status:lr,waitingFor:ur})},[lr,ur]);let dr=gn(`tengu_terminal_sidebar`,!1)&&(En().showStatusInTerminalTab??!1);T(j||!dr?null:lr),(0,Q.useEffect)(()=>(_h(Kn),()=>Wu()),[Kn]);let[G,fr]=(0,Q.useState)(i??[]),pr=(0,Q.useRef)(G),hr=(0,Q.useRef)(!1),K=(0,Q.useCallback)(e=>{let t=pr.current,n=typeof e==`function`?e(pr.current):e;if(pr.current=n,n.length<xn.current)xn.current=0;else if(n.length>t.length&&Sn.current){let e=n.length-t.length;(t.length===0||n[0]===t[0]?n.slice(-e):n.slice(0,e)).some(il)?Sn.current=!1:xn.current=n.length}fr(n)},[]),gr=(0,Q.useCallback)(e=>{e===void 0?Sn.current=!1:(xn.current=pr.current.length,Sn.current=!0),bn(e)},[]),{dividerIndex:_r,dividerYRef:vr,onScrollAway:yr,onRepin:br,jumpToNew:q,shiftDivider:xr}=Ex(G.length);MF(G,K,W);let[Cr,wr]=(0,Q.useState)(null),Er=(0,Q.useRef)(null),Dr=(0,Q.useMemo)(()=>Cx(G,_r),[_r,G.length]),Or=(0,Q.useCallback)(()=>{dn.current?.scrollToBottom(),br(),wr(null)},[br,wr]),kr=G.at(-1),Ar=kr!=null&&il(kr);(0,Q.useEffect)(()=>{Ar&&Or()},[Ar,kr,Or]);let{maybeLoadOlder:jr}=EN({config:C,setMessages:K,scrollRef:dn,onPrepend:xr}),Mr=(0,Q.useCallback)((e,t)=>{pn.current=Date.now(),e?br():(yr(t),jr(t),V(e=>e.companionReaction===void 0?e:{...e,companionReaction:void 0}))},[br,yr,jr,V]),Nr=HN(a,K),Pr=(0,Q.useDeferredValue)(Q.useMemo(()=>G.length>500?G.slice(-500):G,[G])),Fr=G.length-Pr.length;Fr>0&&J(`[useDeferredValue] Messages deferred by ${Fr} (${Pr.length}→${G.length})`);let[Ir,Lr]=(0,Q.useState)(null),[Rr,zr]=(0,Q.useState)(()=>mS()),Br=(0,Q.useRef)(Rr);Br.current=Rr;let Vr=(0,Q.useRef)(null),Hr=(0,Q.useCallback)(e=>{mt(Br.current,e)||(Br.current===``&&e!==``&&Date.now()-pn.current>=xz&&Or(),Br.current=e,zr(e),In(e.trim().length>0))},[In,Or,mt]);(0,Q.useEffect)(()=>{if(Rr.trim().length===0)return;let e=setTimeout(In,1500,!1);return()=>clearTimeout(e)},[Rr]);let[Ur,Wr]=(0,Q.useState)(`prompt`),[Gr,qr]=(0,Q.useState)(),Jr=(0,Q.useCallback)(e=>{let t=new Set(e);De(e=>e.filter(e=>t.has(e.name)||Vo.has(e)))},[De]),[Yr,Xr]=(0,Q.useState)(new Set),Zr=(0,Q.useRef)(!1),$r=dN({config:C,setMessages:K,setIsLoading:kn,onInit:Jr,setToolUseConfirmQueue:Kn,tools:Vt,setStreamingToolUses:$t,setStreamMode:Yt,setInProgressToolUseIDs:Xr}),ei=mN({config:w,setMessages:K,setIsLoading:kn,setToolUseConfirmQueue:Kn,tools:Vt}),ti=hN({session:E,setMessages:K,setIsLoading:kn,setToolUseConfirmQueue:Kn,tools:Vt}),ni=ti.isRemoteMode?ti:ei.isRemoteMode?ei:$r,[ri,ii]=(0,Q.useState)({}),[ai,oi]=(0,Q.useState)(0),si=(0,Q.useRef)(0),ci=(0,Q.useRef)([]),li=(0,Q.useCallback)(e=>{let t=si.current;if(si.current=e(t),si.current>t){let e=ci.current;if(e.length>0){let t=e.at(-1);t.lastTokenTime=Date.now(),t.endResponseLength=si.current}}},[]),[ui,di]=(0,Q.useState)(null),fi=!(Z(e=>e.settings.prefersReducedMotion)??!1)&&!Se(),hi=(0,Q.useCallback)(e=>{fi&&di(e)},[fi]),gi=ui&&fi&&ui.substring(0,ui.lastIndexOf(`
|
|
143
|
-
`)+1)||null,[_i,yi]=(0,Q.useState)(0),[bi,xi]=(0,Q.useState)(null),[Si,Ci]=(0,Q.useState)(null),[wi,Ti]=(0,Q.useState)(null),[Ei,Di]=(0,Q.useState)(!1),[ki,Ai]=(0,Q.useState)(void 0),[ji,Mi]=(0,Q.useState)(!1),[Ni,Fi]=(0,Q.useState)(zS()),[Ii,Li]=(0,Q.useState)(null),Ri=(0,Q.useRef)(!1),zi=(0,Q.useRef)(_i);zi.current=_i;let[Bi]=(0,Q.useState)(()=>({current:ys(i,s)}));xl(()=>{Bi.current=Rl()});let[Vi,Hi]=(0,Q.useState)(En().hasAcknowledgedCostThreshold),[Ui,Wi]=(0,Q.useState)(`INSERT`),[Gi,Ji]=(0,Q.useState)(!1),[Yi,Xi]=(0,Q.useState)(!1),[Zi,$i]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{_e&&Gi&&Ji(!1)},[_e,Gi]);let ta=le(),ra=(0,Q.useRef)(ta);ra.current=ta;let[ia]=ae(),aa=Q.useRef(!1),ca=(0,Q.useCallback)(()=>{if(aa.current)return;aa.current=!0;let e=pr.current.slice(Ga.current);for(let t of tg(e))Wa.current.add(t);Ga.current=pr.current.length,GF({theme:ia,readFileState:Ha.current,bashTools:Wa.current}).then(async e=>{if(e){let t=await e.content({theme:ia});V(e=>({...e,spinnerTip:t})),KF(e)}else V(e=>e.spinnerTip===void 0?e:{...e,spinnerTip:void 0})})},[V,ia]),da=(0,Q.useCallback)(()=>{kn(!1),gr(void 0),si.current=0,ci.current=[],di(null),$t([]),xi(null),Ci(null),Ti(null),ca(),xv(),Sm()},[ca]),fa=(0,Q.useMemo)(()=>ag(B).some(e=>e.status===`running`),[B]);(0,Q.useEffect)(()=>{if(!fa&&jn.current!==null){let e=Date.now()-jn.current,t=Mn.current;jn.current=null,Mn.current=void 0,K(n=>[...n,Kg(e,t,mi(n,Ca))])}},[fa,K]);let ma=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(F.mode!==`auto`){ma.current=!1;return}if(ma.current||(En().autoPermissionsNotificationCount??0)>=3)return;let e=setTimeout((e,t)=>{e.current=!0,kt(e=>{let t=e.autoPermissionsNotificationCount??0;return t>=3?e:{...e,autoPermissionsNotificationCount:t+1}}),t(e=>[...e,Na($F,`warning`)])},800,ma,K);return()=>clearTimeout(e)}},[F.mode,K]);let ga=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ga.current)return;let e=Nl();if(!e?.creationDurationMs||e.usedSparsePaths||e.creationDurationMs<15e3)return;ga.current=!0;let t=Math.round(e.creationDurationMs/1e3);K(e=>[...e,Na(`Worktree creation took ${t}s. For large repos, set \`worktree.sparsePaths\` in .claude/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`,`info`)])},[K]);let _a=(0,Q.useMemo)(()=>{let e=G.findLast(e=>e.type===`assistant`);if(e?.type!==`assistant`)return!1;let t=e.message?.content,n=(Array.isArray(t)?t:[]).filter(e=>e.type===`tool_use`&&Yr.has(e.id));return n.length>0&&n.every(e=>e.type===`tool_use`&&e.name===`Sleep`)},[G,Yr]),{onBeforeQuery:ya,onTurnComplete:Sa,render:Ta}=zN({enabled:M,setMessages:K,inputValue:Rr,setInputValue:Hr,setToolJSX:Wn}),Da=(!Vn||Vn.showSpinner===!0)&&Gn.length===0&&Zn.length===0&&(W||yn||fa||Lo()>0)&&!pe&&!_a&&(!gi||je),Oa=Gn.length>0||Zn.length>0||Yn.length>0||ge.queue.length>0||he.queue.length>0,ka=nF(G,W,ai,`session`,Oa),ja=RN(K),Ma=_L(G,ai),Fa=(0,Q.useMemo)(()=>({...ka,handleSelect:e=>{no.current=!1;let t=ka.handleSelect(e);e===`bad`&&!t&&oL(`feedback_survey_bad`)&&(to(`feedback_survey_bad`),no.current=!0)}}),[ka]),Ia=hF(G,W,Oa,{enabled:!O}),La=uF(G,W,Oa,{enabled:!O}),za=iz(G,W,Oa,Fa.state!==`closed`||Ia.state!==`closed`||La.state!==`closed`);VP({autoConnectIdeFlag:p,ideToInstallExtension:yt,setDynamicMcpConfig:Le,setShowIdeOnboarding:Dt,setIDEInstallationState:Tt}),qF(o,oe,e=>V(t=>({...t,fileHistory:e})));let Ba=(0,Q.useCallback)(async(t,n,r)=>{let i=performance.now();try{let a=Sh(n.messages);{let t=(m_(),e(el)).matchSessionMode(n.mode);if(t){let{getAgentDefinitionsWithOverrides:n,getActiveAgentsFromList:r}=(Im(),e(pg));n.cache.clear?.();let i=await n(ft());V(e=>({...e,agentDefinitions:{...i,allAgents:i.allAgents,activeAgents:r(i.allAgents)}})),a.push(Na(t,`warning`))}}let o=bm();await ea(`resume`,{getAppState:()=>H.getState(),setAppState:V,signal:AbortSignal.timeout(o),timeoutMs:o});let s=await na(`resume`,{sessionId:t,agentType:P?.agentType,model:Te});a.push(...s),r===`fork`?Kf(n,xs(t)):ch(n,xs(t)),_b(n,V),n.fileHistorySnapshots&&Pa(n);let{agentDefinition:c}=hb(n.agentSetting,b,L);ee(c),V(e=>({...e,agent:c?.agentType})),V(e=>({...e,standaloneAgentContext:gb(n.agentName,n.agentColor)})),Vg(n.agentName),Ya(a,n.projectPath??ft()),da(),rn(null),Fi(t);let l=_c(t);Lp(),St(),lt(xs(t),n.fullPath?AS(n.fullPath):null);let{renameRecordingForSession:u}=await import(`./asciicast-DA6TudSH.js`);if(await u(),await ep(),$h(),vd(n),n.goal){let{hydrateGoalFromTranscript:r}=(Sp(),e(jh)),i=new Map;i.set(t,n.goal),r(i,t)}if(rr.current=!0,nr(void 0),r!==`fork`)vb(),yb(n.worktreeSession),Qi(),pa({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V});else{let e=Nl();e&&Ua(e)}{let{saveMode:t}=(go(),e(la)),{isCoordinatorMode:n}=(m_(),e(el));t(n()?`coordinator`:`normal`)}l&&ct(l),Bi.current&&r!==`fork`&&(Bi.current=uh(a,n.contentReplacements??[])),K(()=>a),Wn(null),Hr(``),Y(`tengu_session_resumed`,{entrypoint:r,success:!0,resume_duration_ms:Math.round(performance.now()-i)})}catch(e){throw Y(`tengu_session_resumed`,{entrypoint:r,success:!1}),e}},[da,V]),[Va]=(0,Q.useState)(()=>iv(100)),Ha=(0,Q.useRef)(Va),Wa=(0,Q.useRef)(new Set),Ga=(0,Q.useRef)(0),Ka=(0,Q.useRef)(new Set),Ja=(0,Q.useRef)(new Set),Ya=(0,Q.useCallback)((e,t)=>{let n=Tm(e,t,100);Ha.current=ov(Ha.current,n);for(let t of tg(e))Wa.current.add(t)},[]);(0,Q.useEffect)(()=>{i&&i.length>0&&(Ya(i,ft()),pa({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V}))},[]);let{status:Qa,reverify:$a}=UN(),[eo,to]=(0,Q.useState)(null),no=(0,Q.useRef)(!1),[io,ao]=(0,Q.useState)(null),[oo,so]=(0,Q.useState)(!1),co=!W&&ji;function lo(){if(oo||io)return;if(Ei)return`message-selector`;if(Fn)return;if(Yn[0])return`sandbox-permission`;let e=!Vn||Vn.shouldContinueAnimation;if(e&&Gn[0])return`tool-permission`;if(e&&Zn[0])return`prompt`;if(e&&he.queue[0])return`worker-sandbox-permission`;if(e&&ge.queue[0])return`elicitation`;if(e&&co)return`cost`;if(e&&Ii)return`idle-return`;if(e&&!W&&_e)return`ultraplan-choice`;if(e&&!W&&ve)return`ultraplan-launch`;if(e&&Et)return`ide-onboarding`;if(process.env.USER_TYPE===`ant`&&e&&Ot)return`model-switch`;if(process.env.USER_TYPE===`ant`&&e&&zn)return`undercover-callout`;if(e&&jt)return`effort-callout`;if(e&&Nt)return`remote-callout`;if(e&&It)return`lsp-recommendation`;if(e&&Rt)return`plugin-hint`;if(e&&Bt.visible)return`search-extra-tools-hint`;if(e&&Pt)return`desktop-upsell`}let uo=lo(),fo=Fn&&(Yn[0]||Gn[0]||Zn[0]||he.queue[0]||ge.queue[0]||co);Pn.current=uo,(0,Q.useEffect)(()=>{if(!W)return;let e=uo===`tool-permission`,t=Date.now();e&&Tn.current===null?Tn.current=t:!e&&Tn.current!==null&&(wn.current+=t-Tn.current,Tn.current=null)},[uo,W]);let po=(0,Q.useRef)(uo);(0,Q.useLayoutEffect)(()=>{po.current===`tool-permission`!=(uo===`tool-permission`)&&Or(),po.current=uo},[uo,Or]);function mo(){if(uo!==`elicitation`){if(on.current!==0&&Date.now()-on.current<500){on.current=0,J(`[onCancel] suppressed: local-jsx panel just dismissed`);return}if(on.current=0,J(`[onCancel] focusedInputDialog=${uo} streamMode=${Jt}`),sz?.pauseProactive(),mn.getSnapshot()){let{getGoal:t,pauseGoal:n}=(ba(),e(sl)),{persistCurrentGoal:r}=(Sp(),e(jh));t()?.status===`active`&&(n(),r())}if(cn(!0),mn.forceEnd(),Ri.current=!1,ui?.trim()&&K(e=>[...e,mp({content:ui})]),da(),Ne(null),uo===`tool-permission`)Gn[0]?.onAbort(),Kn([]);else if(uo===`prompt`){for(let e of Zn)e.reject(Error(`Prompt cancelled by user`));Qn([]),nn?.abort(`user-cancel`)}else ni.isRemoteMode?ni.cancelRequest():nn?.abort(`user-cancel`);rn(null),Sa(pr.current,!0)}}let ho=(0,Q.useCallback)(()=>{let e=Au(Rr,0);e&&(Hr(e.text),Wr(`prompt`),e.images.length>0&&ii(t=>{let n={...t};for(let t of e.images)n[t.id]=t;return n}))},[Hr,Wr,Rr,ii]),vo={setToolUseConfirmQueue:Kn,onCancel:mo,onAgentsKilled:()=>K(e=>[...e,Vf()]),isMessageSelectorVisible:Ei||!!Gi,screen:ze,abortSignal:nn?.signal,popCommandFromQueue:ho,vimMode:Ui,isLocalJSXCommand:Vn?.isLocalJSXCommand,isSearchingHistory:Yi,isHelpOpen:Zi,inputMode:Ur,inputValue:Rr,streamMode:Jt};(0,Q.useEffect)(()=>{Ue()>=5&&!ji&&!Vi&&(Y(`tengu_cost_threshold_reached`,{}),Hi(!0),Xt()&&Mi(!0))},[G,ji,Vi]);let yo=(0,Q.useCallback)(async e=>{if(Nn()&&qh()){let t=Dd(),n=await vg(e.host,t);return new Promise(r=>{if(!n){Xn(t=>[...t,{hostPattern:e,resolvePromise:r}]);return}Mh({requestId:t,host:e.host,resolve:r}),V(n=>({...n,pendingSandboxRequest:{requestId:t,host:e.host}}))})}return new Promise(t=>{let n=!1;function r(e){n||(n=!0,t(e))}Xn(t=>[...t,{hostPattern:e,resolvePromise:r}]);{let t=H.getState().replBridgePermissionCallbacks;if(t){let n=zS();t.sendRequest(n,nb,{host:e.host},zS(),`Allow network connection to ${e.host}?`);let r=t.onResponse(n,t=>{r();let n=t.behavior===`allow`;Xn(t=>(t.filter(t=>t.hostPattern.host===e.host).forEach(e=>e.resolvePromise(n)),t.filter(t=>t.hostPattern.host!==e.host)));let i=$n.current.get(e.host);if(i){for(let e of i)e();$n.current.delete(e.host)}}),i=()=>{r(),t.cancelRequest(n)},a=$n.current.get(e.host)??[];a.push(i),$n.current.set(e.host,a)}}})},[V,H]);(0,Q.useEffect)(()=>{let e=Bs.getSandboxUnavailableReason();if(e){if(Bs.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${e}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),Ea(1,`other`);return}J(`sandbox disabled: ${e}`,{level:`warn`}),ut({key:`sandbox-unavailable`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`warning`,children:`sandbox disabled`}),(0,$.jsx)(R,{dimColor:!0,children:` · /sandbox`})]}),priority:`medium`})}},[ut]),Bs.isSandboxingEnabled()&&Bs.initialize(yo).catch(e=>{process.stderr.write(`\n❌ Sandbox Error: ${Sr(e)}\n`),Ea(1,`other`)});let bo=(0,Q.useCallback)((e,t)=>{V(n=>({...n,toolPermissionContext:{...e,mode:t?.preserveMode?n.toolPermissionContext.mode:e.mode}})),setImmediate(e=>{e(e=>(e.forEach(e=>{e.recheckPermission()}),e))},Kn)},[V,Kn]);(0,Q.useEffect)(()=>(Es(bo),()=>ls()),[bo]);let xo=gP(Kn,bo),Co=(0,Q.useCallback)((e,t,r,i)=>{let a=H.getState(),o=()=>{let e=H.getState(),t=rb(Vt,xh(e.toolPermissionContext,e.mcp.tools),e.toolPermissionContext.mode);return P?wc(P,t,!1,!0).resolvedTools:t};return{abortController:r,options:{commands:qt,tools:o(),debug:n,verbose:a.verbose,mainLoopModel:i,thinkingConfig:a.thinkingEnabled===!1?{type:`disabled`}:D,mcpClients:wP(d,a.mcp.clients),mcpResources:a.mcp.resources,ideInstallationStatus:Ct,isNonInteractiveSession:!1,dynamicMcpConfig:Ie,theme:ia,agentDefinitions:Gt?{...a.agentDefinitions,allowedAgentTypes:Gt}:a.agentDefinitions,customSystemPrompt:h,appendSystemPrompt:g,refreshTools:o},getAppState:()=>H.getState(),setAppState:V,messages:e,setMessages:K,updateFileHistoryState(e){V(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState(e){V(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},openMessageSelector:()=>{y||Di(!0)},onChangeAPIKey:$a,readFileState:Ha.current,setToolJSX:Wn,addNotification:ut,appendSystemMessage:e=>K(t=>[...t,e]),sendOSNotification:e=>{Eo(e,we)},onChangeDynamicMcpConfig:Re,onInstallIDEExtension:xt,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:Ja.current,dynamicSkillDirTriggers:new Set,discoveredSkillNames:Ka.current,setResponseLength:li,pushApiMetricsEntry:process.env.USER_TYPE===`ant`?e=>{let t=Date.now(),n=si.current;ci.current.push({ttftMs:e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})}:void 0,setStreamMode:Yt,onCompactProgress:e=>{switch(e.type){case`hooks_start`:Ci(`claudeBlue_FOR_SYSTEM_SPINNER`),Ti(`claudeBlueShimmer_FOR_SYSTEM_SPINNER`),xi(e.hookType===`pre_compact`?`Running PreCompact hooks…`:e.hookType===`post_compact`?`Running PostCompact hooks…`:`Running SessionStart hooks…`);break;case`compact_start`:xi(`Compacting conversation`);break;case`compact_end`:xi(null),Ci(null),Ti(null);break}},setInProgressToolUseIDs:Xr,setHasInterruptibleToolInProgress:e=>{Zr.current=e},resume:Ba,setConversationId:Fi,requestPrompt:void 0,contentReplacementState:Bi.current}},[qt,Vt,P,n,d,Ct,Ie,ia,Gt,H,V,$a,ut,K,Re,Ba,(0,Q.useCallback)((e,t)=>n=>new Promise((r,i)=>{Qn(a=>[...a,{request:n,title:e,toolInputSummary:t,resolve:r,reject:i}])}),[]),y,h,g,Fi]),{handleBackgroundSession:wo}=UP({setMessages:K,setIsLoading:kn,resetLoadingState:da,setAbortController:rn,onBackgroundQuery:(0,Q.useCallback)(()=>{nn?.abort(`background`);let e=td(e=>e.mode===`task-notification`);(async()=>{let t=Co(pr.current,[],new AbortController,Te),[n,r,i]=await Promise.all([pf(t.options.tools,Te,Array.from(F.additionalWorkingDirectories.keys()),t.options.mcpClients),Wl(),Ho()]),a=of({mainThreadAgentDefinition:P,toolUseContext:t,customSystemPrompt:h,defaultSystemPrompt:n,appendSystemPrompt:g});t.renderedSystemPrompt=a;let o=(await Ec(e).catch(()=>[])).map(Ks),s=new Set;for(let e of pr.current)e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode===`task-notification`&&typeof e.attachment.prompt==`string`&&s.add(e.attachment.prompt);let c=o.filter(e=>e.attachment.type===`queued_command`&&(typeof e.attachment.prompt!=`string`||!s.has(e.attachment.prompt)));hm({messages:[...pr.current,...c],queryParams:{systemPrompt:a,userContext:r,systemContext:i,canUseTool:xo,toolUseContext:t,querySource:Bl()},description:ar,setAppState:V,agentDefinition:P})})()},[nn,Te,F,P,Co,h,g,xo,V])}),To=(0,Q.useCallback)(t=>{xa(t,t=>{if(Cu(t)?(El()?K(e=>{let n=jc(e,{includeSnipped:!0});return[...n.length>500?n.slice(-500):n,t]}):K(()=>[t]),Fi(zS()),sz?.setContextBlocked(!1)):t.type===`progress`&&ll(t.data?.type)?K(e=>{let n=t.data;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.type!==`progress`)break;let a=i.data;if(i.parentToolUseID===t.parentToolUseID&&a?.type===n.type){let n=e.slice();return n[r]=t,n}}return[...e,t]}):K(e=>[...e,t]),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage?sz?.setContextBlocked(!0):t.type===`assistant`&&sz?.setContextBlocked(!1),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage){let n=(Ys(t.message?.content??``)??``).toLowerCase();if(n.includes(`connection error`)||n.includes(`fetch failed`)||n.includes(`network error`)||n.includes(`enotfound`)||n.includes(`econnreset`)||n.includes(`etimedout`)){let{getGoal:t,pauseGoal:n}=(ba(),e(sl)),{persistCurrentGoal:r}=(Sp(),e(jh));t()?.status===`active`&&(n(),r(),ut({key:`goal-auto-paused-connectivity-error`,text:`Detected connection error. Active goal was auto-paused. Run /goal resume after network recovers.`,priority:`immediate`}))}}},e=>{li(t=>t+e.length)},Yt,$t,e=>{K(t=>t.filter(t=>t!==e)),nh(e.uuid)},tn,e=>{let t=Date.now(),n=si.current;ci.current.push({...e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})},hi)},[K,li,Yt,$t,tn,hi]),Do=(0,Q.useCallback)(async(e,t,n,r,i,a,o)=>{if(r){let e=wP(d,H.getState().mcp.clients);Jd.handleQueryStart(e);let t=Il(e);t&&i_(t)}if(oy(),!j&&!er&&!ir&&!rr.current){let e=t.find(e=>e.type===`user`&&!e.isMeta),n=e?.type===`user`?Ys(e.message.content):null;n&&!n.startsWith(`<local-command-stdout>`)&&!n.startsWith(`<command-message>`)&&!n.startsWith(`<command-name>`)&&!n.startsWith(`<bash-input>`)&&(rr.current=!0,My(n,new AbortController().signal).then(e=>{e?nr(e):rr.current=!1},()=>{rr.current=!1}))}if(H.setState(e=>{let t=e.toolPermissionContext.alwaysAllowRules.command;return t===i||t?.length===i.length&&t.every((e,t)=>e===i[t])?e:{...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:i}}}}),!r){t.some(Cu)&&(Fi(zS()),sz?.setContextBlocked(!1)),da(),rn(null);return}let s=Co(e,t,n,a),{tools:c,mcpClients:l}=s.options;if(o!==void 0){let e=s.getAppState;s.getAppState=()=>({...e(),effortValue:o})}xg(`query_context_loading_start`);let[,,u,f,p]=await Promise.all([void 0,Px(F,V,H.getState().fastMode),pf(c,a,Array.from(F.additionalWorkingDirectories.keys()),l),Wl(),Ho()]),m={...f,...oz(l,Kl()?x_():void 0),...sz?.isProactiveActive()&&!ra.current?{terminalFocus:`The terminal is unfocused — the user is not actively watching.`}:{}};xg(`query_context_loading_end`);let _=of({mainThreadAgentDefinition:P,toolUseContext:s,customSystemPrompt:h,defaultSystemPrompt:u,appendSystemPrompt:g});s.renderedSystemPrompt=_,xg(`query_query_start`),bt(),Xe(),at();for await(let t of Uo({messages:e,systemPrompt:_,userContext:m,systemContext:p,canUseTool:xo,toolUseContext:s,querySource:Bl()}))To(t);if(typeof globalThis.fireCompanionObserver==`function`){let e=globalThis.fireCompanionObserver;e(pr.current,e=>V(t=>t.companionReaction===e?t:{...t,companionReaction:e}))}if(xg(`query_end`),process.env.USER_TYPE===`ant`&&ci.current.length>0){let e=ci.current,t=e.map(e=>e.ttftMs),n=e.map(e=>{let t=Math.round((e.endResponseLength-e.responseLengthBaseline)/4),n=e.lastTokenTime-e.firstTokenTime;return n>0?Math.round(t/(n/1e3)):0}),r=e.length>1,i=nt(),a=Be(),o=qe(),s=rt(),c=pt(),l=He(),u=Date.now()-Cn.current;K(e=>[...e,ah({ttftMs:r?Sz(t):t[0],otps:r?Sz(n):n[0],isP50:r,hookDurationMs:i>0?i:void 0,hookCount:a>0?a:void 0,turnDurationMs:u>0?u:void 0,toolDurationMs:o>0?o:void 0,toolCount:s>0?s:void 0,classifierDurationMs:c>0?c:void 0,classifierCount:l>0?l:void 0,configWriteCount:An()})])}da(),um(),await v?.(pr.current)},[d,da,Co,F,V,h,v,g,xo,P,To,er,j]),Oo=(0,Q.useCallback)(async(e,t,n,r,i,a,o,s)=>{if(Nn()){let e=pi(),t=vi();e&&t&&Gv(e,t,!0)}let c=mn.tryStart();if(c===null)return Y(`tengu_concurrent_onquery_detected`,{}),e.filter(e=>e.type===`user`&&!e.isMeta).map(e=>Ys(e.message.content)).filter(e=>e!==null).forEach((e,t)=>{h_({value:e,mode:`prompt`}),t===0&&Y(`tengu_concurrent_onquery_enqueued`,{})}),!1;try{ns.current=!1,cn(!1),Dn(),K(t=>[...t,...e]),si.current=0,Ne((o?Ju(o):null)??Me()),ci.current=[],$t([]),di(null);let c=pr.current;if(o&&await ya(o,c,e.length),a&&o&&!await a(o,c))return!0;try{await Do(c,e,t,n,r,i,s)}catch(e){throw e}}finally{if(mn.end(c)){cn(t.signal.aborted),yi(Date.now()),Ri.current=!1,da(),await Sa(pr.current,t.signal.aborted),ln.current(),process.env.USER_TYPE===`ant`&&!t.signal.aborted&&V(e=>e.tungstenActiveSession===void 0||e.tungstenPanelAutoHidden===!0?e:{...e,tungstenPanelAutoHidden:!0});let e;Me()!==null&&Me()>0&&!t.signal.aborted&&(e={tokens:tt(),limit:Me(),nudges:Ye()}),Ne(null);let n=Date.now()-Cn.current-wn.current;(n>3e4||e!==void 0)&&!t.signal.aborted&&!ke&&(ag(H.getState().tasks).some(e=>e.status===`running`)?(jn.current===null&&(jn.current=Cn.current),e&&(Mn.current=e)):K(t=>[...t,Kg(n,e,mi(t,Ca))])),rn(null)}if(t.signal.reason===`user-cancel`&&!mn.isActive&&Br.current===``&&Lo()===0&&!H.getState().viewingAgentTaskId){let e=pr.current,t=e.findLast(ab);t&&sb(e,e.lastIndexOf(t))&&(Uu(),un.current(t))}}return!0},[Do,V,da,mn,ya,Sa]),ko=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=se;if(!e||W||ko.current)return;ko.current=!0;async function t(e){if(e.clearContext){let t=e.message.planContent?ap():void 0,{clearConversation:n}=await import(`./conversation-Bt6QdGd-.js`);await n({setMessages:K,readFileState:Ha.current,discoveredSkillNames:Ka.current,loadedNestedMemoryPaths:Ja.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Fi}),rr.current=!1,nr(void 0),Wa.current.clear(),Ga.current=0,t&&p_(Fe(),t)}V(t=>{let n=e.mode?Hs(t.toolPermissionContext,KT(e.mode,e.allowedPrompts)):t.toolPermissionContext;return e.mode===`auto`&&(n=xc({...n,mode:`auto`,prePlanMode:void 0})),{...t,initialMessage:null,toolPermissionContext:n}}),Ll()&&bc(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.message.uuid),await Nr();let t=e.message.message.content;if(typeof t==`string`&&!e.message.planContent)Ao(t,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}});else{let t=Ki();rn(t),Oo([e.message],t,!0,[],Te)}setTimeout(e=>{e.current=!1},100,ko)}t(e)},[se,W,K,V,Oo,Te,Wt]);let Ao=(0,Q.useCallback)(async(e,t,n,r)=>{if(Or(),sz?.resumeProactive(),is(e)){let n=ro({content:e});K(e=>[...e,n]),r?.fromKeybinding||va({display:eg(e,Ur),pastedContents:ri}),Hr(``),t.setCursorOffset(0),t.clearBuffer(),ii({}),Wr(`prompt`),_t(void 0);return}if(!n&&e.trim().startsWith(`/`)){let n=nu(e,ri).trim(),i=n.indexOf(` `),a=i===-1?n.slice(1):n.slice(1,i),o=i===-1?``:n.slice(i+1).trim(),s=qt.find(e=>Xf(e)&&(e.name===a||e.aliases?.includes(a)||lp(e)===a));s?.name===`clear`&&hr.current&&(Y(`tengu_idle_return_action`,{action:`hint_converted`,variant:hr.current,idleMinutes:Math.round((Date.now()-zi.current)/6e4),messageCount:pr.current.length,totalInputTokens:wt()}),hr.current=!1);let c=mn.isActive&&(s?.immediate||r?.fromKeybinding);if(s&&c&&s.type===`local-jsx`){e.trim()===Br.current.trim()&&(Hr(``),t.setCursorOffset(0),t.clearBuffer(),ii({}));let n=cs(e).filter(e=>ri[e.id]?.type===`text`),i=n.length;Y(`tengu_paste_text`,{pastedTextCount:i,pastedTextBytes:n.reduce((e,t)=>e+(ri[t.id]?.content.length??0),0)}),Y(`tengu_immediate_command_executed`,{commandName:s.name,fromKeybinding:r?.fromKeybinding??!1}),(async()=>{let e=!1,n=(n,r)=>{e=!0,Wn({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0});let i=[];if(n&&r?.display!==`skip`&&(ut({key:`immediate-${s.name}`,text:n,priority:`immediate`}),!El())){let e=r?.displayArgs??o;i.push(Ag(ua(lp(s),e)),Ag(`<${Kr}>${$_(n)}</${Kr}>`))}r?.metaMessages?.length&&i.push(...r.metaMessages.map(e=>ro({content:e,isMeta:!0}))),i.length&&K(e=>[...e,...i]),Gr!==void 0&&(Hr(Gr.text),t.setCursorOffset(Gr.cursorOffset),ii(Gr.pastedContents),qr(void 0))},r=Co(pr.current,[],Ki(),Te),i=await(await s.load()).call(n,r,o);i&&!e&&Wn({jsx:i,shouldHidePromptInput:!1,isLocalJSXCommand:!0})})();return}}if(ni.isRemoteMode&&!e.trim())return;{let r=gn(`tengu_willow_mode`,`off`),i=Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES??75),a=Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD??1e5);if(r!==`off`&&!En().idleReturnDismissed&&!Ri.current&&!n&&!e.trim().startsWith(`/`)&&zi.current>0&&wt()>=a){let n=(Date.now()-zi.current)/6e4;if(n>=i&&r===`dialog`){Li({input:e,idleMinutes:n}),Hr(``),t.setCursorOffset(0),t.clearBuffer();return}}}r?.fromKeybinding||(va({display:n?e:eg(e,Ur),pastedContents:n?{}:ri}),Ur===`bash`&&YO(e.trim()));let i=!n&&e.trim().startsWith(`/`),a=!W||n||ni.isRemoteMode;if(Gr!==void 0&&!i&&a?(Hr(Gr.text),t.setCursorOffset(Gr.cursorOffset),ii(Gr.pastedContents),qr(void 0)):a&&(r?.fromKeybinding||(Hr(``),t.setCursorOffset(0)),ii({})),a&&(Wr(`prompt`),_t(void 0),oi(e=>e+1),t.clearBuffer(),aa.current=!1,!i&&Ur===`prompt`&&!n&&!ni.isRemoteMode&&(gr(e),Dn()),V(e=>({...e,attribution:Ev(e.attribution,e=>{Ep(e).catch(e=>{J(`Attribution: Failed to save snapshot: ${e}`)})})}))),n){let{queryRequired:t}=await qi(n.state,n.speculationSessionTimeSavedMs,n.setAppState,e,{setMessages:K,readFileState:Ha,cwd:ft()});if(t){let e=Ki();rn(e),Oo([],e,!0,[],Te)}return}if(ni.isRemoteMode&&!(i&&qt.find(t=>{let n=e.trim().slice(1).split(/\s/)[0];return Xf(t)&&(t.name===n||t.aliases?.includes(n)||lp(t)===n)})?.type===`local-jsx`)){let t=Object.values(ri),n=t.filter(e=>e.type===`image`),r=n.length>0?n.map(e=>e.id):void 0,i=e.trim(),a=e.trim();if(t.length>0){let n=[],r=[],o=e.trim();o&&(n.push({type:`text`,text:o}),r.push({type:`text`,text:o}));for(let e of t)if(e.type===`image`){let t={type:`base64`,media_type:e.mediaType??`image/png`,data:e.content};n.push({type:`image`,source:t}),r.push({type:`image`,source:t})}else n.push({type:`text`,text:e.content}),r.push({type:`text`,text:e.content});i=n,a=r}let o=ro({content:i,imagePasteIds:r});K(e=>[...e,o]),await ni.sendMessage(a,{uuid:o.uuid});return}await Nr(),await vP({input:e,helpers:t,queryGuard:mn,isExternalLoading:_n,mode:Ur,commands:qt,onInputChange:Hr,setPastedContents:ii,setToolJSX:Wn,getToolUseContext:Co,messages:pr.current,mainLoopModel:Te,pastedContents:ri,ideSelection:gt,setUserInputOnProcessing:gr,setAbortController:rn,abortController:nn,onQuery:Oo,setAppState:V,querySource:Bl(),onBeforeQuery:_,canUseTool:xo,addNotification:ut,setMessages:K,streamMode:Zt.current,hasInterruptibleToolInProgress:Zr.current}),(i||W)&&Gr!==void 0&&(Hr(Gr.text),t.setCursorOffset(Gr.cursorOffset),ii(Gr.pastedContents),qr(void 0))},[mn,W,_n,Ur,qt,Hr,Wr,ii,oi,_t,Wn,Co,Te,ri,gt,gr,rn,ut,Oo,Gr,qr,V,_,xo,$r,K,Nr,Or]),jo=(0,Q.useCallback)(async(e,t,n)=>{Bp(t)?($p(t.id,ro({content:e}),V),t.status===`running`?_o(t.id,e,V):Kd({agentId:t.id,prompt:e,toolUseContext:Co(pr.current,[],new AbortController,Te),canUseTool:xo}).catch(e=>{J(`resumeAgentBackground failed: ${Sr(e)}`),ut({key:`resume-agent-failed-${t.id}`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to resume agent: `,Sr(e)]}),priority:`low`})})):bp(t.id,e,void 0,V),Hr(``),n.setCursorOffset(0),n.clearBuffer()},[V,Hr,Co,xo,Te,ut]),Mo=(0,Q.useCallback)(()=>{let e=eo?sL(eo):`/issue`;to(null),Ao(e,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(t=>{J(`Auto-run ${e} failed: ${Sr(t)}`)})},[Ao,eo]),No=(0,Q.useCallback)(()=>{to(null)},[]),Po=(0,Q.useCallback)(()=>{Ao(process.env.USER_TYPE===`ant`?`/issue`:`/feedback`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(e=>{J(`Survey feedback request failed: ${e instanceof Error?e.message:String(e)}`)})},[Ao]),Io=(0,Q.useRef)(Ao);Io.current=Ao;let Ro=(0,Q.useCallback)(()=>{Io.current(`/rate-limit-options`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})},[]),zo=(0,Q.useCallback)(async()=>{if(so(!0),Rd()){WS(`tmux`,[`detach-client`],{stdio:`ignore`}),so(!1);return}if(Nl()!==null){ao((0,$.jsx)(bx,{showWorktree:!0,onDone:()=>{},onCancel:()=>{ao(null),so(!1)}}));return}let e=await(await s_.load()).call(()=>{});ao(e),e===null&&so(!1)},[]),Bo=(0,Q.useCallback)(()=>{Di(e=>!e)},[]),Wo=(0,Q.useCallback)(e=>{let t=pr.current,n=t.lastIndexOf(e);if(n===-1)return;Y(`tengu_conversation_rewind`,{preRewindMessageCount:t.length,postRewindMessageCount:n,messagesRemoved:t.length-n,rewindToMessageIndex:n}),K(t.slice(0,n)),Fi(zS()),Sd();let r=e.permissionMode;V(e=>({...e,toolPermissionContext:r&&e.toolPermissionContext.mode!==r?{...e.toolPermissionContext,mode:r}:e.toolPermissionContext,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null}}))},[K,V]),Go=(0,Q.useCallback)(e=>{Wo(e);let t=kp(e);if(t&&(Hr(t.text),Wr(t.mode)),Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`image`)){let t=e.message.content.filter(e=>e.type===`image`);if(t.length>0){let n={};t.forEach((t,r)=>{if(t.source.type===`base64`){let i=e.imagePasteIds?.[r]??r+1;n[i]={id:i,type:`image`,content:t.source.data,mediaType:t.source.media_type}}}),ii(n)}}},[Wo,Hr]);un.current=Go;let Ko=(0,Q.useCallback)(async e=>{setImmediate((e,t)=>e(t),Go,e)},[Go]),qo=e=>{let t=e.slice(0,24);return G.findIndex(e=>e.uuid.slice(0,24)===t)},{enter:Yo,handlers:Xo}=Za(Cr,wr,Er,{copy:e=>void Ce(e).then(e=>{e&&process.stdout.write(e),ut({key:`selection-copied`,text:`copied`,color:`success`,priority:`immediate`,timeoutMs:2e3})}),edit:async e=>{let t=qo(e.uuid),n=t>=0?G[t]:void 0;if(!n||!ab(n))return;let r=!await qa(oe,n.uuid),i=sb(G,t);r&&i?(mo(),Ko(n)):(Ai(n),Di(!0))}});async function Zo(){$a();let e=await Pu();if(e.length>0){let t=e.map(e=>` [${e.type}] ${e.path} (${e.content.length} chars)${e.parent?` (included by ${e.parent})`:``}`).join(`
|
|
142
|
+
</goal-steering>`}var HR=t((()=>{})),UR=r({useGoalContinuation:()=>GR});function WR(e){J(`[goal] hook: ${e}`)}function GR(e){let t=(0,KR.useRef)(e);t.current=e;let n=(0,KR.useRef)(!1),r=(0,KR.useRef)(!1);(0,KR.useLayoutEffect)(()=>{if(e.isLoading){n.current=!1;return}if(e.isQueryActiveNow?.()){WR(`skip: queryActiveNow=true`);return}if(e.wasAborted){WR(`skip: wasAborted=true`);return}if(n.current)return;if(Vl().length>0){WR(`skip: yielding to queued user messages`);return}if(e.hasActiveLocalJsxUI){WR(`skip: activeLocalJsxUI`);return}if(e.isInPlanMode){WR(`skip: planMode`);return}let t=Rs();if(!t){r.current=!1;return}if(t.status===`active`&&(r.current=!1),t.status===`budget_limited`&&!r.current){r.current=!0,n.current=!0;let e=VR(t);J(`[goal] hook: budget limit reached, injecting wrap-up prompt`),h_({value:e,mode:`prompt`,priority:`now`,isMeta:!0,origin:`goal-budget-limit`,skipSlashCommands:!0});return}if(t.status!==`active`){WR(`skip: status="${t.status}" (not active)`);return}if(t.turnsExecuted>=150){ou()&&(Ed(),e.onMaxTurnsReached?.()),J(`[goal] hook: MAX_GOAL_TURNS (150) reached, stopping`);return}n.current=!0;let i=b_();Ed();let a=BR(t);J(`[goal] hook: enqueuing turn ${i} for "${t.objective.slice(0,60)}"`),h_({value:a,mode:`prompt`,priority:`now`,isMeta:!0,origin:`goal-continuation`,skipSlashCommands:!0}),e.onContinuationEnqueued?.({turn:i,objective:t.objective})},[e.isLoading,e.wasAborted,e.queuedCommandsLength,e.hasActiveLocalJsxUI,e.isInPlanMode])}var KR,qR=t((()=>{KR=n(L(),1),q(),ba(),HR(),Ss()})),JR=r({AntModelSwitchCallout:()=>YR,shouldShowModelSwitchCallout:()=>XR});function YR(e){return null}function XR(){return!1}var ZR=t((()=>{})),QR=r({UndercoverAutoCallout:()=>$R});function $R({onDone:e}){return(0,ez.useEffect)(()=>{e()},[e]),null}var ez,tz=t((()=>{ez=n(L(),1)}));ot(),ms(),Ci(),f(),H(),ny(),jb(),Rm(),hu(),q(),s(),ki(),qf(),Bv(),Vm(),Yi(),_i(),kh(),fa(),Oo(),Dm(),ub(),As(),Xp(),Cs(),gf(),za(),Np(),gr(),Zr(),wr(),lo(),Pg(),Wo(),xd(),lr(),In(),Cr(),an(),ql(),Ny(),Xr(),Lg(),Qd(),Ly(),hd(),Ma(),ld(),Rb(),X(),Ng(),go(),Up(),pc(),Yn(),ma(),yc(),Ss(),_f(),vf(),so(),im(),Da();var nz=(yR(),e(sR)).useVoiceIntegration,rz=(yR(),e(sR)).VoiceKeybindingHandler,iz=process.env.USER_TYPE===`ant`?(wR(),e(bR)).useFrustrationDetection:()=>({state:`closed`,handleTranscriptSelect:()=>{}}),az=process.env.USER_TYPE===`ant`?(DR(),e(TR)).useAntOrgWarningNotification:()=>{},oz=(m_(),e(el)).getCoordinatorUserContext,sz=(vv(),e(sv)),cz=e=>()=>{},lz=()=>!1,uz=()=>null,dz=(e,t)=>!1,fz=(MR(),e(OR)).useProactive,pz=(RR(),e(NR)).useScheduledTasks,mz=(qR(),e(UR)).useGoalContinuation,hz=()=>({relayPipeMessage:()=>!1,pipeReturnHadErrorRef:{current:!1}}),gz=()=>({routeToSelectedPipes:()=>!1}),_z=process.env.USER_TYPE===`ant`?(ZR(),e(JR)).AntModelSwitchCallout:null,vz=process.env.USER_TYPE===`ant`?(ZR(),e(JR)).shouldShowModelSwitchCallout:()=>!1,yz=process.env.USER_TYPE===`ant`?(tz(),e(QR)).UndercoverAutoCallout:null,bz=[],xz=3e3;function Sz(e){let t=[...e].sort((e,t)=>e-t),n=Math.floor(t.length/2);return t.length%2==0?Math.round((t[n-1]+t[n])/2):t[n]}function Cz({showAllInTranscript:e,virtualScroll:t,searchBadge:n,suppressShowAll:r=!1,status:i}){let a=fc(`app:toggleTranscript`,`Global`,`ctrl+o`),o=fc(`transcript:toggleShowAll`,`Transcript`,`ctrl+e`);return(0,$.jsxs)(U,{noSelect:!0,alignItems:`center`,alignSelf:`center`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,children:[(0,$.jsxs)(R,{dimColor:!0,children:[`Showing detailed transcript · `,a,` to toggle`,n?` · n/N to navigate`:t?` · ${p.arrowUp}${p.arrowDown} scroll · home/end top/bottom`:r?``:` · ${o} to ${e?`collapse`:`show all`}`]}),i?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{children:[i,` `]})]}):n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(U,{flexGrow:1}),(0,$.jsxs)(R,{dimColor:!0,children:[n.current,`/`,n.count,` `]})]}):null]})}function wz({jumpRef:e,count:t,current:n,onClose:r,onCancel:i,setHighlight:a,initialQuery:o}){let{query:s,cursorOffset:c}=px({isActive:!0,initialQuery:o,onExit:()=>r(s),onCancel:i}),[l,u]=Q.useState(`building`);Q.useEffect(()=>{let t=!0,n,r=e.current?.warmSearchIndex;if(!r){u(null);return}return u(`building`),r().then(e=>{t&&(e<20?u(null):(u({ms:e}),n=setTimeout(()=>t&&u(null),2e3)))}),()=>{t=!1,n&&clearTimeout(n)}},[e]);let d=l!==`building`;(0,Q.useEffect)(()=>{d&&(e.current?.setSearchQuery(s),a(s))},[e,s,a,d]);let f=c,p=f<s.length?s[f]:` `;return(0,$.jsxs)(U,{borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,marginTop:1,paddingLeft:2,width:`100%`,noSelect:!0,children:[(0,$.jsx)(R,{children:`/`}),(0,$.jsx)(R,{children:s.slice(0,f)}),(0,$.jsx)(R,{inverse:!0,children:p}),f<s.length&&(0,$.jsx)(R,{children:s.slice(f+1)}),(0,$.jsx)(U,{flexGrow:1}),l===`building`?(0,$.jsx)(R,{dimColor:!0,children:`indexing… `}):l?(0,$.jsxs)(R,{dimColor:!0,children:[`indexed in `,l.ms,`ms `]}):t===0&&s?(0,$.jsx)(R,{color:`error`,children:`no matches `}):t>0?(0,$.jsxs)(R,{dimColor:!0,children:[n,`/`,t,` `]}):null]})}var Tz=[`⠂`,`⠐`],Ez=`✳`,Dz=960;function Oz({isAnimating:e,title:t,disabled:n,noPrefix:r}){let i=le(),[a,o]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{if(n||r||!e||!i)return;let t=setInterval(e=>e(e=>(e+1)%Tz.length),Dz,o);return()=>clearInterval(t)},[n,r,e,i]);let s=e?Tz[a]??Ez:Ez;return ve(n?null:r?t:`${s} ${t}`),null}var kz=`<${qr}>`;function Az(e){return e.type===`text`&&typeof e.text==`string`&&e.text.includes(kz)}function jz({commands:t,debug:n,initialTools:r,initialMessages:i,pendingHookMessages:a,initialFileHistorySnapshots:o,initialContentReplacements:s,initialAgentName:l,initialAgentColor:u,mcpClients:d,dynamicMcpConfig:f,autoConnectIdeFlag:p,strictMcpConfig:m=!1,systemPrompt:h,appendSystemPrompt:g,onBeforeQuery:_,onTurnComplete:v,disabled:y=!1,mainThreadAgentDefinition:b,disableSlashCommands:x=!1,taskListId:S,remoteSessionConfig:C,directConnectConfig:w,sshSession:E,thinkingConfig:D}){let O=!!C,j=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_TERMINAL_TITLE),[]),M=(0,Q.useMemo)(()=>process.env.USER_TYPE===`ant`&&c(process.env.CLAUDE_MORERIGHT),[]),N=(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_VIRTUAL_SCROLL),[]);(0,Q.useMemo)(()=>c(process.env.CLAUDE_CODE_DISABLE_MESSAGE_ACTIONS),[]),(0,Q.useEffect)(()=>(J(`[REPL:mount] REPL mounted, disabled=${y}`),()=>J(`[REPL:unmount] REPL unmounting`)),[y]);let[P,ee]=(0,Q.useState)(b),F=Z(e=>e.toolPermissionContext),te=Z(e=>e.verbose),ne=Z(e=>e.mcp),re=Z(e=>e.plugins),L=Z(e=>e.agentDefinitions),oe=Z(e=>e.fileHistory),se=Z(e=>e.initialMessage),ue=pD(),de=Z(e=>e.spinnerTip),fe=Z(e=>e.expandedView)===`tasks`,pe=Z(e=>e.pendingWorkerRequest),me=Z(e=>e.pendingSandboxRequest),z=Z(e=>e.teamContext),B=Z(e=>e.tasks),he=Z(e=>e.workerSandboxPermissions),ge=Z(e=>e.elicitation),_e=Z(e=>e.ultraplanPendingChoice),ve=Z(e=>e.ultraplanLaunchPending),ye=Z(e=>e.viewingAgentTaskId),V=Af(),be=ye?B[ye]:void 0,xe=Bp(be)&&be.retain&&!be.diskLoaded;(0,Q.useEffect)(()=>{if(!ye||!xe)return;let e=ye;rp(So(e)).then(t=>{V(n=>{let r=n.tasks[e];if(!Bp(r)||r.diskLoaded||!r.retain)return n;let i=r.messages??[],a=new Set(i.map(e=>e.uuid)),o=t?t.messages.filter(e=>!a.has(e.uuid)):[];return{...n,tasks:{...n.tasks,[e]:{...r,messages:[...o,...i],diskLoaded:!0}}}})})},[ye,xe,V]);let H=ef(),we=A(),Te=Lb(),[Ee,De]=(0,Q.useState)(t);DP(O?void 0:vt(),De);let ke=Q.useSyncExternalStore(sz?.subscribeToProactiveChanges??cz,sz?.isProactiveActive??lz),Ae=Q.useSyncExternalStore(sz?.subscribeToProactiveChanges??cz,sz?.getNextTickAt??uz),je=Z(e=>e.isBriefOnly),Pe=(0,Q.useMemo)(()=>Iu(F),[F,ke,je]);Mx();let[Ie,Le]=(0,Q.useState)(f),Re=(0,Q.useCallback)(e=>{Le(e)},[Le]),[ze,Ve]=(0,Q.useState)(`prompt`),[Ge,Ke]=(0,Q.useState)(!1),[Je,Ze]=(0,Q.useState)(!1),[Qe,$e]=(0,Q.useState)(``),it=(0,Q.useRef)(0),ot=(0,Q.useRef)(void 0),st=(0,Q.useRef)(!1),{addNotification:ut,removeNotification:dt}=Bh(),mt=dz,ht=TP(d,ne.clients),[gt,_t]=(0,Q.useState)(void 0),[yt,xt]=(0,Q.useState)(null),[Ct,Tt]=(0,Q.useState)(null),[Et,Dt]=(0,Q.useState)(!1),[Ot,At]=(0,Q.useState)(()=>process.env.USER_TYPE===`ant`?vz():!1),[jt,Mt]=(0,Q.useState)(()=>JP(Te)),Nt=Z(e=>e.showRemoteCallout),[Pt,Ft]=(0,Q.useState)(()=>SS());HI(),GI(),BI({ideSelection:gt,mcpClients:ht,ideInstallationStatus:Ct}),QF({mcpClients:ht}),OI(),kI(),hx(),FI(Te),rL(),II(Te),RI(),az(),wF(),PF(),BF(),tI(),QI();let{recommendation:It,handleResponse:Lt}=_I(),{recommendation:Rt,handleResponse:zt}=bI(),Bt=DI(),Vt=(0,Q.useMemo)(()=>[...Pe,...r],[Pe,r]);zy({enabled:!O});let Ht=c_();(0,Q.useEffect)(()=>{O||MI(V)},[V,O]),HF(O?bz:ht,F.mode),QN(V,i,{enabled:!O});let Ut=kb(Vt,ne.tools,F),{tools:Wt,allowedAgentTypes:Gt}=(0,Q.useMemo)(()=>{if(!P)return{tools:Ut,allowedAgentTypes:void 0};let e=wc(P,Ut,!1,!0);return{tools:e.resolvedTools,allowedAgentTypes:e.allowedAgentTypes}},[P,Ut]),Kt=EP(EP(Ee,re.commands),ne.commands),qt=(0,Q.useMemo)(()=>x?[]:Kt,[x,Kt]);NC(O?bz:ne.clients),AP(O?bz:ne.clients,_t);let[Jt,Yt]=(0,Q.useState)(`responding`),Zt=(0,Q.useRef)(Jt);Zt.current=Jt;let[Qt,$t]=(0,Q.useState)([]),[en,tn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{if(en&&!en.isStreaming&&en.streamingEndedAt){let e=3e4-(Date.now()-en.streamingEndedAt);if(e>0){let t=setTimeout(tn,e,null);return()=>clearTimeout(t)}else tn(null)}},[en]);let[nn,rn]=(0,Q.useState)(null),an=(0,Q.useRef)(null);an.current=nn;let on=(0,Q.useRef)(0),[sn,cn]=(0,Q.useState)(!1),ln=(0,Q.useRef)(()=>{}),un=(0,Q.useRef)(()=>{}),dn=(0,Q.useRef)(null),fn=(0,Q.useRef)(null),pn=(0,Q.useRef)(0),mn=Q.useRef(new dC).current,hn=Q.useSyncExternalStore(mn.subscribe,mn.getSnapshot),[_n,vn]=Q.useState(C?.hasInitialPrompt??!1),W=hn||_n,[yn,bn]=Q.useState(void 0),xn=Q.useRef(0),Sn=Q.useRef(!1),Cn=Q.useRef(0),wn=Q.useRef(0),Tn=Q.useRef(null),Dn=Q.useCallback(()=>{Cn.current=Date.now(),wn.current=0,Tn.current=null},[]),On=Q.useRef(!1);hn&&!On.current&&Dn(),On.current=hn;let kn=Q.useCallback(e=>{vn(e),e&&Dn()},[Dn]),jn=Q.useRef(null),Mn=Q.useRef(void 0),Pn=Q.useRef(void 0),[Fn,In]=Q.useState(!1),[Ln,Rn]=(0,Q.useState)(null);(0,Q.useEffect)(()=>{Ln?.notifications&&Ln.notifications.forEach(e=>{ut({key:`auto-updater-notification`,text:e,priority:`low`})})},[Ln,ut]),(0,Q.useEffect)(()=>{El()&&Ra().then(e=>{e&&ut({key:`tmux-mouse-hint`,text:e,priority:`low`})})},[]);let[zn,Bn]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{process.env.USER_TYPE===`ant`&&(async()=>{let{isInternalModelRepo:e}=await import(`./commitAttribution-DKvggTZx.js`);await e();let{shouldShowUndercoverAutoNotice:t}=await import(`./undercover-DSp7SB7e.js`);t()&&Bn(!0)})()},[]);let[Vn,Hn]=(0,Q.useState)(null),Un=(0,Q.useRef)(null),Wn=(0,Q.useCallback)(e=>{if(e?.isLocalJSXCommand){let{clearLocalJSX:t,...n}=e;Un.current={...n,isLocalJSXCommand:!0},Hn(n);return}if(Un.current){if(e?.clearLocalJSX){Un.current=null,Hn(null),on.current=Date.now();return}return}if(e?.clearLocalJSX){Hn(null);return}Hn(e)},[]),[Gn,Kn]=(0,Q.useState)([]),[qn,Jn]=(0,Q.useState)(null),[Yn,Xn]=(0,Q.useState)([]),[Zn,Qn]=(0,Q.useState)([]),$n=(0,Q.useRef)(new Map),er=Z(e=>e.settings.terminalTitleFromRename)===!1?void 0:Bd(Fe()),[tr,nr]=(0,Q.useState)(),rr=(0,Q.useRef)((i?.length??0)>0),ir=P?.agentType,ar=er??ir??tr??`Claude Code`,or=Gn.length>0||Zn.length>0||pe||me,sr=Vn?.isLocalJSXCommand===!0&&Vn?.jsx!=null,cr=W&&!or&&!sr;(0,Q.useEffect)(()=>{if(W&&!or&&!sr)return iC(),()=>aC()},[W,or,sr]);let lr=or||sr?`waiting`:W?`busy`:`idle`,ur=lr===`waiting`?Gn.length>0?`approve ${Gn[0].tool.name}`:pe?`worker request`:me?`sandbox request`:sr?`dialog open`:`input needed`:void 0;(0,Q.useEffect)(()=>{vl({status:lr,waitingFor:ur})},[lr,ur]);let dr=gn(`tengu_terminal_sidebar`,!1)&&(En().showStatusInTerminalTab??!1);T(j||!dr?null:lr),(0,Q.useEffect)(()=>(_h(Kn),()=>Wu()),[Kn]);let[G,fr]=(0,Q.useState)(i??[]),pr=(0,Q.useRef)(G),hr=(0,Q.useRef)(!1),K=(0,Q.useCallback)(e=>{let t=pr.current,n=typeof e==`function`?e(pr.current):e;if(pr.current=n,n.length<xn.current)xn.current=0;else if(n.length>t.length&&Sn.current){let e=n.length-t.length;(t.length===0||n[0]===t[0]?n.slice(-e):n.slice(0,e)).some(il)?Sn.current=!1:xn.current=n.length}fr(n)},[]),gr=(0,Q.useCallback)(e=>{e===void 0?Sn.current=!1:(xn.current=pr.current.length,Sn.current=!0),bn(e)},[]),{dividerIndex:_r,dividerYRef:vr,onScrollAway:yr,onRepin:br,jumpToNew:q,shiftDivider:xr}=Ex(G.length);MF(G,K,W);let[Cr,wr]=(0,Q.useState)(null),Er=(0,Q.useRef)(null),Dr=(0,Q.useMemo)(()=>Cx(G,_r),[_r,G.length]),Or=(0,Q.useCallback)(()=>{dn.current?.scrollToBottom(),br(),wr(null)},[br,wr]),kr=G.at(-1),Ar=kr!=null&&il(kr);(0,Q.useEffect)(()=>{Ar&&Or()},[Ar,kr,Or]);let{maybeLoadOlder:jr}=EN({config:C,setMessages:K,scrollRef:dn,onPrepend:xr}),Mr=(0,Q.useCallback)((e,t)=>{pn.current=Date.now(),e?br():(yr(t),jr(t),V(e=>e.companionReaction===void 0?e:{...e,companionReaction:void 0}))},[br,yr,jr,V]),Nr=HN(a,K),Pr=(0,Q.useDeferredValue)(Q.useMemo(()=>G.length>500?G.slice(-500):G,[G])),Fr=G.length-Pr.length;Fr>0&&J(`[useDeferredValue] Messages deferred by ${Fr} (${Pr.length}→${G.length})`);let[Ir,Lr]=(0,Q.useState)(null),[Rr,zr]=(0,Q.useState)(()=>mS()),Br=(0,Q.useRef)(Rr);Br.current=Rr;let Vr=(0,Q.useRef)(null),Hr=(0,Q.useCallback)(e=>{mt(Br.current,e)||(Br.current===``&&e!==``&&Date.now()-pn.current>=xz&&Or(),Br.current=e,zr(e),In(e.trim().length>0))},[In,Or,mt]);(0,Q.useEffect)(()=>{if(Rr.trim().length===0)return;let e=setTimeout(In,1500,!1);return()=>clearTimeout(e)},[Rr]);let[Ur,Wr]=(0,Q.useState)(`prompt`),[Gr,qr]=(0,Q.useState)(),Jr=(0,Q.useCallback)(e=>{let t=new Set(e);De(e=>e.filter(e=>t.has(e.name)||Vo.has(e)))},[De]),[Yr,Xr]=(0,Q.useState)(new Set),Zr=(0,Q.useRef)(!1),$r=dN({config:C,setMessages:K,setIsLoading:kn,onInit:Jr,setToolUseConfirmQueue:Kn,tools:Vt,setStreamingToolUses:$t,setStreamMode:Yt,setInProgressToolUseIDs:Xr}),ei=mN({config:w,setMessages:K,setIsLoading:kn,setToolUseConfirmQueue:Kn,tools:Vt}),ti=hN({session:E,setMessages:K,setIsLoading:kn,setToolUseConfirmQueue:Kn,tools:Vt}),ni=ti.isRemoteMode?ti:ei.isRemoteMode?ei:$r,[ri,ii]=(0,Q.useState)({}),[ai,oi]=(0,Q.useState)(0),si=(0,Q.useRef)(0),ci=(0,Q.useRef)([]),li=(0,Q.useCallback)(e=>{let t=si.current;if(si.current=e(t),si.current>t){let e=ci.current;if(e.length>0){let t=e.at(-1);t.lastTokenTime=Date.now(),t.endResponseLength=si.current}}},[]),[ui,di]=(0,Q.useState)(null),fi=!(Z(e=>e.settings.prefersReducedMotion)??!1)&&!Se(),hi=(0,Q.useCallback)(e=>{fi&&di(e)},[fi]),gi=ui&&fi&&ui.substring(0,ui.lastIndexOf(`
|
|
143
|
+
`)+1)||null,[_i,yi]=(0,Q.useState)(0),[bi,xi]=(0,Q.useState)(null),[Si,Ci]=(0,Q.useState)(null),[wi,Ti]=(0,Q.useState)(null),[Ei,Di]=(0,Q.useState)(!1),[ki,Ai]=(0,Q.useState)(void 0),[ji,Mi]=(0,Q.useState)(!1),[Ni,Fi]=(0,Q.useState)(zS()),[Ii,Li]=(0,Q.useState)(null),Ri=(0,Q.useRef)(!1),zi=(0,Q.useRef)(_i);zi.current=_i;let[Bi]=(0,Q.useState)(()=>({current:ys(i,s)}));xl(()=>{Bi.current=Rl()});let[Vi,Hi]=(0,Q.useState)(En().hasAcknowledgedCostThreshold),[Ui,Wi]=(0,Q.useState)(`INSERT`),[Gi,Ji]=(0,Q.useState)(!1),[Yi,Xi]=(0,Q.useState)(!1),[Zi,$i]=(0,Q.useState)(!1);(0,Q.useEffect)(()=>{_e&&Gi&&Ji(!1)},[_e,Gi]);let ta=le(),ra=(0,Q.useRef)(ta);ra.current=ta;let[ia]=ae(),aa=Q.useRef(!1),ca=(0,Q.useCallback)(()=>{if(aa.current)return;aa.current=!0;let e=pr.current.slice(Ga.current);for(let t of tg(e))Wa.current.add(t);Ga.current=pr.current.length,GF({theme:ia,readFileState:Ha.current,bashTools:Wa.current}).then(async e=>{if(e){let t=await e.content({theme:ia});V(e=>({...e,spinnerTip:t})),KF(e)}else V(e=>e.spinnerTip===void 0?e:{...e,spinnerTip:void 0})})},[V,ia]),da=(0,Q.useCallback)(()=>{kn(!1),gr(void 0),si.current=0,ci.current=[],di(null),$t([]),xi(null),Ci(null),Ti(null),ca(),xv(),Sm()},[ca]),fa=(0,Q.useMemo)(()=>ag(B).some(e=>e.status===`running`),[B]);(0,Q.useEffect)(()=>{if(!fa&&jn.current!==null){let e=Date.now()-jn.current,t=Mn.current;jn.current=null,Mn.current=void 0,K(n=>[...n,Kg(e,t,mi(n,Ca))])}},[fa,K]);let ma=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{{if(F.mode!==`auto`){ma.current=!1;return}if(ma.current||(En().autoPermissionsNotificationCount??0)>=3)return;let e=setTimeout((e,t)=>{e.current=!0,kt(e=>{let t=e.autoPermissionsNotificationCount??0;return t>=3?e:{...e,autoPermissionsNotificationCount:t+1}}),t(e=>[...e,Na($F,`warning`)])},800,ma,K);return()=>clearTimeout(e)}},[F.mode,K]);let ga=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ga.current)return;let e=Nl();if(!e?.creationDurationMs||e.usedSparsePaths||e.creationDurationMs<15e3)return;ga.current=!0;let t=Math.round(e.creationDurationMs/1e3);K(e=>[...e,Na(`Worktree creation took ${t}s. For large repos, set \`worktree.sparsePaths\` in .claude/settings.json to check out only the directories you need — e.g. \`{"worktree": {"sparsePaths": ["src", "packages/foo"]}}\`.`,`info`)])},[K]);let _a=(0,Q.useMemo)(()=>{let e=G.findLast(e=>e.type===`assistant`);if(e?.type!==`assistant`)return!1;let t=e.message?.content,n=(Array.isArray(t)?t:[]).filter(e=>e.type===`tool_use`&&Yr.has(e.id));return n.length>0&&n.every(e=>e.type===`tool_use`&&e.name===`Sleep`)},[G,Yr]),{onBeforeQuery:ya,onTurnComplete:Sa,render:Ta}=zN({enabled:M,setMessages:K,inputValue:Rr,setInputValue:Hr,setToolJSX:Wn}),Da=(!Vn||Vn.showSpinner===!0)&&Gn.length===0&&Zn.length===0&&(W||yn||fa||Lo()>0)&&!pe&&!_a&&(!gi||je),Oa=Gn.length>0||Zn.length>0||Yn.length>0||ge.queue.length>0||he.queue.length>0,ka=nF(G,W,ai,`session`,Oa),ja=RN(K),Ma=_L(G,ai),Fa=(0,Q.useMemo)(()=>({...ka,handleSelect:e=>{no.current=!1;let t=ka.handleSelect(e);e===`bad`&&!t&&oL(`feedback_survey_bad`)&&(to(`feedback_survey_bad`),no.current=!0)}}),[ka]),Ia=hF(G,W,Oa,{enabled:!O}),La=uF(G,W,Oa,{enabled:!O}),za=iz(G,W,Oa,Fa.state!==`closed`||Ia.state!==`closed`||La.state!==`closed`);VP({autoConnectIdeFlag:p,ideToInstallExtension:yt,setDynamicMcpConfig:Le,setShowIdeOnboarding:Dt,setIDEInstallationState:Tt}),qF(o,oe,e=>V(t=>({...t,fileHistory:e})));let Ba=(0,Q.useCallback)(async(t,n,r)=>{let i=performance.now();try{let a=Sh(n.messages);{let t=(m_(),e(el)).matchSessionMode(n.mode);if(t){let{getAgentDefinitionsWithOverrides:n,getActiveAgentsFromList:r}=(Im(),e(pg));n.cache.clear?.();let i=await n(ft());V(e=>({...e,agentDefinitions:{...i,allAgents:i.allAgents,activeAgents:r(i.allAgents)}})),a.push(Na(t,`warning`))}}let o=bm();await ea(`resume`,{getAppState:()=>H.getState(),setAppState:V,signal:AbortSignal.timeout(o),timeoutMs:o});let s=await na(`resume`,{sessionId:t,agentType:P?.agentType,model:Te});a.push(...s),r===`fork`?Kf(n,xs(t)):ch(n,xs(t)),_b(n,V),n.fileHistorySnapshots&&Pa(n);let{agentDefinition:c}=hb(n.agentSetting,b,L);ee(c),V(e=>({...e,agent:c?.agentType})),V(e=>({...e,standaloneAgentContext:gb(n.agentName,n.agentColor)})),Vg(n.agentName),Ya(a,n.projectPath??ft()),da(),rn(null),Fi(t);let l=_c(t);Lp(),St(),lt(xs(t),n.fullPath?AS(n.fullPath):null);let{renameRecordingForSession:u}=await import(`./asciicast-DA6TudSH.js`);if(await u(),await ep(),$h(),vd(n),n.goal){let{hydrateGoalFromTranscript:r}=(Sp(),e(jh)),i=new Map;i.set(t,n.goal),r(i,t)}if(rr.current=!0,nr(void 0),r!==`fork`)vb(),yb(n.worktreeSession),Qi(),pa({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V});else{let e=Nl();e&&Ua(e)}{let{saveMode:t}=(go(),e(la)),{isCoordinatorMode:n}=(m_(),e(el));t(n()?`coordinator`:`normal`)}l&&ct(l),Bi.current&&r!==`fork`&&(Bi.current=uh(a,n.contentReplacements??[])),K(()=>a),Wn(null),Hr(``),Y(`tengu_session_resumed`,{entrypoint:r,success:!0,resume_duration_ms:Math.round(performance.now()-i)})}catch(e){throw Y(`tengu_session_resumed`,{entrypoint:r,success:!1}),e}},[da,V]),[Va]=(0,Q.useState)(()=>iv(100)),Ha=(0,Q.useRef)(Va),Wa=(0,Q.useRef)(new Set),Ga=(0,Q.useRef)(0),Ka=(0,Q.useRef)(new Set),Ja=(0,Q.useRef)(new Set),Ya=(0,Q.useCallback)((e,t)=>{let n=Tm(e,t,100);Ha.current=ov(Ha.current,n);for(let t of tg(e))Wa.current.add(t)},[]);(0,Q.useEffect)(()=>{i&&i.length>0&&(Ya(i,ft()),pa({abortController:new AbortController,getAppState:()=>H.getState(),setAppState:V}))},[]);let{status:Qa,reverify:$a}=UN(),[eo,to]=(0,Q.useState)(null),no=(0,Q.useRef)(!1),[io,ao]=(0,Q.useState)(null),[oo,so]=(0,Q.useState)(!1),co=!W&&ji;function lo(){if(oo||io)return;if(Ei)return`message-selector`;if(Fn)return;if(Yn[0])return`sandbox-permission`;let e=!Vn||Vn.shouldContinueAnimation;if(e&&Gn[0])return`tool-permission`;if(e&&Zn[0])return`prompt`;if(e&&he.queue[0])return`worker-sandbox-permission`;if(e&&ge.queue[0])return`elicitation`;if(e&&co)return`cost`;if(e&&Ii)return`idle-return`;if(e&&!W&&_e)return`ultraplan-choice`;if(e&&!W&&ve)return`ultraplan-launch`;if(e&&Et)return`ide-onboarding`;if(process.env.USER_TYPE===`ant`&&e&&Ot)return`model-switch`;if(process.env.USER_TYPE===`ant`&&e&&zn)return`undercover-callout`;if(e&&jt)return`effort-callout`;if(e&&Nt)return`remote-callout`;if(e&&It)return`lsp-recommendation`;if(e&&Rt)return`plugin-hint`;if(e&&Bt.visible)return`search-extra-tools-hint`;if(e&&Pt)return`desktop-upsell`}let uo=lo(),fo=Fn&&(Yn[0]||Gn[0]||Zn[0]||he.queue[0]||ge.queue[0]||co);Pn.current=uo,(0,Q.useEffect)(()=>{if(!W)return;let e=uo===`tool-permission`,t=Date.now();e&&Tn.current===null?Tn.current=t:!e&&Tn.current!==null&&(wn.current+=t-Tn.current,Tn.current=null)},[uo,W]);let po=(0,Q.useRef)(uo);(0,Q.useLayoutEffect)(()=>{po.current===`tool-permission`!=(uo===`tool-permission`)&&Or(),po.current=uo},[uo,Or]);function mo(){if(uo!==`elicitation`){if(on.current!==0&&Date.now()-on.current<500){on.current=0,J(`[onCancel] suppressed: local-jsx panel just dismissed`);return}if(on.current=0,J(`[onCancel] focusedInputDialog=${uo} streamMode=${Jt}`),sz?.pauseProactive(),mn.getSnapshot()){let{getGoal:t,pauseGoal:n}=(ba(),e(sl)),{persistCurrentGoal:r}=(Sp(),e(jh));t()?.status===`active`&&(n(),r())}if(cn(!0),mn.forceEnd(),Ri.current=!1,ui?.trim()&&K(e=>[...e,mp({content:ui})]),da(),Ne(null),uo===`tool-permission`)Gn[0]?.onAbort(),Kn([]);else if(uo===`prompt`){for(let e of Zn)e.reject(Error(`Prompt cancelled by user`));Qn([]),nn?.abort(`user-cancel`)}else ni.isRemoteMode?ni.cancelRequest():nn?.abort(`user-cancel`);rn(null),Sa(pr.current,!0)}}let ho=(0,Q.useCallback)(()=>{let e=Au(Rr,0);e&&(Hr(e.text),Wr(`prompt`),e.images.length>0&&ii(t=>{let n={...t};for(let t of e.images)n[t.id]=t;return n}))},[Hr,Wr,Rr,ii]),vo={setToolUseConfirmQueue:Kn,onCancel:mo,onAgentsKilled:()=>K(e=>[...e,Vf()]),isMessageSelectorVisible:Ei||!!Gi,screen:ze,abortSignal:nn?.signal,popCommandFromQueue:ho,vimMode:Ui,isLocalJSXCommand:Vn?.isLocalJSXCommand,isSearchingHistory:Yi,isHelpOpen:Zi,inputMode:Ur,inputValue:Rr,streamMode:Jt};(0,Q.useEffect)(()=>{Ue()>=5&&!ji&&!Vi&&(Y(`tengu_cost_threshold_reached`,{}),Hi(!0),Xt()&&Mi(!0))},[G,ji,Vi]);let yo=(0,Q.useCallback)(async e=>{if(Nn()&&qh()){let t=Dd(),n=await vg(e.host,t);return new Promise(r=>{if(!n){Xn(t=>[...t,{hostPattern:e,resolvePromise:r}]);return}Mh({requestId:t,host:e.host,resolve:r}),V(n=>({...n,pendingSandboxRequest:{requestId:t,host:e.host}}))})}return new Promise(t=>{let n=!1;function r(e){n||(n=!0,t(e))}Xn(t=>[...t,{hostPattern:e,resolvePromise:r}]);{let t=H.getState().replBridgePermissionCallbacks;if(t){let n=zS();t.sendRequest(n,nb,{host:e.host},zS(),`Allow network connection to ${e.host}?`);let r=t.onResponse(n,t=>{r();let n=t.behavior===`allow`;Xn(t=>(t.filter(t=>t.hostPattern.host===e.host).forEach(e=>e.resolvePromise(n)),t.filter(t=>t.hostPattern.host!==e.host)));let i=$n.current.get(e.host);if(i){for(let e of i)e();$n.current.delete(e.host)}}),i=()=>{r(),t.cancelRequest(n)},a=$n.current.get(e.host)??[];a.push(i),$n.current.set(e.host,a)}}})},[V,H]);(0,Q.useEffect)(()=>{let e=Bs.getSandboxUnavailableReason();if(e){if(Bs.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${e}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),Ea(1,`other`);return}J(`sandbox disabled: ${e}`,{level:`warn`}),ut({key:`sandbox-unavailable`,jsx:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{color:`warning`,children:`sandbox disabled`}),(0,$.jsx)(R,{dimColor:!0,children:` · /sandbox`})]}),priority:`medium`})}},[ut]),Bs.isSandboxingEnabled()&&Bs.initialize(yo).catch(e=>{process.stderr.write(`\n❌ Sandbox Error: ${Sr(e)}\n`),Ea(1,`other`)});let bo=(0,Q.useCallback)((e,t)=>{V(n=>({...n,toolPermissionContext:{...e,mode:t?.preserveMode?n.toolPermissionContext.mode:e.mode}})),setImmediate(e=>{e(e=>(e.forEach(e=>{e.recheckPermission()}),e))},Kn)},[V,Kn]);(0,Q.useEffect)(()=>(Es(bo),()=>ls()),[bo]);let xo=gP(Kn,bo),Co=(0,Q.useCallback)((e,t,r,i)=>{let a=H.getState(),o=()=>{let e=H.getState(),t=rb(Vt,xh(e.toolPermissionContext,e.mcp.tools),e.toolPermissionContext.mode);return P?wc(P,t,!1,!0).resolvedTools:t};return{abortController:r,options:{commands:qt,tools:o(),debug:n,verbose:a.verbose,mainLoopModel:i,thinkingConfig:a.thinkingEnabled===!1?{type:`disabled`}:D,mcpClients:wP(d,a.mcp.clients),mcpResources:a.mcp.resources,ideInstallationStatus:Ct,isNonInteractiveSession:!1,dynamicMcpConfig:Ie,theme:ia,agentDefinitions:Gt?{...a.agentDefinitions,allowedAgentTypes:Gt}:a.agentDefinitions,customSystemPrompt:h,appendSystemPrompt:g,refreshTools:o},getAppState:()=>H.getState(),setAppState:V,messages:e,setMessages:K,updateFileHistoryState(e){V(t=>{let n=e(t.fileHistory);return n===t.fileHistory?t:{...t,fileHistory:n}})},updateAttributionState(e){V(t=>{let n=e(t.attribution);return n===t.attribution?t:{...t,attribution:n}})},openMessageSelector:()=>{y||Di(!0)},onChangeAPIKey:$a,readFileState:Ha.current,setToolJSX:Wn,addNotification:ut,appendSystemMessage:e=>K(t=>[...t,e]),sendOSNotification:e=>{Eo(e,we)},onChangeDynamicMcpConfig:Re,onInstallIDEExtension:xt,nestedMemoryAttachmentTriggers:new Set,loadedNestedMemoryPaths:Ja.current,dynamicSkillDirTriggers:new Set,discoveredSkillNames:Ka.current,setResponseLength:li,pushApiMetricsEntry:process.env.USER_TYPE===`ant`?e=>{let t=Date.now(),n=si.current;ci.current.push({ttftMs:e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})}:void 0,setStreamMode:Yt,onCompactProgress:e=>{switch(e.type){case`hooks_start`:Ci(`claudeBlue_FOR_SYSTEM_SPINNER`),Ti(`claudeBlueShimmer_FOR_SYSTEM_SPINNER`),xi(e.hookType===`pre_compact`?`Running PreCompact hooks…`:e.hookType===`post_compact`?`Running PostCompact hooks…`:`Running SessionStart hooks…`);break;case`compact_start`:xi(`Compacting conversation`);break;case`compact_end`:xi(null),Ci(null),Ti(null);break}},setInProgressToolUseIDs:Xr,setHasInterruptibleToolInProgress:e=>{Zr.current=e},resume:Ba,setConversationId:Fi,requestPrompt:void 0,contentReplacementState:Bi.current}},[qt,Vt,P,n,d,Ct,Ie,ia,Gt,H,V,$a,ut,K,Re,Ba,(0,Q.useCallback)((e,t)=>n=>new Promise((r,i)=>{Qn(a=>[...a,{request:n,title:e,toolInputSummary:t,resolve:r,reject:i}])}),[]),y,h,g,Fi]),{handleBackgroundSession:wo}=UP({setMessages:K,setIsLoading:kn,resetLoadingState:da,setAbortController:rn,onBackgroundQuery:(0,Q.useCallback)(()=>{nn?.abort(`background`);let e=td(e=>e.mode===`task-notification`);(async()=>{let t=Co(pr.current,[],new AbortController,Te),[n,r,i]=await Promise.all([pf(t.options.tools,Te,Array.from(F.additionalWorkingDirectories.keys()),t.options.mcpClients),Wl(),Ho()]),a=of({mainThreadAgentDefinition:P,toolUseContext:t,customSystemPrompt:h,defaultSystemPrompt:n,appendSystemPrompt:g});t.renderedSystemPrompt=a;let o=(await Ec(e).catch(()=>[])).map(Ks),s=new Set;for(let e of pr.current)e.type===`attachment`&&e.attachment.type===`queued_command`&&e.attachment.commandMode===`task-notification`&&typeof e.attachment.prompt==`string`&&s.add(e.attachment.prompt);let c=o.filter(e=>e.attachment.type===`queued_command`&&(typeof e.attachment.prompt!=`string`||!s.has(e.attachment.prompt)));hm({messages:[...pr.current,...c],queryParams:{systemPrompt:a,userContext:r,systemContext:i,canUseTool:xo,toolUseContext:t,querySource:Bl()},description:ar,setAppState:V,agentDefinition:P})})()},[nn,Te,F,P,Co,h,g,xo,V])}),To=(0,Q.useCallback)(t=>{xa(t,t=>{if(Cu(t)?(El()?K(e=>{let n=jc(e,{includeSnipped:!0});return[...n.length>500?n.slice(-500):n,t]}):K(()=>[t]),Fi(zS()),sz?.setContextBlocked(!1)):t.type===`progress`&&ll(t.data?.type)?K(e=>{let n=t.data;for(let r=e.length-1;r>=0;r--){let i=e[r];if(i.type!==`progress`)break;let a=i.data;if(i.parentToolUseID===t.parentToolUseID&&a?.type===n.type){let n=e.slice();return n[r]=t,n}}return[...e,t]}):K(e=>[...e,t]),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage?sz?.setContextBlocked(!0):t.type===`assistant`&&sz?.setContextBlocked(!1),t.type===`assistant`&&`isApiErrorMessage`in t&&t.isApiErrorMessage){let n=(Ys(t.message?.content??``)??``).toLowerCase();if(n.includes(`connection error`)||n.includes(`fetch failed`)||n.includes(`network error`)||n.includes(`enotfound`)||n.includes(`econnreset`)||n.includes(`etimedout`)){let{getGoal:t,pauseGoal:n}=(ba(),e(sl)),{persistCurrentGoal:r}=(Sp(),e(jh));t()?.status===`active`&&(n(),r(),ut({key:`goal-auto-paused-connectivity-error`,text:`Detected connection error. Active goal was auto-paused. Run /goal resume after network recovers.`,priority:`immediate`}))}}},e=>{li(t=>t+e.length)},Yt,$t,e=>{K(t=>t.filter(t=>t!==e)),nh(e.uuid)},tn,e=>{let t=Date.now(),n=si.current;ci.current.push({...e,firstTokenTime:t,lastTokenTime:t,responseLengthBaseline:n,endResponseLength:n})},hi)},[K,li,Yt,$t,tn,hi]),Do=(0,Q.useCallback)(async(e,t,n,r,i,a,o)=>{if(r){let e=wP(d,H.getState().mcp.clients);Jd.handleQueryStart(e);let t=Il(e);t&&i_(t)}if(oy(),!j&&!er&&!ir&&!rr.current){let e=t.find(e=>e.type===`user`&&!e.isMeta),n=e?.type===`user`?Ys(e.message.content):null;n&&!n.startsWith(`<local-command-stdout>`)&&!n.startsWith(`<command-message>`)&&!n.startsWith(`<command-name>`)&&!n.startsWith(`<bash-input>`)&&(rr.current=!0,My(n,new AbortController().signal).then(e=>{e?nr(e):rr.current=!1},()=>{rr.current=!1}))}if(H.setState(e=>{let t=e.toolPermissionContext.alwaysAllowRules.command;return t===i||t?.length===i.length&&t.every((e,t)=>e===i[t])?e:{...e,toolPermissionContext:{...e.toolPermissionContext,alwaysAllowRules:{...e.toolPermissionContext.alwaysAllowRules,command:i}}}}),!r){t.some(Cu)&&(Fi(zS()),sz?.setContextBlocked(!1)),da(),rn(null);return}let s=Co(e,t,n,a),{tools:c,mcpClients:l}=s.options;if(o!==void 0){let e=s.getAppState;s.getAppState=()=>({...e(),effortValue:o})}xg(`query_context_loading_start`);let[,,u,f,p]=await Promise.all([void 0,Px(F,V,H.getState().fastMode),pf(c,a,Array.from(F.additionalWorkingDirectories.keys()),l),Wl(),Ho()]),m={...f,...oz(l,Kl()?x_():void 0),...sz?.isProactiveActive()&&!ra.current?{terminalFocus:`The terminal is unfocused — the user is not actively watching.`}:{}};xg(`query_context_loading_end`);let _=of({mainThreadAgentDefinition:P,toolUseContext:s,customSystemPrompt:h,defaultSystemPrompt:u,appendSystemPrompt:g});s.renderedSystemPrompt=_,xg(`query_query_start`),bt(),Xe(),at();for await(let t of Uo({messages:e,systemPrompt:_,userContext:m,systemContext:p,canUseTool:xo,toolUseContext:s,querySource:Bl()}))To(t);if(typeof globalThis.fireCompanionObserver==`function`){let e=globalThis.fireCompanionObserver;e(pr.current,e=>V(t=>t.companionReaction===e?t:{...t,companionReaction:e}))}if(xg(`query_end`),process.env.USER_TYPE===`ant`&&ci.current.length>0){let e=ci.current,t=e.map(e=>e.ttftMs),n=e.map(e=>{let t=Math.round((e.endResponseLength-e.responseLengthBaseline)/4),n=e.lastTokenTime-e.firstTokenTime;return n>0?Math.round(t/(n/1e3)):0}),r=e.length>1,i=nt(),a=Be(),o=qe(),s=rt(),c=pt(),l=He(),u=Date.now()-Cn.current;K(e=>[...e,ah({ttftMs:r?Sz(t):t[0],otps:r?Sz(n):n[0],isP50:r,hookDurationMs:i>0?i:void 0,hookCount:a>0?a:void 0,turnDurationMs:u>0?u:void 0,toolDurationMs:o>0?o:void 0,toolCount:s>0?s:void 0,classifierDurationMs:c>0?c:void 0,classifierCount:l>0?l:void 0,configWriteCount:An()})])}da(),um(),await v?.(pr.current)},[d,da,Co,F,V,h,v,g,xo,P,To,er,j]),Oo=(0,Q.useCallback)(async(e,t,n,r,i,a,o,s)=>{if(Nn()){let e=pi(),t=vi();e&&t&&Gv(e,t,!0)}let c=mn.tryStart();if(c===null)return Y(`tengu_concurrent_onquery_detected`,{}),e.filter(e=>e.type===`user`&&!e.isMeta).map(e=>Ys(e.message.content)).filter(e=>e!==null).forEach((e,t)=>{h_({value:e,mode:`prompt`}),t===0&&Y(`tengu_concurrent_onquery_enqueued`,{})}),!1;try{ns.current=!1,cn(!1),Dn(),K(t=>[...t,...e]),si.current=0,Ne((o?Ju(o):null)??Me()),ci.current=[],$t([]),di(null);let c=pr.current;if(o&&await ya(o,c,e.length),a&&o&&!await a(o,c))return!0;try{await Do(c,e,t,n,r,i,s)}catch(e){throw e}}finally{if(mn.end(c)){cn(t.signal.aborted),yi(Date.now()),Ri.current=!1,da(),await Sa(pr.current,t.signal.aborted),ln.current(),process.env.USER_TYPE===`ant`&&!t.signal.aborted&&V(e=>e.tungstenActiveSession===void 0||e.tungstenPanelAutoHidden===!0?e:{...e,tungstenPanelAutoHidden:!0});let e;Me()!==null&&Me()>0&&!t.signal.aborted&&(e={tokens:tt(),limit:Me(),nudges:Ye()}),Ne(null);let n=Date.now()-Cn.current-wn.current;(n>3e4||e!==void 0)&&!t.signal.aborted&&!ke&&(ag(H.getState().tasks).some(e=>e.status===`running`)?(jn.current===null&&(jn.current=Cn.current),e&&(Mn.current=e)):K(t=>[...t,Kg(n,e,mi(t,Ca))])),rn(null)}if(t.signal.reason===`user-cancel`&&!mn.isActive&&Br.current===``&&Lo()===0&&!H.getState().viewingAgentTaskId){let e=pr.current,t=e.findLast(ab);t&&sb(e,e.lastIndexOf(t))&&(Uu(),un.current(t))}}return!0},[Do,V,da,mn,ya,Sa]),ko=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{let e=se;if(!e||W||ko.current)return;ko.current=!0;async function t(e){if(e.clearContext){let t=e.message.planContent?ap():void 0,{clearConversation:n}=await import(`./conversation-DVhyJA1O.js`);await n({setMessages:K,readFileState:Ha.current,discoveredSkillNames:Ka.current,loadedNestedMemoryPaths:Ja.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Fi}),rr.current=!1,nr(void 0),Wa.current.clear(),Ga.current=0,t&&p_(Fe(),t)}V(t=>{let n=e.mode?Hs(t.toolPermissionContext,KT(e.mode,e.allowedPrompts)):t.toolPermissionContext;return e.mode===`auto`&&(n=xc({...n,mode:`auto`,prePlanMode:void 0})),{...t,initialMessage:null,toolPermissionContext:n}}),Ll()&&bc(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.message.uuid),await Nr();let t=e.message.message.content;if(typeof t==`string`&&!e.message.planContent)Ao(t,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}});else{let t=Ki();rn(t),Oo([e.message],t,!0,[],Te)}setTimeout(e=>{e.current=!1},100,ko)}t(e)},[se,W,K,V,Oo,Te,Wt]);let Ao=(0,Q.useCallback)(async(e,t,n,r)=>{if(Or(),sz?.resumeProactive(),is(e)){let n=ro({content:e});K(e=>[...e,n]),r?.fromKeybinding||va({display:eg(e,Ur),pastedContents:ri}),Hr(``),t.setCursorOffset(0),t.clearBuffer(),ii({}),Wr(`prompt`),_t(void 0);return}if(!n&&e.trim().startsWith(`/`)){let n=nu(e,ri).trim(),i=n.indexOf(` `),a=i===-1?n.slice(1):n.slice(1,i),o=i===-1?``:n.slice(i+1).trim(),s=qt.find(e=>Xf(e)&&(e.name===a||e.aliases?.includes(a)||lp(e)===a));s?.name===`clear`&&hr.current&&(Y(`tengu_idle_return_action`,{action:`hint_converted`,variant:hr.current,idleMinutes:Math.round((Date.now()-zi.current)/6e4),messageCount:pr.current.length,totalInputTokens:wt()}),hr.current=!1);let c=mn.isActive&&(s?.immediate||r?.fromKeybinding);if(s&&c&&s.type===`local-jsx`){e.trim()===Br.current.trim()&&(Hr(``),t.setCursorOffset(0),t.clearBuffer(),ii({}));let n=cs(e).filter(e=>ri[e.id]?.type===`text`),i=n.length;Y(`tengu_paste_text`,{pastedTextCount:i,pastedTextBytes:n.reduce((e,t)=>e+(ri[t.id]?.content.length??0),0)}),Y(`tengu_immediate_command_executed`,{commandName:s.name,fromKeybinding:r?.fromKeybinding??!1}),(async()=>{let e=!1,n=(n,r)=>{e=!0,Wn({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0});let i=[];if(n&&r?.display!==`skip`&&(ut({key:`immediate-${s.name}`,text:n,priority:`immediate`}),!El())){let e=r?.displayArgs??o;i.push(Ag(ua(lp(s),e)),Ag(`<${Kr}>${$_(n)}</${Kr}>`))}r?.metaMessages?.length&&i.push(...r.metaMessages.map(e=>ro({content:e,isMeta:!0}))),i.length&&K(e=>[...e,...i]),Gr!==void 0&&(Hr(Gr.text),t.setCursorOffset(Gr.cursorOffset),ii(Gr.pastedContents),qr(void 0))},r=Co(pr.current,[],Ki(),Te),i=await(await s.load()).call(n,r,o);i&&!e&&Wn({jsx:i,shouldHidePromptInput:!1,isLocalJSXCommand:!0})})();return}}if(ni.isRemoteMode&&!e.trim())return;{let r=gn(`tengu_willow_mode`,`off`),i=Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES??75),a=Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD??1e5);if(r!==`off`&&!En().idleReturnDismissed&&!Ri.current&&!n&&!e.trim().startsWith(`/`)&&zi.current>0&&wt()>=a){let n=(Date.now()-zi.current)/6e4;if(n>=i&&r===`dialog`){Li({input:e,idleMinutes:n}),Hr(``),t.setCursorOffset(0),t.clearBuffer();return}}}r?.fromKeybinding||(va({display:n?e:eg(e,Ur),pastedContents:n?{}:ri}),Ur===`bash`&&YO(e.trim()));let i=!n&&e.trim().startsWith(`/`),a=!W||n||ni.isRemoteMode;if(Gr!==void 0&&!i&&a?(Hr(Gr.text),t.setCursorOffset(Gr.cursorOffset),ii(Gr.pastedContents),qr(void 0)):a&&(r?.fromKeybinding||(Hr(``),t.setCursorOffset(0)),ii({})),a&&(Wr(`prompt`),_t(void 0),oi(e=>e+1),t.clearBuffer(),aa.current=!1,!i&&Ur===`prompt`&&!n&&!ni.isRemoteMode&&(gr(e),Dn()),V(e=>({...e,attribution:Ev(e.attribution,e=>{Ep(e).catch(e=>{J(`Attribution: Failed to save snapshot: ${e}`)})})}))),n){let{queryRequired:t}=await qi(n.state,n.speculationSessionTimeSavedMs,n.setAppState,e,{setMessages:K,readFileState:Ha,cwd:ft()});if(t){let e=Ki();rn(e),Oo([],e,!0,[],Te)}return}if(ni.isRemoteMode&&!(i&&qt.find(t=>{let n=e.trim().slice(1).split(/\s/)[0];return Xf(t)&&(t.name===n||t.aliases?.includes(n)||lp(t)===n)})?.type===`local-jsx`)){let t=Object.values(ri),n=t.filter(e=>e.type===`image`),r=n.length>0?n.map(e=>e.id):void 0,i=e.trim(),a=e.trim();if(t.length>0){let n=[],r=[],o=e.trim();o&&(n.push({type:`text`,text:o}),r.push({type:`text`,text:o}));for(let e of t)if(e.type===`image`){let t={type:`base64`,media_type:e.mediaType??`image/png`,data:e.content};n.push({type:`image`,source:t}),r.push({type:`image`,source:t})}else n.push({type:`text`,text:e.content}),r.push({type:`text`,text:e.content});i=n,a=r}let o=ro({content:i,imagePasteIds:r});K(e=>[...e,o]),await ni.sendMessage(a,{uuid:o.uuid});return}await Nr(),await vP({input:e,helpers:t,queryGuard:mn,isExternalLoading:_n,mode:Ur,commands:qt,onInputChange:Hr,setPastedContents:ii,setToolJSX:Wn,getToolUseContext:Co,messages:pr.current,mainLoopModel:Te,pastedContents:ri,ideSelection:gt,setUserInputOnProcessing:gr,setAbortController:rn,abortController:nn,onQuery:Oo,setAppState:V,querySource:Bl(),onBeforeQuery:_,canUseTool:xo,addNotification:ut,setMessages:K,streamMode:Zt.current,hasInterruptibleToolInProgress:Zr.current}),(i||W)&&Gr!==void 0&&(Hr(Gr.text),t.setCursorOffset(Gr.cursorOffset),ii(Gr.pastedContents),qr(void 0))},[mn,W,_n,Ur,qt,Hr,Wr,ii,oi,_t,Wn,Co,Te,ri,gt,gr,rn,ut,Oo,Gr,qr,V,_,xo,$r,K,Nr,Or]),jo=(0,Q.useCallback)(async(e,t,n)=>{Bp(t)?($p(t.id,ro({content:e}),V),t.status===`running`?_o(t.id,e,V):Kd({agentId:t.id,prompt:e,toolUseContext:Co(pr.current,[],new AbortController,Te),canUseTool:xo}).catch(e=>{J(`resumeAgentBackground failed: ${Sr(e)}`),ut({key:`resume-agent-failed-${t.id}`,jsx:(0,$.jsxs)(R,{color:`error`,children:[`Failed to resume agent: `,Sr(e)]}),priority:`low`})})):bp(t.id,e,void 0,V),Hr(``),n.setCursorOffset(0),n.clearBuffer()},[V,Hr,Co,xo,Te,ut]),Mo=(0,Q.useCallback)(()=>{let e=eo?sL(eo):`/issue`;to(null),Ao(e,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(t=>{J(`Auto-run ${e} failed: ${Sr(t)}`)})},[Ao,eo]),No=(0,Q.useCallback)(()=>{to(null)},[]),Po=(0,Q.useCallback)(()=>{Ao(process.env.USER_TYPE===`ant`?`/issue`:`/feedback`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}}).catch(e=>{J(`Survey feedback request failed: ${e instanceof Error?e.message:String(e)}`)})},[Ao]),Io=(0,Q.useRef)(Ao);Io.current=Ao;let Ro=(0,Q.useCallback)(()=>{Io.current(`/rate-limit-options`,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})},[]),zo=(0,Q.useCallback)(async()=>{if(so(!0),Rd()){WS(`tmux`,[`detach-client`],{stdio:`ignore`}),so(!1);return}if(Nl()!==null){ao((0,$.jsx)(bx,{showWorktree:!0,onDone:()=>{},onCancel:()=>{ao(null),so(!1)}}));return}let e=await(await s_.load()).call(()=>{});ao(e),e===null&&so(!1)},[]),Bo=(0,Q.useCallback)(()=>{Di(e=>!e)},[]),Wo=(0,Q.useCallback)(e=>{let t=pr.current,n=t.lastIndexOf(e);if(n===-1)return;Y(`tengu_conversation_rewind`,{preRewindMessageCount:t.length,postRewindMessageCount:n,messagesRemoved:t.length-n,rewindToMessageIndex:n}),K(t.slice(0,n)),Fi(zS()),Sd();let r=e.permissionMode;V(e=>({...e,toolPermissionContext:r&&e.toolPermissionContext.mode!==r?{...e.toolPermissionContext,mode:r}:e.toolPermissionContext,promptSuggestion:{text:null,promptId:null,shownAt:0,acceptedAt:0,generationRequestId:null}}))},[K,V]),Go=(0,Q.useCallback)(e=>{Wo(e);let t=kp(e);if(t&&(Hr(t.text),Wr(t.mode)),Array.isArray(e.message.content)&&e.message.content.some(e=>e.type===`image`)){let t=e.message.content.filter(e=>e.type===`image`);if(t.length>0){let n={};t.forEach((t,r)=>{if(t.source.type===`base64`){let i=e.imagePasteIds?.[r]??r+1;n[i]={id:i,type:`image`,content:t.source.data,mediaType:t.source.media_type}}}),ii(n)}}},[Wo,Hr]);un.current=Go;let Ko=(0,Q.useCallback)(async e=>{setImmediate((e,t)=>e(t),Go,e)},[Go]),qo=e=>{let t=e.slice(0,24);return G.findIndex(e=>e.uuid.slice(0,24)===t)},{enter:Yo,handlers:Xo}=Za(Cr,wr,Er,{copy:e=>void Ce(e).then(e=>{e&&process.stdout.write(e),ut({key:`selection-copied`,text:`copied`,color:`success`,priority:`immediate`,timeoutMs:2e3})}),edit:async e=>{let t=qo(e.uuid),n=t>=0?G[t]:void 0;if(!n||!ab(n))return;let r=!await qa(oe,n.uuid),i=sb(G,t);r&&i?(mo(),Ko(n)):(Ai(n),Di(!0))}});async function Zo(){$a();let e=await Pu();if(e.length>0){let t=e.map(e=>` [${e.type}] ${e.path} (${e.content.length} chars)${e.parent?` (included by ${e.parent})`:``}`).join(`
|
|
144
144
|
`);J(`Loaded ${e.length} CLAUDE.md/rules files:\n${t}`)}else J(`No CLAUDE.md/rules files found`);for(let t of e)Ha.current.set(t.path,{content:t.contentDiffersFromDisk?t.rawContent??t.content:t.content,timestamp:Date.now(),offset:void 0,limit:void 0,isPartialView:t.contentDiffersFromDisk})}BN(pS()),mC(G,G.length===i?.length);let{sendBridgeResult:Qo}=jC(G,K,an,qt,Te);ln.current=Qo,VN();let $o=(0,Q.useRef)(!1);(0,Q.useEffect)(()=>{if(ue.length<1){$o.current=!1;return}$o.current||($o.current=!0,kt(e=>({...e,promptQueueUseCount:(e.promptQueueUseCount??0)+1})))},[ue.length]),SP({executeQueuedInput:(0,Q.useCallback)(async e=>{await vP({helpers:{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}},queryGuard:mn,commands:qt,onInputChange:()=>{},setPastedContents:()=>{},setToolJSX:Wn,getToolUseContext:Co,messages:G,mainLoopModel:Te,ideSelection:gt,setUserInputOnProcessing:gr,setAbortController:rn,onQuery:Oo,setAppState:V,querySource:Bl(),onBeforeQuery:_,canUseTool:xo,addNotification:ut,setMessages:K,queuedCommands:e})},[mn,qt,Wn,Co,G,Te,gt,gr,xo,rn,Oo,ut,V,_]),hasActiveLocalJsxUI:sr,queryGuard:mn}),(0,Q.useEffect)(()=>{sa.recordUserActivity(),We(!0)},[Rr,ai]),(0,Q.useEffect)(()=>{ai===1&&TS()},[ai]),(0,Q.useEffect)(()=>{if(W||ai===0||_i===0)return;let e=setTimeout((e,t,n,r,i)=>{if(et()>e)return;let a=Date.now()-e;!t&&!n&&r.current===void 0&&a>=En().messageIdleNotifThresholdMs&&Eo({message:`Claude is waiting for your input`,notificationType:`idle_prompt`},i)},En().messageIdleNotifThresholdMs,_i,W,Vn,Pn,we);return()=>clearTimeout(e)},[W,Vn,ai,_i,we]),(0,Q.useEffect)(()=>{if(_i===0||W)return;let e=gn(`tengu_willow_mode`,`off`);if(e!==`hint`&&e!==`hint_v2`||En().idleReturnDismissed)return;let t=Number(process.env.CLAUDE_CODE_IDLE_TOKEN_THRESHOLD??1e5);if(wt()<t)return;let n=Number(process.env.CLAUDE_CODE_IDLE_THRESHOLD_MINUTES??75)*6e4-(Date.now()-_i),r=setTimeout((e,t,n,r,i)=>{if(n.current.length===0)return;let a=wt(),o=Pi(a),s=(Date.now()-e)/6e4;t({key:`idle-return-hint`,jsx:r===`hint_v2`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(R,{dimColor:!0,children:`new task? `}),(0,$.jsx)(R,{color:`suggestion`,children:`/clear`}),(0,$.jsx)(R,{dimColor:!0,children:` to save `}),(0,$.jsxs)(R,{color:`suggestion`,children:[o,` tokens`]})]}):(0,$.jsxs)(R,{color:`warning`,children:[`new task? /clear to save `,o,` tokens`]}),priority:`medium`,timeoutMs:2147483647}),i.current=r,Y(`tengu_idle_return_action`,{action:`hint_shown`,variant:r,idleMinutes:Math.round(s),messageCount:n.current.length,totalInputTokens:a})},Math.max(0,n),_i,ut,pr,e,hr);return()=>{clearTimeout(r),dt(`idle-return-hint`),hr.current=!1}},[_i,W,ut,dt]);let es=(0,Q.useCallback)((e,t)=>{if(mn.isActive||tu().some(e=>e.mode===`prompt`||e.mode===`bash`))return!1;let n=typeof e==`string`?{value:e,mode:`prompt`,isMeta:t?.isMeta?!0:void 0}:e;return(async()=>{let e=await dm([n]),t=e.attachmentCommands[0];if(!t)return;let r=Ki();rn(r);let i=ro({content:t.value,isMeta:t.isMeta?!0:void 0,origin:t.origin}),a=!1;try{a=await Oo([i],r,!0,[],Te)!==!1}catch(t){try{await op({commands:e.claimedCommands,outcome:{type:`failed`,error:t},currentDir:Tr(),priority:`later`})}catch(e){Qr(mr(e))}Qr(mr(t));return}if(a)try{let t=await op({commands:e.claimedCommands,outcome:{type:`completed`},currentDir:Tr(),priority:`later`});for(let e of t)h_(e)}catch(e){Qr(mr(e))}})().catch(e=>{Qr(mr(e))}),!0},[Oo,Te,H]),{relayPipeMessage:ts,pipeReturnHadErrorRef:ns}=hz(),rs=nz({setInputValueRaw:zr,inputValueRef:Br,insertTextRef:Vr});IP({enabled:Nn(),isLoading:W,focusedInputDialog:uo,onSubmitMessage:es}),CP({isLoading:W,onSubmitMessage:es}),Z(e=>Ry(e));let{routeToSelectedPipes:is}=gz({store:H,setAppState:V,addNotification:ut});{let e=H.getState().kairosEnabled;pz({isLoading:W,assistantMode:e,setMessages:K})}process.env.USER_TYPE===`ant`&&RP({taskListId:S,isLoading:W,onSubmitTask:es}),fz?.({isLoading:W||se!==null,queuedCommandsLength:ue.length,hasActiveLocalJsxUI:sr,isInPlanMode:F.mode===`plan`,onQueueTick:e=>h_(e)}),mz?.({isLoading:W||se!==null,wasAborted:sn,queuedCommandsLength:ue.length,hasActiveLocalJsxUI:sr,isInPlanMode:F.mode===`plan`,isQueryActiveNow:mn.getSnapshot,onContinuationEnqueued:({turn:e,objective:t})=>{let n=`Goal auto-continue (${e}/1): continue advancing "${t}".`;K(e=>[...e,ro({content:n,isVisibleInTranscriptOnly:!0})])},onMaxTurnsReached:()=>{ut({key:`goal-max-turns-reached`,text:`Goal reached max continuation turns (1). Run /goal continue to reset turn counter and continue.`,priority:`immediate`})}}),(0,Q.useEffect)(()=>{if(!ke){mv(null);return}if(!W){if(Ae!==null&&ue.length===0&&!sr&&F.mode!==`plan`&&se===null){mv({enabled:!0,phase:`standby`,next_tick_at:Ae,sleep_until:null});return}mv({enabled:!0,phase:null,next_tick_at:null,sleep_until:null})}},[se,W,sr,ke,Ae,ue.length,F.mode]),(0,Q.useEffect)(()=>{ue.some(e=>e.priority===`now`)&&an.current?.abort(`interrupt`)},[ue]);let as=(0,Q.useRef)(Zo);as.current=Zo;let os=(0,Q.useRef)(Jd);os.current=Jd,(0,Q.useEffect)(()=>(as.current(),()=>{os.current.shutdown()}),[]);let{internal_eventEmitter:ss}=ie(),[us,ds]=(0,Q.useState)(0);(0,Q.useEffect)(()=>{let e=()=>{process.stdout.write(`
|
|
145
145
|
Claude Code has been suspended. Run \`fg\` to bring Claude Code back.
|
|
146
146
|
Note: ctrl + z now suspends Claude Code, ctrl + _ undoes input.
|
|
147
|
-
`)},t=()=>{ds(e=>e+1)};return ss?.on(`suspend`,e),ss?.on(`resume`,t),()=>{ss?.off(`suspend`,e),ss?.off(`resume`,t)}},[ss]);let fs=(0,Q.useMemo)(()=>{if(!W)return null;let e=G.filter(e=>{if(e.type!==`progress`)return!1;let t=e.data;return t.type===`hook_progress`&&(t.hookEvent===`Stop`||t.hookEvent===`SubagentStop`)});if(e.length===0)return null;let t=e.at(-1)?.toolUseID;if(!t||G.some(e=>e.type===`system`&&e.subtype===`stop_hook_summary`&&e.toolUseID===t))return null;let n=e.filter(e=>e.toolUseID===t),r=n.length,i=mi(G,e=>{if(e.type!==`attachment`)return!1;let n=e.attachment;return`hookEvent`in n&&(n.hookEvent===`Stop`||n.hookEvent===`SubagentStop`)&&`toolUseID`in n&&n.toolUseID===t}),a=n.find(e=>e.data.statusMessage)?.data.statusMessage;if(a)return r===1?`${a}…`:`${a}… ${i}/${r}`;let o=n[0]?.data.hookEvent===`SubagentStop`?`subagent stop`:`stop`;if(process.env.USER_TYPE===`ant`){let e=n[i]?.data.command,t=e?` '${Oi(e,40)}'`:``;return r===1?`running ${o} hook${t}`:`running ${o} hook${t}\u2026 ${i}/${r}`}return r===1?`running ${o} hook`:`running stop hooks… ${i}/${r}`},[G,W]),ps=(0,Q.useCallback)(()=>{Lr({messagesLength:G.length,streamingToolUsesLength:Qt.length})},[G.length,Qt.length]),ms=(0,Q.useCallback)(()=>{Lr(null)},[]),hs=El()&&!N,gs=(0,Q.useRef)(null),[_s,vs]=(0,Q.useState)(!1),[bs,Ss]=(0,Q.useState)(``),[Cs,ws]=(0,Q.useState)(0),[Ts,Ds]=(0,Q.useState)(0),Os=(0,Q.useCallback)((e,t)=>{ws(e),Ds(t)},[]);Oe((e,t,n)=>{if(t.ctrl||t.meta)return;if(e===`/`){gs.current?.setAnchor(),vs(!0),n.stopImmediatePropagation();return}let r=e[0];if((r===`n`||r===`N`)&&e===r.repeat(e.length)&&Cs>0){let t=r===`n`?gs.current?.nextMatch:gs.current?.prevMatch;if(t)for(let n=0;n<e.length;n++)t();n.stopImmediatePropagation()}},{isActive:ze===`transcript`&&hs&&!_s&&!Je});let{setQuery:ks,scanElement:As,setPositions:js}=I(),Ms=k().columns,Ns=Q.useRef(Ms);Q.useEffect(()=>{Ns.current!==Ms&&(Ns.current=Ms,(bs||_s)&&(vs(!1),Ss(``),ws(0),Ds(0),gs.current?.disarmSearch(),ks(``)))},[Ms,bs,_s,ks]),Oe((e,t,n)=>{if(!(t.ctrl||t.meta)){if(e===`q`){ms(),n.stopImmediatePropagation();return}if(e===`[`&&!Je)Ze(!0),Ke(!0),n.stopImmediatePropagation();else if(e===`v`){if(n.stopImmediatePropagation(),st.current)return;st.current=!0;let e=it.current,t=t=>{e===it.current&&(clearTimeout(ot.current),$e(t))};t(`rendering ${Pr.length} messages…`),(async()=>{try{let e=(await Ax(Pr,Wt,Math.max(80,(process.stdout.columns??80)-6))).replace(/[ \t]+$/gm,``),n=MS(DS(),`cc-transcript-${Date.now()}.txt`);await HS(n,e),t(Pb(n)?`opening ${n}`:`wrote ${n} · no $VISUAL/$EDITOR set`)}catch(e){t(`render failed: ${e instanceof Error?e.message:String(e)}`)}st.current=!1,e===it.current&&(ot.current=setTimeout(e=>e(``),4e3,$e))})()}}},{isActive:ze===`transcript`&&hs&&!_s});let Ps=ze===`transcript`&&hs;(0,Q.useEffect)(()=>{Ps||(Ss(``),ws(0),Ds(0),vs(!1),it.current++,clearTimeout(ot.current),Ze(!1),$e(``))},[Ps]),(0,Q.useEffect)(()=>{ks(Ps?bs:``),Ps||js(null)},[Ps,bs,ks,js]);let Fs={screen:ze,setScreen:Ve,showAllInTranscript:Ge,setShowAllInTranscript:Ke,messageCount:G.length,onEnterTranscript:ps,onExitTranscript:ms,virtualScrollActive:hs,searchBarOpen:_s},Is=Ir?Pr.slice(0,Ir.messagesLength):Pr,Ls=Ir?Qt.slice(0,Ir.streamingToolUsesLength):Qt;XN({onOpenBackgroundTasks:sr?void 0:()=>Ji(!0),onTogglePipeSelector:()=>{V(e=>{let t=e.pipeIpc??{};return{...e,pipeIpc:{...t,selectorOpen:!t.selectorOpen}}})}}),$N();let Rs=ye?B[ye]:void 0,zs=Rs&&Kp(Rs)?Rs:void 0,Vs=zs??(Rs&&Bp(Rs)?Rs:void 0),Us=fi||!W,Ws=Vs?.messages,Gs=(0,Q.useMemo)(()=>{if(!Vs)return;let e=Ws??[];if(!Bp(Vs)||Vs.agentType!==`fork`||!Vs.prompt)return e;let t=Vs.prompt.trim(),n=-1,r=-1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o.type===`user`&&Array.isArray(o.message?.content)){if(o.message.content.some(Az))n=a;else if(!i){let e=o.message.content.find(e=>e.type===`text`&&typeof e.text==`string`);e&&e.text.trim()===t&&(i=!0)}continue}o.type===`assistant`&&Array.isArray(o.message?.content)&&o.message.content.some(e=>e.type===`tool_use`)&&(r=a)}let a=n===-1?e:e.map((e,t)=>t!==n||!Array.isArray(e.message?.content)?e:{...e,message:{...e.message,content:e.message.content.filter(e=>!Az(e))}});if(i)return a;let o=n===-1?r+1:n+1,s=ro({content:Vs.prompt,timestamp:new Date(Vs.startTime).toISOString()});return[...a.slice(0,o),s,...a.slice(o)]},[Vs,Ws]),qs=Vs?Gs??[]:Us?G:Pr;if(ze===`transcript`){let e=El()&&!N&&!Je?dn:void 0,t=(0,$.jsx)(kx,{messages:Is,tools:Wt,commands:qt,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:Yr,isMessageSelectorVisible:!1,conversationId:Ni,screen:ze,agentDefinitions:L,streamingToolUses:Ls,showAllInTranscript:Ge,onOpenRateLimitOptions:Ro,isLoading:W,hidePastThinking:!0,streamingThinking:en,scrollRef:e,jumpRef:gs,onSearchMatchesChange:Os,scanElement:As,setPositions:js,disableRenderCap:Je}),n=Vn&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Vn.jsx}),r=(0,$.jsxs)(Nc,{children:[(0,$.jsx)(Oz,{isAnimating:cr,title:ar,disabled:j,noPrefix:dr}),(0,$.jsx)(WN,{...Fs}),(0,$.jsx)(rz,{voiceHandleKeyEvent:rs.handleKeyEvent,stripTrailing:rs.stripTrailing,resetAnchor:rs.resetAnchor,isActive:!Vn?.isLocalJSXCommand}),(0,$.jsx)(KN,{onSubmit:Ao,isActive:!Vn?.isLocalJSXCommand}),e?(0,$.jsx)($L,{scrollRef:dn,isActive:uo!==`ultraplan-choice`,isModal:!_s,onScroll:()=>gs.current?.disarmSearch()}):null,(0,$.jsx)(JN,{...vo}),e?(0,$.jsx)(Dx,{scrollRef:dn,scrollable:(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(XF,{})]}),bottom:_s?(0,$.jsx)(wz,{jumpRef:gs,initialQuery:``,count:Cs,current:Ts,onClose:e=>{Ss(Cs>0?e:``),vs(!1),e||(ws(0),Ds(0),gs.current?.setSearchQuery(``))},onCancel:()=>{vs(!1),gs.current?.setSearchQuery(``),gs.current?.setSearchQuery(bs),ks(bs)},setHighlight:ks}):(0,$.jsx)(Cz,{showAllInTranscript:Ge,virtualScroll:!0,status:Qe||void 0,searchBadge:bs&&Cs>0?{current:Ts,count:Cs}:void 0})}):(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(XF,{}),(0,$.jsx)(Cz,{showAllInTranscript:Ge,virtualScroll:!1,suppressShowAll:Je,status:Qe||void 0})]})]});return e?(0,$.jsx)(ce,{mouseTracking:Xa(),children:r}):r}let Js=yn&&!Vs&&qs.length<=xn.current?yn:void 0,Xs=uo===`tool-permission`?(0,$.jsx)(HE,{onDone:()=>Kn(([e,...t])=>t),onReject:ho,toolUseConfirm:Gn[0],toolUseContext:Co(G,G,nn??Ki(),Te),verbose:te,workerBadge:Gn[0]?.workerBadge,setStickyFooter:El()?Jn:void 0},Gn[0]?.toolUseID):null,Zs=Ms<100,Qs=!Vn?.shouldHidePromptInput&&!uo&&!Gi,$s=El()&&Vn?.isLocalJSXCommand===!0,ec=$s?Vn.jsx:null,tc=(0,$.jsxs)(Nc,{children:[(0,$.jsx)(Oz,{isAnimating:cr,title:ar,disabled:j,noPrefix:dr}),(0,$.jsx)(WN,{...Fs}),(0,$.jsx)(rz,{voiceHandleKeyEvent:rs.handleKeyEvent,stripTrailing:rs.stripTrailing,resetAnchor:rs.resetAnchor,isActive:!Vn?.isLocalJSXCommand}),(0,$.jsx)(KN,{onSubmit:Ao,isActive:!Vn?.isLocalJSXCommand}),(0,$.jsx)($L,{scrollRef:dn,isActive:El()&&(ec!=null||!uo||uo===`tool-permission`),onScroll:Mr}),null,(0,$.jsx)(JN,{...vo}),(0,$.jsx)(Jy,{dynamicMcpConfig:Ie,isStrictMcpConfig:m,children:(0,$.jsx)(Dx,{scrollRef:dn,overlay:Xs,bottomFloat:Qs&&!Zs?(0,$.jsx)(PD,{}):void 0,modal:ec,modalScrollRef:fn,dividerYRef:vr,hidePill:!!Vs,hideSticky:!!zs,newMessageCount:Dr?.count??0,onPillClick:()=>{wr(null),q(dn.current)},scrollable:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(OP,{}),(0,$.jsx)(kx,{messages:qs,tools:Wt,commands:qt,verbose:te,toolJSX:Vn,toolUseConfirmQueue:Gn,inProgressToolUseIDs:zs?zs.inProgressToolUseIDs??new Set:Yr,isMessageSelectorVisible:Ei,conversationId:Ni,screen:ze,streamingToolUses:Qt,showAllInTranscript:Ge,agentDefinitions:L,onOpenRateLimitOptions:Ro,isLoading:W,streamingText:W&&!Vs?gi:null,isBriefOnly:Vs?!1:je,unseenDivider:Vs?void 0:Dr,scrollRef:El()?dn:void 0,trackStickyPrompt:El()?!0:void 0,cursor:Cr,setCursor:wr,cursorNavRef:Er}),(0,$.jsx)(PI,{}),!y&&Js&&!ec&&(0,$.jsx)(yg,{param:{text:Js,type:`text`},addMargin:!0,verbose:te}),Vn&&!(Vn.isLocalJSXCommand&&Vn.isImmediate)&&!$s&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Vn.jsx}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(lL,{}),(0,$.jsx)(U,{flexGrow:1}),Da&&(0,$.jsx)(Fo,{mode:Jt,spinnerTip:de,responseLengthRef:si,apiMetricsRef:ci,overrideMessage:bi,spinnerSuffix:fs,verbose:te,loadingStartTimeRef:Cn,totalPausedMsRef:wn,pauseStartTimeRef:Tn,overrideColor:Si,overrideShimmerColor:wi,hasActiveTools:Yr.size>0,leaderIsIdle:!W}),!Da&&!W&&!yn&&!fa&&je&&!Vs&&(0,$.jsx)(Ql,{})]}),bottom:(0,$.jsxs)(U,{flexDirection:Zs?`column`:`row`,width:`100%`,alignItems:Zs?void 0:`flex-end`,children:[Zs&&El()&&Qs?(0,$.jsx)(ND,{}):null,(0,$.jsxs)(U,{flexDirection:`column`,flexGrow:1,children:[El()&&(0,$.jsx)(OM,{}),qn,Vn?.isLocalJSXCommand&&Vn.isImmediate&&!$s&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Vn.jsx}),!Da&&!Vn?.isLocalJSXCommand&&fe&&Ht&&Ht.length>0&&(0,$.jsx)(U,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(Ld,{tasks:Ht,isStandalone:!0})}),uo===`sandbox-permission`&&(0,$.jsx)(JF,{hostPattern:Yn[0].hostPattern,onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=Yn[0];if(!r)return;let i=r.hostPattern.host;if(n){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:t?`allow`:`deny`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:jp(t.toolPermissionContext,e)})),Jo(e),Bs.refreshConfig()}Xn(e=>(e.filter(e=>e.hostPattern.host===i).forEach(e=>e.resolvePromise(t)),e.filter(e=>e.hostPattern.host!==i)));let a=$n.current.get(i);if(a){for(let e of a)e();$n.current.delete(i)}}},Yn[0].hostPattern.host),uo===`prompt`&&(0,$.jsx)(fD,{title:Zn[0].title,toolInputSummary:Zn[0].toolInputSummary,request:Zn[0].request,onRespond:e=>{let t=Zn[0];t&&(t.resolve({prompt_response:t.request.prompt,selected:e}),Qn(([,...e])=>e))},onAbort:()=>{let e=Zn[0];e&&(e.reject(Error(`Prompt cancelled by user`)),Qn(([,...e])=>e))}},Zn[0].request.prompt),pe&&(0,$.jsx)(pC,{toolName:pe.toolName,description:pe.description}),me&&(0,$.jsx)(pC,{toolName:`Network Access`,description:`Waiting for leader to approve network access to ${me.host}`}),uo===`worker-sandbox-permission`&&(0,$.jsx)(JF,{hostPattern:{host:he.queue[0].host,port:void 0},onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=he.queue[0];if(!r)return;let i=r.host;if(sf(r.workerName,r.requestId,i,t,z?.teamName),n&&t){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:`allow`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:jp(t.toolPermissionContext,e)})),Jo(e),Bs.refreshConfig()}V(e=>({...e,workerSandboxPermissions:{...e.workerSandboxPermissions,queue:e.workerSandboxPermissions.queue.slice(1)}}))}},he.queue[0].requestId),uo===`elicitation`&&(0,$.jsx)(lD,{event:ge.queue[0],onResponse:(e,t)=>{let n=ge.queue[0];n&&(n.respond({action:e,content:t}),n.params.mode===`url`&&e===`accept`||V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})))},onWaitingDismiss:e=>{let t=ge.queue[0];V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})),t?.onWaitingDismiss?.(e)}},ge.queue[0].serverName+`:`+String(ge.queue[0].requestId)),uo===`cost`&&(0,$.jsx)(YS,{onDone:()=>{Mi(!1),Hi(!0),kt(e=>({...e,hasAcknowledgedCostThreshold:!0})),Y(`tengu_cost_threshold_acknowledged`,{})}}),uo===`idle-return`&&Ii&&(0,$.jsx)(XS,{idleMinutes:Ii.idleMinutes,totalInputTokens:wt(),onDone:async e=>{let t=Ii;if(Li(null),Y(`tengu_idle_return_action`,{action:e,idleMinutes:Math.round(t.idleMinutes),messageCount:pr.current.length,totalInputTokens:wt()}),e===`dismiss`){Hr(t.input);return}if(e===`never`&&kt(e=>e.idleReturnDismissed?e:{...e,idleReturnDismissed:!0}),e===`clear`){let{clearConversation:e}=await import(`./conversation-Bt6QdGd-.js`);await e({setMessages:K,readFileState:Ha.current,discoveredSkillNames:Ka.current,loadedNestedMemoryPaths:Ja.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Fi}),rr.current=!1,nr(void 0),Wa.current.clear(),Ga.current=0}Ri.current=!0,Io.current(t.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}}),uo===`ide-onboarding`&&(0,$.jsx)(wa,{onDone:()=>Dt(!1),installationStatus:Ct}),process.env.USER_TYPE===`ant`&&uo===`model-switch`&&_z&&(0,$.jsx)(_z,{onDone:(e,t)=>{At(!1),e===`switch`&&t&&V(e=>({...e,mainLoopModel:t,mainLoopModelForSession:null}))}}),process.env.USER_TYPE===`ant`&&uo===`undercover-callout`&&yz&&(0,$.jsx)(yz,{onDone:()=>Bn(!1)}),uo===`effort-callout`&&(0,$.jsx)(GP,{model:Te,onDone:e=>{Mt(!1),e!==`dismiss`&&V(t=>({...t,effortValue:e}))}}),uo===`remote-callout`&&(0,$.jsx)(Wb,{onDone:e=>{V(t=>t.showRemoteCallout?{...t,showRemoteCallout:!1,...e===`enable`&&{replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1}}:t)}}),io,uo===`plugin-hint`&&Rt&&(0,$.jsx)(SI,{pluginName:Rt.pluginName,pluginDescription:Rt.pluginDescription,marketplaceName:Rt.marketplaceName,sourceCommand:Rt.sourceCommand,onResponse:zt}),uo===`search-extra-tools-hint`&&Bt.visible&&(0,$.jsx)(wI,{tools:Bt.tools,onSelect:Bt.handleSelect,onDismiss:Bt.handleDismiss}),uo===`lsp-recommendation`&&It&&(0,$.jsx)(yI,{pluginName:It.pluginName,pluginDescription:It.pluginDescription,fileExtension:It.fileExtension,onResponse:Lt}),uo===`desktop-upsell`&&(0,$.jsx)(bS,{onDone:()=>Ft(!1)}),uo===`ultraplan-choice`&&_e&&(0,$.jsx)(CL,{plan:_e.plan,sessionId:_e.sessionId,taskId:_e.taskId,setMessages:K,readFileState:Ha.current,getAppState:()=>H.getState(),setConversationId:Fi}),uo===`ultraplan-launch`&&ve&&(0,$.jsx)(EL,{onChoice:(e,t)=>{let n=ve.blurb;if(V(e=>e.ultraplanLaunchPending?{...e,ultraplanLaunchPending:void 0}:e),e===`cancel`)return;K(e=>[...e,Ag(ua(`ultraplan`,n))]);let r=e=>K(t=>[...t,Ag(`<local-command-stdout>${$_(e)}</local-command-stdout>`)]);hg({blurb:n,promptIdentifier:t?.promptIdentifier,getAppState:()=>H.getState(),setAppState:V,signal:Ki().signal,disconnectedBridge:t?.disconnectedBridge,onSessionReady:e=>{if(!mn.isActive){r(e);return}let t=mn.subscribe(()=>{mn.isActive||(t(),H.getState().ultraplanSessionUrl&&r(e))})}}).then(r).catch(Qr)}}),Ta(),!Vn?.shouldHidePromptInput&&!uo&&!oo&&!y&&!Cr&&(0,$.jsxs)($.Fragment,{children:[eo&&(0,$.jsx)(aL,{onRun:Mo,onCancel:No,reason:cL(eo)}),Ia.state===`closed`?La.state===`closed`?(0,$.jsx)(bF,{state:Fa.state,lastResponse:Fa.lastResponse,handleSelect:Fa.handleSelect,handleTranscriptSelect:Fa.handleTranscriptSelect,inputValue:Rr,setInputValue:Hr,onRequestFeedback:no.current?void 0:Po}):(0,$.jsx)(bF,{state:La.state,lastResponse:La.lastResponse,handleSelect:La.handleSelect,handleTranscriptSelect:La.handleTranscriptSelect,inputValue:Rr,setInputValue:Hr,onRequestFeedback:Po,message:`How well did Claude use its memory? (optional)`}):(0,$.jsx)(bF,{state:Ia.state,lastResponse:Ia.lastResponse,handleSelect:Ia.handleSelect,inputValue:Rr,setInputValue:Hr,onRequestFeedback:Po}),za.state!==`closed`&&(0,$.jsx)(bF,{state:za.state,lastResponse:null,handleSelect:()=>{},handleTranscriptSelect:za.handleTranscriptSelect,inputValue:Rr,setInputValue:Hr}),ja.suggestion&&(0,$.jsx)(PN,{isOpen:ja.isOpen,skillName:ja.suggestion.skillName,updates:ja.suggestion.updates,handleSelect:ja.handleSelect,inputValue:Rr,setInputValue:Hr}),Ma&&(0,$.jsx)(uL,{}),(0,$.jsx)(ZM,{debug:n,ideSelection:gt,hasSuppressedDialogs:!!fo,isLocalJSXCommandActive:sr,getToolUseContext:Co,toolPermissionContext:F,setToolPermissionContext:bo,apiKeyStatus:Qa,commands:qt,agents:L.activeAgents,isLoading:W,onExit:zo,verbose:te,messages:G,onAutoUpdaterResult:Rn,autoUpdaterResult:Ln,input:Rr,onInputChange:Hr,mode:Ur,onModeChange:Wr,stashedPrompt:Gr,setStashedPrompt:qr,submitCount:ai,onShowMessageSelector:Bo,onMessageActionsEnter:void 0,mcpClients:ht,pastedContents:ri,setPastedContents:ii,vimMode:Ui,setVimMode:Wi,showBashesDialog:Gi,setShowBashesDialog:Ji,onSubmit:Ao,onAgentSubmit:jo,isSearchingHistory:Yi,setIsSearchingHistory:Xi,helpOpen:Zi,setHelpOpen:$i,insertTextRef:Vr,voiceInterimRange:rs.interimRange}),(0,$.jsx)(HP,{onBackgroundSession:wo,isLoading:W}),(0,$.jsx)(NP,{})]}),Cr&&(0,$.jsx)(Fd,{cursor:Cr}),uo===`message-selector`&&(0,$.jsx)(db,{messages:G,preselectedMessage:ki,onPreRestore:mo,onRestoreCode:async e=>{await ha(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)},onSummarize:async(e,t,n=`from`)=>{let r=jc(G),i=r.indexOf(e);if(i===-1){K(e=>[...e,Na(`That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.`,`warning`)]);return}let a=Co(r,[],Ki(),Te),o=a.getAppState(),s=await pf(a.options.tools,a.options.mainLoopModel,Array.from(o.toolPermissionContext.additionalWorkingDirectories.keys()),a.options.mcpClients),c=of({mainThreadAgentDefinition:void 0,toolUseContext:a,customSystemPrompt:a.options.customSystemPrompt,defaultSystemPrompt:s,appendSystemPrompt:a.options.appendSystemPrompt}),[l,u]=await Promise.all([Wl(),Ho()]),d=await Ip(r,i,a,{systemPrompt:c,userContext:l,systemContext:u,toolUseContext:a,forkContextMessages:r},t,n),f=d.messagesToKeep??[],p=n===`up_to`?[...d.summaryMessages,...f]:[...f,...d.summaryMessages],m=[d.boundaryMarker,...p,...d.attachments,...d.hookResults];if(El()&&n===`from`?K(t=>{let n=t.findIndex(t=>t.uuid===e.uuid);return[...t.slice(0,n===-1?0:n),...m]}):K(m),sz?.setContextBlocked(!1),Fi(zS()),Aa(a.options.querySource),n===`from`){let t=kp(e);t&&(Hr(t.text),Wr(t.mode))}ut({key:`summarize-ctrl-o-hint`,text:`Conversation summarized (${oa(`app:toggleTranscript`,`Global`,`ctrl+o`)} for history)`,priority:`medium`,timeoutMs:8e3})},onRestoreMessage:Ko,onClose:()=>{Di(!1),Ai(void 0)}}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(yL,{})]}),!(Zs&&El())&&Qs?(0,$.jsx)(ND,{}):null]})})},us)]});return El()?(0,$.jsx)(ce,{mouseTracking:Xa(),children:tc}):tc}export{jz as t};
|
|
147
|
+
`)},t=()=>{ds(e=>e+1)};return ss?.on(`suspend`,e),ss?.on(`resume`,t),()=>{ss?.off(`suspend`,e),ss?.off(`resume`,t)}},[ss]);let fs=(0,Q.useMemo)(()=>{if(!W)return null;let e=G.filter(e=>{if(e.type!==`progress`)return!1;let t=e.data;return t.type===`hook_progress`&&(t.hookEvent===`Stop`||t.hookEvent===`SubagentStop`)});if(e.length===0)return null;let t=e.at(-1)?.toolUseID;if(!t||G.some(e=>e.type===`system`&&e.subtype===`stop_hook_summary`&&e.toolUseID===t))return null;let n=e.filter(e=>e.toolUseID===t),r=n.length,i=mi(G,e=>{if(e.type!==`attachment`)return!1;let n=e.attachment;return`hookEvent`in n&&(n.hookEvent===`Stop`||n.hookEvent===`SubagentStop`)&&`toolUseID`in n&&n.toolUseID===t}),a=n.find(e=>e.data.statusMessage)?.data.statusMessage;if(a)return r===1?`${a}…`:`${a}… ${i}/${r}`;let o=n[0]?.data.hookEvent===`SubagentStop`?`subagent stop`:`stop`;if(process.env.USER_TYPE===`ant`){let e=n[i]?.data.command,t=e?` '${Oi(e,40)}'`:``;return r===1?`running ${o} hook${t}`:`running ${o} hook${t}\u2026 ${i}/${r}`}return r===1?`running ${o} hook`:`running stop hooks… ${i}/${r}`},[G,W]),ps=(0,Q.useCallback)(()=>{Lr({messagesLength:G.length,streamingToolUsesLength:Qt.length})},[G.length,Qt.length]),ms=(0,Q.useCallback)(()=>{Lr(null)},[]),hs=El()&&!N,gs=(0,Q.useRef)(null),[_s,vs]=(0,Q.useState)(!1),[bs,Ss]=(0,Q.useState)(``),[Cs,ws]=(0,Q.useState)(0),[Ts,Ds]=(0,Q.useState)(0),Os=(0,Q.useCallback)((e,t)=>{ws(e),Ds(t)},[]);Oe((e,t,n)=>{if(t.ctrl||t.meta)return;if(e===`/`){gs.current?.setAnchor(),vs(!0),n.stopImmediatePropagation();return}let r=e[0];if((r===`n`||r===`N`)&&e===r.repeat(e.length)&&Cs>0){let t=r===`n`?gs.current?.nextMatch:gs.current?.prevMatch;if(t)for(let n=0;n<e.length;n++)t();n.stopImmediatePropagation()}},{isActive:ze===`transcript`&&hs&&!_s&&!Je});let{setQuery:ks,scanElement:As,setPositions:js}=I(),Ms=k().columns,Ns=Q.useRef(Ms);Q.useEffect(()=>{Ns.current!==Ms&&(Ns.current=Ms,(bs||_s)&&(vs(!1),Ss(``),ws(0),Ds(0),gs.current?.disarmSearch(),ks(``)))},[Ms,bs,_s,ks]),Oe((e,t,n)=>{if(!(t.ctrl||t.meta)){if(e===`q`){ms(),n.stopImmediatePropagation();return}if(e===`[`&&!Je)Ze(!0),Ke(!0),n.stopImmediatePropagation();else if(e===`v`){if(n.stopImmediatePropagation(),st.current)return;st.current=!0;let e=it.current,t=t=>{e===it.current&&(clearTimeout(ot.current),$e(t))};t(`rendering ${Pr.length} messages…`),(async()=>{try{let e=(await Ax(Pr,Wt,Math.max(80,(process.stdout.columns??80)-6))).replace(/[ \t]+$/gm,``),n=MS(DS(),`cc-transcript-${Date.now()}.txt`);await HS(n,e),t(Pb(n)?`opening ${n}`:`wrote ${n} · no $VISUAL/$EDITOR set`)}catch(e){t(`render failed: ${e instanceof Error?e.message:String(e)}`)}st.current=!1,e===it.current&&(ot.current=setTimeout(e=>e(``),4e3,$e))})()}}},{isActive:ze===`transcript`&&hs&&!_s});let Ps=ze===`transcript`&&hs;(0,Q.useEffect)(()=>{Ps||(Ss(``),ws(0),Ds(0),vs(!1),it.current++,clearTimeout(ot.current),Ze(!1),$e(``))},[Ps]),(0,Q.useEffect)(()=>{ks(Ps?bs:``),Ps||js(null)},[Ps,bs,ks,js]);let Fs={screen:ze,setScreen:Ve,showAllInTranscript:Ge,setShowAllInTranscript:Ke,messageCount:G.length,onEnterTranscript:ps,onExitTranscript:ms,virtualScrollActive:hs,searchBarOpen:_s},Is=Ir?Pr.slice(0,Ir.messagesLength):Pr,Ls=Ir?Qt.slice(0,Ir.streamingToolUsesLength):Qt;XN({onOpenBackgroundTasks:sr?void 0:()=>Ji(!0),onTogglePipeSelector:()=>{V(e=>{let t=e.pipeIpc??{};return{...e,pipeIpc:{...t,selectorOpen:!t.selectorOpen}}})}}),$N();let Rs=ye?B[ye]:void 0,zs=Rs&&Kp(Rs)?Rs:void 0,Vs=zs??(Rs&&Bp(Rs)?Rs:void 0),Us=fi||!W,Ws=Vs?.messages,Gs=(0,Q.useMemo)(()=>{if(!Vs)return;let e=Ws??[];if(!Bp(Vs)||Vs.agentType!==`fork`||!Vs.prompt)return e;let t=Vs.prompt.trim(),n=-1,r=-1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];if(o.type===`user`&&Array.isArray(o.message?.content)){if(o.message.content.some(Az))n=a;else if(!i){let e=o.message.content.find(e=>e.type===`text`&&typeof e.text==`string`);e&&e.text.trim()===t&&(i=!0)}continue}o.type===`assistant`&&Array.isArray(o.message?.content)&&o.message.content.some(e=>e.type===`tool_use`)&&(r=a)}let a=n===-1?e:e.map((e,t)=>t!==n||!Array.isArray(e.message?.content)?e:{...e,message:{...e.message,content:e.message.content.filter(e=>!Az(e))}});if(i)return a;let o=n===-1?r+1:n+1,s=ro({content:Vs.prompt,timestamp:new Date(Vs.startTime).toISOString()});return[...a.slice(0,o),s,...a.slice(o)]},[Vs,Ws]),qs=Vs?Gs??[]:Us?G:Pr;if(ze===`transcript`){let e=El()&&!N&&!Je?dn:void 0,t=(0,$.jsx)(kx,{messages:Is,tools:Wt,commands:qt,verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:Yr,isMessageSelectorVisible:!1,conversationId:Ni,screen:ze,agentDefinitions:L,streamingToolUses:Ls,showAllInTranscript:Ge,onOpenRateLimitOptions:Ro,isLoading:W,hidePastThinking:!0,streamingThinking:en,scrollRef:e,jumpRef:gs,onSearchMatchesChange:Os,scanElement:As,setPositions:js,disableRenderCap:Je}),n=Vn&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Vn.jsx}),r=(0,$.jsxs)(Nc,{children:[(0,$.jsx)(Oz,{isAnimating:cr,title:ar,disabled:j,noPrefix:dr}),(0,$.jsx)(WN,{...Fs}),(0,$.jsx)(rz,{voiceHandleKeyEvent:rs.handleKeyEvent,stripTrailing:rs.stripTrailing,resetAnchor:rs.resetAnchor,isActive:!Vn?.isLocalJSXCommand}),(0,$.jsx)(KN,{onSubmit:Ao,isActive:!Vn?.isLocalJSXCommand}),e?(0,$.jsx)($L,{scrollRef:dn,isActive:uo!==`ultraplan-choice`,isModal:!_s,onScroll:()=>gs.current?.disarmSearch()}):null,(0,$.jsx)(JN,{...vo}),e?(0,$.jsx)(Dx,{scrollRef:dn,scrollable:(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(XF,{})]}),bottom:_s?(0,$.jsx)(wz,{jumpRef:gs,initialQuery:``,count:Cs,current:Ts,onClose:e=>{Ss(Cs>0?e:``),vs(!1),e||(ws(0),Ds(0),gs.current?.setSearchQuery(``))},onCancel:()=>{vs(!1),gs.current?.setSearchQuery(``),gs.current?.setSearchQuery(bs),ks(bs)},setHighlight:ks}):(0,$.jsx)(Cz,{showAllInTranscript:Ge,virtualScroll:!0,status:Qe||void 0,searchBadge:bs&&Cs>0?{current:Ts,count:Cs}:void 0})}):(0,$.jsxs)($.Fragment,{children:[t,n,(0,$.jsx)(XF,{}),(0,$.jsx)(Cz,{showAllInTranscript:Ge,virtualScroll:!1,suppressShowAll:Je,status:Qe||void 0})]})]});return e?(0,$.jsx)(ce,{mouseTracking:Xa(),children:r}):r}let Js=yn&&!Vs&&qs.length<=xn.current?yn:void 0,Xs=uo===`tool-permission`?(0,$.jsx)(HE,{onDone:()=>Kn(([e,...t])=>t),onReject:ho,toolUseConfirm:Gn[0],toolUseContext:Co(G,G,nn??Ki(),Te),verbose:te,workerBadge:Gn[0]?.workerBadge,setStickyFooter:El()?Jn:void 0},Gn[0]?.toolUseID):null,Zs=Ms<100,Qs=!Vn?.shouldHidePromptInput&&!uo&&!Gi,$s=El()&&Vn?.isLocalJSXCommand===!0,ec=$s?Vn.jsx:null,tc=(0,$.jsxs)(Nc,{children:[(0,$.jsx)(Oz,{isAnimating:cr,title:ar,disabled:j,noPrefix:dr}),(0,$.jsx)(WN,{...Fs}),(0,$.jsx)(rz,{voiceHandleKeyEvent:rs.handleKeyEvent,stripTrailing:rs.stripTrailing,resetAnchor:rs.resetAnchor,isActive:!Vn?.isLocalJSXCommand}),(0,$.jsx)(KN,{onSubmit:Ao,isActive:!Vn?.isLocalJSXCommand}),(0,$.jsx)($L,{scrollRef:dn,isActive:El()&&(ec!=null||!uo||uo===`tool-permission`),onScroll:Mr}),null,(0,$.jsx)(JN,{...vo}),(0,$.jsx)(Jy,{dynamicMcpConfig:Ie,isStrictMcpConfig:m,children:(0,$.jsx)(Dx,{scrollRef:dn,overlay:Xs,bottomFloat:Qs&&!Zs?(0,$.jsx)(PD,{}):void 0,modal:ec,modalScrollRef:fn,dividerYRef:vr,hidePill:!!Vs,hideSticky:!!zs,newMessageCount:Dr?.count??0,onPillClick:()=>{wr(null),q(dn.current)},scrollable:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(OP,{}),(0,$.jsx)(kx,{messages:qs,tools:Wt,commands:qt,verbose:te,toolJSX:Vn,toolUseConfirmQueue:Gn,inProgressToolUseIDs:zs?zs.inProgressToolUseIDs??new Set:Yr,isMessageSelectorVisible:Ei,conversationId:Ni,screen:ze,streamingToolUses:Qt,showAllInTranscript:Ge,agentDefinitions:L,onOpenRateLimitOptions:Ro,isLoading:W,streamingText:W&&!Vs?gi:null,isBriefOnly:Vs?!1:je,unseenDivider:Vs?void 0:Dr,scrollRef:El()?dn:void 0,trackStickyPrompt:El()?!0:void 0,cursor:Cr,setCursor:wr,cursorNavRef:Er}),(0,$.jsx)(PI,{}),!y&&Js&&!ec&&(0,$.jsx)(yg,{param:{text:Js,type:`text`},addMargin:!0,verbose:te}),Vn&&!(Vn.isLocalJSXCommand&&Vn.isImmediate)&&!$s&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Vn.jsx}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(lL,{}),(0,$.jsx)(U,{flexGrow:1}),Da&&(0,$.jsx)(Fo,{mode:Jt,spinnerTip:de,responseLengthRef:si,apiMetricsRef:ci,overrideMessage:bi,spinnerSuffix:fs,verbose:te,loadingStartTimeRef:Cn,totalPausedMsRef:wn,pauseStartTimeRef:Tn,overrideColor:Si,overrideShimmerColor:wi,hasActiveTools:Yr.size>0,leaderIsIdle:!W}),!Da&&!W&&!yn&&!fa&&je&&!Vs&&(0,$.jsx)(Ql,{})]}),bottom:(0,$.jsxs)(U,{flexDirection:Zs?`column`:`row`,width:`100%`,alignItems:Zs?void 0:`flex-end`,children:[Zs&&El()&&Qs?(0,$.jsx)(ND,{}):null,(0,$.jsxs)(U,{flexDirection:`column`,flexGrow:1,children:[El()&&(0,$.jsx)(OM,{}),qn,Vn?.isLocalJSXCommand&&Vn.isImmediate&&!$s&&(0,$.jsx)(U,{flexDirection:`column`,width:`100%`,children:Vn.jsx}),!Da&&!Vn?.isLocalJSXCommand&&fe&&Ht&&Ht.length>0&&(0,$.jsx)(U,{width:`100%`,flexDirection:`column`,children:(0,$.jsx)(Ld,{tasks:Ht,isStandalone:!0})}),uo===`sandbox-permission`&&(0,$.jsx)(JF,{hostPattern:Yn[0].hostPattern,onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=Yn[0];if(!r)return;let i=r.hostPattern.host;if(n){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:t?`allow`:`deny`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:jp(t.toolPermissionContext,e)})),Jo(e),Bs.refreshConfig()}Xn(e=>(e.filter(e=>e.hostPattern.host===i).forEach(e=>e.resolvePromise(t)),e.filter(e=>e.hostPattern.host!==i)));let a=$n.current.get(i);if(a){for(let e of a)e();$n.current.delete(i)}}},Yn[0].hostPattern.host),uo===`prompt`&&(0,$.jsx)(fD,{title:Zn[0].title,toolInputSummary:Zn[0].toolInputSummary,request:Zn[0].request,onRespond:e=>{let t=Zn[0];t&&(t.resolve({prompt_response:t.request.prompt,selected:e}),Qn(([,...e])=>e))},onAbort:()=>{let e=Zn[0];e&&(e.reject(Error(`Prompt cancelled by user`)),Qn(([,...e])=>e))}},Zn[0].request.prompt),pe&&(0,$.jsx)(pC,{toolName:pe.toolName,description:pe.description}),me&&(0,$.jsx)(pC,{toolName:`Network Access`,description:`Waiting for leader to approve network access to ${me.host}`}),uo===`worker-sandbox-permission`&&(0,$.jsx)(JF,{hostPattern:{host:he.queue[0].host,port:void 0},onUserResponse:e=>{let{allow:t,persistToSettings:n}=e,r=he.queue[0];if(!r)return;let i=r.host;if(sf(r.workerName,r.requestId,i,t,z?.teamName),n&&t){let e={type:`addRules`,rules:[{toolName:`WebFetch`,ruleContent:`domain:${i}`}],behavior:`allow`,destination:`localSettings`};V(t=>({...t,toolPermissionContext:jp(t.toolPermissionContext,e)})),Jo(e),Bs.refreshConfig()}V(e=>({...e,workerSandboxPermissions:{...e.workerSandboxPermissions,queue:e.workerSandboxPermissions.queue.slice(1)}}))}},he.queue[0].requestId),uo===`elicitation`&&(0,$.jsx)(lD,{event:ge.queue[0],onResponse:(e,t)=>{let n=ge.queue[0];n&&(n.respond({action:e,content:t}),n.params.mode===`url`&&e===`accept`||V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})))},onWaitingDismiss:e=>{let t=ge.queue[0];V(e=>({...e,elicitation:{queue:e.elicitation.queue.slice(1)}})),t?.onWaitingDismiss?.(e)}},ge.queue[0].serverName+`:`+String(ge.queue[0].requestId)),uo===`cost`&&(0,$.jsx)(YS,{onDone:()=>{Mi(!1),Hi(!0),kt(e=>({...e,hasAcknowledgedCostThreshold:!0})),Y(`tengu_cost_threshold_acknowledged`,{})}}),uo===`idle-return`&&Ii&&(0,$.jsx)(XS,{idleMinutes:Ii.idleMinutes,totalInputTokens:wt(),onDone:async e=>{let t=Ii;if(Li(null),Y(`tengu_idle_return_action`,{action:e,idleMinutes:Math.round(t.idleMinutes),messageCount:pr.current.length,totalInputTokens:wt()}),e===`dismiss`){Hr(t.input);return}if(e===`never`&&kt(e=>e.idleReturnDismissed?e:{...e,idleReturnDismissed:!0}),e===`clear`){let{clearConversation:e}=await import(`./conversation-DVhyJA1O.js`);await e({setMessages:K,readFileState:Ha.current,discoveredSkillNames:Ka.current,loadedNestedMemoryPaths:Ja.current,getAppState:()=>H.getState(),setAppState:V,setConversationId:Fi}),rr.current=!1,nr(void 0),Wa.current.clear(),Ga.current=0}Ri.current=!0,Io.current(t.input,{setCursorOffset:()=>{},clearBuffer:()=>{},resetHistory:()=>{}})}}),uo===`ide-onboarding`&&(0,$.jsx)(wa,{onDone:()=>Dt(!1),installationStatus:Ct}),process.env.USER_TYPE===`ant`&&uo===`model-switch`&&_z&&(0,$.jsx)(_z,{onDone:(e,t)=>{At(!1),e===`switch`&&t&&V(e=>({...e,mainLoopModel:t,mainLoopModelForSession:null}))}}),process.env.USER_TYPE===`ant`&&uo===`undercover-callout`&&yz&&(0,$.jsx)(yz,{onDone:()=>Bn(!1)}),uo===`effort-callout`&&(0,$.jsx)(GP,{model:Te,onDone:e=>{Mt(!1),e!==`dismiss`&&V(t=>({...t,effortValue:e}))}}),uo===`remote-callout`&&(0,$.jsx)(Wb,{onDone:e=>{V(t=>t.showRemoteCallout?{...t,showRemoteCallout:!1,...e===`enable`&&{replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1}}:t)}}),io,uo===`plugin-hint`&&Rt&&(0,$.jsx)(SI,{pluginName:Rt.pluginName,pluginDescription:Rt.pluginDescription,marketplaceName:Rt.marketplaceName,sourceCommand:Rt.sourceCommand,onResponse:zt}),uo===`search-extra-tools-hint`&&Bt.visible&&(0,$.jsx)(wI,{tools:Bt.tools,onSelect:Bt.handleSelect,onDismiss:Bt.handleDismiss}),uo===`lsp-recommendation`&&It&&(0,$.jsx)(yI,{pluginName:It.pluginName,pluginDescription:It.pluginDescription,fileExtension:It.fileExtension,onResponse:Lt}),uo===`desktop-upsell`&&(0,$.jsx)(bS,{onDone:()=>Ft(!1)}),uo===`ultraplan-choice`&&_e&&(0,$.jsx)(CL,{plan:_e.plan,sessionId:_e.sessionId,taskId:_e.taskId,setMessages:K,readFileState:Ha.current,getAppState:()=>H.getState(),setConversationId:Fi}),uo===`ultraplan-launch`&&ve&&(0,$.jsx)(EL,{onChoice:(e,t)=>{let n=ve.blurb;if(V(e=>e.ultraplanLaunchPending?{...e,ultraplanLaunchPending:void 0}:e),e===`cancel`)return;K(e=>[...e,Ag(ua(`ultraplan`,n))]);let r=e=>K(t=>[...t,Ag(`<local-command-stdout>${$_(e)}</local-command-stdout>`)]);hg({blurb:n,promptIdentifier:t?.promptIdentifier,getAppState:()=>H.getState(),setAppState:V,signal:Ki().signal,disconnectedBridge:t?.disconnectedBridge,onSessionReady:e=>{if(!mn.isActive){r(e);return}let t=mn.subscribe(()=>{mn.isActive||(t(),H.getState().ultraplanSessionUrl&&r(e))})}}).then(r).catch(Qr)}}),Ta(),!Vn?.shouldHidePromptInput&&!uo&&!oo&&!y&&!Cr&&(0,$.jsxs)($.Fragment,{children:[eo&&(0,$.jsx)(aL,{onRun:Mo,onCancel:No,reason:cL(eo)}),Ia.state===`closed`?La.state===`closed`?(0,$.jsx)(bF,{state:Fa.state,lastResponse:Fa.lastResponse,handleSelect:Fa.handleSelect,handleTranscriptSelect:Fa.handleTranscriptSelect,inputValue:Rr,setInputValue:Hr,onRequestFeedback:no.current?void 0:Po}):(0,$.jsx)(bF,{state:La.state,lastResponse:La.lastResponse,handleSelect:La.handleSelect,handleTranscriptSelect:La.handleTranscriptSelect,inputValue:Rr,setInputValue:Hr,onRequestFeedback:Po,message:`How well did Claude use its memory? (optional)`}):(0,$.jsx)(bF,{state:Ia.state,lastResponse:Ia.lastResponse,handleSelect:Ia.handleSelect,inputValue:Rr,setInputValue:Hr,onRequestFeedback:Po}),za.state!==`closed`&&(0,$.jsx)(bF,{state:za.state,lastResponse:null,handleSelect:()=>{},handleTranscriptSelect:za.handleTranscriptSelect,inputValue:Rr,setInputValue:Hr}),ja.suggestion&&(0,$.jsx)(PN,{isOpen:ja.isOpen,skillName:ja.suggestion.skillName,updates:ja.suggestion.updates,handleSelect:ja.handleSelect,inputValue:Rr,setInputValue:Hr}),Ma&&(0,$.jsx)(uL,{}),(0,$.jsx)(ZM,{debug:n,ideSelection:gt,hasSuppressedDialogs:!!fo,isLocalJSXCommandActive:sr,getToolUseContext:Co,toolPermissionContext:F,setToolPermissionContext:bo,apiKeyStatus:Qa,commands:qt,agents:L.activeAgents,isLoading:W,onExit:zo,verbose:te,messages:G,onAutoUpdaterResult:Rn,autoUpdaterResult:Ln,input:Rr,onInputChange:Hr,mode:Ur,onModeChange:Wr,stashedPrompt:Gr,setStashedPrompt:qr,submitCount:ai,onShowMessageSelector:Bo,onMessageActionsEnter:void 0,mcpClients:ht,pastedContents:ri,setPastedContents:ii,vimMode:Ui,setVimMode:Wi,showBashesDialog:Gi,setShowBashesDialog:Ji,onSubmit:Ao,onAgentSubmit:jo,isSearchingHistory:Yi,setIsSearchingHistory:Xi,helpOpen:Zi,setHelpOpen:$i,insertTextRef:Vr,voiceInterimRange:rs.interimRange}),(0,$.jsx)(HP,{onBackgroundSession:wo,isLoading:W}),(0,$.jsx)(NP,{})]}),Cr&&(0,$.jsx)(Fd,{cursor:Cr}),uo===`message-selector`&&(0,$.jsx)(db,{messages:G,preselectedMessage:ki,onPreRestore:mo,onRestoreCode:async e=>{await ha(e=>{V(t=>({...t,fileHistory:e(t.fileHistory)}))},e.uuid)},onSummarize:async(e,t,n=`from`)=>{let r=jc(G),i=r.indexOf(e);if(i===-1){K(e=>[...e,Na(`That message is no longer in the active context (snipped or pre-compact). Choose a more recent message.`,`warning`)]);return}let a=Co(r,[],Ki(),Te),o=a.getAppState(),s=await pf(a.options.tools,a.options.mainLoopModel,Array.from(o.toolPermissionContext.additionalWorkingDirectories.keys()),a.options.mcpClients),c=of({mainThreadAgentDefinition:void 0,toolUseContext:a,customSystemPrompt:a.options.customSystemPrompt,defaultSystemPrompt:s,appendSystemPrompt:a.options.appendSystemPrompt}),[l,u]=await Promise.all([Wl(),Ho()]),d=await Ip(r,i,a,{systemPrompt:c,userContext:l,systemContext:u,toolUseContext:a,forkContextMessages:r},t,n),f=d.messagesToKeep??[],p=n===`up_to`?[...d.summaryMessages,...f]:[...f,...d.summaryMessages],m=[d.boundaryMarker,...p,...d.attachments,...d.hookResults];if(El()&&n===`from`?K(t=>{let n=t.findIndex(t=>t.uuid===e.uuid);return[...t.slice(0,n===-1?0:n),...m]}):K(m),sz?.setContextBlocked(!1),Fi(zS()),Aa(a.options.querySource),n===`from`){let t=kp(e);t&&(Hr(t.text),Wr(t.mode))}ut({key:`summarize-ctrl-o-hint`,text:`Conversation summarized (${oa(`app:toggleTranscript`,`Global`,`ctrl+o`)} for history)`,priority:`medium`,timeoutMs:8e3})},onRestoreMessage:Ko,onClose:()=>{Di(!1),Ai(void 0)}}),process.env.USER_TYPE===`ant`&&(0,$.jsx)(yL,{})]}),!(Zs&&El())&&Qs?(0,$.jsx)(ND,{}):null]})})},us)]});return El()?(0,$.jsx)(ce,{mouseTracking:Xa(),children:tc}):tc}export{jz as t};
|