claude-code-best 2.6.5 → 2.6.6
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-BYyM_V0q.js → AddWorkspaceDirectory-Bb6crGWh.js} +1 -1
- package/dist/chunks/{App-BboadKdn.js → App-CW0Y4ceR.js} +1 -1
- package/dist/chunks/{ApproveApiKey-BLp4742y.js → ApproveApiKey-9rkwQfgT.js} +1 -1
- package/dist/chunks/ApproveApiKey-BhMr2Y5F.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-B88DM0Oq.js → AssistantSessionChooser-XzXZZdiH.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-BL_dfbZP.js +2 -0
- package/dist/chunks/BypassPermissionsModeDialog-DlLWAKw2.js +1 -0
- package/dist/chunks/{ClaudeInChromeOnboarding-B6XNhFqq.js → ClaudeInChromeOnboarding-CjGydpBk.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-BNhlq7_K.js → ClaudeMdExternalIncludesDialog-B04cjDwX.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DPki55Xa.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-D_j1NebK.js +1 -0
- package/dist/chunks/{DesktopHandoff-S-w4bs5T.js → DesktopHandoff-CFBUqcCf.js} +1 -1
- package/dist/chunks/DevChannelsDialog-ByTf41du.js +1 -0
- package/dist/chunks/DiffDialog-CY-8kw_Q.js +3 -0
- package/dist/chunks/Doctor-2D5Wz58o.js +1 -0
- package/dist/chunks/Doctor-CDez_u_U.js +3 -0
- package/dist/chunks/{ExitFlow-CSBDxw9H.js → ExitFlow-BlON8IgH.js} +2 -2
- package/dist/chunks/Feedback-CSeD3k4M.js +2 -0
- package/dist/chunks/Grove-Dwu_0zRw.js +1 -0
- package/dist/chunks/{Grove-DSXRnXKv.js → Grove-Tp_UtIMg.js} +1 -1
- package/dist/chunks/{HybridTransport-CuT3KI5e.js → HybridTransport-CAko699F.js} +2 -2
- package/dist/chunks/{ITermBackend-mokGZVH_.js → ITermBackend-5P3WJumD.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-Bi4RKYlk.js → InvalidConfigDialog-CVcdra9v.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-0zKo4-so.js → InvalidSettingsDialog-CfLdbmSI.js} +1 -1
- package/dist/chunks/MCPConnectionManager-BK_3uwQj.js +1 -0
- package/dist/chunks/{McpParsingWarnings-EzgsOoHw.js → McpParsingWarnings-BOj-T8F3.js} +1 -1
- package/dist/chunks/MessageSelector-BRkxpO1O.js +3 -0
- package/dist/chunks/Messages-wyMyMP7U.js +11 -0
- package/dist/chunks/{Onboarding-odmthwzz.js → Onboarding-C06Mxlf-.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-Cpk_5Lv0.js → OverageCreditUpsell-abcPm3PB.js} +1 -1
- package/dist/chunks/PluginSettings-DGpIVGvV.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-DrrkNOuS.js → PromptInputFooterSuggestions-ihnbjU0K.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-DMsF4D6d.js → PromptInputHelpMenu-CMm8z7Gk.js} +1 -1
- package/dist/chunks/QueryEngine-I3Bqzbiz.js +1 -0
- package/dist/chunks/REPL-BxAsVlx3.js +1 -0
- package/dist/chunks/REPL-CBFcgD4r.js +97 -0
- package/dist/chunks/{RemoteCallout-CnpCWRPk.js → RemoteCallout-Cy6lH-CZ.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-OWg_Yccq.js → RemoteSessionManager-C7iGd5Og.js} +2 -2
- package/dist/chunks/ResumeConversation-AdLtgdVB.js +1 -0
- package/dist/chunks/{SSETransport-BpnapvlK.js → SSETransport-B5xlXeAN.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-BJ8Nx_Nu.js +1 -0
- package/dist/chunks/SentryErrorBoundary-Bs7mtkPb.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-C-NlfQZw.js → SentryErrorBoundary-iih9eFpM.js} +1 -1
- package/dist/chunks/Settings-PioHwsvg.js +2 -0
- package/dist/chunks/{TeleportProgress-CYXay2ZL.js → TeleportProgress-BX-uLwuL.js} +1 -1
- package/dist/chunks/TeleportRepoMismatchDialog-D8oPPTWd.js +1 -0
- package/dist/chunks/{TeleportResumeWrapper-DiHQeZIM.js → TeleportResumeWrapper-B_CvNDbr.js} +1 -1
- package/dist/chunks/{ThemePicker-BRh027fA.js → ThemePicker-BG1ykSpX.js} +1 -1
- package/dist/chunks/{TmuxBackend-BaX2U7iZ.js → TmuxBackend-CnMCWNS4.js} +1 -1
- package/dist/chunks/TrustDialog-Z_maAYj8.js +1 -0
- package/dist/chunks/{ValidationErrorsList-CdCUgfIl.js → ValidationErrorsList-C9swVkZ-.js} +1 -1
- package/dist/chunks/{WelcomeV2-DCXcYd2x.js → WelcomeV2-Au_5ddlT.js} +1 -1
- package/dist/chunks/WindowsTerminalBackend-CGxaYH74.js +2 -0
- package/dist/chunks/{add-dir-ldGd3Ppz.js → add-dir-Cm9u56YX.js} +1 -1
- package/dist/chunks/{agentDisplay-CVnAeURF.js → agentDisplay-Bi_bEyEn.js} +1 -1
- package/dist/chunks/{agents-DH5fmbVw.js → agents-CMF9fLzV.js} +7 -7
- package/dist/chunks/{agents-C08NzRZx.js → agents-CbjR7hNr.js} +1 -1
- package/dist/chunks/{ant-DJren1Aa.js → ant-Bu1Gs4WJ.js} +1 -1
- package/dist/chunks/api-CFNGoLoL.js +1 -0
- package/dist/chunks/{api-CGOR_Xfl.js → api-D_t0nHsS.js} +1 -1
- package/dist/chunks/assistant-BLd4y2FJ.js +1 -0
- package/dist/chunks/{assistant-aWkDcurV.js → assistant-C_pfWe2a.js} +1 -1
- package/dist/chunks/{assistant-BlzrMSkM.js → assistant-EA-MHNQ-.js} +1 -1
- package/dist/chunks/{auth-CSB2RDKF.js → auth-D7PZvVPf.js} +1 -1
- package/dist/chunks/auth-DGfZCD_B.js +1 -0
- package/dist/chunks/{autoMode-CWvZs1jO.js → autoMode-B8iO05xy.js} +6 -6
- package/dist/chunks/{autonomy-BkVcSMCZ.js → autonomy-CaLvE5N6.js} +12 -12
- package/dist/chunks/{autonomy-DK42aJYt.js → autonomy-dQVtSiCJ.js} +1 -1
- package/dist/chunks/{autonomyPanel-Cn4IhXgE.js → autonomyPanel-DSswVlCF.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-Ckj8W3RO.js +1 -0
- package/dist/chunks/backgroundHousekeeping-D2_Uopt7.js +17 -0
- package/dist/chunks/{branch-juox_fko.js → branch-C7pM8Sjh.js} +1 -1
- package/dist/chunks/{bridge-DudsCZkh.js → bridge-CTYdzSWg.js} +2 -2
- package/dist/chunks/bridgeConfig-7c07tJm9.js +1 -0
- package/dist/chunks/{bridgeConfig-lRZfQqmA.js → bridgeConfig-Df6uyp3q.js} +1 -1
- package/dist/chunks/{bridgeEnabled-D2IykaHE.js → bridgeEnabled-A-_xJ94c.js} +1 -1
- package/dist/chunks/bridgeEnabled-Z2S8lk0l.js +1 -0
- package/dist/chunks/bridgeMain-B7FZpvo0.js +68 -0
- package/dist/chunks/bridgeMain-C5UxF8ST.js +1 -0
- package/dist/chunks/{bridgeMessaging-CqNURC4-.js → bridgeMessaging-DPVLAIzl.js} +1 -1
- package/dist/chunks/{btw-DKlE3Dea.js → btw-CqgjLlFN.js} +1 -1
- package/dist/chunks/{buddy-DQYgHR63.js → buddy-DCGBAqF2.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-Bof-UtM-.js → bypassPermissionsKillswitch-CK0jeZTW.js} +1 -1
- package/dist/chunks/{caches-B5QZDncQ.js → caches-CdVW8fYV.js} +2 -2
- package/dist/chunks/caches-Dt52PedI.js +1 -0
- package/dist/chunks/{ccrClient-BaWg4E9-.js → ccrClient-B_3AmY7K.js} +1 -1
- package/dist/chunks/changeDetector-uO9CBvut.js +1 -0
- package/dist/chunks/{channelNotification-B7A-9DIl.js → channelNotification-BbDQdLZC.js} +1 -1
- package/dist/chunks/channelNotification-DzTzUrCe.js +1 -0
- package/dist/chunks/{chrome-jMAks7-w.js → chrome-CGyqsCkL.js} +1 -1
- package/dist/chunks/clear-B_cVk64B.js +1 -0
- package/dist/chunks/client-BcqXgcrx.js +1 -0
- package/dist/chunks/{color-DG_R5-hl.js → color-DEXUx7gE.js} +1 -1
- package/dist/chunks/commands-BX0_wEGw.js +1 -0
- package/dist/chunks/commitAttribution-CSVDcgTO.js +1 -0
- package/dist/chunks/{commitAttribution-C22a3OCi.js → commitAttribution-e0kkanVT.js} +1 -1
- package/dist/chunks/{compact-BWvnb4or.js → compact-Dh9RewNA.js} +3 -3
- package/dist/chunks/{companion-Bkn2lSLj.js → companion-DVFacTUw.js} +1 -1
- package/dist/chunks/{config-BvpTbJ5p.js → config-CkSmYDJY.js} +1 -1
- package/dist/chunks/{config-D-dzD6n-.js → config-DwiVCSrY.js} +1 -1
- package/dist/chunks/{context-DzNahdyP.js → context-B8VDDHTv.js} +1 -1
- package/dist/chunks/{context-noninteractive-yiyJriiw.js → context-noninteractive-IZfWniex.js} +2 -2
- package/dist/chunks/context-noninteractive-SBxqQ3iu.js +1 -0
- package/dist/chunks/conversation-CQBl9Yy2.js +1 -0
- package/dist/chunks/conversation-DVZplNag.js +1 -0
- package/dist/chunks/{copy-9k9JPRqW.js → copy-CIjrYoFa.js} +2 -2
- package/dist/chunks/{createSSHSession-BZf-Loo5.js → createSSHSession-ArNlbIZB.js} +1 -1
- package/dist/chunks/{createSession-kiTHYXSL.js → createSession-CBheIT_G.js} +1 -1
- package/dist/chunks/createSession-DfEQy2dZ.js +1 -0
- package/dist/chunks/cronJitterConfig-DcMGWOa-.js +6 -0
- package/dist/chunks/crossProjectResume-Z-aR2q-d.js +40 -0
- package/dist/chunks/{datadog-Bg-zL-i7.js → datadog-BK8eJz8B.js} +1 -1
- package/dist/chunks/datadog-Uj6FjEuU.js +1 -0
- package/dist/chunks/{desktop-DpaStjc-.js → desktop-B9vWJeRu.js} +1 -1
- package/dist/chunks/{diff-N_VSBo3Z.js → diff-BTV7_Dca.js} +1 -1
- package/dist/chunks/{doctor-CUWjbh1X.js → doctor-Dpbh0aRz.js} +1 -1
- package/dist/chunks/{effort-loH1TUvE.js → effort-Czlwa5qF.js} +2 -2
- package/dist/chunks/{entry-D58E-E6Y.js → entry-CdfuWjKu.js} +3 -3
- package/dist/chunks/{envLessBridgeConfig-SPEr9oqO.js → envLessBridgeConfig-BAFYaZ0E.js} +1 -1
- package/dist/chunks/envLessBridgeConfig-DOO9eX07.js +1 -0
- package/dist/chunks/{exit-D-tuPpbx.js → exit-DzOm62Dn.js} +1 -1
- package/dist/chunks/{export-BIZ_SPXJ.js → export-DHOR3z3Z.js} +1 -1
- package/dist/chunks/{exportRenderer-CWPSMaqM.js → exportRenderer-CiNXeNr9.js} +1 -1
- package/dist/chunks/extra-usage-CJcyfVCt.js +1 -0
- package/dist/chunks/{extra-usage-CCMwIa85.js → extra-usage-DIYR_3ZR.js} +1 -1
- package/dist/chunks/{extra-usage-core-BNW4VT7o.js → extra-usage-core-C3uM9bOP.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-B_WjXO1E.js → extra-usage-noninteractive-Ctz9TfY8.js} +1 -1
- package/dist/chunks/{extraUsage-CNMMTNJi.js → extraUsage-CBwIvl73.js} +1 -1
- package/dist/chunks/extractMemories-C3SU-Osb.js +1 -0
- package/dist/chunks/fast-7iinMwk-.js +1 -0
- package/dist/chunks/{fast-CG1v3fRr.js → fast-BpBwjbSD.js} +1 -1
- package/dist/chunks/{feedback-CG4mS_-B.js → feedback-BkVnsZVx.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-Y_jAnHoR.js → firstPartyEventLogger-BCzGkdpd.js} +1 -1
- package/dist/chunks/{flushGate-COPcye5f.js → flushGate-CQsnMw8g.js} +1 -1
- package/dist/chunks/{gates-CSKxLmMJ.js → gates-CxWIWtmd.js} +1 -1
- package/dist/chunks/gates-qgzva-fO.js +1 -0
- package/dist/chunks/{gemini-B3uSLiNp.js → gemini-BbV8D2SS.js} +1 -1
- package/dist/chunks/{generateRecap-D7rG3jIm.js → generateRecap-B3j2nUgh.js} +1 -1
- package/dist/chunks/{generateSessionName-zbqanivg.js → generateSessionName-aGnXSNgN.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-B04nEUDG.js → githubRepoPathMapping-DCJLSTLl.js} +1 -1
- package/dist/chunks/{grok-CDOpos8E.js → grok-C4QFXJnR.js} +1 -1
- package/dist/chunks/{growthbook-C_EY78Sn.js → growthbook-prtWhMRg.js} +1 -1
- package/dist/chunks/{heapdump-CpmhJ55b.js → heapdump-Czm-2XiG.js} +1 -1
- package/dist/chunks/{help-EHn2neTv.js → help-CSAFsN0-.js} +1 -1
- package/dist/chunks/hooks-Ch2vPE8u.js +1 -0
- package/dist/chunks/{hooks-BV6HqbU4.js → hooks-DkbOP-bI.js} +2 -2
- package/dist/chunks/{hostAdapter-_SmFAVNf.js → hostAdapter-BcdDPVTj.js} +1 -1
- package/dist/chunks/{ide-DkN0KdTR.js → ide-BXERRFZF.js} +2 -2
- package/dist/chunks/{inboundAttachments-DnGQw7Pf.js → inboundAttachments-7rXrAtkb.js} +1 -1
- package/dist/chunks/inboundAttachments-C0rkLl2x.js +1 -0
- package/dist/chunks/initReplBridge-tXqkba08.js +1 -0
- package/dist/chunks/{insights-Bs9kJDG6.js → insights-DrvqJgF8.js} +25 -25
- package/dist/chunks/{install-CFX_ph9z.js → install-BGnxwO00.js} +1 -1
- package/dist/chunks/{install-github-app-CvRjY1Wi.js → install-github-app-CIpBHlr9.js} +2 -2
- package/dist/chunks/{install-slack-app-DjhnVSe0.js → install-slack-app-By4Lh7ww.js} +1 -1
- package/dist/chunks/{instrumentation-c5zlOWom.js → instrumentation-D9y7Ph_R.js} +3 -3
- package/dist/chunks/{job-3QwLq609.js → job-BPVIMW_P.js} +1 -1
- package/dist/chunks/{keybindings-7mDm3UKD.js → keybindings-Ce6AHMLI.js} +2 -2
- package/dist/chunks/{lang-DyyjY20G.js → lang-DfDG_fSa.js} +1 -1
- package/dist/chunks/language-B1yHC1d6.js +1 -0
- package/dist/chunks/{language-CPRGmY8Q.js → language-yGoDFP3X.js} +1 -1
- package/dist/chunks/{launchAgentsPlatform-CpsMsTqQ.js → launchAgentsPlatform-DT01xZM7.js} +1 -1
- package/dist/chunks/launchAutofixPr-DrYd7WVf.js +18 -0
- package/dist/chunks/{launchLocalMemory-DlYQcEQJ.js → launchLocalMemory-Bt3tMYVJ.js} +1 -1
- package/dist/chunks/{launchLocalVault-CP0AyPjj.js → launchLocalVault-jyRHEa_Y.js} +1 -1
- package/dist/chunks/{launchMemoryStores-BHoDFkJ5.js → launchMemoryStores-cmXnLAF5.js} +1 -1
- package/dist/chunks/{launchOnboarding-CFTNXcnc.js → launchOnboarding-BPTNFftb.js} +1 -1
- package/dist/chunks/{launchSchedule-5KQr6x_A.js → launchSchedule-141GqGC8.js} +1 -1
- package/dist/chunks/{launchSkillStore-D0yGuE68.js → launchSkillStore-Bz0lok_o.js} +1 -1
- package/dist/chunks/{launchTeleport-DRKnXOwY.js → launchTeleport-BMquJxIq.js} +2 -2
- package/dist/chunks/{launchVault-XA-zAswX.js → launchVault-Bsuwqad6.js} +1 -1
- package/dist/chunks/{loadAgentsDir-DI1a76pd.js → loadAgentsDir-D7kapZB5.js} +506 -498
- package/dist/chunks/loadAgentsDir-DxPE2bIO.js +1 -0
- package/dist/chunks/{loadPluginHooks-C0Ei-0E2.js → loadPluginHooks-CL5aGDrb.js} +1 -1
- package/dist/chunks/localSearch-iozuZZhZ.js +1 -0
- package/dist/chunks/{localSearch-CDOJNc_E.js → localSearch-r1_G8kfV.js} +1 -1
- package/dist/chunks/{login-nwTOoyxv.js → login-7MvpaOkt.js} +1 -1
- package/dist/chunks/login-Dxza_KNT.js +1 -0
- package/dist/chunks/{logoV2Utils-DDUoPClc.js → logoV2Utils-DjThKW15.js} +1 -1
- package/dist/chunks/logout-BeGQR78E.js +1 -0
- package/dist/chunks/{magicDocs-CmUlOWjI.js → magicDocs-Dy72LHIj.js} +2 -2
- package/dist/chunks/{main-CeG_nUsC.js → main-CF6Im-LV.js} +46 -46
- package/dist/chunks/{mappers-CJ8IO1o1.js → mappers-CkMESMy7.js} +1 -1
- package/dist/chunks/mcp-BTgHgOhR.js +2 -0
- package/dist/chunks/mcp-UJZ22IDJ.js +6 -0
- package/dist/chunks/mcp-fHf8Uc7h.js +1 -0
- package/dist/chunks/{mcpServer-lIneUZ5p.js → mcpServer-BueM5fWI.js} +1 -1
- package/dist/chunks/{mcpServer-DPHQVYdC.js → mcpServer-Dqm2PQQx.js} +1 -1
- package/dist/chunks/{memory-BcWBkKV8.js → memory-BNZmqma1.js} +1 -1
- package/dist/chunks/model-D3g2QdU-.js +1 -0
- package/dist/chunks/{model-DJLzVvcF.js → model-DOw7wIKQ.js} +1 -1
- package/dist/chunks/{onChangeAppState-Dxbl8fvk.js → onChangeAppState-Cb9_yIuW.js} +1 -1
- package/dist/chunks/{openai-DkYK4THc.js → openai-Bvo0Gcec.js} +3 -3
- package/dist/chunks/{overageCreditGrant-DLKadMYU.js → overageCreditGrant-BrN7dk3d.js} +1 -1
- package/dist/chunks/{passes-BIfuerjL.js → passes-vgcY8_l8.js} +1 -1
- package/dist/chunks/{paths-BBvuDQl9.js → paths-1ngPRtu3.js} +2 -2
- package/dist/chunks/permissions-BDbIjTT6.js +3 -0
- package/dist/chunks/{pipeTransport-DVoIA1uN.js → pipeTransport-KU8psPDI.js} +1 -1
- package/dist/chunks/{plan--lnWxB3Q.js → plan-5NVPuxp6.js} +1 -1
- package/dist/chunks/{plugin-DWLyrLw4.js → plugin-t8jMqdsY.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CGXIWBrb.js → pluginAutoupdate-CAa4KLro.js} +1 -1
- package/dist/chunks/{pluginBlocklist-DJrMdzT0.js → pluginBlocklist-BG2LkLq1.js} +1 -1
- package/dist/chunks/{pluginCliCommands-C08q9dHk.js → pluginCliCommands-vqAtVibb.js} +1 -1
- package/dist/chunks/{pluginFlagging-Dggxke70.js → pluginFlagging-BFCtv3kY.js} +1 -1
- package/dist/chunks/{pluginOperations-CNCImIe8.js → pluginOperations-C9XP-mko.js} +2 -2
- package/dist/chunks/pluginStartupCheck-DZp0wnXP.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BW2fjg2P.js → pluginStartupCheck-RRcAbKfx.js} +1 -1
- package/dist/chunks/plugins-0SyID4Kx.js +4 -0
- package/dist/chunks/policyLimits-Cmmzuv-E.js +1 -0
- package/dist/chunks/{pollConfig-DAQ-ives.js → pollConfig-DTYIJ8lQ.js} +1 -1
- package/dist/chunks/{poor-DqfrQT61.js → poor-Dw5dMZpM.js} +1 -1
- package/dist/chunks/{poorMode-DzYT47KW.js → poorMode-CsGLI_hm.js} +1 -1
- package/dist/chunks/poorMode-D_hB-rDf.js +1 -0
- package/dist/chunks/{print-GGVp62vj.js → print-Ct8N4PYT.js} +12 -12
- package/dist/chunks/{privacy-settings-agwqjYJo.js → privacy-settings-P2r-kg2i.js} +1 -1
- package/dist/chunks/processBashCommand-a8W8aTRu.js +1 -0
- package/dist/chunks/{processSlashCommand-COtIO6Jy.js → processSlashCommand-BaUdUg3T.js} +3 -3
- package/dist/chunks/prompt-B1Qy8mi4.js +1 -0
- package/dist/chunks/{prompt-CjFAtm3w.js → prompt-BBg3jtfc.js} +1 -1
- package/dist/chunks/prompt-D4kWWEZC.js +1 -0
- package/dist/chunks/{promptEditor-EgosPsy-.js → promptEditor-CvaugNTt.js} +2 -2
- package/dist/chunks/{protocolHandler-mtPUT9U0.js → protocolHandler-DxBaHlaD.js} +1 -1
- package/dist/chunks/{rate-limit-options-C6SFOHue.js → rate-limit-options-Df_sgE0b.js} +1 -1
- package/dist/chunks/rcDebugLog-CPGWJbI4.js +11 -0
- package/dist/chunks/{referral-DeDr9zAE.js → referral-BKeCKnOJ.js} +1 -1
- package/dist/chunks/{refresh-D7pdoY_X.js → refresh-Cjv4jA6L.js} +1 -1
- package/dist/chunks/{registerProtocol-BZBH8Zgl.js → registerProtocol-DLuRm0mf.js} +1 -1
- package/dist/chunks/{registry-Dz6AbiYP.js → registry-DVSgtCq5.js} +1 -1
- package/dist/chunks/{release-notes-DiUNOrg9.js → release-notes-CZcf8zB7.js} +1 -1
- package/dist/chunks/{releaseNotes-CnhQit0y.js → releaseNotes-CvfZb3fZ.js} +2 -2
- package/dist/chunks/{reload-plugins-Dx52GcaG.js → reload-plugins-pSlDLk3b.js} +1 -1
- package/dist/chunks/{remote-env-B67Oo3sI.js → remote-env-BH89NuwC.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BzSUgPbt.js → remoteBridgeCore-CrXlWEL1.js} +1 -1
- package/dist/chunks/{remoteControlServer-L8smP7Zu.js → remoteControlServer-BSOnq4yY.js} +1 -1
- package/dist/chunks/{rename-C4PauyTZ.js → rename-DNGvNQm2.js} +1 -1
- package/dist/chunks/{resume-CrSn26xq.js → resume-6UL38yL3.js} +2 -2
- package/dist/chunks/{runtimeObserver-nAhH4Wca.js → runtimeObserver-BhvHeiwD.js} +4 -4
- package/dist/chunks/{runtimeObserver-YNy3mIb7.js → runtimeObserver-Cp-DN8fP.js} +1 -1
- package/dist/chunks/sandbox-adapter-DGVtPPD0.js +1 -0
- package/dist/chunks/{sandbox-toggle-BYqbcI5d.js → sandbox-toggle-D19YbI5G.js} +1 -1
- package/dist/chunks/searchExtraTools-DXWkpOIg.js +1 -0
- package/dist/chunks/{sentry-BNVxoVLS.js → sentry-BZmpC-iI.js} +1 -1
- package/dist/chunks/{session-BuEmHrqM.js → session-lLpGqp0B.js} +2 -2
- package/dist/chunks/{sessionDiscovery-Mcsfa0g-.js → sessionDiscovery-BX3fjgzD.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-BeuS4m7a.js +1 -0
- package/dist/chunks/sessionMemory-LMOQk90c.js +1 -0
- package/dist/chunks/sessionMemory-UpILj5ww.js +1 -0
- package/dist/chunks/sessionMemoryUtils-DE7AezA0.js +1 -0
- package/dist/chunks/{sessionObserver-DG2zQgfi.js → sessionObserver-CujNIWks.js} +1 -1
- package/dist/chunks/sessionObserver-HqvTXhs9.js +1 -0
- package/dist/chunks/sessionStorage-BN56DAAd.js +1 -0
- package/dist/chunks/{sessionTitle-zUVSAHO7.js → sessionTitle-QxXslbJY.js} +1 -1
- package/dist/chunks/{sessionTracing-DoRJ4nSa.js → sessionTracing-DognYcDf.js} +1 -1
- package/dist/chunks/{settingsSync-B9bz77E1.js → settingsSync-DEPET5O1.js} +1 -1
- package/dist/chunks/{setup-B1JbPepL.js → setup-BUBUidOg.js} +1 -1
- package/dist/chunks/setup-BZMVuIIx.js +2 -0
- package/dist/chunks/{setup-CCOLlRtP.js → setup-C6G0lasE.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-BBR3uEgx.js → shadowedRuleDetection-CQayPrmM.js} +1 -1
- package/dist/chunks/{sideQuestion-DHW5rgKz.js → sideQuestion-B9EE1vTM.js} +1 -1
- package/dist/chunks/sink-BRrEbL6h.js +1 -0
- package/dist/chunks/{sink-DxDOsLa2.js → sink-Cugto5We.js} +1 -1
- package/dist/chunks/{sinks-BrrTUxkC.js → sinks-B9A94oIj.js} +2 -2
- package/dist/chunks/sinks-CKaSBvU8.js +1 -0
- package/dist/chunks/{skill-learning-C0nOKZfg.js → skill-learning-CroDcatu.js} +1 -1
- package/dist/chunks/skillChangeDetector-DnyEQqe6.js +1 -0
- package/dist/chunks/{skillGapStore-_YuJP5KI.js → skillGapStore-91Mb3xDY.js} +2 -2
- package/dist/chunks/{skillGapStore-Czi5jKjJ.js → skillGapStore-LKwap3o4.js} +1 -1
- package/dist/chunks/{skillGenerator-kbaRbpqJ.js → skillGenerator-B9GM0LHk.js} +2 -2
- package/dist/chunks/skillLearning-D6latSKi.js +1 -0
- package/dist/chunks/skillLearning-DbOOqb6b.js +1 -0
- package/dist/chunks/{skillPanel-BxDvlPzd.js → skillPanel-rIIYgnBE.js} +3 -3
- package/dist/chunks/{skillSearchPanel-D-MX6Qgt.js → skillSearchPanel-xAL-6uJF.js} +4 -4
- package/dist/chunks/{skills-NpEgFkFZ.js → skills-Doe47wxK.js} +1 -1
- package/dist/chunks/{sprites-DD4eIkN7.js → sprites-D11F3i1M.js} +1 -1
- package/dist/chunks/{stats-xL3NHwhp.js → stats-WNUyieG-.js} +1 -1
- package/dist/chunks/{status-B5E70xRv.js → status-CjBS9SkF.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-DcssRhLw.js → statusNoticeHelpers-cnI4TiGw.js} +1 -1
- package/dist/chunks/{tag-BELr-qIa.js → tag-Gfb8vTAR.js} +2 -2
- package/dist/chunks/{tasks-CrdWcSt-.js → tasks-BwX1rzOD.js} +1 -1
- package/dist/chunks/{teamHelpers--3ZyNDlv.js → teamHelpers-DEgaCpta.js} +1 -1
- package/dist/chunks/teamHelpers-EJxTXoTV.js +1 -0
- package/dist/chunks/teammateModeSnapshot-BgUQ4Phz.js +1 -0
- package/dist/chunks/{teammateModeSnapshot-DOQMTKbQ.js → teammateModeSnapshot-Dyukgtp9.js} +1 -1
- package/dist/chunks/teleport-B4p8XlAv.js +1 -0
- package/dist/chunks/{templateJobs-8IY2Cgig.js → templateJobs-DQXuFnkl.js} +1 -1
- package/dist/chunks/{terminalSetup-C4psrmpb.js → terminalSetup-CTEIn08j.js} +1 -1
- package/dist/chunks/{terminalSetup-Lyg4NbGA.js → terminalSetup-bSbq4LE7.js} +1 -1
- package/dist/chunks/{theme-B8GNnJ_q.js → theme-DazaKPy8.js} +1 -1
- package/dist/chunks/thinkback-BOfZP_QG.js +1 -0
- package/dist/chunks/{thinkback-DPXwEK3B.js → thinkback-CxWZV2Oz.js} +1 -1
- package/dist/chunks/{thinkback-play-BMOE-ceh.js → thinkback-play-CHe1x2Hc.js} +1 -1
- package/dist/chunks/{toolEventObserver-DzLd0MSn.js → toolEventObserver-D4h-QqVP.js} +1 -1
- package/dist/chunks/{toolEventObserver-D0TSHm01.js → toolEventObserver-Dfvv2trb.js} +1 -1
- package/dist/chunks/toolPool-BHChMuLr.js +1 -0
- package/dist/chunks/toolPool-C5K43w4_.js +1 -0
- package/dist/chunks/{trustedDevice-1iTu4LEm.js → trustedDevice-CQ9PK-8m.js} +1 -1
- package/dist/chunks/{trustedDevice-BvYYXfd8.js → trustedDevice-rdvUkS1W.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-BTXAN2wP.js → ultrareviewCommand-Zf9hO4wr.js} +2 -2
- package/dist/chunks/{undercover-DvvnEmsX.js → undercover-DLyKv5TE.js} +1 -1
- package/dist/chunks/undercover-DNS9V_JT.js +1 -0
- package/dist/chunks/{updateCCB-C-qfLi0j.js → updateCCB-7WQRz9lW.js} +4 -4
- package/dist/chunks/{upgrade-DTBZSxwv.js → upgrade-ByIumMQe.js} +1 -1
- package/dist/chunks/upgrade-bK4x32Ma.js +1 -0
- package/dist/chunks/{upload-BF8tf_Eo.js → upload-CvOMbA9_.js} +1 -1
- package/dist/chunks/{usage-DvSTXEYY.js → usage-C_d-Z-eb.js} +1 -1
- package/dist/chunks/{usage-BRYRRgNt.js → usage-DE4PSQiF.js} +1 -1
- package/dist/chunks/useMainLoopModel-Os8Ao8-x.js +1 -0
- package/dist/chunks/{useManagePlugins-GmnI9K53.js → useManagePlugins-BYBubfHU.js} +1 -1
- package/dist/chunks/{useMergedTools-Dah5KDMi.js → useMergedTools-BJAn2i-F.js} +1 -1
- package/dist/chunks/{useSearchInput-BV_azHiA.js → useSearchInput-CF77X2OV.js} +1 -1
- package/dist/chunks/useSettingsErrors-DD7fQ-fU.js +1 -0
- package/dist/chunks/{useVoice-DR69NLxp.js → useVoice-DwzMN0fq.js} +1 -1
- package/dist/chunks/{util-BpyJ4Bom.js → util-DD30Y4o8.js} +1 -1
- package/dist/chunks/utils-D44M8obg.js +1 -0
- package/dist/chunks/validatePlugin-DpHiJRsT.js +1 -0
- package/dist/chunks/{vim-DvOw8dfR.js → vim-zc9EiMil.js} +1 -1
- package/dist/chunks/{voice-B3BZs53f.js → voice-BRhZt4jW.js} +2 -2
- package/dist/chunks/{voiceModeEnabled-DA76xN1Q.js → voiceModeEnabled-168-1Ocs.js} +1 -1
- package/dist/chunks/voiceModeEnabled-CTT25yFj.js +1 -0
- package/dist/chunks/{voiceStreamSTT-_w1VjIOs.js → voiceStreamSTT-B80UegKG.js} +1 -1
- package/dist/chunks/voiceStreamSTT-BpYhKo2H.js +1 -0
- package/dist/chunks/{workerRegistry-2_MZVih1.js → workerRegistry-s8nnpmUO.js} +1 -1
- package/dist/chunks/worktree-CkB4jLXK.js +1 -0
- package/dist/chunks/{xml-Dx--sNE1.js → xml-DTMvLcPg.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-DiEe4eui.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-ByraVuXh.js +0 -2
- package/dist/chunks/BypassPermissionsModeDialog-BDvmz12S.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-B4ocUjev.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-BvaB9b0y.js +0 -1
- package/dist/chunks/DevChannelsDialog-BljR0X9X.js +0 -1
- package/dist/chunks/DiffDialog-BhQ2QaLW.js +0 -3
- package/dist/chunks/Doctor-BXb0qv6n.js +0 -3
- package/dist/chunks/Doctor-C5DYPEGl.js +0 -1
- package/dist/chunks/Feedback-DwHzc4UT.js +0 -2
- package/dist/chunks/Grove-DnTo982-.js +0 -1
- package/dist/chunks/MCPConnectionManager-DYGoS1Ht.js +0 -1
- package/dist/chunks/MessageSelector-DTmUuEKJ.js +0 -3
- package/dist/chunks/Messages-DWiKTx5o.js +0 -11
- package/dist/chunks/PluginSettings-eYcWehI8.js +0 -17
- package/dist/chunks/QueryEngine-C_KZts4y.js +0 -1
- package/dist/chunks/REPL-C6YR0VKU.js +0 -1
- package/dist/chunks/REPL-DzHz-LOY.js +0 -97
- package/dist/chunks/ResumeConversation-BktSnsCm.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CqFD8vVS.js +0 -1
- package/dist/chunks/SentryErrorBoundary-BUirJRWU.js +0 -1
- package/dist/chunks/Settings-vfFvcweR.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-_zbZTvcJ.js +0 -1
- package/dist/chunks/TrustDialog-CVbzrv6g.js +0 -1
- package/dist/chunks/WindowsTerminalBackend-BE9NX5IH.js +0 -2
- package/dist/chunks/api-6tcwJlf_.js +0 -1
- package/dist/chunks/assistant-CwbhlCM-.js +0 -1
- package/dist/chunks/auth-GxZhOvQ1.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BIZTAYho.js +0 -17
- package/dist/chunks/backgroundHousekeeping-Csh58CxV.js +0 -1
- package/dist/chunks/bridgeConfig-D4tpc568.js +0 -1
- package/dist/chunks/bridgeEnabled-B8_c_Ppq.js +0 -1
- package/dist/chunks/bridgeMain-C5RDihlX.js +0 -68
- package/dist/chunks/bridgeMain-D7_lg2iJ.js +0 -1
- package/dist/chunks/caches-dGk7xsDu.js +0 -1
- package/dist/chunks/changeDetector-DoLfg8a6.js +0 -1
- package/dist/chunks/channelNotification-DDErroWn.js +0 -1
- package/dist/chunks/clear-OudnCGa7.js +0 -1
- package/dist/chunks/client-DxDmXXTh.js +0 -1
- package/dist/chunks/commands-BWIOEBPs.js +0 -1
- package/dist/chunks/commitAttribution-BA4fcbHf.js +0 -1
- package/dist/chunks/context-noninteractive-CM1-lUSe.js +0 -1
- package/dist/chunks/conversation-DKlz47xf.js +0 -1
- package/dist/chunks/conversation-cUxdb8MN.js +0 -1
- package/dist/chunks/createSession-BuJcoBAj.js +0 -1
- package/dist/chunks/cronJitterConfig-CYP7yrQu.js +0 -6
- package/dist/chunks/crossProjectResume-BJisir9Z.js +0 -40
- package/dist/chunks/datadog-CVeFkaQu.js +0 -1
- package/dist/chunks/envLessBridgeConfig-CT8sdmFu.js +0 -1
- package/dist/chunks/extra-usage-rdJ7ecEb.js +0 -1
- package/dist/chunks/extractMemories-BrvZVsmM.js +0 -1
- package/dist/chunks/fast-CLKKsx2H.js +0 -1
- package/dist/chunks/gates-CSHuXnUx.js +0 -1
- package/dist/chunks/hooks-BFdX17Za.js +0 -1
- package/dist/chunks/inboundAttachments-BVUunfAX.js +0 -1
- package/dist/chunks/initReplBridge-tPRGPBq7.js +0 -1
- package/dist/chunks/language-Cf6bMI4N.js +0 -1
- package/dist/chunks/launchAutofixPr-D9h6YAZY.js +0 -2
- package/dist/chunks/loadAgentsDir-DCyiY0MN.js +0 -1
- package/dist/chunks/localSearch-MBx7KzC2.js +0 -1
- package/dist/chunks/login-D8UKKaud.js +0 -1
- package/dist/chunks/logout-B0BjqlGi.js +0 -1
- package/dist/chunks/mcp-CanCqnch.js +0 -2
- package/dist/chunks/mcp-Dq0kxZFx.js +0 -6
- package/dist/chunks/mcp-zbxZM9BP.js +0 -1
- package/dist/chunks/model-H3rtl6eR.js +0 -1
- package/dist/chunks/permissions-S2EvIRKj.js +0 -3
- package/dist/chunks/pluginStartupCheck-DpxQPXJE.js +0 -1
- package/dist/chunks/plugins-DQ3CRWWO.js +0 -4
- package/dist/chunks/policyLimits-BotYrS-v.js +0 -1
- package/dist/chunks/poorMode-DEAe3hiK.js +0 -1
- package/dist/chunks/processBashCommand-DHHN8Ca4.js +0 -1
- package/dist/chunks/prompt-CO160cIr.js +0 -1
- package/dist/chunks/prompt-GY9hlRvI.js +0 -1
- package/dist/chunks/rcDebugLog-CPKZCtR8.js +0 -11
- package/dist/chunks/sandbox-adapter-CzwHes1i.js +0 -1
- package/dist/chunks/searchExtraTools-CcpdCO6l.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-qnNiGMnE.js +0 -1
- package/dist/chunks/sessionMemory-CMahwDdW.js +0 -1
- package/dist/chunks/sessionMemory-pFSn4HSN.js +0 -1
- package/dist/chunks/sessionMemoryUtils-Du5jUl7M.js +0 -1
- package/dist/chunks/sessionObserver-Je868MC9.js +0 -1
- package/dist/chunks/sessionStorage-D3FhAADV.js +0 -1
- package/dist/chunks/setup-DWkSjA49.js +0 -2
- package/dist/chunks/sink-cQOgsnw3.js +0 -1
- package/dist/chunks/sinks-Djiz_5-Z.js +0 -1
- package/dist/chunks/skillChangeDetector-D8C-uQSQ.js +0 -1
- package/dist/chunks/skillLearning-3KWrBczS.js +0 -1
- package/dist/chunks/skillLearning-DBbdGbk-.js +0 -1
- package/dist/chunks/teamHelpers-CUAiXng3.js +0 -1
- package/dist/chunks/teammateModeSnapshot-C6EWhR0X.js +0 -1
- package/dist/chunks/teleport-LXFOan9C.js +0 -1
- package/dist/chunks/thinkback-DZW3Mcx_.js +0 -1
- package/dist/chunks/toolPool-DVOfpjDz.js +0 -1
- package/dist/chunks/toolPool-Dq-Vtvrj.js +0 -1
- package/dist/chunks/undercover-C_44e3oN.js +0 -1
- package/dist/chunks/upgrade-CGXa5Dwy.js +0 -1
- package/dist/chunks/useMainLoopModel-CwvuTRXn.js +0 -1
- package/dist/chunks/useSettingsErrors-C-j_Zt7g.js +0 -1
- package/dist/chunks/utils-CrZcpypC.js +0 -1
- package/dist/chunks/validatePlugin-vptAYuYu.js +0 -1
- package/dist/chunks/voiceModeEnabled-DIveLYGb.js +0 -1
- package/dist/chunks/voiceStreamSTT-hpzWd_zl.js +0 -1
- package/dist/chunks/worktree-CCuDwRmS.js +0 -1
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,El as T,Et as oe,Fa as se,Ki as ce,Ma as E,Ml as le,Na as ue,Ot as D,Pr as O,Rr as de,S as fe,Si as pe,Tl as me,Xn as he,Xo as k,Yn as A,_ as ge,a as _e,bl as ve,c as ye,jl as be,kt as xe,ls as Se,ms as Ce,no as j,on as we,oo as Te,pi as Ee,qi as De,ss as Oe,to as ke,vi as M,xi as Ae,xs as N,yi as je,yl as Me}from"./paths-
|
|
1
|
+
import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,El as T,Et as oe,Fa as se,Ki as ce,Ma as E,Ml as le,Na as ue,Ot as D,Pr as O,Rr as de,S as fe,Si as pe,Tl as me,Xn as he,Xo as k,Yn as A,_ as ge,a as _e,bl as ve,c as ye,jl as be,kt as xe,ls as Se,ms as Ce,no as j,on as we,oo as Te,pi as Ee,qi as De,ss as Oe,to as ke,vi as M,xi as Ae,xs as N,yi as je,yl as Me}from"./paths-1ngPRtu3.js";import{E as P,K as Ne,L as F,T as Pe,V as Fe,X as Ie,Y as Le,c as Re,d as I,h as ze,p as Be,s as L,w as R}from"./debug-UI3T040K.js";import{n as Ve,r as z}from"./analytics-DqMQntaB.js";import{n as He,t as Ue}from"./cwd--iizewsn.js";import{i as We,n as B,o as V}from"./process-DMKLUQIO.js";import{F as Ge,I as Ke,P as H}from"./git-CN3qtTb_.js";import{J as qe,K as Je,c as Ye,et as U,i as Xe,o as Ze,s as W}from"./log-CzsijfHZ.js";import{i as Qe,n as $e}from"./path-C4kbwvSH.js";import{s as et,u as tt}from"./types-Csi32ZXh.js";import{C as nt,c as rt,d as it,l as at,m as ot,s as st,x as G}from"./teammate-DMYOtLTK.js";import{n as ct,t as lt}from"./sleep-8Eb9j_Ly.js";import{$A as ut,$E as dt,$r as ft,AO as pt,Ar as mt,BD as ht,BE as gt,BT as _t,Ba as vt,CC as yt,CO as bt,Cn as xt,D as St,DE as Ct,Di as wt,Dv as Tt,Dx as Et,EC as Dt,Ei as Ot,Ev as kt,F as At,FD as jt,Fc as Mt,G as Nt,Gi as Pt,Hi as Ft,ID as It,I_ as Lt,Ic as Rt,Is as zt,JE as Bt,JT as K,Jv as Vt,K as Ht,Ks as Ut,LD as Wt,LS as Gt,L_ as Kt,Lo as qt,Ls as Jt,MD as Yt,Ml as Xt,ND as Zt,NT as Qt,Nc as $t,Ny as en,O as tn,Of as nn,Or as rn,Ox as an,PD as on,Pc as sn,Py as cn,QC as ln,QD as un,QE as dn,Qv as fn,RD as pn,RS as mn,RT as hn,Ra as gn,S as _n,Sx as vn,TD as yn,TT as bn,Tv as xn,Tx as Sn,UD as Cn,UT as wn,Uh as Tn,Us as En,Uu as Dn,VD as On,VE as kn,Vs as An,Vt as jn,WA as Mn,WD as Nn,WT as Pn,Wu as Fn,XT as In,Xi as Ln,Xv as Rn,YC as zn,YD as Bn,YE as Vn,YT as Hn,ZE as Un,Zh as Wn,Zv as Gn,_E as Kn,_O as qn,_c as Jn,_v as Yn,aj as Xn,as as Zn,au as Qn,aw as $n,bE as er,bO as tr,bb as nr,bc as rr,bv as ir,cC as ar,cE as or,cO as sr,cs as cr,cw as lr,db as ur,di as dr,dw as fr,eg as pr,fc as mr,fi as hr,fj as gr,fs as _r,fw as vr,gO as yr,gc as br,gi as xr,gw as Sr,gx as Cr,hO as wr,hc as Tr,hi as Er,ip as Dr,ir as Or,jD as q,jl as kr,kE as Ar,kO as jr,kf as Mr,kr as Nr,lC as Pr,lE as Fr,lO as Ir,la as Lr,lr as Rr,mA as zr,mc as Br,ms as Vr,nj as Hr,nu as Ur,ny as Wr,o as Gr,oA as Kr,oC as qr,os as Jr,ow as Yr,p as Xr,pc as Zr,po as Qr,qE as $r,qT as ei,qu as ti,rA as ni,rp as ri,ru as ii,ry as ai,s as oi,sE as si,sb as ci,tg as li,tj as ui,u as di,uE as fi,uO as J,uj as pi,vA as mi,vE as hi,vc as gi,vi as _i,vx as vi,w as yi,wC as bi,wD as xi,wT as Si,wn as Ci,wv as wi,x as Ti,xE as Ei,xc as Di,xv as Oi,yb as ki,yc as Ai,yn as ji,yx as Mi,zC as Ni,zD as Pi,zi as Fi}from"./loadAgentsDir-D7kapZB5.js";import{F as Ii,Hn as Li,Ht as Ri,M as zi,Nt as Bi,Pt as Vi,Vn as Hi,_t as Ui,pn as Wi,vt as Gi,xn as Ki}from"./prompt-BBg3jtfc.js";import{i as qi,o as Ji}from"./xml-DTMvLcPg.js";import{a as Yi,o as Xi,s as Zi}from"./fileStateCache-C7-TxF8G.js";import{A as Qi,C as $i,D as ea,N as ta,O as na,P as ra,Z as ia,_ as aa,d as oa,g as sa,h as ca,m as la,u as ua,v as da,y as fa}from"./rcDebugLog-CPGWJbI4.js";import{c as pa,l as ma}from"./commitAttribution-e0kkanVT.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-DEgaCpta.js";import{t as ya}from"./pollConfig-DTYIJ8lQ.js";import{r as ba}from"./inboundAttachments-7rXrAtkb.js";import{i as xa,n as Sa,s as Ca}from"./mappers-CkMESMy7.js";import{n as wa,r as Ta}from"./sessionTitle-QxXslbJY.js";import{n as Ea,t as Da}from"./ccrClient-B_3AmY7K.js";import{n as Oa,t as ka}from"./HybridTransport-CAko699F.js";import{n as Aa,t as ja}from"./SSETransport-B5xlXeAN.js";import{t as Ma}from"./pluginBlocklist-BG2LkLq1.js";import{c as Na,d as Pa,f as Fa,l as Ia,o as La,r as Ra,s as za,u as Ba}from"./channelNotification-BbDQdLZC.js";import{t as Va}from"./onChangeAppState-Cb9_yIuW.js";import{t as Ha}from"./settingsSync-DEPET5O1.js";import{a as Ua,c as Wa,d as Ga,f as Ka,l as qa,m as Ja,o as Ya,p as Xa,r as Za,t as Qa}from"./cronJitterConfig-DcMGWOa-.js";import{i as $a,n as eo}from"./toolPool-BHChMuLr.js";import{n as to,r as no}from"./QueryEngine-I3Bqzbiz.js";import{n as ro,r as io}from"./sideQuestion-B9EE1vTM.js";import{n as ao,r as oo}from"./context-noninteractive-IZfWniex.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-DnyEQqe6.js";import{n as uo,t as fo}from"./refresh-Cjv4jA6L.js";import{dirname as po,join as mo}from"path";import{PassThrough as ho}from"stream";import{randomUUID as Y}from"crypto";import{readFile as go,stat as _o}from"fs/promises";import{URL as vo}from"url";import{cwd as X}from"process";a(),_(),He(),Le(),Fe(),R(),ze(),B(),L(),H(),U(),Ze(),Qe(),et(),G(),N(),Te(),se(),E(),De(),O(),A(),lt(),we(),at(),fe(),_e(),Hi(),Ki(),zr(),Kr(),qn(),jt(),yn(),kn(),ta(),hi(),ha(),Hn(),Qt(),na(),Lt(),oa(),Mt(),sn(),Jr(),qt(),Ln(),mt(),Ci(),ji(),Ha(),r(),Aa();function yo(e,t={},n,r){if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let i=new vo(e.href);return i.protocol===`wss:`?i.protocol=`https:`:i.protocol===`ws:`&&(i.protocol=`http:`),i.pathname=i.pathname.replace(/\/$/,``)+`/worker/events/stream`,new ja(i,t,n,r)}if(e.protocol===`ws:`||e.protocol===`wss:`)return i(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ka(e,t,n,r):new Oa(e,t,n,r);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Aa();var bo=class extends Ga{constructor(e,t,n){let r=new ho({encoding:`utf8`});super(r,n),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=r,this.url=new vo(e);let a={},s=ea();s?a.Authorization=`Bearer ${s}`:I(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;if(c&&(a[`x-environment-runner-version`]=c),this.transport=yo(this.url,a,u(),()=>{let e={},t=ea();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e}),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Re(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&V(e.endsWith(`
|
|
2
2
|
`)?e:e+`
|
|
3
|
-
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ge(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${F(e)}`)),
|
|
3
|
+
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ge(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${F(e)}`)),ei(1,`other`)}),Ie(async()=>this.ccrClient?.close()),wt((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Ot(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};Wt((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),da((e,t)=>{this.ccrClient?.reportState(e,t)}),aa(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let l=ya().session_keepalive_interval_v2_ms;if(this.isBridge&&l>0&&(this.keepAliveTimer=setInterval(()=>{I(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{I(`[remote-io] keep_alive write failed: ${F(e)}`)})},l),this.keepAliveTimer.unref?.()),Ie(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
|
|
4
4
|
`)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&V(Ka(e)+`
|
|
5
5
|
`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Wi(),k(),Ri(),Vi(),[...Bi],Le(),L();var xo=`[stdout-guard]`,So=!1,Z=``,Co=null;function wo(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function To(){So||(So=!0,Co=process.stdout.write.bind(process.stdout),process.stdout.write=function(e,t,n){let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);Z+=r;let i,a=!0;for(;(i=Z.indexOf(`
|
|
6
6
|
`))!==-1;){let e=Z.slice(0,i);Z=Z.slice(i+1),wo(e)?a=Co(e+`
|
|
7
7
|
`):(process.stderr.write(`${xo} ${e}\n`),I(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},Ie(async()=>{Z.length>0&&(Co&&wo(Z)?Co(Z+`
|
|
8
|
-
`):process.stderr.write(`${xo} ${Z}\n`),Z=``),Co&&(process.stdout.write=Co,Co=null),So=!1}))}Me(),Se()
|
|
8
|
+
`):process.stderr.write(`${xo} ${Z}\n`),Z=``),Co&&(process.stdout.write=Co,Co=null),So=!1}))}Me(),Se(),pi(),ut(),qi(),Gi(),Xi(),ra(),dn(),Ar(),fr(),ln(),ai(),wi(),ir(),ti(),Ai(),An(),_r(),Ht(),Gr(),Ba(),Na(),eo(),Yn(),Fe(),Ze(),na(),Vt(),L(),Hn();function Eo(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(I(`Exiting after ${n}ms of idle time`),K())},n))},stop(){i&&(clearTimeout(i),i=null)}}}be(),me(),M(),jr(),$r(),or(),bn(),mn(),ki(),ur(),Xt(),gn(),yi(),Ta(),ro();function Do(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(Kt(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:Y(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}s(),D(),Bn(),On(),Zt(),ma(),wn(),yt(),qr(),Sn(),Mr(),Ur(),Sa(),oo(),L();async function Oo(){try{let e=await go(br(),`utf-8`),t=Ce().safeParse(Pe(e));return t.success?t.data:(I(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function ko(e){await mr(br(),P(e,null,2))}async function Ao(e,t){let n=Tr();if(!n)return;let r=await jo(t);r!==null&&await mr(mo(n,Br(e)),r)}async function jo(e){let t=[mo(e,`.claude-plugin`,`marketplace.json`),mo(e,`marketplace.json`),e];for(let e of t)try{return await go(e,`utf-8`)}catch{}return null}async function Mo(){let e=await En();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Ao(t,n.installLocation)}catch(e){I(`Failed to save marketplace JSON for ${t}: ${e}`)}await ko({...await Oo(),...e})}Ve(),Le(),L(),H(),Ze(),An(),Ai();async function No(){let e=Di();I(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await Ut();t&&(zt(),cr(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Be().mkdir(Jn()),await Be().mkdir(gi()));let n=Object.keys(Jt()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)I(`installPluginsForHeadless: no marketplaces declared`);else{let t=await Ke(`headless_marketplace_reconcile`,()=>Wa({skip:e?(e,t)=>!rr(t):void 0,onProgress:e=>{e.type===`installed`?I(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&I(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&I(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(zt(),cr(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Mo();let t=await Ma();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&cr(`headlessPluginInstall: plugins changed`),e&&Ie(Zr),i}catch(e){return W(e),!1}finally{z(`tengu_headless_plugin_install`,r)}}Ve(),L(),H(),jt(),oa(),Ze(),B(),Lt(),Hn(),Le(),He(),_(),mt(),qt(),R(),r(),fo(),_r(),Tn(),_a(),Ei(),en(),ri(),Fe();var Q=(fi(),e(Fr)),$=(fa(),e($i)),Po=(Ya(),e(Ua)),Fo=(Za(),e(Qa)),Io=(zi(),e(Ii)),Lo=`<system-reminder>
|
|
9
9
|
You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
|
|
10
10
|
|
|
11
11
|
You MUST shut down your team before preparing your final response:
|
|
@@ -18,22 +18,22 @@ The user cannot receive your response until the team is completely shut down.
|
|
|
18
18
|
</system-reminder>
|
|
19
19
|
|
|
20
20
|
Shut down your team and prepare your final response for the user.`,Ro=1e4,zo=new Set,Bo=[];function Vo(e){if(zo.has(e))return!1;if(zo.add(e),Bo.push(e),Bo.length>Ro){let e=Bo.splice(0,Bo.length-Ro);for(let t of e)zo.delete(t)}return!0}function Ho(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Uo(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
|
|
21
|
-
`):e.flatMap(Ho)}function Wo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Go(e,t,n,r,a,o,s,c){if(process.env.USER_TYPE===`ant`&&i(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),
|
|
21
|
+
`):e.flatMap(Ho)}function Wo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Go(e,t,n,r,a,o,s,c){if(process.env.USER_TYPE===`ant`&&i(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),mi.subscribe(e=>{Gt(e,n),Ae()&&n(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&i(process.env.CLAUDE_CODE_PROACTIVE)&&$.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),Yt(),q(`runHeadless_entry`),await Pn()&&await _t(),q(`after_grove_check`),re(),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
22
22
|
`),K(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
23
23
|
`),K(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
24
|
-
`),K(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=
|
|
24
|
+
`),K(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=ni.getSandboxUnavailableReason();if(d){if(ni.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${d}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),K(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${d}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(ni.isSandboxingEnabled())try{await ni.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${F(e)}\n`),K(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&Rt(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:Y(),session_id:u()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:Y(),session_id:u()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:Y(),session_id:u()}}})();l.write(t)}),c.setupTrigger&&await kt(c.setupTrigger),q(`before_loadInitialMessages`);let f=t(),{messages:p,turnInterruptionState:m,agentSetting:h}=await ns(n,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),g=Tt();if(g&&l.prependUserMessage(g),!c.agent&&!x()&&h){let{agentDefinition:e}=so(h,void 0,{activeAgents:s,allAgents:s});if(e){if(n(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!oi(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Er(e.agentType)}}if(p.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=p.find(e=>e.uuid===c.rewindFiles);if(!e||e.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),K(1);return}let r=t(),i=await Xo(c.rewindFiles,r,n,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),K(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),K(0);return}let ee=typeof c.resume==`string`&&(!!Kt(c.resume)||c.resume.endsWith(`.jsonl`)),_=!!c.sdkUrl;if(!e&&!ee&&!_){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
|
|
25
25
|
`),K(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
26
|
-
`),K(1);return}let te=
|
|
26
|
+
`),K(1);return}let te=Fn(f.mcp.tools,f.toolPermissionContext),v=[...a,...te],y=Jo(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{n(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),ca(`requires_action`,e)});c.permissionPromptToolName&&(v=v.filter(e=>!Li(e,c.permissionPromptToolName))),We(),q(`after_loadInitialMessages`),await C(),q(`after_modelStrings`);let b=c.outputFormat===`json`&&c.verbose,S=[],w;q(`before_runHeadlessStreaming`);for await(let e of Ko(l,f.mcp.clients,[...r,...f.mcp.commands],v,p,y,o,t,n,s,c,m))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(b&&S.push(e),w=e);switch(c.outputFormat){case`json`:if(!w||w.type!==`result`)throw Error(`No messages returned`);if(c.verbose){V(P(S)+`
|
|
27
27
|
`);break}V(P(w)+`
|
|
28
28
|
`);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:V(w.result.endsWith(`
|
|
29
29
|
`)?w.result:w.result+`
|
|
30
30
|
`);break;case`error_during_execution`:V(`Execution error`);break;case`error_max_turns`:V(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:V(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:V(`Error: Failed to provide valid structured output after maximum retries.
|
|
31
|
-
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(en(),ye())try{let{drainPendingExtraction:e}=await import(`./extractMemories-BrvZVsmM.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,se=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),Mt(0)}),Ie(async()=>{let t={};for(let e of hi(g()))nn(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},fe;v.enableAuthStatus&&(fe=ce.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let me=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};sn.add(me);let k=s,A=Cn(s,X(),100),_e=Yi(100),ye=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ye&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),q({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let be=cn().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=ut(n),i=pi(n),a=pe(e.value),o=he(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:nr(n)?[...Pt]:Pt.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Yr(e,de(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await Vr(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await oi(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),jn({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Tt(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(Oe(t)))),...we]}})),Hn(j)}}De();let M={clients:[],tools:[],configs:{}},Ae=e=>{let t=Dn(e.toolPermissionContext,e.mcp.tools),n=ve($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Li(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Ui(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Pe=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Fe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(Oe(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Pe=Pe.then(t,t),Pe}function Le(){let e=g(),t=e.mcp.clients,n=ve([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Xr(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>Bt())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),L=a,R=te;async function Ve(){let{agentDefinitions:e}=await uo(_);L=await Nt(X());let t=R.filter(e=>e.source===`flagSettings`);R=[...e.allAgents,...t]}async function He(){let{servers:e}=await Sr(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Fe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Fi(),Nt(X()).then(e=>{L=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Ft({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await Rt({commands:e});return}for(let t of e)q({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};Di(()=>{E&&qr(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),J(`run_entry`),await De(),J(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-C0Ei-0E2.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=Ur(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wo(r,gi(t));)i.push(Ur(t));let a=await Xt(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=Ae(s);for(let e of o)un(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&Kt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=bn(),J(`before_ask`),Yn();let h=r,ee=!1;try{if(await xe(h.workload??v.workload,async()=>{for await(let t of to({commands:ve([...L,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?A:Zi(A,_e),setReadFileCache:e=>{A=e;for(let[e,t]of _e.entries()){let n=A.get(e);(!n||t.timestamp>n.timestamp)&&A.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:R,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);hi(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&nn(e))?se=t:(se=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await pn({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await pn({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)q({...t,uuid:Y()})}}catch(e){throw await pn({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)un(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=Tr();if(!t)Qr(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await zn(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};se?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Qr(`aborted`,void 0,void 0,`sdk`);return}W(Ne(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}en(),ri(),ft()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=hi(g()).some(e=>nn(e)&&e.type!==`in_process_teammate`),n=gi(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);se&&(D.enqueue(se),se=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[F(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Ut()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&gi(t)===void 0&&!C){We();return}if(gi(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await Rr(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await ui(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=fn(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}q({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
|
|
31
|
+
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(on(),ye())try{let{drainPendingExtraction:e}=await import(`./extractMemories-C3SU-Osb.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,se=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),ei(0)}),Ie(async()=>{let t={};for(let e of er(g()))cn(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},fe;v.enableAuthStatus&&(fe=ce.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let me=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};pt.add(me);let k=s,A=Ct(s,X(),100),_e=Yi(100),ye=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ye&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),J({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let be=nn().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=ui(n),i=gr(n),a=pe(e.value),o=he(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:Hr(n)?[...Mn]:Mn.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Qr(e,de(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await ar(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await Pr(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),jn({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await an(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(Oe(t)))),...we]}})),dt(j)}}De();let M={clients:[],tools:[],configs:{}},Ae=e=>{let t=Dn(e.toolPermissionContext,e.mcp.tools),n=ve($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Li(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Ui(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Pe=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Fe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(Oe(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Pe=Pe.then(t,t),Pe}function Le(){let e=g(),t=e.mcp.clients,n=ve([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?zn(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>hn())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),L=a,R=te;async function Ve(){let{agentDefinitions:e}=await uo(_);L=await Pt(X());let t=R.filter(e=>e.source===`flagSettings`);R=[...e.allAgents,...t]}async function He(){let{servers:e}=await Yr(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Fe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Fi(),Pt(X()).then(e=>{L=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Nn({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await pn({commands:e});return}for(let t of e)J({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};bt(()=>{E&&wr(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),q(`run_entry`),await De(),q(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-CL5aGDrb.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=sr(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wo(r,tr(t));)i.push(sr(t));let a=await Pi(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=Ae(s);for(let e of o)It(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&Bt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=xi(),q(`before_ask`),Qn();let h=r,ee=!1;try{if(await xe(h.workload??v.workload,async()=>{for await(let t of to({commands:ve([...L,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?A:Zi(A,_e),setReadFileCache:e=>{A=e;for(let[e,t]of _e.entries()){let n=A.get(e);(!n||t.timestamp>n.timestamp)&&A.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:R,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);er(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&cn(e))?se=t:(se=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await ht({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await ht({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)J({...t,uuid:Y()})}}catch(e){throw await ht({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)It(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=kr();if(!t)Vn(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Un(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};se?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Vn(`aborted`,void 0,void 0,`sdk`);return}W(Ne(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}on(),ii(),Yt()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=er(g()).some(e=>cn(e)&&e.type!==`in_process_teammate`),n=tr(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);se&&(D.enqueue(se),se=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[F(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!In()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&tr(t)===void 0&&!C){We();return}if(tr(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await li(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await pr(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=Wn(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}J({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
|
|
32
32
|
|
|
33
|
-
`),uuid:Y()}),B();return}if(C&&!re){re=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),
|
|
33
|
+
`),uuid:Y()}),B();return}if(C&&!re){re=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),J({mode:`prompt`,value:Lo,uuid:Y()}),B();return}await ct(500)}}}C&&(await(async()=>{let e=g();rt(e)&&await ot(_,e);let t=g(),n=t.teamContext;return n&&Object.keys(n.teammates).length>0||st(t)})()?(J({mode:`prompt`,value:Lo,uuid:Y()}),B()):(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await $t(),Ue(),fe?.(),pt.delete(me),D.done()))},V=null;if(Io.isKairosCronEnabled()){let e=e=>{C||(async()=>{let t=await Cn({basePrompt:e.basePrompt,trigger:`scheduled-task`,currentDir:X(),sourceId:e.sourceId,sourceLabel:e.sourceLabel,workload:oe,shouldCreate:()=>!C});if(t){if(C){await pn({commands:[t]});return}await e.onSuccess(t)}})().catch(t=>{W(t),I(`[ScheduledTasks] failed to enqueue headless task${e.logSuffix}: ${t}`,{level:`error`})})},t=e=>{J({...e,uuid:Y()}),B()};V=Po.createCronScheduler({onFire:n=>{e({basePrompt:n,sourceId:n,sourceLabel:n,logSuffix:``,onSuccess:t})},onFireTask:n=>{if(n.agentId){e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:async e=>{await un(e.autonomy.runId,`No teammate runtime available for scheduled task owner ${n.agentId} in headless mode.`,e.autonomy.rootDir)}});return}e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:t})},isLoading:()=>x||C,getJitterConfig:Fo?.getCronJitterConfig,isKilled:()=>!Io?.isKairosCronEnabled()}),V.start()}let H=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},U=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ze=new Set;e.setUnexpectedResponseCallback(async e=>{await is({message:e,setAppState:_,handledToolUseIds:Ze,onEnqueued:()=>{B()}})});let Qe=new Map,et=new Map,tt=new Set,at=new Map,G=null;return(async()=>{let t=!1;Ge(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&It(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);else if(o.subtype===`end_session`){I(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)h[e]={type:`sdk`,name:e};await Yo(i.request,i.request_id,t,D,a,be,e,!!v.enableAuthStatus,v,te,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&ge(`tengu_slate_prism`,!0)&&ee(!0),t=!0,yr()&&B()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Zo(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e===`default`?ie():e;Se=t,b(t),la({model:t}),Ce(e,t),H(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?v.thinkingConfig=void 0:i.request.max_thinking_tokens===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},H(i);else if(i.request.subtype===`mcp_status`)H(i,{mcpServers:Le()});else if(i.request.subtype===`get_context_usage`)try{let e=g();H(i,{...await ao({messages:k,getAppState:g,options:{mainLoopModel:ae(),tools:Ae(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt}})})}catch(e){U(i,F(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=j.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),H(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await Xo(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?H(i,t):U(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid;H(i,{cancelled:Ir(t=>t.uuid===e).length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=$e(i.request.path),t=Math.floor((await _o(e)).mtimeMs);if(t<=i.request.mtime){let n=await go(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
34
34
|
`,`
|
|
35
|
-
`);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Fe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=R.filter(e=>e.source===`flagSettings`);R=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([Nt(X()),He(),Fr()]);r.status===`fulfilled`?L=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:L.filter(e=>e.userInvocable!==!1).map(e=>({name:kr(e),description:Lt(e),argumentHint:e.argumentHint||``})),agents:R.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,F(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=Gr(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await Tn(t,n),r=Oe(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...T(n.mcp.commands,e=>Yt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:le(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=Gr(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){Ir(t,!0);let e=await Tn(t,a),n=Oe(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...T(r.mcp.commands,e=>Yt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:le(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{Ir(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await fr(t,a);let o=Oe(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:T(e.mcp.tools,e=>e.name?.startsWith(o)),commands:T(e.mcp.commands,e=>Yt(e,t)),resources:le(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=Gr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=yn(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(mi(e)||tt.has(e))return;let t=await Tn(e,n),r=Oe(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Yt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,F(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new xn,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await _i(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,F(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ue()}})},e=>U(i,F(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=Gr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Si(e,n);let t=await Tn(e,n),r=Oe(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Yt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),cr.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=ut(t)?ti(t,e.effortValue):void 0;H(i,{...ke(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await br(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,F(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:bn()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{dr(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,F(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Tr();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:bn()}}:await no({tools:Ae(g()),commands:L,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:A,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:R})})).response})}catch(e){U(i,F(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:Kn(N.bridgeSessionId,N.sessionIngressUrl),connect_url:qn(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-tPRGPBq7.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;q({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:Kn(r.bridgeSessionId,r.sessionIngressUrl),connect_url:qn(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,F(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await xr(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&un(o.uuid,`completed`);continue}Vo(o.uuid)}q({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{dt(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await an(),Ue(),fe?.(),sn.delete(me),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await At(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=_t(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await At(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Li(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),K(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Kr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!ai(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=j()?.outputStyle||`default`,p=await Jn(Ue()),m=ne();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:kr(e),description:Lt(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ue()},pid:process.pid};if(Ae()&&je()){let e=d();ee.fast_mode_state=Ee(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=ce.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!Bn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Wt(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Rn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await rr(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${F(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(on())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!bt()){let e=vn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${Ti(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Et(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),q({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),q({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
|
|
35
|
+
`);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Fe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=R.filter(e=>e.source===`flagSettings`);R=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([Pt(X()),He(),Vr()]);r.status===`fulfilled`?L=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:L.filter(e=>e.userInvocable!==!1).map(e=>({name:Lr(e),description:Ft(e),argumentHint:e.argumentHint||``})),agents:R.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,F(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=lr(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await Et(t,n),r=Oe(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...T(n.mcp.commands,e=>Ni(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:le(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=lr(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){Sr(t,!0);let e=await Et(t,a),n=Oe(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...T(r.mcp.commands,e=>Ni(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:le(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{Sr(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await vi(t,a);let o=Oe(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:T(e.mcp.tools,e=>e.name?.startsWith(o)),commands:T(e.mcp.commands,e=>Ni(e,t)),resources:le(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=lr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=bi(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(vr(e)||tt.has(e))return;let t=await Et(e,n),r=Oe(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Ni(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,F(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Si,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await nr(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,F(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ue()}})},e=>U(i,F(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=lr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Dt(e,n);let t=await Et(e,n),r=Oe(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Ni(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),mi.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=ui(t)?Xn(t,e.effortValue):void 0;H(i,{...ke(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await Dr(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,F(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:xi()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{xr(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,F(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=kr();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:xi()}}:await no({tools:Ae(g()),commands:L,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:A,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:R})})).response})}catch(e){U(i,F(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:si(N.bridgeSessionId,N.sessionIngressUrl),connect_url:ci(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-tXqkba08.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;J({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:si(r.bridgeSessionId,r.sessionIngressUrl),connect_url:ci(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,F(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await Or(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&It(o.uuid,`completed`);continue}Vo(o.uuid)}J({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{ft(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await $t(),Ue(),fe?.(),pt.delete(me),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Nt(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=xt(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Nt(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Li(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),K(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Xr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!oi(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=j()?.outputStyle||`default`,p=await Zn(Ue()),m=ne();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:Lr(e),description:Ft(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ue()},pid:process.pid};if(Ae()&&je()){let e=d();ee.fast_mode_state=Ee(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=ce.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!Gn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Rn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await fn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await Wr(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${F(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(tn())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!St()){let e=_n();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${Ti(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...At(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),J({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),J({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
|
|
36
36
|
`)}else process.stderr.write(e+`
|
|
37
|
-
`)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{z(`tengu_continue_print`,{});let i=await
|
|
38
|
-
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(
|
|
39
|
-
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(
|
|
37
|
+
`)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{z(`tengu_continue_print`,{});let i=await Oi(void 0,void 0);if(i){if(Q){let n=Q.matchSessionMode(i.mode);if(n){process.stderr.write(n+`
|
|
38
|
+
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Gr(),e(di));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return n.forkSession||i.sessionId&&(te(Kn(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await dr()),co(i,t),hr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&_i(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),K(1),{messages:[]}}if(n.teleport)try{if(!vt(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(z(`tengu_teleport_print`,{}),typeof n.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:t,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-B4p8XlAv.js`);await i();let a=await r(n.teleport),{branchError:o}=await e(a.branch);return{messages:t(a.log,o)}}catch(e){return W(e),K(1),{messages:[]}}if(n.resume)try{z(`tengu_resume_print`,{});let a=Do(typeof n.resume==`string`?n.resume:``);if(!a){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof n.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${n.resume}" is not a valid UUID`),es(e,n.outputFormat),K(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([rn(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&b(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await Nr(a.sessionId,a.ingressUrl);let o=await Oi(a.sessionId,a.jsonlFile||void 0);if(!o||o.messages.length===0)return a.isUrl||i(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(n.sessionStartHooksPromise??xn(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),K(1),{messages:[]});if(n.resumeSessionAt){let e=o.messages.findIndex(e=>e.uuid===n.resumeSessionAt);if(e<0)return es(`No message found with message.uuid of: ${n.resumeSessionAt}`,n.outputFormat),K(1),{messages:[]};o.messages=e>=0?o.messages.slice(0,e+1):[]}if(Q){let n=Q.matchSessionMode(o.mode);if(n){process.stderr.write(n+`
|
|
39
|
+
`);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Gr(),e(di));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return!n.forkSession&&o.sessionId&&(te(Kn(o.sessionId),o.fullPath?po(o.fullPath):null),r&&await dr()),co(o,t),hr(n.forkSession?{...o,worktreeSession:void 0}:o),Q&&_i(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:o.messages,turnInterruptionState:o.turnInterruptionState,agentSetting:o.agentSetting}}catch(e){return W(e),es(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,n.outputFormat),K(1),{messages:[]}}return{messages:await(n.sessionStartHooksPromise??xn(`startup`))}}function rs(e,t){let n;return n=typeof e==`string`?e.trim()===``?gt([]):gt([P({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new bo(t.sdkUrl,n,t.replayUserMessages):new Ga(n,t.replayUserMessages)}async function is({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(I(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return I(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await Rr(t);return a?(r.add(t),I(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),J({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(I(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function as(e){return{...e,scope:`dynamic`}}async function os(e,t,n,r){let{allowed:i,blocked:a}=$n(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await ss(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function ss(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i?!0:!Cr(r,as(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){W(e)}await vi(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=as(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await Mi(t,r);if(d.push(e),e.type===`connected`){let t=await vn(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Ne(e);u[t]=n.message,W(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=as(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Go as runHeadless};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{HT as a,UT as o,VT as s,WT as c}from"./loadAgentsDir-D7kapZB5.js";import{n as l,r as u,t as d}from"./Grove-Tp_UtIMg.js";async function f(e){if(!await c())return e(m),null;let[t,n]=await Promise.all([a(),s()]);if(!t.success)return e(m),null;let r=t.data,o=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await a();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:o?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),o(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e}from"./chunk-DR8-3Aex.js";import{Rn as t,t as n,x as r}from"./src-Di342QoJ.js";import{t as i}from"./jsx-runtime-D-D469L8.js";import{Ka as a,oo as o}from"./paths-1ngPRtu3.js";import{L as s,N as c,V as l}from"./debug-UI3T040K.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{Dg as f,Dm as p,Eg as m,Em as h,Lo as g,Rm as _,bo as v,go as y,hC as b,hu as x,mC as S,mu as C,qo as w,yo as T,zm as E}from"./loadAgentsDir-D7kapZB5.js";import{Ft as D,Pt as O}from"./prompt-BBg3jtfc.js";import{r as k,t as A}from"./xml-DTMvLcPg.js";import{randomUUID as j}from"crypto";t(),n(),x(),f(),E();var M=i();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(m,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(_,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):C.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}u(),l(),S(),g(),o();function P(){return a().defaultShell??`bash`}x(),O(),k();async function F(t,n,r,i,a){let o=D()&&P()===`powershell`;d(`tengu_input_bash`,{powershell:o});let l=v({content:w({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},s=e=>{a({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},c=null;o&&(c=(p(),e(h)).PowerShellTool);let d=c??C,f=(c?await c.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await C.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s)).data;if(!f)throw Error(`No result received from shell command`);let m=f.stderr,g=await b(d,{...f,stderr:``},j()),_=typeof g.content==`string`?g.content:A(f.stdout);return{messages:[y(),l,...r,v({content:`<bash-stdout>${_}</bash-stdout><bash-stderr>${A(m)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof c?e.interrupted?{messages:[y(),l,T({toolUse:!1}),...r],shouldQuery:!1}:{messages:[y(),l,...r,v({content:`<bash-stdout>${A(e.stdout)}</bash-stdout><bash-stderr>${A(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[y(),l,...r,v({content:`<bash-stderr>Command failed: ${A(s(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{F as processBashCommand};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,As as c,Dt as l,Ot as u,Zc as d,el as f,ks as p,tt as m}from"./paths-BBvuDQl9.js";import{M as h,V as g,d as _,h as v,k as y,p as b,s as x}from"./debug-UI3T040K.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-CzsijfHZ.js";import{n as k,t as ee}from"./sleep-8Eb9j_Ly.js";import{A as te,Al as A,BE as ne,B_ as re,CD as ie,Cl as ae,Dc as oe,ED as se,E_ as ce,Ec as le,Ek as ue,FA as de,G as fe,G_ as pe,Go as me,Gx as he,H_ as j,Ho as ge,IA as M,I_ as N,Jf as P,K as F,L_ as I,Li as L,Lo as _e,Ml as ve,Nl as ye,Ok as be,Ro as xe,SD as Se,TD as Ce,T_ as we,UD as Te,V_ as Ee,Vi as De,WD as Oe,Wi as ke,Xi as Ae,Yf as je,Yi as Me,_o as Ne,bo as R,bw as Pe,cO as Fe,fo as z,go as B,hO as Ie,i_ as V,ik as Le,kc as Re,lO as ze,la as H,qD as Be,qo as U,qx as Ve,r_ as He,sk as Ue,w as We,w_ as Ge,wo as Ke,xl as qe,xw as Je,yo as Ye,yw as Xe,zE as Ze}from"./loadAgentsDir-DI1a76pd.js";import{a as W,i as Qe,o as G}from"./xml-Dx--sNE1.js";import{E as $e,T as et,w as tt}from"./sessionTracing-DoRJ4nSa.js";import{n as nt,t as rt}from"./slashCommandParsing-Cari0pNg.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{_(`Removing one-shot hook for event ${o} in skill '${r}'`),ce(e,t,o,s)}:void 0;Ge(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),we()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=N(),c=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...j(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await ye(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};_(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let v=!1;if(g.kairosEnabled&&(v=!0),v){let t=Se(),r=H(e),i=l(),c=e=>ze({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await Te({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)Fe(t)},d=async e=>{o?.runId&&await Oe({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of V({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=A(l,`Command completed`);_(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:je(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of V({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=me([t]);if(t.type===`assistant`){let r=Le(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{i(null)}let E=A(y,`Command completed`);return _(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${d(Ce(s))}\n${E}`),{messages:[R({content:U({inputString:`/${H(e)} ${t}`.trim(),precedingInputBlocks:r})}),R({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[B(),...r,R({content:U({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:L().has(f)?f:`custom`;if(!Me(f,i.options.commands)){let n=!1;try{await b().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[B(),...r,R({content:U({inputString:e,precedingInputBlocks:t})}),...p?[Ne(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[R({content:U({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:v,model:y,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,j(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:y,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[B(),...g],shouldQuery:_,allowedTools:v,model:y};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,j(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&xe(g[0]);return{messages:_||g.every(ge)||k?g:[B(),...g],shouldQuery:_,allowedTools:v,model:y,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=ke(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&Ee(e),u.userInvocable===!1)return{messages:[R({content:U({inputString:`/${e}`,precedingInputBlocks:i})}),R({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>R({content:e,isMeta:!0})),s=Ve()&&typeof n==`string`&&n.endsWith(` dismissed`);e({messages:r?.display===`system`?s?o:[z(J(u,t)),z(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[R({content:U({inputString:J(u,t),precedingInputBlocks:i})}),R(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${de}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=R({content:U({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=B(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[R({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return be(),{messages:qe(r),shouldQuery:!1,command:u}}return{messages:[e,z(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,z(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??fe,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[R({content:U({inputString:J(u,t),precedingInputBlocks:i})}),Ye({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[R({content:U({inputString:J(u,t),precedingInputBlocks:i})}),R({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[R({content:U({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return Ke(H(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,As as c,Dt as l,Ot as u,Zc as d,el as f,ks as p,tt as m}from"./paths-1ngPRtu3.js";import{M as h,V as g,d as _,h as v,k as y,p as b,s as x}from"./debug-UI3T040K.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-CzsijfHZ.js";import{n as k,t as ee}from"./sleep-8Eb9j_Ly.js";import{A as te,Ak as ne,Al as A,B_ as re,C_ as ie,Cl as ae,Cw as oe,DD as se,Dc as ce,Ec as le,F_ as ue,G as de,GD as fe,Go as pe,HE as me,Ho as he,I_ as ge,Jf as _e,K as j,KD as M,LA as N,Li as P,Lo as F,Ml as I,Nl as ve,OD as ye,Ok as be,RA as xe,Ro as Se,Sw as Ce,TD as we,T_ as Te,VE as Ee,V_ as L,Vi as De,W_ as Oe,Wi as ke,Xi as Ae,YD as je,Yf as Me,Yi as Ne,Yx as Pe,_O as Fe,_o as Ie,bo as R,dO as Le,fo as z,go as B,kc as Re,la as V,lk as ze,n_ as Be,ok as Ve,qo as H,qx as He,r_ as U,uO as Ue,w as We,wD as Ge,w_ as Ke,wo as qe,xl as Je,xw as Ye,yo as Xe,z_ as Ze}from"./loadAgentsDir-D7kapZB5.js";import{a as W,i as Qe,o as G}from"./xml-DTMvLcPg.js";import{E as $e,T as et,w as tt}from"./sessionTracing-DognYcDf.js";import{n as nt,t as rt}from"./slashCommandParsing-Cari0pNg.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{_(`Removing one-shot hook for event ${o} in skill '${r}'`),Te(e,t,o,s)}:void 0;ie(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),Ke()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=ue(),c=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...L(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await ve(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};_(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let v=!1;if(g.kairosEnabled&&(v=!0),v){let t=Ge(),r=V(e),i=l(),c=e=>Le({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await fe({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)Ue(t)},d=async e=>{o?.runId&&await M({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=A(l,`Command completed`);_(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:Me(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=pe([t]);if(t.type===`assistant`){let r=Ve(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{i(null)}let E=A(y,`Command completed`);return _(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${d(se(s))}\n${E}`),{messages:[R({content:H({inputString:`/${V(e)} ${t}`.trim(),precedingInputBlocks:r})}),R({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:P().has(f)?f:`custom`;if(!Ne(f,i.options.commands)){let n=!1;try{await b().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})}),...p?[Ie(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[R({content:H({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:v,model:y,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,L(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:y,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[B(),...g],shouldQuery:_,allowedTools:v,model:y};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,L(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&Se(g[0]);return{messages:_||g.every(he)||k?g:[B(),...g],shouldQuery:_,allowedTools:v,model:y,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=ke(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&re(e),u.userInvocable===!1)return{messages:[R({content:H({inputString:`/${e}`,precedingInputBlocks:i})}),R({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>R({content:e,isMeta:!0})),s=Pe()&&typeof n==`string`&&n.endsWith(` dismissed`);e({messages:r?.display===`system`?s?o:[z(J(u,t)),z(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${N}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=R({content:H({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=B(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[R({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return ne(),{messages:Je(r),shouldQuery:!1,command:u}}return{messages:[e,z(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,z(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??de,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),Xe({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[R({content:H({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return qe(V(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
|
|
2
2
|
`)}function dt(e,t){return[`<${w}>${e}</${w}>`,`<${E}>/${e}</${E}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
3
3
|
`)}function X(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?Y(e.name,e.progressMessage):dt(e.name,t)}async function ft(e,t,n,r,i=[]){let a=De(e,n);if(!a)throw new h(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,i,a=[],c=[],l){if(n(process.env.CLAUDE_CODE_COORDINATOR_MODE)&&!i.agentId){let n=X(e,t),r=[`Skill "/${e.name}" is available for workers.`];e.description&&r.push(`Description: ${e.description}`),e.whenToUse&&r.push(`When to use: ${e.whenToUse}`);let i=e.allowedTools??[];i.length>0&&r.push(`This skill grants workers additional tool permissions: ${i.join(`, `)}`),r.push(`\nInstruct a worker to use this skill by including "Use the /${e.name} skill" in your Agent prompt. The worker has access to the Skill tool and will receive the skill's content and permissions when it invokes it.`);let a=[{type:`text`,text:r.join(`
|
|
4
|
-
`)}];return{messages:[R({content:n,uuid:l}),R({content:a,isMeta:!0})],shouldQuery:!0,model:e.model,effort:e.effort,command:e}}let u=await e.getPromptForCommand(t,i),d=!
|
|
4
|
+
`)}];return{messages:[R({content:n,uuid:l}),R({content:a,isMeta:!0})],shouldQuery:!0,model:e.model,effort:e.effort,command:e}}let u=await e.getPromptForCommand(t,i),d=!Ce(`hooks`)||oe(e.source);if(e.hooks&&d){let t=r();it(i.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
5
5
|
|
|
6
|
-
`);o(e.name,f,p,s()?.agentId??null);let m=X(e,t),h=te(e.allowedTools??[]),g=c.length>0||a.length>0?[...c,...a,...u]:u,_=await
|
|
6
|
+
`);o(e.name,f,p,s()?.agentId??null);let m=X(e,t),h=te(e.allowedTools??[]),g=c.length>0||a.length>0?[...c,...a,...u]:u,_=await me(ce(u.filter(e=>e.type===`text`).map(e=>e.text).join(` `),i,null,[],i.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[R({content:m,uuid:l}),R({content:g,isMeta:!0}),..._,le({type:`command_permissions`,allowedTools:h,model:e.model})],shouldQuery:!0,allowedTools:h,model:e.model,effort:e.effort,command:e}}var Q,$;e((()=>{i(),Ae(),xe(),T(),S(),ye(),ae(),be(),Be(),_e(),we(),m(),Re(),x(),t(),g(),f(),I(),v(),He(),Ee(),at(),D(),Fe(),F(),We(),j(),Qe(),Ye(),rt(),ee(),Ze(),tt(),Oe(),ze(),ge(),je(),u(),Q=200,$=1e4}))();export{Y as formatSkillLoadingMetadata,ft as processPromptSlashCommand,lt as processSlashCommand};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./prompt-BBg3jtfc.js";t();export{e as isDeferredTool};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{Ln as ee,wn as te}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{t as re}from"./ajv-B_OpU_Uh.js";import{St as ie,cn as ae,n as oe,ut as se,vn as ce}from"./state-sIHsFpDu.js";import{$o as c,Dr as le,Pr as ue,Qo as de,S as fe,Xo as pe,Yo as l,Zo as me,_ as he,rs as ge,v as _e}from"./paths-
|
|
1
|
+
import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{Ln as ee,wn as te}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{t as re}from"./ajv-B_OpU_Uh.js";import{St as ie,cn as ae,n as oe,ut as se,vn as ce}from"./state-sIHsFpDu.js";import{$o as c,Dr as le,Pr as ue,Qo as de,S as fe,Xo as pe,Yo as l,Zo as me,_ as he,rs as ge,v as _e}from"./paths-1ngPRtu3.js";import{E as ve,P as ye,V as be,W as xe,d as Se,h as Ce,p as we,s as Te,w as Ee}from"./debug-UI3T040K.js";import{J as De,et as Oe,o as ke,s as Ae}from"./log-CzsijfHZ.js";import{i as je,o as Me}from"./platform-CuyedWpe.js";import{s as Ne,u as Pe}from"./types-Csi32ZXh.js";import{n as Fe,t as Ie}from"./lazySchema-2sOku3cX.js";import{i as Le,r as Re,t as ze}from"./cron-DiW7eIPP.js";import{join as u}from"path";import{readFileSync as Be}from"fs";import{randomUUID as Ve}from"crypto";import{mkdir as He,writeFile as Ue}from"fs/promises";function We(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function Ge(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function Ke(e,t){return e.find(e=>Ge(e,t))}function qe(e){return{...Ye,userFacingName:()=>e.name,...e}}var Je,Ye,Xe=e((()=>{Je=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),Ye={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),d,f=e((()=>{d=`Bash`}));function Ze(){return`A powerful search tool built on ripgrep
|
|
2
2
|
|
|
3
3
|
Usage:
|
|
4
4
|
- ALWAYS use ${p} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${d} command. The ${p} tool has been optimized for correct permissions and access.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Wk as e,Xk as t}from"./loadAgentsDir-D7kapZB5.js";t();export{e as clearPromptCache};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{O as a,d as o,h as s,p as c,s as l,w as u}from"./debug-UI3T040K.js";import{n as d,t as f}from"./execSyncWrapper-C2XQnFVo.js";import{r as p,t as m}from"./which-DqSAIvp2.js";import{
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{O as a,d as o,h as s,p as c,s as l,w as u}from"./debug-UI3T040K.js";import{n as d,t as f}from"./execSyncWrapper-C2XQnFVo.js";import{r as p,t as m}from"./which-DqSAIvp2.js";import{dS as h,ex as g,gS as _,hS as v,hv as y,lx as b,mv as x,pS as S}from"./loadAgentsDir-D7kapZB5.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!p(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,s=i.slice(1),c=D(n);if(c){let r=O(c,e,t),i={detached:!0,stdio:`ignore`},l;return l=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...s,...r],i),l.on(`error`,e=>o(`editor spawn failed: ${e}`,{level:`error`})),l.unref(),!0}let l=r.get(process.stdout);if(!l)return!1;let u=t&&j.test(C(a));l.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${u?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...s,...u?[`+${t}`,e]:[e]],r),i.error?(o(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{l.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),l(),m(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=c(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return f(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${b(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=S(n,v(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=c(),r=x();try{a(r,t?h(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
|
|
2
2
|
`)&&!i.endsWith(`
|
|
3
3
|
|
|
4
|
-
`)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{
|
|
4
|
+
`)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{_(),i(),P(),d(),s(),g(),u(),y(),z={code:`code -w`,subl:`subl --wait`}}));export{P as a,N as i,R as n,k as o,B as r,I as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ac as e,Sc as t}from"./paths-
|
|
1
|
+
import{Ac as e,Sc as t}from"./paths-1ngPRtu3.js";import{E as n,d as r,s as i,w as a}from"./debug-UI3T040K.js";import{n as o,t as s}from"./which-DqSAIvp2.js";import{r as c,t as l}from"./execFileNoThrow-CuQN1sz8.js";import{n as u,t as d}from"./githubRepoPathMapping-DCJLSTLl.js";import{n as f}from"./banner-CVXH2xts.js";import{a as p,i as m,n as h}from"./registerProtocol-DLuRm0mf.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";a(),m(),h(),e(),i(),c(),s();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=t().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let n=process.env.TERM_PROGRAM;if(n){let e=n.replace(/\.app$/i,``).toLowerCase(),t=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(t)return{name:t.name,command:t.app}}for(let e of y){let{code:t,stdout:n}=await l(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await l(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await o(e);if(t)return{name:_(e),command:t}}let t=await o(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await o(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await o(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await o(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await o(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,t){let n=await w();if(!n)return r(`No terminal emulator detected`,{level:`error`}),!1;r(`Launching in terminal: ${n.name} (${n.command})`);let i=[`--deep-link-origin`];switch(t.repo&&(i.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&i.push(`--prefill`,t.query),process.platform){case`darwin`:return E(n,e,i,t.cwd);case`linux`:return D(n,e,i,t.cwd);case`win32`:return O(n,e,i,t.cwd);default:return!1}}async function E(e,t,n,i){switch(e.command){case`iTerm`:{let{code:e}=await l(`osascript`,[`-e`,`tell application "iTerm"
|
|
2
2
|
if running then
|
|
3
3
|
create window with default profile
|
|
4
4
|
else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-1ngPRtu3.js";import{n as m,r as h}from"./analytics-DqMQntaB.js";import{Ax as g,Fg as _,Ig as v,Lg as y,Rg as b,da as x,fa as S,kx as C}from"./loadAgentsDir-D7kapZB5.js";import{n as w,t as T}from"./extra-usage-DIYR_3ZR.js";import{n as E,t as D}from"./upgrade-ByIumMQe.js";function O({onDone:e,context:t}){let[n,i]=(0,A.useState)(null),a=v(),c=p(),d=o(),f=l()?.hasExtraUsageEnabled===!0,m=c===`max`&&d===`default_claude_max_20x`,g=c===`team`||c===`enterprise`,_=u(`tengu_jade_anvil_4`,!1),b=(0,A.useMemo)(()=>{let e=[];if(y.isEnabled()){let t=s(),n=g&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}!m&&!g&&S.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`});let t={label:`Stop and wait for limit to reset`,value:`cancel`};return _?[...e,t]:[t,...e]},[_,m,g,f,a.overageStatus,a.overageDisabledReason]);function x(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function w(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),D(e,t).then(e=>{e&&i(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),T(e,t).then(e=>{e&&i(e)})):n===`cancel`&&x()}return n||(0,j.jsx)(r,{title:`What do you want to do?`,onCancel:x,color:`suggestion`,children:(0,j.jsx)(C,{options:b,onChange:w,visibleOptionCount:b.length})})}async function k(e,t){return(0,j.jsx)(O,{onDone:e,context:t})}var A,j;e((()=>{A=t(n(),1),g(),i(),c(),m(),_(),f(),d(),w(),b(),x(),E(),j=a()}))();export{k as call};
|