claude-code-best 2.6.10 → 2.6.11
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-DYIf4o0g.js → AddWorkspaceDirectory-CGKtPsTK.js} +1 -1
- package/dist/chunks/{App-Bw4stCcv.js → App-DF28Bpg9.js} +1 -1
- package/dist/chunks/ApproveApiKey-BtiWOryM.js +1 -0
- package/dist/chunks/{ApproveApiKey-CNBKF9de.js → ApproveApiKey-D21kbmQj.js} +1 -1
- package/dist/chunks/{AssistantSessionChooser-DU5OOPwq.js → AssistantSessionChooser-CDfwNVi5.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-ChDZ6M4c.js → BackgroundTasksDialog-5RpkAbJz.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-UOkwRr3W.js → BypassPermissionsModeDialog-BDWFw61G.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-6UL2_PCg.js → ClaudeInChromeOnboarding-CpN0yIU_.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-DBfmH_dG.js → ClaudeMdExternalIncludesDialog-CWRHpy22.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-Dje7A0F2.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-DQf3dmj6.js +1 -0
- package/dist/chunks/{DesktopHandoff-B-ySC5nP.js → DesktopHandoff-CKHLXiwc.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-DZMsKuak.js → DevChannelsDialog-BwMFW7Wt.js} +1 -1
- package/dist/chunks/{DiffDialog-CeYcqIIw.js → DiffDialog-oA1v0BMo.js} +1 -1
- package/dist/chunks/Doctor-ButdpAkf.js +1 -0
- package/dist/chunks/{Doctor-ByQrTdef.js → Doctor-QVMo0fIh.js} +1 -1
- package/dist/chunks/{ExitFlow-gMv13EpM.js → ExitFlow-DJLYN-Bd.js} +1 -1
- package/dist/chunks/{Feedback-CGRlFB5g.js → Feedback-CpfhqIEv.js} +1 -1
- package/dist/chunks/{Grove-CnHyPepC.js → Grove-BugC6ssx.js} +1 -1
- package/dist/chunks/Grove-CmdRVv9F.js +1 -0
- package/dist/chunks/{HybridTransport-CiY6jyhx.js → HybridTransport-PeXWuYfl.js} +1 -1
- package/dist/chunks/{ITermBackend-CG-a4QYW.js → ITermBackend-dcs68DGS.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-umJZVrz-.js → InvalidConfigDialog-DdB9_Ve0.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-C62kuhHc.js → InvalidSettingsDialog-BL8nxwWQ.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-BbGFGZTr.js → MCPConnectionManager-D2eAGUME.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-DW0d9Lsb.js → McpParsingWarnings-BYPXpmte.js} +1 -1
- package/dist/chunks/{MessageSelector-A-814zUi.js → MessageSelector-Bzq8CYAH.js} +1 -1
- package/dist/chunks/{Messages-C4nIAGDL.js → Messages-uRxxAMW-.js} +2 -2
- package/dist/chunks/{Onboarding-BRePz3fJ.js → Onboarding-ByLnHSnW.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-DEZsyI6y.js → OverageCreditUpsell-CVNfTSKG.js} +1 -1
- package/dist/chunks/{PluginSettings-CuZtXDaS.js → PluginSettings-h9Lj0vW6.js} +1 -1
- package/dist/chunks/{PromptInputFooterSuggestions-BrpVQJVn.js → PromptInputFooterSuggestions-CYWSLCgA.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-BlGRpX1Q.js → PromptInputHelpMenu-BsYNhZCw.js} +1 -1
- package/dist/chunks/{QueryEngine-CK9YRTZo.js → QueryEngine-CxP2S3qi.js} +1 -1
- package/dist/chunks/{REPL-D-t0XQx2.js → REPL-CV12-ns7.js} +6 -6
- package/dist/chunks/REPL-h1bwm8ee.js +1 -0
- package/dist/chunks/{RemoteCallout-DvOZQWoG.js → RemoteCallout-WWO84za-.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-BlIA65dM.js → RemoteSessionManager-Dx2skKnM.js} +1 -1
- package/dist/chunks/{ResumeConversation-BTccgPK8.js → ResumeConversation-CagiCg7-.js} +1 -1
- package/dist/chunks/{SSETransport-CIvM80QS.js → SSETransport-BHdzk1HO.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-BJ2d8mtx.js +1 -0
- package/dist/chunks/SentryErrorBoundary-CYiFofRZ.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-BK2HjzVw.js → SentryErrorBoundary-CmewX8Dv.js} +1 -1
- package/dist/chunks/{Settings-D3Kpcb7q.js → Settings-BcgtW60l.js} +2 -2
- package/dist/chunks/{TeleportProgress-BFlMrsa_.js → TeleportProgress-BmbhZlOg.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-BUeyIQCH.js → TeleportRepoMismatchDialog-BAwtgUhR.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-CHfeyo9J.js → TeleportResumeWrapper-BlkvOdYn.js} +1 -1
- package/dist/chunks/{ThemePicker-a5n2EKgk.js → ThemePicker-v_3lh136.js} +1 -1
- package/dist/chunks/{TmuxBackend-Ct9v-J78.js → TmuxBackend-B7Nabc5t.js} +1 -1
- package/dist/chunks/{TrustDialog-e1nyM-Fp.js → TrustDialog-CHu5eoeR.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-BHCepjdO.js → ValidationErrorsList-BSMetgqr.js} +1 -1
- package/dist/chunks/{WelcomeV2-BnyziLbm.js → WelcomeV2-DZfBSTu5.js} +1 -1
- package/dist/chunks/{WindowsTerminalBackend-Dw6qjsBu.js → WindowsTerminalBackend-CeSoQ_Nk.js} +1 -1
- package/dist/chunks/{add-dir-CjnY5yfR.js → add-dir-7UeFZkdv.js} +1 -1
- package/dist/chunks/{agentDisplay-Dfx-axK9.js → agentDisplay-DJgsfIlm.js} +1 -1
- package/dist/chunks/{agents-lM-cxA8_.js → agents-DD7gQVZD.js} +1 -1
- package/dist/chunks/{agents-CICHEOOq.js → agents-DK0y9jId.js} +1 -1
- package/dist/chunks/{ant-JgExUpwJ.js → ant-PhgMZT08.js} +1 -1
- package/dist/chunks/api-D4aCzJS-.js +1 -0
- package/dist/chunks/{api-CClu711S.js → api-nHsRf03G.js} +1 -1
- package/dist/chunks/{assistant-Bih7t52W.js → assistant-BJbeizyH.js} +1 -1
- package/dist/chunks/{assistant-D1XefK1z.js → assistant-DO7RAhd3.js} +1 -1
- package/dist/chunks/assistant-Dvx-UrTi.js +1 -0
- package/dist/chunks/auth-Cp7Nt0ik.js +1 -0
- package/dist/chunks/{auth-CU6ArDos.js → auth-DxRiJwZ-.js} +1 -1
- package/dist/chunks/{autoMode-DM9eDMmT.js → autoMode-BswSpjo5.js} +1 -1
- package/dist/chunks/{autonomy-CZCZ9wlx.js → autonomy-CNJQwoAQ.js} +1 -1
- package/dist/chunks/{autonomy-DUfXLZfq.js → autonomy-Lc78acHX.js} +1 -1
- package/dist/chunks/{autonomyPanel-kUZwcjfu.js → autonomyPanel-DxcumRp-.js} +1 -1
- package/dist/chunks/{backgroundHousekeeping-KGRk7QeA.js → backgroundHousekeeping-BkfWgzIP.js} +2 -2
- package/dist/chunks/backgroundHousekeeping-BxBI2KkX.js +1 -0
- package/dist/chunks/{branch-Ac3HXXs2.js → branch-BPsUW1dk.js} +1 -1
- package/dist/chunks/{bridge-Drt-UmFp.js → bridge-DcOGvDbb.js} +2 -2
- package/dist/chunks/{bridgeConfig-GQzZVhuF.js → bridgeConfig-CvKdNJOg.js} +1 -1
- package/dist/chunks/bridgeConfig-Dkn5GGec.js +1 -0
- package/dist/chunks/bridgeEnabled-CjaYKTo5.js +1 -0
- package/dist/chunks/{bridgeEnabled-CDoXbe3S.js → bridgeEnabled-D01faWms.js} +1 -1
- package/dist/chunks/{bridgeMain-B0fLyOLC.js → bridgeMain-Bu2oOX31.js} +6 -6
- package/dist/chunks/bridgeMain-CEpOBx8Z.js +1 -0
- package/dist/chunks/{bridgeMessaging-gRm2WcIE.js → bridgeMessaging-BZMDSZAN.js} +1 -1
- package/dist/chunks/{btw-B2Tq2ewP.js → btw-B8s-X_cm.js} +1 -1
- package/dist/chunks/{buddy-v00QHFZ6.js → buddy-DkB1xU1o.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-DAr5U3Ep.js → bypassPermissionsKillswitch-B9Qz9zKO.js} +1 -1
- package/dist/chunks/{caches-DHUk9KMo.js → caches-BuSzLvN9.js} +2 -2
- package/dist/chunks/caches-Bvl2jdxF.js +1 -0
- package/dist/chunks/{ccrClient-1Q3C_3_r.js → ccrClient-CMZXfu9P.js} +1 -1
- package/dist/chunks/changeDetector-DTXMv7gH.js +1 -0
- package/dist/chunks/channelNotification-B7s1OoRK.js +1 -0
- package/dist/chunks/{channelNotification-d08DSK9u.js → channelNotification-t6Kgu-vX.js} +1 -1
- package/dist/chunks/{chrome-CKo0_n71.js → chrome-Cvkozg2F.js} +1 -1
- package/dist/chunks/clear-C9pufI6F.js +1 -0
- package/dist/chunks/client-CqJ5gRGj.js +1 -0
- package/dist/chunks/{color-DqtpdhFx.js → color-AYeAYKyq.js} +1 -1
- package/dist/chunks/commands-LcLR5Vgx.js +1 -0
- package/dist/chunks/commitAttribution-BZupnGMc.js +1 -0
- package/dist/chunks/{commitAttribution-BJvmLsVe.js → commitAttribution-CUqUEjsh.js} +1 -1
- package/dist/chunks/{compact-DLYic2Oa.js → compact-BF0-0_qh.js} +1 -1
- package/dist/chunks/{companion-C2CBSYiF.js → companion-Cf_kYtOD.js} +1 -1
- package/dist/chunks/{config-Cht2x9n9.js → config-45GLd-lt.js} +1 -1
- package/dist/chunks/{config-DnWYFpDc.js → config-JGm0O-ZQ.js} +1 -1
- package/dist/chunks/{context-CDz9HqRT.js → context-Bl5VUX5M.js} +1 -1
- package/dist/chunks/context-noninteractive-BtzPsJ8k.js +1 -0
- package/dist/chunks/{context-noninteractive-BUIf4IMX.js → context-noninteractive-DdPFYYO9.js} +1 -1
- package/dist/chunks/{conversation-CLRfdC_V.js → conversation-C3NWyOB3.js} +1 -1
- package/dist/chunks/conversation-oX932vBQ.js +1 -0
- package/dist/chunks/{copy-BgHTb1Z0.js → copy-CbhxPqw4.js} +1 -1
- package/dist/chunks/{createSSHSession-C_mpeqPy.js → createSSHSession-Dq2nMChz.js} +1 -1
- package/dist/chunks/createSession-1ewHG3eq.js +1 -0
- package/dist/chunks/{createSession-kVJBXQlZ.js → createSession-DTHPUie-.js} +1 -1
- package/dist/chunks/{cronJitterConfig-SI7bYvJj.js → cronJitterConfig-IGWCRDrv.js} +1 -1
- package/dist/chunks/{crossProjectResume-BMWSw62A.js → crossProjectResume-WmabPBTO.js} +1 -1
- package/dist/chunks/datadog-Da7KYZNF.js +1 -0
- package/dist/chunks/{datadog-Bd9AgZT-.js → datadog-FKvRNyFi.js} +1 -1
- package/dist/chunks/{desktop-BeUj2fqu.js → desktop-ZASE3YWy.js} +1 -1
- package/dist/chunks/{diff-BzgXDp1o.js → diff-QP-TbxuD.js} +1 -1
- package/dist/chunks/{doctor-HCOexiL5.js → doctor-DVkgmkRb.js} +1 -1
- package/dist/chunks/{effort-BaJU_k2K.js → effort-DbryQCua.js} +1 -1
- package/dist/chunks/{entry-BoXZIfxW.js → entry-D8y42iuM.js} +5 -5
- package/dist/chunks/envLessBridgeConfig-CpW0G4Eh.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-CnR1E53G.js → envLessBridgeConfig-D4bSwf7w.js} +1 -1
- package/dist/chunks/{exit-B-9k0zjK.js → exit-BsNW67F9.js} +1 -1
- package/dist/chunks/{export-p85q3g8t.js → export-C9A9nOA1.js} +1 -1
- package/dist/chunks/{exportRenderer-CUqd8PZM.js → exportRenderer-CyTuZFFF.js} +1 -1
- package/dist/chunks/{extra-usage-pPprHqwq.js → extra-usage-C6s5mXW0.js} +1 -1
- package/dist/chunks/extra-usage-DL2C0_BM.js +1 -0
- package/dist/chunks/{extra-usage-core-B9Fy8_RP.js → extra-usage-core-BFCwz3XM.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-B4vaWh0y.js → extra-usage-noninteractive-IHq7s6wm.js} +1 -1
- package/dist/chunks/{extraUsage-CEHCMe7l.js → extraUsage-CIrG_Lbw.js} +1 -1
- package/dist/chunks/extractMemories-CA2eJwHy.js +1 -0
- package/dist/chunks/fast-B01NO2uA.js +1 -0
- package/dist/chunks/{fast-CiSIZ5FI.js → fast-NEKXVZqQ.js} +1 -1
- package/dist/chunks/{feedback-C2QLdCfW.js → feedback-D5iWO16P.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-CozFbFD9.js → firstPartyEventLogger-Dr3TK3IU.js} +1 -1
- package/dist/chunks/{flushGate-LXr8ynSz.js → flushGate-DygHyqmB.js} +1 -1
- package/dist/chunks/gates-BSpXbh9s.js +1 -0
- package/dist/chunks/{gates-BGfvIJXl.js → gates-Dyz_t5zJ.js} +1 -1
- package/dist/chunks/{gemini-BFBrPtVM.js → gemini-BEmbnRQR.js} +1 -1
- package/dist/chunks/{generateRecap-CLla3Ymz.js → generateRecap-DZiXeYWn.js} +1 -1
- package/dist/chunks/{generateSessionName-DF4I7gr2.js → generateSessionName-EbB2vl9t.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-C_5RCW_Z.js → githubRepoPathMapping-dky2fPeU.js} +1 -1
- package/dist/chunks/{grok-Dih61WOo.js → grok-BM6ZJ4w2.js} +1 -1
- package/dist/chunks/{growthbook-C39e6Byf.js → growthbook-JD-WW3yV.js} +1 -1
- package/dist/chunks/{heapdump-BRj4tC1y.js → heapdump-8vyFTWly.js} +1 -1
- package/dist/chunks/{help-fH9LNwox.js → help-C2DM0p8U.js} +1 -1
- package/dist/chunks/{hooks-D22Uu3Vs.js → hooks-CMh0a2pT.js} +1 -1
- package/dist/chunks/hooks-QXGwOfWj.js +1 -0
- package/dist/chunks/{hostAdapter-CbXytx4y.js → hostAdapter-CmbGfgNV.js} +1 -1
- package/dist/chunks/{ide-DM5Tw70v.js → ide-Bn8R7397.js} +1 -1
- package/dist/chunks/{inboundAttachments-2QIORKsd.js → inboundAttachments-BweY9sYo.js} +1 -1
- package/dist/chunks/inboundAttachments-N5DKbZSl.js +1 -0
- package/dist/chunks/{initReplBridge-D8sWx97P.js → initReplBridge-3CfmzjJL.js} +1 -1
- package/dist/chunks/{insights-B6ogyLuv.js → insights-NOl_PxhN.js} +1 -1
- package/dist/chunks/{install-DimDiHha.js → install-BoT2GIcz.js} +1 -1
- package/dist/chunks/{install-github-app-CQ7vkhIX.js → install-github-app-SD4PvrTR.js} +1 -1
- package/dist/chunks/{install-slack-app-By9_5YS7.js → install-slack-app-DLQXpOCt.js} +1 -1
- package/dist/chunks/{instrumentation-DbKu2GCL.js → instrumentation-BXJk0mxI.js} +3 -3
- package/dist/chunks/{job-D_DoFtev.js → job-CnlMlm3t.js} +1 -1
- package/dist/chunks/{keybindings-DYRBv1bg.js → keybindings-BjaRqcbD.js} +1 -1
- package/dist/chunks/{lang-CAMxxG9F.js → lang-BI8CzjL6.js} +1 -1
- package/dist/chunks/{language-CoHgN7rh.js → language-CRIdgj2F.js} +1 -1
- package/dist/chunks/language-DmbRGIs8.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-9P8K66ku.js → launchAgentsPlatform-Bg9guiqy.js} +1 -1
- package/dist/chunks/{launchAutofixPr-BbsqqUMA.js → launchAutofixPr-BMfXGXwN.js} +1 -1
- package/dist/chunks/{launchLocalMemory-K55Yo6JM.js → launchLocalMemory-lgnXOi6U.js} +1 -1
- package/dist/chunks/{launchLocalVault-rrd1Q7jP.js → launchLocalVault-C0Oz-lto.js} +1 -1
- package/dist/chunks/{launchMemoryStores-DMZ8GNQj.js → launchMemoryStores-Bw11ruRi.js} +1 -1
- package/dist/chunks/{launchOnboarding-Duz_huXl.js → launchOnboarding-WEW34cnl.js} +1 -1
- package/dist/chunks/{launchSchedule-7VlG_3M6.js → launchSchedule-X0rcM_kM.js} +1 -1
- package/dist/chunks/{launchSkillStore-CcJL8RT0.js → launchSkillStore-DpxSlMCU.js} +1 -1
- package/dist/chunks/{launchTeleport-C8h_4F_L.js → launchTeleport-uOtMsYcI.js} +1 -1
- package/dist/chunks/{launchVault-Bm1EeT2x.js → launchVault-CJyJaPqH.js} +1 -1
- package/dist/chunks/{loadAgentsDir-HZ19tmOZ.js → loadAgentsDir-D-xcJ22-.js} +45 -45
- package/dist/chunks/loadAgentsDir-ILQxk_4G.js +1 -0
- package/dist/chunks/{loadPluginHooks-DoFtrBWf.js → loadPluginHooks-BC1Ea7_D.js} +1 -1
- package/dist/chunks/{localSearch-4cz5ia5a.js → localSearch-B6Ho7Vfj.js} +1 -1
- package/dist/chunks/localSearch-COyJeP9E.js +1 -0
- package/dist/chunks/login-Cf89biEK.js +1 -0
- package/dist/chunks/{login-D6ywctRr.js → login-uOvq1xN_.js} +1 -1
- package/dist/chunks/{logoV2Utils-jaFn88oE.js → logoV2Utils-C2cdcgtp.js} +1 -1
- package/dist/chunks/logout-CEXwTlEX.js +1 -0
- package/dist/chunks/{magicDocs-DHGtJq0K.js → magicDocs-BBjAhGN1.js} +1 -1
- package/dist/chunks/{main-Bv4AvaJk.js → main-DGsAUuG_.js} +15 -15
- package/dist/chunks/{mappers-qcXgNBi5.js → mappers-CO6koWDa.js} +1 -1
- package/dist/chunks/{mcp-iCbCqg7w.js → mcp-BrN_Tbq5.js} +2 -2
- package/dist/chunks/{mcp-BXPg0RPm.js → mcp-CZltNml5.js} +1 -1
- package/dist/chunks/{mcp-yDWIJznG.js → mcp-D6JOqdT8.js} +1 -1
- package/dist/chunks/{mcpServer-Do9XTs2J.js → mcpServer-C-0K3Azg.js} +1 -1
- package/dist/chunks/{mcpServer-DcSto-Od.js → mcpServer-C_aDoLMg.js} +1 -1
- package/dist/chunks/{memory-B0YG4r65.js → memory-BYYOgo4e.js} +1 -1
- package/dist/chunks/model-CHgqwg6N.js +1 -0
- package/dist/chunks/{model-DwVGG0mc.js → model-CrAPXYZA.js} +1 -1
- package/dist/chunks/{onChangeAppState-CHYSALjM.js → onChangeAppState-C6ZIU1SD.js} +1 -1
- package/dist/chunks/{openai-Brj68CWD.js → openai-Cm4gozk8.js} +1 -1
- package/dist/chunks/{overageCreditGrant-D5X6-TcP.js → overageCreditGrant-Pe7C_4Qi.js} +1 -1
- package/dist/chunks/{passes-B1f6NHWA.js → passes-BpI6azLG.js} +1 -1
- package/dist/chunks/{paths-D8Fx3kUi.js → paths-D9CVAtXU.js} +2 -2
- package/dist/chunks/{permissions-CYrv_WVH.js → permissions-C7wcAYOc.js} +1 -1
- package/dist/chunks/{pipeTransport-DAYnzvGK.js → pipeTransport-wjeyTgon.js} +1 -1
- package/dist/chunks/{plan-B7EPetF0.js → plan-DA8IRpHQ.js} +1 -1
- package/dist/chunks/{plugin-BRWx-_ZS.js → plugin-N2pTkzOz.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-BwxAsU2F.js → pluginAutoupdate-DCc5qDvo.js} +1 -1
- package/dist/chunks/{pluginBlocklist-BiRgxFei.js → pluginBlocklist-C_Veew3p.js} +1 -1
- package/dist/chunks/{pluginCliCommands-CXANH43C.js → pluginCliCommands-BN7loc5T.js} +1 -1
- package/dist/chunks/{pluginFlagging-CBbUoCJ9.js → pluginFlagging-Dpu1cvMo.js} +1 -1
- package/dist/chunks/{pluginOperations-B3gcFjVq.js → pluginOperations-CP6NFNog.js} +1 -1
- package/dist/chunks/pluginStartupCheck-BF0xUEJG.js +1 -0
- package/dist/chunks/{pluginStartupCheck-BNfv-Pf4.js → pluginStartupCheck-DvWHwNnD.js} +1 -1
- package/dist/chunks/{plugins-zHTS03v8.js → plugins-BHoniP5f.js} +1 -1
- package/dist/chunks/policyLimits-sh7ywop0.js +1 -0
- package/dist/chunks/{pollConfig-BWY_xmk6.js → pollConfig-xYxAmuXi.js} +1 -1
- package/dist/chunks/{poor-Bcu8JaV5.js → poor-C0KwfFF0.js} +1 -1
- package/dist/chunks/{poorMode-CDhhKGBw.js → poorMode-D7WXWZtJ.js} +1 -1
- package/dist/chunks/poorMode-DZQXZ_zu.js +1 -0
- package/dist/chunks/{print-DO52Fudu.js → print-BcRG8gkQ.js} +4 -4
- package/dist/chunks/{privacy-settings-CmHUlYoo.js → privacy-settings-DT3LGgsH.js} +1 -1
- package/dist/chunks/{processBashCommand-DltW2Ubs.js → processBashCommand-DPfJ9lrj.js} +1 -1
- package/dist/chunks/{processSlashCommand-JLJ_vF05.js → processSlashCommand-DyPCeZux.js} +1 -1
- package/dist/chunks/{prompt-BxoRdmaw.js → prompt-C69iv9cI.js} +1 -1
- package/dist/chunks/prompt-DaIJzI1P.js +1 -0
- package/dist/chunks/prompt-DnLsyywj.js +1 -0
- package/dist/chunks/{promptEditor-LQu9NhbN.js → promptEditor-BZqpLrcZ.js} +1 -1
- package/dist/chunks/{protocolHandler-DYn2E9Yl.js → protocolHandler-CfmBTg36.js} +1 -1
- package/dist/chunks/{rate-limit-options-OQt6LUP8.js → rate-limit-options-P7oQuwrl.js} +1 -1
- package/dist/chunks/{rcDebugLog-5XEbz_Yg.js → rcDebugLog-CTOZ2K3E.js} +1 -1
- package/dist/chunks/{referral-BsAvaATn.js → referral-D26orIXE.js} +1 -1
- package/dist/chunks/{refresh-TlNezXn4.js → refresh-BeSXaVya.js} +1 -1
- package/dist/chunks/{registerProtocol-COUVHFku.js → registerProtocol-DSQh-I21.js} +1 -1
- package/dist/chunks/{registry-m7JojEMY.js → registry-Dp5W2V8B.js} +1 -1
- package/dist/chunks/{release-notes-BDdughgu.js → release-notes-Cg85UVo8.js} +1 -1
- package/dist/chunks/{releaseNotes-Bd3zxid3.js → releaseNotes-Dps4SeVh.js} +2 -2
- package/dist/chunks/{reload-plugins-qUIybHNy.js → reload-plugins-Bo-R1CF3.js} +1 -1
- package/dist/chunks/{remote-env-GGlLNGsx.js → remote-env-ChQuV3rO.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-DpF5alU6.js → remoteBridgeCore-BXtygJA-.js} +1 -1
- package/dist/chunks/{remoteControlServer-C32rxr3F.js → remoteControlServer-sqW_JLwC.js} +1 -1
- package/dist/chunks/{rename-CCF7A5mG.js → rename-Bigaipiq.js} +1 -1
- package/dist/chunks/{resume-C6ereXig.js → resume-CtOI2pOJ.js} +1 -1
- package/dist/chunks/{runtimeObserver-jrNSkZU2.js → runtimeObserver-CJ955XSo.js} +2 -2
- package/dist/chunks/{runtimeObserver-DBdzsp_h.js → runtimeObserver-DojpbVgU.js} +1 -1
- package/dist/chunks/sandbox-adapter-BbrJOJNZ.js +1 -0
- package/dist/chunks/{sandbox-toggle-Bfti5GKF.js → sandbox-toggle-B9dn09gt.js} +1 -1
- package/dist/chunks/searchExtraTools-Denn1c1E.js +1 -0
- package/dist/chunks/{sentry-CZUyEC3A.js → sentry-B6tWUNGj.js} +1 -1
- package/dist/chunks/{session-DCIDa5dI.js → session-C5yIf_zV.js} +1 -1
- package/dist/chunks/{sessionDiscovery-5m_pul65.js → sessionDiscovery-CQ3iMN4s.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-1IAwziOQ.js +1 -0
- package/dist/chunks/sessionMemory-3TAJyNuJ.js +1 -0
- package/dist/chunks/{sessionMemory-BQP_RezB.js → sessionMemory-HZNzEOLd.js} +1 -1
- package/dist/chunks/sessionMemoryUtils-BAkA4sGG.js +1 -0
- package/dist/chunks/sessionObserver-DqLMFMLM.js +1 -0
- package/dist/chunks/{sessionObserver-LBqNoak9.js → sessionObserver-MQA9_wZw.js} +1 -1
- package/dist/chunks/sessionStorage-CFfMypMQ.js +1 -0
- package/dist/chunks/{sessionTitle-BIykjtKk.js → sessionTitle-BafqFHLc.js} +1 -1
- package/dist/chunks/{sessionTracing-Da_r0mIc.js → sessionTracing-_obALZbi.js} +1 -1
- package/dist/chunks/{settingsSync-BE0PQqyo.js → settingsSync-DBWi-NXU.js} +1 -1
- package/dist/chunks/{setup-CjA5bW6e.js → setup-C_GrS0Rd.js} +1 -1
- package/dist/chunks/{setup-lxzmZdw5.js → setup-D1sQnli9.js} +2 -2
- package/dist/chunks/{setup-p04XtwYu.js → setup-DIxsjw17.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-Zqp1M5St.js → shadowedRuleDetection-CwMwv9uM.js} +1 -1
- package/dist/chunks/{sideQuestion-DzJenEES.js → sideQuestion-CI5pyoQF.js} +1 -1
- package/dist/chunks/{sink-N5XR8Zgp.js → sink-BSTUubjl.js} +1 -1
- package/dist/chunks/sink-fGBOXJab.js +1 -0
- package/dist/chunks/{sinks-D8erzS9D.js → sinks-B9EsWFeb.js} +2 -2
- package/dist/chunks/sinks-BCl9slVM.js +1 -0
- package/dist/chunks/{skill-learning-CbMQ8IsZ.js → skill-learning-DThetLpo.js} +1 -1
- package/dist/chunks/{skillChangeDetector-4XWLpjQl.js → skillChangeDetector-BOH-fyEn.js} +1 -1
- package/dist/chunks/{skillGapStore-DbiDG9Pd.js → skillGapStore-BmjCK9ZR.js} +2 -2
- package/dist/chunks/{skillGapStore-Bp5IVfOx.js → skillGapStore-ax0GuSmd.js} +1 -1
- package/dist/chunks/{skillGenerator-Bys7U1l_.js → skillGenerator-Dj3xInwG.js} +2 -2
- package/dist/chunks/skillLearning-BDsjN-u-.js +1 -0
- package/dist/chunks/skillLearning-CXUsWxdi.js +1 -0
- package/dist/chunks/{skillPanel-MIHU1PPp.js → skillPanel-CJ4tvX7A.js} +3 -3
- package/dist/chunks/{skillSearchPanel-MFB-PzB1.js → skillSearchPanel-hwZvXKZ4.js} +2 -2
- package/dist/chunks/{skills-D4tZYFpd.js → skills-BVWDDcD9.js} +1 -1
- package/dist/chunks/{sprites-B479AZSz.js → sprites-B-V9otkt.js} +1 -1
- package/dist/chunks/{stats-B-ErfxCJ.js → stats-DcS6ZnsX.js} +1 -1
- package/dist/chunks/{status-DVACJLsK.js → status-DZKjK9CE.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-CwSCVvxP.js → statusNoticeHelpers-reCcymMR.js} +1 -1
- package/dist/chunks/{tag-YpE2D2ve.js → tag-B5b-waIf.js} +1 -1
- package/dist/chunks/{tasks-7N7iSiEx.js → tasks-vXM-vULI.js} +1 -1
- package/dist/chunks/teamHelpers-BBhol4dD.js +1 -0
- package/dist/chunks/{teamHelpers-BFdTH57t.js → teamHelpers-CbFFdvPw.js} +1 -1
- package/dist/chunks/{teammateModeSnapshot-CwacsQvD.js → teammateModeSnapshot-DkkMv2-b.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-W5G22rwQ.js +1 -0
- package/dist/chunks/{teleport-CPB1CHBs.js → teleport-Da0rKwCo.js} +1 -1
- package/dist/chunks/{templateJobs-BM98KAEH.js → templateJobs-BLQqrGjb.js} +1 -1
- package/dist/chunks/{terminalSetup-yQ0CoywX.js → terminalSetup-BKfVYk3w.js} +1 -1
- package/dist/chunks/{terminalSetup-CGiIwoIX.js → terminalSetup-BLU99dau.js} +1 -1
- package/dist/chunks/{theme-C5ULGNRs.js → theme-BM2CXWYE.js} +1 -1
- package/dist/chunks/{thinkback-CF_sLFvX.js → thinkback-Cd1g_2A9.js} +1 -1
- package/dist/chunks/thinkback-ChP6pvCS.js +1 -0
- package/dist/chunks/{thinkback-play-syg_SJm8.js → thinkback-play-Cg8Ys2dq.js} +1 -1
- package/dist/chunks/{toolEventObserver-CcLqNRcT.js → toolEventObserver-71WYUega.js} +1 -1
- package/dist/chunks/{toolEventObserver-CuJbsUL0.js → toolEventObserver-nxcfjaur.js} +1 -1
- package/dist/chunks/{toolPool-CRq0GSrk.js → toolPool-CN1cPGQz.js} +1 -1
- package/dist/chunks/toolPool-CygNb5cr.js +1 -0
- package/dist/chunks/{trustedDevice-C4tvgByY.js → trustedDevice-Brc9B8cZ.js} +1 -1
- package/dist/chunks/{trustedDevice-u2HpuTkN.js → trustedDevice-C0KJ0qiK.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-CWLiiq-z.js → ultrareviewCommand-BY0T8Pzl.js} +1 -1
- package/dist/chunks/undercover-bx8TwG9W.js +1 -0
- package/dist/chunks/{undercover-CNlN7Xzl.js → undercover-j27F8p49.js} +1 -1
- package/dist/chunks/{updateCCB-BWN4mOEz.js → updateCCB-Dgb2ed9v.js} +1 -1
- package/dist/chunks/upgrade-BkHztwGA.js +1 -0
- package/dist/chunks/{upgrade-CE25mJEk.js → upgrade-zs7K9UkG.js} +1 -1
- package/dist/chunks/{upload-YpyOX2a-.js → upload-Df84yCBz.js} +1 -1
- package/dist/chunks/{usage-Bw-kTwHb.js → usage-DKENFl_k.js} +1 -1
- package/dist/chunks/{usage-DNXwr_ep.js → usage-lTILrQJV.js} +1 -1
- package/dist/chunks/{useMainLoopModel-DPmF_cMn.js → useMainLoopModel-X1PW9z5A.js} +1 -1
- package/dist/chunks/{useManagePlugins-hPG7UMWo.js → useManagePlugins-DDKeDfIv.js} +1 -1
- package/dist/chunks/{useMergedTools-BSO1NflP.js → useMergedTools-CC3XwtOR.js} +1 -1
- package/dist/chunks/{useSearchInput-CR9uhbA7.js → useSearchInput-DNpNG36H.js} +1 -1
- package/dist/chunks/{useSettingsErrors-453j5XuO.js → useSettingsErrors-vGzCYpIA.js} +1 -1
- package/dist/chunks/{useVoice-B5DQ5Tay.js → useVoice-DmObXoAh.js} +1 -1
- package/dist/chunks/{util-D_BHu06u.js → util-9vJ9WIeZ.js} +1 -1
- package/dist/chunks/utils-Dg0S2Vfn.js +1 -0
- package/dist/chunks/{validatePlugin-Dxm-5f8W.js → validatePlugin-_Z4zhjSx.js} +1 -1
- package/dist/chunks/{vim-BGqKMQxl.js → vim-CK7lReJi.js} +1 -1
- package/dist/chunks/{voice-B2MWrkN3.js → voice-BLVF7E3Q.js} +1 -1
- package/dist/chunks/{voiceModeEnabled-if9dV1bW.js → voiceModeEnabled-BpLBjY2-.js} +1 -1
- package/dist/chunks/voiceModeEnabled-BqFYzoXw.js +1 -0
- package/dist/chunks/voiceStreamSTT-C0pkuXGm.js +1 -0
- package/dist/chunks/{voiceStreamSTT-CWhKAxcp.js → voiceStreamSTT-i4tUq3Hu.js} +1 -1
- package/dist/chunks/{workerRegistry-BANOcuS2.js → workerRegistry-Bg7dWLHf.js} +1 -1
- package/dist/chunks/worktree-Cg4p1J__.js +1 -0
- package/dist/chunks/{xml-DZp0WcWT.js → xml-K_hNNh2b.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-CBEOrsej.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-CG26Jg7h.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-1aq67dJV.js +0 -1
- package/dist/chunks/Doctor-DOil8Eh7.js +0 -1
- package/dist/chunks/Grove-CJn8QGFo.js +0 -1
- package/dist/chunks/REPL-DV96-Prr.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-CmyZbRut.js +0 -1
- package/dist/chunks/SentryErrorBoundary-B9sk4zvj.js +0 -1
- package/dist/chunks/api-DgzWK3bh.js +0 -1
- package/dist/chunks/assistant-Ojm6Wsb6.js +0 -1
- package/dist/chunks/auth-lQWhUjLX.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BcLV1-Ap.js +0 -1
- package/dist/chunks/bridgeConfig-ByjfIoJz.js +0 -1
- package/dist/chunks/bridgeEnabled-C7AI9y8g.js +0 -1
- package/dist/chunks/bridgeMain-DKQ1u3k_.js +0 -1
- package/dist/chunks/caches-DbE9R4Zh.js +0 -1
- package/dist/chunks/changeDetector--9sSzU2e.js +0 -1
- package/dist/chunks/channelNotification-CLYOd2-R.js +0 -1
- package/dist/chunks/clear-Cf1D1WkR.js +0 -1
- package/dist/chunks/client-Bzn58Ea4.js +0 -1
- package/dist/chunks/commands-CJz20FMO.js +0 -1
- package/dist/chunks/commitAttribution-BgNel6QS.js +0 -1
- package/dist/chunks/context-noninteractive-CzuLiIeO.js +0 -1
- package/dist/chunks/conversation-D2iFk7Te.js +0 -1
- package/dist/chunks/createSession-XhPMcSns.js +0 -1
- package/dist/chunks/datadog-B5oHSyS1.js +0 -1
- package/dist/chunks/envLessBridgeConfig-DgdkC9jO.js +0 -1
- package/dist/chunks/extra-usage-CsJ9Z2G1.js +0 -1
- package/dist/chunks/extractMemories-D34FfNYT.js +0 -1
- package/dist/chunks/fast-CxPB-PBH.js +0 -1
- package/dist/chunks/gates-D-kXXHiv.js +0 -1
- package/dist/chunks/hooks-Cw-F-1uO.js +0 -1
- package/dist/chunks/inboundAttachments-CZN_sUNx.js +0 -1
- package/dist/chunks/language-DB1HIsF8.js +0 -1
- package/dist/chunks/loadAgentsDir-DsskgPWe.js +0 -1
- package/dist/chunks/localSearch-CScvVw0c.js +0 -1
- package/dist/chunks/login-FdPNsHJs.js +0 -1
- package/dist/chunks/logout-CulTqT7V.js +0 -1
- package/dist/chunks/model-DG0v1297.js +0 -1
- package/dist/chunks/pluginStartupCheck-Ga_XiMnA.js +0 -1
- package/dist/chunks/policyLimits-Dsz-jkpD.js +0 -1
- package/dist/chunks/poorMode-BAuBNURJ.js +0 -1
- package/dist/chunks/prompt-D3rBUscf.js +0 -1
- package/dist/chunks/prompt-ohTcwieE.js +0 -1
- package/dist/chunks/sandbox-adapter-CQ0imVO1.js +0 -1
- package/dist/chunks/searchExtraTools-Ntz1u-YC.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DD2a-mTZ.js +0 -1
- package/dist/chunks/sessionMemory-hbxplpxs.js +0 -1
- package/dist/chunks/sessionMemoryUtils-DlW9hqOH.js +0 -1
- package/dist/chunks/sessionObserver-Lb1c5FPy.js +0 -1
- package/dist/chunks/sessionStorage-DG68Xvsy.js +0 -1
- package/dist/chunks/sink-BdRlnpoG.js +0 -1
- package/dist/chunks/sinks-Bn0FK_Ab.js +0 -1
- package/dist/chunks/skillLearning-702-D6Lq.js +0 -1
- package/dist/chunks/skillLearning-Cz7qU9V6.js +0 -1
- package/dist/chunks/teamHelpers-CmDn2xyl.js +0 -1
- package/dist/chunks/teammateModeSnapshot-DXtG86pG.js +0 -1
- package/dist/chunks/thinkback-D1Fv1QYl.js +0 -1
- package/dist/chunks/toolPool-C4CO158z.js +0 -1
- package/dist/chunks/undercover-jZEIpxrJ.js +0 -1
- package/dist/chunks/upgrade-C_0-l0Zo.js +0 -1
- package/dist/chunks/utils--ZdihcLH.js +0 -1
- package/dist/chunks/voiceModeEnabled-0NU5pSM-.js +0 -1
- package/dist/chunks/voiceStreamSTT-yvcTWD7i.js +0 -1
- package/dist/chunks/worktree-CRn2SbHn.js +0 -1
package/dist/chunks/{WindowsTerminalBackend-Dw6qjsBu.js → WindowsTerminalBackend-CeSoQ_Nk.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./defineProperty-80gRi2ZW.js";import{d as r,s as i}from"./debug-UI3T040K.js";import{i as a,o}from"./platform-CuyedWpe.js";import{r as s,t as c}from"./execFileNoThrow-CuQN1sz8.js";import{Dd as l,Sd as u}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./defineProperty-80gRi2ZW.js";import{d as r,s as i}from"./debug-UI3T040K.js";import{i as a,o}from"./platform-CuyedWpe.js";import{r as s,t as c}from"./execFileNoThrow-CuQN1sz8.js";import{Dd as l,Sd as u}from"./loadAgentsDir-D-xcJ22-.js";import{a as d,r as f}from"./detection-CQsNad64.js";import{tmpdir as p}from"os";import{join as m}from"path";import{randomUUID as h}from"crypto";import{readFile as g,unlink as _}from"fs/promises";function v(e){return`'${e.replace(/'/g,`''`)}'`}function y(e,t){let n=v(t);return[`$ErrorActionPreference = 'Stop'`,`Set-Content -LiteralPath ${n} -Value $PID`,[`try { ${e}; if ($LASTEXITCODE -is [int]) { exit $LASTEXITCODE } }`,`catch { Write-Error $_; exit 1 }`,`finally { Remove-Item -LiteralPath ${n} -Force -ErrorAction SilentlyContinue }`].join(`
|
|
2
2
|
`)].join(`; `)}function b(){let e=process.env.CLAUDE_WT_PANE_TIMEOUT_MS;if(!e)return S;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:S}async function x(e,t){let n=Date.now()+t,r;for(;Date.now()<n;){try{let t=(await g(e,`utf-8`)).trim();if(!/^\d+$/.test(t))r=Error(`pidFile content not a valid pid: ${JSON.stringify(t)}`);else{let e=Number.parseInt(t,10);if(Number.isFinite(e)&&e>0)return e;r=Error(`pidFile content parsed to invalid pid: ${e}`)}}catch(e){r=e}await new Promise(e=>setTimeout(e,C))}throw r??Error(`pidFile never appeared`)}var S,C,w;e((()=>{i(),s(),o(),f(),u(),t(),S=8e3,C=200,w=class{constructor(e,t){n(this,`type`,`windows-terminal`),n(this,`displayName`,`Windows Terminal`),n(this,`supportsHideShow`,!1),n(this,`panes`,new Map),n(this,`runCommand`,void 0),n(this,`getPlatformValue`,void 0),n(this,`pidFileDir`,void 0),typeof e==`function`||e===void 0?(this.runCommand=e??c,this.getPlatformValue=t??a,this.pidFileDir=p()):(this.runCommand=e.runCommand??c,this.getPlatformValue=e.getPlatform??a,this.pidFileDir=e.pidFileDir??p())}makePidFile(e){return m(this.pidFileDir,`${e.replace(/[^a-zA-Z0-9_-]/g,`-`)}.pid`)}async isAvailable(){return this.getPlatformValue()===`windows`?process.env.WT_SESSION?!0:(await this.runCommand(`where.exe`,[`wt.exe`])).code===0:!1}async isRunningInside(){return this.getPlatformValue()===`windows`&&d()}async createTeammatePaneInSwarmView(e,t){let n=`wt-${h()}`,r=this.panes.size===0;return this.panes.set(n,{title:e,mode:`pane`,pidFile:this.makePidFile(n),status:`registered`}),{paneId:n,isFirstTeammate:r}}async createTeammateWindowInSwarmView(e,t){let n=`wt-${h()}`,r=`teammate-${e.replace(/[^a-zA-Z0-9]/g,`-`).toLowerCase()}`;return this.panes.set(n,{title:e,mode:`window`,pidFile:this.makePidFile(n),status:`registered`}),{paneId:n,isFirstTeammate:!1,windowName:r}}async sendCommandToPane(e,t,n){let r=this.panes.get(e);if(!r)throw Error(`Unknown Windows Terminal pane id: ${e}`);if(r.status===`ready`||r.status===`killing`)throw Error(`Pane ${e} already spawned (status=${r.status}); create a new pane to re-launch`);if(r.status===`spawning`)throw Error(`Pane ${e} is currently spawning; wait for the in-flight launch to complete`);if(r.status===`dead`)throw Error(`Pane ${e} is dead; create a new pane`);let i,a,o=new Promise((e,t)=>{i=e,a=t});o.catch(()=>{}),r.status=`spawning`,r.spawnPromise=o;try{let n=y(t,r.pidFile),a=Buffer.from(n,`utf16le`).toString(`base64`),o=r.mode===`window`?[`-w`,`-1`,`new-tab`,`--title`,r.title]:[`-w`,`0`,`split-pane`,`--vertical`,`--title`,r.title];await _(r.pidFile).catch(()=>{});let s=await this.runCommand(`wt.exe`,[...o,`powershell.exe`,`-NoLogo`,`-NoProfile`,`-ExecutionPolicy`,`Bypass`,`-EncodedCommand`,a]);if(s.code!==0)throw Error(`Failed to launch Windows Terminal teammate ${e}: ${s.stderr}`);let c=b(),l;try{l=await x(r.pidFile,c)}catch(t){throw Error(`Windows Terminal pane failed to launch within ${c}ms\n paneId: ${e}\n pidFile: ${r.pidFile}\n wt.exe stdout: ${s.stdout||`(empty)`}\n wt.exe stderr: ${s.stderr||`(empty)`}\n underlying: ${t instanceof Error?t.message:String(t)}\n override timeout via env CLAUDE_WT_PANE_TIMEOUT_MS`)}r.pid=l,r.status=`ready`,i()}catch(e){throw r.status=`dead`,r.pid=void 0,a(e),e}finally{r.spawnPromise=void 0}}async setPaneBorderColor(e,t,n){}async setPaneTitle(e,t,n,r){}async enablePaneBorderStatus(e,t){}async rebalancePanes(e,t){}async killPane(e,t){let n=this.panes.get(e);if(!n)return!1;if(n.status===`spawning`&&n.spawnPromise&&await n.spawnPromise.catch(()=>{}),n.status===`dead`)return this.panes.delete(e),!1;if(n.status!==`ready`)return!1;n.status=`killing`;let i=n.pid;if(i===void 0){let t=null;for(let r=0;r<3;r++)try{t=(await g(n.pidFile,`utf-8`)).trim();break}catch{if(r===2)return n.status=`dead`,this.panes.delete(e),!1;await new Promise(e=>setTimeout(e,500))}if(!t||!/^\d+$/.test(t))return n.status=`dead`,this.panes.delete(e),!1;let r=Number.parseInt(t,10);if(!Number.isFinite(r)||r<=0)return n.status=`dead`,this.panes.delete(e),!1;i=r}let a=await this.runCommand(`powershell.exe`,[`-NoLogo`,`-NoProfile`,`-Command`,`Stop-Process -Id ${i} -Force -ErrorAction Stop`]);return n.pid=void 0,n.status=`dead`,this.panes.delete(e),r(`[WindowsTerminalBackend] killPane ${e} pid=${i} code=${a.code}`),a.code===0}async hidePane(e,t){return!1}async showPane(e,t,n){return!1}},l(w)}))();export{};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{In as i,Ln as a,Rn as o,b as s,t as c,x as l}from"./src-Di342QoJ.js";import{t as u}from"./jsx-runtime-D-D469L8.js";import{Cn as d,cn as f,g as p}from"./state-sIHsFpDu.js";import{B as m,Gw as h,R as g,Ww as _,dD as v,oD as y,sA as b,uA as x,uD as S,z as C}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{In as i,Ln as a,Rn as o,b as s,t as c,x as l}from"./src-Di342QoJ.js";import{t as u}from"./jsx-runtime-D-D469L8.js";import{Cn as d,cn as f,g as p}from"./state-sIHsFpDu.js";import{B as m,Gw as h,R as g,Ww as _,dD as v,oD as y,sA as b,uA as x,uD as S,z as C}from"./loadAgentsDir-D-xcJ22-.js";import{n as w,t as T}from"./AddWorkspaceDirectory-CGKtPsTK.js";function E({message:e,args:t,onDone:n}){return(0,O.useEffect)(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,k.jsxs)(l,{flexDirection:`column`,children:[(0,k.jsxs)(s,{dimColor:!0,children:[r.pointer,` /add-dir `,t]}),(0,k.jsx)(_,{children:(0,k.jsx)(s,{children:e})})]})}async function D(e,t,n){let r=(n??``).trim(),a=t.getAppState(),o=async(n,r=!1)=>{let a={type:`addDirectories`,directories:[n],destination:r?`localSettings`:`session`},o=y(t.getAppState().toolPermissionContext,a);t.setAppState(e=>({...e,toolPermissionContext:o}));let s=p();s.includes(n)||d([...s,n]),b.refreshConfig();let c;if(r)try{v(a),c=`Added ${i.bold(n)} as a working directory and saved to local settings`}catch(e){c=`Added ${i.bold(n)} as a working directory. Failed to save to local settings: ${e instanceof Error?e.message:`Unknown error`}`}else c=`Added ${i.bold(n)} as a working directory for this session`;e(`${c} ${i.dim(`· /permissions to manage`)}`)};if(!r)return(0,k.jsx)(T,{permissionContext:a.toolPermissionContext,onAddDirectory:o,onCancel:()=>{e(`Did not add a working directory.`)}});let s=await m(r,a.toolPermissionContext);if(s.resultType!==`success`){let t=g(s);return(0,k.jsx)(E,{message:t,args:n??``,onDone:()=>e(t)})}return(0,k.jsx)(T,{directoryPath:s.absolutePath,permissionContext:a.toolPermissionContext,onAddDirectory:o,onCancel:()=>{e(`Did not add ${i.bold(s.absolutePath)} as a working directory.`)}})}var O,k;e((()=>{a(),n(),O=t(o(),1),f(),h(),w(),c(),S(),x(),C(),k=u()}))();export{D as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{nc as t,tc as n}from"./paths-D9CVAtXU.js";import{T_ as r,w_ as i}from"./loadAgentsDir-D-xcJ22-.js";function a(e,t){let n=new Map;for(let e of t)n.set(e.agentType,e);let r=new Set,i=[];for(let t of e){let e=`${t.agentType}:${t.source}`;if(r.has(e))continue;r.add(e);let a=n.get(t.agentType),o=a&&a.source!==t.source?a.source:void 0;i.push({...t,overriddenBy:o})}return i}function o(e){let t=e.model||i();if(t)return t===`inherit`?`inherit`:t}function s(e){return n(e).toLowerCase()}function c(e,t){return e.agentType.localeCompare(t.agentType,void 0,{sensitivity:`base`})}var l,u=e((()=>{r(),t(),l=[{label:`User agents`,source:`userSettings`},{label:`Project agents`,source:`projectSettings`},{label:`Local agents`,source:`localSettings`},{label:`Managed agents`,source:`policySettings`},{label:`Plugin agents`,source:`plugin`},{label:`CLI arg agents`,source:`flagSettings`},{label:`Built-in agents`,source:`built-in`}]}));export{o as a,u as i,c as n,a as o,s as r,l as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,t}from"./cwd--iizewsn.js";import{i as n,o as r,r as i}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,t}from"./cwd--iizewsn.js";import{i as n,o as r,r as i}from"./loadAgentsDir-D-xcJ22-.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-DJgsfIlm.js";o(),r(),e();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:e}=await n(t()),r=c(e,i(e)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
|
|
2
2
|
`).trimEnd()))}export{f as agentsHandler};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{g as i}from"./client-_sjL0I7A.js";import{n as a,t as o}from"./figures-gfT9mM8P.js";import{In as s,Ln as c,Rn as l,b as u,f as d,g as f,h as p,m,t as h,tt as g,x as _}from"./src-Di342QoJ.js";import{t as v}from"./jsx-runtime-D-D469L8.js";import{Ct as y,cn as b}from"./state-sIHsFpDu.js";import{$o as x,Bc as S,Bl as ee,Do as C,Fa as te,Hc as ne,Na as re,Po as ie,a as ae,ec as oe,jo as se,ls as ce,nc as le,rs as ue,s as de,us as fe,zl as pe}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{g as i}from"./client-_sjL0I7A.js";import{n as a,t as o}from"./figures-gfT9mM8P.js";import{In as s,Ln as c,Rn as l,b as u,f as d,g as f,h as p,m,t as h,tt as g,x as _}from"./src-Di342QoJ.js";import{t as v}from"./jsx-runtime-D-D469L8.js";import{Ct as y,cn as b}from"./state-sIHsFpDu.js";import{$o as x,Bc as S,Bl as ee,Do as C,Fa as te,Hc as ne,Na as re,Po as ie,a as ae,ec as oe,jo as se,ls as ce,nc as le,rs as ue,s as de,us as fe,zl as pe}from"./paths-D9CVAtXU.js";import{K as me,R as he,T as ge,V as _e,w as ve}from"./debug-UI3T040K.js";import{n as ye,r as be}from"./analytics-DqMQntaB.js";import{n as xe,t as Se}from"./cwd--iizewsn.js";import{t as Ce}from"./sdk-DEtgRZvI.js";import{o as we,s as Te}from"./log-CzsijfHZ.js";import{b as Ee,x as De}from"./teammate-DMYOtLTK.js";import{E as Oe,x as ke}from"./startupProfiler-DnXZaX4A.js";import{$y as Ae,Ap as je,BS as Me,Bc as Ne,Bp as Pe,Bx as Fe,C_ as Ie,Dp as Le,Ep as Re,Gf as ze,Gn as Be,HE as Ve,Hw as He,IE as Ue,Kf as We,Ko as Ge,Ku as Ke,LE as qe,LO as Je,LS as Ye,Lf as Xe,Lo as Ze,Lp as Qe,Mp as $e,Np as et,Nx as tt,OD as nt,Px as rt,RE as it,RS as at,Rf as ot,Rp as st,S_ as ct,Sy as lt,T_ as ut,Un as dt,Vc as ft,Vg as pt,Vw as mt,Wf as ht,Wn as gt,bo as _t,by as vt,c as yt,cE as bt,c_ as xt,eC as w,eb as St,hC as Ct,hp as wt,hu as Tt,jp as Et,kD as Dt,l as Ot,lt as kt,mC as At,mp as jt,mu as Mt,nb as Nt,np as Pt,nw as Ft,o as It,o_ as Lt,qf as Rt,qu as zt,r as Bt,rb as Vt,rt as Ht,rw as Ut,s as Wt,sE as Gt,s_ as Kt,st as qt,t as Jt,tC as T,tb as Yt,tp as Xt,tt as Zt,vk as Qt,yk as $t,zg as en,zp as tn,zx as nn}from"./loadAgentsDir-D-xcJ22-.js";import{Bn as rn,Vn as an}from"./prompt-C69iv9cI.js";import{X as on}from"./rcDebugLog-CTOZ2K3E.js";import{t as E}from"./useKeybinding-FsOnjW6T.js";import{l as sn,u as cn}from"./referral-D26orIXE.js";import{r as ln,t as un}from"./TungstenTool-V-Bwqlx3.js";import{a as dn,i as fn,n as pn,o as mn,r as hn,t as gn}from"./agentDisplay-DJgsfIlm.js";import{n as _n,t as vn}from"./useMergedTools-CC3XwtOR.js";import{n as yn,r as bn,t as xn}from"./promptEditor-BZqpLrcZ.js";import{n as Sn,t as Cn}from"./useMainLoopModel-X1PW9z5A.js";import{join as D}from"path";import{mkdir as wn,open as Tn,unlink as En}from"fs/promises";var O,Dn=e((()=>{O={FOLDER_NAME:`.claude`,AGENTS_DIR:`agents`}}));function On(e,t,n,r,i,a,o,s){return`---
|
|
2
2
|
name: ${e}
|
|
3
3
|
description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${s===void 0?``:`\neffort: ${s}`}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
|
|
4
4
|
---
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as e,I as t,N as n,O as r,P as i,j as a}from"./teamHelpers-
|
|
1
|
+
import{H as e,I as t,N as n,O as r,P as i,j as a}from"./teamHelpers-CbFFdvPw.js";import{s as o,u as s}from"./logoV2Utils-C2cdcgtp.js";i(),s();var c=`default`;async function l(e,t){let n=await r(t.list||c,{subject:e,description:t.description||``,status:`pending`,blocks:[],blockedBy:[]});console.log(`Created task ${n}: ${e}`)}async function u(e){let n=await t(e.list||c);if(e.pending&&(n=n.filter(e=>e.status===`pending`)),e.json){console.log(JSON.stringify(n,null,2));return}if(n.length===0){console.log(`No tasks found.`);return}for(let e of n)console.log(` [${e.status}] ${e.id}: ${e.subject}`),e.description&&console.log(` ${e.description}`),e.owner&&console.log(` owner: ${e.owner}`)}async function d(e,t){let n=await a(t.list||c,e);if(!n){console.error(`Task not found: ${e}`),process.exitCode=1;return}console.log(JSON.stringify(n,null,2))}async function f(t,n){let r=n.list||c,i={};n.status&&(i.status=n.status),n.subject&&(i.subject=n.subject),n.description&&(i.description=n.description),n.owner&&(i.owner=n.owner),n.clearOwner&&(i.owner=void 0);let a=await e(r,t,i);if(!a){console.error(`Task not found: ${t}`),process.exitCode=1;return}console.log(`Updated task ${t}: [${a.status}] ${a.subject}`)}async function p(e){let t=e.list||c;console.log(n(t))}async function m(e){let t=await o();if(e===void 0){if(t.length===0){console.log(`No recent sessions.`);return}for(let e=0;e<Math.min(t.length,20);e++){let n=t[e],r=n.modified?new Date(n.modified).toLocaleString():`unknown`,i=n.title||n.sessionId||`untitled`;console.log(` ${e}: ${i} (${r})`)}return}let n=typeof e==`string`?parseInt(e,10):e,r=Number.isFinite(n)&&n>=0&&n<t.length?t[n]:t.find(t=>t.sessionId===String(e));if(!r){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(JSON.stringify(r,null,2))}async function h(e){let t=await o(),n=e??5;console.log(`Last ${n} sessions:`);for(let e=0;e<Math.min(n,t.length);e++){let n=t[e],r=n.modified?new Date(n.modified).toLocaleString():`unknown`;console.log(` ${e}: ${n.sessionId} (${r})`)}}async function g(e,t){let{writeFile:n,readFile:r}=await import(`fs/promises`),i=await o(),a=parseInt(e,10),s;if(s=Number.isFinite(a)&&a>=0&&a<i.length?i[a]:i.find(t=>t.sessionId===e),!s)try{await n(t,await r(e,`utf-8`),`utf-8`),console.log(`Exported ${e} → ${t}`);return}catch{console.error(`Source not found: ${e}`),process.exitCode=1;return}await n(t,JSON.stringify(s,null,2),`utf-8`),console.log(`Exported session ${s.sessionId} → ${t}`)}async function _(e,t,n){let{regenerateCompletionCache:r}=await import(`./completionCache-DHfUBBMH.js`);t.output,await r(),console.log(`Completion cache regenerated for ${e}.`)}export{_ as completionHandler,h as errorHandler,g as exportHandler,m as logHandler,l as taskCreateHandler,p as taskDirHandler,d as taskGetHandler,u as taskListHandler,f as taskUpdateHandler};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,o as n}from"./api-nHsRf03G.js";n();export{t as fetchCodeSessionsFromSessionsAPI,e as getOAuthHeaders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{n as r,t as i}from"./v4-f1i_CNUT.js";import{Ac as a,Jt as o,Sc as s,la as c,on as l,ua as u}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{n as r,t as i}from"./v4-f1i_CNUT.js";import{Ac as a,Jt as o,Sc as s,la as c,on as l,ua as u}from"./paths-D9CVAtXU.js";import{E as d,K as f,L as p,V as m,d as h,s as g,w as _}from"./debug-UI3T040K.js";import{l as v,u as y}from"./oauth-CdZEzMww.js";import{o as b,s as x}from"./log-CzsijfHZ.js";import{n as S,t as C}from"./lazySchema-2sOku3cX.js";import{n as w,t as T}from"./sleep-8Eb9j_Ly.js";import{a as E,o as D}from"./detectRepository-CBk3S2zv.js";import{randomUUID as O}from"crypto";function k(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function A(e,n){let r;for(let i=0;i<=V;i++)try{return await t.get(e,n)}catch(e){if(r=e,!k(e))throw e;if(i>=V)throw h(`Teleport request failed after ${i+1} attempts: ${p(e)}`),e;let t=B[i]??2e3;h(`Teleport request failed (attempt ${i+1}/${V+1}), retrying in ${t}ms: ${p(e)}`),await w(t)}throw r}function j(e){return e===null||typeof e==`string`&&e.trim()===``}async function M(){let e=s(),t=process.env.ANTHROPIC_API_KEY?.trim()||e.workspaceApiKey?.trim();if(!t){let t=e.workspaceApiKey,n=j(t)?`Your workspace API key was cleared. `:`A workspace API key (sk-ant-api03-*) is required to use workspace endpoints (/v1/agents, /v1/vaults, /v1/memory_stores, /v1/skills). `;throw Error(n+`Press W in /login to save your key directly (no restart needed), or set ANTHROPIC_API_KEY=<key> and restart. Obtain a key from https://console.anthropic.com/settings/keys. Subscription OAuth (claude.ai login) cannot reach these endpoints.`)}if(!t.startsWith(`sk-ant-api03-`))throw Error(`Workspace API key must start with sk-ant-api03-, got prefix "${t.slice(0,4)}...". Obtain a workspace API key from https://console.anthropic.com/settings/keys. Press W in /login to save your key, or set ANTHROPIC_API_KEY.`);return{apiKey:t}}async function N(){let e=o()?.accessToken;if(e===void 0)throw Error(`Claude Code web sessions require authentication with a Claude.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.`);let t=await c();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function P(){let{accessToken:e,orgUUID:t}=await N(),n=`${v().BASE_API_URL}/v1/sessions`;try{let r=await A(n,{headers:{...F(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=D(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw x(f(e)),e}}function F(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function I(e){let{accessToken:n,orgUUID:r}=await N(),i=`${v().BASE_API_URL}/v1/sessions/${e}`,a={...F(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired. Please run /login to sign in again.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function L(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function R(e,n,r){try{let{accessToken:i,orgUUID:a}=await N(),o=`${v().BASE_API_URL}/v1/sessions/${e}/events`,s={...F(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},c={events:[{uuid:r?.uuid??O(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};h(`[sendEventToRemoteSession] Sending event to session ${e}`);let l=await t.post(o,c,{headers:s,validateStatus:e=>e<500,timeout:3e4});return l.status===200||l.status===201?(h(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(h(`[sendEventToRemoteSession] Failed with status ${l.status}: ${d(l.data)}`),!1)}catch(e){return h(`[sendEventToRemoteSession] Error: ${p(e)}`),!1}}async function z(e,n){try{let{accessToken:r,orgUUID:i}=await N(),a=`${v().BASE_API_URL}/v1/sessions/${e}`,o={...F(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};h(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let s=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return s.status===200?(h(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(h(`[updateSessionTitle] Failed with status ${s.status}: ${d(s.data)}`),!1)}catch(e){return h(`[updateSessionTitle] Error: ${p(e)}`),!1}}var B,V,H=e((()=>{n(),y(),u(),i(),l(),a(),g(),E(),m(),C(),b(),T(),_(),B=[2e3,4e3,8e3,16e3],V=B.length,S(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{F as a,j as c,R as d,z as f,L as i,N as l,P as n,H as o,I as r,k as s,A as t,M as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,K as a,cn as o}from"./state-sIHsFpDu.js";import{n as s,t as c}from"./cwd--iizewsn.js";import{Ad as l,Fy as u,Iy as d,kd as f}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,K as a,cn as o}from"./state-sIHsFpDu.js";import{n as s,t as c}from"./cwd--iizewsn.js";import{Ad as l,Fy as u,Iy as d,kd as f}from"./loadAgentsDir-D-xcJ22-.js";import{A as p,B as m,P as h,R as g,a as _,c as v,i as y,p as b,y as x}from"./teamHelpers-CbFFdvPw.js";import{a as S,c as C}from"./constants-41VpZw2G.js";import{join as w}from"path";import{readFileSync as T}from"fs";var E=t({getAssistantActivationPath:()=>M,getAssistantSystemPromptAddendum:()=>j,initializeAssistantTeam:()=>A,isAssistantForced:()=>k,isAssistantMode:()=>D,markAssistantForced:()=>O});function D(){return a()}function O(){N=!0}function k(){return N}async function A(){let e=i(),t=b(`assistant-${e.slice(0,8)}`),n=u(S,t),r=y(t),a=Date.now(),o=c(),s=f(n);return await x(t,{name:t,description:`Assistant mode in-process team`,createdAt:a,leadAgentId:n,leadSessionId:e,members:[{agentId:n,name:S,agentType:`assistant`,color:s,joinedAt:a,tmuxPaneId:``,cwd:o,subscriptions:[],backendType:`in-process`}]}),v(t),await g(t),await p(t),m(t),{teamName:t,teamFilePath:r,leadAgentId:n,selfAgentId:n,selfAgentName:S,isLeader:!0,selfAgentColor:s,teammates:{[n]:{name:S,agentType:`assistant`,color:s,tmuxSessionName:`in-process`,tmuxPaneId:`leader`,cwd:o,spawnedAt:a}}}}function j(){try{return T(w(n(),`agents`,`assistant.md`),`utf-8`)}catch{return``}}function M(){if(D())return N?`daemon`:`gate`}var N,P=e((()=>{o(),d(),s(),r(),C(),_(),l(),h(),N=!1}));export{A as a,O as c,P as i,M as n,k as o,j as r,D as s,E as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{K as u,Kn as d,cn as f}from"./state-sIHsFpDu.js";import{r as p,v as m}from"./git-CN3qtTb_.js";import{Fx as h,Rx as g}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{K as u,Kn as d,cn as f}from"./state-sIHsFpDu.js";import{r as p,v as m}from"./git-CN3qtTb_.js";import{Fx as h,Rx as g}from"./loadAgentsDir-D-xcJ22-.js";import{t as _}from"./useKeybinding-FsOnjW6T.js";import{t as v}from"./Dialog-DYFGqyDs.js";import{t as y}from"./ListItem-OFARanN7.js";import{i as b,o as x,t as S}from"./cliLaunch-BQa48gsr.js";import{resolve as C}from"path";async function w(){let e=process.cwd();return p(e)||C(e)}function T({defaultDir:e,onInstalled:t,onCancel:n,onError:s}){g(`assistant-install-wizard`);let[l,u]=(0,D.useState)(0),[d,f]=(0,D.useState)(!1);o({"select:next":()=>u(e=>(e+1)%2),"select:previous":()=>u(e=>(e-1+2)%2),"select:accept":()=>{l===0?p():n()}},{context:`Select`});function p(){if(d)return;f(!0);let n=e||C(`.`);try{let e=x(S([`daemon`,`start`,`--dir=${n}`]),{cwd:n,stdio:`ignore`,detached:!0});e.unref(),e.on(`error`,e=>{s(`Failed to start daemon: ${e.message}`)}),setTimeout(()=>{t(n)},1500)}catch(e){s(`Failed to start daemon: ${e instanceof Error?e.message:String(e)}`)}}return d?(0,O.jsx)(a,{title:`Assistant Setup`,onCancel:n,hideInputGuide:!0,children:(0,O.jsxs)(r,{children:[`Starting daemon in `,e,`...`]})}):(0,O.jsx)(a,{title:`Assistant Setup`,onCancel:n,hideInputGuide:!0,children:(0,O.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,O.jsx)(r,{children:`No active assistant sessions found.`}),(0,O.jsxs)(r,{children:[`Start a daemon in `,(0,O.jsx)(r,{bold:!0,children:e||`.`}),` to create a cloud session?`]}),(0,O.jsxs)(c,{flexDirection:`column`,children:[(0,O.jsx)(i,{isFocused:l===0,children:(0,O.jsx)(r,{children:`Start assistant daemon`})}),(0,O.jsx)(i,{isFocused:l===1,children:(0,O.jsx)(r,{children:`Cancel`})})]}),(0,O.jsx)(r,{dimColor:!0,children:`Enter to select · Esc to cancel`})]})})}async function E(e,t,n){let{setAppState:r,getAppState:i}=t;return u()?(i().assistantPanelVisible?(r(e=>({...e,assistantPanelVisible:!1})),e(`Assistant panel hidden.`,{display:`system`})):(r(e=>({...e,assistantPanelVisible:!0})),e(`Assistant panel opened.`,{display:`system`})),null):(d(!0),r(e=>({...e,kairosEnabled:!0,assistantPanelVisible:!0})),e(`KAIROS assistant mode activated.`,{display:`system`}),null)}var D,O;e((()=>{n(),D=t(n(),1),s(),v(),y(),h(),_(),m(),b(),f(),O=l()}))();export{T as NewInstallWizard,E as call,w as computeDefaultInstallDir};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,s as t}from"./assistant-BJbeizyH.js";e();export{t as isAssistantMode};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Cb as e,Sb as t,bb as n,xb as r}from"./loadAgentsDir-D-xcJ22-.js";e();export{n as authLogin,r as authLogout,t as authStatus};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jt as e,Pt as t,cn as n,nn as r,on as i,zt as a}from"./paths-
|
|
1
|
+
import{Jt as e,Pt as t,cn as n,nn as r,on as i,zt as a}from"./paths-D9CVAtXU.js";i();export{t as checkAndRefreshOAuthTokenIfNeeded,a as clearOAuthTokenCache,e as getClaudeAIOAuthTokens,r as handleOAuth401Error,n as isAnthropicAuthEnabled};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Br as e,Dr as t,Ga as n,Mr as r,Pr as i,oo as a}from"./paths-
|
|
1
|
+
import{Br as e,Dr as t,Ga as n,Mr as r,Pr as i,oo as a}from"./paths-D9CVAtXU.js";import{E as o,L as s,V as c,w as l}from"./debug-UI3T040K.js";import{d_ as u,f_ as d,l_ as f,p_ as p,u_ as m}from"./loadAgentsDir-D-xcJ22-.js";import{n as h,t as g}from"./poorMode-D7WXWZtJ.js";c(),i(),u(),a(),g(),d(),l();function _(e){process.stdout.write(o(e,null,2)+`
|
|
2
2
|
`)}function v(){_(m())}function y(){let e=n(),t=m();_({allow:e?.allow?.length?e.allow:t.allow,soft_deny:e?.soft_deny?.length?e.soft_deny:t.soft_deny,environment:e?.environment?.length?e.environment:t.environment})}var b=`You are an expert reviewer of auto mode classifier rules for Claude Code.
|
|
3
3
|
|
|
4
4
|
Claude Code has an "auto mode" that uses an AI classifier to decide whether tool calls should be auto-approved or require user confirmation. Users can write custom rules in three categories:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,c as t,i as n,m as r,n as i,o as a,r as o,t as s}from"./autonomy-
|
|
1
|
+
import{a as e,c as t,i as n,m as r,n as i,o as a,r as o,t as s}from"./autonomy-Lc78acHX.js";r();export{s as autonomyFlowCancelHandler,i as autonomyFlowHandler,o as autonomyFlowResumeHandler,n as autonomyFlowsHandler,e as autonomyRunsHandler,a as autonomyStatusHandler,t as getAutonomyCommandText};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,s as n}from"./envUtils-BWeoiL4Y.js";import{cn as r,ut as i}from"./state-sIHsFpDu.js";import{s as a,u as ee}from"./types-Csi32ZXh.js";import{$D as o,D as te,EO as ne,QD as s,S as c,ZD as re,aO as ie,cO as l,cf as u,eO as d,hO as f,iO as p,lO as m,lf as ae,oO as h,rO as oe,sO as se,sf as ce,tO as g,uO as le,w as ue,xO as de}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,s as n}from"./envUtils-BWeoiL4Y.js";import{cn as r,ut as i}from"./state-sIHsFpDu.js";import{s as a,u as ee}from"./types-Csi32ZXh.js";import{$D as o,D as te,EO as ne,QD as s,S as c,ZD as re,aO as ie,cO as l,cf as u,eO as d,hO as f,iO as p,lO as m,lf as ae,oO as h,rO as oe,sO as se,sf as ce,tO as g,uO as le,w as ue,xO as de}from"./loadAgentsDir-D-xcJ22-.js";import{G as fe,U as pe,V as me}from"./prompt-C69iv9cI.js";import{n as he,r as _}from"./cron-DiW7eIPP.js";import{I as v,P as y}from"./teamHelpers-CbFFdvPw.js";import{a as b,n as x,o as S,t as C}from"./bridgeConfig-CvKdNJOg.js";import{i as w,o as T}from"./bg-DK0E4ZtW.js";import{n as E,t as D}from"./state-Ce1HlR-H.js";import{a as O,i as k,n as A,r as j}from"./pipeTransport-wjeyTgon.js";import{join as M}from"path";import"crypto";import{readFile as N,readdir as P}from"fs/promises";function F(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function I(e){return typeof e==`string`&&V.includes(e)}function L(e){return typeof e==`string`&&H.includes(e)}function R(e){return!F(e)||typeof e.name!=`string`||!L(e.status)?null:{name:e.name,...typeof e.prompt==`string`?{prompt:e.prompt}:{},status:e.status,...typeof e.startedAt==`number`?{startedAt:e.startedAt}:{},...typeof e.completedAt==`number`?{completedAt:e.completedAt}:{}}}function ge(e){if(!F(e)||typeof e.runId!=`string`||typeof e.workflow!=`string`||!I(e.status)||typeof e.createdAt!=`number`||typeof e.updatedAt!=`number`||typeof e.currentStepIndex!=`number`||!Array.isArray(e.steps))return null;let t=e.steps.map(R).filter(e=>e!==null);return t.length===e.steps.length?{runId:e.runId,workflow:e.workflow,...typeof e.args==`string`?{args:e.args}:{},status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,currentStepIndex:e.currentStepIndex,steps:t}:null}async function _e(e,t){try{return ge(ee(await N(M(e,z,`${t}.json`),`utf-8`),!1))}catch{return null}}async function ve(e=i()){let t;try{t=await P(M(e,z))}catch{return[]}let n=t.filter(e=>e.endsWith(`.json`));return(await Promise.all(n.slice(0,B).map(t=>_e(e,t.slice(0,-5))))).filter(e=>e!==null).sort((e,t)=>t.updatedAt-e.updatedAt)}function ye(e){if(e.length===0)return[`Workflow runs: 0`,` none`].join(`
|
|
2
2
|
`);let t=e.filter(e=>e.status===`running`).length,n=e.filter(e=>e.status===`completed`).length,r=e.filter(e=>e.status===`cancelled`).length,i=[`Workflow runs: ${e.length}`,` Running: ${t}`,` Completed: ${n}`,` Cancelled: ${r}`];for(let t of e.slice(0,10)){let e=t.steps[t.currentStepIndex];i.push(` ${t.runId}: ${t.workflow}: ${t.status} step=${e?.name??`none`} updated=${new Date(t.updatedAt).toLocaleString()}`)}return e.length>10&&i.push(` ... ${e.length-10} more workflow run(s)`),i.join(`
|
|
3
3
|
`)}var z,B,V,H,be=e((()=>{r(),a(),z=M(`.claude`,`workflow-runs`),B=200,V=[`running`,`completed`,`cancelled`],H=[`pending`,`running`,`completed`,`cancelled`]}));function xe(){return M(A(),`registry.json`)}async function Se(){try{let e=await N(xe(),`utf8`),t=JSON.parse(e);return t.version===1?t:{...U}}catch{return{...U}}}var U,Ce=e((()=>{j(),U={version:1,mainMachineId:null,main:null,subs:[]}}));async function we(){return Te(await Se())}function Te(e){let t=[`Pipe registry: ${+!!e.main} main, ${e.subs.length} sub(s)`];e.mainMachineId&&t.push(` main_machine=${e.mainMachineId.slice(0,8)}...`),e.main&&t.push(` [main] ${e.main.pipeName} pid=${e.main.pid} host=${e.main.hostname} tcp=${e.main.tcpPort??`none`}`);for(let n of e.subs.slice(0,10))t.push(` [sub-${n.subIndex}] ${n.pipeName} pid=${n.pid} host=${n.hostname} bound=${n.boundToMain??`none`} tcp=${n.tcpPort??`none`}`);return!e.main&&e.subs.length===0&&t.push(` none`),e.subs.length>10&&t.push(` ... ${e.subs.length-10} more sub pipe(s)`),t.join(`
|
|
4
4
|
`)}var Ee=e((()=>{Ce()}));function De(){try{let e=S(),t=C();return[`Remote Control: ${e?`self-hosted`:`official`}`,` base_url=${x()}`,` token=${t?`present`:`missing`}`,` entitlement=checked at remote-control startup`].join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,f as i,t as a,x as o,xt as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Fx as l,Rx as u,cO as d,lO as f}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,f as i,t as a,x as o,xt as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Fx as l,Rx as u,cO as d,lO as f}from"./loadAgentsDir-D-xcJ22-.js";import{c as p,l as m,m as h,p as g}from"./autonomy-Lc78acHX.js";function _(){return S}function v({onDone:e}){u(`autonomy-panel`);let[t,n]=(0,b.useState)(0),[a,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return f().then(t=>{e||c(t.slice(0,5))}),()=>{e=!0}},[]);let l=(0,b.useMemo)(()=>{let e=[{label:`Overview`,description:`Show run and flow counts plus the latest automatic activity`,run:()=>g()},{label:`Full deep status`,description:`Print every local autonomy surface in one diagnostic report`,run:()=>g({deep:!0})},{label:`Auto mode`,description:`Check whether auto permission mode is available and why`,run:()=>m(`auto-mode`)},{label:`Runs summary`,description:`Show queued/running/completed/failed run totals and latest run`,run:()=>m(`runs`)},{label:`Recent runs`,description:`List recent autonomy run IDs, triggers, statuses, and prompts`,run:()=>p(`runs 10`)},{label:`Flows summary`,description:`Show managed flow totals across queued/running/waiting states`,run:()=>m(`flows`)},{label:`Recent flows`,description:`List recent managed flow IDs, status, current step, and goal`,run:()=>p(`flows 10`)},{label:`Cron`,description:`Show scheduled autonomy jobs, durability, recurrence, and next run`,run:()=>m(`cron`)},{label:`Workflow runs`,description:`Show persisted WorkflowTool runs and their current workflow step`,run:()=>m(`workflow-runs`)},{label:`Teams`,description:`Show Agent Teams, teammate backends, activity, and open tasks`,run:()=>m(`teams`)},{label:`Pipes`,description:`Show UDS/named-pipe and LAN registry for terminal messaging`,run:()=>m(`pipes`)},{label:`Runtime`,description:`Show daemon state and live background or interactive sessions`,run:()=>m(`runtime`)},{label:`Remote Control`,description:`Show bridge mode, base URL, token presence, and entitlement note`,run:()=>m(`remote-control`)},{label:`RemoteTrigger`,description:`Show recent remote trigger audit records, failures, and latest call`,run:()=>m(`remote-trigger`)}],t=a.flatMap(e=>{let t=e.flowId.slice(0,8),n=[{label:`Flow ${t}`,description:`${e.status}: ${e.goal}`,run:()=>p(`flow ${e.flowId}`)}];return e.status===`waiting`&&n.push({label:`Resume ${t}`,description:e.currentStep?`Resume waiting step: ${e.currentStep}`:`Resume waiting flow`,run:()=>p(`flow resume ${e.flowId}`,{enqueueInMemory:!0})}),(e.status===`queued`||e.status===`running`||e.status===`waiting`||e.status===`blocked`)&&n.push({label:`Cancel ${t}`,description:`Cancel ${e.status} flow`,run:()=>p(`flow cancel ${e.flowId}`,{removeQueuedInMemory:!0})}),n});return[...e,...t]},[a]),d=()=>{let n=l[t];n&&n.run().then(t=>{e(t,{display:`system`})})};return s((e,t)=>{if(t.upArrow){n(e=>Math.max(0,e-1));return}if(t.downArrow){n(e=>Math.min(l.length-1,e+1));return}t.return&&d()}),(0,x.jsx)(i,{title:`Autonomy`,subtitle:`${l.length} actions`,onCancel:()=>e(`Autonomy panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,x.jsxs)(o,{flexDirection:`column`,children:[l.map((e,n)=>(0,x.jsxs)(o,{flexDirection:`row`,children:[(0,x.jsx)(r,{children:`${n===t?`›`:` `} ${e.label}`.padEnd(C)}),(0,x.jsx)(r,{dimColor:!0,children:e.description})]},`${e.label}-${n}`)),(0,x.jsx)(o,{marginTop:1,children:(0,x.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function y(e,t,n){let r=n?.trim()??``;return r?(e(await p(r,{enqueueInMemory:!0,removeQueuedInMemory:!0}),{display:`system`}),null):(0,x.jsx)(v,{onDone:e})}var b,x,S,C;e((()=>{b=t(n(),1),a(),l(),h(),d(),x=c(),S=14,C=24}))();export{y as call,_ as getAutonomyPanelBaseActionCountForTests};
|
package/dist/chunks/{backgroundHousekeeping-KGRk7QeA.js → backgroundHousekeeping-BkfWgzIP.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,H as a,X as o,cn as s}from"./state-sIHsFpDu.js";import{Fa as c,Mr as l,Na as u,Pr as d,S as f,co as p,no as ee,oo as te}from"./paths-
|
|
1
|
+
import{a as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,H as a,X as o,cn as s}from"./state-sIHsFpDu.js";import{Fa as c,Mr as l,Na as u,Pr as d,S as f,co as p,no as ee,oo as te}from"./paths-D9CVAtXU.js";import{K as ne,V as m,d as h,h as re,p as g,s as ie,w as _}from"./debug-UI3T040K.js";import{n as ae,r as v}from"./analytics-DqMQntaB.js";import{n as y,t as b}from"./cwd--iizewsn.js";import{o as x,s as S,v as C,y as w}from"./log-CzsijfHZ.js";import{E as T,O as E,T as oe}from"./teammate-DMYOtLTK.js";import{Ar as se,Co as ce,Gl as le,HE as ue,IE as de,Ib as D,LE as O,LO as k,Lb as A,Lo as j,ND as M,OD as N,RE as P,Rb as F,So as I,TS as L,Vb as R,Wl as z,aC as B,bo as V,gC as H,kD as fe,pt as pe,rC as me,rt as he,tt as U,vC as ge,wS as _e,wt as ve,xr as ye}from"./loadAgentsDir-D-xcJ22-.js";import{Bn as be,Vn as xe}from"./prompt-C69iv9cI.js";import{X as Se}from"./rcDebugLog-CTOZ2K3E.js";import{n as Ce,r as we}from"./magicDocs-BBjAhGN1.js";import{n as Te,t as Ee}from"./pluginAutoupdate-DCc5qDvo.js";import{n as De,r as Oe}from"./registerProtocol-DSQh-I21.js";import{homedir as ke}from"os";import{join as W}from"path";import"crypto";import*as G from"fs/promises";r(),s(),y(),_(),re(),ie(),w(),te(),c(),d(),f(),xe(),M(),de(),le(),se(),we(),U(),x(),m(),j(),k(),U(),fe(),m(),x(),j(),k();async function Ae(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),a=n(b(),`.claude`,`skills`,e,`SKILL.md`),o;try{o=await r.readFile(a,`utf-8`)}catch{S(Error(`Failed to read skill file for improvement: ${a}`));return}let s=t.map(e=>`- ${e.section}: ${e.change}`).join(`
|
|
2
2
|
`),c=l(),d=ue()?O({sessionId:i(),model:c,provider:u(),name:`skill-improvement-apply`}):null,f=await he({messages:[V({content:`You are editing a skill definition file. Apply the following improvements to the skill.
|
|
3
3
|
|
|
4
4
|
<current_skill_file>
|
|
@@ -14,4 +14,4 @@ Rules:
|
|
|
14
14
|
- Preserve frontmatter (--- block) exactly as-is
|
|
15
15
|
- Preserve the overall format and style
|
|
16
16
|
- Do not remove existing content unless an improvement explicitly replaces it
|
|
17
|
-
- Output the complete updated file inside <updated_file> tags`})],systemPrompt:Se([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:N().signal,options:{getToolPermissionContext:async()=>be(),model:c,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[],langfuseTrace:d}});P(d);let p=I(ce(Array.isArray(f.message.content)?f.message.content:[]).trim(),`updated_file`);if(!p){S(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(a,p,`utf-8`)}catch(e){S(ne(e))}}ae(),B(),oe(),x(),F(),L(),A(),ge(),ve();var je=30;function K(){let e=((ee()||{}).cleanupPeriodDays??je)*24*60*60*1e3;return new Date(Date.now()-e)}function Me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function Ne(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function q(e,t,n){let r={messages:0,errors:0};try{let i=await g().readdir(e);for(let a of i)try{Ne(a.name)<t&&(await g().unlink(W(e,a.name)),n?r.messages++:r.errors++)}catch(e){S(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&S(e)}return r}async function Pe(){let e=g(),t=K(),n=C.errors(),r=C.baseLogs(),i=await q(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>W(r,e.name));for(let n of a)i=Me(i,await q(n,t,!0)),await Y(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&S(e)}return i}async function J(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Y(e,t){try{await t.rmdir(e)}catch{}}async function Fe(){let e=K(),t={messages:0,errors:0},n=ye(),r=g(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=W(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=W(i,n.name),o=W(a,H),s;try{s=await r.readdir(o)}catch{await Y(a,r);continue}for(let n of s)if(n.isFile())try{await J(W(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=W(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Y(i,r)}await Y(o,r),await Y(a,r)}await Y(i,r)}return t}async function Ie(e,t,n=!0){let r=K(),i={messages:0,errors:0},a=g(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await J(W(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Y(e,a),i}function Le(){return Ie(W(n(),`plans`),`.md`)}async function Re(){let e=K(),t={messages:0,errors:0},r=g();try{let i=W(n(),`file-history`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));await Promise.all(o.map(async n=>{try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}})),await Y(i,r)}catch(e){S(e)}return t}async function ze(){let e=K(),t={messages:0,errors:0},r=g();try{let i=W(n(),`session-env`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));for(let n of o)try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}await Y(i,r)}catch(e){S(e)}return t}async function X(){let e=K(),t={messages:0,errors:0},r=g(),i=W(n(),`debug`),a;try{a=await r.readdir(i)}catch{return t}for(let n of a)if(!(!n.isFile()||!n.name.endsWith(`.txt`)||n.name===`latest`))try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}return t}var Z=1440*60*1e3;async function Q(){let e=W(n(),`.npm-cache-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){h(`npm cache cleanup: skipping, ran recently`);return}}catch{}try{await T(e,{retries:0,realpath:!1})}catch{h(`npm cache cleanup: skipping, lock held`);return}h(`npm cache cleanup: starting`);let r=W(ke(),`.npm`,`_cacache`),i=Date.now();try{let n=await import(`./lib-inCisXen.js`).then(e=>t(e.default,1)),a=i-Z,o=n.ls.stream(r),s=[];for await(let e of o)e.key.includes(`@anthropic-ai/claude-`)&&s.push({key:e.key,time:e.time});let c=new Map;for(let e of s){let t=e.key.lastIndexOf(`@`),n=t>0?e.key.slice(0,t):e.key,r=c.get(n)??[];r.push(e),c.set(n,r)}let l=[];for(let[,e]of c){e.sort((e,t)=>t.time-e.time);for(let t=0;t<e.length;t++){let n=e[t];(n.time<a||t>=5)&&l.push(n.key)}}await Promise.all(l.map(e=>n.rm.entry(r,e))),await G.writeFile(e,new Date().toISOString());let u=Date.now()-i;l.length>0?h(`npm cache cleanup: Removed ${l.length} old @anthropic-ai entries in ${u}ms`):h(`npm cache cleanup: completed in ${u}ms`),v(`tengu_npm_cache_cleanup`,{success:!0,durationMs:u,entriesRemoved:l.length})}catch(e){S(e),v(`tengu_npm_cache_cleanup`,{success:!1,durationMs:Date.now()-i})}finally{await E(e,{realpath:!1}).catch(()=>{})}}async function Be(){let e=W(n(),`.version-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){h(`version cleanup: skipping, ran recently`);return}}catch{}try{await T(e,{retries:0,realpath:!1})}catch{h(`version cleanup: skipping, lock held`);return}h(`version cleanup: starting (throttled)`);try{await R(),await G.writeFile(e,new Date().toISOString())}catch(e){S(e)}finally{await E(e,{realpath:!1}).catch(()=>{})}}async function Ve(){let{errors:e}=D();if(e.length>0&&p(`cleanupPeriodDays`)){h(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await Pe(),await Fe(),await Le(),await Re(),await ze(),await X(),await me(),await _e(K());let t=await pe(K());t>0&&v(`tengu_worktree_cleanup`,{removed:t}),process.env.USER_TYPE===`ant`&&await Q()}s(),F(),Te();var He=(De(),e(Oe)),Ue=1440*60*1e3,$=600*1e3;function We(){Ce(),import(`./extractMemories-
|
|
17
|
+
- Output the complete updated file inside <updated_file> tags`})],systemPrompt:Se([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:N().signal,options:{getToolPermissionContext:async()=>be(),model:c,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[],langfuseTrace:d}});P(d);let p=I(ce(Array.isArray(f.message.content)?f.message.content:[]).trim(),`updated_file`);if(!p){S(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(a,p,`utf-8`)}catch(e){S(ne(e))}}ae(),B(),oe(),x(),F(),L(),A(),ge(),ve();var je=30;function K(){let e=((ee()||{}).cleanupPeriodDays??je)*24*60*60*1e3;return new Date(Date.now()-e)}function Me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function Ne(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function q(e,t,n){let r={messages:0,errors:0};try{let i=await g().readdir(e);for(let a of i)try{Ne(a.name)<t&&(await g().unlink(W(e,a.name)),n?r.messages++:r.errors++)}catch(e){S(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&S(e)}return r}async function Pe(){let e=g(),t=K(),n=C.errors(),r=C.baseLogs(),i=await q(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>W(r,e.name));for(let n of a)i=Me(i,await q(n,t,!0)),await Y(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&S(e)}return i}async function J(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Y(e,t){try{await t.rmdir(e)}catch{}}async function Fe(){let e=K(),t={messages:0,errors:0},n=ye(),r=g(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=W(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=W(i,n.name),o=W(a,H),s;try{s=await r.readdir(o)}catch{await Y(a,r);continue}for(let n of s)if(n.isFile())try{await J(W(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=W(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Y(i,r)}await Y(o,r),await Y(a,r)}await Y(i,r)}return t}async function Ie(e,t,n=!0){let r=K(),i={messages:0,errors:0},a=g(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await J(W(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Y(e,a),i}function Le(){return Ie(W(n(),`plans`),`.md`)}async function Re(){let e=K(),t={messages:0,errors:0},r=g();try{let i=W(n(),`file-history`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));await Promise.all(o.map(async n=>{try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}})),await Y(i,r)}catch(e){S(e)}return t}async function ze(){let e=K(),t={messages:0,errors:0},r=g();try{let i=W(n(),`session-env`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));for(let n of o)try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}await Y(i,r)}catch(e){S(e)}return t}async function X(){let e=K(),t={messages:0,errors:0},r=g(),i=W(n(),`debug`),a;try{a=await r.readdir(i)}catch{return t}for(let n of a)if(!(!n.isFile()||!n.name.endsWith(`.txt`)||n.name===`latest`))try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}return t}var Z=1440*60*1e3;async function Q(){let e=W(n(),`.npm-cache-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){h(`npm cache cleanup: skipping, ran recently`);return}}catch{}try{await T(e,{retries:0,realpath:!1})}catch{h(`npm cache cleanup: skipping, lock held`);return}h(`npm cache cleanup: starting`);let r=W(ke(),`.npm`,`_cacache`),i=Date.now();try{let n=await import(`./lib-inCisXen.js`).then(e=>t(e.default,1)),a=i-Z,o=n.ls.stream(r),s=[];for await(let e of o)e.key.includes(`@anthropic-ai/claude-`)&&s.push({key:e.key,time:e.time});let c=new Map;for(let e of s){let t=e.key.lastIndexOf(`@`),n=t>0?e.key.slice(0,t):e.key,r=c.get(n)??[];r.push(e),c.set(n,r)}let l=[];for(let[,e]of c){e.sort((e,t)=>t.time-e.time);for(let t=0;t<e.length;t++){let n=e[t];(n.time<a||t>=5)&&l.push(n.key)}}await Promise.all(l.map(e=>n.rm.entry(r,e))),await G.writeFile(e,new Date().toISOString());let u=Date.now()-i;l.length>0?h(`npm cache cleanup: Removed ${l.length} old @anthropic-ai entries in ${u}ms`):h(`npm cache cleanup: completed in ${u}ms`),v(`tengu_npm_cache_cleanup`,{success:!0,durationMs:u,entriesRemoved:l.length})}catch(e){S(e),v(`tengu_npm_cache_cleanup`,{success:!1,durationMs:Date.now()-i})}finally{await E(e,{realpath:!1}).catch(()=>{})}}async function Be(){let e=W(n(),`.version-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){h(`version cleanup: skipping, ran recently`);return}}catch{}try{await T(e,{retries:0,realpath:!1})}catch{h(`version cleanup: skipping, lock held`);return}h(`version cleanup: starting (throttled)`);try{await R(),await G.writeFile(e,new Date().toISOString())}catch(e){S(e)}finally{await E(e,{realpath:!1}).catch(()=>{})}}async function Ve(){let{errors:e}=D();if(e.length>0&&p(`cleanupPeriodDays`)){h(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await Pe(),await Fe(),await Le(),await Re(),await ze(),await X(),await me(),await _e(K());let t=await pe(K());t>0&&v(`tengu_worktree_cleanup`,{removed:t}),process.env.USER_TYPE===`ant`&&await Q()}s(),F(),Te();var He=(De(),e(Oe)),Ue=1440*60*1e3,$=600*1e3;function We(){Ce(),import(`./extractMemories-CA2eJwHy.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),z(),Ee(),a()&&He.ensureDeepLinkProtocolRegistered();let e=!0;async function t(){if(a()&&o()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Ve()),a()&&o()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await R()}setTimeout(t,$).unref(),process.env.USER_TYPE===`ant`&&setInterval(()=>{Q(),Be()},Ue).unref()}export{Ae as n,We as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./backgroundHousekeeping-BkfWgzIP.js";export{e as startBackgroundHousekeeping};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n,ot as r}from"./state-sIHsFpDu.js";import{jo as i,ko as a}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n,ot as r}from"./state-sIHsFpDu.js";import{jo as i,ko as a}from"./paths-D9CVAtXU.js";import{E as o,w as s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{c as u,s as d}from"./types-Csi32ZXh.js";import{Ar as f,Er as p,Ir as m,Si as h,Tr as g,_i as _,br as v}from"./loadAgentsDir-D-xcJ22-.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),i=t(),a=v(r()),s=p(n),c=g();await b(a,{recursive:!0,mode:448});let l;try{l=await x(c)}catch{throw Error(`No conversation to branch`)}if(l.length===0)throw Error(`No conversation to branch`);let d=u(l),f=d.filter(e=>m(e)&&!e.isSidechain),h=d.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(f.length===0)throw Error(`No messages to branch`);let _=null,C=[],w=[];for(let e of f){let t={...e,sessionId:n,parentUuid:_,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(o(t)),e.type!==`progress`&&(_=e.uuid)}if(h.length>0){let e={type:`content-replacement`,sessionId:n,replacements:h};C.push(o(e))}return await S(s,C.join(`
|
|
2
2
|
`)+`
|
|
3
3
|
`,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:s,serializedMessages:w,contentReplacementRecords:h}}async function T(e){let t=`${e} (Branch)`;if((await h(t,{exact:!0})).length===0)return t;let n=await h(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${a(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let o=2;for(;r.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,n,r){let i=r?.trim()||void 0,a=t();try{let{sessionId:t,title:r,forkPath:o,serializedMessages:s,contentReplacementRecords:c}=await w(i),u=new Date,d=C(s.find(e=>e.type===`user`)),f=await T(r??d);await _(t,f,o),l(`tengu_conversation_forked`,{message_count:s.length,has_custom_title:!!r});let p={date:u.toISOString().split(`T`)[0],messages:s,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:s.length,isSidechain:!1,sessionId:t,customTitle:f,contentReplacements:c},m=r?` "${r}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${a}`}`;return n.resume?(await n.resume(t,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${t}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{n(),c(),d(),f(),s(),i()}))();export{E as call,C as deriveFirstPrompt};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{d as u,s as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{BS as m,Fx as h,LS as g,RS as _,Rx as v}from"./loadAgentsDir-
|
|
2
|
-
`).filter(e=>e.length>0):[];return(0,B.jsx)(a,{title:`Remote Control`,onCancel:C,hideInputGuide:!0,children:(0,B.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,B.jsxs)(r,{children:[`This session is available via Remote Control`,b?` at ${b}`:``,`.`]}),f&&w.length>0&&(0,B.jsx)(c,{flexDirection:`column`,children:w.map((e,t)=>(0,B.jsx)(r,{children:e},t))}),(0,B.jsxs)(c,{flexDirection:`column`,children:[(0,B.jsx)(i,{isFocused:u===0,children:(0,B.jsx)(r,{children:`Disconnect this session`})}),(0,B.jsx)(i,{isFocused:u===1,children:(0,B.jsx)(r,{children:f?`Hide QR code`:`Show QR code`})}),(0,B.jsx)(i,{isFocused:u===2,children:(0,B.jsx)(r,{children:`Continue`})})]}),(0,B.jsx)(r,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function I(){let{waitForPolicyLimitsToLoad:e,isPolicyAllowed:t}=await import(`./policyLimits-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{d as u,s as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{BS as m,Fx as h,LS as g,RS as _,Rx as v}from"./loadAgentsDir-D-xcJ22-.js";import{t as y}from"./useKeybinding-FsOnjW6T.js";import{a as b,t as x}from"./bridgeConfig-CvKdNJOg.js";import{n as S,r as C,s as w,t as T}from"./bridgeEnabled-D01faWms.js";import{a as E,i as D,n as O}from"./types-RJTEOuIt.js";import{t as k}from"./lib-B4Q0Nrpb.js";import{i as A,n as j}from"./envLessBridgeConfig-D4bSwf7w.js";import{n as M,r as N}from"./RemoteCallout-WWO84za-.js";function P({onDone:e,name:t}){let n=m(),r=_(e=>e.replBridgeConnected),i=_(e=>e.replBridgeEnabled),a=_(e=>e.replBridgeOutboundOnly),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{if((r||i)&&!a){s(!0);return}let o=!1;return(async()=>{let r=await I();if(!o){if(r){p(`tengu_bridge_command`,{action:`preflight_failed`}),e(r,{display:`system`});return}if(N()){n(e=>e.showRemoteCallout?e:{...e,showRemoteCallout:!0,replBridgeInitialName:t}),e(``,{display:`system`});return}p(`tengu_bridge_command`,{action:`connect`}),n(e=>e.replBridgeEnabled&&!e.replBridgeOutboundOnly?e:{...e,replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1,replBridgeInitialName:t}),e(`Remote Control connecting…`,{display:`system`})}})(),()=>{o=!0}},[]),o?(0,B.jsx)(F,{onDone:e}):null}function F({onDone:e}){v(`bridge-disconnect-dialog`);let t=m(),n=_(e=>e.replBridgeSessionUrl),s=_(e=>e.replBridgeConnectUrl),l=_(e=>e.replBridgeSessionActive),[u,d]=(0,z.useState)(2),[f,h]=(0,z.useState)(!1),[g,y]=(0,z.useState)(``),b=l?n:s;(0,z.useEffect)(()=>{if(!f||!b){y(``);return}(0,R.toString)(b,{type:`utf8`,errorCorrectionLevel:`L`,small:!0}).then(y).catch(()=>y(``))},[f,b]);function x(){t(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),p(`tengu_bridge_command`,{action:`disconnect`}),e(D,{display:`system`})}function S(){h(e=>!e)}function C(){e(void 0,{display:`skip`})}o({"select:next":()=>d(e=>(e+1)%3),"select:previous":()=>d(e=>(e-1+3)%3),"select:accept":()=>{u===0?x():u===1?S():C()}},{context:`Select`});let w=g?g.split(`
|
|
2
|
+
`).filter(e=>e.length>0):[];return(0,B.jsx)(a,{title:`Remote Control`,onCancel:C,hideInputGuide:!0,children:(0,B.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,B.jsxs)(r,{children:[`This session is available via Remote Control`,b?` at ${b}`:``,`.`]}),f&&w.length>0&&(0,B.jsx)(c,{flexDirection:`column`,children:w.map((e,t)=>(0,B.jsx)(r,{children:e},t))}),(0,B.jsxs)(c,{flexDirection:`column`,children:[(0,B.jsx)(i,{isFocused:u===0,children:(0,B.jsx)(r,{children:`Disconnect this session`})}),(0,B.jsx)(i,{isFocused:u===1,children:(0,B.jsx)(r,{children:f?`Hide QR code`:`Show QR code`})}),(0,B.jsx)(i,{isFocused:u===2,children:(0,B.jsx)(r,{children:`Continue`})})]}),(0,B.jsx)(r,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function I(){let{waitForPolicyLimitsToLoad:e,isPolicyAllowed:t}=await import(`./policyLimits-sh7ywop0.js`);if(await e(),!t(`allow_remote_control`))return`Remote Control is disabled by your organization's policy.`;let n=await S();if(n)return n;let r=w();if(r){let{isAssistantMode:e}=await import(`./assistant-Dvx-UrTi.js`);e()&&(r=!1)}return(r?await j():T())||(x()?(u(`[bridge] Prerequisites passed, enabling bridge`),null):O)}async function L(e,t,n){return(0,B.jsx)(P,{onDone:e,name:n.trim()||void 0})}var R,z,B;e((()=>{R=k(),n(),z=t(n(),1),b(),C(),A(),E(),s(),M(),h(),y(),f(),g(),d(),B=l()}))();export{L as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Jt as t,on as n}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Jt as t,on as n}from"./paths-D9CVAtXU.js";import{l as r,u as i}from"./oauth-CdZEzMww.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??t()?.accessToken}function c(){return o()??r().BASE_API_URL}function l(){return!!o()}var u=e((()=>{i(),n()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,n as t,o as n,t as r}from"./bridgeConfig-CvKdNJOg.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./bridgeEnabled-D01faWms.js";t();export{n as checkBridgeMinVersion,e as getBridgeDisabledReason};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t}from"./envUtils-BWeoiL4Y.js";import{S as n,Zt as r,_ as i,an as a,dn as o,g as s,l as c,on as l}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t}from"./envUtils-BWeoiL4Y.js";import{S as n,Zt as r,_ as i,an as a,dn as o,g as s,l as c,on as l}from"./paths-D9CVAtXU.js";import{i as u,r as d}from"./semver-Tw0AFar5.js";import{a as f,o as p}from"./bridgeConfig-CvKdNJOg.js";function m(){return p()?!0:_()&&i(`tengu_ccr_bridge`,!1)}async function h(){return p()?!0:_()&&await c(`tengu_ccr_bridge`)}async function g(){return p()?null:_()?v()?y()?.organizationUuid?await c(`tengu_ccr_bridge`)?null:`Remote Control is not yet enabled for your account.`:"Unable to determine your organization for Remote Control eligibility. Run `claude auth login` to refresh your account information.":"Remote Control requires a full-scope login token. Long-lived tokens (from `claude setup-token` or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only for security reasons. Run `claude auth login` to use Remote Control.":"Remote Control requires a claude.ai subscription. Run `claude auth login` to sign in with your claude.ai account."}function _(){try{return o()}catch{return!1}}function v(){try{return a()}catch{return!1}}function y(){try{return r()}catch{return}}function b(){return i(`tengu_bridge_repl_v2`,!1)}function x(){return i(`tengu_bridge_repl_v2_cse_shim_enabled`,!0)}function S(){{let e=s(`tengu_bridge_min_version`,{minVersion:`0.0.0`});if(e.minVersion&&u(`2.6.11`,e.minVersion))return`Your version of Claude Code (2.6.11) is too old for Remote Control.\nVersion ${e.minVersion} or higher is required. Run \`claude update\` to update.`}return null}var C=e((()=>{n(),f(),l(),t(),d()}));export{h as a,m as i,g as n,x as o,C as r,b as s,S as t};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{d as e,s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Cn as r,In as i,Ln as a,t as o}from"./src-Di342QoJ.js";import{Gs as s,M as c,S as l,Us as u,Ws as d,l as f,z as p}from"./paths-
|
|
1
|
+
import{d as e,s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Cn as r,In as i,Ln as a,t as o}from"./src-Di342QoJ.js";import{Gs as s,M as c,S as l,Us as u,Ws as d,l as f,z as p}from"./paths-D9CVAtXU.js";import{E as m,L as h,T as g,V as _,d as v,s as y,w as b}from"./debug-UI3T040K.js";import{i as x,n as S,r as C}from"./analytics-DqMQntaB.js";import{F as w,P as T}from"./git-CN3qtTb_.js";import{o as E,s as D}from"./log-CzsijfHZ.js";import{E as O,d as k,x as A}from"./startupProfiler-DnXZaX4A.js";import{n as j,t as M}from"./sleep-8Eb9j_Ly.js";import{Aa as N,Da as P,Ma as F,Oa as ee,_b as te,cb as I,dE as ne,db as L,fE as R,fb as z,gb as B,gt as V,hb as H,ja as re,ka as U,kt as W,pb as G,ub as K,wt as q}from"./loadAgentsDir-D-xcJ22-.js";import{n as ie,t as J}from"./rcDebugLog-CTOZ2K3E.js";import{c as Y,d as ae,f as oe,n as se,o as ce,r as le}from"./debugUtils-BBMFODKH.js";import{r as ue,t as de}from"./datadog-FKvRNyFi.js";import{a as X,i as fe}from"./trustedDevice-Brc9B8cZ.js";import{a as Z,t as pe}from"./types-RJTEOuIt.js";import{t as Q}from"./lib-B4Q0Nrpb.js";import{i as me,n as he,r as ge}from"./cliLaunch-BQa48gsr.js";import{t as _e}from"./capacityWake-BXlUpptF.js";import{t as $}from"./jwtUtils-CpXwh_du.js";import{t as ve}from"./pollConfig-xYxAmuXi.js";import{a as ye,i as be,n as xe,r as Se,t as Ce}from"./workSecret-mS2OrpxF.js";import{hostname as we,tmpdir as Te}from"os";import{basename as Ee,dirname as De,join as Oe,resolve as ke}from"path";import{createWriteStream as Ae}from"fs";import{randomUUID as je}from"crypto";import{spawn as Me}from"child_process";import{createInterface as Ne}from"readline";t(),S(),_(),b(),T(),E(),A(),M(),c(),l(),R(),de(),ce(),J(),Z(),U(),q(),me(),a();var Pe=Q();s(),o(),y(),H();var Fe={type:`utf8`,errorCorrectionLevel:`L`,small:!0};async function Ie(e){return(await(0,Pe.toString)(e,Fe)).split(`
|
|
2
2
|
`).filter(e=>e.length>0)}function Le(e){let t=e.write??(e=>process.stdout.write(e)),n=e.verbose,a=0,o=`idle`,s=`Ready`,c=``,l=``,f=``,p=``,m=``,h=``,g=null,_=[],y=!1,b=null,x=0,S=0,C=1,w=null,T=`single-session`,E=new Map,D=null,A=0;function j(e){let t=process.stdout.columns||80,n=0;for(let i of e.split(`
|
|
3
3
|
`)){if(i.length===0){n++;continue}let e=r(i);n+=Math.max(1,Math.ceil(e/t))}return e.endsWith(`
|
|
4
4
|
`)&&n--,n}function M(e){t(e),a+=j(e)}function N(){a<=0||(v(`[bridge:ui] clearStatusLines count=${a}`),t(`\x1b[${a}A`),t(`\x1B[J`),a=0)}function P(e){N(),t(e)}function F(e){Ie(e).then(e=>{_=e,V()}).catch(e=>{v(`QR code generation failed: ${e}`,{level:`error`})})}function ee(){N();let e=d[A%d.length],t=``;c&&(t+=i.dim(` · `)+i.dim(c)),l&&(t+=i.dim(` · `)+i.dim(l)),M(`${i.yellow(e)} ${i.yellow(`Connecting`)}${t}\n`)}function ne(){R(),ee(),D=setInterval(()=>{A++,ee()},150)}function R(){D&&(clearInterval(D),D=null)}function V(){if(o===`reconnecting`||o===`failed`)return;N();let e=o===`idle`;if(y)for(let e of _)M(`${i.dim(e)}\n`);let t=u,n=e?i.green:i.cyan,r=(e?i.green:i.cyan)(s),a=``;if(c&&(a+=i.dim(` · `)+i.dim(c)),l&&T!==`worktree`&&(a+=i.dim(` · `)+i.dim(l)),process.env.USER_TYPE===`ant`&&f&&M(`${i.yellow(`[ANT-ONLY] Logs:`)} ${i.dim(f)}\n`),M(`${n(t)} ${r}${a}\n`),C>1){let e=T===`worktree`?`New sessions will be created in an isolated worktree`:`New sessions will be created in the current directory`;M(` ${i.dim(`Capacity: ${S}/${C} \u00b7 ${e}`)}\n`);for(let[,e]of E){let t=te(e.title?O(e.title,35):i.dim(`Attached`),e.url),n=e.activity;M(` ${t}${n&&n.type!==`result`&&n.type!==`error`?i.dim(` ${O(n.summary,40)}`):``}
|
|
5
5
|
`)}}if(C===1){let e=T===`single-session`?`Single session · exits when complete`:T===`worktree`?`Capacity: ${S}/1 \u00b7 New sessions will be created in an isolated worktree`:`Capacity: ${S}/1 \u00b7 New sessions will be created in the current directory`;M(` ${i.dim(e)}\n`)}C===1&&!e&&b&&Date.now()-x<3e4&&M(` ${i.dim(O(b,60))}\n`);let d=g??p;if(d){M(`
|
|
6
|
-
`);let t=e?G(d):K(d),n=y?i.dim.italic(`space to hide QR code`):i.dim.italic(`space to show QR code`),r=w?i.dim.italic(` · w to toggle spawn mode`):``;M(`${i.dim(t)}\n`),M(`${n}${r}\n`)}}return{printBanner(e,r){m=e.sessionIngressUrl,h=r,p=L(r,m),F(p),n&&t(i.dim(`Remote Control`)+` v2.6.
|
|
6
|
+
`);let t=e?G(d):K(d),n=y?i.dim.italic(`space to hide QR code`):i.dim.italic(`space to show QR code`),r=w?i.dim.italic(` · w to toggle spawn mode`):``;M(`${i.dim(t)}\n`),M(`${n}${r}\n`)}}return{printBanner(e,r){m=e.sessionIngressUrl,h=r,p=L(r,m),F(p),n&&t(i.dim(`Remote Control`)+` v2.6.11
|
|
7
7
|
`),n&&(e.spawnMode!==`single-session`&&(t(i.dim(`Spawn mode: `)+`${e.spawnMode}\n`),t(i.dim(`Max concurrent sessions: `)+`${e.maxSessions}\n`)),t(i.dim(`Environment ID: `)+`${r}\n`)),e.sandbox&&t(i.dim(`Sandbox: `)+`${i.green(`Enabled`)}\n`),t(`
|
|
8
8
|
`),ne()},logSessionStart(e,t){if(n){let n=O(t,80);P(i.dim(`[${B()}]`)+` Session started: ${i.white(`"${n}"`)} (${i.dim(e)})\n`)}},logSessionComplete(e,t){P(i.dim(`[${B()}]`)+` Session ${i.green(`completed`)} (${k(t)}) ${i.dim(e)}\n`)},logSessionFailed(e,t){P(i.dim(`[${B()}]`)+` Session ${i.red(`failed`)}: ${t} ${i.dim(e)}\n`)},logStatus(e){P(i.dim(`[${B()}]`)+` ${e}\n`)},logVerbose(e){n&&P(i.dim(`[${B()}] ${e}`)+`
|
|
9
9
|
`)},logError(e){P(i.red(`[${B()}] Error: ${e}`)+`
|
|
@@ -12,7 +12,7 @@ import{d as e,s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Cn as r,In as i,
|
|
|
12
12
|
`),e.onDebug(`[bridge:ws] sessionId=${t.sessionId} <<< ${se(n)}`),e.verbose&&process.stderr.write(n+`
|
|
13
13
|
`);let r=Ue(n,t.sessionId,e.onDebug);for(let n of r)u.length>=Re&&u.shift(),u.push(n),d=n,e.onActivity?.(t.sessionId,n);{let r;try{r=g(n)}catch{}if(r&&typeof r==`object`){let n=r;if(n.type===`control_request`)n.request?.subtype===`can_use_tool`&&e.onPermissionRequest&&e.onPermissionRequest(t.sessionId,r,t.accessToken);else if(n.type===`user`&&!h&&t.onFirstUserMessage){let e=We(n);e&&(h=!0,t.onFirstUserMessage(e))}}}});let _=new Promise(n=>{l.on(`close`,(r,i)=>{a&&(a.end(),a=null),i===`SIGTERM`||i===`SIGINT`?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} interrupted signal=${i} pid=${l.pid}`),n(`interrupted`)):r===0?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} completed exit_code=0 pid=${l.pid}`),n(`completed`)):(e.onDebug(`[bridge:session] sessionId=${t.sessionId} failed exit_code=${r} pid=${l.pid}`),n(`failed`))}),l.on(`error`,r=>{e.onDebug(`[bridge:session] sessionId=${t.sessionId} spawn error: ${r.message}`),n(`failed`)})}),v={sessionId:t.sessionId,done:_,activities:u,accessToken:t.accessToken,lastStderr:f,get currentActivity(){return d},kill(){l.killed||(e.onDebug(`[bridge:session] Sending SIGTERM to sessionId=${t.sessionId} pid=${l.pid}`),process.platform===`win32`?l.kill():l.kill(`SIGTERM`))},forceKill(){!p&&l.pid&&(p=!0,e.onDebug(`[bridge:session] Sending SIGKILL to sessionId=${t.sessionId} pid=${l.pid}`),process.platform===`win32`?l.kill():l.kill(`SIGKILL`))},writeStdin(n){l.stdin&&!l.stdin.destroyed&&(e.onDebug(`[bridge:ws] sessionId=${t.sessionId} >>> ${se(n)}`),l.stdin.write(n))},updateAccessToken(n){v.accessToken=n,v.writeStdin(m({type:`update_environment_variables`,variables:{CLAUDE_CODE_SESSION_ACCESS_TOKEN:n}})+`
|
|
14
14
|
`),e.onDebug(`[bridge:session] Sent token refresh via stdin for sessionId=${t.sessionId}`)}};return v}}}y(),H(),ce(),X();var qe={connInitialMs:2e3,connCapMs:12e4,connGiveUpMs:6e5,generalInitialMs:500,generalCapMs:3e4,generalGiveUpMs:6e5},Je=1e3,Ye=32;async function Xe(){return f(`tengu_ccr_bridge_multi_session`)}function Ze(e){return e.connCapMs*2}function Qe(){let e=[...he()],t=ge();return t&&e.push(t),e}function $e(e,t,n){try{return e.spawn(t,n)}catch(e){let t=h(e);return D(Error(`Session spawn failed: ${t}`)),t}}async function et(t,r,i,a,o,s,c,l=qe,u,d){let f=new AbortController;c.aborted?f.abort():c.addEventListener(`abort`,()=>f.abort(),{once:!0});let p=f.signal,m=new Map,g=new Map,_=new Map,y=new Map,b=new Map,x=new Map,S=new Set,T=new Map,E=new Set,O=new Set,A=_e(p);async function M(){ie(`heartbeat: checking ${m.size} active session(s)`);let e=!1,t=!1,n=[];for(let[i]of m){let o=_.get(i),s=b.get(i);if(!(!o||!s))try{await a.heartbeatWork(r,o,s),e=!0}catch(e){v(`[bridge:heartbeat] Failed for sessionId=${i} workId=${o}: ${h(e)}`),e instanceof P&&(C(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),e.status===401||e.status===403?n.push(i):t=!0)}}for(let e of n){s.logVerbose(`Session ${e} token expired — re-queuing via bridge/reconnect`);try{await a.reconnectSession(r,e),v(`[bridge:heartbeat] Re-queued sessionId=${e} via bridge/reconnect`)}catch(t){s.logError(`Failed to refresh session ${e} token: ${h(t)}`),v(`[bridge:heartbeat] reconnectSession(${e}) failed: ${h(t)}`,{level:`error`})}}return t?`fatal`:n.length>0?`auth_failed`:e?`ok`:`failed`}let ee=new Set,te=d?$({getAccessToken:d,onRefresh:(e,t)=>{let n=m.get(e);n&&(ee.has(e)?(s.logVerbose(`Refreshing session ${e} token via bridge/reconnect`),a.reconnectSession(r,e).catch(t=>{s.logError(`Failed to refresh session ${e} token: ${h(t)}`),v(`[bridge:token] reconnectSession(${e}) failed: ${h(t)}`,{level:`error`})})):n.updateAccessToken(t))},label:`bridge`}):null,I=Date.now(),L=new Set;function R(e){L.add(e),e.finally(()=>L.delete(e))}let z=0,B=0,H=null,U=null,G=null,K=null,q=!1;if(v(`[bridge:work] Starting poll loop spawnMode=${t.spawnMode} maxSessions=${t.maxSessions} environmentId=${r}`),w(`info`,`bridge_loop_started`,{max_sessions:t.maxSessions,spawn_mode:t.spawnMode}),process.env.USER_TYPE===`ant`){let e;if(t.debugFile){let n=t.debugFile.lastIndexOf(`.`);e=n>0?`${t.debugFile.slice(0,n)}-*${t.debugFile.slice(n)}`:`${t.debugFile}-*`}else e=Oe(Te(),`claude`,`bridge-session-*.log`);s.setDebugLogPath(e)}s.printBanner(t,r),s.updateSessionCount(0,t.maxSessions,t.spawnMode),u&&s.setAttached(u);function J(){s.updateSessionCount(m.size,t.maxSessions,t.spawnMode);for(let[e,t]of m){let n=t.currentActivity;n&&s.updateSessionActivity(y.get(e)??e,n)}if(m.size===0){s.updateIdleStatus();return}let[e,n]=[...m.entries()].pop(),r=g.get(e);if(!r)return;let i=n.currentActivity;if(!i||i.type===`result`||i.type===`error`){t.maxSessions>1&&s.refreshDisplay();return}let a=k(Date.now()-r),o=n.activities.filter(e=>e.type===`tool_start`).slice(-5).map(e=>e.summary);s.updateSessionStatus(e,a,i,o)}function Y(){oe(),J(),K=setInterval(J,Je)}function oe(){K&&(clearInterval(K),K=null)}function se(e,n,i){return o=>{let c=_.get(e);ie(`session done: sessionId=${e} workId=${c??`none`} status=${o} wasTimedOut=${E.has(e)} duration=${Math.round((Date.now()-n)/1e3)}s stderr=${i.lastStderr.length>0?i.lastStderr.join(`\\n`).slice(0,500):`(none)`}`),m.delete(e),g.delete(e),_.delete(e),b.delete(e);let u=y.get(e)??e;y.delete(e),s.removeSession(u),O.delete(u),ee.delete(e);let d=x.get(e);d&&(clearTimeout(d),x.delete(e)),te?.cancel(e),A.wake();let j=E.delete(e),M=j&&o===`interrupted`?`failed`:o,N=Date.now()-n;v(`[bridge:session] sessionId=${e} workId=${c??`unknown`} exited status=${M} duration=${k(N)}`),C(`tengu_bridge_session_done`,{status:M,duration_ms:N}),w(`info`,`bridge_session_done`,{status:M,duration_ms:N}),s.clearStatus(),oe();let P=i.lastStderr.length>0?i.lastStderr.join(`
|
|
15
|
-
`):void 0,F;switch(M){case`completed`:s.logSessionComplete(e,N);break;case`failed`:!j&&!p.aborted&&(F=P??`Process exited with error`,s.logSessionFailed(e,F),D(Error(`Bridge session failed: ${F}`)));break;case`interrupted`:s.logVerbose(`Session ${e} interrupted`);break}M!==`interrupted`&&c&&(R(ot(a,r,c,s,l.stopWorkBaseDelayMs)),S.add(c));let I=T.get(e);if(I&&(T.delete(e),R(W(I.worktreePath,I.worktreeBranch,I.gitRoot,I.hookBased).catch(e=>s.logVerbose(`Failed to remove worktree ${I.worktreePath}: ${h(e)}`)))),M!==`interrupted`&&!p.aborted)if(t.spawnMode!==`single-session`)R(a.archiveSession(u).catch(t=>s.logVerbose(`Failed to archive session ${e}: ${h(t)}`))),v(`[bridge:session] Session ${M}, returning to idle (multi-session mode)`);else{v(`[bridge:session] Session ${M}, aborting poll loop to tear down environment`),f.abort();return}p.aborted||Y()}}for(u||Y();!p.aborted;){let c=ve();try{ie(`poll: envId=${r} activeSessions=${m.size}`);let d=await a.pollForWork(r,i,p,c.reclaim_older_than_ms);if(H!==null||U!==null){let e=Date.now()-(H??U??Date.now());s.logReconnected(e),v(`[bridge:poll] Reconnected after ${k(e)}`),C(`tengu_bridge_reconnected`,{disconnected_ms:e})}if(z=0,B=0,H=null,U=null,G=null,!d){if(m.size>=t.maxSessions){let e=c.multisession_poll_interval_ms_at_capacity;if(c.non_exclusive_heartbeat_interval_ms>0){C(`tengu_bridge_heartbeat_mode_entered`,{active_sessions:m.size,heartbeat_interval_ms:c.non_exclusive_heartbeat_interval_ms});let n=e>0?Date.now()+e:null,r=`ok`,i=0;for(;!p.aborted&&m.size>=t.maxSessions&&(n===null||Date.now()<n);){let e=ve();if(e.non_exclusive_heartbeat_interval_ms<=0)break;let t=A.signal();if(r=await M(),r===`auth_failed`||r===`fatal`){t.cleanup();break}i++,await j(e.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}let a=r===`auth_failed`||r===`fatal`?r:p.aborted?`shutdown`:m.size<t.maxSessions?`capacity_changed`:n!==null&&Date.now()>=n?`poll_due`:`config_disabled`;if(C(`tengu_bridge_heartbeat_mode_exited`,{reason:a,heartbeat_cycles:i,active_sessions:m.size}),a===`poll_due`&&v(`[bridge:poll] Heartbeat poll_due after ${i} cycles — falling through to pollForWork`),r===`auth_failed`||r===`fatal`){let t=A.signal();await j(e>0?e:c.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}}else if(e>0){let t=A.signal();await j(e,t.signal),t.cleanup()}}else await j(m.size>0?c.multisession_poll_interval_ms_partial_capacity:c.multisession_poll_interval_ms_not_at_capacity,p);continue}let f=m.size>=t.maxSessions;if(S.has(d.id)){if(v(`[bridge:work] Skipping already-completed workId=${d.id}`),f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}else await j(1e3,p);continue}let N;try{N=Se(d.secret)}catch(e){let t=h(e);if(s.logError(`Failed to decode work secret for workId=${d.id}: ${t}`),C(`tengu_bridge_work_secret_failed`,{}),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs)),f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}continue}let P=async()=>{v(`[bridge:work] Acknowledging workId=${d.id}`);try{await a.acknowledgeWork(r,d.id,N.session_ingress_token)}catch(e){v(`[bridge:work] Acknowledge failed workId=${d.id}: ${h(e)}`)}},I=d.data.type;switch(d.data.type){case`healthcheck`:await P(),v(`[bridge:work] Healthcheck received`),s.logVerbose(`Healthcheck received`);break;case`session`:{let i=d.data.id;ie(`work received: type=session sessionId=${i} workId=${d.id}`);try{F(i,`session_id`)}catch{await P(),s.logError(`Invalid session_id received: ${i}`);break}let c=m.get(i);if(c){c.updateAccessToken(N.session_ingress_token),b.set(i,N.session_ingress_token),_.set(i,d.id),te?.schedule(i,N.session_ingress_token),v(`[bridge:work] Updated access token for existing sessionId=${i} workId=${d.id}`),await P();break}if(m.size>=t.maxSessions){v(`[bridge:work] At capacity (${m.size}/${t.maxSessions}), cannot spawn new session for workId=${d.id}`);break}await P();let f=Date.now(),k,A=!1,M;if(N.use_code_sessions===!0||n(process.env.CLAUDE_BRIDGE_USE_CCR_V2)){k=Ce(t.apiBaseUrl,i);for(let e=1;e<=2;e++)try{M=await be(k,N.session_ingress_token),A=!0,v(`[bridge:session] CCR v2: registered worker sessionId=${i} epoch=${M} attempt=${e}`);break}catch(t){let n=h(t);if(e<2){if(v(`[bridge:session] CCR v2: registerWorker attempt ${e} failed, retrying: ${n}`),await j(2e3,p),p.aborted)break;continue}s.logError(`CCR v2 worker registration failed for session ${i}: ${n}`),D(Error(`registerWorker failed: ${n}`)),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs))}if(!A)break}else k=xe(t.sessionIngressUrl,i);let I=t.spawnMode,L=t.dir,z=0;if(I===`worktree`&&(u===void 0||!ye(i,u))){let e=Date.now();try{let t=await V(`bridge-${Be(i)}`);z=Date.now()-e,T.set(i,{worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,gitRoot:t.gitRoot,hookBased:t.hookBased}),L=t.worktreePath,v(`[bridge:session] Created worktree for sessionId=${i} at ${t.worktreePath}`)}catch(e){let t=h(e);s.logError(`Failed to create worktree for session ${i}: ${t}`),D(Error(`Worktree creation failed: ${t}`)),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs));break}}v(`[bridge:session] Spawning sessionId=${i} sdkUrl=${k}`);let B=ae(i);ie(`spawning session: sessionId=${i} sdkUrl=${k} useCcrV2=${A} workerEpoch=${M} dir=${L} accessToken=${N.session_ingress_token?N.session_ingress_token.slice(0,8)+`...`:`NONE`}`);let H=$e(o,{sessionId:i,sdkUrl:k,accessToken:N.session_ingress_token,useCcrV2:A,workerEpoch:M,onFirstUserMessage:e=>{if(O.has(B))return;O.add(B);let n=mt(e);s.setSessionTitle(B,n),v(`[bridge:title] derived title for ${B}: ${n}`),import(`./createSession-XhPMcSns.js`).then(({updateBridgeSessionTitle:e})=>e(B,n,{baseUrl:t.apiBaseUrl})).catch(e=>v(`[bridge:title] failed to update title for ${B}: ${e}`,{level:`error`}))}},L);if(typeof H==`string`){s.logError(`Failed to spawn session ${i}: ${H}`);let e=T.get(i);e&&(T.delete(i),R(W(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased).catch(t=>s.logVerbose(`Failed to remove worktree ${e.worktreePath}: ${h(t)}`)))),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs));break}let re=H,U=Date.now()-f;C(`tengu_bridge_session_started`,{active_sessions:m.size,spawn_mode:I,in_worktree:T.has(i),spawn_duration_ms:U,worktree_create_ms:z,inProtectedNamespace:e()}),w(`info`,`bridge_session_started`,{spawn_mode:I,in_worktree:T.has(i),spawn_duration_ms:U,worktree_create_ms:z}),m.set(i,re),_.set(i,d.id),b.set(i,N.session_ingress_token),y.set(i,B);let G=Date.now();g.set(i,G),s.logSessionStart(i,`Session ${i}`);let K=Be(i),q;if(t.debugFile){let e=t.debugFile.lastIndexOf(`.`);q=e>0?`${t.debugFile.slice(0,e)}-${K}${t.debugFile.slice(e)}`:`${t.debugFile}-${K}`}else (t.verbose||process.env.USER_TYPE===`ant`)&&(q=Oe(Te(),`claude`,`bridge-session-${K}.log`));q&&s.logVerbose(`Debug log: ${q}`),s.addSession(B,ne(B,t.sessionIngressUrl)),Y(),s.setAttached(B),ht(B,t.apiBaseUrl).then(e=>{e&&m.has(i)&&(O.add(B),s.setSessionTitle(B,e),v(`[bridge:title] server title for ${B}: ${e}`))}).catch(e=>v(`[bridge:title] failed to fetch title for ${B}: ${e}`,{level:`error`}));let J=t.sessionTimeoutMs??864e5;if(J>0){let e=setTimeout(st,J,i,J,s,E,re);x.set(i,e)}A&&ee.add(i),te?.schedule(i,N.session_ingress_token),re.done.then(se(i,G,re));break}default:await P(),v(`[bridge:work] Unknown work type: ${I}, skipping`);break}if(f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}}catch(e){if(p.aborted)break;if(e instanceof P){q=!0,N(e.errorType)?s.logStatus(e.message):re(e)?v(`[bridge:work] Suppressed 403 error: ${e.message}`):(s.logError(e.message),D(e)),C(`tengu_bridge_fatal_error`,{status:e.status,error_type:e.errorType}),w(N(e.errorType)?`info`:`error`,`bridge_fatal_error`,{status:e.status,error_type:e.errorType});break}let t=le(e);if(ie(`poll error: ${t} isConn=${nt(e)} isServer=${rt(e)} activeSessions=${m.size}`),nt(e)||rt(e)){let e=Date.now();G!==null&&e-G>Ze(l)&&(v(`[bridge:work] Detected system sleep (${Math.round((e-G)/1e3)}s gap), resetting error budget`),w(`info`,`bridge_poll_sleep_detected`,{gapMs:e-G}),H=null,z=0,U=null,B=0),G=e,H||(H=e);let n=e-H;if(n>=l.connGiveUpMs){s.logError(`Server unreachable for ${Math.round(n/6e4)} minutes, giving up.`),C(`tengu_bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),w(`error`,`bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),q=!0;break}U=null,B=0,z=z?Math.min(z*2,l.connCapMs):l.connInitialMs;let r=it(z);s.logVerbose(`Connection error, retrying in ${at(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),s.updateReconnectingStatus(at(r),k(n)),ve().non_exclusive_heartbeat_interval_ms>0&&await M(),await j(r,p)}else{let e=Date.now();G!==null&&e-G>Ze(l)&&(v(`[bridge:work] Detected system sleep (${Math.round((e-G)/1e3)}s gap), resetting error budget`),w(`info`,`bridge_poll_sleep_detected`,{gapMs:e-G}),H=null,z=0,U=null,B=0),G=e,U||(U=e);let n=e-U;if(n>=l.generalGiveUpMs){s.logError(`Persistent errors for ${Math.round(n/6e4)} minutes, giving up.`),C(`tengu_bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),w(`error`,`bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),q=!0;break}H=null,z=0,B=B?Math.min(B*2,l.generalCapMs):l.generalInitialMs;let r=it(B);s.logVerbose(`Poll failed, retrying in ${at(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),s.updateReconnectingStatus(at(r),k(n)),ve().non_exclusive_heartbeat_interval_ms>0&&await M(),await j(r,p)}}}oe(),s.clearStatus();let ce=Date.now()-I;C(`tengu_bridge_shutdown`,{active_sessions:m.size,loop_duration_ms:ce}),w(`info`,`bridge_shutdown`,{active_sessions:m.size,loop_duration_ms:ce});let ue=new Set(m.keys());u&&ue.add(u);let de=new Map(y);if(m.size>0){v(`[bridge:shutdown] Shutting down ${m.size} active session(s)`),s.logStatus(`Shutting down ${m.size} active session(s)\u2026`);let e=new Map(_);for(let[e,t]of m.entries())v(`[bridge:shutdown] Sending SIGTERM to sessionId=${e}`),t.kill();let t=new AbortController;await Promise.race([Promise.allSettled([...m.values()].map(e=>e.done)),j(l.shutdownGraceMs??3e4,t.signal)]),t.abort();for(let[e,t]of m.entries())v(`[bridge:shutdown] Force-killing stuck sessionId=${e}`),t.forceKill();for(let e of x.values())clearTimeout(e);if(x.clear(),te?.cancelAll(),T.size>0){let e=[...T.values()];T.clear(),v(`[bridge:shutdown] Cleaning up ${e.length} worktree(s)`),await Promise.allSettled(e.map(e=>W(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased)))}await Promise.allSettled([...e.entries()].map(([e,t])=>a.stopWork(r,t,!0).catch(n=>s.logVerbose(`Failed to stop work ${t} for session ${e}: ${h(n)}`))))}if(L.size>0&&await Promise.allSettled([...L]),t.spawnMode===`single-session`&&u&&!q){s.logStatus("Resume this session by running `claude remote-control --continue`"),v(`[bridge:shutdown] Skipping archive+deregister to allow resume of session ${u}`);return}ue.size>0&&(v(`[bridge:shutdown] Archiving ${ue.size} session(s)`),await Promise.allSettled([...ue].map(e=>a.archiveSession(de.get(e)??ae(e)).catch(t=>s.logVerbose(`Failed to archive session ${e}: ${h(t)}`)))));try{await a.deregisterEnvironment(r),v(`[bridge:shutdown] Environment deregistered, bridge offline`),s.logVerbose(`Environment deregistered.`)}catch(e){s.logVerbose(`Failed to deregister environment: ${h(e)}`)}let{clearBridgePointer:X}=await import(`./bridgePointer-B2FPGDWR.js`);await X(t.dir),s.logVerbose(`Environment offline.`)}var tt=new Set([`ECONNREFUSED`,`ECONNRESET`,`ETIMEDOUT`,`ENETUNREACH`,`EHOSTUNREACH`]);function nt(e){return!!(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&tt.has(e.code))}function rt(e){return!!e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&e.code===`ERR_BAD_RESPONSE`}function it(e){return Math.max(0,e+e*.25*(2*Math.random()-1))}function at(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}async function ot(e,t,n,r,i=1e3){for(let a=1;a<=3;a++)try{await e.stopWork(t,n,!1),v(`[bridge:work] stopWork succeeded for workId=${n} on attempt ${a}/3`);return}catch(e){if(e instanceof P){re(e)?v(`[bridge:work] Suppressed stopWork 403 for ${n}: ${e.message}`):r.logError(`Failed to stop work ${n}: ${e.message}`),w(`error`,`bridge_stop_work_failed`,{attempts:a,fatal:!0});return}let t=h(e);if(a<3){let e=it(i*2**(a-1));r.logVerbose(`Failed to stop work ${n} (attempt ${a}/3), retrying in ${at(e)}: ${t}`),await j(e)}else r.logError(`Failed to stop work ${n} after 3 attempts: ${t}`),w(`error`,`bridge_stop_work_failed`,{attempts:3})}}function st(e,t,n,r,i){v(`[bridge:session] sessionId=${e} timed out after ${k(t)}`),C(`tengu_bridge_session_timeout`,{timeout_ms:t}),n.logSessionFailed(e,`Session timed out after ${k(t)}`),r.add(e),i.kill()}var ct=[`session`,`same-dir`,`worktree`];function lt(e){return e===`session`?`single-session`:e===`same-dir`?`same-dir`:e===`worktree`?`worktree`:`--spawn requires one of: ${ct.join(`, `)} (got: ${e??`<missing>`})`}function ut(e){let t=e===void 0?NaN:parseInt(e,10);return isNaN(t)||t<1?`--capacity requires a positive integer (got: ${e??`<missing>`})`:t}function dt(e){let t=!1,n=!1,r,i,a,o,s=!1,c,l,u,d,f=!1;for(let m=0;m<e.length;m++){let h=e[m];if(h===`--help`||h===`-h`)s=!0;else if(h===`--verbose`||h===`-v`)t=!0;else if(h===`--sandbox`)n=!0;else if(h===`--no-sandbox`)n=!1;else if(h===`--debug-file`&&m+1<e.length)r=ke(e[++m]);else if(h.startsWith(`--debug-file=`))r=ke(h.slice(13));else if(h===`--session-timeout`&&m+1<e.length)i=parseInt(e[++m],10)*1e3;else if(h.startsWith(`--session-timeout=`))i=parseInt(h.slice(18),10)*1e3;else if(h===`--permission-mode`&&m+1<e.length)a=e[++m];else if(h.startsWith(`--permission-mode=`))a=h.slice(18);else if(h===`--name`&&m+1<e.length)o=e[++m];else if(h.startsWith(`--name=`))o=h.slice(7);else if(h===`--session-id`&&m+1<e.length){if(d=e[++m],!d)return p(`--session-id requires a value`)}else if(h.startsWith(`--session-id=`)){if(d=h.slice(13),!d)return p(`--session-id requires a value`)}else if(h===`--continue`||h===`-c`)f=!0;else if(h===`--spawn`||h.startsWith(`--spawn=`)){if(c!==void 0)return p(`--spawn may only be specified once`);let t=lt(h.startsWith(`--spawn=`)?h.slice(8):e[++m]);if(t===`single-session`||t===`same-dir`||t===`worktree`)c=t;else return p(t)}else if(h===`--capacity`||h.startsWith(`--capacity=`)){if(l!==void 0)return p(`--capacity may only be specified once`);let t=ut(h.startsWith(`--capacity=`)?h.slice(11):e[++m]);if(typeof t==`number`)l=t;else return p(t)}else if(h===`--create-session-in-dir`)u=!0;else if(h===`--no-create-session-in-dir`)u=!1;else return p(`Unknown argument: ${h}\nRun 'claude remote-control --help' for usage.`)}if(c===`single-session`&&l!==void 0)return p(`--capacity cannot be used with --spawn=session (single-session mode has fixed capacity 1).`);if((d||f)&&(c!==void 0||l!==void 0||u!==void 0))return p(`--session-id and --continue cannot be used with --spawn, --capacity, or --create-session-in-dir.`);if(d&&f)return p(`--session-id and --continue cannot be used together.`);return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s};function p(e){return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s,error:e}}}async function ft(){let{EXTERNAL_PERMISSION_MODES:e}=await import(`./permissions-Ps_D01ZB.js`),t=e.join(`, `),n=await Xe(),r=`
|
|
15
|
+
`):void 0,F;switch(M){case`completed`:s.logSessionComplete(e,N);break;case`failed`:!j&&!p.aborted&&(F=P??`Process exited with error`,s.logSessionFailed(e,F),D(Error(`Bridge session failed: ${F}`)));break;case`interrupted`:s.logVerbose(`Session ${e} interrupted`);break}M!==`interrupted`&&c&&(R(ot(a,r,c,s,l.stopWorkBaseDelayMs)),S.add(c));let I=T.get(e);if(I&&(T.delete(e),R(W(I.worktreePath,I.worktreeBranch,I.gitRoot,I.hookBased).catch(e=>s.logVerbose(`Failed to remove worktree ${I.worktreePath}: ${h(e)}`)))),M!==`interrupted`&&!p.aborted)if(t.spawnMode!==`single-session`)R(a.archiveSession(u).catch(t=>s.logVerbose(`Failed to archive session ${e}: ${h(t)}`))),v(`[bridge:session] Session ${M}, returning to idle (multi-session mode)`);else{v(`[bridge:session] Session ${M}, aborting poll loop to tear down environment`),f.abort();return}p.aborted||Y()}}for(u||Y();!p.aborted;){let c=ve();try{ie(`poll: envId=${r} activeSessions=${m.size}`);let d=await a.pollForWork(r,i,p,c.reclaim_older_than_ms);if(H!==null||U!==null){let e=Date.now()-(H??U??Date.now());s.logReconnected(e),v(`[bridge:poll] Reconnected after ${k(e)}`),C(`tengu_bridge_reconnected`,{disconnected_ms:e})}if(z=0,B=0,H=null,U=null,G=null,!d){if(m.size>=t.maxSessions){let e=c.multisession_poll_interval_ms_at_capacity;if(c.non_exclusive_heartbeat_interval_ms>0){C(`tengu_bridge_heartbeat_mode_entered`,{active_sessions:m.size,heartbeat_interval_ms:c.non_exclusive_heartbeat_interval_ms});let n=e>0?Date.now()+e:null,r=`ok`,i=0;for(;!p.aborted&&m.size>=t.maxSessions&&(n===null||Date.now()<n);){let e=ve();if(e.non_exclusive_heartbeat_interval_ms<=0)break;let t=A.signal();if(r=await M(),r===`auth_failed`||r===`fatal`){t.cleanup();break}i++,await j(e.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}let a=r===`auth_failed`||r===`fatal`?r:p.aborted?`shutdown`:m.size<t.maxSessions?`capacity_changed`:n!==null&&Date.now()>=n?`poll_due`:`config_disabled`;if(C(`tengu_bridge_heartbeat_mode_exited`,{reason:a,heartbeat_cycles:i,active_sessions:m.size}),a===`poll_due`&&v(`[bridge:poll] Heartbeat poll_due after ${i} cycles — falling through to pollForWork`),r===`auth_failed`||r===`fatal`){let t=A.signal();await j(e>0?e:c.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}}else if(e>0){let t=A.signal();await j(e,t.signal),t.cleanup()}}else await j(m.size>0?c.multisession_poll_interval_ms_partial_capacity:c.multisession_poll_interval_ms_not_at_capacity,p);continue}let f=m.size>=t.maxSessions;if(S.has(d.id)){if(v(`[bridge:work] Skipping already-completed workId=${d.id}`),f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}else await j(1e3,p);continue}let N;try{N=Se(d.secret)}catch(e){let t=h(e);if(s.logError(`Failed to decode work secret for workId=${d.id}: ${t}`),C(`tengu_bridge_work_secret_failed`,{}),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs)),f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}continue}let P=async()=>{v(`[bridge:work] Acknowledging workId=${d.id}`);try{await a.acknowledgeWork(r,d.id,N.session_ingress_token)}catch(e){v(`[bridge:work] Acknowledge failed workId=${d.id}: ${h(e)}`)}},I=d.data.type;switch(d.data.type){case`healthcheck`:await P(),v(`[bridge:work] Healthcheck received`),s.logVerbose(`Healthcheck received`);break;case`session`:{let i=d.data.id;ie(`work received: type=session sessionId=${i} workId=${d.id}`);try{F(i,`session_id`)}catch{await P(),s.logError(`Invalid session_id received: ${i}`);break}let c=m.get(i);if(c){c.updateAccessToken(N.session_ingress_token),b.set(i,N.session_ingress_token),_.set(i,d.id),te?.schedule(i,N.session_ingress_token),v(`[bridge:work] Updated access token for existing sessionId=${i} workId=${d.id}`),await P();break}if(m.size>=t.maxSessions){v(`[bridge:work] At capacity (${m.size}/${t.maxSessions}), cannot spawn new session for workId=${d.id}`);break}await P();let f=Date.now(),k,A=!1,M;if(N.use_code_sessions===!0||n(process.env.CLAUDE_BRIDGE_USE_CCR_V2)){k=Ce(t.apiBaseUrl,i);for(let e=1;e<=2;e++)try{M=await be(k,N.session_ingress_token),A=!0,v(`[bridge:session] CCR v2: registered worker sessionId=${i} epoch=${M} attempt=${e}`);break}catch(t){let n=h(t);if(e<2){if(v(`[bridge:session] CCR v2: registerWorker attempt ${e} failed, retrying: ${n}`),await j(2e3,p),p.aborted)break;continue}s.logError(`CCR v2 worker registration failed for session ${i}: ${n}`),D(Error(`registerWorker failed: ${n}`)),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs))}if(!A)break}else k=xe(t.sessionIngressUrl,i);let I=t.spawnMode,L=t.dir,z=0;if(I===`worktree`&&(u===void 0||!ye(i,u))){let e=Date.now();try{let t=await V(`bridge-${Be(i)}`);z=Date.now()-e,T.set(i,{worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,gitRoot:t.gitRoot,hookBased:t.hookBased}),L=t.worktreePath,v(`[bridge:session] Created worktree for sessionId=${i} at ${t.worktreePath}`)}catch(e){let t=h(e);s.logError(`Failed to create worktree for session ${i}: ${t}`),D(Error(`Worktree creation failed: ${t}`)),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs));break}}v(`[bridge:session] Spawning sessionId=${i} sdkUrl=${k}`);let B=ae(i);ie(`spawning session: sessionId=${i} sdkUrl=${k} useCcrV2=${A} workerEpoch=${M} dir=${L} accessToken=${N.session_ingress_token?N.session_ingress_token.slice(0,8)+`...`:`NONE`}`);let H=$e(o,{sessionId:i,sdkUrl:k,accessToken:N.session_ingress_token,useCcrV2:A,workerEpoch:M,onFirstUserMessage:e=>{if(O.has(B))return;O.add(B);let n=mt(e);s.setSessionTitle(B,n),v(`[bridge:title] derived title for ${B}: ${n}`),import(`./createSession-1ewHG3eq.js`).then(({updateBridgeSessionTitle:e})=>e(B,n,{baseUrl:t.apiBaseUrl})).catch(e=>v(`[bridge:title] failed to update title for ${B}: ${e}`,{level:`error`}))}},L);if(typeof H==`string`){s.logError(`Failed to spawn session ${i}: ${H}`);let e=T.get(i);e&&(T.delete(i),R(W(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased).catch(t=>s.logVerbose(`Failed to remove worktree ${e.worktreePath}: ${h(t)}`)))),S.add(d.id),R(ot(a,r,d.id,s,l.stopWorkBaseDelayMs));break}let re=H,U=Date.now()-f;C(`tengu_bridge_session_started`,{active_sessions:m.size,spawn_mode:I,in_worktree:T.has(i),spawn_duration_ms:U,worktree_create_ms:z,inProtectedNamespace:e()}),w(`info`,`bridge_session_started`,{spawn_mode:I,in_worktree:T.has(i),spawn_duration_ms:U,worktree_create_ms:z}),m.set(i,re),_.set(i,d.id),b.set(i,N.session_ingress_token),y.set(i,B);let G=Date.now();g.set(i,G),s.logSessionStart(i,`Session ${i}`);let K=Be(i),q;if(t.debugFile){let e=t.debugFile.lastIndexOf(`.`);q=e>0?`${t.debugFile.slice(0,e)}-${K}${t.debugFile.slice(e)}`:`${t.debugFile}-${K}`}else (t.verbose||process.env.USER_TYPE===`ant`)&&(q=Oe(Te(),`claude`,`bridge-session-${K}.log`));q&&s.logVerbose(`Debug log: ${q}`),s.addSession(B,ne(B,t.sessionIngressUrl)),Y(),s.setAttached(B),ht(B,t.apiBaseUrl).then(e=>{e&&m.has(i)&&(O.add(B),s.setSessionTitle(B,e),v(`[bridge:title] server title for ${B}: ${e}`))}).catch(e=>v(`[bridge:title] failed to fetch title for ${B}: ${e}`,{level:`error`}));let J=t.sessionTimeoutMs??864e5;if(J>0){let e=setTimeout(st,J,i,J,s,E,re);x.set(i,e)}A&&ee.add(i),te?.schedule(i,N.session_ingress_token),re.done.then(se(i,G,re));break}default:await P(),v(`[bridge:work] Unknown work type: ${I}, skipping`);break}if(f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}}catch(e){if(p.aborted)break;if(e instanceof P){q=!0,N(e.errorType)?s.logStatus(e.message):re(e)?v(`[bridge:work] Suppressed 403 error: ${e.message}`):(s.logError(e.message),D(e)),C(`tengu_bridge_fatal_error`,{status:e.status,error_type:e.errorType}),w(N(e.errorType)?`info`:`error`,`bridge_fatal_error`,{status:e.status,error_type:e.errorType});break}let t=le(e);if(ie(`poll error: ${t} isConn=${nt(e)} isServer=${rt(e)} activeSessions=${m.size}`),nt(e)||rt(e)){let e=Date.now();G!==null&&e-G>Ze(l)&&(v(`[bridge:work] Detected system sleep (${Math.round((e-G)/1e3)}s gap), resetting error budget`),w(`info`,`bridge_poll_sleep_detected`,{gapMs:e-G}),H=null,z=0,U=null,B=0),G=e,H||(H=e);let n=e-H;if(n>=l.connGiveUpMs){s.logError(`Server unreachable for ${Math.round(n/6e4)} minutes, giving up.`),C(`tengu_bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),w(`error`,`bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),q=!0;break}U=null,B=0,z=z?Math.min(z*2,l.connCapMs):l.connInitialMs;let r=it(z);s.logVerbose(`Connection error, retrying in ${at(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),s.updateReconnectingStatus(at(r),k(n)),ve().non_exclusive_heartbeat_interval_ms>0&&await M(),await j(r,p)}else{let e=Date.now();G!==null&&e-G>Ze(l)&&(v(`[bridge:work] Detected system sleep (${Math.round((e-G)/1e3)}s gap), resetting error budget`),w(`info`,`bridge_poll_sleep_detected`,{gapMs:e-G}),H=null,z=0,U=null,B=0),G=e,U||(U=e);let n=e-U;if(n>=l.generalGiveUpMs){s.logError(`Persistent errors for ${Math.round(n/6e4)} minutes, giving up.`),C(`tengu_bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),w(`error`,`bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),q=!0;break}H=null,z=0,B=B?Math.min(B*2,l.generalCapMs):l.generalInitialMs;let r=it(B);s.logVerbose(`Poll failed, retrying in ${at(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),s.updateReconnectingStatus(at(r),k(n)),ve().non_exclusive_heartbeat_interval_ms>0&&await M(),await j(r,p)}}}oe(),s.clearStatus();let ce=Date.now()-I;C(`tengu_bridge_shutdown`,{active_sessions:m.size,loop_duration_ms:ce}),w(`info`,`bridge_shutdown`,{active_sessions:m.size,loop_duration_ms:ce});let ue=new Set(m.keys());u&&ue.add(u);let de=new Map(y);if(m.size>0){v(`[bridge:shutdown] Shutting down ${m.size} active session(s)`),s.logStatus(`Shutting down ${m.size} active session(s)\u2026`);let e=new Map(_);for(let[e,t]of m.entries())v(`[bridge:shutdown] Sending SIGTERM to sessionId=${e}`),t.kill();let t=new AbortController;await Promise.race([Promise.allSettled([...m.values()].map(e=>e.done)),j(l.shutdownGraceMs??3e4,t.signal)]),t.abort();for(let[e,t]of m.entries())v(`[bridge:shutdown] Force-killing stuck sessionId=${e}`),t.forceKill();for(let e of x.values())clearTimeout(e);if(x.clear(),te?.cancelAll(),T.size>0){let e=[...T.values()];T.clear(),v(`[bridge:shutdown] Cleaning up ${e.length} worktree(s)`),await Promise.allSettled(e.map(e=>W(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased)))}await Promise.allSettled([...e.entries()].map(([e,t])=>a.stopWork(r,t,!0).catch(n=>s.logVerbose(`Failed to stop work ${t} for session ${e}: ${h(n)}`))))}if(L.size>0&&await Promise.allSettled([...L]),t.spawnMode===`single-session`&&u&&!q){s.logStatus("Resume this session by running `claude remote-control --continue`"),v(`[bridge:shutdown] Skipping archive+deregister to allow resume of session ${u}`);return}ue.size>0&&(v(`[bridge:shutdown] Archiving ${ue.size} session(s)`),await Promise.allSettled([...ue].map(e=>a.archiveSession(de.get(e)??ae(e)).catch(t=>s.logVerbose(`Failed to archive session ${e}: ${h(t)}`)))));try{await a.deregisterEnvironment(r),v(`[bridge:shutdown] Environment deregistered, bridge offline`),s.logVerbose(`Environment deregistered.`)}catch(e){s.logVerbose(`Failed to deregister environment: ${h(e)}`)}let{clearBridgePointer:X}=await import(`./bridgePointer-B2FPGDWR.js`);await X(t.dir),s.logVerbose(`Environment offline.`)}var tt=new Set([`ECONNREFUSED`,`ECONNRESET`,`ETIMEDOUT`,`ENETUNREACH`,`EHOSTUNREACH`]);function nt(e){return!!(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&tt.has(e.code))}function rt(e){return!!e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&e.code===`ERR_BAD_RESPONSE`}function it(e){return Math.max(0,e+e*.25*(2*Math.random()-1))}function at(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}async function ot(e,t,n,r,i=1e3){for(let a=1;a<=3;a++)try{await e.stopWork(t,n,!1),v(`[bridge:work] stopWork succeeded for workId=${n} on attempt ${a}/3`);return}catch(e){if(e instanceof P){re(e)?v(`[bridge:work] Suppressed stopWork 403 for ${n}: ${e.message}`):r.logError(`Failed to stop work ${n}: ${e.message}`),w(`error`,`bridge_stop_work_failed`,{attempts:a,fatal:!0});return}let t=h(e);if(a<3){let e=it(i*2**(a-1));r.logVerbose(`Failed to stop work ${n} (attempt ${a}/3), retrying in ${at(e)}: ${t}`),await j(e)}else r.logError(`Failed to stop work ${n} after 3 attempts: ${t}`),w(`error`,`bridge_stop_work_failed`,{attempts:3})}}function st(e,t,n,r,i){v(`[bridge:session] sessionId=${e} timed out after ${k(t)}`),C(`tengu_bridge_session_timeout`,{timeout_ms:t}),n.logSessionFailed(e,`Session timed out after ${k(t)}`),r.add(e),i.kill()}var ct=[`session`,`same-dir`,`worktree`];function lt(e){return e===`session`?`single-session`:e===`same-dir`?`same-dir`:e===`worktree`?`worktree`:`--spawn requires one of: ${ct.join(`, `)} (got: ${e??`<missing>`})`}function ut(e){let t=e===void 0?NaN:parseInt(e,10);return isNaN(t)||t<1?`--capacity requires a positive integer (got: ${e??`<missing>`})`:t}function dt(e){let t=!1,n=!1,r,i,a,o,s=!1,c,l,u,d,f=!1;for(let m=0;m<e.length;m++){let h=e[m];if(h===`--help`||h===`-h`)s=!0;else if(h===`--verbose`||h===`-v`)t=!0;else if(h===`--sandbox`)n=!0;else if(h===`--no-sandbox`)n=!1;else if(h===`--debug-file`&&m+1<e.length)r=ke(e[++m]);else if(h.startsWith(`--debug-file=`))r=ke(h.slice(13));else if(h===`--session-timeout`&&m+1<e.length)i=parseInt(e[++m],10)*1e3;else if(h.startsWith(`--session-timeout=`))i=parseInt(h.slice(18),10)*1e3;else if(h===`--permission-mode`&&m+1<e.length)a=e[++m];else if(h.startsWith(`--permission-mode=`))a=h.slice(18);else if(h===`--name`&&m+1<e.length)o=e[++m];else if(h.startsWith(`--name=`))o=h.slice(7);else if(h===`--session-id`&&m+1<e.length){if(d=e[++m],!d)return p(`--session-id requires a value`)}else if(h.startsWith(`--session-id=`)){if(d=h.slice(13),!d)return p(`--session-id requires a value`)}else if(h===`--continue`||h===`-c`)f=!0;else if(h===`--spawn`||h.startsWith(`--spawn=`)){if(c!==void 0)return p(`--spawn may only be specified once`);let t=lt(h.startsWith(`--spawn=`)?h.slice(8):e[++m]);if(t===`single-session`||t===`same-dir`||t===`worktree`)c=t;else return p(t)}else if(h===`--capacity`||h.startsWith(`--capacity=`)){if(l!==void 0)return p(`--capacity may only be specified once`);let t=ut(h.startsWith(`--capacity=`)?h.slice(11):e[++m]);if(typeof t==`number`)l=t;else return p(t)}else if(h===`--create-session-in-dir`)u=!0;else if(h===`--no-create-session-in-dir`)u=!1;else return p(`Unknown argument: ${h}\nRun 'claude remote-control --help' for usage.`)}if(c===`single-session`&&l!==void 0)return p(`--capacity cannot be used with --spawn=session (single-session mode has fixed capacity 1).`);if((d||f)&&(c!==void 0||l!==void 0||u!==void 0))return p(`--session-id and --continue cannot be used with --spawn, --capacity, or --create-session-in-dir.`);if(d&&f)return p(`--session-id and --continue cannot be used together.`);return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s};function p(e){return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s,error:e}}}async function ft(){let{EXTERNAL_PERMISSION_MODES:e}=await import(`./permissions-Ps_D01ZB.js`),t=e.join(`, `),n=await Xe(),r=`
|
|
16
16
|
Remote Control - Connect your local environment to claude.ai/code
|
|
17
17
|
|
|
18
18
|
USAGE
|
|
@@ -52,12 +52,12 @@ NOTES
|
|
|
52
52
|
- You must be logged in with a Claude account that has a subscription
|
|
53
53
|
- Run \`claude\` first in the directory to accept the workspace trust dialog
|
|
54
54
|
${n?` - Worktree mode requires a git repository or WorktreeCreate/WorktreeRemove hooks
|
|
55
|
-
`:``}`;console.log(r)}var pt=80;function mt(e){return O(e.replace(/\s+/g,` `).trim(),pt)}async function ht(e,t){let{getBridgeSession:n}=await import(`./createSession-
|
|
55
|
+
`:``}`;console.log(r)}var pt=80;function mt(e){return O(e.replace(/\s+/g,` `).trim(),pt)}async function ht(e,t){let{getBridgeSession:n}=await import(`./createSession-1ewHG3eq.js`);return(await n(e,{baseUrl:t}))?.title||void 0}async function gt(e){let t=dt(e);if(t.help){await ft();return}t.error&&(console.error(`Error: ${t.error}`),process.exit(1));let{verbose:n,sandbox:r,debugFile:i,sessionTimeoutMs:a,permissionMode:o,name:s,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f}=t,m=d,g,_=c!==void 0||l!==void 0||u!==void 0;if(o!==void 0){let{PERMISSION_MODES:e}=await import(`./permissions-Ps_D01ZB.js`),t=e;t.includes(o)||(console.error(`Error: Invalid permission mode '${o}'. Valid modes: ${t.join(`, `)}`),process.exit(1))}let y=ke(`.`),{enableConfigs:b,checkHasTrustDialogAccepted:S}=await import(`./config-JGm0O-ZQ.js`);b();let{initSinks:T}=await import(`./sinks-BCl9slVM.js`);T();let E=await Xe();_&&!E&&(await x(`tengu_bridge_multi_session_denied`,{used_spawn:c!==void 0,used_capacity:l!==void 0,used_create_session_in_dir:u!==void 0}),await Promise.race([Promise.all([p(),ue()]),j(500,void 0,{unref:!0})]).catch(()=>{}),console.error(`Error: Multi-session Remote Control is not enabled for your account yet.`),process.exit(1));let{setOriginalCwd:O,setCwdState:k}=await import(`./state-B2GIOsTB.js`);O(y),k(y),S()||(console.error(`Error: Workspace not trusted. Please run \`claude\` in ${y} first to review and accept the workspace trust dialog.`),process.exit(1));let{clearOAuthTokenCache:A,checkAndRefreshOAuthTokenIfNeeded:M}=await import(`./auth-DxRiJwZ-.js`),{getBridgeAccessToken:N,getBridgeBaseUrl:te}=await import(`./bridgeConfig-Dkn5GGec.js`);N()||(console.error(pe),process.exit(1));let{getGlobalConfig:I,saveGlobalConfig:ne,getCurrentProjectConfig:L,saveCurrentProjectConfig:R}=await import(`./config-JGm0O-ZQ.js`);if(!I().remoteDialogSeen){let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});console.log(`
|
|
56
56
|
Remote Control lets you access this CLI session from the web (claude.ai/code)
|
|
57
57
|
or the Claude app, so you can pick up where you left off on any device.
|
|
58
58
|
|
|
59
59
|
You can disconnect remote access anytime by running /remote-control again.
|
|
60
|
-
`);let t=await new Promise(t=>{e.question(`Enable Remote Control? (y/n) `,t)});e.close(),ne(e=>e.remoteDialogSeen?e:{...e,remoteDialogSeen:!0}),t.toLowerCase()!==`y`&&t.toLowerCase()!==`yes`&&process.exit(0)}if(f){let{readBridgePointerAcrossWorktrees:e}=await import(`./bridgePointer-B2FPGDWR.js`),t=await e(y);t||(console.error("Error: No recent session found in this directory or its worktrees. Run `claude remote-control` to start a new one."),process.exit(1));let{pointer:n,dir:r}=t,i=Math.round(n.ageMs/6e4),a=i<60?`${i}m`:`${Math.round(i/60)}h`,o=r===y?``:` from worktree ${r}`;console.error(`Resuming session ${n.sessionId} (${a} ago)${o}\u2026`),m=n.sessionId,g=r}let z=te();z.startsWith(`http://`)&&!z.includes(`localhost`)&&!z.includes(`127.0.0.1`)&&(console.error(`Error: Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`),process.exit(1));let B=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||z,{getBranch:V,getRemoteUrl:H,findGitRoot:re}=await import(`./git-D23Mzu_K.js`),{hasWorktreeCreateHook:U}=await import(`./hooks-
|
|
60
|
+
`);let t=await new Promise(t=>{e.question(`Enable Remote Control? (y/n) `,t)});e.close(),ne(e=>e.remoteDialogSeen?e:{...e,remoteDialogSeen:!0}),t.toLowerCase()!==`y`&&t.toLowerCase()!==`yes`&&process.exit(0)}if(f){let{readBridgePointerAcrossWorktrees:e}=await import(`./bridgePointer-B2FPGDWR.js`),t=await e(y);t||(console.error("Error: No recent session found in this directory or its worktrees. Run `claude remote-control` to start a new one."),process.exit(1));let{pointer:n,dir:r}=t,i=Math.round(n.ageMs/6e4),a=i<60?`${i}m`:`${Math.round(i/60)}h`,o=r===y?``:` from worktree ${r}`;console.error(`Resuming session ${n.sessionId} (${a} ago)${o}\u2026`),m=n.sessionId,g=r}let z=te();z.startsWith(`http://`)&&!z.includes(`localhost`)&&!z.includes(`127.0.0.1`)&&(console.error(`Error: Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`),process.exit(1));let B=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||z,{getBranch:V,getRemoteUrl:H,findGitRoot:re}=await import(`./git-D23Mzu_K.js`),{hasWorktreeCreateHook:U}=await import(`./hooks-QXGwOfWj.js`),W=U()||re(y)!==null,G=E?L().remoteControlSpawnMode:void 0;if(G===`worktree`&&!W&&(console.error(`Warning: Saved spawn mode is worktree but this directory is not a git repository. Falling back to same-dir.`),G=void 0,R(e=>e.remoteControlSpawnMode===void 0?e:{...e,remoteControlSpawnMode:void 0})),E&&!G&&W&&c===void 0&&!m&&process.stdin.isTTY){let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});console.log(`
|
|
61
61
|
Claude Remote Control is launching in spawn mode which lets you create new sessions in this project from Claude Code on Web or your Mobile app. Learn more here: https://code.claude.com/docs/en/remote-control
|
|
62
62
|
|
|
63
63
|
Spawn mode for this project:
|
|
@@ -65,4 +65,4 @@ Spawn mode for this project:
|
|
|
65
65
|
[2] worktree — each session gets an isolated git worktree
|
|
66
66
|
|
|
67
67
|
This can be changed later or explicitly set with --spawn=same-dir or --spawn=worktree.
|
|
68
|
-
`);let t=await new Promise(t=>{e.question(`Choose [1/2] (default: 1): `,t)});e.close();let n=t.trim()===`2`?`worktree`:`same-dir`;G=n,C(`tengu_bridge_spawn_mode_chosen`,{spawn_mode:n}),R(e=>e.remoteControlSpawnMode===n?e:{...e,remoteControlSpawnMode:n})}let K,q;m?(q=`single-session`,K=`resume`):c===void 0?G===void 0?(q=E?`same-dir`:`single-session`,K=`gate_default`):(q=G,K=`saved`):(q=c,K=`flag`);let ie=q===`single-session`?1:l??Ye,J=u??!0;if(!m){let{clearBridgePointer:e}=await import(`./bridgePointer-B2FPGDWR.js`);await e(y)}q===`worktree`&&!W&&(console.error(`Error: Worktree mode requires a git repository or WorktreeCreate hooks configured. Use --spawn=session for single-session mode.`),process.exit(1));let Y=await V(),ae=await H(),se=we(),ce=je(),{handleOAuth401Error:le}=await import(`./auth-
|
|
68
|
+
`);let t=await new Promise(t=>{e.question(`Choose [1/2] (default: 1): `,t)});e.close();let n=t.trim()===`2`?`worktree`:`same-dir`;G=n,C(`tengu_bridge_spawn_mode_chosen`,{spawn_mode:n}),R(e=>e.remoteControlSpawnMode===n?e:{...e,remoteControlSpawnMode:n})}let K,q;m?(q=`single-session`,K=`resume`):c===void 0?G===void 0?(q=E?`same-dir`:`single-session`,K=`gate_default`):(q=G,K=`saved`):(q=c,K=`flag`);let ie=q===`single-session`?1:l??Ye,J=u??!0;if(!m){let{clearBridgePointer:e}=await import(`./bridgePointer-B2FPGDWR.js`);await e(y)}q===`worktree`&&!W&&(console.error(`Error: Worktree mode requires a git repository or WorktreeCreate hooks configured. Use --spawn=session for single-session mode.`),process.exit(1));let Y=await V(),ae=await H(),se=we(),ce=je(),{handleOAuth401Error:le}=await import(`./auth-DxRiJwZ-.js`),de=ee({baseUrl:z,getAccessToken:N,runnerVersion:`2.6.11`,onDebug:v,onAuth401:le,getTrustedDeviceToken:fe}),X;if(m){try{F(m,`sessionId`)}catch{console.error(`Error: Invalid session ID "${m}". Session IDs must not contain unsafe characters.`),process.exit(1)}await M(),A();let{getBridgeSession:e}=await import(`./createSession-1ewHG3eq.js`),t=await e(m,{baseUrl:z,getAccessToken:N});if(!t){if(g){let{clearBridgePointer:e}=await import(`./bridgePointer-B2FPGDWR.js`);await e(g)}console.error(`Error: Session ${m} not found. It may have been archived or expired, or your login may have lapsed (run \`claude /login\`).`),process.exit(1)}if(!t.environment_id){if(g){let{clearBridgePointer:e}=await import(`./bridgePointer-B2FPGDWR.js`);await e(g)}console.error(`Error: Session ${m} has no environment_id. It may never have been attached to a bridge.`),process.exit(1)}X=t.environment_id,v(`[bridge:init] Resuming session ${m} on environment ${X}`)}let Z={dir:y,machineName:se,branch:Y,gitRepoUrl:ae,maxSessions:ie,spawnMode:q,verbose:n,sandbox:r,bridgeId:ce,workerType:`claude_code`,environmentId:je(),reuseEnvironmentId:X,apiBaseUrl:z,sessionIngressUrl:B,debugFile:i,sessionTimeoutMs:a};v(`[bridge:init] bridgeId=${ce}${X?` reuseEnvironmentId=${X}`:``} dir=${y} branch=${Y} gitRepoUrl=${ae} machine=${se}`),v(`[bridge:init] apiBaseUrl=${z} sessionIngressUrl=${B}`),v(`[bridge:init] sandbox=${r}${i?` debugFile=${i}`:``}`);let Q,me;try{let e=await de.registerBridgeEnvironment(Z);Q=e.environment_id,me=e.environment_secret}catch(e){C(`tengu_bridge_registration_failed`,{status:e instanceof P?e.status:void 0}),console.error(e instanceof P&&e.status===404?`Remote Control environments are not available for your account.`:`Error: ${h(e)}`),process.exit(1)}let he;if(m)if(X&&Q!==X)D(Error(`Bridge resume env mismatch: requested ${X}, backend returned ${Q}. Falling back to fresh session.`)),console.warn(`Warning: Could not resume session ${m} — its environment has expired. Creating a fresh session instead.`);else{let e=oe(m),t=e===m?[m]:[m,e],n=!1,r;for(let e of t)try{await de.reconnectSession(Q,e),v(`[bridge:init] Session ${e} re-queued via bridge/reconnect`),he=m,n=!0;break}catch(t){r=t,v(`[bridge:init] reconnectSession(${e}) failed: ${h(t)}`)}if(!n){let e=r,t=e instanceof P;if(g&&t){let{clearBridgePointer:e}=await import(`./bridgePointer-B2FPGDWR.js`);await e(g)}console.error(t?`Error: ${h(e)}`:`Error: Failed to reconnect session ${m}: ${h(e)}\nThe session may still be resumable — try running the same command again.`),process.exit(1)}}v(`[bridge:init] Registered, server environmentId=${Q}`);let ge=ve();C(`tengu_bridge_started`,{max_sessions:Z.maxSessions,has_debug_file:!!Z.debugFile,sandbox:Z.sandbox,verbose:Z.verbose,heartbeat_interval_ms:ge.non_exclusive_heartbeat_interval_ms,spawn_mode:Z.spawnMode,spawn_mode_source:K,multi_session_gate:E,pre_create_session:J,worktree_available:W}),w(`info`,`bridge_started`,{max_sessions:Z.maxSessions,sandbox:Z.sandbox,spawn_mode:Z.spawnMode});let _e=Ke({execPath:process.execPath,scriptArgs:Qe(),env:process.env,verbose:n,sandbox:r,debugFile:i,permissionMode:o,onDebug:v,onActivity:(e,t)=>{v(`[bridge:activity] sessionId=${e} ${t.type} ${t.summary}`)},onPermissionRequest:(e,t,n)=>{v(`[bridge:perm] sessionId=${e} tool=${t.request.tool_name} request_id=${t.request_id} (not auto-approving)`)}}),$=Le({verbose:n}),{parseGitHubRepository:ye}=await import(`./detectRepository-DCTvg4p0.js`),be=ae?ye(ae):null,xe=be?be.split(`/`).pop():Ee(y);$.setRepoInfo(xe,Y);let Se=q!==`single-session`&&W;Se&&$.setSpawnModeDisplay(q);let Ce=e=>{if(e[0]===3||e[0]===4){process.emit(`SIGINT`);return}if(e[0]===32){$.toggleQr();return}if(e[0]===119){if(!Se)return;let e=Z.spawnMode===`same-dir`?`worktree`:`same-dir`;Z.spawnMode=e,C(`tengu_bridge_spawn_mode_toggled`,{spawn_mode:e}),$.logStatus(e===`worktree`?`Spawn mode: worktree (new sessions get isolated git worktrees)`:`Spawn mode: same-dir (new sessions share the current directory)`),$.setSpawnModeDisplay(e),$.refreshDisplay(),R(t=>t.remoteControlSpawnMode===e?t:{...t,remoteControlSpawnMode:e});return}};process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on(`data`,Ce));let Te=new AbortController,De=()=>{v(`[bridge:shutdown] SIGINT received, shutting down`),Te.abort()},Oe=()=>{v(`[bridge:shutdown] SIGTERM received, shutting down`),Te.abort()};process.on(`SIGINT`,De),process.on(`SIGTERM`,Oe);let Ae=he||null;if(J&&!he){let{createBridgeSession:e}=await import(`./createSession-1ewHG3eq.js`);try{Ae=await e({environmentId:Q,title:s,events:[],gitRepoUrl:ae,branch:Y,signal:Te.signal,baseUrl:z,getAccessToken:N,permissionMode:o}),Ae&&v(`[bridge:init] Created initial session ${Ae}`)}catch(e){v(`[bridge:init] Session creation failed (non-fatal): ${h(e)}`)}}let Me=null;if(Ae&&q===`single-session`){let{writeBridgePointer:e}=await import(`./bridgePointer-B2FPGDWR.js`),t={sessionId:Ae,environmentId:Q,source:`standalone`};await e(Z.dir,t),Me=setInterval(e,3600*1e3,Z.dir,t),Me.unref?.()}try{await et(Z,Q,me,de,_e,$,Te.signal,void 0,Ae??void 0,async()=>(A(),await M(),N()))}finally{Me!==null&&clearInterval(Me),process.off(`SIGINT`,De),process.off(`SIGTERM`,Oe),process.stdin.off(`data`,Ce),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause()}process.exit(0)}var _t=class extends Error{constructor(e){super(e),this.name=`BridgeHeadlessPermanentError`}};async function vt(e,t){let{dir:n,log:r}=e;process.chdir(n);let{setOriginalCwd:i,setCwdState:a}=await import(`./state-B2GIOsTB.js`);i(n),a(n);let{enableConfigs:o,checkHasTrustDialogAccepted:s}=await import(`./config-JGm0O-ZQ.js`);o();let{initSinks:c}=await import(`./sinks-BCl9slVM.js`);if(c(),!s())throw new _t(`Workspace not trusted: ${n}. Run \`claude\` in that directory first to accept the trust dialog.`);if(!e.getAccessToken())throw Error(pe);let{getBridgeBaseUrl:l}=await import(`./bridgeConfig-Dkn5GGec.js`),u=l();if(u.startsWith(`http://`)&&!u.includes(`localhost`)&&!u.includes(`127.0.0.1`))throw new _t(`Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`);let d=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||u,{getBranch:f,getRemoteUrl:p,findGitRoot:m}=await import(`./git-D23Mzu_K.js`),{hasWorktreeCreateHook:g}=await import(`./hooks-QXGwOfWj.js`);if(e.spawnMode===`worktree`&&!(g()||m(n)!==null))throw new _t(`Worktree mode requires a git repository or WorktreeCreate hooks. Directory ${n} has neither.`);let _=await f(),v=await p(),y=we(),b=je(),x={dir:n,machineName:y,branch:_,gitRepoUrl:v,maxSessions:e.capacity,spawnMode:e.spawnMode,verbose:!1,sandbox:e.sandbox,bridgeId:b,workerType:`claude_code`,environmentId:je(),apiBaseUrl:u,sessionIngressUrl:d,sessionTimeoutMs:e.sessionTimeoutMs},S=ee({baseUrl:u,getAccessToken:e.getAccessToken,runnerVersion:`2.6.11`,onDebug:r,onAuth401:e.onAuth401,getTrustedDeviceToken:fe}),C,w;try{let e=await S.registerBridgeEnvironment(x);C=e.environment_id,w=e.environment_secret}catch(e){throw Error(`Bridge registration failed: ${h(e)}`)}let T=Ke({execPath:process.execPath,scriptArgs:Qe(),env:process.env,verbose:!1,sandbox:e.sandbox,permissionMode:e.permissionMode,onDebug:r}),E=yt(r);E.printBanner(x,C);let D;if(e.createSessionOnStart){let{createBridgeSession:n}=await import(`./createSession-1ewHG3eq.js`);try{let i=await n({environmentId:C,title:e.name,events:[],gitRepoUrl:v,branch:_,signal:t,baseUrl:u,getAccessToken:e.getAccessToken,permissionMode:e.permissionMode});i&&(D=i,r(`created initial session ${i}`))}catch(e){r(`session pre-creation failed (non-fatal): ${h(e)}`)}}await et(x,C,w,S,T,E,t,void 0,D,async()=>e.getAccessToken())}function yt(e){let t=()=>{};return{printBanner:(t,n)=>e(`registered environmentId=${n} dir=${t.dir} spawnMode=${t.spawnMode} capacity=${t.maxSessions}`),logSessionStart:(t,n)=>e(`session start ${t}`),logSessionComplete:(t,n)=>e(`session complete ${t} (${n}ms)`),logSessionFailed:(t,n)=>e(`session failed ${t}: ${n}`),logStatus:e,logVerbose:e,logError:t=>e(`error: ${t}`),logReconnected:t=>e(`reconnected after ${t}ms`),addSession:(t,n)=>e(`session attached ${t}`),removeSession:t=>e(`session detached ${t}`),updateIdleStatus:t,updateReconnectingStatus:t,updateSessionStatus:t,updateSessionActivity:t,updateSessionCount:t,updateFailedStatus:t,setSpawnModeDisplay:t,setRepoInfo:t,setDebugLogPath:t,setAttached:t,setSessionTitle:t,clearStatus:t,toggleQr:t,refreshDisplay:t}}export{dt as a,rt as i,gt as n,vt as o,nt as r,et as s,_t as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./bridgeMain-Bu2oOX31.js";export{e as bridgeMain};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{L as n,T as r,V as i,d as a,s as o,w as s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{B as u,J as d,K as f,M as p,S as m,T as h,W as g,X as _,et as v,g as y,m as b,z as x}from"./log-CzsijfHZ.js";import{P as S,Z as C,n as w,t as T}from"./rcDebugLog-
|
|
1
|
+
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{L as n,T as r,V as i,d as a,s as o,w as s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{B as u,J as d,K as f,M as p,S as m,T as h,W as g,X as _,et as v,g as y,m as b,z as x}from"./log-CzsijfHZ.js";import{P as S,Z as C,n as w,t as T}from"./rcDebugLog-CTOZ2K3E.js";import{t as E}from"./controlMessageCompat-BJhFiS7u.js";import{randomUUID as D}from"crypto";c(),S(),o(),T(),b(),i(),s(),v(),e();function O(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function k(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function A(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function j(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function M(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return y(n)||void 0}var N=`system-reminder`,P=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,F=new Set([m,h,p,x,u,g,f,d,_]);function I(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function L(e){let t=e.trim();if(!t)return null;P.lastIndex=0;let n=[];for(;P.lastIndex<t.length;){let e=P.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function R(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=L(I(e));return t?t.some(e=>e!==`local-command-caveat`&&e!==N&&F.has(e)):!0}function z(e){return e.some(R)}function B(e,t,i,o,s,c){try{let n=E(r(e));if(k(n)){a(`[bridge:repl] Ingress message type=control_response`),s?.(n);return}if(A(n)){a(`[bridge:repl] Inbound control_request subtype=${n.request.subtype}`),c?.(n);return}if(!O(n))return;let u=`uuid`in n&&typeof n.uuid==`string`?n.uuid:void 0;if(u&&t.has(u)){a(`[bridge:repl] Ignoring echo: type=${n.type} uuid=${u}`);return}if(u&&i.has(u)){a(`[bridge:repl] Ignoring re-delivered inbound: type=${n.type} uuid=${u}`);return}a(`[bridge:repl] Ingress message type=${n.type}${u?` uuid=${u}`:``}`),n.type===`user`?(u&&i.add(u),l(`tengu_bridge_message_received`,{is_repl:!0}),o?.(n)):a(`[bridge:repl] Ignoring non-user inbound message: type=${n.type}`)}catch(e){a(`[bridge:repl] Failed to parse ingress message: ${n(e)}`)}}var V=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function H(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:o,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){a(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:V}};let t={...u,session_id:r};n.write(t),a(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:o?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),w(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),a(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function U(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...C},modelUsage:{},permission_denials:[],session_id:e,uuid:D()}}var W=class{constructor(e){t(this,`capacity`,void 0),t(this,`ring`,void 0),t(this,`set`,new Set),t(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{j as a,z as c,H as i,M as n,U as o,B as r,R as s,W as t};
|