claude-code-best 2.6.11 → 2.6.13
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-CGKtPsTK.js → AddWorkspaceDirectory-BKIYdg96.js} +1 -1
- package/dist/chunks/{App-DF28Bpg9.js → App-BAwWP3iN.js} +1 -1
- package/dist/chunks/ApproveApiKey-CJFvgVKS.js +1 -0
- package/dist/chunks/{ApproveApiKey-D21kbmQj.js → ApproveApiKey-da08NX2f.js} +1 -1
- package/dist/chunks/{AssistantSessionChooser-CDfwNVi5.js → AssistantSessionChooser-DQMKGO_q.js} +1 -1
- package/dist/chunks/BackgroundTasksDialog-Jtiqm4k2.js +2 -0
- package/dist/chunks/{BypassPermissionsModeDialog-BDWFw61G.js → BypassPermissionsModeDialog-D7TJ4Qn1.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-CpN0yIU_.js → ClaudeInChromeOnboarding-CuPz5Xfi.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CRC6kEV1.js +1 -0
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-CWRHpy22.js → ClaudeMdExternalIncludesDialog-J0uv5XzG.js} +1 -1
- package/dist/chunks/ConsoleOAuthFlow-CE4OlAHo.js +1 -0
- package/dist/chunks/{DesktopHandoff-CKHLXiwc.js → DesktopHandoff-B_vNnZS5.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-BwMFW7Wt.js → DevChannelsDialog-kjRnWtNf.js} +1 -1
- package/dist/chunks/{DiffDialog-oA1v0BMo.js → DiffDialog-CSBWOnXJ.js} +2 -2
- package/dist/chunks/Doctor-DhK599q8.js +1 -0
- package/dist/chunks/Doctor-VJ5ZGb8g.js +3 -0
- package/dist/chunks/{ExitFlow-DJLYN-Bd.js → ExitFlow-M5XPGBHL.js} +2 -2
- package/dist/chunks/{Feedback-CpfhqIEv.js → Feedback-FHvqI2bu.js} +2 -2
- package/dist/chunks/Grove-68muTpx6.js +1 -0
- package/dist/chunks/{Grove-BugC6ssx.js → Grove-BC2IZIhN.js} +1 -1
- package/dist/chunks/{HybridTransport-PeXWuYfl.js → HybridTransport-Df_FceV2.js} +1 -1
- package/dist/chunks/{ITermBackend-dcs68DGS.js → ITermBackend-DkpK9X1H.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-DdB9_Ve0.js → InvalidConfigDialog-Cm6Yvt00.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-BL8nxwWQ.js → InvalidSettingsDialog-Ai3D8AL1.js} +1 -1
- package/dist/chunks/MCPConnectionManager-BqNXYQEr.js +1 -0
- package/dist/chunks/{McpParsingWarnings-BYPXpmte.js → McpParsingWarnings-BZcVbGhE.js} +1 -1
- package/dist/chunks/MessageSelector-BXOoEogr.js +3 -0
- package/dist/chunks/Messages-F6OIAv8C.js +11 -0
- package/dist/chunks/{Onboarding-ByLnHSnW.js → Onboarding-n1aA7tmN.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-CVNfTSKG.js → OverageCreditUpsell-Bt23I92r.js} +1 -1
- package/dist/chunks/{PluginSettings-h9Lj0vW6.js → PluginSettings-Dgu23nzv.js} +3 -3
- package/dist/chunks/{PromptInputFooterSuggestions-CYWSLCgA.js → PromptInputFooterSuggestions-uiV23aG4.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-BsYNhZCw.js → PromptInputHelpMenu-D84vnNKM.js} +1 -1
- package/dist/chunks/QueryEngine-CEodAvI2.js +1 -0
- package/dist/chunks/{REPL-CV12-ns7.js → REPL-CTTa9BK0.js} +34 -34
- package/dist/chunks/REPL-IO7wsKaQ.js +1 -0
- package/dist/chunks/{RemoteCallout-WWO84za-.js → RemoteCallout-BYKqws96.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-Dx2skKnM.js → RemoteSessionManager-Dq0W_fcj.js} +2 -2
- package/dist/chunks/ResumeConversation-CxzeCdL8.js +1 -0
- package/dist/chunks/{SSETransport-BHdzk1HO.js → SSETransport-CJrrD1ln.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DI-36R5p.js +1 -0
- package/dist/chunks/SentryErrorBoundary-BKPxEWOf.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-CmewX8Dv.js → SentryErrorBoundary-CcI0kkLW.js} +1 -1
- package/dist/chunks/Settings-CGcBR9CD.js +2 -0
- package/dist/chunks/{TeleportProgress-BmbhZlOg.js → TeleportProgress-C7muqjDw.js} +1 -1
- package/dist/chunks/TeleportRepoMismatchDialog-B3pUiRc2.js +1 -0
- package/dist/chunks/{TeleportResumeWrapper-BlkvOdYn.js → TeleportResumeWrapper-ClyBQR3K.js} +1 -1
- package/dist/chunks/{ThemePicker-v_3lh136.js → ThemePicker-CGIB6YiW.js} +1 -1
- package/dist/chunks/{TmuxBackend-B7Nabc5t.js → TmuxBackend-m2ldrneQ.js} +1 -1
- package/dist/chunks/{TrustDialog-CHu5eoeR.js → TrustDialog-o5kqmn6m.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-BSMetgqr.js → ValidationErrorsList-D7bXMb0U.js} +1 -1
- package/dist/chunks/{WelcomeV2-DZfBSTu5.js → WelcomeV2-Ckp3JPnA.js} +1 -1
- package/dist/chunks/{WindowsTerminalBackend-CeSoQ_Nk.js → WindowsTerminalBackend-DsDqNWSP.js} +2 -2
- package/dist/chunks/{add-dir-7UeFZkdv.js → add-dir-DTP3NrLy.js} +1 -1
- package/dist/chunks/{agentDisplay-DJgsfIlm.js → agentDisplay-BEn43jMP.js} +1 -1
- package/dist/chunks/{agents-DD7gQVZD.js → agents-3ii2LyeQ.js} +1 -1
- package/dist/chunks/{agents-DK0y9jId.js → agents-g0PDZl_l.js} +7 -7
- package/dist/chunks/{ant-PhgMZT08.js → ant-PZvt_t1G.js} +1 -1
- package/dist/chunks/{api-nHsRf03G.js → api-BRckHGQ5.js} +1 -1
- package/dist/chunks/api-DBvyymX6.js +1 -0
- package/dist/chunks/{assistant-DO7RAhd3.js → assistant-BBmaU8-A.js} +1 -1
- package/dist/chunks/{assistant-BJbeizyH.js → assistant-CMaN0QzY.js} +1 -1
- package/dist/chunks/assistant-CVhvOfqJ.js +1 -0
- package/dist/chunks/auth-BXzbkJcE.js +1 -0
- package/dist/chunks/{auth-DxRiJwZ-.js → auth-Cud9tPJB.js} +1 -1
- package/dist/chunks/{autoMode-BswSpjo5.js → autoMode-BREcJLYf.js} +6 -6
- package/dist/chunks/{autonomy-CNJQwoAQ.js → autonomy-CuQizTZi.js} +1 -1
- package/dist/chunks/{autonomy-Lc78acHX.js → autonomy-h9vver1r.js} +12 -12
- package/dist/chunks/{autonomyPanel-DxcumRp-.js → autonomyPanel-DVyrTxfP.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-DwA5WO9N.js +1 -0
- package/dist/chunks/backgroundHousekeeping-Ij_q7KN8.js +17 -0
- package/dist/chunks/{branch-BPsUW1dk.js → branch-B9AQFFTX.js} +2 -2
- package/dist/chunks/{bridge-DcOGvDbb.js → bridge-BkL7g0ua.js} +2 -2
- package/dist/chunks/bridgeConfig-BPP3lJRh.js +1 -0
- package/dist/chunks/{bridgeConfig-CvKdNJOg.js → bridgeConfig-BZQBBfap.js} +1 -1
- package/dist/chunks/{bridgeEnabled-D01faWms.js → bridgeEnabled-Bkmqv-2V.js} +1 -1
- package/dist/chunks/bridgeEnabled-BwBjPmEE.js +1 -0
- package/dist/chunks/bridgeMain-CbGj0plH.js +68 -0
- package/dist/chunks/bridgeMain-DpQRGiMo.js +1 -0
- package/dist/chunks/{bridgeMessaging-BZMDSZAN.js → bridgeMessaging-C-ZFPTiZ.js} +1 -1
- package/dist/chunks/{btw-B8s-X_cm.js → btw-BSme4Kzi.js} +1 -1
- package/dist/chunks/{buddy-DkB1xU1o.js → buddy-DX94yYTy.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-B9Qz9zKO.js → bypassPermissionsKillswitch-Crl2aipx.js} +1 -1
- package/dist/chunks/{caches-BuSzLvN9.js → caches-DeXmHls9.js} +2 -2
- package/dist/chunks/caches-U1iFQIc7.js +1 -0
- package/dist/chunks/{ccrClient-CMZXfu9P.js → ccrClient-BYD1ONzC.js} +1 -1
- package/dist/chunks/changeDetector-PaQPe1HQ.js +1 -0
- package/dist/chunks/channelNotification-Aq0p9f-W.js +1 -0
- package/dist/chunks/{channelNotification-t6Kgu-vX.js → channelNotification-B0QskFjB.js} +1 -1
- package/dist/chunks/{chrome-Cvkozg2F.js → chrome-B8ByN3u6.js} +1 -1
- package/dist/chunks/clear-CeJ5tgg8.js +1 -0
- package/dist/chunks/client-B7AdqRap.js +1 -0
- package/dist/chunks/color-OlMWmMnJ.js +1 -0
- package/dist/chunks/commands-BwfOl3fk.js +1 -0
- package/dist/chunks/{commitAttribution-CUqUEjsh.js → commitAttribution-C479aqmn.js} +1 -1
- package/dist/chunks/commitAttribution-CZ1OOh8F.js +1 -0
- package/dist/chunks/compact-Dq-J7j1C.js +3 -0
- package/dist/chunks/{companion-Cf_kYtOD.js → companion-CtJjyD3N.js} +1 -1
- package/dist/chunks/{config-45GLd-lt.js → config-DcnYYwCy.js} +1 -1
- package/dist/chunks/{config-JGm0O-ZQ.js → config-_KcvL7RX.js} +1 -1
- package/dist/chunks/{context-Bl5VUX5M.js → context-CShSBp-i.js} +1 -1
- package/dist/chunks/{context-noninteractive-DdPFYYO9.js → context-noninteractive-BApFNncX.js} +2 -2
- package/dist/chunks/context-noninteractive-uMvPKhng.js +1 -0
- package/dist/chunks/conversation-BlUHkj1_.js +1 -0
- package/dist/chunks/conversation-CCzL-eYb.js +1 -0
- package/dist/chunks/{copy-CbhxPqw4.js → copy-DIMR3Q3S.js} +2 -2
- package/dist/chunks/{createSSHSession-Dq2nMChz.js → createSSHSession-DvSnUdsD.js} +1 -1
- package/dist/chunks/createSession-D8tcktmP.js +1 -0
- package/dist/chunks/{createSession-DTHPUie-.js → createSession-DaT4x1E6.js} +1 -1
- package/dist/chunks/{cronJitterConfig-IGWCRDrv.js → cronJitterConfig-C2a-Ybqm.js} +3 -3
- package/dist/chunks/crossProjectResume-B3Chhiwf.js +40 -0
- package/dist/chunks/{daemon-VYRit6Aq.js → daemon-CCtZ9wY3.js} +1 -1
- package/dist/chunks/datadog-BYNSi8R3.js +1 -0
- package/dist/chunks/{datadog-FKvRNyFi.js → datadog-DCukMGn4.js} +1 -1
- package/dist/chunks/{desktop-ZASE3YWy.js → desktop-BXj3JEMV.js} +1 -1
- package/dist/chunks/{diff-QP-TbxuD.js → diff-D3Xuv_4J.js} +1 -1
- package/dist/chunks/{doctor-DVkgmkRb.js → doctor-B5-jh6lS.js} +1 -1
- package/dist/chunks/earlyInput-RoVleNEN.js +1 -0
- package/dist/chunks/{effort-DbryQCua.js → effort-CpHnXRxJ.js} +2 -2
- package/dist/chunks/{entry-D8y42iuM.js → entry-YXnIL7B7.js} +8 -8
- package/dist/chunks/envLessBridgeConfig-CcgSiwvA.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-D4bSwf7w.js → envLessBridgeConfig-MaElAFPV.js} +1 -1
- package/dist/chunks/exit-DKG0r57m.js +1 -0
- package/dist/chunks/{export-C9A9nOA1.js → export-BNbcpW3p.js} +1 -1
- package/dist/chunks/{exportRenderer-CyTuZFFF.js → exportRenderer-pYMIcnO4.js} +1 -1
- package/dist/chunks/extra-usage-DTXphHAD.js +1 -0
- package/dist/chunks/{extra-usage-C6s5mXW0.js → extra-usage-H-U38bGx.js} +1 -1
- package/dist/chunks/{extra-usage-core-BFCwz3XM.js → extra-usage-core-N4VLj0ye.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-IHq7s6wm.js → extra-usage-noninteractive-BGUiGr3a.js} +1 -1
- package/dist/chunks/{extraUsage-CIrG_Lbw.js → extraUsage-X6CmSsdg.js} +1 -1
- package/dist/chunks/extractMemories-C8R4DJVc.js +1 -0
- package/dist/chunks/{fast-NEKXVZqQ.js → fast-BJwQnvAP.js} +1 -1
- package/dist/chunks/fast-DMkPYQmQ.js +1 -0
- package/dist/chunks/{feedback-D5iWO16P.js → feedback-DLcYu4id.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-Dr3TK3IU.js → firstPartyEventLogger-C00GfHTl.js} +1 -1
- package/dist/chunks/{flushGate-DygHyqmB.js → flushGate-0DZFLUEb.js} +1 -1
- package/dist/chunks/{gates-Dyz_t5zJ.js → gates-DP4JyL5e.js} +1 -1
- package/dist/chunks/gates-DeLWne9R.js +1 -0
- package/dist/chunks/gemini-CnKaXUJJ.js +1 -0
- package/dist/chunks/{generateRecap-DZiXeYWn.js → generateRecap-BUS2DEdj.js} +1 -1
- package/dist/chunks/{generateSessionName-EbB2vl9t.js → generateSessionName-CnPPgvyy.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-dky2fPeU.js → githubRepoPathMapping-CnXpQRPY.js} +1 -1
- package/dist/chunks/grok-C2BUbWJR.js +1 -0
- package/dist/chunks/{growthbook-JD-WW3yV.js → growthbook-CPTqwUyC.js} +1 -1
- package/dist/chunks/{heapdump-8vyFTWly.js → heapdump-pamjtM2a.js} +1 -1
- package/dist/chunks/{help-C2DM0p8U.js → help-z7XnNKDT.js} +1 -1
- package/dist/chunks/hooks-BEAaBqmd.js +1 -0
- package/dist/chunks/{hooks-CMh0a2pT.js → hooks-iTfSDH96.js} +2 -2
- package/dist/chunks/{hostAdapter-CmbGfgNV.js → hostAdapter-DWD430of.js} +1 -1
- package/dist/chunks/{ide-Bn8R7397.js → ide-BK8Td_CD.js} +2 -2
- package/dist/chunks/{inboundAttachments-BweY9sYo.js → inboundAttachments-DQ4Czsr5.js} +1 -1
- package/dist/chunks/inboundAttachments-Dq3IYudc.js +1 -0
- package/dist/chunks/initReplBridge-BeGirV3Q.js +1 -0
- package/dist/chunks/{insights-NOl_PxhN.js → insights-DfD6PMkd.js} +64 -64
- package/dist/chunks/{install-BoT2GIcz.js → install-CNq--Fit.js} +1 -1
- package/dist/chunks/{install-github-app-SD4PvrTR.js → install-github-app-Dhq_T_EJ.js} +2 -2
- package/dist/chunks/{install-slack-app-DLQXpOCt.js → install-slack-app-mz5O3xo_.js} +1 -1
- package/dist/chunks/{instrumentation-BXJk0mxI.js → instrumentation-CM0poWjx.js} +3 -3
- package/dist/chunks/{job-CnlMlm3t.js → job-CKI1I_Va.js} +1 -1
- package/dist/chunks/{keybindings-BjaRqcbD.js → keybindings-5qahtcNc.js} +2 -2
- package/dist/chunks/{lang-BI8CzjL6.js → lang-BMNwfSRv.js} +1 -1
- package/dist/chunks/{language-CRIdgj2F.js → language-DXpi4083.js} +1 -1
- package/dist/chunks/language-GlWQb4l9.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-Bg9guiqy.js → launchAgentsPlatform-BU4bAPan.js} +1 -1
- package/dist/chunks/{launchAutofixPr-BMfXGXwN.js → launchAutofixPr-B80p6iq-.js} +3 -3
- package/dist/chunks/{launchLocalMemory-lgnXOi6U.js → launchLocalMemory-CDAa9B30.js} +2 -2
- package/dist/chunks/{launchLocalVault-C0Oz-lto.js → launchLocalVault-B19lF8tP.js} +3 -3
- package/dist/chunks/{launchMemoryStores-Bw11ruRi.js → launchMemoryStores-C6wJI-8V.js} +1 -1
- package/dist/chunks/{launchOnboarding-WEW34cnl.js → launchOnboarding-BIlwEdkk.js} +1 -1
- package/dist/chunks/{launchSchedule-X0rcM_kM.js → launchSchedule-DjMh3--x.js} +1 -1
- package/dist/chunks/{launchSkillStore-DpxSlMCU.js → launchSkillStore-Bs5thijU.js} +1 -1
- package/dist/chunks/{launchTeleport-uOtMsYcI.js → launchTeleport-CDlWx4xC.js} +2 -2
- package/dist/chunks/{launchVault-CJyJaPqH.js → launchVault-C40NAyOp.js} +1 -1
- package/dist/chunks/loadAgentsDir-BYqiLHDS.js +1 -0
- package/dist/chunks/{loadAgentsDir-D-xcJ22-.js → loadAgentsDir-C9Ee_fs1.js} +793 -749
- package/dist/chunks/loadPluginHooks-DaETszNq.js +1 -0
- package/dist/chunks/{localSearch-B6Ho7Vfj.js → localSearch-B3zijtEM.js} +1 -1
- package/dist/chunks/localSearch-BTGnGPVi.js +1 -0
- package/dist/chunks/{login-uOvq1xN_.js → login-B3IQj5YQ.js} +1 -1
- package/dist/chunks/login-CUM0odSh.js +1 -0
- package/dist/chunks/{logoV2Utils-C2cdcgtp.js → logoV2Utils-CW73xjcW.js} +1 -1
- package/dist/chunks/logout-B3hPrJSX.js +1 -0
- package/dist/chunks/{magicDocs-BBjAhGN1.js → magicDocs-BysWdjbO.js} +2 -2
- package/dist/chunks/{main-DGsAUuG_.js → main-CnAyCMYQ.js} +48 -48
- package/dist/chunks/{mappers-CO6koWDa.js → mappers-D1SAyuKF.js} +1 -1
- package/dist/chunks/mcp-BIiXcANN.js +1 -0
- package/dist/chunks/mcp-BLcZi9zs.js +2 -0
- package/dist/chunks/mcp-nOKz2_By.js +6 -0
- package/dist/chunks/{mcpServer-C-0K3Azg.js → mcpServer-CJOTyq3O.js} +1 -1
- package/dist/chunks/{mcpServer-C_aDoLMg.js → mcpServer-DaiouIKs.js} +1 -1
- package/dist/chunks/memory-DtFuXZHl.js +1 -0
- package/dist/chunks/mode-BPNUYCpk.js +2 -0
- package/dist/chunks/model-Cky6xlFt.js +1 -0
- package/dist/chunks/{model-CrAPXYZA.js → model-DC5bOhtE.js} +1 -1
- package/dist/chunks/{onChangeAppState-C6ZIU1SD.js → onChangeAppState-pafR88Yw.js} +1 -1
- package/dist/chunks/{openai-Cm4gozk8.js → openai-BOxlfR-k.js} +3 -3
- package/dist/chunks/{overageCreditGrant-Pe7C_4Qi.js → overageCreditGrant-BmmOYjTh.js} +1 -1
- package/dist/chunks/{panel-Bz_8td5D.js → panel-s9fbCKfl.js} +1 -1
- package/dist/chunks/{passes-BpI6azLG.js → passes-CqiFdifM.js} +1 -1
- package/dist/chunks/{paths-D9CVAtXU.js → paths-C2JRlUsH.js} +3 -3
- package/dist/chunks/permissions-BHJUxNga.js +3 -0
- package/dist/chunks/{pipeTransport-wjeyTgon.js → pipeTransport-BTYiqf9e.js} +1 -1
- package/dist/chunks/{plan-DA8IRpHQ.js → plan-CF_ClJlj.js} +1 -1
- package/dist/chunks/{plugin-N2pTkzOz.js → plugin-Bz3RKbru.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-DCc5qDvo.js → pluginAutoupdate-Ck0wWoNE.js} +1 -1
- package/dist/chunks/pluginBlocklist-7dlesHcW.js +1 -0
- package/dist/chunks/{pluginCliCommands-BN7loc5T.js → pluginCliCommands-D502zE25.js} +1 -1
- package/dist/chunks/{pluginFlagging-Dpu1cvMo.js → pluginFlagging-DfHARfd-.js} +1 -1
- package/dist/chunks/pluginOperations-BBRf8tuH.js +2 -0
- package/dist/chunks/{pluginStartupCheck-DvWHwNnD.js → pluginStartupCheck-BKEhWQR2.js} +1 -1
- package/dist/chunks/pluginStartupCheck-ZcaocOSL.js +1 -0
- package/dist/chunks/plugins-JnZ3lNqG.js +4 -0
- package/dist/chunks/policyLimits-CtOjYdHx.js +1 -0
- package/dist/chunks/{pollConfig-xYxAmuXi.js → pollConfig-Duecunu0.js} +1 -1
- package/dist/chunks/{poor-C0KwfFF0.js → poor-CUwZAV9z.js} +1 -1
- package/dist/chunks/poorMode-DOoZ0U-8.js +1 -0
- package/dist/chunks/{poorMode-D7WXWZtJ.js → poorMode-DRcH1fuh.js} +1 -1
- package/dist/chunks/print-D9IhN66j.js +39 -0
- package/dist/chunks/{privacy-settings-DT3LGgsH.js → privacy-settings-DmbuvR-R.js} +1 -1
- package/dist/chunks/processBashCommand-Cg8we9vS.js +1 -0
- package/dist/chunks/processSlashCommand-BBQQEGZd.js +6 -0
- package/dist/chunks/{projectContext-0fpRKUeH.js → projectContext-D5FgyE-d.js} +1 -1
- package/dist/chunks/prompt-7Vt8FUX_.js +1 -0
- package/dist/chunks/prompt-Cj0hg3CU.js +1 -0
- package/dist/chunks/{prompt-C69iv9cI.js → prompt-thBQB2X5.js} +1 -1
- package/dist/chunks/{promptEditor-BZqpLrcZ.js → promptEditor-C8B2TEXp.js} +2 -2
- package/dist/chunks/{protocolHandler-CfmBTg36.js → protocolHandler-BUKWgksO.js} +1 -1
- package/dist/chunks/rate-limit-options-PruvKAQt.js +1 -0
- package/dist/chunks/{rcDebugLog-CTOZ2K3E.js → rcDebugLog-CIS3PU-H.js} +1 -1
- package/dist/chunks/{referral-D26orIXE.js → referral-CXmDvb7V.js} +1 -1
- package/dist/chunks/refresh-C_FDHRT7.js +1 -0
- package/dist/chunks/{registerProtocol-DSQh-I21.js → registerProtocol-WxQUBybC.js} +1 -1
- package/dist/chunks/registry-CeBTik9J.js +1 -0
- package/dist/chunks/{release-notes-Cg85UVo8.js → release-notes-aZ6QUVnT.js} +1 -1
- package/dist/chunks/{releaseNotes-Dps4SeVh.js → releaseNotes-2GPd_O_r.js} +2 -2
- package/dist/chunks/{reload-plugins-Bo-R1CF3.js → reload-plugins-BDh4ZhHi.js} +1 -1
- package/dist/chunks/{remote-env-ChQuV3rO.js → remote-env-BIOFHNQC.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-BXtygJA-.js → remoteBridgeCore-DyA_2GrL.js} +1 -1
- package/dist/chunks/{remoteControlServer-sqW_JLwC.js → remoteControlServer-BjW9GsPd.js} +2 -2
- package/dist/chunks/rename-CKlAeppY.js +1 -0
- package/dist/chunks/{resume-CtOI2pOJ.js → resume-Dm71Aeni.js} +2 -2
- package/dist/chunks/{runtimeObserver-DojpbVgU.js → runtimeObserver-BYOo5dT0.js} +1 -1
- package/dist/chunks/{runtimeObserver-CJ955XSo.js → runtimeObserver-CA7pdBvT.js} +3 -3
- package/dist/chunks/sandbox-adapter-C7TBAehE.js +1 -0
- package/dist/chunks/{sandbox-toggle-B9dn09gt.js → sandbox-toggle-fHc9E9xW.js} +1 -1
- package/dist/chunks/searchExtraTools-CpFsg_tS.js +1 -0
- package/dist/chunks/{sentry-B6tWUNGj.js → sentry-B1g5Tgp2.js} +1 -1
- package/dist/chunks/{session-C5yIf_zV.js → session-C46oy7nX.js} +2 -2
- package/dist/chunks/{sessionDiscovery-CQ3iMN4s.js → sessionDiscovery-CtrJ2Bfr.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-dwF5SFoS.js +1 -0
- package/dist/chunks/sessionMemory-BqCsLnFl.js +1 -0
- package/dist/chunks/sessionMemory-D4-Ymn0Q.js +1 -0
- package/dist/chunks/sessionMemoryUtils-BKdYMir6.js +1 -0
- package/dist/chunks/sessionObserver-Bfu8q0_K.js +1 -0
- package/dist/chunks/{sessionObserver-MQA9_wZw.js → sessionObserver-DoBuLaCJ.js} +1 -1
- package/dist/chunks/sessionStorage-CUUU_J4D.js +1 -0
- package/dist/chunks/{sessionTitle-BafqFHLc.js → sessionTitle-BOM0LQlq.js} +1 -1
- package/dist/chunks/{sessionTracing-_obALZbi.js → sessionTracing-BEKULg2L.js} +1 -1
- package/dist/chunks/{settingsSync-DBWi-NXU.js → settingsSync-BIsGiZhM.js} +1 -1
- package/dist/chunks/{setup-DIxsjw17.js → setup-C3FOTg1s.js} +1 -1
- package/dist/chunks/{setup-C_GrS0Rd.js → setup-ChF37I92.js} +1 -1
- package/dist/chunks/setup-DvFPFV-3.js +2 -0
- package/dist/chunks/{shadowedRuleDetection-CwMwv9uM.js → shadowedRuleDetection-spwhhTXF.js} +1 -1
- package/dist/chunks/{sideQuestion-CI5pyoQF.js → sideQuestion-iy7kJEkr.js} +2 -2
- package/dist/chunks/{sink-BSTUubjl.js → sink-D6dxOYIw.js} +1 -1
- package/dist/chunks/sink-FeQonv8-.js +1 -0
- package/dist/chunks/sinks-DKMqKJ66.js +1 -0
- package/dist/chunks/{sinks-B9EsWFeb.js → sinks-zNh_PVeS.js} +2 -2
- package/dist/chunks/{skill-learning-DThetLpo.js → skill-learning-ChAFwJf0.js} +1 -1
- package/dist/chunks/skillChangeDetector-8LVraP0Y.js +1 -0
- package/dist/chunks/{skillGapStore-BmjCK9ZR.js → skillGapStore-CUws9CQ6.js} +2 -2
- package/dist/chunks/{skillGapStore-ax0GuSmd.js → skillGapStore-CdPgIARS.js} +1 -1
- package/dist/chunks/{skillGenerator-Dj3xInwG.js → skillGenerator-CLtTRIjy.js} +2 -2
- package/dist/chunks/skillLearning-CBosoKl-.js +1 -0
- package/dist/chunks/skillLearning-f7-aknmS.js +1 -0
- package/dist/chunks/{skillPanel-CJ4tvX7A.js → skillPanel-Cd0AFEZf.js} +3 -3
- package/dist/chunks/{skillSearchPanel-hwZvXKZ4.js → skillSearchPanel-VWiAbmdr.js} +3 -3
- package/dist/chunks/{skills-BVWDDcD9.js → skills-oQtI4eDn.js} +1 -1
- package/dist/chunks/{sprites-B-V9otkt.js → sprites-Cp4_DJUI.js} +1 -1
- package/dist/chunks/{stats-DcS6ZnsX.js → stats-B1X-nxO8.js} +1 -1
- package/dist/chunks/{status-DZKjK9CE.js → status-BtCnWZEv.js} +1 -1
- package/dist/chunks/statusNoticeHelpers-B6GW2gMe.js +1 -0
- package/dist/chunks/{tag-B5b-waIf.js → tag-B6WpuUE_.js} +2 -2
- package/dist/chunks/{tasks-vXM-vULI.js → tasks-DIOPZDoF.js} +1 -1
- package/dist/chunks/{teamHelpers-CbFFdvPw.js → teamHelpers-9p7wPcXj.js} +1 -1
- package/dist/chunks/teamHelpers-PLGwYL4x.js +1 -0
- package/dist/chunks/teammateModeSnapshot-DO-3AkNP.js +1 -0
- package/dist/chunks/{teammateModeSnapshot-DkkMv2-b.js → teammateModeSnapshot-DU8JCRRs.js} +1 -1
- package/dist/chunks/teleport-DPUoWpD4.js +1 -0
- package/dist/chunks/{templateJobs-BLQqrGjb.js → templateJobs-DOSQvjx0.js} +1 -1
- package/dist/chunks/{terminalSetup-BLU99dau.js → terminalSetup-DdHkyElj.js} +1 -1
- package/dist/chunks/{terminalSetup-BKfVYk3w.js → terminalSetup-tSFJeCVl.js} +1 -1
- package/dist/chunks/{theme-BM2CXWYE.js → theme-Hf1fhR3q.js} +1 -1
- package/dist/chunks/thinkback-5QYAbr0P.js +1 -0
- package/dist/chunks/thinkback-B5IraP81.js +1 -0
- package/dist/chunks/thinkback-play-Bqv85sjY.js +1 -0
- package/dist/chunks/{toolEventObserver-71WYUega.js → toolEventObserver-B-mqmRv0.js} +1 -1
- package/dist/chunks/{toolEventObserver-nxcfjaur.js → toolEventObserver-_Fk1dSYg.js} +1 -1
- package/dist/chunks/toolPool-C2KLBvek.js +1 -0
- package/dist/chunks/toolPool-CiEaFfxq.js +1 -0
- package/dist/chunks/{trustedDevice-C0KJ0qiK.js → trustedDevice-BowIKqqC.js} +1 -1
- package/dist/chunks/{trustedDevice-Brc9B8cZ.js → trustedDevice-f8HslQu2.js} +1 -1
- package/dist/chunks/{tui-BVc2q4Xv.js → tui-geoc3zxu.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-BY0T8Pzl.js → ultrareviewCommand-DbmRN6Lg.js} +2 -2
- package/dist/chunks/{undercover-j27F8p49.js → undercover-Ch9wnIbk.js} +1 -1
- package/dist/chunks/undercover-X6-EJ_7K.js +1 -0
- package/dist/chunks/{updateCCB-Dgb2ed9v.js → updateCCB-DFHrOTEX.js} +1 -1
- package/dist/chunks/{upgrade-zs7K9UkG.js → upgrade-B6Ih-Ubj.js} +1 -1
- package/dist/chunks/upgrade-CC4cnsnt.js +1 -0
- package/dist/chunks/{upload-Df84yCBz.js → upload-DSTB33ZR.js} +1 -1
- package/dist/chunks/{usage-DKENFl_k.js → usage-CNqpSfd2.js} +1 -1
- package/dist/chunks/{usage-lTILrQJV.js → usage-DiZsjcMM.js} +1 -1
- package/dist/chunks/useMainLoopModel-Bo6iEtB3.js +1 -0
- package/dist/chunks/{useManagePlugins-DDKeDfIv.js → useManagePlugins-Cvj0XfLp.js} +1 -1
- package/dist/chunks/useMergedTools-BEpwy0Ec.js +1 -0
- package/dist/chunks/{useSearchInput-DNpNG36H.js → useSearchInput-YiO4crrI.js} +1 -1
- package/dist/chunks/useSettingsErrors-BE-PITl4.js +1 -0
- package/dist/chunks/{useVoice-DmObXoAh.js → useVoice-D1sKPiqb.js} +1 -1
- package/dist/chunks/{util-9vJ9WIeZ.js → util-C8_5375U.js} +1 -1
- package/dist/chunks/utils-Dmh9vBcg.js +1 -0
- package/dist/chunks/validatePlugin-BQA60S_J.js +1 -0
- package/dist/chunks/{vim-CK7lReJi.js → vim-oNiLgw0C.js} +1 -1
- package/dist/chunks/{voice-BLVF7E3Q.js → voice-CGsMzVaA.js} +2 -2
- package/dist/chunks/voiceModeEnabled-DprM_JSH.js +1 -0
- package/dist/chunks/{voiceModeEnabled-BpLBjY2-.js → voiceModeEnabled-Dpx-sP8V.js} +1 -1
- package/dist/chunks/voiceStreamSTT-CASv4SGl.js +1 -0
- package/dist/chunks/{voiceStreamSTT-i4tUq3Hu.js → voiceStreamSTT-CaI5Uz-7.js} +1 -1
- package/dist/chunks/{workerRegistry-Bg7dWLHf.js → workerRegistry-CCYrYthd.js} +1 -1
- package/dist/chunks/worktree-C9WNXNFR.js +1 -0
- package/dist/chunks/{xml-K_hNNh2b.js → xml-BW5T-oW-.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-BtiWOryM.js +0 -1
- package/dist/chunks/BackgroundTasksDialog-5RpkAbJz.js +0 -2
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Dje7A0F2.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-DQf3dmj6.js +0 -1
- package/dist/chunks/Doctor-ButdpAkf.js +0 -1
- package/dist/chunks/Doctor-QVMo0fIh.js +0 -3
- package/dist/chunks/Grove-CmdRVv9F.js +0 -1
- package/dist/chunks/MCPConnectionManager-D2eAGUME.js +0 -1
- package/dist/chunks/MessageSelector-Bzq8CYAH.js +0 -3
- package/dist/chunks/Messages-uRxxAMW-.js +0 -11
- package/dist/chunks/QueryEngine-CxP2S3qi.js +0 -1
- package/dist/chunks/REPL-h1bwm8ee.js +0 -1
- package/dist/chunks/ResumeConversation-CagiCg7-.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-BJ2d8mtx.js +0 -1
- package/dist/chunks/SentryErrorBoundary-CYiFofRZ.js +0 -1
- package/dist/chunks/Settings-BcgtW60l.js +0 -2
- package/dist/chunks/TeleportRepoMismatchDialog-BAwtgUhR.js +0 -1
- package/dist/chunks/api-D4aCzJS-.js +0 -1
- package/dist/chunks/assistant-Dvx-UrTi.js +0 -1
- package/dist/chunks/auth-Cp7Nt0ik.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BkfWgzIP.js +0 -17
- package/dist/chunks/backgroundHousekeeping-BxBI2KkX.js +0 -1
- package/dist/chunks/bridgeConfig-Dkn5GGec.js +0 -1
- package/dist/chunks/bridgeEnabled-CjaYKTo5.js +0 -1
- package/dist/chunks/bridgeMain-Bu2oOX31.js +0 -68
- package/dist/chunks/bridgeMain-CEpOBx8Z.js +0 -1
- package/dist/chunks/caches-Bvl2jdxF.js +0 -1
- package/dist/chunks/changeDetector-DTXMv7gH.js +0 -1
- package/dist/chunks/channelNotification-B7s1OoRK.js +0 -1
- package/dist/chunks/clear-C9pufI6F.js +0 -1
- package/dist/chunks/client-CqJ5gRGj.js +0 -1
- package/dist/chunks/color-AYeAYKyq.js +0 -1
- package/dist/chunks/commands-LcLR5Vgx.js +0 -1
- package/dist/chunks/commitAttribution-BZupnGMc.js +0 -1
- package/dist/chunks/compact-BF0-0_qh.js +0 -3
- package/dist/chunks/context-noninteractive-BtzPsJ8k.js +0 -1
- package/dist/chunks/conversation-C3NWyOB3.js +0 -1
- package/dist/chunks/conversation-oX932vBQ.js +0 -1
- package/dist/chunks/createSession-1ewHG3eq.js +0 -1
- package/dist/chunks/crossProjectResume-WmabPBTO.js +0 -40
- package/dist/chunks/datadog-Da7KYZNF.js +0 -1
- package/dist/chunks/earlyInput-JGJo1zcC.js +0 -1
- package/dist/chunks/envLessBridgeConfig-CpW0G4Eh.js +0 -1
- package/dist/chunks/exit-BsNW67F9.js +0 -1
- package/dist/chunks/extra-usage-DL2C0_BM.js +0 -1
- package/dist/chunks/extractMemories-CA2eJwHy.js +0 -1
- package/dist/chunks/fast-B01NO2uA.js +0 -1
- package/dist/chunks/gates-BSpXbh9s.js +0 -1
- package/dist/chunks/gemini-BEmbnRQR.js +0 -1
- package/dist/chunks/grok-BM6ZJ4w2.js +0 -1
- package/dist/chunks/hooks-QXGwOfWj.js +0 -1
- package/dist/chunks/inboundAttachments-N5DKbZSl.js +0 -1
- package/dist/chunks/initReplBridge-3CfmzjJL.js +0 -1
- package/dist/chunks/language-DmbRGIs8.js +0 -1
- package/dist/chunks/loadAgentsDir-ILQxk_4G.js +0 -1
- package/dist/chunks/loadPluginHooks-BC1Ea7_D.js +0 -1
- package/dist/chunks/localSearch-COyJeP9E.js +0 -1
- package/dist/chunks/login-Cf89biEK.js +0 -1
- package/dist/chunks/logout-CEXwTlEX.js +0 -1
- package/dist/chunks/mcp-BrN_Tbq5.js +0 -6
- package/dist/chunks/mcp-CZltNml5.js +0 -1
- package/dist/chunks/mcp-D6JOqdT8.js +0 -2
- package/dist/chunks/memory-BYYOgo4e.js +0 -1
- package/dist/chunks/model-CHgqwg6N.js +0 -1
- package/dist/chunks/permissions-C7wcAYOc.js +0 -3
- package/dist/chunks/pluginBlocklist-C_Veew3p.js +0 -1
- package/dist/chunks/pluginOperations-CP6NFNog.js +0 -2
- package/dist/chunks/pluginStartupCheck-BF0xUEJG.js +0 -1
- package/dist/chunks/plugins-BHoniP5f.js +0 -4
- package/dist/chunks/policyLimits-sh7ywop0.js +0 -1
- package/dist/chunks/poorMode-DZQXZ_zu.js +0 -1
- package/dist/chunks/print-BcRG8gkQ.js +0 -39
- package/dist/chunks/processBashCommand-DPfJ9lrj.js +0 -1
- package/dist/chunks/processSlashCommand-DyPCeZux.js +0 -6
- package/dist/chunks/prompt-DaIJzI1P.js +0 -1
- package/dist/chunks/prompt-DnLsyywj.js +0 -1
- package/dist/chunks/rate-limit-options-P7oQuwrl.js +0 -1
- package/dist/chunks/refresh-BeSXaVya.js +0 -1
- package/dist/chunks/registry-Dp5W2V8B.js +0 -1
- package/dist/chunks/rename-Bigaipiq.js +0 -1
- package/dist/chunks/sandbox-adapter-BbrJOJNZ.js +0 -1
- package/dist/chunks/searchExtraTools-Denn1c1E.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-1IAwziOQ.js +0 -1
- package/dist/chunks/sessionMemory-3TAJyNuJ.js +0 -1
- package/dist/chunks/sessionMemory-HZNzEOLd.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BAkA4sGG.js +0 -1
- package/dist/chunks/sessionObserver-DqLMFMLM.js +0 -1
- package/dist/chunks/sessionStorage-CFfMypMQ.js +0 -1
- package/dist/chunks/setup-D1sQnli9.js +0 -2
- package/dist/chunks/sink-fGBOXJab.js +0 -1
- package/dist/chunks/sinks-BCl9slVM.js +0 -1
- package/dist/chunks/skillChangeDetector-BOH-fyEn.js +0 -1
- package/dist/chunks/skillLearning-BDsjN-u-.js +0 -1
- package/dist/chunks/skillLearning-CXUsWxdi.js +0 -1
- package/dist/chunks/statusNoticeHelpers-reCcymMR.js +0 -1
- package/dist/chunks/teamHelpers-BBhol4dD.js +0 -1
- package/dist/chunks/teammateModeSnapshot-W5G22rwQ.js +0 -1
- package/dist/chunks/teleport-Da0rKwCo.js +0 -1
- package/dist/chunks/thinkback-Cd1g_2A9.js +0 -1
- package/dist/chunks/thinkback-ChP6pvCS.js +0 -1
- package/dist/chunks/thinkback-play-Cg8Ys2dq.js +0 -1
- package/dist/chunks/toolPool-CN1cPGQz.js +0 -1
- package/dist/chunks/toolPool-CygNb5cr.js +0 -1
- package/dist/chunks/undercover-bx8TwG9W.js +0 -1
- package/dist/chunks/upgrade-BkHztwGA.js +0 -1
- package/dist/chunks/useMainLoopModel-X1PW9z5A.js +0 -1
- package/dist/chunks/useMergedTools-CC3XwtOR.js +0 -1
- package/dist/chunks/useSettingsErrors-vGzCYpIA.js +0 -1
- package/dist/chunks/utils-Dg0S2Vfn.js +0 -1
- package/dist/chunks/validatePlugin-_Z4zhjSx.js +0 -1
- package/dist/chunks/voiceModeEnabled-BqFYzoXw.js +0 -1
- package/dist/chunks/voiceStreamSTT-C0pkuXGm.js +0 -1
- package/dist/chunks/worktree-Cg4p1J__.js +0 -1
- /package/dist/chunks/{InProcessTransport-DB52dh4f.js → InProcessTransport-gJLr5CIx.js} +0 -0
- /package/dist/chunks/{attributionHooks-PygdohOh.js → attributionHooks-Br5LZ6bk.js} +0 -0
- /package/dist/chunks/{attributionTrailer-BpvhXgRP.js → attributionTrailer-BMTuK4Ax.js} +0 -0
- /package/dist/chunks/{autoModeDenials-Cp6VFdsm.js → autoModeDenials-D8eQ1CoM.js} +0 -0
- /package/dist/chunks/{banner-CVXH2xts.js → banner-32EBTKI7.js} +0 -0
- /package/dist/chunks/{bedrockClient-qi1-JCOK.js → bedrockClient-Ci523Btx.js} +0 -0
- /package/dist/chunks/{ccshareResume-DWLjTF22.js → ccshareResume-CqNm2k-J.js} +0 -0
- /package/dist/chunks/{chromeNativeHost-4U39yLtd.js → chromeNativeHost-DX8f9Y2L.js} +0 -0
- /package/dist/chunks/{claudeDesktop-D0S1eq1F.js → claudeDesktop-C1qQs6os.js} +0 -0
- /package/dist/chunks/{cleanup-Bg_gFgcj.js → cleanup-Pv6U3HiI.js} +0 -0
- /package/dist/chunks/{connectHeadless-CwsFt-Mh.js → connectHeadless-DFCrE6O4.js} +0 -0
- /package/dist/chunks/{dangerousBackend-BU_PHGR2.js → dangerousBackend-Du0K4q5Z.js} +0 -0
- /package/dist/chunks/{earlyInput-tRkbxFv2.js → earlyInput-feVuZGzR.js} +0 -0
- /package/dist/chunks/{eventLoopStallDetector-Dnh1fc31.js → eventLoopStallDetector-XfubcyMN.js} +0 -0
- /package/dist/chunks/{fpsMetrics-DeezdcwV.js → fpsMetrics-CEQt6Tk1.js} +0 -0
- /package/dist/chunks/{fuse-Ch_OAlm3.js → fuse-TM-TeOo_.js} +0 -0
- /package/dist/chunks/{instinctParser-DHMa8xa0.js → instinctParser-CJPM8VjX.js} +0 -0
- /package/dist/chunks/{lockfile-DBwdlC3K.js → lockfile-Y1hwdHrQ.js} +0 -0
- /package/dist/chunks/{main-C6be1KFk.js → main-D9fUXJiD.js} +0 -0
- /package/dist/chunks/{observationStore-tvkldXUo.js → observationStore-gFvWXJmc.js} +0 -0
- /package/dist/chunks/{openaiShared-Bjrci9n8.js → openaiShared-Dy78YERG.js} +0 -0
- /package/dist/chunks/{output-style-XDb9-2Kk.js → output-style-BmEQscMd.js} +0 -0
- /package/dist/chunks/{parseConnectUrl-BS6i9JPo.js → parseConnectUrl-C6cvMkkH.js} +0 -0
- /package/dist/chunks/{poller-Ds0Y6Cir.js → poller-Dbo07OEA.js} +0 -0
- /package/dist/chunks/{postCommitAttribution-Ehmwzzuq.js → postCommitAttribution-DhFkZMxJ.js} +0 -0
- /package/dist/chunks/{projectContext-eXMSfgdZ.js → projectContext-iWPqcl0Z.js} +0 -0
- /package/dist/chunks/{renderOptions-BiyC2rj1.js → renderOptions-rmj4Mkls.js} +0 -0
- /package/dist/chunks/{rewind-CXplHgh_.js → rewind-DAn-nNs-.js} +0 -0
- /package/dist/chunks/{sanitization-CYp-9DbE.js → sanitization-JYRkZFrK.js} +0 -0
- /package/dist/chunks/{sdkHeapDumpMonitor--fevrC5z.js → sdkHeapDumpMonitor-DKtfJW5o.js} +0 -0
- /package/dist/chunks/{server-C5XZSlto.js → server-CswFAYwN.js} +0 -0
- /package/dist/chunks/{serverBanner-WlSYP-f8.js → serverBanner-CImTYGhY.js} +0 -0
- /package/dist/chunks/{serverLog-DtsUvDiY.js → serverLog-Bwt7XEmk.js} +0 -0
- /package/dist/chunks/{sessionDataUploader-Ctjo1bgR.js → sessionDataUploader-CKRXCBxI.js} +0 -0
- /package/dist/chunks/{sessionManager-Dw72ZUTg.js → sessionManager-Ca2O821f.js} +0 -0
- /package/dist/chunks/{stickers-2K05wjSp.js → stickers-BMh2qjgF.js} +0 -0
- /package/dist/chunks/{udsClient-BvG_Jip0.js → udsClient-BdPOrL1H.js} +0 -0
- /package/dist/chunks/{upstreamproxy-DcLeL2XX.js → upstreamproxy-Ci5T_JCo.js} +0 -0
- /package/dist/chunks/{voice-DXiiy8HX.js → voice-BcA5h8ya.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e}from"./chunk-DR8-3Aex.js";import{d as t,s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,cn as a,ot as o}from"./state-sIHsFpDu.js";import{Ac as s,Jt as c,Pc as l,Pt as u,S as d,Sc as f,la as p,nn as m,on as h,ua as g,v as _}from"./paths-D9CVAtXU.js";import{L as v,V as y,X as ee,Y as b,d as x,s as S}from"./debug-UI3T040K.js";import{n as te,r as C}from"./analytics-DqMQntaB.js";import{F as w,P as T,i as ne,m as re,v as E}from"./git-CN3qtTb_.js";import{g as D,m as O}from"./log-CzsijfHZ.js";import{n as k,t as A}from"./sleep-8Eb9j_Ly.js";import{Aa as ie,Ar as ae,Ba as j,Ca as M,Da as N,Ea as oe,Eo as se,Ka as P,Lo as ce,Ma as F,Oa as le,Oo as I,Ra as L,Sa as ue,Ta as de,Vo as fe,Xv as pe,Zv as me,cd as R,fd as he,hr as z,ja as B,ka as ge,wa as _e}from"./loadAgentsDir-D-xcJ22-.js";import{O as V,_ as ve,d as H,k as ye,n as be,t as U}from"./rcDebugLog-CTOZ2K3E.js";import{a as W,c as G,d as xe,f as Se,o as K,r as Ce,s as q,u as J}from"./debugUtils-BBMFODKH.js";import{a as we,i as Te}from"./trustedDevice-Brc9B8cZ.js";import{a as Y,i as Ee,n as X,o as Z,t as Q}from"./bridgeConfig-CvKdNJOg.js";import{a as De,o as Oe,r as ke,s as Ae,t as je}from"./bridgeEnabled-D01faWms.js";import{i as Me,t as $}from"./assistant-BJbeizyH.js";import{t as Ne}from"./capacityWake-BXlUpptF.js";import{n as Pe,t as Fe}from"./pollConfig-xYxAmuXi.js";import{a as Ie,n as Le,r as Re,t as ze}from"./workSecret-mS2OrpxF.js";import{a as Be,i as Ve,n as He,t as Ue}from"./createSession-DTHPUie-.js";import{i as We,n as Ge}from"./envLessBridgeConfig-D4bSwf7w.js";import{n as Ke,o as qe}from"./mappers-CO6koWDa.js";import{n as Je,r as Ye,t as Xe}from"./sessionTitle-BafqFHLc.js";import{a as Ze,i as Qe,n as $e,o as et,r as tt,t as nt}from"./bridgeMessaging-BZMDSZAN.js";import{t as rt}from"./HybridTransport-PeXWuYfl.js";import{n as it,r as at,t as ot}from"./flushGate-DygHyqmB.js";import{hostname as st}from"os";import{randomUUID as ct}from"crypto";a(),O(),E(),s(),g(),h(),d(),Y(),me(),ke(),ce(),L(),ae(),Ve(),We(),Ke(),Ye(),ge(),S(),U(),T(),te(),b(),G(),R(),we(),V(),H(),n(),K(),y(),A(),M();var lt=2e3,ut=6e4,dt=900*1e3,ft=0;async function pt(e){let{dir:n,machineName:i,branch:a,gitRepoUrl:o,title:s,baseUrl:c,sessionIngressUrl:l,workerType:u,getAccessToken:d,createSession:f,archiveSession:p,getCurrentTitle:m=()=>s,toSDKMessages:h=()=>{throw Error(`BridgeCoreParams.toSDKMessages not provided. Pass it if you use writeMessages() or initialMessages — daemon callers that only use writeSdkMessages() never hit this path.`)},onAuth401:g,getPollIntervalConfig:_=()=>Pe,initialHistoryCap:y=200,initialMessages:b,previouslyFlushedUUIDs:S,onInboundMessage:te,onPermissionResponse:T,onInterrupt:ne,onSetModel:re,onSetMaxThinkingTokens:E,onSetPermissionMode:D,onStateChange:O,onUserMessage:k,perpetual:A,initialSSESequenceNum:ie=0}=e,ae=++ft,{writeBridgePointer:j,clearBridgePointer:M,readBridgePointer:N}=await import(`./bridgePointer-B2FPGDWR.js`),se=A?await N(n):null,P=se?.source===`repl`?se:null;x(`[bridge:repl] initBridgeCore #${ae} starting (initialMessages=${b?.length??0}${P?` perpetual prior=env:${P.environmentId}`:``})`);let ce=le({baseUrl:c,getAccessToken:d,runnerVersion:`2.6.11`,onDebug:x,onAuth401:g,getTrustedDeviceToken:Te}),F=process.env.USER_TYPE===`ant`?oe(ce):ce,I={dir:n,machineName:i,branch:a,gitRepoUrl:o,maxSessions:1,spawnMode:`single-session`,verbose:!1,sandbox:!1,bridgeId:ct(),workerType:u,environmentId:ct(),reuseEnvironmentId:P?.environmentId,apiBaseUrl:c,sessionIngressUrl:l},L,fe;try{let e=await F.registerBridgeEnvironment(I);L=e.environment_id,fe=e.environment_secret}catch(e){return q(`registration_failed`,`[bridge:repl] Environment registration failed: ${v(e)}`),P&&await M(n),O?.(`failed`,v(e)),null}x(`[bridge:repl] Environment registered: ${L}`),w(`info`,`bridge_repl_env_registered`),C(`tengu_bridge_repl_env_registered`,{});async function pe(e,t){if(L!==e)return x(`[bridge:repl] Env mismatch (requested ${e}, got ${L}) — cannot reconnect in place`),!1;let n=Se(t),r=n===t?[t]:[t,n];for(let e of r)try{return await F.reconnectSession(L,e),x(`[bridge:repl] Reconnected session ${e} in place on env ${L}`),!0}catch(t){x(`[bridge:repl] reconnectSession(${e}) failed: ${v(t)}`)}return x(`[bridge:repl] reconnectSession exhausted — falling through to fresh session`),!1}let me=P?await pe(P.environmentId,P.sessionId):!1;P&&!me&&await M(n);let R;if(me&&P){if(R=P.sessionId,x(`[bridge:repl] Perpetual session reused: ${R}`),b&&S)for(let e of b)S.add(e.uuid)}else{let e=await f({environmentId:L,title:s,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});if(!e)return x(`[bridge:repl] Session creation failed, deregistering environment`),C(`tengu_bridge_repl_session_failed`,{}),await F.deregisterEnvironment(L).catch(()=>{}),O?.(`failed`,`Session creation failed`),null;R=e,x(`[bridge:repl] Session created: ${R}`)}await j(n,{sessionId:R,environmentId:L,source:`repl`}),w(`info`,`bridge_repl_session_created`),C(`tengu_bridge_repl_started`,{has_initial_messages:!!(b&&b.length>0),inProtectedNamespace:t()});let z=new Set;if(b)for(let e of b)z.add(e.uuid);let B=new nt(2e3);for(let e of z)B.add(e);let ge=new nt(2e3),V=new AbortController,H=null;ve(e=>{V.signal.aborted||H?.reportMetadata(e)},{replayCurrent:!0});let U=0,W=me?ie:0,G=null,K=null,Ce=Ne(V.signal),J=Ce.wake,we=Ce.signal,Y=new ot,Ee=!k,X=0,Z=null;async function Q(){if(Z)return Z;Z=De();try{return await Z}finally{Z=null}}async function De(){if(X++,be(`doReconnect: attempt=${X}/3 envId=${L} sessionId=${R} workId=${G}`),U++,x(`[bridge:repl] Reconnecting after env lost (attempt ${X}/3)`),X>3)return x(`[bridge:repl] Environment reconnect limit reached (3), giving up`),!1;if(H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}if(J(),Y.drop(),G){let e=G;if(await F.stopWork(L,e,!1).catch(()=>{}),G!==e)return x(`[bridge:repl] Poll loop recovered during stopWork await — deferring to it`),X=0,!0;G=null,K=null}if(V.signal.aborted)return x(`[bridge:repl] Reconnect aborted by teardown`),!1;let e=L;I.reuseEnvironmentId=e;try{let e=await F.registerBridgeEnvironment(I);L=e.environment_id,fe=e.environment_secret}catch(e){return I.reuseEnvironmentId=void 0,x(`[bridge:repl] Environment re-registration failed: ${v(e)}`),!1}if(I.reuseEnvironmentId=void 0,x(`[bridge:repl] Re-registered: requested=${e} got=${L}`),V.signal.aborted)return x(`[bridge:repl] Reconnect aborted after env registration, cleaning up`),await F.deregisterEnvironment(L).catch(()=>{}),!1;if(H!==null)return x(`[bridge:repl] Poll loop recovered during registerBridgeEnvironment await — deferring to it`),X=0,!0;if(await pe(e,R))return C(`tengu_bridge_repl_reconnected_in_place`,{}),X=0,!0;if(L!==e&&C(`tengu_bridge_repl_env_expired_fresh_session`,{}),await p(R),V.signal.aborted)return x(`[bridge:repl] Reconnect aborted after archive, cleaning up`),await F.deregisterEnvironment(L).catch(()=>{}),!1;let t=m(),r=await f({environmentId:L,title:t,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});return r?V.signal.aborted?(x(`[bridge:repl] Reconnect aborted after session creation, cleaning up`),await p(r),!1):(R=r,he(xe(r)).catch(()=>{}),W=0,ge.clear(),Ee=!k,x(`[bridge:repl] Re-created session: ${R}`),await j(n,{sessionId:R,environmentId:L,source:`repl`}),S?.clear(),X=0,!0):(x(`[bridge:repl] Session creation failed during reconnection`),!1)}function Oe(){return d()}function ke(){let e=Y.end();if(e.length===0)return;if(!H){x(`[bridge:repl] Cannot drain ${e.length} pending message(s): no transport`);return}for(let t of e)B.add(t.uuid);let t=h(e).map(e=>({...e,session_id:R}));x(`[bridge:repl] Drained ${e.length} pending message(s) after flush`),H.writeBatch(t)}let Ae=null;function je(){Ae?.()}function Me(e){if(be(`handleTransportPermanentClose: code=${e} transport=${H?`exists`:`null`} pollAborted=${V.signal.aborted}`),x(`[bridge:repl] Transport permanently closed: code=${e}`),C(`tengu_bridge_repl_ws_closed`,{code:e}),H){let e=H.getLastSequenceNum();e>W&&(W=e),H=null}J();let t=Y.drop();if(t>0&&x(`[bridge:repl] Dropping ${t} pending message(s) on transport close (code=${e})`,{level:`warn`}),e===1e3){O?.(`failed`,`session ended`),V.abort(),je();return}O?.(`reconnecting`,`Remote Control connection lost (code ${e})`),x(`[bridge:repl] Transport reconnect budget exhausted (code=${e}), attempting env reconnect`),Q().then(t=>{t||V.signal.aborted||(x(`[bridge:repl] reconnectEnvironmentWithSession resolved false — tearing down`),C(`tengu_bridge_repl_reconnect_failed`,{close_code:e}),O?.(`failed`,`reconnection failed`),je())})}let $;process.env.USER_TYPE===`ant`&&process.platform!==`win32`&&($=()=>{x(`[bridge:repl] SIGUSR2 received — forcing doReconnect() for testing`),Q()},process.on(`SIGUSR2`,$));let Fe=null;process.env.USER_TYPE===`ant`&&de({fireClose:e=>{if(!Fe){x(`[bridge:debug] fireClose: no transport wired yet`);return}x(`[bridge:debug] fireClose(${e}) — injecting`),Fe(e)},forceReconnect:()=>{x(`[bridge:debug] forceReconnect — injecting`),Q()},injectFault:_e,wakePollLoop:J,describe:()=>`env=${L} session=${R} transport=${H?.getStateLabel()??`null`} workId=${G??`null`}`}),mt({api:F,getCredentials:()=>({environmentId:L,environmentSecret:fe}),signal:V.signal,getPollIntervalConfig:_,onStateChange:O,getWsState:()=>H?.getStateLabel()??`null`,isAtCapacity:()=>H!==null,capacitySignal:we,onFatalError:je,getHeartbeatInfo:()=>!G||!K?null:{environmentId:L,workId:G,sessionToken:K},onHeartbeatFatal:e=>{if(x(`[bridge:repl] heartbeatWork fatal (status=${e.status}) — tearing down work item for fast re-dispatch`),H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}Y.drop(),G&&F.stopWork(L,G,!1).catch(e=>{x(`[bridge:repl] stopWork after heartbeat fatal: ${v(e)}`)}),G=null,K=null,J(),O?.(`reconnecting`,`Work item lease expired, fetching fresh token`)},async onEnvironmentLost(){return await Q()?{environmentId:L,environmentSecret:fe}:null},onWorkReceived:(e,t,i,a)=>{if(H?.isConnectedStatus()&&x(`[bridge:repl] Work received while transport connected, replacing with fresh token (workId=${i})`),x(`[bridge:repl] Work received: workId=${i} workSessionId=${e} currentSessionId=${R} match=${Ie(e,R)}`),j(n,{sessionId:R,environmentId:L,source:`repl`}),!Ie(e,R)){x(`[bridge:repl] Rejecting foreign session: expected=${R} got=${e}`);return}G=i,K=t;let o=a||r(process.env.CLAUDE_BRIDGE_USE_CCR_V2),s;if(!o){if(s=Oe(),!s){x(`[bridge:repl] No OAuth token available for session ingress, skipping work`);return}ye(s)}if(C(`tengu_bridge_repl_work_received`,{}),H){let e=H;H=null;let t=e.getLastSequenceNum();t>W&&(W=t),e.close()}Y.deactivate();let u=e=>Qe(e,{transport:H,sessionId:R,onInterrupt:ne,onSetModel:re,onSetMaxThinkingTokens:E,onSetPermissionMode:D}),d=!1,f=e=>{H=e,e.setOnConnect(()=>{if(H===e){if(x(`[bridge:repl] Ingress transport connected`),C(`tengu_bridge_repl_ws_connected`,{}),!o){let e=Oe();e&&ye(e)}if(He=!1,!d&&b&&b.length>0){d=!0;let t=y,n=b.filter(e=>Ze(e)&&!S?.has(e.uuid)),r=t>0&&n.length>t?n.slice(-t):n;r.length<n.length&&(x(`[bridge:repl] Capped initial flush: ${n.length} -> ${r.length} (cap=${t})`),C(`tengu_bridge_repl_history_capped`,{eligible_count:n.length,capped_count:r.length}));let i=h(r);if(i.length>0){x(`[bridge:repl] Flushing ${i.length} initial message(s) via transport`);let t=i.map(e=>({...e,session_id:R})),n=e.droppedBatchCount;e.writeBatch(t).then(()=>{if(e.droppedBatchCount>n){x(`[bridge:repl] Initial flush dropped ${e.droppedBatchCount-n} batch(es) — not marking ${i.length} UUID(s) as flushed`);return}if(S)for(let e of i)e.uuid&&S.add(e.uuid)}).catch(e=>x(`[bridge:repl] Initial flush failed: ${e}`)).finally(()=>{H===e&&(ke(),O?.(`connected`))})}else ke(),O?.(`connected`)}else Y.active||O?.(`connected`)}}),e.setOnData(e=>{try{let t=JSON.parse(e);be(`ingress: type=${t.type}${t.type===`control_request`?` subtype=${t.request?.subtype} request_id=${t.request_id}`:``}${t.type===`control_response`?` subtype=${t.response?.subtype} request_id=${t.response?.request_id}`:``}${t.type===`user`?` uuid=${t.uuid}`:``}${t.type===`keep_alive`?``:` len=${e.length}`}`)}catch{be(`ingress (non-JSON): ${String(e).slice(0,200)}`)}tt(e,B,ge,te,T,u)}),Fe=Me,e.setOnClose(t=>{H===e&&(be(`transport onClose: code=${t} connected=${e.isConnectedStatus()} state=${e.getStateLabel()} seq=${e.getLastSequenceNum()}`),Me(t))}),!d&&b&&b.length>0&&Y.start(),e.connect()};if(U++,o){let n=ze(c,e),r=U;x(`[bridge:repl] CCR v2: sessionUrl=${n} session=${e} gen=${r}`),at({sessionUrl:n,ingressToken:t,sessionId:e,initialSequenceNum:W}).then(e=>{if(V.signal.aborted){e.close();return}if(r!==U){x(`[bridge:repl] CCR v2: discarding stale handshake gen=${r} current=${U}`),e.close();return}f(e)},e=>{x(`[bridge:repl] CCR v2: createV2ReplTransport failed: ${v(e)}`,{level:`error`}),C(`tengu_bridge_repl_ccr_v2_init_failed`,{}),r===U&&(G&&(F.stopWork(L,G,!1).catch(e=>{x(`[bridge:repl] stopWork after v2 init failure: ${v(e)}`)}),G=null,K=null),J())})}else{let t=Le(l,e);x(`[bridge:repl] Ingress URL: ${t}`),x(`[bridge:repl] Creating HybridTransport: session=${e}`);let n=s??``;f(it(new rt(new URL(t),{Authorization:`Bearer ${n}`,"anthropic-version":`2023-06-01`},e,()=>({Authorization:`Bearer ${Oe()??n}`,"anthropic-version":`2023-06-01`}),{maxConsecutiveFailures:50,isBridge:!0,onBatchDropped:()=>{O?.(`reconnecting`,`Lost sync with Remote Control — events could not be delivered`),J()}})))}}});let Re=A?setInterval(()=>{Z||j(n,{sessionId:R,environmentId:L,source:`repl`})},60*6e4):null;Re?.unref?.();let Be=_().session_keepalive_interval_v2_ms,Ve=Be>0?setInterval(()=>{H&&(x(`[bridge:repl] keep_alive sent`),H.write({type:`keep_alive`}).catch(e=>{x(`[bridge:repl] keep_alive write failed: ${v(e)}`)}))},Be):null;Ve?.unref?.();let He=!1;Ae=async()=>{if(He){x(`[bridge:repl] Teardown already in progress, skipping duplicate call env=${L} session=${R}`);return}He=!0;let e=Date.now();if(x(`[bridge:repl] Teardown starting: env=${L} session=${R} workId=${G??`none`} transportState=${H?.getStateLabel()??`null`}`),Re!==null&&clearInterval(Re),Ve!==null&&clearInterval(Ve),$&&process.off(`SIGUSR2`,$),process.env.USER_TYPE===`ant`&&(ue(),Fe=null),V.abort(),x(`[bridge:repl] Teardown: poll loop aborted`),H){let e=H.getLastSequenceNum();e>W&&(W=e)}if(A){H=null,Y.drop(),await j(n,{sessionId:R,environmentId:L,source:`repl`}),x(`[bridge:repl] Teardown (perpetual): leaving env=${L} session=${R} alive on server, duration=${Date.now()-e}ms`);return}let t=H;if(H=null,Y.drop(),t){let e={...et(R),session_id:R};t.write(e)}let r=G?F.stopWork(L,G,!0).then(()=>{x(`[bridge:repl] Teardown: stopWork completed`)}).catch(e=>{x(`[bridge:repl] Teardown stopWork failed: ${v(e)}`)}):Promise.resolve();await Promise.all([r,p(R)]),t?.close(),x(`[bridge:repl] Teardown: transport closed`),await F.deregisterEnvironment(L).catch(e=>{x(`[bridge:repl] Teardown deregister failed: ${v(e)}`)}),await M(n),x(`[bridge:repl] Teardown complete: env=${L} duration=${Date.now()-e}ms`)};let Ue=ee(()=>Ae?.());return x(`[bridge:repl] Ready: env=${L} session=${R}`),O?.(`ready`),{get bridgeSessionId(){return R},get environmentId(){return L},getSSESequenceNum(){let e=H?.getLastSequenceNum()??0;return Math.max(W,e)},sessionIngressUrl:l,writeMessages(e){let t=e.filter(e=>Ze(e)&&!z.has(e.uuid)&&!B.has(e.uuid));if(t.length===0)return;if(!Ee)for(let e of t){let t=$e(e);if(t!==void 0&&k?.(t,R)){Ee=!0;break}}if(Y.enqueue(...t)){x(`[bridge:repl] Queued ${t.length} message(s) during initial flush`);return}if(!H){let e=t.map(e=>e.type).join(`,`);x(`[bridge:repl] Transport not configured, dropping ${t.length} message(s) [${e}] for session=${R}`,{level:`warn`});return}for(let e of t)B.add(e.uuid);x(`[bridge:repl] Sending ${t.length} message(s) via transport`);let n=h(t).map(e=>({...e,session_id:R}));H.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!B.has(e.uuid));if(t.length===0)return;if(!H){x(`[bridge:repl] Transport not configured, dropping ${t.length} SDK message(s) for session=${R}`,{level:`warn`});return}for(let e of t)e.uuid&&B.add(e.uuid);let n=t.map(e=>({...e,session_id:R}));H.writeBatch(n)},sendControlRequest(e){if(!H){x(`[bridge:repl] Transport not configured, skipping control_request`);return}let t={...e,session_id:R};H.write(t),x(`[bridge:repl] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(!H){x(`[bridge:repl] Transport not configured, skipping control_response`);return}let t={...e,session_id:R};H.write(t),x(`[bridge:repl] Sent control_response`)},sendControlCancelRequest(e){if(!H){x(`[bridge:repl] Transport not configured, skipping control_cancel_request`);return}let t={type:`control_cancel_request`,request_id:e,session_id:R};H.write(t),x(`[bridge:repl] Sent control_cancel_request request_id=${e}`)},sendResult(){if(!H){x(`[bridge:repl] sendResult: skipping, transport not configured session=${R}`);return}H.reportState(`idle`);let e={...et(R),session_id:R};H.write(e),x(`[bridge:repl] Sent result for session=${R}`)},async teardown(){Ue(),await Ae?.(),x(`[bridge:repl] Torn down`),C(`tengu_bridge_repl_teardown`,{})}}}async function mt({api:e,getCredentials:t,signal:n,onStateChange:r,onWorkReceived:i,onEnvironmentLost:a,getWsState:o,isAtCapacity:s,capacitySignal:c,onFatalError:l,getPollIntervalConfig:u=()=>Pe,getHeartbeatInfo:d,onHeartbeatFatal:f}){x(`[bridge:repl] Starting work poll loop for env=${t().environmentId}`);let p=0,m=null,h=null,g=0,_=!1;for(;!n.aborted;){let{environmentId:y,environmentSecret:ee}=t(),b=u();try{let t=await e.pollForWork(y,ee,n,b.reclaim_older_than_ms);if(g=0,p>0&&(x(`[bridge:repl] Poll recovered after ${p} consecutive error(s)`),p=0,m=null,h=null,r?.(`ready`)),!t){let t=_;if(_=!1,s?.()&&c&&!t){let t=b.poll_interval_ms_at_capacity;if(b.non_exclusive_heartbeat_interval_ms>0&&d){C(`tengu_bridge_heartbeat_mode_entered`,{heartbeat_interval_ms:b.non_exclusive_heartbeat_interval_ms});let r=t>0?Date.now()+t:null,i=!1,a=0;for(;!n.aborted&&s()&&(r===null||Date.now()<r);){let t=u();if(t.non_exclusive_heartbeat_interval_ms<=0)break;let n=d();if(!n)break;let r=c();try{await e.heartbeatWork(n.environmentId,n.workId,n.sessionToken)}catch(e){if(x(`[bridge:repl:heartbeat] Failed: ${v(e)}`),e instanceof N){r.cleanup(),C(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),f?(f(e),x(`[bridge:repl:heartbeat] Fatal (status=${e.status}), work state cleared — fast-polling for re-dispatch`)):i=!0;break}}a++,await k(t.non_exclusive_heartbeat_interval_ms,r.signal),r.cleanup()}let o=i?`error`:n.aborted?`shutdown`:s()?r!==null&&Date.now()>=r?`poll_due`:`config_disabled`:`capacity_changed`;if(C(`tengu_bridge_heartbeat_mode_exited`,{reason:o,heartbeat_cycles:a}),!i){o===`poll_due`&&x(`[bridge:repl] Heartbeat poll_due after ${a} cycles — falling through to pollForWork`);continue}}let r=t>0?t:b.non_exclusive_heartbeat_interval_ms;if(r>0){let e=c(),t=Date.now();await k(r,e.signal),e.cleanup();let n=Date.now()-t-r;n>6e4&&(x(`[bridge:repl] At-capacity sleep overran by ${Math.round(n/1e3)}s — process suspension detected, forcing one fast-poll cycle`),C(`tengu_bridge_repl_suspension_detected`,{overrun_ms:n}),_=!0)}}else await k(b.poll_interval_ms_not_at_capacity,n);continue}let a;try{a=Re(t.secret)}catch(n){x(`[bridge:repl] Failed to decode work secret: ${v(n)}`),C(`tengu_bridge_repl_work_secret_failed`,{}),await e.stopWork(y,t.id,!1).catch(()=>{});continue}x(`[bridge:repl] Acknowledging workId=${t.id}`);try{await e.acknowledgeWork(y,t.id,a.session_ingress_token)}catch(e){x(`[bridge:repl] Acknowledge failed workId=${t.id}: ${v(e)}`)}if(t.data.type===`healthcheck`){x(`[bridge:repl] Healthcheck received`);continue}if(t.data.type===`session`){let e=t.data.id;try{F(e,`session_id`)}catch{x(`[bridge:repl] Invalid session_id in work: ${e}`);continue}i(e,a.session_ingress_token,t.id,a.use_code_sessions===!0),x(`[bridge:repl] Work accepted, continuing poll loop`)}}catch(i){if(n.aborted)break;if(i instanceof N&&i.status===404&&a){let e=t().environmentId;if(y!==e){x(`[bridge:repl] Stale poll error for old env=${y}, current env=${e} — skipping onEnvironmentLost`),p=0,m=null;continue}if(g++,x(`[bridge:repl] Environment deleted, attempting re-registration (attempt ${g}/3)`),C(`tengu_bridge_repl_env_lost`,{attempt:g}),g>3){x(`[bridge:repl] Environment re-registration limit reached (3), giving up`),r?.(`failed`,`Environment deleted and re-registration limit reached`),l?.();break}r?.(`reconnecting`,`environment lost, recreating session`);let i=await a();if(n.aborted)break;if(i){p=0,m=null,r?.(`ready`),x(`[bridge:repl] Re-registered environment: ${i.environmentId}`);continue}r?.(`failed`,`Environment deleted and re-registration failed`),l?.();break}if(i instanceof N){let e=ie(i.errorType),t=B(i);x(`[bridge:repl] Fatal poll error: ${i.message} (status=${i.status}, type=${i.errorType??`unknown`})${t?` (suppressed)`:``}`),C(`tengu_bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),w(e?`info`:`error`,`bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),t||r?.(`failed`,e?`session expired · /remote-control to reconnect`:i.message),l?.();break}let s=Date.now();h!==null&&s-h>6e4*2&&(x(`[bridge:repl] Detected system sleep (${Math.round((s-h)/1e3)}s gap), resetting poll error budget`),w(`info`,`bridge_repl_poll_sleep_detected`,{gapMs:s-h}),p=0,m=null),h=s,p++,m===null&&(m=s);let c=s-m,f=W(i),_=Ce(i),v=o?.()??`unknown`;if(x(`[bridge:repl] Poll error (attempt ${p}, elapsed ${Math.round(c/1e3)}s, ws=${v}): ${_}`),C(`tengu_bridge_repl_poll_error`,{status:f,consecutiveErrors:p,elapsedMs:c}),p===1&&r?.(`reconnecting`,_),c>=9e5){x(`[bridge:repl] Poll failures exceeded ${dt/1e3}s (${p} errors), giving up`),w(`info`,`bridge_repl_poll_give_up`),C(`tengu_bridge_repl_poll_give_up`,{consecutiveErrors:p,elapsedMs:c,lastStatus:f}),r?.(`failed`,`connection to server lost`);break}let ee=Math.min(lt*2**(p-1),ut);if(u().non_exclusive_heartbeat_interval_ms>0){let t=d?.();if(t)try{await e.heartbeatWork(t.environmentId,t.workId,t.sessionToken)}catch{}}await k(ee,n)}}x(`[bridge:repl] Work poll loop ended (aborted=${n.aborted}) env=${t().environmentId}`)}S(),y(),K(),G();async function ht(t){let{onInboundMessage:n,onPermissionResponse:r,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:d,onSetPermissionMode:h,onStateChange:g,initialMessages:y,getMessages:ee,previouslyFlushedUUIDs:b,initialName:S,perpetual:te,outboundOnly:C,tags:w}=t??{};if(J(Oe),!await De())return q(`not_enabled`,`[bridge:repl] Skipping: bridge not enabled`),null;if(!Q())return q(`no_oauth`,`[bridge:repl] Skipping: no OAuth tokens`),g?.(`failed`,`/login`),null;if(await P(),!j(`allow_remote_control`))return q(`policy_denied`,`[bridge:repl] Skipping: allow_remote_control policy not allowed`),g?.(`failed`,`disabled by your organization's policy`),null;if(!Ee()){let e=f();if(e.bridgeOauthDeadExpiresAt!=null&&(e.bridgeOauthDeadFailCount??0)>=3&&c()?.expiresAt===e.bridgeOauthDeadExpiresAt)return x(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${e.bridgeOauthDeadFailCount} times)`),null;await u();let t=c();if(t&&t.expiresAt!==null&&t.expiresAt<=Date.now()){q(`oauth_expired_unrefreshable`,`[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)`),g?.(`failed`,`/login`);let e=t.expiresAt;return l(t=>({...t,bridgeOauthDeadExpiresAt:e,bridgeOauthDeadFailCount:t.bridgeOauthDeadExpiresAt===e?(t.bridgeOauthDeadFailCount??0)+1:1})),null}}let T=X(),E=`remote-control-${pe()}`,D=!1,O=!1;if(S)E=S,D=!0,O=!0;else{let e=i(),t=e?z(e):void 0;if(t)E=t,D=!0,O=!0;else if(y&&y.length>0)for(let e=y.length-1;e>=0;e--){let t=y[e];if(t.type!==`user`||t.isMeta||t.toolUseResult||t.isCompactSummary||t.origin&&t.origin.kind!==`human`||fe(t))continue;let n=se(t.message.content);if(!n)continue;let r=_t(n);if(r){E=r,D=!0;break}}}let k=0,A,ie=0,ae=(e,t,n)=>{D=!0,E=e,x(`[bridge:repl] derived title from message ${n}: ${e}`),Be(t,e,{baseUrl:T,getAccessToken:Q}).catch(()=>{})},M=(e,t)=>{let n=++ie,r=k;Je(e,AbortSignal.timeout(15e3)).then(e=>{e&&n===ie&&A===t&&!z(i())&&ae(e,t,r)})},N=(e,t)=>{if(O||z(i()))return!0;if(A!==void 0&&A!==t&&(k=0),A=t,k++,k===1&&!D){let n=_t(e);n&&ae(n,t,k),M(e,t)}else if(k===3){let n=ee?.();M(n?Xe(I(n)):e,t)}return k>=3},oe=_(`tengu_bridge_initial_history_cap`,200,300*1e3),ce=Z()?`self-hosted`:await p();if(!ce)return q(`no_org_uuid`,`[bridge:repl] Skipping: no org UUID`),g?.(`failed`,`/login`),null;if(Ae()&&!te){let e=await Ge();if(e)return q(`version_too_old`,`[bridge:repl] Skipping: ${e}`,!0),g?.(`failed`,"run `claude update` to upgrade"),null;x(`[bridge:repl] Using env-less bridge path (tengu_bridge_repl_v2)`);let{initEnvLessBridgeCore:t}=await import(`./remoteBridgeCore-BXtygJA-.js`);return t({baseUrl:T,orgUUID:ce,title:E,getAccessToken:Q,onAuth401:m,toSDKMessages:qe,initialHistoryCap:oe,initialMessages:y,onInboundMessage:n,onUserMessage:N,onPermissionResponse:r,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:d,onSetPermissionMode:h,onStateChange:g,outboundOnly:C,tags:w})}let F=je();if(F)return q(`version_too_old`,`[bridge:repl] Skipping: ${F}`),g?.(`failed`,"run `claude update` to upgrade"),null;let le=await ne(),L=await re(),ue=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||T,de=`claude_code`;{let{isAssistantMode:t}=(Me(),e($));t()&&(de=`claude_code_assistant`)}return pt({dir:o(),machineName:st(),branch:le,gitRepoUrl:L,title:E,baseUrl:T,sessionIngressUrl:ue,workerType:de,getAccessToken:Q,createSession:e=>He({...e,events:[],baseUrl:T,getAccessToken:Q}),archiveSession:e=>Ue(e,{baseUrl:T,getAccessToken:Q,timeoutMs:1500}).catch(e=>{x(`[bridge:repl] archiveBridgeSession threw: ${v(e)}`,{level:`error`})}),getCurrentTitle:()=>z(i())??E,onUserMessage:N,toSDKMessages:qe,onAuth401:m,getPollIntervalConfig:Fe,initialHistoryCap:oe,initialMessages:y,previouslyFlushedUUIDs:b,onInboundMessage:n,onPermissionResponse:r,onInterrupt:a,onSetModel:s,onSetMaxThinkingTokens:d,onSetPermissionMode:h,onStateChange:g,perpetual:te})}var gt=50;function _t(e){let t=D(e),n=(/^(.*?[.!?])\s/.exec(t)?.[1]??t).replace(/\s+/g,` `).trim();if(n)return n.length>gt?n.slice(0,gt-1)+`…`:n}export{ht as initReplBridge};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t}from"./language-CRIdgj2F.js";t();export{e as getResolvedLanguage};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e,t}from"./loadAgentsDir-D-xcJ22-.js";e();export{t as clearAgentDefinitionsCache};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Fv as e,Lv as t,Pv as n}from"./loadAgentsDir-D-xcJ22-.js";n();export{e as loadPluginHooks,t as setupPluginHookHotReload};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{a as e,c as t,o as n,t as r}from"./localSearch-B6Ho7Vfj.js";n();export{r as clearSkillIndexCache,e as getSkillIndex,t as searchSkills};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,r as t,t as n}from"./login-uOvq1xN_.js";t();export{n as Login,e as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{AT as e,MT as t,NT as n,jT as r}from"./loadAgentsDir-D-xcJ22-.js";t();export{e as call,r as clearAuthRelatedCaches,n as performLogout};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./p-map-D7WEmnBE.js";import{Mt as r,Rn as i,T as a,b as o,f as s,g as c,h as l,t as u,v as ee,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Ac as p,Nc as m,Po as h,Sc as g,bc as _,jo as v}from"./paths-D9CVAtXU.js";import{V as y,W as b}from"./debug-UI3T040K.js";import{n as x,r as S}from"./analytics-DqMQntaB.js";import{n as C,o as te}from"./process-DMKLUQIO.js";import{i as ne,o as re}from"./platform-CuyedWpe.js";import{s as ie,u as ae}from"./types-Csi32ZXh.js";import{$T as w,Cx as oe,DC as se,Dx as ce,EC as T,GC as E,IS as D,LS as O,TC as k,WC as A,ZT as j,aw as M,dy as N,eC as P,fw as F,gy as I,hw as L,hy as R,jC as z,kC as B,kx as V,nw as H,pw as U,tC as W,tw as G,uw as K,uy as le,wC as ue,yw as q}from"./loadAgentsDir-D-xcJ22-.js";import{n as J,t as Y}from"./exit-_obETqBv.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";n();var X=e(i(),1);w(),C(),u(),L(),v(),W(),I();var Z=f();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[i,u]=(0,X.useState)({});(0,X.useEffect)(()=>{K().then(({servers:e})=>u(e))},[]);let f=r.filter(e=>i[e]!==void 0);async function p(n){let r=0;for(let a of n){let n=e[a];if(n){let e=a;if(i[e]!==void 0){let t=1;for(;i[`${a}_${t}`]!==void 0;)t++;e=`${a}_${t}`}await M(e,n,t),r++}}g(r)}let[m]=a(),g=(0,X.useCallback)(e=>{te(e>0?`\n${ee(`success`,m)(`Successfully imported ${e} MCP ${h(e,`server`)} to ${t} config.`)}\n`:`
|
|
2
|
-
No servers were imported.`),n(),j()},[m,t,n]),_=(0,X.useCallback)(()=>{g(0)},[g]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(s,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${r.length} MCP ${h(r.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:_,hideInputGuide:!0,children:[f.length>0&&(0,Z.jsx)(o,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(o,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(R,{options:r.map(e=>({label:`${e}${f.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!f.includes(e)),onSubmit:p,onCancel:_,hideIndexes:!0})]}),(0,Z.jsx)(d,{paddingX:1,children:(0,Z.jsx)(o,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(l,{children:[(0,Z.jsx)(c,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(c,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(P,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}u(),N(),x(),se(),V(),L(),H(),O(),p(),y(),w(),ie(),re();async function Q(e,t){try{let n=await oe(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();S(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw b(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-D1sQnli9.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-D6JOqdT8.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let n=F(e),r=()=>{n&&(n.type===`sse`||n.type===`http`)&&(k(e,n),ue(e,n))};try{if(t.scope){let n=E(t.scope);S(`tengu_mcp_delete`,{name:e,scope:n}),await q(e,n),r(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${A(n)}`)}let n=_(),i=g(),{servers:a}=U(`project`),o=!!a[e],s=[];if(n.mcpServers?.[e]&&s.push(`local`),o&&s.push(`project`),i.mcpServers?.[e]&&s.push(`user`),s.length===0)Y(`No MCP server found with name: "${e}"`);else if(s.length===1){let t=s[0];S(`tengu_mcp_delete`,{name:e,scope:t}),await q(e,t),r(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${A(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),s.forEach(e=>{process.stderr.write(` - ${G(e)} (${A(e)})\n`)}),process.stderr.write(`
|
|
3
|
-
To remove from a specific scope, use:
|
|
4
|
-
`),s.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){S(`tengu_mcp_list`,{});let{servers:e}=await K();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
|
|
5
|
-
`);let n=await t(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:ce()});for(let{name:e,server:t,status:r}of n)if(t.type===`sse`)console.log(`${e}: ${t.url} (SSE) - ${r}`);else if(t.type===`http`)console.log(`${e}: ${t.url} (HTTP) - ${r}`);else if(t.type===`claudeai-proxy`)console.log(`${e}: ${t.url} - ${r}`);else if(!t.type||t.type===`stdio`){let n=t,i=Array.isArray(n.args)?n.args:[];console.log(`${e}: ${n.command} ${i.join(` `)} - ${r}`)}}await j(0)}async function $(e){S(`tengu_mcp_get`,{name:e});let t=F(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${G(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),T(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),T(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await j(0)}async function _e(e,t,n){try{let r=E(n.scope),i=ae(t),a=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await B():void 0;await M(e,i,r);let o=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;a&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&z(e,{type:i.type,url:i.url},a),S(`tengu_mcp_add`,{scope:r,source:`json`,type:o}),J(`Added ${o} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=E(e.scope);S(`tengu_mcp_add`,{scope:t,platform:ne(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-D0S1eq1F.js`),i=await n();Object.keys(i).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:a}=await r((0,Z.jsx)(D,{children:(0,Z.jsx)(le,{children:(0,Z.jsx)(pe,{servers:i,scope:t,onDone:()=>{a()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){S(`tengu_mcp_reset_mcpjson_choices`,{}),m(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
|
|
6
|
-
You will be prompted for approval next time you start Claude Code.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{Q as i,Rn as a,T as o,b as s,f as c,g as l,h as u,nt as d,t as f,tt as p,v as m,x as h}from"./src-Di342QoJ.js";import{t as g}from"./jsx-runtime-D-D469L8.js";import{Do as _,Po as v,jo as y}from"./paths-D9CVAtXU.js";import{c as b,s as x}from"./debug-UI3T040K.js";import{$C as S,CC as C,DC as w,LS as T,Nx as E,OC as ee,RS as D,SC as O,Sy as k,WC as A,ZC as j,by as te,eC as M,my as ne,nw as N,tC as P,zS as re}from"./loadAgentsDir-D-xcJ22-.js";import{D as ie,O as ae}from"./rcDebugLog-CTOZ2K3E.js";import{t as F}from"./useKeybinding-FsOnjW6T.js";import{i as oe,n as I,r as se}from"./MCPConnectionManager-D2eAGUME.js";import{n as ce,t as le}from"./McpParsingWarnings-BYPXpmte.js";import{a as ue,c as L,i as de,l as fe,n as pe,o as me,r as he,s as ge,t as _e,u as ve}from"./PluginSettings-h9Lj0vW6.js";function ye({agentServer:e,onCancel:t,onComplete:n}){let[a]=o(),[d,f]=(0,R.useState)(!1),[g,v]=(0,R.useState)(null),[y,b]=(0,R.useState)(null),x=(0,R.useRef)(null);(0,R.useEffect)(()=>()=>x.current?.abort(),[]),p(`confirm:no`,(0,R.useCallback)(()=>{d&&(x.current?.abort(),x.current=null,f(!1),b(null))},[d]),{context:`Confirmation`,isActive:d});let S=(0,R.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;f(!0),v(null);let t=new AbortController;x.current=t;try{let r={type:e.transport,url:e.url};await ee(e.name,r,b,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof O)&&v(e.message)}finally{f(!1),x.current=null}},[e,n]),C=_(String(e.name));if(d)return(0,z.jsxs)(h,{flexDirection:`column`,gap:1,padding:1,children:[(0,z.jsxs)(s,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(te,{}),(0,z.jsx)(s,{children:` A browser window will open for authentication`})]}),y&&(0,z.jsxs)(h,{flexDirection:`column`,children:[(0,z.jsx)(s,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,z.jsx)(i,{url:y})]}),(0,z.jsx)(h,{marginLeft:3,children:(0,z.jsxs)(s,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,z.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let w=[];return e.needsAuth&&w.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),w.push({label:`Back`,value:`back`}),(0,z.jsxs)(c,{title:`${C} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,z.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,z.jsxs)(u,{children:[(0,z.jsx)(l,{shortcut:`↑↓`,action:`navigate`}),(0,z.jsx)(l,{shortcut:`Enter`,action:`confirm`}),(0,z.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,z.jsxs)(h,{flexDirection:`column`,gap:0,children:[(0,z.jsxs)(h,{children:[(0,z.jsx)(s,{bold:!0,children:`Type: `}),(0,z.jsx)(s,{dimColor:!0,children:e.transport})]}),e.url&&(0,z.jsxs)(h,{children:[(0,z.jsx)(s,{bold:!0,children:`URL: `}),(0,z.jsx)(s,{dimColor:!0,children:e.url})]}),e.command&&(0,z.jsxs)(h,{children:[(0,z.jsx)(s,{bold:!0,children:`Command: `}),(0,z.jsx)(s,{dimColor:!0,children:e.command})]}),(0,z.jsxs)(h,{children:[(0,z.jsx)(s,{bold:!0,children:`Used by: `}),(0,z.jsx)(s,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,z.jsxs)(h,{marginTop:1,children:[(0,z.jsx)(s,{bold:!0,children:`Status: `}),(0,z.jsxs)(s,{children:[m(`inactive`,a)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,z.jsxs)(h,{children:[(0,z.jsx)(s,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,z.jsxs)(s,{children:[m(`success`,a)(r.tick),` authenticated`]}):(0,z.jsxs)(s,{children:[m(`warning`,a)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,z.jsx)(h,{children:(0,z.jsx)(s,{dimColor:!0,children:`This server connects only when running the agent.`})}),g&&(0,z.jsx)(h,{children:(0,z.jsxs)(s,{color:`error`,children:[`Error: `,g]})}),(0,z.jsx)(h,{children:(0,z.jsx)(E,{options:w,onChange:async e=>{switch(e){case`auth`:await S();break;case`back`:t();break}},onCancel:t})})]})}var R,z,B=e((()=>{n(),R=t(a(),1),f(),F(),w(),y(),P(),ne(),k(),z=g()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:A(e)};case`user`:return{label:`User MCPs`,path:A(e)};case`local`:return{label:`Local MCPs`,path:A(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function be(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function xe({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:a,onComplete:f}){let[p]=o(),[g,_]=(0,H.useState)(0),y=H.useMemo(()=>be(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),x=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),S=H.useMemo(()=>(y.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[y]),C=V(`dynamic`),w=H.useMemo(()=>{let e=[];for(let t of W){let n=y.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of x)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of S)e.push({type:`server`,server:t});return e},[y,x,t,S]),T=(0,H.useCallback)(()=>{f(`MCP dialog dismissed`,{display:`system`})},[f]);d({"confirm:previous":()=>_(e=>e===0?w.length-1:e-1),"confirm:next":()=>_(e=>e===w.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=w[g];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&a&&a(e.agentServer))},[w,g,n,a]),"confirm:no":T},{context:`Confirmation`});let E=e=>w.findIndex(t=>t.type===`server`&&t.server===e),ee=e=>w.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),D=b(),O=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let k=e=>{let t=E(e),n=g===t,i=``,a=``;if(e.client.type===`disabled`)i=m(`inactive`,p)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=m(`success`,p)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=m(`inactive`,p)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=m(`warning`,p)(r.triangleUpOutline),a=`needs authentication`):(i=m(`error`,p)(r.cross),a=`failed`);return(0,U.jsxs)(h,{children:[(0,U.jsx)(s,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(s,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(s,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(s,{dimColor:!n,children:a})]},`${e.name}-${t}`)},A=e=>{let t=ee(e),n=g===t,i=e.needsAuth?m(`warning`,p)(r.triangleUpOutline):m(`inactive`,p)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(h,{children:[(0,U.jsx)(s,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(s,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(s,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(s,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},j=e.length+t.length;return(0,U.jsxs)(h,{flexDirection:`column`,children:[(0,U.jsx)(le,{}),(0,U.jsx)(c,{title:`Manage MCP servers`,subtitle:`${j} ${v(j,`server`)}`,onCancel:T,hideInputGuide:!0,children:(0,U.jsxs)(h,{flexDirection:`column`,children:[W.map(e=>{let t=y.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(h,{paddingLeft:2,children:[(0,U.jsx)(s,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(s,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>k(e))]},e)}),x.length>0&&(0,U.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(h,{paddingLeft:2,children:(0,U.jsx)(s,{bold:!0,children:`claude.ai`})}),x.map(e=>k(e))]}),t.length>0&&(0,U.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(h,{paddingLeft:2,children:(0,U.jsx)(s,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(h,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(h,{paddingLeft:2,children:(0,U.jsxs)(s,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>A(e))]},e))]}),S.length>0&&(0,U.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(h,{paddingLeft:2,children:[(0,U.jsx)(s,{bold:!0,children:C.label}),C.path&&(0,U.jsxs)(s,{dimColor:!0,children:[` (`,C.path,`)`]})]}),S.map(e=>k(e))]}),(0,U.jsxs)(h,{flexDirection:`column`,children:[O&&(0,U.jsx)(s,{dimColor:!0,children:D?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(s,{dimColor:!0,children:[(0,U.jsx)(i,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(h,{paddingX:1,children:(0,U.jsx)(s,{dimColor:!0,italic:!0,children:(0,U.jsxs)(u,{children:[(0,U.jsx)(l,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(l,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(M,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(a(),1),f(),F(),N(),x(),y(),P(),ce(),U=g(),W=[`project`,`local`,`user`,`enterprise`]}));function Se({serverName:e,onComplete:t}){let[n]=o(),i=re(),a=se(),[c,l]=(0,K.useState)(!0),[u,d]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){d(`MCP server "${e}" not found`),l(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:l(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:d(`${e} requires authentication`),l(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:d(`Failed to reconnect to ${e}`),l(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);d(n),l(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),c?(0,q.jsxs)(h,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(s,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(s,{bold:!0,children:e})]}),(0,q.jsxs)(h,{children:[(0,q.jsx)(te,{}),(0,q.jsx)(s,{children:` Establishing connection to MCP server`})]})]}):u?(0,q.jsxs)(h,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(h,{children:[(0,q.jsxs)(s,{children:[m(`error`,n)(r.cross),` `]}),(0,q.jsxs)(s,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(s,{dimColor:!0,children:[`Error: `,u]})]}):null}var K,q,J=e((()=>{n(),K=t(a(),1),f(),I(),T(),k(),q=g()}));function Y({onComplete:e}){let t=D(e=>e.mcp),n=D(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>j(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;if(r||i){let n=await new C(e.name,e.config).tokens(),r=ie()!==null&&e.type===`connected`,i=e.type===`connected`&&S(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.claude.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(xe,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=S(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Claude Code`;return i.server.transport===`stdio`?(0,Z.jsx)(ge,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(fe,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(he,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=S(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(ue,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(ye,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,Ce=e((()=>{X=t(a(),1),w(),N(),T(),ae(),B(),G(),ve(),L(),me(),de(),Z=g()})),we=e((()=>{B(),G(),J(),ve(),Ce(),L(),me(),de()}));function Te({action:e,target:t,onComplete:n}){let r=D(e=>e.mcp.clients),i=oe(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function Ee(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(Se,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Te,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return process.env.USER_TYPE===`ant`?(0,$.jsx)(_e,{onComplete:e,args:`manage`,showMcpRedirectMessage:!0}):(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(a(),1),we(),J(),I(),T(),pe(),$=g()}))();export{Ee as call};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{B as e,M as t,d as n,n as r,t as i}from"./server-DzOdtq8A.js";import{Dr as a,Pr as o}from"./paths-D9CVAtXU.js";import{E as s,w as c}from"./debug-UI3T040K.js";import{o as l,s as u}from"./log-CzsijfHZ.js";import{G as d,Hm as f,JE as p,K as m,Ku as h,Lo as g,Na as _,OD as v,Pa as y,Vm as b,YE as x,kD as S,lo as C,nl as w,ou as T,qu as E,su as D,tl as O}from"./loadAgentsDir-D-xcJ22-.js";import{Bn as k,Vn as A,zn as j}from"./prompt-C69iv9cI.js";import{a as M,o as N}from"./fileStateCache-C7-TxF8G.js";import{n as P,t as F}from"./stdio-BEEzuxaZ.js";r(),P(),e(),x(),_(),A(),E(),S(),N(),l(),g(),o(),m(),b(),c(),D(),O();var I=[y];async function L(e,r,o){let c=M(100);f(e);let l=new i({name:`claude/tengu`,version:`2.6.11`},{capabilities:{tools:{}}});l.setRequestHandler(t,async()=>{let e=k(),t=h(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=w(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:w(n.inputSchema),outputSchema:r}}))}}),l.setRequestHandler(n,async({params:{name:e,arguments:t}})=>{let n=h(k()),i=j(n,e);if(!i)throw Error(`Tool ${e} not found`);let l={abortController:v(),options:{commands:I,tools:n,mainLoopModel:a(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:r,verbose:o,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>p(),setAppState:()=>{},messages:[],readFileState:c,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!i.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await i.validateInput?.(t??{},l);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${n.message}`);let r=await i.call(t??{},l,d,C({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:s(r.data)}]}}catch(e){return u(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?T(e):[String(e)]).filter(Boolean).join(`
|
|
2
|
-
`).trim()||`Error`}]}}});async function m(){let e=new F;await l.connect(e)}return await m()}export{L as startMCPServer};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{In as i,Ln as a,Q as o,Rn as s,b as c,d as l,f as u,t as d,tt as f,x as p}from"./src-Di342QoJ.js";import{t as m}from"./jsx-runtime-D-D469L8.js";import{cn as h,ot as g}from"./state-sIHsFpDu.js";import{Zc as ee,a as _,el as v,lo as y,n as te,oo as b,s as x}from"./paths-D9CVAtXU.js";import{R as S,V as C}from"./debug-UI3T040K.js";import{n as w,r as T}from"./analytics-DqMQntaB.js";import{n as E,t as D}from"./cwd--iizewsn.js";import{r as O,v as k}from"./git-CN3qtTb_.js";import{o as A,s as j}from"./log-CzsijfHZ.js";import{g as M,x as N}from"./startupProfiler-DnXZaX4A.js";import{Dk as P,Hn as ne,LS as F,Nx as re,RS as I,Sk as L,Tk as R,Wn as z,eu as B,lp as ie,my as ae,tu as oe,up as se}from"./loadAgentsDir-D-xcJ22-.js";import{r as ce,t as le}from"./browser-fLRXxIsQ.js";import{t as V}from"./useKeybinding-FsOnjW6T.js";import{l as H,u as U}from"./referral-D26orIXE.js";import{r as ue,t as de}from"./promptEditor-BZqpLrcZ.js";import{homedir as fe}from"os";import{join as W,relative as pe}from"path";import{mkdir as G,writeFile as me}from"fs/promises";function he(e){return O(e)!==null}var ge=e((()=>{k()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(R()),a=W(n(),`CLAUDE.md`),o=W(g(),`CLAUDE.md`),s=r.some(e=>e.path===a),u=r.some(e=>e.path===o),d=[...r.filter(e=>e.type!==`AutoMem`&&e.type!==`TeamMem`).map(e=>({...e,exists:!0})),...s?[]:[{path:a,type:`User`,content:``,exists:!1}],...u?[]:[{path:o,type:`Project`,content:``,exists:!1}]],m=new Map,h=d.map(e=>{let t=ee(e.path),n=e.exists?``:` (new)`,r=e.parent?(m.get(e.parent)??0)+1:0;m.set(e.path,r);let i=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===a?`User memory`:e.type===`Project`&&!e.isNested&&e.path===o?`Project memory`:r>0?`${i}L ${t}${n}`:`${t}`;let c,l=he(g());return c=e.type===`User`&&!e.isNested?`Saved in ~/.claude/CLAUDE.md`:e.type===`Project`&&!e.isNested&&e.path===o?`${l?`Checked in at`:`Saved in`} ./CLAUDE.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),_=[],v=I(e=>e.agentDefinitions);if(x()){_.push({label:`Open auto-memory folder`,value:`${Y}${te()}`,description:``});for(let e of v.activeAgents)if(e.memory){let t=ne(e.agentType,e.memory);_.push({label:`Open ${i.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}h.push(..._);let b=J&&h.some(e=>e.value===J)?J:h[0]?.value||``,[S,C]=(0,K.useState)(x),[w,E]=(0,K.useState)(oe),[D]=(0,K.useState)(x),O=I(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{D&&se().then(A)},[D,O]);let j=O?`running`:k===null?``:k===0?`never`:`last ran ${M(new Date(k))}`,[N,P]=(0,K.useState)(null),F=N!==null,L=+!!D;function z(){let e=!S;y(`userSettings`,{autoMemoryEnabled:e}),C(e),T(`tengu_auto_memory_toggled`,{enabled:e})}function B(){let e=!w;y(`userSettings`,{autoDreamEnabled:e}),E(e),T(`tengu_auto_dream_toggled`,{enabled:e})}return U(),f(`confirm:no`,t,{context:`Confirmation`}),f(`confirm:yes`,()=>{N===0?z():N===1&&B()},{context:`Confirmation`,isActive:F}),f(`select:next`,()=>{P(e=>e!==null&&e<L?e+1:null)},{context:`Select`,isActive:F}),f(`select:previous`,()=>{P(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:F}),(0,q.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(p,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(l,{isFocused:N===0,children:(0,q.jsxs)(c,{children:[`Auto-memory: `,S?`on`:`off`]})}),D&&(0,q.jsx)(l,{isFocused:N===1,styled:!1,children:(0,q.jsxs)(c,{color:N===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(c,{dimColor:!0,children:[` · `,j]}),!O&&w&&(0,q.jsx)(c,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(re,{defaultFocusValue:b,options:h,isDisabled:F,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ce(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>P(L)})]})}var K,q,J,Y,X=e((()=>{a(),s(),K=t(s(),1),h(),H(),d(),V(),_(),w(),B(),ie(),F(),z(),le(),P(),r(),v(),N(),ge(),b(),ae(),q=m(),Y=`__open_folder__`}));function ve(e){let t=fe(),n=D(),r=e.startsWith(t)?`~`+e.slice(t.length):null,i=e.startsWith(n)?`./`+pe(n,e):null;return r&&i?r.length<=i.length?r:i:r||i||e}var ye=e((()=>{s(),d(),E(),m()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await me(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(S(e)!==`EEXIST`)throw e}await de(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r===`default`?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${ve(t)}\n\n${o}`,{display:`system`})}catch(t){j(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(u,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(p,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(p,{marginTop:1,children:(0,Q.jsxs)(c,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(o,{url:`https://code.claude.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(s(),1),d(),X(),ye(),P(),r(),C(),A(),ue(),Q=m(),$=async e=>(L(),await R(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Dr as e,Pr as t}from"./paths-D9CVAtXU.js";t();export{e as getMainLoopModel};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{F as i,In as a,J as o,Ln as s,Rn as c,Ut as l,_ as u,a as d,b as f,f as p,i as m,n as h,o as g,p as ee,r as te,t as _,tt as ne,x as v,xt as y}from"./src-Di342QoJ.js";import{t as b}from"./jsx-runtime-D-D469L8.js";import{cn as re,ot as x}from"./state-sIHsFpDu.js";import{Bo as S,Po as C,Ro as w,Vo as T,Xa as E,Xs as D,jo as O,nc as k,oo as A}from"./paths-D9CVAtXU.js";import{E as j,w as M}from"./debug-UI3T040K.js";import{BS as ie,Bx as ae,H as oe,K as se,LS as N,Lo as ce,Nx as P,Px as F,RS as le,U as ue,Uw as I,V as de,W as fe,dD as pe,hp as me,hu as L,mo as he,mp as R,mu as z,oD as B,q as ge,sA as _e,uA as ve,uD as V,zx as ye}from"./loadAgentsDir-D-xcJ22-.js";import{t as be}from"./useKeybinding-FsOnjW6T.js";import{l as xe,u as Se}from"./referral-D26orIXE.js";import{n as Ce,t as we}from"./AddWorkspaceDirectory-CGKtPsTK.js";import{t as Te}from"./SearchBox-DfOmUoaI.js";import{n as Ee,t as De}from"./useSearchInput-DNpNG36H.js";import{n as H,t as Oe}from"./shadowedRuleDetection-CwMwv9uM.js";import{n as ke,t as Ae}from"./autoModeDenials-Cp6VFdsm.js";function je({ruleValue:e}){switch(e.toolName){case z.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,U.jsxs)(f,{dimColor:!0,children:[`Any Bash command starting with `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,U.jsxs)(f,{dimColor:!0,children:[`The Bash command `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent})]}):(0,U.jsx)(f,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,U.jsxs)(f,{dimColor:!0,children:[`Any use of the `,(0,U.jsx)(f,{bold:!0,children:e.toolName}),` tool`]})}}var U,Me=e((()=>{c(),_(),L(),U=b()}));function Ne(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${E(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${E(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function Pe({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=D.map(Ne),s=(0,Fe.useCallback)(o=>{if(o===`cancel`){t();return}else if(D.includes(o)){let t=o,s=B(i,{type:`addRules`,rules:n,behavior:r,destination:t});pe({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Oe(s,{sandboxAutoAllowEnabled:_e.isSandboxingEnabled()&&_e.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,W.jsxs)(p,{title:`Add ${r} permission ${C(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,W.jsx)(v,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,W.jsxs)(v,{flexDirection:`column`,children:[(0,W.jsx)(f,{bold:!0,children:T(e)}),(0,W.jsx)(je,{ruleValue:e})]},T(e)))}),(0,W.jsxs)(v,{flexDirection:`column`,marginY:1,children:[(0,W.jsx)(f,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,W.jsx)(P,{options:o,onChange:s})]})]})}var Fe,W,Ie=e((()=>{c(),Fe=t(c(),1),F(),_(),V(),w(),H(),ve(),k(),A(),O(),Me(),W=b()}));function Le({onCancel:e,onSubmit:t,ruleBehavior:n}){let[a,s]=(0,Re.useState)(``),[c,l]=(0,Re.useState)(0),u=Se();ne(`confirm:no`,e,{context:`Settings`});let{columns:d}=i(),p=d-6;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,G.jsxs)(f,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,G.jsxs)(v,{flexDirection:`column`,children:[(0,G.jsxs)(f,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,G.jsx)(o,{}),`e.g., `,(0,G.jsx)(f,{bold:!0,children:T({toolName:R.name})}),(0,G.jsx)(f,{bold:!1,children:` or `}),(0,G.jsx)(f,{bold:!0,children:T({toolName:z.name,ruleContent:`ls:*`})})]}),(0,G.jsx)(v,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,G.jsx)(ye,{showCursor:!0,value:a,onChange:s,onSubmit:e=>{let r=e.trim();r.length!==0&&t(S(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:c,onChangeCursorOffset:l})})]})]}),(0,G.jsx)(v,{marginLeft:3,children:u.pending?(0,G.jsxs)(f,{dimColor:!0,children:[`Press `,u.keyName,` again to exit`]}):(0,G.jsx)(f,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Re,G,ze=e((()=>{n(),c(),Re=t(c(),1),ae(),xe(),I(),_(),be(),L(),me(),w(),G=b()}));function Be({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=m();(0,K.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,K.useState)(()=>Ae()),[a,o]=(0,K.useState)(()=>new Set),[s,c]=(0,K.useState)(()=>new Set),[l,u]=(0,K.useState)(0);(0,K.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,K.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),p=(0,K.useCallback)(e=>{u(Number(e))},[]);if(y((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,q.jsx)(f,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let h=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,q.jsxs)(f,{children:[(0,q.jsx)(g,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,q.jsx)(f,{dimColor:!0,children:r})]}),value:String(t)}});return(0,q.jsxs)(v,{flexDirection:`column`,children:[(0,q.jsx)(f,{children:`Commands recently denied by the auto mode classifier.`}),(0,q.jsx)(v,{marginTop:1,children:(0,q.jsx)(P,{options:h,onChange:d,onFocus:p,visibleOptionCount:Math.min(10,h.length),isDisabled:n,onUpFromFirstItem:r})})]})}var K,q,Ve=e((()=>{c(),K=t(c(),1),_(),ke(),F(),q=b()}));function He({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,J.useCallback)(()=>{i(B(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,J.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(p,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(v,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(f,{bold:!0,children:e})}),(0,Y.jsx)(f,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(P,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var J,Y,Ue=e((()=>{c(),J=t(c(),1),F(),_(),V(),Y=b()}));function We({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=m();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=Ge.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ge.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(v,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(v,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(f,{children:`- ${x()}`}),(0,Z.jsx)(f,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(P,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var Ge,X,Z,Ke=e((()=>{n(),Ge=t(c(),1),X=t(c(),1),re(),F(),_(),Z=b()}));function qe({rule:e}){return(0,$.jsx)(f,{dimColor:!0,children:`From ${ge(e.source)}`})}function Je(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Ye({rule:e,onDelete:t,onCancel:n}){let r=Se();ne(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(v,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(f,{bold:!0,children:T(e.ruleValue)}),(0,$.jsx)(je,{ruleValue:e.ruleValue}),(0,$.jsx)(qe,{rule:e})]}),a=(0,$.jsx)(v,{marginLeft:3,children:r.pending?(0,$.jsxs)(f,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(f,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(f,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(f,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
|
|
2
|
-
`,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(f,{bold:!0,color:`error`,children:[`Delete `,Je(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(f,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(P,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Xe(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,f=d(),{headerFocused:p,focusHeader:h,blurHeader:g}=m();return(0,Q.useEffect)(()=>{r&&p&&g()},[r,p,g]),(0,Q.useEffect)(()=>{l?.(p)},[p,l]),(0,$.jsxs)(v,{flexDirection:`column`,children:[(0,$.jsx)(v,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(u,{query:n,isFocused:r&&!p,isTerminalFocused:i,width:f,cursorOffset:c})}),(0,$.jsx)(P,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||p,defaultFocusValue:s,onUpFromFirstItem:h})]})}function Ze({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(v,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(f,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Xe,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Qe({onExit:e,initialTab:t,onRetryDenials:n}){let i=Ae().length>0,o=t??(i?`recent`:`allow`),[s,c]=(0,Q.useState)([]),u=le(e=>e.toolPermissionContext),d=ie(),p=l(),m=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),g=(0,Q.useCallback)(e=>{m.current=e},[]),[_,y]=(0,Q.useState)(),[b,re]=(0,Q.useState)(),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[A,M]=(0,Q.useState)(!1),[ae,se]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{se(e)},[]),ce=(0,Q.useMemo)(()=>{let e=new Map;return oe(u).forEach(t=>{e.set(j(t),t)}),e},[u]),P=(0,Q.useMemo)(()=>{let e=new Map;return fe(u).forEach(t=>{e.set(j(t),t)}),e},[u]),F=(0,Q.useMemo)(()=>{let e=new Map;return ue(u).forEach(t=>{e.set(j(t),t)}),e},[u]),I=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return ce;case`deny`:return P;case`ask`:return F;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=T(r.ruleValue).toLowerCase(),t=T(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=T(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[ce,P,F]),me=Se(),L=!_&&!x&&!C&&!E&&!O,{query:he,setQuery:R,cursorOffset:z}=Ee({isActive:L&&A,onExit:()=>{M(!1)}}),ge=(0,Q.useCallback)(e=>{L&&(A||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),M(!0),R(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),M(!0),R(e.key))))},[L,A,R]),_e=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=I(t);if(e===`add-new-rule`){S(t);return}else{y(n.get(e));return}},[I]),ve=(0,Q.useCallback)(()=>{S(null)},[]),V=(0,Q.useCallback)((e,t)=>{w({ruleValue:e,ruleBehavior:t}),S(null)},[]),ye=(0,Q.useCallback)((e,t)=>{w(null);for(let t of e)c(e=>[...e,`Added ${t.ruleBehavior} rule ${a.bold(T(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;c(n=>[...n,a.yellow(`${r.warning} Warning: ${T(e.rule.ruleValue)} is ${t}`),a.dim(` ${e.reason}`),a.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{w(null)},[]),xe=(0,Q.useCallback)(()=>D(!0),[]),Ce=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=m.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let o=r(t.approved);o.length>0||s.length>0?e([...o.length>0?[`Approved ${o.map(e=>a.bold(e.display)).join(`, `)}`]:[],...s].join(`
|
|
3
|
-
`)):e(`Permissions dialog dismissed`,{display:`system`})},[s,e,n]);ne(`confirm:no`,Te,{context:`Settings`,isActive:L&&!A});let De=()=>{if(!_)return;let{options:e}=I(_.ruleBehavior),t=j(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),de({rule:_,initialContext:u,setToolPermissionContext(e){d(t=>({...t,toolPermissionContext:e}))}}),c(e=>[...e,`Deleted ${_.ruleBehavior} rule ${a.bold(T(_.ruleValue))}`]),y(void 0)};if(_)return(0,$.jsx)(Ye,{rule:_,onDelete:De,onCancel:()=>y(void 0)});if(x&&x!==`workspace`&&x!==`recent`)return(0,$.jsx)(Le,{onCancel:ve,onSubmit:V,ruleBehavior:x});if(C)return(0,$.jsx)(Pe,{onAddRules:ye,onCancel:be,ruleValues:[C.ruleValue],ruleBehavior:C.ruleBehavior,initialContext:u,setToolPermissionContext:e=>{d(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(we,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=B(u,n);d(e=>({...e,toolPermissionContext:r})),t&&pe(n),c(n=>[...n,`Added directory ${a.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:u});if(O)return(0,$.jsx)(He,{directoryPath:O,onRemove:()=>{c(e=>[...e,`Removed directory ${a.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:u,setPermissionContext:e=>{d(t=>({...t,toolPermissionContext:e}))}});let H={searchQuery:he,isSearchMode:A,isFocused:p,onCancel:Te,lastFocusedRuleKey:b,cursorOffset:z,getRulesOptions:I,handleToolSelect:_e,onHeaderFocusChange:N};return(0,$.jsx)(v,{flexDirection:`column`,onKeyDown:ge,children:(0,$.jsxs)(ee,{color:`permission`,children:[(0,$.jsxs)(te,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!_||!!x||!!C||E||!!O,initialHeaderFocused:!i,navFromContent:!A,children:[(0,$.jsx)(h,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Be,{onHeaderFocusChange:N,onStateChange:g})}),(0,$.jsx)(h,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ze,{tab:`allow`,...H})}),(0,$.jsx)(h,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ze,{tab:`ask`,...H})}),(0,$.jsx)(h,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ze,{tab:`deny`,...H})}),(0,$.jsx)(h,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(v,{flexDirection:`column`,children:[(0,$.jsx)(f,{children:`Claude Code can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(We,{onExit:e,toolPermissionContext:u,onRequestAddDirectory:xe,onRequestRemoveDirectory:Ce,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(v,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(f,{dimColor:!0,children:me.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,me.keyName,` again to exit`]}):ae?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):A?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):i&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,$e=e((()=>{s(),n(),c(),Q=t(c(),1),N(),V(),F(),xe(),De(),_(),be(),ke(),w(),se(),M(),Te(),Ie(),Ce(),Me(),ze(),Ve(),Ue(),Ke(),$=b()})),et,tt;e((()=>{$e(),ce(),et=b(),tt=async(e,t)=>(0,et.jsx)(Qe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,he(e)])}})}))();export{tt as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{L as e,V as t,d as n,s as r}from"./debug-UI3T040K.js";import{Es as i,Ms as a,Rs as o,Us as s,Vs as c}from"./loadAgentsDir-D-xcJ22-.js";import{d as l,s as u}from"./pluginOperations-CP6NFNog.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-Dpu1cvMo.js";u(),r(),t(),i(),c(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let t=a(),r=f(),i=await s(),c=[];for(let a of Object.keys(i))try{let i=await o(a);if(!i.forceRemoveDeletedPlugins)continue;let s=h(t,i,a);for(let i of s){if(i in r)continue;let a=t.plugins[i]??[];if(a.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let t of a){let{scope:r}=t;if(!(r!==`user`&&r!==`project`&&r!==`local`))try{await l(i,r)}catch(t){n(`Failed to auto-uninstall delisted plugin ${i} from ${r}: ${e(t)}`,{level:`error`})}}await m(i),c.push(i)}}}catch(t){n(`Failed to check for delisted plugins in "${a}": ${e(t)}`,{level:`warn`})}return c}export{g as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{Po as r,Qa as i,jo as a,lo as o,oo as s}from"./paths-D9CVAtXU.js";import{K as c,U as l,V as u,h as d,p as f}from"./debug-UI3T040K.js";import{o as p,s as m}from"./log-CzsijfHZ.js";import{Bs as h,Cs as g,Es as _,FA as v,Hs as y,IA as b,Ms as x,Ns as ee,Nw as S,PA as C,Ps as w,Rs as T,Ss as E,Vs as te,_s as ne,aA as D,bs as O,dc as k,ds as A,fs as re,hs as ie,js as j,jw as ae,lc as M,ls as oe,nh as se,ps as N,rh as ce,ss as P,tA as F,uc as I,us as L,vs as R}from"./loadAgentsDir-D-xcJ22-.js";import{i as z,m as B,o as V,p as H,s as U}from"./xml-K_hNNh2b.js";import{n as W,t as G}from"./pluginStartupCheck-DvWHwNnD.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return i(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let r=i(U(n))?.enabledPlugins;if(r){for(let i of Object.keys(r))if(t?i===e:i.startsWith(`${e}@`))return{pluginId:i,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=V(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=V(e),n=x();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=V(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=x().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=V(e),i,a,o;if(r){let t=await h(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await y();for(let[t,r]of Object.entries(e))try{let e=(await T(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){m(c(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let s=i,l=`${s.name}@${a}`,u=await O({pluginId:l,entry:s,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:ne(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:s.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:r,disabled:a}=await N(),s=[...r,...a],c=pe(e,s),l=U(t),u=i(l),d,f;if(c)d=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===c.name||t.startsWith(`${c.name}@`))??(e.includes(`@`)?e:c.name),f=c.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};d=t.pluginId,f=t.pluginName}let p=J(t),m=x().plugins[d],h=m?.find(e=>e.scope===t&&e.projectPath===p);if(!h){let{scope:n}=Y(d);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let g=h.installPath,_={...u?.enabledPlugins};_[d]=void 0,o(l,{enabledPlugins:_}),M(),ee(d,t,p);let y=x().plugins[d],b=!y||y.length===0;b&&g&&await k(g),b&&(ae(d),n&&await F(d));let S=C(d,s),w=v(S);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${w}`,pluginId:d,pluginName:f,scope:t,reverseDependents:S.length>0?S:void 0}}async function X(e,t,n){let r=t?`enable`:`disable`;if(B(e)){let{error:n}=o(`userSettings`,{enabledPlugins:{...i(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${r} built-in plugin: ${n.message}`};M();let{name:a}=V(e);return{success:!0,message:`Successfully ${r}d built-in plugin: ${a}`,pluginId:e,pluginName:a,scope:`user`}}n&&q(n);let a,s,c=fe(e);if(n)if(s=n,c)a=c.pluginId;else if(e.includes(`@`))a=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)a=c.pluginId,s=c.scope;else if(e.includes(`@`))a=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&ce(a))return{success:!1,message:`Plugin "${a}" is blocked by your organization's policy and cannot be enabled`};let l=U(s),u=i(l)?.enabledPlugins?.[a],d={user:0,project:1,local:2},f=n&&c&&d[n]>d[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!f)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!f?u===!0:G().has(a)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let p;if(!t){let{enabled:e,disabled:t}=await N(),n=C(a,[...e,...t]);n.length>0&&(p=n)}let{error:m}=o(l,{enabledPlugins:{...i(l)?.enabledPlugins,[a]:t}});if(m)return{success:!1,message:`Failed to ${r} plugin: ${m.message}`};M();let{name:h}=V(a),g=v(p);return{success:!0,message:`Successfully ${r}d plugin: ${h} (scope: ${s})${g}`,pluginId:a,pluginName:h,scope:s,reverseDependents:p}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${r(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
|
|
2
|
-
`)}`}:{success:!0,message:`Disabled ${t.length} ${r(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=V(e),i=r?`${n}@${r}`:e,a=await h(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=j().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:o}){let s=f(),c=i.version,u,d,p=!1,m;if(typeof n.source!=`string`){let t=await P(n.source,{manifest:{name:n.name}});u=t.path,p=!0,m=t.gitCommitSha,d=await E(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await s.stat(r)}catch(t){if(l(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}u=K(t.isDirectory()?r:le(r),n.source);try{await s.stat(u)}catch(t){if(l(t))return{success:!1,message:`Plugin source not found at ${u}`,pluginId:e,scope:a};throw t}let i,o=K(u,`.claude-plugin`,`plugin.json`);try{i=await ie(o,n.name,n.source)}catch{}d=await E(e,n.source,i,u,n.version)}try{let r=L(e,d),s=A(e,d);if(i.version===d||i.installPath===r||i.installPath===s)return{success:!0,message:`${t} is already at the latest version (${d}).`,pluginId:e,newVersion:d,oldVersion:c,alreadyUpToDate:!0,scope:a};r=await oe(u,e,d,n);let l=i.installPath;if(w(e,a,o,r,d,m),l&&l!==r){let e=j();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===l))||await k(l)}let f=o?`${a} (${o})`:a;return{success:!0,message:`Plugin "${t}" updated from ${c||`unknown`} to ${d} for scope ${f}. Restart to apply changes.`,pluginId:e,newVersion:d,oldVersion:c,scope:a}}finally{p&&u!==L(e,d)&&await s.rm(u,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),H(),u(),d(),p(),I(),b(),_(),te(),D(),z(),R(),re(),S(),se(),W(),g(),s(),a(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./pluginStartupCheck-DvWHwNnD.js";e();export{t as getPluginEditableScopes};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./figures-gfT9mM8P.js";import{Or as n,cn as r}from"./state-sIHsFpDu.js";import{Po as i,jo as a}from"./paths-D9CVAtXU.js";import{E as o,L as s,V as c,w as l}from"./debug-UI3T040K.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{o as f,s as p}from"./log-CzsijfHZ.js";import{$s as m,As as h,Aw as g,BA as _,Es as v,Fs as y,Gs as b,Hs as x,Ms as S,Vs as C,Ws as w,Ys as T,ac as ee,fs as te,kw as ne,lc as E,ps as D,qs as O,sc as k,uc as A,zA as j}from"./loadAgentsDir-D-xcJ22-.js";import{i as M,o as N,s as P}from"./xml-K_hNNh2b.js";import{n as F,t as I}from"./exit-_obETqBv.js";import{n as L,t as R}from"./pluginOperations-CP6NFNog.js";import{a as z,i as B,n as V,o as H,r as U,t as W}from"./pluginCliCommands-BN7loc5T.js";import{a as re,c as G,i as K,n as q,r as J,s as Y,t as X}from"./validatePlugin-_Z4zhjSx.js";import{basename as ie,dirname as Z}from"path";e(),r(),u(),_(),c(),f(),A(),G(),v(),ee(),C(),ne(),K(),M(),te(),X(),l(),a();function Q(e,n){p(e),I(`${t.cross} Failed to ${n}: ${s(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${i(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${i(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function ae(e,r){r.cowork&&n(!0);try{let n=await q(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ie(e)===`.claude-plugin`){r=await J(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){p(e),console.error(`${t.cross} Unexpected error during validation: ${s(e)}`),process.exit(2)}}async function oe(e){e.cowork&&n(!0),d(`tengu_plugin_list_command`,{});let r=S(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-BF0xUEJG.js`),a=i(),s=Object.keys(r.plugins),{enabled:c,disabled:l,errors:u}=await D(),f=[...c,...l],p=f.filter(e=>e.source.endsWith(`@inline`)),_=u.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(f.map(e=>[e.source,e])),n=[];for(let e of s.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let o=N(e).name,s=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===o).map(j);for(let r of i){let i=t.get(e),o;if(i){let e=i.mcpServers||await g(i);e&&Object.keys(e).length>0&&(o=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:a.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:o,errors:s.length>0?s:void 0})}}for(let e of p){let t=e.mcpServers||await g(e),r=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(j);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[j(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([x(),Y()]),{marketplaces:r}=await k(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=m(r.name,t);h(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}F(o({installed:n,available:e},null,2))}else F(o(n,null,2))}s.length===0&&p.length===0&&_.length===0&&F("No plugins installed. Use `claude plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
|
|
2
|
-
`);for(let e of s.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=N(e).name,o=u.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=a.has(e),i=o.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,s=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${s}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of o)console.log(` Error: ${j(e)}`);console.log(``)}}if(p.length>0||_.length>0){console.log(`Session-only plugins (--plugin-dir):
|
|
3
|
-
`);for(let e of p){let n=_.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${j(e)}`);console.log(``)}for(let e of _.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${j(e)}\n`)}F()}async function se(e,r){r.cowork&&n(!0);try{let n=await re(e);n||I(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in n&&I(`${t.cross} ${n.error}`);let i=r.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&I(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=P(i),o=n;r.sparse&&r.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:r.sparse}:I(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:s,alreadyMaterialized:c,resolvedSource:l}=await y(o,e=>{console.log(e)});T(s,{source:l},a),E();let u=o.source;o.source===`github`&&(u=o.repo),d(`tengu_marketplace_added`,{source_type:u}),F(c?`${t.tick} Marketplace '${s}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${s} (declared in ${i} settings)`)}catch(e){Q(e,`add marketplace`)}}async function ce(e){e.cowork&&n(!0);try{let n=await x(),r=Object.keys(n);e.json&&F(o(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&F(`No marketplaces configured`),console.log(`Configured marketplaces:
|
|
4
|
-
`),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),F()}catch(e){Q(e,`list marketplaces`)}}async function le(e,r){r.cowork&&n(!0);try{await O(e),E(),d(`tengu_marketplace_removed`,{marketplace_name:e}),F(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Q(e,`remove marketplace`)}}async function ue(e,r){r.cowork&&n(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await b(e,e=>{console.log(e)}),E(),d(`tengu_marketplace_updated`,{marketplace_name:e}),F(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await x(),n=Object.keys(e);n.length===0&&F(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await w(),E(),d(`tengu_marketplace_updated_all`,{count:n.length}),F(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Q(e,`update marketplace(s)`)}}async function de(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&I(`--cowork can only be used with user scope`),R.includes(r)||I(`Invalid scope: ${r}. Must be one of: ${R.join(`, `)}.`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_install_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r}),await B(e,r)}async function fe(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&I(`--cowork can only be used with user scope`),R.includes(r)||I(`Invalid scope: ${r}. Must be one of: ${R.join(`, `)}.`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_uninstall_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r}),await z(e,r,t.keepData)}async function pe(e,t){t.cowork&&n(!0);let r;t.scope&&(R.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${R.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_enable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r??`auto`}),await U(e,r)}async function me(e,t){if(t.all&&e&&I(`Cannot use --all with a specific plugin`),!t.all&&!e&&I(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&n(!0),t.all){t.scope&&I(`Cannot use --scope with --all`),d(`tengu_plugin_disable_command`,{}),await W();return}let r;t.scope&&(R.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${R.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=N(e);d(`tengu_plugin_disable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r??`auto`}),await V(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=N(e);d(`tengu_plugin_update_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i}});let a=`user`;t.scope&&(L.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),a=t.scope),t.cowork&&a!==`user`&&I(`--cowork can only be used with user scope`),await H(e,a)}export{se as marketplaceAddHandler,ce as marketplaceListHandler,le as marketplaceRemoveHandler,ue as marketplaceUpdateHandler,me as pluginDisableHandler,pe as pluginEnableHandler,de as pluginInstallHandler,oe as pluginListHandler,fe as pluginUninstallHandler,he as pluginUpdateHandler,ae as pluginValidateHandler};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Ba as e,Ka as t,Ra as n}from"./loadAgentsDir-D-xcJ22-.js";n();export{e as isPolicyAllowed,t as waitForPolicyLimitsToLoad};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./poorMode-D7WXWZtJ.js";t();export{e as isPoorModeActive};
|
|
@@ -1,39 +0,0 @@
|
|
|
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 ne,tr as re,tt as y,y as b}from"./state-sIHsFpDu.js";import{Aa as x,Br as S,Bt as ie,C as ae,Cr as oe,Dr as se,El as C,Et as ce,Fa as le,Ki as ue,Ma as w,Ml as de,Na as fe,Ot as T,Pr as E,Rr as pe,S as me,Si as he,Tl as ge,Xn as _e,Xo as D,Yn as O,_ as ve,a as ye,bl as be,c as xe,jl as Se,kt as Ce,ls as we,ms as Te,no as k,on as A,oo as Ee,pi as De,qi as Oe,ss as j,to as ke,vi as M,xi as Ae,xs as N,yi as je,yl as Me}from"./paths-D9CVAtXU.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-B3lx7yHn.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{$C as ut,$D as dt,$E as ft,$T as pt,$r as mt,AC as ht,Ar as gt,Av as _t,BD as vt,B_ as yt,Ba as bt,Cb as xt,Cn as St,Cx as Ct,D as wt,DC as Tt,DO as Et,Di as Dt,Ei as Ot,Ex as kt,F as At,FD as K,Fc as jt,G as Mt,GD as Nt,GE as Pt,Gi as Ft,HD as It,HS as Lt,HT as Rt,Hi as zt,ID as Bt,Ic as Vt,Is as Ht,JA as Ut,JD as Wt,JT as Gt,K as Kt,Ks as qt,LD as Jt,LT as Yt,Lo as Xt,Ls as Zt,Ly as Qt,Ml as $t,Mx as en,NE as tn,NO as nn,Nc as rn,O as an,OC as on,OD as sn,OT as cn,Of as ln,Or as un,Ov as dn,PO as fn,Pc as pn,QE as mn,QT as q,Qv as hn,RD as gn,Ra as _n,Ry as vn,S as yn,SA as bn,SE as xn,Sx as Sn,TE as Cn,Tv as wn,UC as Tn,UD as En,Uh as Dn,Us as On,Uu as kn,VD as An,VS as jn,V_ as Mn,Vs as Nn,Vt as Pn,WD as Fn,WE as In,WT as Ln,Wu as Rn,Xi as zn,ZE as Bn,ZT as Vn,Zh as Hn,_c as Un,aj as Wn,as as Gn,au as Kn,bO as qn,bc as Jn,bw as Yn,bx as Xn,cs as Zn,dE as Qn,db as $n,di as er,eE as tr,eg as nr,ey as rr,fC as ir,fE as ar,fO as or,fc as sr,fi as cr,fs as lr,fw as ur,gc as dr,gi as fr,gj as pr,gw as mr,hb as hr,hc as gr,hi as _r,hw as vr,ip as yr,ir as br,jE as xr,jl as Sr,jv as Cr,jx as wr,kD as Tr,kT as Er,kf as Dr,kr as Or,kv as kr,kx as Ar,la as jr,lj as Mr,lr as Nr,lw as Pr,mE as Fr,mO as J,mc as Ir,mj as Lr,ms as Rr,nD as zr,nO as Br,nu as Vr,nw as Hr,ny as Ur,o as Wr,oj as Gr,os as Kr,oy as qr,p as Jr,pC as Yr,pE as Xr,pO as Zr,pc as Qr,po as $r,qD as ei,qT as ti,qu as ni,rD as ri,rj as ii,rp as ai,ru as oi,s as si,sA as ci,sy as li,tD as ui,tg as di,ty as fi,u as pi,uA as mi,uC as hi,uw as gi,vA as _i,vc as vi,vi as yi,w as bi,wE as xi,wO as Si,wb as Ci,wn as wi,wv as Ti,x as Ei,xE as Di,xO as Oi,xc as ki,xv as Ai,yO as ji,yc as Mi,yn as Ni,zD as Pi,zi as Fi}from"./loadAgentsDir-D-xcJ22-.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-C69iv9cI.js";import{i as qi,o as Ji}from"./xml-K_hNNh2b.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-CTOZ2K3E.js";import{c as pa,l as ma}from"./commitAttribution-CUqUEjsh.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-CbFFdvPw.js";import{t as ya}from"./pollConfig-xYxAmuXi.js";import{r as ba}from"./inboundAttachments-BweY9sYo.js";import{i as xa,n as Sa,s as Ca}from"./mappers-CO6koWDa.js";import{n as wa,r as Ta}from"./sessionTitle-BafqFHLc.js";import{n as Ea,t as Da}from"./ccrClient-CMZXfu9P.js";import{n as Oa,t as ka}from"./HybridTransport-PeXWuYfl.js";import{n as Aa,t as ja}from"./SSETransport-BHdzk1HO.js";import{t as Ma}from"./pluginBlocklist-C_Veew3p.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-t6Kgu-vX.js";import{t as Va}from"./onChangeAppState-C6ZIU1SD.js";import{t as Ha}from"./settingsSync-DBWi-NXU.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-IGWCRDrv.js";import{i as $a,n as eo}from"./toolPool-CN1cPGQz.js";import{n as to,r as no}from"./QueryEngine-CxP2S3qi.js";import{n as ro,r as io}from"./sideQuestion-CI5pyoQF.js";import{n as ao,r as oo}from"./context-noninteractive-DdPFYYO9.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-BOH-fyEn.js";import{n as uo,t as fo}from"./refresh-BeSXaVya.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(),Ee(),le(),w(),Oe(),E(),O(),lt(),A(),at(),me(),ye(),Hi(),Ki(),_i(),mi(),Oi(),Pi(),Tr(),Pt(),ta(),xn(),ha(),pt(),Yt(),na(),yt(),oa(),jt(),pn(),Kr(),Xt(),zn(),gt(),wi(),Ni(),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
|
-
`)?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)}`)),Vn(1,`other`)}),Ie(async()=>this.ccrClient?.close()),Dt((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Ot(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};An((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
|
-
`)})()}}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
|
-
`)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Wi(),D(),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
|
-
`))!==-1;){let e=Z.slice(0,i);Z=Z.slice(i+1),wo(e)?a=Co(e+`
|
|
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(),we(),Lr(),ii(),qi(),Gi(),Xi(),ra(),zr(),tn(),vr(),Hr(),li(),dn(),Ti(),ni(),Mi(),Nn(),lr(),Kt(),Wr(),Ba(),Na(),eo(),Ai(),Fe(),Ze(),na(),hn(),L(),pt();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`),q())},n))},stop(){i&&(clearTimeout(i),i=null)}}}Se(),ge(),M(),nn(),Bn(),ar(),Er(),Lt(),xt(),hr(),$t(),_n(),bi(),Ta(),ro();function Do(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(Mn(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(),T(),dt(),Nt(),Jt(),ma(),ti(),Tt(),hi(),Ar(),Dr(),Vr(),Sa(),oo(),L();async function Oo(){try{let e=await go(dr(),`utf-8`),t=Te().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 sr(dr(),P(e,null,2))}async function Ao(e,t){let n=gr();if(!n)return;let r=await jo(t);r!==null&&await sr(mo(n,Ir(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 On();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(),Nn(),Mi();async function No(){let e=ki();I(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await qt();t&&(Ht(),Zn(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Be().mkdir(Un()),await Be().mkdir(vi()));let n=Object.keys(Zt()).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)=>!Jn(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&&(Ht(),Zn(`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&&Zn(`headlessPluginInstall: plugins changed`),e&&Ie(Qr),i}catch(e){return W(e),!1}finally{z(`tengu_headless_plugin_install`,r)}}Ve(),L(),H(),Pi(),oa(),Ze(),B(),yt(),pt(),Le(),He(),_(),gt(),Xt(),R(),r(),fo(),lr(),Dn(),_a(),Cn(),Qt(),ai(),Fe();var Q=(Fr(),e(Xr)),$=(fa(),e($i)),Po=(Ya(),e(Ua)),Fo=(Za(),e(Qa)),Io=(zi(),e(Ii)),Lo=`<system-reminder>
|
|
9
|
-
You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
|
|
10
|
-
|
|
11
|
-
You MUST shut down your team before preparing your final response:
|
|
12
|
-
1. Use requestShutdown to ask each team member to shut down gracefully
|
|
13
|
-
2. Wait for shutdown approvals
|
|
14
|
-
3. Use the cleanup operation to clean up the team
|
|
15
|
-
4. Only then provide your final response to the user
|
|
16
|
-
|
|
17
|
-
The user cannot receive your response until the team is completely shut down.
|
|
18
|
-
</system-reminder>
|
|
19
|
-
|
|
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)),bn.subscribe(e=>{jn(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(),Bt(),K(`runHeadless_entry`),await Gt()&&await Ln(),K(`after_grove_check`),ae(),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
|
|
22
|
-
`),q(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
|
|
23
|
-
`),q(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
|
|
24
|
-
`),q(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=ci.getSandboxUnavailableReason();if(d){if(ci.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${d}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),q(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(ci.isSandboxingEnabled())try{await ci.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${F(e)}\n`),q(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&Vt(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 _t(c.setupTrigger),K(`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=Cr();if(g&&l.prependUserMessage(g),!c.agent&&!y()&&h){let{agentDefinition:e}=so(h,void 0,{activeAgents:s,allAgents:s});if(e){if(n(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!si(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}_r(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`),q(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`),q(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),q(0);return}let ee=typeof c.resume==`string`&&(!!Mn(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
|
-
`),q(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
|
|
26
|
-
`),q(1);return}let te=Rn(f.mcp.tools,f.toolPermissionContext),v=[...a,...te],ne=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(),K(`after_loadInitialMessages`),await x(),K(`after_modelStrings`);let re=c.outputFormat===`json`&&c.verbose,b=[],S;K(`before_runHeadlessStreaming`);for await(let e of Ko(l,f.mcp.clients,[...r,...f.mcp.commands],v,p,ne,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`&&(re&&b.push(e),S=e);switch(c.outputFormat){case`json`:if(!S||S.type!==`result`)throw Error(`No messages returned`);if(c.verbose){V(P(b)+`
|
|
27
|
-
`);break}V(P(S)+`
|
|
28
|
-
`);break;case`stream-json`:break;default:if(!S||S.type!==`result`)throw Error(`No messages returned`);switch(S.subtype){case`success`:V(S.result.endsWith(`
|
|
29
|
-
`)?S.result:S.result+`
|
|
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(gn(),xe())try{let{drainPendingExtraction:e}=await import(`./extractMemories-CA2eJwHy.js`);await e()}catch{}q(S?.type===`result`&&S?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,ne){let y=!1,b,x=!1,ae=!1,le=null,w,T=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),w&&!w.signal.aborted&&w.abort(),Vn(0)}),Ie(async()=>{let t={};for(let e of xi(g()))vn(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:y,run_phase:b,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`)&&T.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let E={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},me;v.enableAuthStatus&&(me=ue.getInstance().subscribe(e=>{T.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let ge=e=>{let t=Ca(e);t&&T.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};fn.add(ge);let D=s,O=xr(s,X(),100),ye=Yi(100),xe=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;ne&&ne.kind!==`none`&&xe&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${ne.kind})`),ts(D,ne.message),J({mode:`prompt`,value:ne.message.message.content,uuid:Y()}));let Se=ln().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?oe():S(t),r=Wn(n),i=pr(n),a=he(e.value),o=_e(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:Gr(n)?[...Ut]:Ut.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),we=v.userSpecifiedModel;function Te(e,t){let n=$r(e,pe(t));D.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&T.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 k=[],A=[],Ee=new Set;function De(t){for(let n of t){if(n.type!==`connected`||Ee.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 ir(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 Yr(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}`),Pn({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),T.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Ee.add(t)}catch{}}}async function Oe(){let t=new Set(Object.keys(h)),n=new Set(k.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=k.some(e=>e.type===`pending`),o=k.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of k)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await en(h,(t,n)=>e.sendMcpMessage(t,n));k=r.clients,A=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(j(t)))),...A]}})),ri(k)}}Oe();let M={clients:[],tools:[],configs:{}},Ae=e=>{let t=kn(e.toolPermissionContext,e.mcp.tools),n=be($a([...o,...A,...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,D.length),t=D.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=D.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(k.map(e=>e.name)),n=await os(e,{configs:h,clients:k,tools:A},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),k=n.newSdkState.clients,A=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(k.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(j(t)))),...A]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Pe=Pe.then(t,t),Pe}function Le(){let e=g(),t=e.mcp.clients,n=be([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...k.map(e=>e.name)]);return[...t,...k,...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`?ut(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`,()=>Rt())]),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(()=>!y),L=a,R=te;async function Ve(){let{agentDefinitions:e}=await uo(_);L=await Ft(X());let t=R.filter(e=>e.source===`flagSettings`);R=[...e.allAgents,...t]}async function He(){let{servers:e}=await gi(),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&&Oe(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Fi(),Ft(X()).then(e=>{L=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||x||(async()=>{let e=await Wt({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!x});if(x){await It({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)};Et(()=>{w&&ji(`now`).length>0&&w.abort(`interrupt`)});let B=async()=>{if(y)return;if(y=!0,b=void 0,ca(`running`),Be.stop(),K(`run_entry`),await Oe(),K(`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-BC1Ea7_D.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=or(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,Si(t));)i.push(or(t));let a=await En(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&&T.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,...k,...M.clients];De(c);for(let e of c)$o(e);let l=Ae(s);for(let e of o)vt(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&&T.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}),E.abortController?.abort(),E.abortController=null,E.pendingSuggestion=null,E.pendingLastEmittedEntry=null,E.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&mn(E.lastEmitted.text,e,E.lastEmitted.emittedAt,E.lastEmitted.promptId,E.lastEmitted.generationRequestId),E.lastEmitted=null}w=sn(),K(`before_ask`),Kn();let h=r,ee=!1;try{if(await Ce(h.workload??v.workload,async()=>{for await(let t of to({commands:be([...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:we,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:D,getReadFileCache:()=>ye.size===0?O:Zi(O,ye),setReadFileCache:e=>{O=e;for(let[e,t]of ye.entries()){let n=O.get(e);(!n||t.timestamp>n.timestamp)&&O.set(e,t)}ye.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:w,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=>{T.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())T.enqueue(e);xi(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&vn(e))?le=t:(le=null,T.enqueue(t))}else{for(let e of Qi())T.enqueue(e);T.enqueue(t)}}),ee)await Fn({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Fn({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 Fn({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)vt(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){E.abortController?.abort();let e=new AbortController;E.abortController=e;let t=Sr();if(!t)ft(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await ui(e,D,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};le?(E.pendingSuggestion=r,E.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(E.lastEmitted=i,T.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){ft(`aborted`,void 0,void 0,`sdk`);return}W(Ne(e))}finally{E.inflightPromise===n.promise&&(E.inflightPromise=null)}})(),E.inflightPromise=n.promise}}gn(),oi(),Bt()}};do{for(let e of Qi())T.enqueue(e);b=`draining_commands`,await a(),i=!1;{let e=xi(g()).some(e=>vn(e)&&e.type!==`in_process_teammate`),n=Si(t)!==void 0;(e||n)&&(i=!0,n||(b=`waiting_for_agents`,await ct(100)))}}while(i);le&&(T.enqueue(le),le=null,E.pendingSuggestion&&(T.enqueue(E.pendingSuggestion),E.pendingLastEmittedEntry&&(E.lastEmitted={...E.pendingLastEmittedEntry,emittedAt:Date.now()},E.pendingLastEmittedEntry=null),E.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{}E.abortController?.abort(),q(1);return}finally{if(b=`finally_flush`,await e.flushInternalEvents(),b=`finally_post_flush`,!tr()){ca(`idle`);for(let e of Qi())T.enqueue(e)}y=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Si(t)===void 0&&!x){We();return}if(Si(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 di(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await nr(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=Hn(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
|
-
|
|
33
|
-
`),uuid:Y()}),B();return}if(x&&!ae){ae=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),J({mode:`prompt`,value:Lo,uuid:Y()}),B();return}await ct(500)}}}x&&(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()):(E.inflightPromise&&await Promise.race([E.inflightPromise,ct(5e3)]),E.abortController?.abort(),E.abortController=null,await rn(),Ue(),me?.(),fn.delete(ge),T.done()))},V=null;if(Io.isKairosCronEnabled()){let e=e=>{x||(async()=>{let t=await ei({basePrompt:e.basePrompt,trigger:`scheduled-task`,currentDir:X(),sourceId:e.sourceId,sourceLabel:e.sourceLabel,workload:ce,shouldCreate:()=>!x});if(t){if(x){await It({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 Br(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:()=>y||x,getJitterConfig:Fo?.getCronJitterConfig,isKilled:()=>!Io?.isKairosCronEnabled()}),V.start()}let H=function(e,t){T.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},U=function(e,t){T.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`&&vt(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}})),w&&w.abort(),E.abortController?.abort(),E.abortController=null,E.lastEmitted=null,E.pendingSuggestion=null,H(i);else if(o.subtype===`end_session`){I(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),w&&w.abort(),E.abortController?.abort(),E.abortController=null,E.lastEmitted=null,E.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,T,a,Se,e,!!v.enableAuthStatus,v,te,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&ve(`tengu_slate_prism`,!0)&&ee(!0),t=!0,qn()&&B()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Zo(e,i.request_id,t.toolPermissionContext,T),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e===`default`?oe():e;we=t,re(t),la({model:t}),Te(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:D,getAppState:g,options:{mainLoopModel:se(),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=k.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:Zr(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
|
-
`,`
|
|
35
|
-
`);ye.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&&Oe()}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([Ft(X()),He(),Rr()]);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:jr(e),description:zt(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;Ee.delete(t);let n=ur(t)??r.find(e=>e.name===t)?.config??k.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 wr(t,n),r=j(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...C(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...C(n.mcp.commands,e=>Tn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:de(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`?(De([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;Ee.delete(t);let a=ur(t)??r.find(e=>e.name===t)?.config??k.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){Yn(t,!0);let e=await wr(t,a),n=j(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...C(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...C(r.mcp.commands,e=>Tn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:de(r.mcp.resources,t)}})),e.client.type===`connected`?(De([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{Yn(t,!1);let n=[...r,...k,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await Sn(t,a);let o=j(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:C(e.mcp.tools,e=>e.name?.startsWith(o)),commands:C(e.mcp.commands,e=>Tn(e,t)),resources:de(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...k,...M.clients],T)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=ur(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=on(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(mr(e)||tt.has(e))return;let t=await wr(e,n),r=j(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...C(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...C(n.mcp.commands,t=>Tn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:de(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 cn,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 Ci(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=ie();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:fe()}})},e=>U(i,F(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=ur(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 ht(e,n);let t=await wr(e,n),r=j(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...C(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...C(n.mcp.commands,t=>Tn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:de(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=se(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),bn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?re(void 0):re(String(n.model)));let a=se();if(a!==e){we=a;let e=n.model?String(n.model):`default`;la({model:a}),Te(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=se(),n=Wn(t)?Mr(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 yr(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=(w&&!w.signal.aborted?w:sn()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{fr(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=Sr();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:sn()}}:await no({tools:Ae(g()),commands:L,mcpClients:[...g().mcp.clients,...k,...M.clients],messages:D,readFileState:O,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:Qn(N.bridgeSessionId,N.sessionIngressUrl),connect_url:$n(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-3CfmzjJL.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(){w?.abort()},onSetModel(e){let t=e===`default`?oe():e;we=t,re(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}`:``}`),T.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:D.length>0?D:void 0});r?(N=r,je=D.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:Qn(r.bridgeSessionId,r.sessionIngressUrl),connect_url:$n(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&&T.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]);D.push(...e),n.type===`assistant`&&v.replayUserMessages&&T.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await br(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}`),T.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&&vt(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=>{mt(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}x=!0,V?.stop(),y||(E.inflightPromise&&await Promise.race([E.inflightPromise,ct(5e3)]),E.abortController?.abort(),E.abortController=null,await rn(),Ue(),me?.(),fn.delete(ge),T.done())})(),T}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Mt(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=St(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 Mt(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`),q(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`),q(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=Jr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=y()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(ne(t.agentType),!c.systemPrompt&&!si(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&re(S(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=k()?.outputStyle||`default`,p=await Gn(Ue()),m=ie();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:jr(e),description:zt(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:fe()},pid:process.pid};if(Ae()&&je()){let e=d();ee.fast_mode_state=De(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=ue.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(!fi())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!rr(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Ur(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await qr(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(an())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`&&!wt()){let e=yn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${Ei(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=b(),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,b()),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
|
-
`)}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 wn(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}=(Wr(),e(pi));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(Di(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await er()),co(i,t),cr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&yi(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),q(1),{messages:[]}}if(n.teleport)try{if(!bt(`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-Da0rKwCo.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),q(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),q(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([un(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&re(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await Or(a.sessionId,a.ingressUrl);let o=await wn(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??kr(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),q(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),q(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}=(Wr(),e(pi));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(Di(o.sessionId),o.fullPath?po(o.fullPath):null),r&&await er()),co(o,t),cr(n.forkSession?{...o,worktreeSession:void 0}:o),Q&&yi(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),q(1),{messages:[]}}return{messages:await(n.sessionStartHooksPromise??kr(`startup`))}}function rs(e,t){let n;return n=typeof e==`string`?e.trim()===``?In([]):In([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 Nr(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}=Pr(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:!Xn(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 Sn(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 Ct(t,r);if(d.push(e),e.type===`connected`){let t=await kt(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 +0,0 @@
|
|
|
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-D9CVAtXU.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,hu as b,mu as x,qo as S,vC as C,yC as w,yo as T,zm as E}from"./loadAgentsDir-D-xcJ22-.js";import{Ft as D,Pt as O}from"./prompt-C69iv9cI.js";import{r as k,t as A}from"./xml-K_hNNh2b.js";import{randomUUID as j}from"crypto";t(),n(),b(),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}):x.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}u(),l(),C(),g(),o();function P(){return a().defaultShell??`bash`}b(),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:S({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??x,f=(c?await c.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await x.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 w(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 +0,0 @@
|
|
|
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-D9CVAtXU.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{$D as te,$x as ne,A as re,Al as A,B_ as ie,Cl as ae,D_ as oe,Dc as se,Dw as ce,Ec as le,Ew as ue,G as de,GE as fe,G_ as j,Go as pe,HA as me,Ho as he,J_ as ge,Jf as M,K as N,KE as P,Li as F,Lo as I,MD as L,Mk as _e,Ml as ve,Nl as ye,OD as be,O_ as xe,Pk as Se,Ro as Ce,Tw as we,U_ as Te,VA as Ee,Vi as De,W_ as Oe,Wi as ke,XD as Ae,Xi as je,YD as Me,Yf as Ne,Yi as Pe,Zx as Fe,_o as Ie,bo as R,fo as z,go as B,hO as Le,jD as Re,kD as ze,k_ as Be,kc as Ve,la as V,mO as He,n_ as Ue,pk as We,qo as H,r_ as U,uk as Ge,w as Ke,wo as qe,xO as Je,xl as Ye,yo as Xe,z_ as Ze}from"./loadAgentsDir-D-xcJ22-.js";import{a as W,i as Qe,o as G}from"./xml-K_hNNh2b.js";import{E as $e,T as et,w as tt}from"./sessionTracing-_obALZbi.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}'`),Be(e,t,o,s)}:void 0;oe(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),xe()}));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=Ze(),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=be(),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 Me({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)He(t)},d=async e=>{o?.runId&&await Ae({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:Ne(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=Ge(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(Re(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`:F().has(f)?f:`custom`;if(!Pe(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,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]&&Ce(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&&Oe(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=ne()&&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>${Ee}</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 Se(),{messages:Ye(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
|
-
`)}function dt(e,t){return[`<${w}>${e}</${w}>`,`<${E}>/${e}</${E}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
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=!ue(`hooks`)||ce(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
|
-
|
|
6
|
-
`);o(e.name,f,p,s()?.agentId??null);let m=X(e,t),h=re(e.allowedTools??[]),g=c.length>0||a.length>0?[...c,...a,...u]:u,_=await P(se(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(),je(),me(),T(),S(),L(),ae(),_e(),Ue(),M(),ze(),m(),Ve(),x(),t(),g(),f(),ve(),v(),Fe(),fe(),at(),D(),Je(),I(),Ke(),N(),Qe(),we(),rt(),ee(),Te(),tt(),ge(),We(),ie(),te(),u(),Q=200,$=1e4}))();export{Y as formatSkillLoadingMetadata,ft as processPromptSlashCommand,lt as processSlashCommand};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./prompt-C69iv9cI.js";t();export{e as isDeferredTool};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Jk as e,eA as t}from"./loadAgentsDir-D-xcJ22-.js";t();export{e as clearPromptCache};
|
|
@@ -1 +0,0 @@
|
|
|
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-D9CVAtXU.js";import{n as m,r as h}from"./analytics-DqMQntaB.js";import{Fg as g,Ig as _,Lg as v,Nx as y,Px as b,Rg as x,da as S,fa as C}from"./loadAgentsDir-D-xcJ22-.js";import{n as w,t as T}from"./extra-usage-C6s5mXW0.js";import{n as E,t as D}from"./upgrade-zs7K9UkG.js";function O({onDone:e,context:t}){let[n,i]=(0,A.useState)(null),a=_(),c=p(),d=o(),f=l()?.hasExtraUsageEnabled===!0,m=c===`max`&&d===`default_claude_max_20x`,g=c===`team`||c===`enterprise`,b=u(`tengu_jade_anvil_4`,!1),x=(0,A.useMemo)(()=>{let e=[];if(v.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&&C.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`});let t={label:`Stop and wait for limit to reset`,value:`cancel`};return b?[...e,t]:[t,...e]},[b,m,g,f,a.overageStatus,a.overageDisabledReason]);function S(){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`&&S()}return n||(0,j.jsx)(r,{title:`What do you want to do?`,onCancel:S,color:`suggestion`,children:(0,j.jsx)(y,{options:x,onChange:w,visibleOptionCount:x.length})})}async function k(e,t){return(0,j.jsx)(O,{onDone:e,context:t})}var A,j;e((()=>{A=t(n(),1),b(),i(),c(),m(),g(),f(),d(),w(),x(),S(),E(),j=a()}))();export{k as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{L as r,V as i,d as a,s as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{Aw as l,Cc as u,Fv as d,Ip as f,Pp as p,Pv as m,Sc as h,fs as g,gh as _,i as v,kw as y,lc as b,mh as x,o as S,ps as C,uc as w,vh as T,yh as E}from"./loadAgentsDir-D-xcJ22-.js";async function D(e){a(`refreshActivePlugins: clearing all plugin caches`),b(),p();let t=await C(),[i,o]=await Promise.all([h(),v(n())]),{enabled:s,disabled:u,errors:f}=t,[m,g]=await Promise.all([Promise.all(s.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await l(e,f);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(s.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await E(e,f);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),y=m.reduce((e,t)=>e+t,0),x=g.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:s,disabled:u,commands:i,errors:O(e.plugins.errors,f),needsRefresh:!1},agentDefinitions:o,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),_();let S=!1;try{await d()}catch(e){S=!0,c(e),a(`refreshActivePlugins: loadPluginHooks failed: ${r(e)}`)}let w=s.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return a(`refreshActivePlugins: ${s.length} enabled, ${i.length} commands, ${o.allAgents.length} agents, ${w} hooks, ${y} MCP, ${x} LSP`),{enabled_count:s.length,disabled_count:u.length,command_count:i.length,agent_count:o.allAgents.length,hook_count:w,mcp_count:y,lsp_count:x,error_count:f.length+ +!!S,agentDefinitions:o,pluginCommands:i}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),x(),S(),o(),i(),s(),w(),u(),m(),T(),y(),f(),g()}));export{D as n,A as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Cd as e,Dd as t,Ed as n,Od as r,Sd as i,Td as a,_d as o,bd as s,gd as c,hd as l,md as u,vd as d,wd as f,xd as p,yd as m}from"./loadAgentsDir-D-xcJ22-.js";i();export{u as detectAndGetBackend,l as ensureBackendsRegistered,c as getBackendByType,o as getCachedBackend,d as getCachedDetectionResult,m as getInProcessBackend,s as getResolvedTeammateMode,p as getTeammateExecutor,e as isInProcessEnabled,f as markInProcessFallback,a as registerITermBackend,n as registerTmuxBackend,t as registerWindowsTerminalBackend,r as resetBackendDetection};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{f as r,l as i}from"./teammate-DMYOtLTK.js";import{Ar as a,Lo as o,Oo as s,Tr as c,_i as l,mi as u}from"./loadAgentsDir-D-xcJ22-.js";import{a as d,i as f,r as p}from"./bridgeConfig-CvKdNJOg.js";import{n as m,t as h}from"./generateSessionName-EbB2vl9t.js";async function g(e,n,i){if(r())return e(`Cannot rename: This session is a swarm teammate. Teammate names are set by the team leader.`,{display:`system`}),null;let a;if(!i||i.trim()===``){let t=await h(s(n.messages),n.abortController.signal);if(!t)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;a=t}else a=i.trim();let o=t(),d=c();await l(o,a,d);let m=n.getAppState().replBridgeSessionId;if(m){let e=f();import(`./createSession-1ewHG3eq.js`).then(({updateBridgeSessionTitle:t})=>t(m,a,{baseUrl:p(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await u(o,a,d),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:a}})),e(`Session renamed to: ${a}`,{display:`system`}),null}e((()=>{n(),d(),o(),a(),i(),m()}))();export{g as call};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{sA as e,uA as t}from"./loadAgentsDir-D-xcJ22-.js";t();export{e as SandboxManager};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{Yc as e,Zc as t}from"./loadAgentsDir-D-xcJ22-.js";e();export{t as isSearchExtraToolsEnabled};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{gu as e,vu as t}from"./loadAgentsDir-D-xcJ22-.js";e();export{t as registerSessionFileAccessHooks};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e,r as t}from"./sessionMemory-HZNzEOLd.js";t();export{e as manuallyExtractSessionMemory};
|