claude-code-best 2.8.1 → 2.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-CNyPaerF.js → AddWorkspaceDirectory-BCCbaWoh.js} +1 -1
- package/dist/chunks/{App-hiKxO6UA.js → App-BIAYUFvT.js} +1 -1
- package/dist/chunks/{ApproveApiKey-Cd43j9Wa.js → ApproveApiKey-DRARgWX3.js} +1 -1
- package/dist/chunks/ApproveApiKey-Do-Qth0X.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-C8OxwSGM.js → AssistantSessionChooser-eUrEGDlX.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-VKhuyQLe.js → BackgroundTasksDialog-DSeAqhMC.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-Ddjzluka.js → BypassPermissionsModeDialog-8z7R5EpU.js} +1 -1
- package/dist/chunks/{ClaudeInChromeOnboarding-BhvrEJlm.js → ClaudeInChromeOnboarding-B7mDm5Hb.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-DoNd72PS.js → ClaudeMdExternalIncludesDialog-DE9dpWtg.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DTZS-dek.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-UcQCmIWd.js +1 -0
- package/dist/chunks/{DesktopHandoff-DVUOZjb0.js → DesktopHandoff-Ce0nE7D6.js} +1 -1
- package/dist/chunks/{DevChannelsDialog-DJbRHAIy.js → DevChannelsDialog-mt0lA5wR.js} +1 -1
- package/dist/chunks/{DiffDialog-D0RK4t-9.js → DiffDialog-BfSnz8L-.js} +1 -1
- package/dist/chunks/{Doctor-0Nv3L1Oy.js → Doctor-BOVjkAKn.js} +1 -1
- package/dist/chunks/Doctor-osWC5WVY.js +1 -0
- package/dist/chunks/{ExitFlow-BPbtGcEg.js → ExitFlow-C3BGvwv-.js} +1 -1
- package/dist/chunks/{Feedback-BSagYjmf.js → Feedback-BtZb1A8b.js} +1 -1
- package/dist/chunks/Grove-DyC_Wrfx.js +1 -0
- package/dist/chunks/{Grove-BrP9JNpK.js → Grove-HpMLktXp.js} +1 -1
- package/dist/chunks/{HybridTransport-DLaxmXCR.js → HybridTransport-COk7jAC7.js} +1 -1
- package/dist/chunks/{ITermBackend-tXN55G2D.js → ITermBackend-BlwyeN8U.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-BzFQdfwu.js → InvalidConfigDialog-QVIRDXwA.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-KFg61s41.js → InvalidSettingsDialog-CZRZm0oa.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-N-oJu3qn.js → MCPConnectionManager-2Fulnp8q.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-DsHSSgsx.js → McpParsingWarnings-DWMO0bV6.js} +1 -1
- package/dist/chunks/{MessageSelector-D10JMnsc.js → MessageSelector-B4jJQ-KQ.js} +1 -1
- package/dist/chunks/{Messages-CQdQJ2AA.js → Messages-ltcn1Qkf.js} +2 -2
- package/dist/chunks/{Onboarding-DBJX6Cnf.js → Onboarding-CHcND5Tt.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-B4beCEX2.js → OverageCreditUpsell-CMBqZrnz.js} +1 -1
- package/dist/chunks/{PluginSettings-BBrFCSpQ.js → PluginSettings-DIS_qrVA.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-Bjjr3tYl.js → PromptInputHelpMenu-CAwbW7z2.js} +1 -1
- package/dist/chunks/{QueryEngine-BSk8-8vB.js → QueryEngine-BQs519Rb.js} +1 -1
- package/dist/chunks/REPL-DJh_wVWI.js +1 -0
- package/dist/chunks/{REPL-CXcCBQuz.js → REPL-Dx3SPe95.js} +6 -6
- package/dist/chunks/{RemoteCallout-CuxqarhC.js → RemoteCallout-CwI1mLQ9.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-BhPF41Wn.js → RemoteSessionManager-BXMBhfQD.js} +1 -1
- package/dist/chunks/{ResumeConversation-hmIOkZ2U.js → ResumeConversation-BK7L_YBI.js} +1 -1
- package/dist/chunks/{SSETransport-8yaTbdSK.js → SSETransport-Co-0nMlR.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-DVi-ggud.js +1 -0
- package/dist/chunks/SentryErrorBoundary-DLML64E_.js +1 -0
- package/dist/chunks/{SentryErrorBoundary-ydwbrVTx.js → SentryErrorBoundary-kEgE7qeH.js} +1 -1
- package/dist/chunks/{Settings-BSbzT25q.js → Settings-DOve7mW1.js} +2 -2
- package/dist/chunks/{TeleportProgress-CNcl_DxR.js → TeleportProgress--n-u7MYY.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-DJc8_mjE.js → TeleportRepoMismatchDialog-CzQzdYb2.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-Cw438s-J.js → TeleportResumeWrapper-CtANoO1Z.js} +1 -1
- package/dist/chunks/{ThemePicker-8X6yAwuQ.js → ThemePicker-kBt6obJb.js} +1 -1
- package/dist/chunks/{TmuxBackend-CqAnVFoI.js → TmuxBackend-Q5xdOkW4.js} +1 -1
- package/dist/chunks/{TrustDialog-Ch1FJzxi.js → TrustDialog-CoCFqyRD.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-sgfvJPWZ.js → ValidationErrorsList-CL42YlaS.js} +1 -1
- package/dist/chunks/{WelcomeV2-Bu8l3w90.js → WelcomeV2-B0d9sH1c.js} +1 -1
- package/dist/chunks/{WindowsTerminalBackend-Bvq7nHOp.js → WindowsTerminalBackend-CLSeqqHh.js} +1 -1
- package/dist/chunks/{add-dir-DqrRNnxe.js → add-dir-IrADCHV-.js} +1 -1
- package/dist/chunks/{agentDisplay-DcxzWi1v.js → agentDisplay-BUXpQhYh.js} +1 -1
- package/dist/chunks/{agents-QqLm1wcM.js → agents-BqQtaTaM.js} +1 -1
- package/dist/chunks/{agents-Do1ynqiW.js → agents-Cx0f6suK.js} +1 -1
- package/dist/chunks/{ant-D5gD6O-r.js → ant-BUkS8Em4.js} +1 -1
- package/dist/chunks/api-CoBZPEi-.js +1 -0
- package/dist/chunks/{api-hcsOinLV.js → api-Cy1N7XAQ.js} +1 -1
- package/dist/chunks/assistant-B2_c5C4T.js +1 -0
- package/dist/chunks/{assistant-DkECAILU.js → assistant-BGzd9a5x.js} +1 -1
- package/dist/chunks/{assistant-CemNvrYr.js → assistant-C3dP-BSJ.js} +1 -1
- package/dist/chunks/auth-CRVuUNwf.js +1 -0
- package/dist/chunks/{auth-Dm8aWPRh.js → auth-DVtMm7Hj.js} +1 -1
- package/dist/chunks/{autoMode-dygqoN_C.js → autoMode-ThlM20qr.js} +1 -1
- package/dist/chunks/{autonomy-BdxnxJnk.js → autonomy-B637YdCF.js} +1 -1
- package/dist/chunks/{autonomy-DPeEmb00.js → autonomy-B_vxYZbV.js} +1 -1
- package/dist/chunks/{autonomyPanel-Bocl2taZ.js → autonomyPanel-BM2VhTsn.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-BWAfdRVf.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-zf-tDimg.js → backgroundHousekeeping-Cll7XHG1.js} +2 -2
- package/dist/chunks/{branch-DwdVgun5.js → branch-BlH5WYNu.js} +1 -1
- package/dist/chunks/{bridge-DkkMogD_.js → bridge-QRFJRzVG.js} +2 -2
- package/dist/chunks/{bridgeConfig-l6Ldi_hk.js → bridgeConfig-Di9LziJ3.js} +1 -1
- package/dist/chunks/bridgeConfig-pVTHa_ED.js +1 -0
- package/dist/chunks/bridgeEnabled-c_BeJX3S.js +1 -0
- package/dist/chunks/{bridgeEnabled-DYclTb9d.js → bridgeEnabled-z1fPRzzV.js} +1 -1
- package/dist/chunks/bridgeMain-CHk_DCxy.js +1 -0
- package/dist/chunks/{bridgeMain-Ct5oDosG.js → bridgeMain-DVoobI7G.js} +6 -6
- package/dist/chunks/{bridgeMessaging-CYe1Cixl.js → bridgeMessaging-BG8fNZac.js} +1 -1
- package/dist/chunks/{btw-CyOlY5R-.js → btw-DpeWZQbf.js} +1 -1
- package/dist/chunks/{buddy-q-utA1_5.js → buddy-Bni2g0Km.js} +1 -1
- package/dist/chunks/{bypassPermissionsKillswitch-CTrRxzdz.js → bypassPermissionsKillswitch-7e56Rquc.js} +1 -1
- package/dist/chunks/caches-3byHT6VF.js +1 -0
- package/dist/chunks/{caches-Bz4yVQyE.js → caches-CzEBsMvP.js} +2 -2
- package/dist/chunks/{ccrClient-DXiEw9xU.js → ccrClient-iR6zwGb1.js} +1 -1
- package/dist/chunks/changeDetector-Cg75mKOu.js +1 -0
- package/dist/chunks/channelNotification-BSmZprUZ.js +1 -0
- package/dist/chunks/{channelNotification-CLPdvxGZ.js → channelNotification-CSmLgwtO.js} +1 -1
- package/dist/chunks/{chrome-DxbhLWDW.js → chrome-BO1vbvZ0.js} +1 -1
- package/dist/chunks/clear-CTOCrXv_.js +1 -0
- package/dist/chunks/client-BgdjJNnC.js +1 -0
- package/dist/chunks/{color-DiLtK8_L.js → color-BP4FmcMn.js} +1 -1
- package/dist/chunks/commands-CkfOhzGE.js +1 -0
- package/dist/chunks/commitAttribution-DKvggTZx.js +1 -0
- package/dist/chunks/{commitAttribution-CJXF8wMs.js → commitAttribution-Djh1ZpYH.js} +1 -1
- package/dist/chunks/{compact-C6xm1N5a.js → compact-BtAvCkY0.js} +1 -1
- package/dist/chunks/{companion-rXSt0nmz.js → companion-C-jfFhlz.js} +1 -1
- package/dist/chunks/{config-CzC08IjE.js → config-CloXpblh.js} +1 -1
- package/dist/chunks/{config-BE3jrcr-.js → config-DwsIX0hc.js} +1 -1
- package/dist/chunks/{context-BHE99SMA.js → context-DdwMoH4j.js} +1 -1
- package/dist/chunks/{context-noninteractive-BZQIUH_y.js → context-noninteractive-BWbEqad6.js} +1 -1
- package/dist/chunks/context-noninteractive-DNOyQYnM.js +1 -0
- package/dist/chunks/{conversation-CBPRFDod.js → conversation-DR4MFYYi.js} +1 -1
- package/dist/chunks/conversation-DVhyJA1O.js +1 -0
- package/dist/chunks/{copy-TgphIVzy.js → copy-tl-41wwU.js} +1 -1
- package/dist/chunks/{createSSHSession-CSKEZ4ic.js → createSSHSession-B_IyqOll.js} +1 -1
- package/dist/chunks/createSession-CIM50iEU.js +1 -0
- package/dist/chunks/{createSession-Ce218tQj.js → createSession-Csaqw8kb.js} +1 -1
- package/dist/chunks/{cronJitterConfig-CnKed5Gi.js → cronJitterConfig-2sHTXBLu.js} +1 -1
- package/dist/chunks/{crossProjectResume-BFlsTYOq.js → crossProjectResume-C1I0X__e.js} +1 -1
- package/dist/chunks/{datadog-D5jSRybW.js → datadog-BzkFYNcv.js} +1 -1
- package/dist/chunks/datadog-vQKKqB6Z.js +1 -0
- package/dist/chunks/{desktop-cjA0tGOa.js → desktop-oTXppB2O.js} +1 -1
- package/dist/chunks/{diff-DMd61IjE.js → diff-B23DUoT8.js} +1 -1
- package/dist/chunks/{doctor-ueUYyjyL.js → doctor-o2MJvjAE.js} +1 -1
- package/dist/chunks/{effort-B9IvAstG.js → effort-B1X_S_oa.js} +1 -1
- package/dist/chunks/{entry-Bq_KRMWs.js → entry-BAXMpXJ0.js} +5 -5
- package/dist/chunks/envLessBridgeConfig-Dj0umjOo.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-CpjlwmvF.js → envLessBridgeConfig-YNTOVEqU.js} +1 -1
- package/dist/chunks/{exit-DtjFIrvJ.js → exit-CwGJifQF.js} +1 -1
- package/dist/chunks/{export-CP638-TO.js → export-CqbYdFmJ.js} +1 -1
- package/dist/chunks/{exportRenderer-B5emJDvn.js → exportRenderer-DP_z8YD1.js} +1 -1
- package/dist/chunks/extra-usage-1FUBiJOE.js +1 -0
- package/dist/chunks/{extra-usage-DIm8nrKj.js → extra-usage-BQ5Z1wJb.js} +1 -1
- package/dist/chunks/{extra-usage-core-DERKSEe1.js → extra-usage-core-B1oJoxYa.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-Dq5dog_-.js → extra-usage-noninteractive-BV_6cpdd.js} +1 -1
- package/dist/chunks/{extraUsage-BMvDY0Sk.js → extraUsage-Ca_6qcke.js} +1 -1
- package/dist/chunks/extractMemories-B-yrLjpP.js +1 -0
- package/dist/chunks/{fast-BP2t1xDM.js → fast-BJMGfO_S.js} +1 -1
- package/dist/chunks/fast-CFtN26up.js +1 -0
- package/dist/chunks/{feedback-C-mR6zJr.js → feedback-O0Gushxg.js} +1 -1
- package/dist/chunks/{firstPartyEventLogger-sMmHdYjg.js → firstPartyEventLogger-0s2WJ6SR.js} +1 -1
- package/dist/chunks/{flushGate-C18XwNsa.js → flushGate-CLjpgnG6.js} +1 -1
- package/dist/chunks/gates-4fq2Ws2D.js +1 -0
- package/dist/chunks/{gates-Be5r2kKS.js → gates-C5y8P5t9.js} +1 -1
- package/dist/chunks/{gemini-BberPcp1.js → gemini-D6lfJRGH.js} +1 -1
- package/dist/chunks/{generateRecap-B76UcVUS.js → generateRecap-AYujRzfu.js} +1 -1
- package/dist/chunks/{generateSessionName-BwtXd8TC.js → generateSessionName-CXg1uVLN.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-5IlVgR2l.js → githubRepoPathMapping-CdjkMIX3.js} +1 -1
- package/dist/chunks/{goal-DQ0jNcLO.js → goal-BGr-SlcA.js} +1 -1
- package/dist/chunks/{grok-Dh_thT2_.js → grok-DxyRt4Jq.js} +1 -1
- package/dist/chunks/{growthbook-4ADV3CAt.js → growthbook-D93ZmHUL.js} +1 -1
- package/dist/chunks/{heapdump-Dwqmh4SX.js → heapdump-DZz5qnZg.js} +1 -1
- package/dist/chunks/{help-Bznaywoi.js → help-C8HhaC70.js} +1 -1
- package/dist/chunks/hooks-CmW7bdtz.js +1 -0
- package/dist/chunks/{hooks-F-82cg6M.js → hooks-De2yBPig.js} +1 -1
- package/dist/chunks/{hostAdapter-DpfLr3hX.js → hostAdapter-CZdJUeS1.js} +1 -1
- package/dist/chunks/{ide-BfAKWufQ.js → ide-GnSLasRI.js} +1 -1
- package/dist/chunks/{inboundAttachments-CFV_eqMu.js → inboundAttachments-C8y3D5mp.js} +1 -1
- package/dist/chunks/inboundAttachments-DZiITyN8.js +1 -0
- package/dist/chunks/{initReplBridge-DV9KhSic.js → initReplBridge-YGXqLbNZ.js} +1 -1
- package/dist/chunks/{insights-BNsCwNYa.js → insights-23tyPxXV.js} +1 -1
- package/dist/chunks/{install-Bszzs98N.js → install-BXi4d63r.js} +1 -1
- package/dist/chunks/{install-github-app-DVxGR2rp.js → install-github-app-D2X7BgzJ.js} +1 -1
- package/dist/chunks/{install-slack-app-CjlRL19o.js → install-slack-app-_J1t0kSP.js} +1 -1
- package/dist/chunks/{instrumentation-BOYPOtyu.js → instrumentation-C9WDRy-K.js} +3 -3
- package/dist/chunks/{job-BvD5_lGz.js → job-DXX7dNN_.js} +1 -1
- package/dist/chunks/{keybindings-RPmPPGhp.js → keybindings-CChhkkE0.js} +1 -1
- package/dist/chunks/{lang-9VNaOJMz.js → lang-COIVItM_.js} +1 -1
- package/dist/chunks/language-CiMwEWO-.js +1 -0
- package/dist/chunks/{language-Ct5Nkqm6.js → language-DzWvcLCu.js} +1 -1
- package/dist/chunks/{launchAgentsPlatform-CnoxFIXV.js → launchAgentsPlatform-Du_WvKeU.js} +1 -1
- package/dist/chunks/{launchAutofixPr-ChaDUtvx.js → launchAutofixPr-CypNniKH.js} +1 -1
- package/dist/chunks/{launchLocalMemory-MwZfEJxz.js → launchLocalMemory-GkqB_Gcr.js} +1 -1
- package/dist/chunks/{launchLocalVault-B6Ib5WXx.js → launchLocalVault-CBihJDzq.js} +1 -1
- package/dist/chunks/{launchMemoryStores-D6xyGwQ1.js → launchMemoryStores-BkK0wwq0.js} +1 -1
- package/dist/chunks/{launchOnboarding-BtdAOO3p.js → launchOnboarding-BubTG5vY.js} +1 -1
- package/dist/chunks/{launchSchedule-XVljzNKg.js → launchSchedule-CkV6Ai-0.js} +1 -1
- package/dist/chunks/{launchSkillStore-QT8Qcc5N.js → launchSkillStore-DIrFg_WZ.js} +1 -1
- package/dist/chunks/{launchTeleport-DwxPesKQ.js → launchTeleport-DFrgN9sU.js} +1 -1
- package/dist/chunks/{launchVault-Dbti6pph.js → launchVault-CIiNsg91.js} +1 -1
- package/dist/chunks/loadAgentsDir-CjhNkoq0.js +1 -0
- package/dist/chunks/{loadAgentsDir-BYWykYwn.js → loadAgentsDir-DC4jN6-f.js} +53 -53
- package/dist/chunks/{loadPluginHooks-2U3UO__Q.js → loadPluginHooks-DukITDP2.js} +1 -1
- package/dist/chunks/{localSearch-eWjZxMc8.js → localSearch-But4wyLg.js} +1 -1
- package/dist/chunks/localSearch-D8FFon8N.js +1 -0
- package/dist/chunks/login-B3TV33p4.js +1 -0
- package/dist/chunks/{login-D1aQCqp0.js → login-ajsn1Sg7.js} +1 -1
- package/dist/chunks/{logoV2Utils-CPNvLtol.js → logoV2Utils-CpeUvaOM.js} +1 -1
- package/dist/chunks/logout-BqbTEPv9.js +1 -0
- package/dist/chunks/{magicDocs-DAvjAbAJ.js → magicDocs-TF6U6QoB.js} +1 -1
- package/dist/chunks/{main-BKlQiSuc.js → main-bjQRqaUr.js} +15 -15
- package/dist/chunks/mappers-Bg-xtimK.js +1 -0
- package/dist/chunks/{mcp-Cmw8ecKk.js → mcp-DtHGTZUo.js} +1 -1
- package/dist/chunks/{mcp-C3jlClk0.js → mcp-Vj0ijoSq.js} +2 -2
- package/dist/chunks/{mcp-ya96irNP.js → mcp-i8lqdWTr.js} +1 -1
- package/dist/chunks/{mcpServer-B1q9blAc.js → mcpServer-CuqaXxiJ.js} +1 -1
- package/dist/chunks/{mcpServer-BJB5g6j2.js → mcpServer-Dr9UfcEd.js} +1 -1
- package/dist/chunks/{memory-CxiukAGg.js → memory-DVJxsbcO.js} +1 -1
- package/dist/chunks/{mode-DqAJ2y6R.js → mode-C9yWWppB.js} +1 -1
- package/dist/chunks/model-BYSyXf9-.js +1 -0
- package/dist/chunks/{model-C8TW-qjl.js → model-Dq-13vaB.js} +1 -1
- package/dist/chunks/{onChangeAppState-BG1pF7ht.js → onChangeAppState-Cc4zOnqx.js} +1 -1
- package/dist/chunks/{openai-CHoRhRtf.js → openai-DMCGGZts.js} +1 -1
- package/dist/chunks/{overageCreditGrant-DYMg1lV4.js → overageCreditGrant-CzkWDmsQ.js} +1 -1
- package/dist/chunks/{panelCall-SYrmrKt9.js → panelCall-D36EWzwF.js} +1 -1
- package/dist/chunks/{passes-CSV-SZJc.js → passes-CPAwB9_F.js} +1 -1
- package/dist/chunks/{paths-BZjPDxMm.js → paths-CEAy4QCs.js} +2 -2
- package/dist/chunks/{permissions-DBddT2NP.js → permissions-B39hfy0O.js} +1 -1
- package/dist/chunks/{pipeTransport-uK7GxbSG.js → pipeTransport-7auNUakO.js} +1 -1
- package/dist/chunks/{plan-DEbo-Adi.js → plan-pCEs76NM.js} +1 -1
- package/dist/chunks/{plugin-Cops24hg.js → plugin-BSC-7wQh.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-Bg7JMOHN.js → pluginAutoupdate-Cre72Rtf.js} +1 -1
- package/dist/chunks/{pluginBlocklist-DEM_RWc2.js → pluginBlocklist-D2Cj4TR2.js} +1 -1
- package/dist/chunks/{pluginCliCommands-DyYEg7Cv.js → pluginCliCommands-CTxmCPph.js} +1 -1
- package/dist/chunks/{pluginFlagging-DwChUZMJ.js → pluginFlagging-C5EGcjZe.js} +1 -1
- package/dist/chunks/{pluginOperations-COyT4tHs.js → pluginOperations-DDI1CG0K.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DCxJJkYs.js → pluginStartupCheck-B3QqfRt6.js} +1 -1
- package/dist/chunks/pluginStartupCheck-DYC8CWxw.js +1 -0
- package/dist/chunks/{plugins-BanQjHmw.js → plugins-Bz7JxD43.js} +1 -1
- package/dist/chunks/policyLimits-C-oHygGe.js +1 -0
- package/dist/chunks/{pollConfig-DBNHhvHf.js → pollConfig-CyO4Ycwc.js} +1 -1
- package/dist/chunks/{poor-aPQce502.js → poor-eRoBwI0Z.js} +1 -1
- package/dist/chunks/{poorMode-CFRuV-nB.js → poorMode-BdNsLBQ-.js} +1 -1
- package/dist/chunks/poorMode-D2-4vRxb.js +1 -0
- package/dist/chunks/{print-Cf2tY__0.js → print-Ogibzjap.js} +4 -4
- package/dist/chunks/{privacy-settings-CYkM3Aem.js → privacy-settings-Dd7PtKbY.js} +1 -1
- package/dist/chunks/{processBashCommand-BLSC8o8M.js → processBashCommand-BjdUo_Na.js} +1 -1
- package/dist/chunks/{processSlashCommand-Ch9B-6nh.js → processSlashCommand-tetvMLMl.js} +1 -1
- package/dist/chunks/prompt-BHI7PZe4.js +227 -0
- package/dist/chunks/prompt-DZ1EAUlC.js +1 -0
- package/dist/chunks/prompt-DeRHlPn1.js +1 -0
- package/dist/chunks/{promptEditor-U03qQWbq.js → promptEditor-DoJ-xPi4.js} +1 -1
- package/dist/chunks/{protocolHandler-3yBj9w5N.js → protocolHandler-Dgzu5UWb.js} +1 -1
- package/dist/chunks/{rate-limit-options-D-xl_9PO.js → rate-limit-options-B6QH2-xn.js} +1 -1
- package/dist/chunks/{rcDebugLog-ClX1msJX.js → rcDebugLog-C0Bam8V9.js} +1 -1
- package/dist/chunks/{referral-qe-yqXJE.js → referral-B10JtHMk.js} +1 -1
- package/dist/chunks/{refresh-CO_P3WKA.js → refresh-DmEsCaJ0.js} +1 -1
- package/dist/chunks/{registerProtocol-CClQph00.js → registerProtocol-CQjmvg7a.js} +1 -1
- package/dist/chunks/{registry-C0zdU2Hb.js → registry-CLaXh4Gk.js} +1 -1
- package/dist/chunks/{release-notes-CyZHxWTF.js → release-notes-dxng0ob_.js} +1 -1
- package/dist/chunks/{releaseNotes-BtxL5R5Q.js → releaseNotes-CS5L5W0H.js} +2 -2
- package/dist/chunks/{reload-plugins-B0eR8JHH.js → reload-plugins-CgzAjBDp.js} +1 -1
- package/dist/chunks/{remote-env-B_sIjY87.js → remote-env-BasfU8Ra.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-C3WRaLpU.js → remoteBridgeCore-IJI5koHz.js} +1 -1
- package/dist/chunks/{remoteControlServer-BOj9qmgH.js → remoteControlServer-BBCt7ySV.js} +1 -1
- package/dist/chunks/{rename-BFAC3WLD.js → rename-eEdSZsJ2.js} +1 -1
- package/dist/chunks/{resume-CpivBr9S.js → resume-DjnfattK.js} +1 -1
- package/dist/chunks/{runtimeObserver-sOnfVR7t.js → runtimeObserver-ByTBtmBf.js} +2 -2
- package/dist/chunks/{runtimeObserver-C2_7Vsnd.js → runtimeObserver-COpkJmg-.js} +1 -1
- package/dist/chunks/sandbox-adapter-DagBhoTC.js +1 -0
- package/dist/chunks/{sandbox-toggle-Bv68-Ca7.js → sandbox-toggle-CQohaYND.js} +1 -1
- package/dist/chunks/searchExtraTools-kk-wV-cC.js +1 -0
- package/dist/chunks/{sentry-BBCn6RGP.js → sentry-C0bQlih_.js} +1 -1
- package/dist/chunks/{session-DfvxYP8o.js → session-Dx_ODOHl.js} +1 -1
- package/dist/chunks/{sessionDiscovery-CyuRBTAm.js → sessionDiscovery-DAqs0Ra6.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-C-Ic-0Ry.js +1 -0
- package/dist/chunks/sessionMemory-BMtFup-Y.js +1 -0
- package/dist/chunks/{sessionMemory-kYQnpcyG.js → sessionMemory-Bq3ECr1S.js} +1 -1
- package/dist/chunks/sessionMemoryUtils-BU7N_IQG.js +1 -0
- package/dist/chunks/sessionObserver-BwAfzGUg.js +1 -0
- package/dist/chunks/{sessionObserver-CTkIYplM.js → sessionObserver-rd6RRTzc.js} +1 -1
- package/dist/chunks/sessionStorage-X2u45U9z.js +1 -0
- package/dist/chunks/{sessionTitle-ePQRpeV2.js → sessionTitle-1k_2BhFL.js} +1 -1
- package/dist/chunks/{sessionTracing-81-RIJBo.js → sessionTracing-DNSDPYdR.js} +1 -1
- package/dist/chunks/{settingsSync-DEFWnE1o.js → settingsSync-3xG2A_wN.js} +1 -1
- package/dist/chunks/{setup-BJSk1czd.js → setup-C2V4elOv.js} +2 -2
- package/dist/chunks/{setup-2611vmGJ.js → setup-CY808VaY.js} +1 -1
- package/dist/chunks/{setup-CTfYsKsz.js → setup-Hlga8GJ_.js} +1 -1
- package/dist/chunks/{shadowedRuleDetection-CGD7Nx03.js → shadowedRuleDetection-BdBNo5eP.js} +1 -1
- package/dist/chunks/{sideQuestion-BcP9Mm-5.js → sideQuestion-DWOCUKMh.js} +1 -1
- package/dist/chunks/{sink-D_t1TIt9.js → sink-DCh0VJ4g.js} +1 -1
- package/dist/chunks/sink-nZmawD5W.js +1 -0
- package/dist/chunks/sinks-BTZnXPr_.js +1 -0
- package/dist/chunks/{sinks-DXsozhmS.js → sinks-_9T2oPB_.js} +2 -2
- package/dist/chunks/{skill-learning-CZm2iMik.js → skill-learning-CzZFGFZO.js} +1 -1
- package/dist/chunks/{skillChangeDetector-1aFn40GC.js → skillChangeDetector-345QNWDp.js} +1 -1
- package/dist/chunks/{skillGapStore-cWo6Ra90.js → skillGapStore-Bz_qbwI1.js} +2 -2
- package/dist/chunks/{skillGapStore-DzHv8v-D.js → skillGapStore-DJm3SULe.js} +1 -1
- package/dist/chunks/{skillGenerator-D_W1IeP3.js → skillGenerator-BcNv-VZ5.js} +2 -2
- package/dist/chunks/skillLearning-BJAfTX2G.js +1 -0
- package/dist/chunks/skillLearning-DPhuKS4j.js +1 -0
- package/dist/chunks/{skillPanel-ChmOZu4F.js → skillPanel-Q85P-Gg4.js} +3 -3
- package/dist/chunks/{skillSearchPanel-CVx2b4Pr.js → skillSearchPanel-CMCQDAcX.js} +2 -2
- package/dist/chunks/{skills-CWX1SydA.js → skills-D3eUg3HG.js} +1 -1
- package/dist/chunks/{sprites-BuvEFwW6.js → sprites-ChoMSqpa.js} +1 -1
- package/dist/chunks/{stats-wjMQA-CA.js → stats-DdhEa_6-.js} +1 -1
- package/dist/chunks/{status-CyU7IQhO.js → status-CX7Kgn21.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-JNibsI_v.js → statusNoticeHelpers-AibXOONm.js} +1 -1
- package/dist/chunks/{tag-opEEZI5B.js → tag-BJ_u3aJm.js} +1 -1
- package/dist/chunks/{tasks-CCtnU5u1.js → tasks-DeEWOchP.js} +1 -1
- package/dist/chunks/teamHelpers-CxoQp7OY.js +1 -0
- package/dist/chunks/{teamHelpers-BJJs8taN.js → teamHelpers-WmWa_h3B.js} +1 -1
- package/dist/chunks/{teammateModeSnapshot-CLiiOCkO.js → teammateModeSnapshot-DZ6ulELC.js} +1 -1
- package/dist/chunks/teammateModeSnapshot-KWxn1jxl.js +1 -0
- package/dist/chunks/{teleport-ClxQigSQ.js → teleport-CuDXJj_f.js} +1 -1
- package/dist/chunks/{templateJobs-C6D7GC-Q.js → templateJobs-nFBp68za.js} +1 -1
- package/dist/chunks/{terminalSetup-B3bN4Cj8.js → terminalSetup-BORjK3qH.js} +1 -1
- package/dist/chunks/{terminalSetup-2ioFcRAA.js → terminalSetup-DULcnnWe.js} +1 -1
- package/dist/chunks/{theme-Dgq_Og2P.js → theme-Bf2QD0ja.js} +1 -1
- package/dist/chunks/thinkback-C1nnGg5r.js +1 -0
- package/dist/chunks/{thinkback-C43WBHis.js → thinkback-DZEhr3Ii.js} +1 -1
- package/dist/chunks/{thinkback-play-D2_n_aoQ.js → thinkback-play-BtEBESXM.js} +1 -1
- package/dist/chunks/{toolEventObserver-BG_3sGCL.js → toolEventObserver-CNZy5TpN.js} +1 -1
- package/dist/chunks/{toolEventObserver-B7EA-nNa.js → toolEventObserver-DMdrez6V.js} +1 -1
- package/dist/chunks/toolPool-DDj2TbY6.js +1 -0
- package/dist/chunks/{toolPool-HYKCHxDA.js → toolPool-DHQyHmDY.js} +1 -1
- package/dist/chunks/{trustedDevice-DeNxe6bl.js → trustedDevice-DWb5CPB_.js} +1 -1
- package/dist/chunks/{trustedDevice-S34i6Jc9.js → trustedDevice-Dw2crViN.js} +1 -1
- package/dist/chunks/{ultrareviewCommand-C45bmZqN.js → ultrareviewCommand-BfN25zni.js} +1 -1
- package/dist/chunks/undercover-DSp7SB7e.js +1 -0
- package/dist/chunks/{undercover-DoUSM8d6.js → undercover-rcR56jZx.js} +1 -1
- package/dist/chunks/{updateCCB-BuAm25MX.js → updateCCB-DlTAqQJq.js} +1 -1
- package/dist/chunks/{upgrade-BDKg286g.js → upgrade-ClLcX7zy.js} +1 -1
- package/dist/chunks/upgrade-kf1QWUo7.js +1 -0
- package/dist/chunks/{upload-CMptZXZs.js → upload-BqEzK59v.js} +1 -1
- package/dist/chunks/{usage-Bw_LK9YI.js → usage-BgKDh8pQ.js} +1 -1
- package/dist/chunks/{usage-DEWsKPXj.js → usage-DW-akzSR.js} +1 -1
- package/dist/chunks/{useMainLoopModel-D0PmGDuy.js → useMainLoopModel-BTpZ8k3k.js} +1 -1
- package/dist/chunks/{useManagePlugins-B-ejJsXy.js → useManagePlugins-z0qezP5r.js} +1 -1
- package/dist/chunks/{useMergedTools-B6x9qtfj.js → useMergedTools-B78rAreW.js} +1 -1
- package/dist/chunks/{useSearchInput-BpMLsxaS.js → useSearchInput-CwxF3CHN.js} +1 -1
- package/dist/chunks/{useSettingsErrors-DUe4k_RK.js → useSettingsErrors-CjDaon07.js} +1 -1
- package/dist/chunks/{useVoice-C3ryR2HE.js → useVoice-X5WSnyed.js} +1 -1
- package/dist/chunks/{util-DWl5gjmI.js → util-CP-_gsEO.js} +1 -1
- package/dist/chunks/utils-CULcnflj.js +1 -0
- package/dist/chunks/{validatePlugin-8EMSASvV.js → validatePlugin-DUuaprqR.js} +1 -1
- package/dist/chunks/{vim-CaZ20SrQ.js → vim-BfmsdxOa.js} +1 -1
- package/dist/chunks/{voice-BrnKguEV.js → voice-B3GIfFlB.js} +1 -1
- package/dist/chunks/voiceModeEnabled-BrA5ZhH4.js +1 -0
- package/dist/chunks/{voiceModeEnabled-3eg8vSqy.js → voiceModeEnabled-C1Q9j5q6.js} +1 -1
- package/dist/chunks/{voiceStreamSTT-D7jWIYwz.js → voiceStreamSTT-BguyxdrW.js} +1 -1
- package/dist/chunks/voiceStreamSTT-Dmp7Vm1S.js +1 -0
- package/dist/chunks/{web-tools-BT3TbzG5.js → web-tools-qf_VwWRn.js} +1 -1
- package/dist/chunks/{workerRegistry-C_i5wwjL.js → workerRegistry-SbiLJIsG.js} +1 -1
- package/dist/chunks/worktree-Djga1wtm.js +1 -0
- package/dist/chunks/{xml-DOXio8vw.js → xml-D7-jJqSA.js} +1 -1
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-DUoUTxFp.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-COO2W0ij.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-CPWq7O57.js +0 -1
- package/dist/chunks/Doctor-Ba9zhV0V.js +0 -1
- package/dist/chunks/Grove-DyvIToPa.js +0 -1
- package/dist/chunks/REPL-D-akKdFc.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-wDSdfnRo.js +0 -1
- package/dist/chunks/SentryErrorBoundary-Duyg6HeT.js +0 -1
- package/dist/chunks/api-VMfJpk1G.js +0 -1
- package/dist/chunks/assistant-D7D1sqTB.js +0 -1
- package/dist/chunks/auth-CGdLe3rq.js +0 -1
- package/dist/chunks/backgroundHousekeeping-4H6yTjsj.js +0 -1
- package/dist/chunks/bridgeConfig-CTJBoASk.js +0 -1
- package/dist/chunks/bridgeEnabled-SMuWz3Is.js +0 -1
- package/dist/chunks/bridgeMain-UqwOi37W.js +0 -1
- package/dist/chunks/caches-DKMoKTAZ.js +0 -1
- package/dist/chunks/changeDetector--KPj2maX.js +0 -1
- package/dist/chunks/channelNotification-fJgjqRMx.js +0 -1
- package/dist/chunks/clear-CYVCwiwu.js +0 -1
- package/dist/chunks/client-DvWRsIpi.js +0 -1
- package/dist/chunks/commands-BT2_ICaW.js +0 -1
- package/dist/chunks/commitAttribution-Bpbro1a4.js +0 -1
- package/dist/chunks/context-noninteractive-BQDOgVUW.js +0 -1
- package/dist/chunks/conversation-Bt6QdGd-.js +0 -1
- package/dist/chunks/createSession-BaHXBnfG.js +0 -1
- package/dist/chunks/datadog-DgYqUGa-.js +0 -1
- package/dist/chunks/envLessBridgeConfig-D_GCqhTu.js +0 -1
- package/dist/chunks/extra-usage-C4dUWLhg.js +0 -1
- package/dist/chunks/extractMemories-DS7XXeEo.js +0 -1
- package/dist/chunks/fast-D1xIHYaN.js +0 -1
- package/dist/chunks/gates-CUAwAhPL.js +0 -1
- package/dist/chunks/hooks-DynUngv2.js +0 -1
- package/dist/chunks/inboundAttachments-Cug-8Xdy.js +0 -1
- package/dist/chunks/language-CjFs6_la.js +0 -1
- package/dist/chunks/loadAgentsDir-tPgCg0WD.js +0 -1
- package/dist/chunks/localSearch-CxwxzM8W.js +0 -1
- package/dist/chunks/login-CVVFklZw.js +0 -1
- package/dist/chunks/logout-BYsszpXx.js +0 -1
- package/dist/chunks/mappers-BBkM1aA5.js +0 -1
- package/dist/chunks/model-VB4ItNVB.js +0 -1
- package/dist/chunks/pluginStartupCheck-DjfIaOch.js +0 -1
- package/dist/chunks/policyLimits-D-Y_soHx.js +0 -1
- package/dist/chunks/poorMode-DQagHYWe.js +0 -1
- package/dist/chunks/prompt-BGNhFY1n.js +0 -227
- package/dist/chunks/prompt-CrNwH5kr.js +0 -1
- package/dist/chunks/prompt-dH0MMivt.js +0 -1
- package/dist/chunks/sandbox-adapter-jX_WzvnK.js +0 -1
- package/dist/chunks/searchExtraTools-xPuOKDpi.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-DiKsr7H7.js +0 -1
- package/dist/chunks/sessionMemory-C34-eFnJ.js +0 -1
- package/dist/chunks/sessionMemoryUtils-CcJcgftx.js +0 -1
- package/dist/chunks/sessionObserver-B73s6yu8.js +0 -1
- package/dist/chunks/sessionStorage-BHi7PKs-.js +0 -1
- package/dist/chunks/sink-i8NmYch9.js +0 -1
- package/dist/chunks/sinks-3w0mLszx.js +0 -1
- package/dist/chunks/skillLearning-Bddmbx8E.js +0 -1
- package/dist/chunks/skillLearning-C-uI_jZB.js +0 -1
- package/dist/chunks/teamHelpers-D41zdxpl.js +0 -1
- package/dist/chunks/teammateModeSnapshot-q-bARbLL.js +0 -1
- package/dist/chunks/thinkback-BE8NNmAo.js +0 -1
- package/dist/chunks/toolPool-BLshLuvo.js +0 -1
- package/dist/chunks/undercover-B4sdXe12.js +0 -1
- package/dist/chunks/upgrade-BiWGhm2d.js +0 -1
- package/dist/chunks/utils-DP3EtI6F.js +0 -1
- package/dist/chunks/voiceModeEnabled-B1ARFTcz.js +0 -1
- package/dist/chunks/voiceStreamSTT-CONK4g-B.js +0 -1
- package/dist/chunks/worktree-CFNQKVGn.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t}from"./envLessBridgeConfig-YNTOVEqU.js";t();export{e as shouldShowAppUpgradeMessage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Cn as t,Ln as n,kt as r,wn as i}from"./schemas-BGAvj1T4.js";import{t as a}from"./v4-f1i_CNUT.js";import{S as o,y as s}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Cn as t,Ln as n,kt as r,wn as i}from"./schemas-BGAvj1T4.js";import{t as a}from"./v4-f1i_CNUT.js";import{S as o,y as s}from"./paths-CEAy4QCs.js";import{n as c,t as l}from"./lazySchema-B0QShMaQ.js";import{i as u,r as d}from"./semver-Di5OaTd5.js";import{r as f,s as p}from"./bridgeEnabled-z1fPRzzV.js";async function m(){let e=await s(`tengu_bridge_repl_v2_config`,_),t=v().safeParse(e);return t.success?t.data:_}async function h(){let e=await m();return e.min_version&&u(`2.8.2`,e.min_version)?`Your version of Claude Code (2.8.2) is too old for Remote Control.\nVersion ${e.min_version} or higher is required. Run \`claude update\` to update.`:null}async function g(){return p()?(await m()).should_show_app_upgrade_message:!1}var _,v,y=e((()=>{a(),o(),l(),d(),f(),_={init_retry_max_attempts:3,init_retry_base_delay_ms:500,init_retry_jitter_fraction:.25,init_retry_max_delay_ms:4e3,http_timeout_ms:1e4,uuid_dedup_buffer_size:2e3,heartbeat_interval_ms:2e4,heartbeat_jitter_fraction:.1,token_refresh_buffer_ms:3e5,teardown_archive_timeout_ms:1500,connect_timeout_ms:15e3,min_version:`0.0.0`,should_show_app_upgrade_message:!1},v=c(()=>i({init_retry_max_attempts:t().int().min(1).max(10).default(3),init_retry_base_delay_ms:t().int().min(100).default(500),init_retry_jitter_fraction:t().min(0).max(1).default(.25),init_retry_max_delay_ms:t().int().min(500).default(4e3),http_timeout_ms:t().int().min(2e3).default(1e4),uuid_dedup_buffer_size:t().int().min(100).max(5e4).default(2e3),heartbeat_interval_ms:t().int().min(5e3).max(3e4).default(2e4),heartbeat_jitter_fraction:t().min(0).max(.5).default(.1),token_refresh_buffer_ms:t().int().min(3e4).max(18e5).default(3e5),teardown_archive_timeout_ms:t().int().min(500).max(2e3).default(1500),connect_timeout_ms:t().int().min(5e3).max(6e4).default(15e3),min_version:n().refine(e=>{try{return u(e,`0.0.0`),!0}catch{return!1}}).default(`0.0.0`),should_show_app_upgrade_message:r().default(!1)}))}));export{g as a,y as i,h as n,m as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{fl as r,pl as i}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{fl as r,pl as i}from"./paths-CEAy4QCs.js";import{Ot as a,SE as o,Tt as s,bd as c,wE as l,yd as u}from"./loadAgentsDir-DC4jN6-f.js";import{n as d,t as f}from"./ExitFlow-C3BGvwv-.js";import{spawnSync as p}from"child_process";function m(){return i(_)??`Goodbye!`}async function h(e){if(c())return e(),p(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=s()!==null;return t?(0,g.jsx)(f,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(m()),await o(0,`prompt_input_exit`),null)}var g,_;e((()=>{r(),t(),d(),u(),l(),a(),g=n(),_=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{h as call};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{F as n,Rn as r,b as i,f as a,g as o,h as s,t as c,tn as l,tt as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{A as p,E as m}from"./debug-otxXY3j-.js";import{n as h,t as g}from"./cwd--iizewsn.js";import{DC as _,EC as v,aS as y,dS as b,fS as x,oS as S}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{F as n,Rn as r,b as i,f as a,g as o,h as s,t as c,tn as l,tt as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{A as p,E as m}from"./debug-otxXY3j-.js";import{n as h,t as g}from"./cwd--iizewsn.js";import{DC as _,EC as v,aS as y,dS as b,fS as x,oS as S}from"./loadAgentsDir-DC4jN6-f.js";import{t as C}from"./useKeybinding-DPOUuymz.js";import{t as w}from"./useTerminalSize-Du-EamDN.js";import{n as T,t as E}from"./exportRenderer-DP_z8YD1.js";import{join as D}from"path";function O({content:e,defaultFilename:t,onDone:r}){let[,c]=(0,k.useState)(null),[f,m]=(0,k.useState)(t),[h,_]=(0,k.useState)(t.length),[x,S]=(0,k.useState)(!1),{columns:C}=n(),w=(0,k.useCallback)(()=>{S(!1),c(null)},[]),T=async t=>{if(t===`clipboard`){let t=await l(e);t&&process.stdout.write(t),r({success:!0,message:`Conversation copied to clipboard`})}else t===`file`&&(c(`file`),S(!0))},E=()=>{let t=f.endsWith(`.txt`)?f:f.replace(/\.[^.]+$/,``)+`.txt`,n=D(g(),t);try{p(n,e,{encoding:`utf-8`,flush:!0}),r({success:!0,message:`Conversation exported to: ${n}`})}catch(e){r({success:!1,message:`Failed to export conversation: ${e instanceof Error?e.message:`Unknown error`}`})}},O=(0,k.useCallback)(()=>{x?w():r({success:!1,message:`Export cancelled`})},[x,w,r]),j=[{label:`Copy to clipboard`,value:`clipboard`,description:`Copy the conversation to your system clipboard`},{label:`Save to file`,value:`file`,description:`Save the conversation to a file in the current directory`}];function M(e){return x?(0,A.jsxs)(s,{children:[(0,A.jsx)(o,{shortcut:`Enter`,action:`save`}),(0,A.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}):e.pending?(0,A.jsxs)(i,{children:[`Press `,e.keyName,` again to exit`]}):(0,A.jsx)(v,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})}return u(`confirm:no`,O,{context:`Settings`,isActive:x}),(0,A.jsx)(a,{title:`Export Conversation`,subtitle:`Select export method:`,color:`permission`,onCancel:O,inputGuide:M,isCancelActive:!x,children:x?(0,A.jsxs)(d,{flexDirection:`column`,children:[(0,A.jsx)(i,{children:`Enter filename:`}),(0,A.jsxs)(d,{flexDirection:`row`,gap:1,marginTop:1,children:[(0,A.jsx)(i,{children:`>`}),(0,A.jsx)(b,{value:f,onChange:m,onSubmit:E,focus:!0,showCursor:!0,columns:C,cursorOffset:h,onChangeCursorOffset:_})]})]}):(0,A.jsx)(y,{options:j,onChange:T,onCancel:O})})}var k,A,j=e((()=>{k=t(r(),1),w(),c(),C(),h(),m(),_(),S(),x(),A=f()}));function M(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,`0`)}-${String(e.getDate()).padStart(2,`0`)}-${String(e.getHours()).padStart(2,`0`)}${String(e.getMinutes()).padStart(2,`0`)}${String(e.getSeconds()).padStart(2,`0`)}`}function N(e){let t=e.find(e=>e.type===`user`);if(!t||t.type!==`user`)return``;let n=t.message?.content,r=``;if(typeof n==`string`)r=n.trim();else if(Array.isArray(n)){let e=n.find(e=>e.type===`text`);e&&`text`in e&&(r=e.text.trim())}return r=r.split(`
|
|
2
2
|
`)[0]||``,r.length>50&&(r=r.substring(0,49)+`…`),r}function P(e){return e.toLowerCase().replace(/[^a-z0-9\s-]/g,``).replace(/\s+/g,`-`).replace(/-+/g,`-`).replace(/^-|-$/g,``)}async function F(e){let t=e.options.tools||[];return T(e.messages,t)}async function I(e,t,n){let r=await F(t),i=n.trim();if(i){let t=i.endsWith(`.txt`)?i:i.replace(/\.[^.]+$/,``)+`.txt`,n=D(g(),t);try{return p(n,r,{encoding:`utf-8`,flush:!0}),e(`Conversation exported to: ${n}`),null}catch(t){return e(`Failed to export conversation: ${t instanceof Error?t.message:`Unknown error`}`),null}}let a=N(t.messages),o=M(new Date),s;if(a){let e=P(a);s=e?`${o}-${e}.txt`:`conversation-${o}.txt`}else s=`conversation-${o}.txt`;return(0,L.jsx)(O,{content:r,defaultFilename:s,onDone:t=>{e(t.message)}})}var L;e((()=>{r(),j(),h(),E(),m(),L=f()}))();export{I as call,N as extractFirstPrompt,P as sanitizeFilename};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,Tn as r,rt as i,wn as a}from"./src-Di342QoJ.js";import{t as o}from"./jsx-runtime-D-D469L8.js";import{FT as s,LT as c,cC as l,kT as u,lC as d}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,Tn as r,rt as i,wn as a}from"./src-Di342QoJ.js";import{t as o}from"./jsx-runtime-D-D469L8.js";import{FT as s,LT as c,cC as l,kT as u,lC as d}from"./loadAgentsDir-DC4jN6-f.js";import{n as f,t as p}from"./staticRender-DKFIRhkH.js";import{n as m,t as h}from"./Messages-ltcn1Qkf.js";function g({children:e}){let{bindings:t}=c(),n=(0,b.useRef)(null),r=(0,b.useRef)(new Map),a=(0,b.useRef)(new Set).current;return(0,x.jsx)(i,{bindings:t,pendingChordRef:n,pendingChord:null,setPendingChord:()=>{},activeContexts:a,registerActiveContext:()=>{},unregisterActiveContext:()=>{},handlerRegistryRef:r,children:e})}function _(e){if(!(`message`in e))return 1;let t=e.message.content;return Array.isArray(t)?t.length:1}async function v(e,t,n,{columns:i,verbose:a=!1,chunkSize:o=40,onProgress:s}={}){let c=n=>f((0,x.jsx)(l,{children:(0,x.jsx)(g,{children:(0,x.jsx)(h,{messages:e,tools:t,commands:[],verbose:a,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:`export`,screen:`prompt`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1,renderRange:n})})}),i),u=o;for(let t of e)u+=_(t);for(let e=0;e<u;e+=o){let t=await c([e,e+o]);if(r(t).trim()===``)break;await n(t),s?.(e+o)}}async function y(e,t=[],n){let i=[];return await v(e,t,e=>void i.push(r(e)),{columns:n}),i.join(``)}var b,x,S=e((()=>{b=t(n(),1),a(),m(),u(),s(),d(),p(),x=o()}));export{y as n,S as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./extra-usage-BQ5Z1wJb.js";e();export{t as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./extra-usage-core-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./extra-usage-core-B1oJoxYa.js";import{r as a,t as o}from"./login-ajsn1Sg7.js";async function s(e,t){let n=await r();return n.type===`message`?(e(n.value),null):(0,c.jsx)(o,{startingMessage:`Starting new login following /extra-usage. Exit with Ctrl-C to use existing account.`,onDone:n=>{t.onChangeAPIKey(),e(n?`Login successful`:`Login interrupted`)}})}var c,l=e((()=>{t(),a(),i(),c=n()}));export{l as n,s as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Cc as r,Da as i,dc as a,ka as o,on as s,tn as c,yc as l}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Cc as r,Da as i,dc as a,ka as o,on as s,tn as c,yc as l}from"./paths-CEAy4QCs.js";import{l as u,u as d}from"./oauth-CdZEzMww.js";import{o as f,s as p}from"./log-DSV4Ht5l.js";import{a as m,l as h,o as g}from"./api-Cy1N7XAQ.js";import{n as _,t as v}from"./browser-Bt-ckCaU.js";import{n as y,t as b}from"./usage-BgKDh8pQ.js";import{i as x,r as S}from"./overageCreditGrant-CzkWDmsQ.js";async function C(e){let{accessToken:n,orgUUID:r}=await h(),i={...m(n),"x-organization-uuid":r},a=`${u().BASE_API_URL}/api/oauth/organizations/${r}/admin_requests`;return(await t.post(a,e,{headers:i})).data}async function w(e,n){let{accessToken:r,orgUUID:i}=await h(),a={...m(r),"x-organization-uuid":i},o=`${u().BASE_API_URL}/api/oauth/organizations/${i}/admin_requests/me?request_type=${e}`;for(let e of n)o+=`&statuses=${e}`;return(await t.get(o,{headers:a})).data}async function T(e){let{accessToken:n,orgUUID:r}=await h(),i={...m(n),"x-organization-uuid":r},a=`${u().BASE_API_URL}/api/oauth/organizations/${r}/admin_requests/eligibility?request_type=${e}`;return(await t.get(a,{headers:i})).data}var E=e((()=>{n(),d(),g()}));async function D(){a().hasVisitedExtraUsage||r(e=>({...e,hasVisitedExtraUsage:!0})),x();let e=c(),t=e===`team`||e===`enterprise`;if(!i()&&t){let e;try{e=(await b())?.extra_usage}catch(e){p(e)}if(e?.is_enabled&&e.monthly_limit===null)return{type:`message`,value:`Your organization already has unlimited extra usage. No request needed.`};try{if((await T(`limit_increase`))?.is_allowed===!1)return{type:`message`,value:`Please contact your admin to manage extra usage settings.`}}catch(e){p(e)}try{let e=await w(`limit_increase`,[`pending`,`dismissed`]);if(e&&e.length>0)return{type:`message`,value:`You have already submitted a request for extra usage to your admin.`}}catch(e){p(e)}try{return await C({request_type:`limit_increase`,details:null}),{type:`message`,value:e?.is_enabled?`Request sent to your admin to increase extra usage.`:`Request sent to your admin to enable extra usage.`}}catch(e){p(e)}return{type:`message`,value:`Please contact your admin to manage extra usage settings.`}}let n=t?`https://claude.ai/admin-settings/usage`:`https://claude.ai/settings/usage`;try{return{type:`browser-opened`,url:n,opened:await _(n)}}catch(e){return p(e),{type:`message`,value:`Failed to open browser. Please visit ${n} to manage extra usage.`}}}var O=e((()=>{E(),S(),y(),s(),o(),v(),l(),f()}));export{D as n,O as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./extra-usage-core-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./extra-usage-core-B1oJoxYa.js";async function r(){let e=await t();return e.type===`message`?{type:`text`,value:e.value}:{type:`text`,value:e.opened?`Browser opened to manage extra usage. If it didn't open, visit: ${e.url}`:`Please visit ${e.url} to manage extra usage.`}}e((()=>{n()}))();export{r as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,g as i,h as a,nt as o,p as ee,t as te,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Br as l,Cr as u,Ol as ne,Pr as d,Ps as f,Qa as re,Rr as p,bi as ie,dn as m,dr as h,kl as g,li as _,lo as ae,on as v,oo as y,ur as b,vi as x,xi as S,yi as oe}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,g as i,h as a,nt as o,p as ee,t as te,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{Br as l,Cr as u,Ol as ne,Pr as d,Ps as f,Qa as re,Rr as p,bi as ie,dn as m,dr as h,kl as g,li as _,lo as ae,on as v,oo as y,ur as b,vi as x,xi as S,yi as oe}from"./paths-CEAy4QCs.js";import{n as C,r as se}from"./analytics-DqMQntaB.js";import{Bf as w,DC as T,Dj as E,EC as ce,Mj as le,Nj as ue,Oj as de,Ry as D,Tj as O,_j as k,aS as fe,fC as pe,kj as me,lC as A,uC as j,vj as M,yj as N,zf as he}from"./loadAgentsDir-DC4jN6-f.js";import{t as P}from"./useKeybinding-DPOUuymz.js";import{n as ge,t as F}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";function I(e,t){if(!E(t))return;let n=N(t,e);return`${L(n)} ${n} · /effort`}function L(e){switch(e){case`low`:return`○`;case`medium`:return`◐`;case`high`:return`●`;case`xhigh`:return`⦿`;case`max`:return`◉`;default:return`●`}}var R=e((()=>{f(),O()}));function z({initial:e,sessionModel:t,onSelect:n,onCancel:te,isStandaloneCommand:c,showFastModeNotice:l,headerText:u,skipSettingsWrite:d}){let f=pe(),m=ge(),h=e===null?G:e,[g,v]=(0,U.useState)(h),y=j(e=>S()?e.fastMode:!1),[x,C]=(0,U.useState)(()=>new Set(b(h)?[h.replace(/\[1m\]/i,``)]:[])),w=(0,U.useCallback)(()=>{if(!g||g===G)return;let e=g.replace(/\[1m\]/i,``);C(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[g]),[T,D]=(0,U.useState)(!1),O=j(e=>e.effortValue),[A,M]=(0,U.useState)(O===void 0?void 0:k(O)),N=(0,U.useMemo)(()=>he(y??!1),[y]),P=(0,U.useMemo)(()=>e!==null&&!N.some(t=>t.value===e)?[...N,{value:e,label:p(e),description:`Current model`}]:N,[N,e]),F=(0,U.useMemo)(()=>P.map(e=>({...e,value:e.value===null?G:e.value})),[P]),I=(0,U.useMemo)(()=>F.some(e=>e.value===h)?h:F[0]?.value??void 0,[F,h]),L=Math.min(10,F.length),R=Math.max(0,F.length-L),z=F.find(e=>e.value===g)?.label,K=B(g),q=g!==void 0&&g!==G&&x.has(g.replace(/\[1m\]/i,``)),J=K?E(K):!1,Y=K?me(K):!1,X=K?de(K):!1,Z=H(g),Q=A===`max`&&!X?Y?`xhigh`:`high`:A===`xhigh`&&!Y?`high`:A,ve=(0,U.useCallback)(e=>{v(e),!T&&O===void 0&&M(H(e))},[T,O]),ye=(0,U.useCallback)(e=>{J&&(M(t=>_e(t??Z,e,Y,X)),D(!0))},[J,Y,X,Z]);o({"modelPicker:decreaseEffort":()=>ye(`left`),"modelPicker:increaseEffort":()=>ye(`right`),"modelPicker:toggle1M":()=>w()},{context:`ModelPicker`});function be(e){if(se(`tengu_model_command_menu_effort`,{effort:A}),!d){let t=le(A,H(e),re(`userSettings`)?.effortLevel,T),n=ue(t);n!==void 0&&ae(`userSettings`,{effortLevel:n}),f(e=>({...e,effortValue:t}))}let t=B(e),r=T&&t&&E(t)?A:void 0;if(e===G){n(null,r);return}let i=e.replace(/\[1m\]/i,``);n(x.has(i)?`${i}[1m]`:i,r)}let $=(0,W.jsxs)(s,{flexDirection:`column`,children:[(0,W.jsxs)(s,{flexDirection:`column`,children:[(0,W.jsxs)(s,{marginBottom:1,flexDirection:`column`,children:[(0,W.jsx)(r,{color:`remember`,bold:!0,children:`Select model`}),(0,W.jsx)(r,{dimColor:!0,children:u??`Choose a model for this and future sessions. Use ← → to adjust effort, Space to toggle 1M context.`}),t&&(0,W.jsxs)(r,{dimColor:!0,children:[`Currently using `,p(t),` for this session (set by plan mode). Selecting a model will undo this.`]})]}),(0,W.jsxs)(s,{flexDirection:`column`,marginBottom:1,children:[(0,W.jsx)(s,{flexDirection:`column`,children:(0,W.jsx)(fe,{defaultValue:h,defaultFocusValue:I,options:F,onChange:be,onFocus:ve,onCancel:te??(()=>{}),visibleOptionCount:L})}),R>0&&(0,W.jsx)(s,{paddingLeft:3,children:(0,W.jsxs)(r,{dimColor:!0,children:[`and `,R,` more…`]})})]}),(0,W.jsxs)(s,{marginBottom:1,flexDirection:`column`,children:[J?(0,W.jsxs)(r,{dimColor:!0,children:[(0,W.jsx)(V,{effort:Q}),` `,ne(Q),` effort`,Q===Z?` (default)`:``,` `,(0,W.jsx)(r,{color:`subtle`,children:`← → to adjust`})]}):(0,W.jsxs)(r,{color:`subtle`,children:[(0,W.jsx)(V,{effort:void 0}),` Effort not supported`,z?` for ${z}`:``]}),q?(0,W.jsxs)(r,{dimColor:!0,children:[(0,W.jsx)(V,{effort:`high`}),` 1M context on`,(0,W.jsx)(r,{color:`subtle`,children:` · Space to toggle`})]}):(0,W.jsxs)(r,{color:`subtle`,children:[(0,W.jsx)(V,{effort:void 0}),` 1M context off`,z?` for ${z}`:``,(0,W.jsx)(r,{color:`subtle`,children:` · Space to toggle`})]})]}),S()?l?(0,W.jsx)(s,{marginBottom:1,children:(0,W.jsxs)(r,{dimColor:!0,children:[`Fast mode is `,(0,W.jsx)(r,{bold:!0,children:`ON`}),` and available with `,_,` only (/fast). Switching to other models turn off fast mode.`]})}):oe()&&!ie()?(0,W.jsx)(s,{marginBottom:1,children:(0,W.jsxs)(r,{dimColor:!0,children:[`Use `,(0,W.jsx)(r,{bold:!0,children:`/fast`}),` to turn on Fast mode (`,_,` only).`]})}):null:null]}),c&&(0,W.jsx)(r,{dimColor:!0,italic:!0,children:m.pending?(0,W.jsxs)(W.Fragment,{children:[`Press `,m.keyName,` again to exit`]}):(0,W.jsxs)(a,{children:[(0,W.jsx)(i,{shortcut:`Enter`,action:`confirm`}),(0,W.jsx)(ce,{action:`select:cancel`,context:`Select`,fallback:`Esc`,description:`exit`})]})})]});return c?(0,W.jsx)(ee,{color:`permission`,children:$}):$}function B(e){if(e)return e===G?u():l(e)}function V({effort:e}){return(0,W.jsx)(r,{color:e?`claude`:`subtle`,children:L(e??`low`)})}function _e(e,t,n,r){let i=[`low`,`medium`,`high`,...n?[`xhigh`]:[],...r?[`max`]:[]],a=i.indexOf(e),o=a===-1?i.indexOf(`high`):a;return t===`right`?i[(o+1)%i.length]:i[(o-1+i.length)%i.length]}function H(e){let t=M(B(e)??u());return t===void 0?`high`:k(t)}var U,W,G,K=e((()=>{g(),n(),U=t(n(),1),h(),F(),C(),x(),te(),P(),A(),O(),d(),w(),y(),T(),D(),R(),W=c(),G=`__NO_PREFERENCE__`}));function q(e,t,n){if(!m())return!1;if(t)return!0;if(e===null||!b(e))return!1;let r=e.toLowerCase().replace(/\[1m\]$/,``).trim(),i=r===`opus`||r.includes(`opus-4-6`)||r.includes(`opus-4-7`),a=r===`sonnet`||r.includes(`sonnet-4-6`);return i&&n?!1:i||a}var J=e((()=>{v(),h()}));export{L as a,K as i,q as n,I as o,z as r,R as s,J as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{iu as e,nu as t,ru as n,tu as r}from"./loadAgentsDir-DC4jN6-f.js";e();export{r as drainPendingExtraction,t as executeExtractMemories,n as initExtractMemories};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Q as i,Rn as a,b as o,f as s,nt as c,t as l,v as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Di as p,Ps as m,Si as h,ci as g,dc as _,di as v,fi as y,li as b,lo as x,mi as S,oi as C,oo as w,si as T,ui as E,vi as D,xi as O,yc as k}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Q as i,Rn as a,b as o,f as s,nt as c,t as l,v as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Di as p,Ps as m,Si as h,ci as g,dc as _,di as v,fi as y,li as b,lo as x,mi as S,oi as C,oo as w,si as T,ui as E,vi as D,xi as O,yc as k}from"./paths-CEAy4QCs.js";import{n as A,r as j}from"./analytics-DqMQntaB.js";import{b as M,u as N}from"./startupProfiler-CBcN1Chw.js";import{fC as P,lC as F,uC as I}from"./loadAgentsDir-DC4jN6-f.js";import{t as L}from"./useKeybinding-DPOUuymz.js";import{n as R,t as z}from"./systemTheme-eRWGHYSL.js";function B({cooldown:e}){return e?(0,H.jsx)(o,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,H.jsx)(o,{color:`fastMode`,children:`↯`})}function V(e=!0,t=!1){if(!e)return`↯`;let r=R(_().theme);return t?n.dim(u(`promptBorder`,r)(`↯`)):u(`fastMode`,r)(`↯`)}var H,U=e((()=>{r(),a(),m(),l(),k(),z(),H=f()}));function W(e,t){E(),x(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!h(e.mainLoopModel);return{...e,...t?{mainLoopModel:v(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let n=I(e=>e.mainLoopModel),r=I(e=>e.fastMode),a=P(),[l,u]=(0,J.useState)(r??!1),f=y(),p=f.status===`cooldown`,m=t!==null,g=C(T(!0));function _(){m||(W(l,a),j(`tengu_fast_mode_toggled`,{enabled:l,source:`picker`}),l?e(`${V(l)} Fast mode ON${h(n)?``:` · model set to ${b}`} · ${g}`):(a(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function v(){if(m){r&&W(!1,a),e(`Fast mode OFF`,{display:`system`});return}e(r?`${V()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function x(){m||u(e=>!e)}return c({"confirm:yes":_,"confirm:nextField":x,"confirm:next":x,"confirm:previous":x,"confirm:cycleMode":x,"confirm:toggle":x},{context:`Confirmation`}),(0,Y.jsxs)(s,{title:(0,Y.jsxs)(o,{children:[(0,Y.jsx)(B,{cooldown:p}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${b}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:v,color:`fastMode`,inputGuide:e=>e.pending?(0,Y.jsxs)(o,{children:[`Press `,e.keyName,` again to exit`]}):m?(0,Y.jsx)(o,{children:`Esc to cancel`}):(0,Y.jsx)(o,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,Y.jsx)(d,{marginLeft:2,children:(0,Y.jsx)(o,{color:`error`,children:t})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(d,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,Y.jsxs)(d,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(o,{bold:!0,children:`Fast mode`}),(0,Y.jsx)(o,{color:l?`fastMode`:void 0,bold:l,children:l?`ON `:`OFF`}),(0,Y.jsx)(o,{dimColor:!0,children:g})]})}),p&&f.status===`cooldown`&&(0,Y.jsx)(d,{marginLeft:2,children:(0,Y.jsxs)(o,{color:`warning`,children:[f.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,N(f.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,Y.jsxs)(o,{dimColor:!0,children:[`Learn more:`,` `,(0,Y.jsx)(i,{url:`https://code.claude.com/docs/en/fast-mode`,children:`https://code.claude.com/docs/en/fast-mode`})]})]})}async function K(e,t,n){let r=S();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return W(e,n),j(`tengu_fast_mode_toggled`,{enabled:e,source:`shortcut`}),e?`${V(!0)} Fast mode ON${h(i)?``:` · model set to ${b}`} · ${C(T(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!O())return null;await p();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=S();return j(`tengu_fast_mode_picker_shown`,{unavailable_reason:i??``}),(0,Y.jsx)(G,{onDone:e,unavailableReason:i})}var J,Y,X=e((()=>{a(),J=t(a(),1),l(),U(),L(),A(),F(),D(),M(),g(),w(),Y=f()}));export{U as a,V as i,q as n,X as r,G as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./fast-BJMGfO_S.js";t();export{n as FastModePicker,e as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./Feedback-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./Feedback-BtZb1A8b.js";function a(e,t,n,r=``,a={}){return(0,s.jsx)(i,{abortSignal:t,messages:n,initialDescription:r,onDone:e,backgroundTasks:a})}async function o(e,t,n){let r=n||``;return a(e,t.abortController.signal,t.messages,r)}var s;e((()=>{t(),r(),s=n()}))();export{o as call,a as renderFeedbackComponent};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{F as e,I as t,L as n,M as r,N as i,P as a,R as o,j as s,z as c}from"./paths-
|
|
1
|
+
import{F as e,I as t,L as n,M as r,N as i,P as a,R as o,j as s,z as c}from"./paths-CEAy4QCs.js";r();export{s as getEventSamplingConfig,i as initialize1PEventLogging,a as is1PEventLoggingEnabled,e as logEventTo1P,t as logGrowthBookExperimentTo1P,n as reinitialize1PEventLoggingIfConfigChanged,o as shouldSampleEvent,c as shutdown1PEventLogging};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{U as n,l as r,p as i,z as a}from"./debug-otxXY3j-.js";import{O as o,k as s}from"./rcDebugLog-
|
|
1
|
+
import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{U as n,l as r,p as i,z as a}from"./debug-otxXY3j-.js";import{O as o,k as s}from"./rcDebugLog-C0Bam8V9.js";import{i as c}from"./workSecret-DJu7k30X.js";import{t as l}from"./ccrClient-iR6zwGb1.js";import{n as u,t as d}from"./SSETransport-Co-0nMlR.js";u(),r(),n(),o();function f(e){return{write:t=>e.write(t),writeBatch:t=>e.writeBatch(t),close:()=>e.close(),isConnectedStatus:()=>e.isConnectedStatus(),getStateLabel:()=>e.getStateLabel(),setOnData:t=>e.setOnData(t),setOnClose:t=>e.setOnClose(t),setOnConnect:t=>e.setOnConnect(t),connect:()=>void e.connect(),getLastSequenceNum:()=>0,get droppedBatchCount(){return e.droppedBatchCount},reportState:()=>{},reportMetadata:()=>{},reportDelivery:()=>{},flush:()=>Promise.resolve()}}async function p(e){let{sessionUrl:t,ingressToken:n,sessionId:r,initialSequenceNum:o,getAuthToken:u}=e,f;u?f=()=>{let e=u();return e?{Authorization:`Bearer ${e}`}:{}}:s(n);let p=e.epoch??await c(t,n);i(`[bridge:repl] CCR v2: worker sessionId=${r} epoch=${p}${e.epoch===void 0?` (via registerWorker)`:` (from /bridge)`}`);let m=new URL(t);m.pathname=m.pathname.replace(/\/$/,``)+`/worker/events/stream`;let h=new d(m,{},r,void 0,o,f),g,_=new l(h,new URL(t),{getAuthHeaders:f,heartbeatIntervalMs:e.heartbeatIntervalMs,heartbeatJitterFraction:e.heartbeatJitterFraction,onEpochMismatch:()=>{i(`[bridge:repl] CCR v2: epoch superseded (409) — closing for poll-loop recovery`);try{_.close(),h.close(),g?.(4090)}catch(e){i(`[bridge:repl] CCR v2: error during epoch-mismatch cleanup: ${a(e)}`,{level:`error`})}throw Error(`epoch superseded`)}});h.setOnEvent(e=>{_.reportDelivery(e.event_id,`received`),_.reportDelivery(e.event_id,`processed`)});let v,y=!1,b=!1;return{write(e){return _.writeEvent(e)},async writeBatch(e){for(let t of e){if(b)break;await _.writeEvent(t)}},close(){b=!0,_.close(),h.close()},isConnectedStatus(){return y},getStateLabel(){return h.isClosedStatus()?`closed`:h.isConnectedStatus()?y?`connected`:`init`:`connecting`},setOnData(e){h.setOnData(e)},setOnClose(e){g=e,h.setOnClose(t=>{_.close(),e(t??4092)})},setOnConnect(e){v=e},getLastSequenceNum(){return h.getLastSequenceNum()},droppedBatchCount:0,reportState(e){_.reportState(e)},reportMetadata(e){_.reportMetadata(e)},reportDelivery(e,t){_.reportDelivery(e,t)},flush(){return _.flush()},connect(){e.outboundOnly||h.connect(),_.initialize(p).then(()=>{y=!0,i(`[bridge:repl] v2 transport ready for writes (epoch=${p}, sse=${h.isConnectedStatus()?`open`:`opening`})`),v?.()},e=>{i(`[bridge:repl] CCR v2 initialize failed: ${a(e)}`,{level:`error`}),_.close(),h.close(),g?.(4091)})}}}e();var m=class{constructor(){t(this,`_active`,!1),t(this,`_pending`,[])}get active(){return this._active}get pendingCount(){return this._pending.length}start(){this._active=!0}end(){return this._active=!1,this._pending.splice(0)}enqueue(...e){return this._active?(this._pending.push(...e),!0):!1}drop(){this._active=!1;let e=this._pending.length;return this._pending.length=0,e}deactivate(){this._active=!1}};export{f as n,p as r,m as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,n as t}from"./gates-C5y8P5t9.js";e();export{t as getChicagoEnabled};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{S as r,g as i}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{S as r,g as i}from"./paths-CEAy4QCs.js";function a(){return{...u,...i(`tengu_malort_pedway`,u)}}function o(){return!0}function s(){return process.env.USER_TYPE===`ant`&&process.env.MONOREPO_ROOT_DIR&&!n(process.env.ALLOW_ANT_COMPUTER_USE_MCP)?!1:o()&&a().enabled}function c(){let{enabled:e,coordinateMode:t,...n}=a();return n}function l(){return d??(d=a().coordinateMode),d}var u,d,f=e((()=>{r(),t(),u={enabled:!0,pixelValidation:!1,clipboardPasteMultiline:!0,mouseAnimation:!0,hideBeforeAction:!0,autoTargetDisplay:!0,clipboardGuard:!0,coordinateMode:`pixels`}}));export{f as i,s as n,c as r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{U as t,l as n,p as r,z as i}from"./debug-otxXY3j-.js";import{o as a,u as o}from"./proxy-CF7ZDxaW.js";import{G_ as s,H_ as c,Qo as l,U_ as u,Uo as d,W_ as f,Xo as p,dD as m,mo as h,st as g,uD as _,ut as v}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{U as t,l as n,p as r,z as i}from"./debug-otxXY3j-.js";import{o as a,u as o}from"./proxy-CF7ZDxaW.js";import{G_ as s,H_ as c,Qo as l,U_ as u,Uo as d,W_ as f,Xo as p,dD as m,mo as h,st as g,uD as _,ut as v}from"./loadAgentsDir-DC4jN6-f.js";import{G as y,H as b,K as x,P as S,U as C,W as w,q as T}from"./rcDebugLog-C0Bam8V9.js";import{n as E,r as D}from"./SSETransport-Co-0nMlR.js";import{randomUUID as O}from"crypto";function k(){return(process.env.GEMINI_BASE_URL||M).replace(/\/+$/,``)}function A(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*j(e){let t=await(e.fetchOverride??fetch)(`${k()}/${A(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...a({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,o=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;o+=r.decode(t,N);let{frames:a,remaining:s}=D(o);o=s;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${i(e)}`)}}o+=r.decode();let{frames:e}=D(o);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${i(e)}`)}}finally{n.releaseLock()}}var M,N,P=e((()=>{E(),t(),o(),M=`https://generativelanguage.googleapis.com/v1beta`,N={stream:!0}}));async function*F(e,t,n,i,a,o){try{let s=T(a.model),d=l(e,n),h=await Promise.all(n.map(e=>v(e,{getToolPermissionContext:a.getToolPermissionContext,tools:n,agents:a.agents,allowedAgentTypes:a.allowedAgentTypes,model:a.model}))),g=h.filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:_,systemInstruction:S}=y(d,t),E=w(g),D=C(a.toolChoice),k=j({model:s,signal:i,fetchOverride:a.fetchOverride,body:{contents:_,...S&&{systemInstruction:S},...E.length>0&&{tools:E},...D&&{toolConfig:{functionCallingConfig:D}},generationConfig:{...a.temperatureOverride!==void 0&&{temperature:a.temperatureOverride},...o.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...o.type===`enabled`&&{thinkingBudget:o.budgetTokens}}}}}});r(`[Gemini] Calling model=${s}, messages=${_.length}, tools=${E.length}`);let A=b(k,s),M={},N=[],P=null,F=0,I=Date.now();for await(let e of A){switch(e.type){case`message_start`:P=e.message,F=Date.now()-I;break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?M[t]={...n,input:``}:n.type===`text`?M[t]={...n,text:``}:n.type===`thinking`?M[t]={...n,thinking:``,signature:``}:M[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=M[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.type===`thinking`?r.signature=n.signature:r[x]=n.signature);break}case`content_block_stop`:{let t=M[e.index];if(!t||!P)break;let r={message:{...P,content:p([t],n,a.agentId)},requestId:void 0,type:`assistant`,uuid:O(),timestamp:new Date().toISOString()};N.push(r),yield r;break}case`message_delta`:case`message_stop`:break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:F}:void 0}}m(a.langfuseTrace??null,{model:s,provider:`gemini`,input:c(d,t),output:u(N),usage:{input_tokens:0,output_tokens:0},startTime:new Date(I),endTime:new Date,completionStartTime:F>0?new Date(I+F):void 0,tools:f(h),thinking:o.type===`disabled`?void 0:{type:o.type,...o.type===`enabled`&&{budgetTokens:o.budgetTokens}}})}catch(e){let t=e instanceof Error?e.message:String(e);r(`[Gemini] Error: ${t}`,{level:`error`}),yield h({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{g(),n(),d(),_(),s(),P(),S()}))();export{F as queryModelGemini};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{g as t}from"./client-_sjL0I7A.js";import{l as n,p as r}from"./debug-otxXY3j-.js";import{t as i}from"./sdk-DEtgRZvI.js";import{Bl as a,Eo as o,Ll as s,Rl as c,Uo as l,jo as u}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{g as t}from"./client-_sjL0I7A.js";import{l as n,p as r}from"./debug-otxXY3j-.js";import{t as i}from"./sdk-DEtgRZvI.js";import{Bl as a,Eo as o,Ll as s,Rl as c,Uo as l,jo as u}from"./loadAgentsDir-DC4jN6-f.js";async function d(){try{let{getResolvedLanguage:e}=await import(`./language-CiMwEWO-.js`);return e()===`zh`?m:p}catch{return p}}async function f(e){let n=s();if(!n)return r(`[recap] no CacheSafeParams saved, skipping`),{kind:`no-turn`};let i=new AbortController;e.addEventListener(`abort`,()=>i.abort(),{once:!0});try{let{messages:t}=await a({promptMessages:[o({content:await d()})],cacheSafeParams:n,canUseTool:async()=>({behavior:`deny`,message:`Recap cannot use tools`,decisionReason:{type:`other`,reason:`away_summary`}}),overrides:{abortController:i},querySource:`away_summary`,forkLabel:`away_summary`,maxTurns:1,skipCacheWrite:!0,skipTranscript:!0});if(e.aborted)return{kind:`aborted`};let r=t.find(e=>e.type===`assistant`&&e.isApiErrorMessage);if(r)return{kind:`api-error`,text:u(r)??``};let s=t.filter(e=>e.type===`assistant`&&!e.isApiErrorMessage).pop();if(!s)return{kind:`failed`};let c=u(s);return!c||c.trim().length===0?{kind:`failed`}:{kind:`ok`,text:c.trim()}}catch(n){return n instanceof t||e.aborted||i.signal.aborted?{kind:`aborted`}:(r(`[recap] generation failed: ${n}`),{kind:`failed`})}}var p,m;e((()=>{i(),n(),c(),l(),p=`The user stepped away and is coming back. Recap in under 40 words, 1-2 plain sentences, no markdown. Lead with the overall goal and current task, then the one next action. Skip root-cause narrative, fix internals, secondary to-dos, and em-dash tangents.`,m=`用户离开后回来了。用中文写 1-2 句话,不超过 60 字,无 markdown。先说明高层目标和当前任务,再说明下一步操作。跳过根因分析和次要待办。`}))();export{f as generateRecap};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{U as t,l as n,p as r,z as i}from"./debug-otxXY3j-.js";import{s as a,u as o}from"./types-KeqFPzY5.js";import{Uo as s,ck as c,ko as l,nt as u,tt as d}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{U as t,l as n,p as r,z as i}from"./debug-otxXY3j-.js";import{s as a,u as o}from"./types-KeqFPzY5.js";import{Uo as s,ck as c,ko as l,nt as u,tt as d}from"./loadAgentsDir-DC4jN6-f.js";import{X as f}from"./rcDebugLog-C0Bam8V9.js";import{r as p,t as m}from"./sessionTitle-1k_2BhFL.js";async function h(e,t){let n=m(e);if(!n)return null;try{let e=await u({systemPrompt:f([`Generate a short kebab-case name (2-4 words) that captures the main topic of this conversation. Use lowercase words separated by hyphens. Examples: "fix-login-bug", "add-auth-feature", "refactor-api-client", "debug-test-failures". Return JSON with a "name" field.`]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:t,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),r=o(Array.isArray(e.message.content)?l(e.message.content):e.message.content);return r&&typeof r==`object`&&`name`in r&&typeof r.name==`string`?r.name:null}catch(e){return r(`generateSessionName failed: ${i(e)}`,{level:`error`}),null}}var g=e((()=>{d(),n(),t(),a(),s(),p(),c()}));export{g as n,h as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cn as e,ot as t}from"./state-sIHsFpDu.js";import{Cc as n,Jc as r,Uc as i,dc as a,yc as o}from"./paths-
|
|
1
|
+
import{cn as e,ot as t}from"./state-sIHsFpDu.js";import{Cc as n,Jc as r,Uc as i,dc as a,yc as o}from"./paths-CEAy4QCs.js";import{l as s,p as c}from"./debug-otxXY3j-.js";import{E as l,T as u,r as d,v as f}from"./git-C0IuvuIy.js";import{a as p,n as m,o as h}from"./detectRepository-2ICvGD0U.js";import{realpath as g}from"fs/promises";e(),o(),s(),p(),i(),l(),f();async function _(){try{let e=await m();if(!e){c(`Not in a GitHub repository, skipping path mapping update`);return}let r=t(),i=d(r)??r,o;try{o=(await g(i)).normalize(`NFC`)}catch{o=i}let s=e.toLowerCase(),l=a().githubRepoPaths?.[s]??[];if(l[0]===o){c(`Path ${o} already tracked for repo ${s}`);return}let u=l.filter(e=>e!==o),f=[o,...u];n(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:f}})),c(`Added ${o} to tracked paths for repo ${s}`)}catch(e){c(`Error updating repo path mapping: ${e}`)}}function v(e){let t=a(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function y(e){let t=await Promise.all(e.map(r));return e.filter((e,n)=>t[n])}async function b(e,t){try{let n=await u(e);if(!n)return!1;let r=h(n);return r?r.toLowerCase()===t.toLowerCase():!1}catch{return!1}}function x(e,t){let r=a(),i=e.toLowerCase(),o=r.githubRepoPaths?.[i]??[],s=o.filter(e=>e!==t);if(s.length===o.length)return;let l={...r.githubRepoPaths};s.length===0?delete l[i]:l[i]=s,n(e=>({...e,githubRepoPaths:l})),c(`Removed ${t} from tracked paths for repo ${i}`)}export{b as a,_ as i,v as n,x as r,y as t};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{Bm as o,Fm as s,Hm as c,Im as l,KO as u,Lm as d,Mm as f,Nm as p,Pm as m,Ry as h,Um as g,Wm as _,ZO as v,aS as y,ad as b,id as x,od as S,zm as C}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{Bm as o,Fm as s,Hm as c,Im as l,KO as u,Lm as d,Mm as f,Nm as p,Pm as m,Ry as h,Um as g,Wm as _,ZO as v,aS as y,ad as b,id as x,od as S,zm as C}from"./loadAgentsDir-DC4jN6-f.js";import{n as w,t as T}from"./PermissionDialog-R-Vl4Tk-.js";function E({currentGoal:e,newObjective:t,onConfirm:r,onCancel:a}){function o(e){e===`yes`?r():a()}let c=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,D.jsx)(T,{color:`warning`,title:`Replace active goal?`,children:(0,D.jsxs)(i,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,D.jsx)(n,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,D.jsxs)(i,{marginTop:1,flexDirection:`column`,children:[(0,D.jsx)(n,{dimColor:!0,children:`Current goal:`}),(0,D.jsxs)(n,{children:[(0,D.jsx)(n,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,D.jsxs)(n,{children:[(0,D.jsx)(n,{dimColor:!0,children:`· Status: `}),l(e.status)]}),(0,D.jsxs)(n,{children:[(0,D.jsx)(n,{dimColor:!0,children:`· Time: `}),s(e)]}),(0,D.jsxs)(n,{children:[(0,D.jsx)(n,{dimColor:!0,children:`· Tokens: `}),c]})]}),(0,D.jsxs)(i,{marginTop:1,flexDirection:`column`,children:[(0,D.jsx)(n,{dimColor:!0,children:`New objective:`}),(0,D.jsx)(n,{children:t})]}),(0,D.jsx)(i,{marginTop:1,children:(0,D.jsx)(y,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:o,onCancel:a})})]})})}var D,O=e((()=>{t(),r(),h(),w(),o(),D=a()}));function k(e){let t=e.split(`
|
|
2
2
|
`)[0]??e;return t.length<=I?t:t.slice(0,I)+`…`}function A(){v(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function j(){let e=d();if(!e)return"No active goal. Set one with `/goal <objective>`.";let t=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`,n=[`Goal: ${e.objective}`,`Status: ${l(e.status)}`,`Time: ${s(e)}`,`Tokens: ${t}`,`Continuation turns: ${e.turnsExecuted}`];return e.status===`max_turns`&&n.push("Hint: Max continuation turns reached (150). Run `/goal continue` to reset and continue."),n.join(`
|
|
3
3
|
`)}function M(e){return _(e),C(),b(),`Goal set.`}async function N(e,t,n){let r=n.trim();if(!r||r.toLowerCase()===`status`)return e(j(),{display:`system`}),null;let i=r.toLowerCase();if(i===`clear`){let t=f();return t&&(S(),A()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(i===`pause`){let t=c();return t&&(b(),A()),e(t?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(i===`resume`){if(d()?.status===`max_turns`)return e("Goal reached max continuation turns (150). Run `/goal continue` to reset turn counter and continue.",{display:`system`}),null;let t=g();return t&&b(),e(t?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!t}),null}if(i===`continue`){let t=m();return t&&b(),e(t?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!t}),null}if(i===`complete`){let t=p();return t&&(b(),A()),e(t?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(r.length>F)return e(`Goal objective is too long (${r.length} chars; limit ${F}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let a=d();return a&&a.status!==`complete`?(0,P.jsx)(E,{currentGoal:a,newObjective:r,onConfirm:()=>{A(),e(M(r),{display:`system`,shouldQuery:!0,displayArgs:k(r),metaMessages:[`<goal-objective-updated>\n${r}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(M(r),{display:`system`,shouldQuery:!0,displayArgs:k(r),metaMessages:[`<goal-objective-updated>\n${r}\n</goal-objective-updated>`]}),null)}var P,F,I;e((()=>{t(),o(),x(),u(),O(),P=a(),F=4e3,I=80}))();export{N as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{ai as t,ci as n}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{ai as t,ci as n}from"./paths-CEAy4QCs.js";import{l as r,p as i}from"./debug-otxXY3j-.js";import{B_ as a,G_ as o,H_ as s,Qo as c,Tm as l,U_ as u,Uo as d,V_ as f,W_ as p,Xo as m,dD as h,km as g,mo as _,st as v,uD as y,ut as b}from"./loadAgentsDir-DC4jN6-f.js";import{F as x,I as S,J as C,L as w,P as T,R as E}from"./rcDebugLog-C0Bam8V9.js";import{n as D,t as O}from"./openaiShared-BkVgd2rZ.js";import{randomUUID as k}from"crypto";async function*A(e,n,r,o,d){try{let f=C(d.model),g=c(e,r),_=await Promise.all(r.map(e=>b(e,{getToolPermissionContext:d.getToolPermissionContext,tools:r,agents:d.agents,allowedAgentTypes:d.allowedAgentTypes,model:d.model}))),v=_.filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),y=E(g,n),T=w(v),O=S(d.toolChoice),A=a({maxRetries:0,fetchOverride:d.fetchOverride,source:d.querySource});i(`[Grok] Calling model=${f}, messages=${y.length}, tools=${T.length}`);let j=x(await A.chat.completions.create({model:f,messages:y,...T.length>0&&{tools:T,...O&&{tool_choice:O}},stream:!0,stream_options:{include_usage:!0},...d.temperatureOverride!==void 0&&{temperature:d.temperatureOverride}},{signal:o}),f),M={},N=[],P=null,F={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},I=0,L=Date.now();for await(let e of j){switch(e.type){case`message_start`:P=e.message,I=Date.now()-L,e.message.usage&&(F=D(F,e.message.usage));break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?M[t]={...n,input:``}:n.type===`text`?M[t]={...n,text:``}:n.type===`thinking`?M[t]={...n,thinking:``,signature:``}:M[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=M[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:{let t=M[e.index];if(!t||!P)break;let n={message:{...P,content:m([t],r,d.agentId)},requestId:void 0,type:`assistant`,uuid:k(),timestamp:new Date().toISOString()};N.push(n),yield n;break}case`message_delta`:{let t=e.usage;t&&(F=D(F,t));break}case`message_stop`:break}e.type===`message_stop`&&F.input_tokens+F.output_tokens>0&&l(t(f,F),F,d.model),yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:I}:void 0}}h(d.langfuseTrace??null,{model:f,provider:`grok`,input:s(g,n),output:u(N),usage:{input_tokens:F.input_tokens,output_tokens:F.output_tokens,cache_creation_input_tokens:F.cache_creation_input_tokens,cache_read_input_tokens:F.cache_read_input_tokens},startTime:new Date(L),endTime:new Date,completionStartTime:I>0?new Date(L+I):void 0,tools:p(_)})}catch(e){let t=e instanceof Error?e.message:String(e);i(`[Grok] Error: ${t}`,{level:`error`}),yield _({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{f(),O(),T(),d(),v(),r(),g(),n(),y(),o()}))();export{A as queryModelGrok};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,b as c,d as l,f as u,g as d,h as f,k as p,l as m,m as h,p as g,u as _,v,w as y,x as b,y as x}from"./paths-
|
|
1
|
+
import{A as e,C as t,D as n,E as r,O as i,S as a,T as o,_ as s,b as c,d as l,f as u,g as d,h as f,k as p,l as m,m as h,p as g,u as _,v,w as y,x as b,y as x}from"./paths-CEAy4QCs.js";a();export{m as checkGate_CACHED_OR_BLOCKING,_ as checkSecurityRestrictionGate,l as checkStatsigFeatureGate_CACHED_MAY_BE_STALE,u as clearGrowthBookConfigOverrides,g as getAllGrowthBookFeatures,h as getApiBaseUrlHost,f as getDynamicConfig_BLOCKS_ON_INIT,d as getDynamicConfig_CACHED_MAY_BE_STALE,s as getFeatureValue_CACHED_MAY_BE_STALE,v as getFeatureValue_CACHED_WITH_REFRESH,x as getFeatureValue_DEPRECATED,c as getGrowthBookConfigOverrides,b as hasGrowthBookEnvOverride,t as initializeGrowthBook,y as onGrowthBookRefresh,o as refreshGrowthBookAfterAuthChange,r as refreshGrowthBookFeatures,n as resetGrowthBook,i as setGrowthBookConfigOverride,p as setupPeriodicGrowthBookRefresh,e as stopPeriodicGrowthBookRefresh};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{Uc as r,zc as i}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{Uc as r,zc as i}from"./paths-CEAy4QCs.js";import{E as a,J as o,O as s,U as c,_ as l,h as u,l as d,p as f}from"./debug-otxXY3j-.js";import{n as p,r as m}from"./analytics-DqMQntaB.js";import{o as h,s as g}from"./log-DSV4Ht5l.js";import{join as _}from"path";import{createWriteStream as v,writeFileSync as y}from"fs";import{readFile as b,readdir as x,writeFile as S}from"fs/promises";import{pipeline as C}from"stream/promises";import{getHeapSnapshot as w,getHeapSpaceStatistics as T,getHeapStatistics as E}from"v8";async function D(e,n=0){let r=process.memoryUsage(),i=E(),a=process.resourceUsage(),o=process.uptime(),s;try{s=T()}catch{}let c=process._getActiveHandles().length,l=process._getActiveRequests().length,u;try{u=(await x(`/proc/self/fd`)).length}catch{}let d;try{d=await b(`/proc/self/smaps_rollup`,`utf8`)}catch{}let f=r.rss-r.heapUsed,p=o>0?r.rss/o:0,m=p*3600/(1024*1024),h=[];return i.number_of_detached_contexts>0&&h.push(`${i.number_of_detached_contexts} detached context(s) - possible iframe/context leak`),c>100&&h.push(`${c} active handles - possible timer/socket leak`),f>r.heapUsed&&h.push(`Native memory > heap - leak may be in native addons (node-pty, sharp, etc.)`),m>100&&h.push(`High memory growth rate: ${m.toFixed(1)} MB/hour`),u&&u>500&&h.push(`${u} open file descriptors - possible file/socket leak`),{timestamp:new Date().toISOString(),sessionId:t(),trigger:e,dumpNumber:n,uptimeSeconds:o,memoryUsage:{heapUsed:r.heapUsed,heapTotal:r.heapTotal,external:r.external,arrayBuffers:r.arrayBuffers,rss:r.rss},memoryGrowthRate:{bytesPerSecond:p,mbPerHour:m},v8HeapStats:{heapSizeLimit:i.heap_size_limit,mallocedMemory:i.malloced_memory,peakMallocedMemory:i.peak_malloced_memory,detachedContexts:i.number_of_detached_contexts,nativeContexts:i.number_of_native_contexts},v8HeapSpaces:s?.map(e=>({name:e.space_name,size:e.space_size,used:e.space_used_size,available:e.space_available_size})),resourceUsage:{maxRSS:a.maxRSS*1024,userCPUTime:a.userCPUTime,systemCPUTime:a.systemCPUTime},activeHandles:c,activeRequests:l,openFileDescriptors:u,analysis:{potentialLeaks:h,recommendation:h.length>0?`WARNING: ${h.length} potential leak indicator(s) found. See potentialLeaks array.`:`No obvious leak indicators. Check heap snapshot for retained objects.`},smapsRollup:d,platform:process.platform,nodeVersion:process.version,ccVersion:`2.8.2`}}async function O(e=`manual`,n=0){try{let r=t(),a=await D(e,n),o=e=>(e/1024/1024/1024).toFixed(3);f(`[HeapDump] Memory state:
|
|
2
2
|
heapUsed: ${o(a.memoryUsage.heapUsed)} GB (in snapshot)
|
|
3
3
|
external: ${o(a.memoryUsage.external)} GB (NOT in snapshot)
|
|
4
4
|
rss: ${o(a.memoryUsage.rss)} GB (total process)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{F as n,Q as r,Rn as i,b as a,i as o,n as s,p as c,r as l,t as u,tt as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{S as m,x as h}from"./startupProfiler-CBcN1Chw.js";import{DT as g,Ji as _,OT as v,Ui as y,Vi as b,aS as x,na as S,oS as C}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{F as n,Q as r,Rn as i,b as a,i as o,n as s,p as c,r as l,t as u,tt as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{S as m,x as h}from"./startupProfiler-CBcN1Chw.js";import{DT as g,Ji as _,OT as v,Ui as y,Vi as b,aS as x,na as S,oS as C}from"./loadAgentsDir-DC4jN6-f.js";import{t as w}from"./useKeybinding-DPOUuymz.js";import{t as T}from"./useTerminalSize-Du-EamDN.js";import{n as E,t as D}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{n as O,r as k}from"./modalContext-CuTwi_eD.js";import{n as A,t as j}from"./PromptInputHelpMenu-CAwbW7z2.js";function M({commands:e,maxHeight:t,columns:n,title:r,onCancel:i,emptyMessage:s}){let{headerFocused:c,focusHeader:l}=o(),u=Math.max(1,n-10),d=Math.max(1,Math.floor((t-10)/2)),p=(0,N.useMemo)(()=>{let t=new Set;return e.filter(e=>t.has(e.name)?!1:(t.add(e.name),!0)).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({label:`/${e.name}`,value:e.name,description:m(_(e),u,!0)}))},[e,u]);return(0,P.jsx)(f,{flexDirection:`column`,paddingY:1,children:e.length===0&&s?(0,P.jsx)(a,{dimColor:!0,children:s}):(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(a,{children:r}),(0,P.jsx)(f,{marginTop:1,children:(0,P.jsx)(x,{options:p,visibleOptionCount:d,onCancel:i,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:l,isDisabled:c})})]})})}var N,P,F=e((()=>{i(),N=t(i(),1),S(),h(),u(),C(),P=p()}));function I(){return(0,L.jsxs)(f,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,L.jsxs)(f,{flexDirection:`column`,gap:1,children:[(0,L.jsx)(a,{bold:!0,children:`Getting started`}),(0,L.jsxs)(f,{flexDirection:`column`,children:[(0,L.jsxs)(a,{children:[(0,L.jsx)(a,{bold:!0,children:`1. `}),(0,L.jsx)(a,{children:`Ask a question or describe a task — Claude will explore your code and respond.`})]}),(0,L.jsxs)(a,{children:[(0,L.jsx)(a,{bold:!0,children:`2. `}),(0,L.jsx)(a,{children:`When Claude wants to edit files or run commands, you review and approve each action.`})]}),(0,L.jsxs)(a,{children:[(0,L.jsx)(a,{bold:!0,children:`3. `}),(0,L.jsx)(a,{children:`Type `}),(0,L.jsx)(a,{bold:!0,children:`/commit`}),(0,L.jsx)(a,{children:` to commit changes, `}),(0,L.jsx)(a,{bold:!0,children:`/help`}),(0,L.jsx)(a,{children:` for commands, or `}),(0,L.jsx)(a,{bold:!0,children:`?`}),(0,L.jsx)(a,{children:` for shortcuts.`})]})]})]}),(0,L.jsxs)(f,{flexDirection:`column`,children:[(0,L.jsx)(f,{children:(0,L.jsx)(a,{bold:!0,children:`Shortcuts`})}),(0,L.jsx)(j,{gap:2,fixedWidth:!0})]})]})}var L,R=e((()=>{i(),u(),A(),L=p()}));function z({onClose:e,commands:t}){let{rows:i,columns:o}=n(),u=Math.floor(i/2),p=k(),m=()=>e(`Help dialog dismissed`,{display:`system`});d(`help:dismiss`,m,{context:`Help`});let h=E(m),g=v(`help:dismiss`,`Help`,`esc`),_=y(),x=t.filter(e=>_.has(e.name)&&!e.isHidden),S=[];if(process.env.USER_TYPE===`ant`){let e=new Set(b.map(e=>e.name));x=x.filter(t=>!e.has(t.name)),S=t.filter(t=>e.has(t.name)&&!t.isHidden)}let C=t.filter(e=>!_.has(e.name)&&!e.isHidden),w=[(0,B.jsx)(s,{title:`general`,children:(0,B.jsx)(I,{})},`general`)];return w.push((0,B.jsx)(s,{title:`commands`,children:(0,B.jsx)(M,{commands:x,maxHeight:u,columns:o,title:`Browse default commands:`,onCancel:m})},`commands`)),w.push((0,B.jsx)(s,{title:`custom-commands`,children:(0,B.jsx)(M,{commands:C,maxHeight:u,columns:o,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:m})},`custom`)),process.env.USER_TYPE===`ant`&&S.length>0&&w.push((0,B.jsx)(s,{title:`[ant-only]`,children:(0,B.jsx)(M,{commands:S,maxHeight:u,columns:o,title:`Browse ant-only commands:`,onCancel:m})},`ant-only`)),(0,B.jsx)(f,{flexDirection:`column`,height:p?void 0:u,children:(0,B.jsxs)(c,{color:`professionalBlue`,children:[(0,B.jsx)(l,{title:process.env.USER_TYPE===`ant`?`/help`:`Claude Code v2.8.2`,color:`professionalBlue`,defaultTab:`general`,children:w}),(0,B.jsx)(f,{marginTop:1,children:(0,B.jsxs)(a,{children:[`For more help: `,(0,B.jsx)(r,{url:`https://code.claude.com/docs/en/overview`})]})}),(0,B.jsx)(f,{marginTop:1,children:(0,B.jsx)(a,{dimColor:!0,children:h.pending?(0,B.jsxs)(B.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,B.jsxs)(a,{italic:!0,children:[g,` to cancel`]})})})]})})}var B,V=e((()=>{i(),D(),g(),S(),O(),T(),u(),w(),F(),R(),B=p()})),H,U;e((()=>{V(),H=p(),U=async(e,{options:{commands:t}})=>(0,H.jsx)(z,{commands:t,onClose:e})}))();export{U as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{$t as e,Cn as t,Sn as n,mn as r}from"./loadAgentsDir-DC4jN6-f.js";t();export{e as executeSessionEndHooks,r as getSessionEndHookTimeoutMs,n as hasWorktreeCreateHook};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./memoize-DNnuA2aU.js";import{n as i,t as a}from"./figures-gfT9mM8P.js";import{Q as o,Rn as s,b as c,f as l,t as u,tt as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{cn as m,ht as h}from"./state-sIHsFpDu.js";import{Qa as g,no as _,oo as v}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./memoize-DNnuA2aU.js";import{n as i,t as a}from"./figures-gfT9mM8P.js";import{Q as o,Rn as s,b as c,f as l,t as u,tt as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{cn as m,ht as h}from"./state-sIHsFpDu.js";import{Qa as g,no as _,oo as v}from"./paths-CEAy4QCs.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{l as x,o as S}from"./stringUtils-KZoO4GUd.js";import{Xu as C,Zu as w,aS as T,av as E,dC as D,ev as O,iv as k,lC as A,nv as j,oS as M,ov as N,rv as P,tv as F,uC as ee,vC as te,yC as ne}from"./loadAgentsDir-DC4jN6-f.js";import{t as re}from"./useKeybinding-DPOUuymz.js";function ie(e,t){let n={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},r=L(t);O(e).forEach(e=>{let t=n[e.event];if(t){let n=r[e.event].matcherMetadata===void 0?``:e.matcher||``;t[n]||(t[n]=[]),t[n].push(e)}});let i=h();if(i)for(let[e,t]of Object.entries(i)){let r=e,i=n[r];if(i)for(let e of t??[]){let t=e.matcher||``;if(`pluginRoot`in e){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:n,matcher:e.matcher,source:`pluginHook`,pluginName:e.pluginId})}else if(process.env.USER_TYPE===`ant`){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:{type:`command`,command:`[ANT-ONLY] Built-in Hook`},matcher:e.matcher,source:`builtinHook`})}}}return n}function ae(e,t){return N(Object.keys(e[t]||{}),e,t)}function oe(e,t,n){let r=n??``;return e[t]?.[r]??[]}function I(e,t){return L(t)[e].matcherMetadata}var L,R=e((()=>{r(),m(),E(),L=n(function(e){return{PreToolUse:{summary:`Before tool execution`,description:`Input to command is JSON of tool call arguments.
|
|
2
2
|
Exit code 0 - stdout/stderr not shown
|
|
3
3
|
Exit code 2 - show stderr to model and block tool call
|
|
4
4
|
Other exit codes - show stderr to user only but continue with tool call`,matcherMetadata:{fieldToMatch:`tool_name`,values:e}},PostToolUse:{summary:`After tool execution`,description:`Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{l as t,p as n}from"./debug-otxXY3j-.js";import{o as r,r as i}from"./common-NEOWMwtB.js";import{c as a,s as o}from"./escHotkey-D8WgbSyj.js";import{i as s,n as c,r as l}from"./gates-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{l as t,p as n}from"./debug-otxXY3j-.js";import{o as r,r as i}from"./common-NEOWMwtB.js";import{c as a,s as o}from"./escHotkey-D8WgbSyj.js";import{i as s,n as c,r as l}from"./gates-C5y8P5t9.js";import{n as u,t as d}from"./executor-BVh1PTF-.js";import{format as f}from"util";function p(){try{return Bun.spawnSync({cmd:[`osascript`,`-e`,`tell application "System Events" to get name of every process whose background only is false`],stdout:`pipe`,stderr:`pipe`}).exitCode===0}catch{return!1}}function m(){try{return Bun.spawnSync({cmd:[`screencapture`,`-x`,`-R`,`0,0,1,1`,`/dev/null`],stdout:`pipe`,stderr:`pipe`}).exitCode===0}catch{return!1}}function h(){return _||(_={serverName:i,logger:new g,executor:d({getMouseAnimationEnabled:()=>l().mouseAnimation,getHideBeforeActionEnabled:()=>l().hideBeforeAction}),ensureOsPermissions:async()=>{if(process.platform!==`darwin`)return{granted:!0};let e=a().tcc;if(e){let t=e.checkAccessibility(),n=e.checkScreenRecording();return t&&n?{granted:!0}:{granted:!1,accessibility:t,screenRecording:n}}let t=p(),n=m();return t&&n?{granted:!0}:{granted:!1,accessibility:t,screenRecording:n}},isDisabled:()=>!c(),getSubGates:l,getAutoUnhideEnabled:()=>!0,cropRawPatch:()=>null},_)}var g,_,v=e((()=>{t(),r(),u(),s(),o(),g=class{silly(e,t){n(f(e,t??``),{level:`debug`})}debug(e,t){n(f(e,t??``),{level:`debug`})}info(e,t){n(f(e,t??``),{level:`info`})}warn(e,t){n(f(e,t??``),{level:`warn`})}error(e,t){n(f(e,t??``),{level:`error`})}}}));export{v as n,h as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Rn as i,b as a,f as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{Cc as u,dc as d,yc as f}from"./paths-
|
|
1
|
+
import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Rn as i,b as a,f as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{Cc as u,dc as d,yc as f}from"./paths-CEAy4QCs.js";import{n as p,r as m}from"./analytics-DqMQntaB.js";import{n as h,t as g}from"./cwd--iizewsn.js";import{r as _,t as v}from"./execFileNoThrow-azCkYhmF.js";import{Ax as y,Cx as b,Fx as x,Jx as S,Nx as C,Ot as w,Px as T,Ry as E,Sx as D,Tt as O,aS as k,fC as A,lC as j,tS as M,uC as N,zx as P}from"./loadAgentsDir-DC4jN6-f.js";import*as F from"path";function I({onComplete:e}){return(0,V.jsxs)(o,{title:`Do you wish to enable auto-connect to IDE?`,color:`ide`,onCancel:e,children:[(0,V.jsx)(k,{options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}],onChange:(0,B.useCallback)(async t=>{let n=t===`yes`;u(e=>({...e,autoConnectIde:n,hasIdeAutoConnectDialogBeenShown:!0})),e()},[e]),defaultValue:`yes`}),(0,V.jsx)(a,{dimColor:!0,children:`You can also configure this in /config or with the --ide flag`})]})}function L(){let e=d();return!x()&&e.autoConnectIde!==!0&&e.hasIdeAutoConnectDialogBeenShown!==!0}function R({onComplete:e}){let t=(0,B.useCallback)(t=>{let n=t===`yes`;n&&u(e=>({...e,autoConnectIde:!1})),e(n)},[e]);return(0,V.jsx)(o,{title:`Do you wish to disable auto-connect to IDE?`,subtitle:`You can also configure this in /config`,onCancel:(0,B.useCallback)(()=>{e(!1)},[e]),color:`ide`,children:(0,V.jsx)(k,{options:[{label:`No`,value:`no`},{label:`Yes`,value:`yes`}],onChange:t,defaultValue:`no`})})}function z(){let e=d();return!x()&&e.autoConnectIde===!0}var B,V,H=e((()=>{B=t(i(),1),s(),f(),y(),E(),V=l()}));function U({availableIDEs:e,unavailableIDEs:t,selectedIDE:n,onClose:r,onSelect:i}){let[s,l]=(0,Z.useState)(n?.port?.toString()??`None`),[u,d]=(0,Z.useState)(!1),[f,p]=(0,Z.useState)(!1),m=(0,Z.useCallback)(t=>{t!==`None`&&L()?d(!0):t===`None`&&z()?p(!0):i(e.find(e=>e.port===parseInt(t,10)))},[e,i]),h=e.reduce((e,t)=>(e[t.name]=(e[t.name]||0)+1,e),{}),g=e.map(e=>{let t=(h[e.name]||0)>1&&e.workspaceFolders.length>0;return{label:e.name,value:e.port.toString(),description:t?X(e.workspaceFolders):void 0}}).concat([{label:`None`,value:`None`,description:void 0}]);return u?(0,Q.jsx)(I,{onComplete:()=>m(s)}):f?(0,Q.jsx)(R,{onComplete:()=>{i(void 0)}}):(0,Q.jsx)(o,{title:`Select IDE`,subtitle:`Connect to an IDE for integrated development features.`,onCancel:r,color:`ide`,children:(0,Q.jsxs)(c,{flexDirection:`column`,children:[e.length===0&&(0,Q.jsx)(a,{dimColor:!0,children:T()?`No available IDEs detected. Please install the plugin and restart your IDE:
|
|
2
2
|
https://docs.claude.com/s/claude-code-jetbrains`:`No available IDEs detected. Make sure your IDE has the Claude Code extension or plugin installed and is running.`}),e.length!==0&&(0,Q.jsx)(k,{defaultValue:s,defaultFocusValue:s,options:g,onChange:e=>{l(e),m(e)}}),e.length!==0&&e.some(e=>e.name===`VS Code`||e.name===`Visual Studio Code`)&&(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(a,{color:`warning`,children:`Note: Only one Claude Code instance can be connected to VS Code at a time.`})}),e.length!==0&&!x()&&(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(a,{dimColor:!0,children:`Tip: You can enable auto-connect to IDE in /config or with the --ide flag`})}),t.length>0&&(0,Q.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,Q.jsxs)(a,{dimColor:!0,children:[`Found `,t.length,` other running IDE(s). However, their workspace/project directories do not match the current cwd.`]}),(0,Q.jsx)(c,{marginTop:1,flexDirection:`column`,children:t.map((e,t)=>(0,Q.jsx)(c,{paddingLeft:3,children:(0,Q.jsxs)(a,{dimColor:!0,children:[`• `,e.name,`: `,X(e.workspaceFolders)]})},t))})]})]})})}async function W(e,t){let n=t?.ide;if(!n||n.type!==`sse-ide`&&n.type!==`ws-ide`)return null;for(let t of e)if(t.url===n.url)return t;return null}function G({availableIDEs:e,onSelectIDE:t,onDone:n}){let[r,i]=(0,Z.useState)(e[0]?.port?.toString()??``),a=(0,Z.useCallback)(n=>{t(e.find(e=>e.port===parseInt(n,10)))},[e,t]),s=e.map(e=>({label:e.name,value:e.port.toString()}));function c(){n(`IDE selection cancelled`,{display:`system`})}return(0,Q.jsx)(o,{title:`Select an IDE to open the project`,onCancel:c,color:`ide`,children:(0,Q.jsx)(k,{defaultValue:r,defaultFocusValue:r,options:s,onChange:e=>{i(e),a(e)}})})}function K({runningIDEs:e,onSelectIDE:t,onDone:n}){let[r,i]=(0,Z.useState)(e[0]??``),a=(0,Z.useCallback)(e=>{t(e)},[t]),s=e.map(e=>({label:P(e),value:e}));function c(){n(`IDE selection cancelled`,{display:`system`})}return(0,Q.jsx)(o,{title:`Select IDE to install extension`,onCancel:c,color:`ide`,children:(0,Q.jsx)(k,{defaultFocusValue:r,options:s,onChange:e=>{i(e),a(e)}})})}function q({ide:e,onInstall:t}){return(0,Z.useEffect)(()=>{t(e)},[e,t]),null}async function J(e,t,r){m(`tengu_ext_ide_command`,{});let{options:{dynamicMcpConfig:i},onChangeDynamicMcpConfig:a}=t;if(r?.trim()===`open`){let t=O(),r=t?t.worktreePath:g(),i=(await D(!0)).filter(e=>e.isValid);return i.length===0?(e(`No IDEs with Claude Code extension detected.`),null):(0,Q.jsx)(G,{availableIDEs:i,onSelectIDE:async i=>{if(!i){e(`No IDE selected.`);return}if(i.name.toLowerCase().includes(`vscode`)||i.name.toLowerCase().includes(`cursor`)||i.name.toLowerCase().includes(`windsurf`)){let{code:a}=await v(`code`,[r]);e(a===0?`Opened ${t?`worktree`:`project`} in ${n.bold(i.name)}`:`Failed to open in ${i.name}. Try opening manually: ${r}`)}else T(),e(`Please open the ${t?`worktree`:`project`} manually in ${n.bold(i.name)}: ${r}`)},onDone:()=>{e(`Exited without opening IDE`,{display:`system`})}})}let o=await D(!0);if(o.length===0&&t.onInstallIDEExtension&&!x()){let r=await b(),i=r=>{t.onInstallIDEExtension&&(t.onInstallIDEExtension(r),C(r)?e(`Installed plugin to ${n.bold(P(r))}\nPlease ${n.bold(`restart your IDE`)} completely for it to take effect`):e(`Installed extension to ${n.bold(P(r))}`))};if(r.length>1)return(0,Q.jsx)(K,{runningIDEs:r,onSelectIDE:i,onDone:()=>{e(`No IDE selected.`,{display:`system`})}});if(r.length===1)return(0,Q.jsx)(q,{ide:r[0],onInstall:i})}let s=o.filter(e=>e.isValid);return(0,Q.jsx)(Y,{availableIDEs:s,unavailableIDEs:o.filter(e=>!e.isValid),currentIDE:await W(s,i),dynamicMcpConfig:i,onChangeDynamicMcpConfig:a,onDone:e})}function Y({availableIDEs:e,unavailableIDEs:t,currentIDE:n,dynamicMcpConfig:r,onChangeDynamicMcpConfig:i,onDone:o}){let[s,c]=(0,Z.useState)(null),l=N(e=>e.mcp.clients.find(e=>e.name===`ide`)),u=A(),d=(0,Z.useRef)(!0);(0,Z.useEffect)(()=>{if(s){if(d.current){d.current=!1;return}!l||l.type===`pending`||(l.type===`connected`?o(`Connected to ${s.name}.`):l.type===`failed`&&o(`Failed to connect to ${s.name}.`))}},[l,s,o]),(0,Z.useEffect)(()=>{if(!s)return;let e=setTimeout(o,$,`Connection to ${s.name} timed out.`);return()=>clearTimeout(e)},[s,o]);let f=(0,Z.useCallback)(e=>{if(!i){o(`Error connecting to IDE.`);return}let t={...r||{}};if(n&&delete t.ide,!e){l&&l.type===`connected`&&n&&(l.client.onclose=()=>{},S(`ide`,l.config),u(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.filter(e=>e.name!==`ide`),tools:e.mcp.tools.filter(e=>!e.name?.startsWith(`mcp__ide__`)),commands:e.mcp.commands.filter(e=>!e.name?.startsWith(`mcp__ide__`))}}))),i(t),o(n?`Disconnected from ${n.name}.`:`No IDE selected.`);return}let a=e.url;t.ide={type:a.startsWith(`ws:`)?`ws-ide`:`sse-ide`,url:a,ideName:e.name,authToken:e.authToken,ideRunningInWindows:e.ideRunningInWindows,scope:`dynamic`},d.current=!0,c(e),i(t)},[r,n,l,u,i,o]);return s?(0,Q.jsxs)(a,{dimColor:!0,children:[`Connecting to `,s.name,`…`]}):(0,Q.jsx)(U,{availableIDEs:e,unavailableIDEs:t,selectedIDE:n,onClose:()=>o(`IDE selection cancelled`,{display:`system`}),onSelect:f})}function X(e,t=100){if(e.length===0)return``;let n=g(),r=e.slice(0,2),i=e.length>2,a=i?3:0,o=t-(r.length-1)*2-a,s=Math.floor(o/r.length),c=n.normalize(`NFC`),l=r.map(e=>{let t=e.normalize(`NFC`);return t.startsWith(c+F.sep)&&(e=t.slice(c.length+1)),e.length<=s?e:`…`+e.slice(-(s-1))}).join(`, `);return i&&(l+=`, …`),l}var Z,Q,$;e((()=>{r(),Z=t(i(),1),p(),E(),s(),H(),M(),j(),h(),_(),y(),w(),Q=l(),$=35e3}))();export{J as call,X as formatWorkspaceFolders};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,s as t}from"./envUtils-BWeoiL4Y.js";import{n,t as r}from"./axios-DhfaybwJ.js";import{Ln as i,Tt as a,wn as o}from"./schemas-BGAvj1T4.js";import{t as s}from"./v4-f1i_CNUT.js";import{Ct as c,cn as l}from"./state-sIHsFpDu.js";import{l as u,p as d}from"./debug-otxXY3j-.js";import{n as f,t as p}from"./lazySchema-B0QShMaQ.js";import{a as m,n as h,t as g}from"./bridgeConfig-
|
|
1
|
+
import{n as e,s as t}from"./envUtils-BWeoiL4Y.js";import{n,t as r}from"./axios-DhfaybwJ.js";import{Ln as i,Tt as a,wn as o}from"./schemas-BGAvj1T4.js";import{t as s}from"./v4-f1i_CNUT.js";import{Ct as c,cn as l}from"./state-sIHsFpDu.js";import{l as u,p as d}from"./debug-otxXY3j-.js";import{n as f,t as p}from"./lazySchema-B0QShMaQ.js";import{a as m,n as h,t as g}from"./bridgeConfig-Di9LziJ3.js";import{basename as _,join as v}from"path";import{randomUUID as y}from"crypto";import{mkdir as b,writeFile as x}from"fs/promises";r(),s(),l(),u(),t(),p(),m();var S=3e4;function C(e){d(`[bridge:inbound-attach] ${e}`)}var w=f(()=>o({file_uuid:i(),file_name:i()})),T=f(()=>a(w()));function E(e){if(typeof e!=`object`||!e||!(`file_attachments`in e))return[];let t=T().safeParse(e.file_attachments);return t.success?t.data:[]}function D(e){return _(e).replace(/[^a-zA-Z0-9._-]/g,`_`)||`attachment`}function O(){return v(e(),`uploads`,c())}async function k(e){let t=g();if(!t){C(`skip: no oauth token`);return}let r;try{let i=`${h()}/api/oauth/files/${encodeURIComponent(e.file_uuid)}/content`,a=await n.get(i,{headers:{Authorization:`Bearer ${t}`},responseType:`arraybuffer`,timeout:S,validateStatus:()=>!0});if(a.status!==200){C(`fetch ${e.file_uuid} failed: status=${a.status}`);return}r=Buffer.from(a.data)}catch(t){C(`fetch ${e.file_uuid} threw: ${t}`);return}let i=D(e.file_name),a=(e.file_uuid.slice(0,8)||y().slice(0,8)).replace(/[^a-zA-Z0-9_-]/g,`_`),o=O(),s=v(o,`${a}-${i}`);try{await b(o,{recursive:!0}),await x(s,r)}catch(e){C(`write ${s} failed: ${e}`);return}return C(`resolved ${e.file_uuid} → ${s} (${r.length} bytes)`),s}async function A(e){if(e.length===0)return``;C(`resolving ${e.length} attachment(s)`);let t=(await Promise.all(e.map(k))).filter(e=>e!==void 0);return t.length===0?``:t.map(e=>`@"${e}"`).join(` `)+` `}function j(e,t){if(!t)return e;if(typeof e==`string`)return t+e;let n=e.findLastIndex(e=>e.type===`text`);if(n!==-1){let r=e[n];if(r.type===`text`)return[...e.slice(0,n),{...r,text:t+r.text},...e.slice(n+1)]}return[...e,{type:`text`,text:t.trimEnd()}]}async function M(e,t){let n=E(e);return n.length===0?t:j(t,await A(n))}export{A as i,j as n,M as r,E as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./inboundAttachments-C8y3D5mp.js";export{e as resolveAndPrepend};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./chunk-DR8-3Aex.js";import{d as t,s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,cn as a,ot as o}from"./state-sIHsFpDu.js";import{Cc as s,Jt as c,Pt as l,S as u,dc as d,la as f,nn as p,on as m,ua as h,v as g,yc as _}from"./paths-BZjPDxMm.js";import{Q as v,U as y,Z as b,l as x,p as S,z as C}from"./debug-otxXY3j-.js";import{n as ee,r as w}from"./analytics-DqMQntaB.js";import{F as T,P as E,i as te,m as ne,v as D}from"./git-C0IuvuIy.js";import{g as O,m as k}from"./log-DSV4Ht5l.js";import{n as A,t as j}from"./sleep-C6koP5Ka.js";import{Aa as re,Cd as ie,Fa as ae,Fr as oe,Ia as M,Ka as se,La as ce,Ma as le,Mo as ue,Na as N,Oa as de,Pa as fe,Po as pe,Qa as P,Ra as F,Uo as I,Wa as L,br as R,by as me,ja as he,ka as z,qo as ge,xy as B,yd as _e}from"./loadAgentsDir-BYWykYwn.js";import{O as V,_ as ve,d as H,k as ye,n as be,t as U}from"./rcDebugLog-ClX1msJX.js";import{a as W,c as G,d as xe,f as Se,o as K,r as Ce,s as q,u as J}from"./debugUtils-l8nsUZ6R.js";import{a as we,i as Te}from"./trustedDevice-DeNxe6bl.js";import{a as Y,i as Ee,n as X,o as Z,t as Q}from"./bridgeConfig-l6Ldi_hk.js";import{a as De,o as Oe,r as ke,s as Ae,t as je}from"./bridgeEnabled-DYclTb9d.js";import{i as Me,t as Ne}from"./assistant-CemNvrYr.js";import{t as Pe}from"./capacityWake-DtmDHwEt.js";import{n as Fe,t as $}from"./pollConfig-DBNHhvHf.js";import{a as Ie,n as Le,r as Re,t as ze}from"./workSecret-DJu7k30X.js";import{a as Be,i as Ve,n as He,t as Ue}from"./createSession-Ce218tQj.js";import{i as We,n as Ge}from"./envLessBridgeConfig-CpjlwmvF.js";import{n as Ke,o as qe}from"./mappers-BBkM1aA5.js";import{n as Je,r as Ye,t as Xe}from"./sessionTitle-ePQRpeV2.js";import{a as Ze,i as Qe,n as $e,o as et,r as tt,t as nt}from"./bridgeMessaging-CYe1Cixl.js";import{t as rt}from"./HybridTransport-DLaxmXCR.js";import{n as it,r as at,t as ot}from"./flushGate-C18XwNsa.js";import{hostname as st}from"os";import{randomUUID as ct}from"crypto";a(),k(),D(),_(),h(),m(),u(),Y(),B(),ke(),I(),L(),oe(),Ve(),We(),Ke(),Ye(),ae(),x(),U(),E(),ee(),b(),G(),_e(),we(),V(),H(),n(),K(),y(),j(),z();var lt=2e3,ut=6e4,dt=900*1e3,ft=0;async function pt(e){let{dir:n,machineName:i,branch:a,gitRepoUrl:o,title:s,baseUrl:c,sessionIngressUrl:l,workerType:u,getAccessToken:d,createSession:f,archiveSession:p,getCurrentTitle:m=()=>s,toSDKMessages:h=()=>{throw Error(`BridgeCoreParams.toSDKMessages not provided. Pass it if you use writeMessages() or initialMessages — daemon callers that only use writeSdkMessages() never hit this path.`)},onAuth401:g,getPollIntervalConfig:_=()=>Fe,initialHistoryCap:y=200,initialMessages:b,previouslyFlushedUUIDs:x,onInboundMessage:ee,onPermissionResponse:E,onInterrupt:te,onSetModel:ne,onSetMaxThinkingTokens:D,onSetPermissionMode:O,onStateChange:k,onUserMessage:A,perpetual:j,initialSSESequenceNum:ae=0}=e,oe=++ft,{writeBridgePointer:M,clearBridgePointer:se,readBridgePointer:ce}=await import(`./bridgePointer-Clcvh52n.js`),ue=j?await ce(n):null,N=ue?.source===`repl`?ue:null;S(`[bridge:repl] initBridgeCore #${oe} starting (initialMessages=${b?.length??0}${N?` perpetual prior=env:${N.environmentId}`:``})`);let pe=fe({baseUrl:c,getAccessToken:d,runnerVersion:`2.8.1`,onDebug:S,onAuth401:g,getTrustedDeviceToken:Te}),P=process.env.USER_TYPE===`ant`?le(pe):pe,F={dir:n,machineName:i,branch:a,gitRepoUrl:o,maxSessions:1,spawnMode:`single-session`,verbose:!1,sandbox:!1,bridgeId:ct(),workerType:u,environmentId:ct(),reuseEnvironmentId:N?.environmentId,apiBaseUrl:c,sessionIngressUrl:l},I,L;try{let e=await P.registerBridgeEnvironment(F);I=e.environment_id,L=e.environment_secret}catch(e){return q(`registration_failed`,`[bridge:repl] Environment registration failed: ${C(e)}`),N&&await se(n),k?.(`failed`,C(e)),null}S(`[bridge:repl] Environment registered: ${I}`),T(`info`,`bridge_repl_env_registered`),w(`tengu_bridge_repl_env_registered`,{});async function R(e,t){if(I!==e)return S(`[bridge:repl] Env mismatch (requested ${e}, got ${I}) — cannot reconnect in place`),!1;let n=Se(t),r=n===t?[t]:[t,n];for(let e of r)try{return await P.reconnectSession(I,e),S(`[bridge:repl] Reconnected session ${e} in place on env ${I}`),!0}catch(t){S(`[bridge:repl] reconnectSession(${e}) failed: ${C(t)}`)}return S(`[bridge:repl] reconnectSession exhausted — falling through to fresh session`),!1}let me=N?await R(N.environmentId,N.sessionId):!1;N&&!me&&await se(n);let z;if(me&&N){if(z=N.sessionId,S(`[bridge:repl] Perpetual session reused: ${z}`),b&&x)for(let e of b)x.add(e.uuid)}else{let e=await f({environmentId:I,title:s,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});if(!e)return S(`[bridge:repl] Session creation failed, deregistering environment`),w(`tengu_bridge_repl_session_failed`,{}),await P.deregisterEnvironment(I).catch(()=>{}),k?.(`failed`,`Session creation failed`),null;z=e,S(`[bridge:repl] Session created: ${z}`)}await M(n,{sessionId:z,environmentId:I,source:`repl`}),T(`info`,`bridge_repl_session_created`),w(`tengu_bridge_repl_started`,{has_initial_messages:!!(b&&b.length>0),inProtectedNamespace:t()});let ge=new Set;if(b)for(let e of b)ge.add(e.uuid);let B=new nt(2e3);for(let e of ge)B.add(e);let _e=new nt(2e3),V=new AbortController,H=null;ve(e=>{V.signal.aborted||H?.reportMetadata(e)},{replayCurrent:!0});let U=0,W=me?ae:0,G=null,K=null,Ce=Pe(V.signal),J=Ce.wake,we=Ce.signal,Y=new ot,Ee=!A,X=0,Z=null;async function Q(){if(Z)return Z;Z=De();try{return await Z}finally{Z=null}}async function De(){if(X++,be(`doReconnect: attempt=${X}/3 envId=${I} sessionId=${z} workId=${G}`),U++,S(`[bridge:repl] Reconnecting after env lost (attempt ${X}/3)`),X>3)return S(`[bridge:repl] Environment reconnect limit reached (3), giving up`),!1;if(H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}if(J(),Y.drop(),G){let e=G;if(await P.stopWork(I,e,!1).catch(()=>{}),G!==e)return S(`[bridge:repl] Poll loop recovered during stopWork await — deferring to it`),X=0,!0;G=null,K=null}if(V.signal.aborted)return S(`[bridge:repl] Reconnect aborted by teardown`),!1;let e=I;F.reuseEnvironmentId=e;try{let e=await P.registerBridgeEnvironment(F);I=e.environment_id,L=e.environment_secret}catch(e){return F.reuseEnvironmentId=void 0,S(`[bridge:repl] Environment re-registration failed: ${C(e)}`),!1}if(F.reuseEnvironmentId=void 0,S(`[bridge:repl] Re-registered: requested=${e} got=${I}`),V.signal.aborted)return S(`[bridge:repl] Reconnect aborted after env registration, cleaning up`),await P.deregisterEnvironment(I).catch(()=>{}),!1;if(H!==null)return S(`[bridge:repl] Poll loop recovered during registerBridgeEnvironment await — deferring to it`),X=0,!0;if(await R(e,z))return w(`tengu_bridge_repl_reconnected_in_place`,{}),X=0,!0;if(I!==e&&w(`tengu_bridge_repl_env_expired_fresh_session`,{}),await p(z),V.signal.aborted)return S(`[bridge:repl] Reconnect aborted after archive, cleaning up`),await P.deregisterEnvironment(I).catch(()=>{}),!1;let t=m(),r=await f({environmentId:I,title:t,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});return r?V.signal.aborted?(S(`[bridge:repl] Reconnect aborted after session creation, cleaning up`),await p(r),!1):(z=r,ie(xe(r)).catch(()=>{}),W=0,_e.clear(),Ee=!A,S(`[bridge:repl] Re-created session: ${z}`),await M(n,{sessionId:z,environmentId:I,source:`repl`}),x?.clear(),X=0,!0):(S(`[bridge:repl] Session creation failed during reconnection`),!1)}function Oe(){return d()}function ke(){let e=Y.end();if(e.length===0)return;if(!H){S(`[bridge:repl] Cannot drain ${e.length} pending message(s): no transport`);return}for(let t of e)B.add(t.uuid);let t=h(e).map(e=>({...e,session_id:z}));S(`[bridge:repl] Drained ${e.length} pending message(s) after flush`),H.writeBatch(t)}let Ae=null;function je(){Ae?.()}function Me(e){if(be(`handleTransportPermanentClose: code=${e} transport=${H?`exists`:`null`} pollAborted=${V.signal.aborted}`),S(`[bridge:repl] Transport permanently closed: code=${e}`),w(`tengu_bridge_repl_ws_closed`,{code:e}),H){let e=H.getLastSequenceNum();e>W&&(W=e),H=null}J();let t=Y.drop();if(t>0&&S(`[bridge:repl] Dropping ${t} pending message(s) on transport close (code=${e})`,{level:`warn`}),e===1e3){k?.(`failed`,`session ended`),V.abort(),je();return}k?.(`reconnecting`,`Remote Control connection lost (code ${e})`),S(`[bridge:repl] Transport reconnect budget exhausted (code=${e}), attempting env reconnect`),Q().then(t=>{t||V.signal.aborted||(S(`[bridge:repl] reconnectEnvironmentWithSession resolved false — tearing down`),w(`tengu_bridge_repl_reconnect_failed`,{close_code:e}),k?.(`failed`,`reconnection failed`),je())})}let Ne;process.env.USER_TYPE===`ant`&&process.platform!==`win32`&&(Ne=()=>{S(`[bridge:repl] SIGUSR2 received — forcing doReconnect() for testing`),Q()},process.on(`SIGUSR2`,Ne));let $=null;process.env.USER_TYPE===`ant`&&he({fireClose:e=>{if(!$){S(`[bridge:debug] fireClose: no transport wired yet`);return}S(`[bridge:debug] fireClose(${e}) — injecting`),$(e)},forceReconnect:()=>{S(`[bridge:debug] forceReconnect — injecting`),Q()},injectFault:re,wakePollLoop:J,describe:()=>`env=${I} session=${z} transport=${H?.getStateLabel()??`null`} workId=${G??`null`}`}),mt({api:P,getCredentials:()=>({environmentId:I,environmentSecret:L}),signal:V.signal,getPollIntervalConfig:_,onStateChange:k,getWsState:()=>H?.getStateLabel()??`null`,isAtCapacity:()=>H!==null,capacitySignal:we,onFatalError:je,getHeartbeatInfo:()=>!G||!K?null:{environmentId:I,workId:G,sessionToken:K},onHeartbeatFatal:e=>{if(S(`[bridge:repl] heartbeatWork fatal (status=${e.status}) — tearing down work item for fast re-dispatch`),H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}Y.drop(),G&&P.stopWork(I,G,!1).catch(e=>{S(`[bridge:repl] stopWork after heartbeat fatal: ${C(e)}`)}),G=null,K=null,J(),k?.(`reconnecting`,`Work item lease expired, fetching fresh token`)},async onEnvironmentLost(){return await Q()?{environmentId:I,environmentSecret:L}:null},onWorkReceived:(e,t,i,a)=>{if(H?.isConnectedStatus()&&S(`[bridge:repl] Work received while transport connected, replacing with fresh token (workId=${i})`),S(`[bridge:repl] Work received: workId=${i} workSessionId=${e} currentSessionId=${z} match=${Ie(e,z)}`),M(n,{sessionId:z,environmentId:I,source:`repl`}),!Ie(e,z)){S(`[bridge:repl] Rejecting foreign session: expected=${z} got=${e}`);return}G=i,K=t;let o=a||r(process.env.CLAUDE_BRIDGE_USE_CCR_V2),s;if(!o){if(s=Oe(),!s){S(`[bridge:repl] No OAuth token available for session ingress, skipping work`);return}ye(s)}if(w(`tengu_bridge_repl_work_received`,{}),H){let e=H;H=null;let t=e.getLastSequenceNum();t>W&&(W=t),e.close()}Y.deactivate();let u=e=>Qe(e,{transport:H,sessionId:z,onInterrupt:te,onSetModel:ne,onSetMaxThinkingTokens:D,onSetPermissionMode:O}),d=!1,f=e=>{H=e,e.setOnConnect(()=>{if(H===e){if(S(`[bridge:repl] Ingress transport connected`),w(`tengu_bridge_repl_ws_connected`,{}),!o){let e=Oe();e&&ye(e)}if(He=!1,!d&&b&&b.length>0){d=!0;let t=y,n=b.filter(e=>Ze(e)&&!x?.has(e.uuid)),r=t>0&&n.length>t?n.slice(-t):n;r.length<n.length&&(S(`[bridge:repl] Capped initial flush: ${n.length} -> ${r.length} (cap=${t})`),w(`tengu_bridge_repl_history_capped`,{eligible_count:n.length,capped_count:r.length}));let i=h(r);if(i.length>0){S(`[bridge:repl] Flushing ${i.length} initial message(s) via transport`);let t=i.map(e=>({...e,session_id:z})),n=e.droppedBatchCount;e.writeBatch(t).then(()=>{if(e.droppedBatchCount>n){S(`[bridge:repl] Initial flush dropped ${e.droppedBatchCount-n} batch(es) — not marking ${i.length} UUID(s) as flushed`);return}if(x)for(let e of i)e.uuid&&x.add(e.uuid)}).catch(e=>S(`[bridge:repl] Initial flush failed: ${e}`)).finally(()=>{H===e&&(ke(),k?.(`connected`))})}else ke(),k?.(`connected`)}else Y.active||k?.(`connected`)}}),e.setOnData(e=>{try{let t=JSON.parse(e);be(`ingress: type=${t.type}${t.type===`control_request`?` subtype=${t.request?.subtype} request_id=${t.request_id}`:``}${t.type===`control_response`?` subtype=${t.response?.subtype} request_id=${t.response?.request_id}`:``}${t.type===`user`?` uuid=${t.uuid}`:``}${t.type===`keep_alive`?``:` len=${e.length}`}`)}catch{be(`ingress (non-JSON): ${String(e).slice(0,200)}`)}tt(e,B,_e,ee,E,u)}),$=Me,e.setOnClose(t=>{H===e&&(be(`transport onClose: code=${t} connected=${e.isConnectedStatus()} state=${e.getStateLabel()} seq=${e.getLastSequenceNum()}`),Me(t))}),!d&&b&&b.length>0&&Y.start(),e.connect()};if(U++,o){let n=ze(c,e),r=U;S(`[bridge:repl] CCR v2: sessionUrl=${n} session=${e} gen=${r}`),at({sessionUrl:n,ingressToken:t,sessionId:e,initialSequenceNum:W}).then(e=>{if(V.signal.aborted){e.close();return}if(r!==U){S(`[bridge:repl] CCR v2: discarding stale handshake gen=${r} current=${U}`),e.close();return}f(e)},e=>{S(`[bridge:repl] CCR v2: createV2ReplTransport failed: ${C(e)}`,{level:`error`}),w(`tengu_bridge_repl_ccr_v2_init_failed`,{}),r===U&&(G&&(P.stopWork(I,G,!1).catch(e=>{S(`[bridge:repl] stopWork after v2 init failure: ${C(e)}`)}),G=null,K=null),J())})}else{let t=Le(l,e);S(`[bridge:repl] Ingress URL: ${t}`),S(`[bridge:repl] Creating HybridTransport: session=${e}`);let n=s??``;f(it(new rt(new URL(t),{Authorization:`Bearer ${n}`,"anthropic-version":`2023-06-01`},e,()=>({Authorization:`Bearer ${Oe()??n}`,"anthropic-version":`2023-06-01`}),{maxConsecutiveFailures:50,isBridge:!0,onBatchDropped:()=>{k?.(`reconnecting`,`Lost sync with Remote Control — events could not be delivered`),J()}})))}}});let Re=j?setInterval(()=>{Z||M(n,{sessionId:z,environmentId:I,source:`repl`})},60*6e4):null;Re?.unref?.();let Be=_().session_keepalive_interval_v2_ms,Ve=Be>0?setInterval(()=>{H&&(S(`[bridge:repl] keep_alive sent`),H.write({type:`keep_alive`}).catch(e=>{S(`[bridge:repl] keep_alive write failed: ${C(e)}`)}))},Be):null;Ve?.unref?.();let He=!1;Ae=async()=>{if(He){S(`[bridge:repl] Teardown already in progress, skipping duplicate call env=${I} session=${z}`);return}He=!0;let e=Date.now();if(S(`[bridge:repl] Teardown starting: env=${I} session=${z} workId=${G??`none`} transportState=${H?.getStateLabel()??`null`}`),Re!==null&&clearInterval(Re),Ve!==null&&clearInterval(Ve),Ne&&process.off(`SIGUSR2`,Ne),process.env.USER_TYPE===`ant`&&(de(),$=null),V.abort(),S(`[bridge:repl] Teardown: poll loop aborted`),H){let e=H.getLastSequenceNum();e>W&&(W=e)}if(j){H=null,Y.drop(),await M(n,{sessionId:z,environmentId:I,source:`repl`}),S(`[bridge:repl] Teardown (perpetual): leaving env=${I} session=${z} alive on server, duration=${Date.now()-e}ms`);return}let t=H;if(H=null,Y.drop(),t){let e={...et(z),session_id:z};t.write(e)}let r=G?P.stopWork(I,G,!0).then(()=>{S(`[bridge:repl] Teardown: stopWork completed`)}).catch(e=>{S(`[bridge:repl] Teardown stopWork failed: ${C(e)}`)}):Promise.resolve();await Promise.all([r,p(z)]),t?.close(),S(`[bridge:repl] Teardown: transport closed`),await P.deregisterEnvironment(I).catch(e=>{S(`[bridge:repl] Teardown deregister failed: ${C(e)}`)}),await se(n),S(`[bridge:repl] Teardown complete: env=${I} duration=${Date.now()-e}ms`)};let Ue=v(()=>Ae?.());return S(`[bridge:repl] Ready: env=${I} session=${z}`),k?.(`ready`),{get bridgeSessionId(){return z},get environmentId(){return I},getSSESequenceNum(){let e=H?.getLastSequenceNum()??0;return Math.max(W,e)},sessionIngressUrl:l,writeMessages(e){let t=e.filter(e=>Ze(e)&&!ge.has(e.uuid)&&!B.has(e.uuid));if(t.length===0)return;if(!Ee)for(let e of t){let t=$e(e);if(t!==void 0&&A?.(t,z)){Ee=!0;break}}if(Y.enqueue(...t)){S(`[bridge:repl] Queued ${t.length} message(s) during initial flush`);return}if(!H){let e=t.map(e=>e.type).join(`,`);S(`[bridge:repl] Transport not configured, dropping ${t.length} message(s) [${e}] for session=${z}`,{level:`warn`});return}for(let e of t)B.add(e.uuid);S(`[bridge:repl] Sending ${t.length} message(s) via transport`);let n=h(t).map(e=>({...e,session_id:z}));H.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!B.has(e.uuid));if(t.length===0)return;if(!H){S(`[bridge:repl] Transport not configured, dropping ${t.length} SDK message(s) for session=${z}`,{level:`warn`});return}for(let e of t)e.uuid&&B.add(e.uuid);let n=t.map(e=>({...e,session_id:z}));H.writeBatch(n)},sendControlRequest(e){if(!H){S(`[bridge:repl] Transport not configured, skipping control_request`);return}let t={...e,session_id:z};H.write(t),S(`[bridge:repl] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(!H){S(`[bridge:repl] Transport not configured, skipping control_response`);return}let t={...e,session_id:z};H.write(t),S(`[bridge:repl] Sent control_response`)},sendControlCancelRequest(e){if(!H){S(`[bridge:repl] Transport not configured, skipping control_cancel_request`);return}let t={type:`control_cancel_request`,request_id:e,session_id:z};H.write(t),S(`[bridge:repl] Sent control_cancel_request request_id=${e}`)},sendResult(){if(!H){S(`[bridge:repl] sendResult: skipping, transport not configured session=${z}`);return}H.reportState(`idle`);let e={...et(z),session_id:z};H.write(e),S(`[bridge:repl] Sent result for session=${z}`)},async teardown(){Ue(),await Ae?.(),S(`[bridge:repl] Torn down`),w(`tengu_bridge_repl_teardown`,{})}}}async function mt({api:e,getCredentials:t,signal:n,onStateChange:r,onWorkReceived:i,onEnvironmentLost:a,getWsState:o,isAtCapacity:s,capacitySignal:c,onFatalError:l,getPollIntervalConfig:u=()=>Fe,getHeartbeatInfo:d,onHeartbeatFatal:f}){S(`[bridge:repl] Starting work poll loop for env=${t().environmentId}`);let p=0,m=null,h=null,g=0,_=!1;for(;!n.aborted;){let{environmentId:v,environmentSecret:y}=t(),b=u();try{let t=await e.pollForWork(v,y,n,b.reclaim_older_than_ms);if(g=0,p>0&&(S(`[bridge:repl] Poll recovered after ${p} consecutive error(s)`),p=0,m=null,h=null,r?.(`ready`)),!t){let t=_;if(_=!1,s?.()&&c&&!t){let t=b.poll_interval_ms_at_capacity;if(b.non_exclusive_heartbeat_interval_ms>0&&d){w(`tengu_bridge_heartbeat_mode_entered`,{heartbeat_interval_ms:b.non_exclusive_heartbeat_interval_ms});let r=t>0?Date.now()+t:null,i=!1,a=0;for(;!n.aborted&&s()&&(r===null||Date.now()<r);){let t=u();if(t.non_exclusive_heartbeat_interval_ms<=0)break;let n=d();if(!n)break;let r=c();try{await e.heartbeatWork(n.environmentId,n.workId,n.sessionToken)}catch(e){if(S(`[bridge:repl:heartbeat] Failed: ${C(e)}`),e instanceof N){r.cleanup(),w(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),f?(f(e),S(`[bridge:repl:heartbeat] Fatal (status=${e.status}), work state cleared — fast-polling for re-dispatch`)):i=!0;break}}a++,await A(t.non_exclusive_heartbeat_interval_ms,r.signal),r.cleanup()}let o=i?`error`:n.aborted?`shutdown`:s()?r!==null&&Date.now()>=r?`poll_due`:`config_disabled`:`capacity_changed`;if(w(`tengu_bridge_heartbeat_mode_exited`,{reason:o,heartbeat_cycles:a}),!i){o===`poll_due`&&S(`[bridge:repl] Heartbeat poll_due after ${a} cycles — falling through to pollForWork`);continue}}let r=t>0?t:b.non_exclusive_heartbeat_interval_ms;if(r>0){let e=c(),t=Date.now();await A(r,e.signal),e.cleanup();let n=Date.now()-t-r;n>6e4&&(S(`[bridge:repl] At-capacity sleep overran by ${Math.round(n/1e3)}s — process suspension detected, forcing one fast-poll cycle`),w(`tengu_bridge_repl_suspension_detected`,{overrun_ms:n}),_=!0)}}else await A(b.poll_interval_ms_not_at_capacity,n);continue}let a;try{a=Re(t.secret)}catch(n){S(`[bridge:repl] Failed to decode work secret: ${C(n)}`),w(`tengu_bridge_repl_work_secret_failed`,{}),await e.stopWork(v,t.id,!1).catch(()=>{});continue}S(`[bridge:repl] Acknowledging workId=${t.id}`);try{await e.acknowledgeWork(v,t.id,a.session_ingress_token)}catch(e){S(`[bridge:repl] Acknowledge failed workId=${t.id}: ${C(e)}`)}if(t.data.type===`healthcheck`){S(`[bridge:repl] Healthcheck received`);continue}if(t.data.type===`session`){let e=t.data.id;try{F(e,`session_id`)}catch{S(`[bridge:repl] Invalid session_id in work: ${e}`);continue}i(e,a.session_ingress_token,t.id,a.use_code_sessions===!0),S(`[bridge:repl] Work accepted, continuing poll loop`)}}catch(i){if(n.aborted)break;if(i instanceof N&&i.status===404&&a){let e=t().environmentId;if(v!==e){S(`[bridge:repl] Stale poll error for old env=${v}, current env=${e} — skipping onEnvironmentLost`),p=0,m=null;continue}if(g++,S(`[bridge:repl] Environment deleted, attempting re-registration (attempt ${g}/3)`),w(`tengu_bridge_repl_env_lost`,{attempt:g}),g>3){S(`[bridge:repl] Environment re-registration limit reached (3), giving up`),r?.(`failed`,`Environment deleted and re-registration limit reached`),l?.();break}r?.(`reconnecting`,`environment lost, recreating session`);let i=await a();if(n.aborted)break;if(i){p=0,m=null,r?.(`ready`),S(`[bridge:repl] Re-registered environment: ${i.environmentId}`);continue}r?.(`failed`,`Environment deleted and re-registration failed`),l?.();break}if(i instanceof N){let e=M(i.errorType),t=ce(i);S(`[bridge:repl] Fatal poll error: ${i.message} (status=${i.status}, type=${i.errorType??`unknown`})${t?` (suppressed)`:``}`),w(`tengu_bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),T(e?`info`:`error`,`bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),t||r?.(`failed`,e?`session expired · /remote-control to reconnect`:i.message),l?.();break}let s=Date.now();h!==null&&s-h>6e4*2&&(S(`[bridge:repl] Detected system sleep (${Math.round((s-h)/1e3)}s gap), resetting poll error budget`),T(`info`,`bridge_repl_poll_sleep_detected`,{gapMs:s-h}),p=0,m=null),h=s,p++,m===null&&(m=s);let c=s-m,f=W(i),_=Ce(i),y=o?.()??`unknown`;if(S(`[bridge:repl] Poll error (attempt ${p}, elapsed ${Math.round(c/1e3)}s, ws=${y}): ${_}`),w(`tengu_bridge_repl_poll_error`,{status:f,consecutiveErrors:p,elapsedMs:c}),p===1&&r?.(`reconnecting`,_),c>=9e5){S(`[bridge:repl] Poll failures exceeded ${dt/1e3}s (${p} errors), giving up`),T(`info`,`bridge_repl_poll_give_up`),w(`tengu_bridge_repl_poll_give_up`,{consecutiveErrors:p,elapsedMs:c,lastStatus:f}),r?.(`failed`,`connection to server lost`);break}let b=Math.min(lt*2**(p-1),ut);if(u().non_exclusive_heartbeat_interval_ms>0){let t=d?.();if(t)try{await e.heartbeatWork(t.environmentId,t.workId,t.sessionToken)}catch{}}await A(b,n)}}S(`[bridge:repl] Work poll loop ended (aborted=${n.aborted}) env=${t().environmentId}`)}x(),y(),K(),G();async function ht(t){let{onInboundMessage:n,onPermissionResponse:r,onInterrupt:a,onSetModel:u,onSetMaxThinkingTokens:m,onSetPermissionMode:h,onStateChange:_,initialMessages:v,getMessages:y,previouslyFlushedUUIDs:b,initialName:x,perpetual:ee,outboundOnly:w,tags:T}=t??{};if(J(Oe),!await De())return q(`not_enabled`,`[bridge:repl] Skipping: bridge not enabled`),null;if(!Q())return q(`no_oauth`,`[bridge:repl] Skipping: no OAuth tokens`),_?.(`failed`,`/login`),null;if(await P(),!se(`allow_remote_control`))return q(`policy_denied`,`[bridge:repl] Skipping: allow_remote_control policy not allowed`),_?.(`failed`,`disabled by your organization's policy`),null;if(!Ee()){let e=d();if(e.bridgeOauthDeadExpiresAt!=null&&(e.bridgeOauthDeadFailCount??0)>=3&&c()?.expiresAt===e.bridgeOauthDeadExpiresAt)return S(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${e.bridgeOauthDeadFailCount} times)`),null;await l();let t=c();if(t&&t.expiresAt!==null&&t.expiresAt<=Date.now()){q(`oauth_expired_unrefreshable`,`[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)`),_?.(`failed`,`/login`);let e=t.expiresAt;return s(t=>({...t,bridgeOauthDeadExpiresAt:e,bridgeOauthDeadFailCount:t.bridgeOauthDeadExpiresAt===e?(t.bridgeOauthDeadFailCount??0)+1:1})),null}}let E=X(),D=`remote-control-${me()}`,O=!1,k=!1;if(x)D=x,O=!0,k=!0;else{let e=i(),t=e?R(e):void 0;if(t)D=t,O=!0,k=!0;else if(v&&v.length>0)for(let e=v.length-1;e>=0;e--){let t=v[e];if(t.type!==`user`||t.isMeta||t.toolUseResult||t.isCompactSummary||t.origin&&t.origin.kind!==`human`||ge(t))continue;let n=ue(t.message.content);if(!n)continue;let r=_t(n);if(r){D=r,O=!0;break}}}let A=0,j,re=0,ie=(e,t,n)=>{O=!0,D=e,S(`[bridge:repl] derived title from message ${n}: ${e}`),Be(t,e,{baseUrl:E,getAccessToken:Q}).catch(()=>{})},ae=(e,t)=>{let n=++re,r=A;Je(e,AbortSignal.timeout(15e3)).then(e=>{e&&n===re&&j===t&&!R(i())&&ie(e,t,r)})},oe=(e,t)=>{if(k||R(i()))return!0;if(j!==void 0&&j!==t&&(A=0),j=t,A++,A===1&&!O){let n=_t(e);n&&ie(n,t,A),ae(e,t)}else if(A===3){let n=y?.();ae(n?Xe(pe(n)):e,t)}return A>=3},M=g(`tengu_bridge_initial_history_cap`,200,300*1e3),ce=Z()?`self-hosted`:await f();if(!ce)return q(`no_org_uuid`,`[bridge:repl] Skipping: no org UUID`),_?.(`failed`,`/login`),null;if(Ae()&&!ee){let e=await Ge();if(e)return q(`version_too_old`,`[bridge:repl] Skipping: ${e}`,!0),_?.(`failed`,"run `claude update` to upgrade"),null;S(`[bridge:repl] Using env-less bridge path (tengu_bridge_repl_v2)`);let{initEnvLessBridgeCore:t}=await import(`./remoteBridgeCore-C3WRaLpU.js`);return t({baseUrl:E,orgUUID:ce,title:D,getAccessToken:Q,onAuth401:p,toSDKMessages:qe,initialHistoryCap:M,initialMessages:v,onInboundMessage:n,onUserMessage:oe,onPermissionResponse:r,onInterrupt:a,onSetModel:u,onSetMaxThinkingTokens:m,onSetPermissionMode:h,onStateChange:_,outboundOnly:w,tags:T})}let le=je();if(le)return q(`version_too_old`,`[bridge:repl] Skipping: ${le}`),_?.(`failed`,"run `claude update` to upgrade"),null;let N=await te(),de=await ne(),fe=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||E,F=`claude_code`;{let{isAssistantMode:t}=(Me(),e(Ne));t()&&(F=`claude_code_assistant`)}return pt({dir:o(),machineName:st(),branch:N,gitRepoUrl:de,title:D,baseUrl:E,sessionIngressUrl:fe,workerType:F,getAccessToken:Q,createSession:e=>He({...e,events:[],baseUrl:E,getAccessToken:Q}),archiveSession:e=>Ue(e,{baseUrl:E,getAccessToken:Q,timeoutMs:1500}).catch(e=>{S(`[bridge:repl] archiveBridgeSession threw: ${C(e)}`,{level:`error`})}),getCurrentTitle:()=>R(i())??D,onUserMessage:oe,toSDKMessages:qe,onAuth401:p,getPollIntervalConfig:$,initialHistoryCap:M,initialMessages:v,previouslyFlushedUUIDs:b,onInboundMessage:n,onPermissionResponse:r,onInterrupt:a,onSetModel:u,onSetMaxThinkingTokens:m,onSetPermissionMode:h,onStateChange:_,perpetual:ee})}var gt=50;function _t(e){let t=O(e),n=(/^(.*?[.!?])\s/.exec(t)?.[1]??t).replace(/\s+/g,` `).trim();if(n)return n.length>gt?n.slice(0,gt-1)+`…`:n}export{ht as initReplBridge};
|
|
1
|
+
import{a as e}from"./chunk-DR8-3Aex.js";import{d as t,s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,cn as a,ot as o}from"./state-sIHsFpDu.js";import{Cc as s,Jt as c,Pt as l,S as u,dc as d,la as f,nn as p,on as m,ua as h,v as g,yc as _}from"./paths-CEAy4QCs.js";import{Q as v,U as y,Z as b,l as x,p as S,z as C}from"./debug-otxXY3j-.js";import{n as ee,r as w}from"./analytics-DqMQntaB.js";import{F as T,P as E,i as te,m as ne,v as D}from"./git-C0IuvuIy.js";import{g as O,m as k}from"./log-DSV4Ht5l.js";import{n as A,t as j}from"./sleep-C6koP5Ka.js";import{Aa as re,Cd as ie,Fa as ae,Fr as oe,Ia as M,Ka as se,La as ce,Ma as le,Mo as ue,Na as N,Oa as de,Pa as fe,Po as pe,Qa as P,Ra as F,Uo as I,Wa as L,br as R,by as me,ja as he,ka as z,qo as ge,xy as B,yd as _e}from"./loadAgentsDir-DC4jN6-f.js";import{O as V,_ as ve,d as H,k as ye,n as be,t as U}from"./rcDebugLog-C0Bam8V9.js";import{a as W,c as G,d as xe,f as Se,o as K,r as Ce,s as q,u as J}from"./debugUtils-l8nsUZ6R.js";import{a as we,i as Te}from"./trustedDevice-DWb5CPB_.js";import{a as Y,i as Ee,n as X,o as Z,t as Q}from"./bridgeConfig-Di9LziJ3.js";import{a as De,o as Oe,r as ke,s as Ae,t as je}from"./bridgeEnabled-z1fPRzzV.js";import{i as Me,t as Ne}from"./assistant-C3dP-BSJ.js";import{t as Pe}from"./capacityWake-DtmDHwEt.js";import{n as Fe,t as $}from"./pollConfig-CyO4Ycwc.js";import{a as Ie,n as Le,r as Re,t as ze}from"./workSecret-DJu7k30X.js";import{a as Be,i as Ve,n as He,t as Ue}from"./createSession-Csaqw8kb.js";import{i as We,n as Ge}from"./envLessBridgeConfig-YNTOVEqU.js";import{n as Ke,o as qe}from"./mappers-Bg-xtimK.js";import{n as Je,r as Ye,t as Xe}from"./sessionTitle-1k_2BhFL.js";import{a as Ze,i as Qe,n as $e,o as et,r as tt,t as nt}from"./bridgeMessaging-BG8fNZac.js";import{t as rt}from"./HybridTransport-COk7jAC7.js";import{n as it,r as at,t as ot}from"./flushGate-CLjpgnG6.js";import{hostname as st}from"os";import{randomUUID as ct}from"crypto";a(),k(),D(),_(),h(),m(),u(),Y(),B(),ke(),I(),L(),oe(),Ve(),We(),Ke(),Ye(),ae(),x(),U(),E(),ee(),b(),G(),_e(),we(),V(),H(),n(),K(),y(),j(),z();var lt=2e3,ut=6e4,dt=900*1e3,ft=0;async function pt(e){let{dir:n,machineName:i,branch:a,gitRepoUrl:o,title:s,baseUrl:c,sessionIngressUrl:l,workerType:u,getAccessToken:d,createSession:f,archiveSession:p,getCurrentTitle:m=()=>s,toSDKMessages:h=()=>{throw Error(`BridgeCoreParams.toSDKMessages not provided. Pass it if you use writeMessages() or initialMessages — daemon callers that only use writeSdkMessages() never hit this path.`)},onAuth401:g,getPollIntervalConfig:_=()=>Fe,initialHistoryCap:y=200,initialMessages:b,previouslyFlushedUUIDs:x,onInboundMessage:ee,onPermissionResponse:E,onInterrupt:te,onSetModel:ne,onSetMaxThinkingTokens:D,onSetPermissionMode:O,onStateChange:k,onUserMessage:A,perpetual:j,initialSSESequenceNum:ae=0}=e,oe=++ft,{writeBridgePointer:M,clearBridgePointer:se,readBridgePointer:ce}=await import(`./bridgePointer-Clcvh52n.js`),ue=j?await ce(n):null,N=ue?.source===`repl`?ue:null;S(`[bridge:repl] initBridgeCore #${oe} starting (initialMessages=${b?.length??0}${N?` perpetual prior=env:${N.environmentId}`:``})`);let pe=fe({baseUrl:c,getAccessToken:d,runnerVersion:`2.8.2`,onDebug:S,onAuth401:g,getTrustedDeviceToken:Te}),P=process.env.USER_TYPE===`ant`?le(pe):pe,F={dir:n,machineName:i,branch:a,gitRepoUrl:o,maxSessions:1,spawnMode:`single-session`,verbose:!1,sandbox:!1,bridgeId:ct(),workerType:u,environmentId:ct(),reuseEnvironmentId:N?.environmentId,apiBaseUrl:c,sessionIngressUrl:l},I,L;try{let e=await P.registerBridgeEnvironment(F);I=e.environment_id,L=e.environment_secret}catch(e){return q(`registration_failed`,`[bridge:repl] Environment registration failed: ${C(e)}`),N&&await se(n),k?.(`failed`,C(e)),null}S(`[bridge:repl] Environment registered: ${I}`),T(`info`,`bridge_repl_env_registered`),w(`tengu_bridge_repl_env_registered`,{});async function R(e,t){if(I!==e)return S(`[bridge:repl] Env mismatch (requested ${e}, got ${I}) — cannot reconnect in place`),!1;let n=Se(t),r=n===t?[t]:[t,n];for(let e of r)try{return await P.reconnectSession(I,e),S(`[bridge:repl] Reconnected session ${e} in place on env ${I}`),!0}catch(t){S(`[bridge:repl] reconnectSession(${e}) failed: ${C(t)}`)}return S(`[bridge:repl] reconnectSession exhausted — falling through to fresh session`),!1}let me=N?await R(N.environmentId,N.sessionId):!1;N&&!me&&await se(n);let z;if(me&&N){if(z=N.sessionId,S(`[bridge:repl] Perpetual session reused: ${z}`),b&&x)for(let e of b)x.add(e.uuid)}else{let e=await f({environmentId:I,title:s,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});if(!e)return S(`[bridge:repl] Session creation failed, deregistering environment`),w(`tengu_bridge_repl_session_failed`,{}),await P.deregisterEnvironment(I).catch(()=>{}),k?.(`failed`,`Session creation failed`),null;z=e,S(`[bridge:repl] Session created: ${z}`)}await M(n,{sessionId:z,environmentId:I,source:`repl`}),T(`info`,`bridge_repl_session_created`),w(`tengu_bridge_repl_started`,{has_initial_messages:!!(b&&b.length>0),inProtectedNamespace:t()});let ge=new Set;if(b)for(let e of b)ge.add(e.uuid);let B=new nt(2e3);for(let e of ge)B.add(e);let _e=new nt(2e3),V=new AbortController,H=null;ve(e=>{V.signal.aborted||H?.reportMetadata(e)},{replayCurrent:!0});let U=0,W=me?ae:0,G=null,K=null,Ce=Pe(V.signal),J=Ce.wake,we=Ce.signal,Y=new ot,Ee=!A,X=0,Z=null;async function Q(){if(Z)return Z;Z=De();try{return await Z}finally{Z=null}}async function De(){if(X++,be(`doReconnect: attempt=${X}/3 envId=${I} sessionId=${z} workId=${G}`),U++,S(`[bridge:repl] Reconnecting after env lost (attempt ${X}/3)`),X>3)return S(`[bridge:repl] Environment reconnect limit reached (3), giving up`),!1;if(H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}if(J(),Y.drop(),G){let e=G;if(await P.stopWork(I,e,!1).catch(()=>{}),G!==e)return S(`[bridge:repl] Poll loop recovered during stopWork await — deferring to it`),X=0,!0;G=null,K=null}if(V.signal.aborted)return S(`[bridge:repl] Reconnect aborted by teardown`),!1;let e=I;F.reuseEnvironmentId=e;try{let e=await P.registerBridgeEnvironment(F);I=e.environment_id,L=e.environment_secret}catch(e){return F.reuseEnvironmentId=void 0,S(`[bridge:repl] Environment re-registration failed: ${C(e)}`),!1}if(F.reuseEnvironmentId=void 0,S(`[bridge:repl] Re-registered: requested=${e} got=${I}`),V.signal.aborted)return S(`[bridge:repl] Reconnect aborted after env registration, cleaning up`),await P.deregisterEnvironment(I).catch(()=>{}),!1;if(H!==null)return S(`[bridge:repl] Poll loop recovered during registerBridgeEnvironment await — deferring to it`),X=0,!0;if(await R(e,z))return w(`tengu_bridge_repl_reconnected_in_place`,{}),X=0,!0;if(I!==e&&w(`tengu_bridge_repl_env_expired_fresh_session`,{}),await p(z),V.signal.aborted)return S(`[bridge:repl] Reconnect aborted after archive, cleaning up`),await P.deregisterEnvironment(I).catch(()=>{}),!1;let t=m(),r=await f({environmentId:I,title:t,gitRepoUrl:o,branch:a,signal:AbortSignal.timeout(15e3)});return r?V.signal.aborted?(S(`[bridge:repl] Reconnect aborted after session creation, cleaning up`),await p(r),!1):(z=r,ie(xe(r)).catch(()=>{}),W=0,_e.clear(),Ee=!A,S(`[bridge:repl] Re-created session: ${z}`),await M(n,{sessionId:z,environmentId:I,source:`repl`}),x?.clear(),X=0,!0):(S(`[bridge:repl] Session creation failed during reconnection`),!1)}function Oe(){return d()}function ke(){let e=Y.end();if(e.length===0)return;if(!H){S(`[bridge:repl] Cannot drain ${e.length} pending message(s): no transport`);return}for(let t of e)B.add(t.uuid);let t=h(e).map(e=>({...e,session_id:z}));S(`[bridge:repl] Drained ${e.length} pending message(s) after flush`),H.writeBatch(t)}let Ae=null;function je(){Ae?.()}function Me(e){if(be(`handleTransportPermanentClose: code=${e} transport=${H?`exists`:`null`} pollAborted=${V.signal.aborted}`),S(`[bridge:repl] Transport permanently closed: code=${e}`),w(`tengu_bridge_repl_ws_closed`,{code:e}),H){let e=H.getLastSequenceNum();e>W&&(W=e),H=null}J();let t=Y.drop();if(t>0&&S(`[bridge:repl] Dropping ${t} pending message(s) on transport close (code=${e})`,{level:`warn`}),e===1e3){k?.(`failed`,`session ended`),V.abort(),je();return}k?.(`reconnecting`,`Remote Control connection lost (code ${e})`),S(`[bridge:repl] Transport reconnect budget exhausted (code=${e}), attempting env reconnect`),Q().then(t=>{t||V.signal.aborted||(S(`[bridge:repl] reconnectEnvironmentWithSession resolved false — tearing down`),w(`tengu_bridge_repl_reconnect_failed`,{close_code:e}),k?.(`failed`,`reconnection failed`),je())})}let Ne;process.env.USER_TYPE===`ant`&&process.platform!==`win32`&&(Ne=()=>{S(`[bridge:repl] SIGUSR2 received — forcing doReconnect() for testing`),Q()},process.on(`SIGUSR2`,Ne));let $=null;process.env.USER_TYPE===`ant`&&he({fireClose:e=>{if(!$){S(`[bridge:debug] fireClose: no transport wired yet`);return}S(`[bridge:debug] fireClose(${e}) — injecting`),$(e)},forceReconnect:()=>{S(`[bridge:debug] forceReconnect — injecting`),Q()},injectFault:re,wakePollLoop:J,describe:()=>`env=${I} session=${z} transport=${H?.getStateLabel()??`null`} workId=${G??`null`}`}),mt({api:P,getCredentials:()=>({environmentId:I,environmentSecret:L}),signal:V.signal,getPollIntervalConfig:_,onStateChange:k,getWsState:()=>H?.getStateLabel()??`null`,isAtCapacity:()=>H!==null,capacitySignal:we,onFatalError:je,getHeartbeatInfo:()=>!G||!K?null:{environmentId:I,workId:G,sessionToken:K},onHeartbeatFatal:e=>{if(S(`[bridge:repl] heartbeatWork fatal (status=${e.status}) — tearing down work item for fast re-dispatch`),H){let e=H.getLastSequenceNum();e>W&&(W=e),H.close(),H=null}Y.drop(),G&&P.stopWork(I,G,!1).catch(e=>{S(`[bridge:repl] stopWork after heartbeat fatal: ${C(e)}`)}),G=null,K=null,J(),k?.(`reconnecting`,`Work item lease expired, fetching fresh token`)},async onEnvironmentLost(){return await Q()?{environmentId:I,environmentSecret:L}:null},onWorkReceived:(e,t,i,a)=>{if(H?.isConnectedStatus()&&S(`[bridge:repl] Work received while transport connected, replacing with fresh token (workId=${i})`),S(`[bridge:repl] Work received: workId=${i} workSessionId=${e} currentSessionId=${z} match=${Ie(e,z)}`),M(n,{sessionId:z,environmentId:I,source:`repl`}),!Ie(e,z)){S(`[bridge:repl] Rejecting foreign session: expected=${z} got=${e}`);return}G=i,K=t;let o=a||r(process.env.CLAUDE_BRIDGE_USE_CCR_V2),s;if(!o){if(s=Oe(),!s){S(`[bridge:repl] No OAuth token available for session ingress, skipping work`);return}ye(s)}if(w(`tengu_bridge_repl_work_received`,{}),H){let e=H;H=null;let t=e.getLastSequenceNum();t>W&&(W=t),e.close()}Y.deactivate();let u=e=>Qe(e,{transport:H,sessionId:z,onInterrupt:te,onSetModel:ne,onSetMaxThinkingTokens:D,onSetPermissionMode:O}),d=!1,f=e=>{H=e,e.setOnConnect(()=>{if(H===e){if(S(`[bridge:repl] Ingress transport connected`),w(`tengu_bridge_repl_ws_connected`,{}),!o){let e=Oe();e&&ye(e)}if(He=!1,!d&&b&&b.length>0){d=!0;let t=y,n=b.filter(e=>Ze(e)&&!x?.has(e.uuid)),r=t>0&&n.length>t?n.slice(-t):n;r.length<n.length&&(S(`[bridge:repl] Capped initial flush: ${n.length} -> ${r.length} (cap=${t})`),w(`tengu_bridge_repl_history_capped`,{eligible_count:n.length,capped_count:r.length}));let i=h(r);if(i.length>0){S(`[bridge:repl] Flushing ${i.length} initial message(s) via transport`);let t=i.map(e=>({...e,session_id:z})),n=e.droppedBatchCount;e.writeBatch(t).then(()=>{if(e.droppedBatchCount>n){S(`[bridge:repl] Initial flush dropped ${e.droppedBatchCount-n} batch(es) — not marking ${i.length} UUID(s) as flushed`);return}if(x)for(let e of i)e.uuid&&x.add(e.uuid)}).catch(e=>S(`[bridge:repl] Initial flush failed: ${e}`)).finally(()=>{H===e&&(ke(),k?.(`connected`))})}else ke(),k?.(`connected`)}else Y.active||k?.(`connected`)}}),e.setOnData(e=>{try{let t=JSON.parse(e);be(`ingress: type=${t.type}${t.type===`control_request`?` subtype=${t.request?.subtype} request_id=${t.request_id}`:``}${t.type===`control_response`?` subtype=${t.response?.subtype} request_id=${t.response?.request_id}`:``}${t.type===`user`?` uuid=${t.uuid}`:``}${t.type===`keep_alive`?``:` len=${e.length}`}`)}catch{be(`ingress (non-JSON): ${String(e).slice(0,200)}`)}tt(e,B,_e,ee,E,u)}),$=Me,e.setOnClose(t=>{H===e&&(be(`transport onClose: code=${t} connected=${e.isConnectedStatus()} state=${e.getStateLabel()} seq=${e.getLastSequenceNum()}`),Me(t))}),!d&&b&&b.length>0&&Y.start(),e.connect()};if(U++,o){let n=ze(c,e),r=U;S(`[bridge:repl] CCR v2: sessionUrl=${n} session=${e} gen=${r}`),at({sessionUrl:n,ingressToken:t,sessionId:e,initialSequenceNum:W}).then(e=>{if(V.signal.aborted){e.close();return}if(r!==U){S(`[bridge:repl] CCR v2: discarding stale handshake gen=${r} current=${U}`),e.close();return}f(e)},e=>{S(`[bridge:repl] CCR v2: createV2ReplTransport failed: ${C(e)}`,{level:`error`}),w(`tengu_bridge_repl_ccr_v2_init_failed`,{}),r===U&&(G&&(P.stopWork(I,G,!1).catch(e=>{S(`[bridge:repl] stopWork after v2 init failure: ${C(e)}`)}),G=null,K=null),J())})}else{let t=Le(l,e);S(`[bridge:repl] Ingress URL: ${t}`),S(`[bridge:repl] Creating HybridTransport: session=${e}`);let n=s??``;f(it(new rt(new URL(t),{Authorization:`Bearer ${n}`,"anthropic-version":`2023-06-01`},e,()=>({Authorization:`Bearer ${Oe()??n}`,"anthropic-version":`2023-06-01`}),{maxConsecutiveFailures:50,isBridge:!0,onBatchDropped:()=>{k?.(`reconnecting`,`Lost sync with Remote Control — events could not be delivered`),J()}})))}}});let Re=j?setInterval(()=>{Z||M(n,{sessionId:z,environmentId:I,source:`repl`})},60*6e4):null;Re?.unref?.();let Be=_().session_keepalive_interval_v2_ms,Ve=Be>0?setInterval(()=>{H&&(S(`[bridge:repl] keep_alive sent`),H.write({type:`keep_alive`}).catch(e=>{S(`[bridge:repl] keep_alive write failed: ${C(e)}`)}))},Be):null;Ve?.unref?.();let He=!1;Ae=async()=>{if(He){S(`[bridge:repl] Teardown already in progress, skipping duplicate call env=${I} session=${z}`);return}He=!0;let e=Date.now();if(S(`[bridge:repl] Teardown starting: env=${I} session=${z} workId=${G??`none`} transportState=${H?.getStateLabel()??`null`}`),Re!==null&&clearInterval(Re),Ve!==null&&clearInterval(Ve),Ne&&process.off(`SIGUSR2`,Ne),process.env.USER_TYPE===`ant`&&(de(),$=null),V.abort(),S(`[bridge:repl] Teardown: poll loop aborted`),H){let e=H.getLastSequenceNum();e>W&&(W=e)}if(j){H=null,Y.drop(),await M(n,{sessionId:z,environmentId:I,source:`repl`}),S(`[bridge:repl] Teardown (perpetual): leaving env=${I} session=${z} alive on server, duration=${Date.now()-e}ms`);return}let t=H;if(H=null,Y.drop(),t){let e={...et(z),session_id:z};t.write(e)}let r=G?P.stopWork(I,G,!0).then(()=>{S(`[bridge:repl] Teardown: stopWork completed`)}).catch(e=>{S(`[bridge:repl] Teardown stopWork failed: ${C(e)}`)}):Promise.resolve();await Promise.all([r,p(z)]),t?.close(),S(`[bridge:repl] Teardown: transport closed`),await P.deregisterEnvironment(I).catch(e=>{S(`[bridge:repl] Teardown deregister failed: ${C(e)}`)}),await se(n),S(`[bridge:repl] Teardown complete: env=${I} duration=${Date.now()-e}ms`)};let Ue=v(()=>Ae?.());return S(`[bridge:repl] Ready: env=${I} session=${z}`),k?.(`ready`),{get bridgeSessionId(){return z},get environmentId(){return I},getSSESequenceNum(){let e=H?.getLastSequenceNum()??0;return Math.max(W,e)},sessionIngressUrl:l,writeMessages(e){let t=e.filter(e=>Ze(e)&&!ge.has(e.uuid)&&!B.has(e.uuid));if(t.length===0)return;if(!Ee)for(let e of t){let t=$e(e);if(t!==void 0&&A?.(t,z)){Ee=!0;break}}if(Y.enqueue(...t)){S(`[bridge:repl] Queued ${t.length} message(s) during initial flush`);return}if(!H){let e=t.map(e=>e.type).join(`,`);S(`[bridge:repl] Transport not configured, dropping ${t.length} message(s) [${e}] for session=${z}`,{level:`warn`});return}for(let e of t)B.add(e.uuid);S(`[bridge:repl] Sending ${t.length} message(s) via transport`);let n=h(t).map(e=>({...e,session_id:z}));H.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!B.has(e.uuid));if(t.length===0)return;if(!H){S(`[bridge:repl] Transport not configured, dropping ${t.length} SDK message(s) for session=${z}`,{level:`warn`});return}for(let e of t)e.uuid&&B.add(e.uuid);let n=t.map(e=>({...e,session_id:z}));H.writeBatch(n)},sendControlRequest(e){if(!H){S(`[bridge:repl] Transport not configured, skipping control_request`);return}let t={...e,session_id:z};H.write(t),S(`[bridge:repl] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(!H){S(`[bridge:repl] Transport not configured, skipping control_response`);return}let t={...e,session_id:z};H.write(t),S(`[bridge:repl] Sent control_response`)},sendControlCancelRequest(e){if(!H){S(`[bridge:repl] Transport not configured, skipping control_cancel_request`);return}let t={type:`control_cancel_request`,request_id:e,session_id:z};H.write(t),S(`[bridge:repl] Sent control_cancel_request request_id=${e}`)},sendResult(){if(!H){S(`[bridge:repl] sendResult: skipping, transport not configured session=${z}`);return}H.reportState(`idle`);let e={...et(z),session_id:z};H.write(e),S(`[bridge:repl] Sent result for session=${z}`)},async teardown(){Ue(),await Ae?.(),S(`[bridge:repl] Torn down`),w(`tengu_bridge_repl_teardown`,{})}}}async function mt({api:e,getCredentials:t,signal:n,onStateChange:r,onWorkReceived:i,onEnvironmentLost:a,getWsState:o,isAtCapacity:s,capacitySignal:c,onFatalError:l,getPollIntervalConfig:u=()=>Fe,getHeartbeatInfo:d,onHeartbeatFatal:f}){S(`[bridge:repl] Starting work poll loop for env=${t().environmentId}`);let p=0,m=null,h=null,g=0,_=!1;for(;!n.aborted;){let{environmentId:v,environmentSecret:y}=t(),b=u();try{let t=await e.pollForWork(v,y,n,b.reclaim_older_than_ms);if(g=0,p>0&&(S(`[bridge:repl] Poll recovered after ${p} consecutive error(s)`),p=0,m=null,h=null,r?.(`ready`)),!t){let t=_;if(_=!1,s?.()&&c&&!t){let t=b.poll_interval_ms_at_capacity;if(b.non_exclusive_heartbeat_interval_ms>0&&d){w(`tengu_bridge_heartbeat_mode_entered`,{heartbeat_interval_ms:b.non_exclusive_heartbeat_interval_ms});let r=t>0?Date.now()+t:null,i=!1,a=0;for(;!n.aborted&&s()&&(r===null||Date.now()<r);){let t=u();if(t.non_exclusive_heartbeat_interval_ms<=0)break;let n=d();if(!n)break;let r=c();try{await e.heartbeatWork(n.environmentId,n.workId,n.sessionToken)}catch(e){if(S(`[bridge:repl:heartbeat] Failed: ${C(e)}`),e instanceof N){r.cleanup(),w(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),f?(f(e),S(`[bridge:repl:heartbeat] Fatal (status=${e.status}), work state cleared — fast-polling for re-dispatch`)):i=!0;break}}a++,await A(t.non_exclusive_heartbeat_interval_ms,r.signal),r.cleanup()}let o=i?`error`:n.aborted?`shutdown`:s()?r!==null&&Date.now()>=r?`poll_due`:`config_disabled`:`capacity_changed`;if(w(`tengu_bridge_heartbeat_mode_exited`,{reason:o,heartbeat_cycles:a}),!i){o===`poll_due`&&S(`[bridge:repl] Heartbeat poll_due after ${a} cycles — falling through to pollForWork`);continue}}let r=t>0?t:b.non_exclusive_heartbeat_interval_ms;if(r>0){let e=c(),t=Date.now();await A(r,e.signal),e.cleanup();let n=Date.now()-t-r;n>6e4&&(S(`[bridge:repl] At-capacity sleep overran by ${Math.round(n/1e3)}s — process suspension detected, forcing one fast-poll cycle`),w(`tengu_bridge_repl_suspension_detected`,{overrun_ms:n}),_=!0)}}else await A(b.poll_interval_ms_not_at_capacity,n);continue}let a;try{a=Re(t.secret)}catch(n){S(`[bridge:repl] Failed to decode work secret: ${C(n)}`),w(`tengu_bridge_repl_work_secret_failed`,{}),await e.stopWork(v,t.id,!1).catch(()=>{});continue}S(`[bridge:repl] Acknowledging workId=${t.id}`);try{await e.acknowledgeWork(v,t.id,a.session_ingress_token)}catch(e){S(`[bridge:repl] Acknowledge failed workId=${t.id}: ${C(e)}`)}if(t.data.type===`healthcheck`){S(`[bridge:repl] Healthcheck received`);continue}if(t.data.type===`session`){let e=t.data.id;try{F(e,`session_id`)}catch{S(`[bridge:repl] Invalid session_id in work: ${e}`);continue}i(e,a.session_ingress_token,t.id,a.use_code_sessions===!0),S(`[bridge:repl] Work accepted, continuing poll loop`)}}catch(i){if(n.aborted)break;if(i instanceof N&&i.status===404&&a){let e=t().environmentId;if(v!==e){S(`[bridge:repl] Stale poll error for old env=${v}, current env=${e} — skipping onEnvironmentLost`),p=0,m=null;continue}if(g++,S(`[bridge:repl] Environment deleted, attempting re-registration (attempt ${g}/3)`),w(`tengu_bridge_repl_env_lost`,{attempt:g}),g>3){S(`[bridge:repl] Environment re-registration limit reached (3), giving up`),r?.(`failed`,`Environment deleted and re-registration limit reached`),l?.();break}r?.(`reconnecting`,`environment lost, recreating session`);let i=await a();if(n.aborted)break;if(i){p=0,m=null,r?.(`ready`),S(`[bridge:repl] Re-registered environment: ${i.environmentId}`);continue}r?.(`failed`,`Environment deleted and re-registration failed`),l?.();break}if(i instanceof N){let e=M(i.errorType),t=ce(i);S(`[bridge:repl] Fatal poll error: ${i.message} (status=${i.status}, type=${i.errorType??`unknown`})${t?` (suppressed)`:``}`),w(`tengu_bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),T(e?`info`:`error`,`bridge_repl_fatal_error`,{status:i.status,error_type:i.errorType}),t||r?.(`failed`,e?`session expired · /remote-control to reconnect`:i.message),l?.();break}let s=Date.now();h!==null&&s-h>6e4*2&&(S(`[bridge:repl] Detected system sleep (${Math.round((s-h)/1e3)}s gap), resetting poll error budget`),T(`info`,`bridge_repl_poll_sleep_detected`,{gapMs:s-h}),p=0,m=null),h=s,p++,m===null&&(m=s);let c=s-m,f=W(i),_=Ce(i),y=o?.()??`unknown`;if(S(`[bridge:repl] Poll error (attempt ${p}, elapsed ${Math.round(c/1e3)}s, ws=${y}): ${_}`),w(`tengu_bridge_repl_poll_error`,{status:f,consecutiveErrors:p,elapsedMs:c}),p===1&&r?.(`reconnecting`,_),c>=9e5){S(`[bridge:repl] Poll failures exceeded ${dt/1e3}s (${p} errors), giving up`),T(`info`,`bridge_repl_poll_give_up`),w(`tengu_bridge_repl_poll_give_up`,{consecutiveErrors:p,elapsedMs:c,lastStatus:f}),r?.(`failed`,`connection to server lost`);break}let b=Math.min(lt*2**(p-1),ut);if(u().non_exclusive_heartbeat_interval_ms>0){let t=d?.();if(t)try{await e.heartbeatWork(t.environmentId,t.workId,t.sessionToken)}catch{}}await A(b,n)}}S(`[bridge:repl] Work poll loop ended (aborted=${n.aborted}) env=${t().environmentId}`)}x(),y(),K(),G();async function ht(t){let{onInboundMessage:n,onPermissionResponse:r,onInterrupt:a,onSetModel:u,onSetMaxThinkingTokens:m,onSetPermissionMode:h,onStateChange:_,initialMessages:v,getMessages:y,previouslyFlushedUUIDs:b,initialName:x,perpetual:ee,outboundOnly:w,tags:T}=t??{};if(J(Oe),!await De())return q(`not_enabled`,`[bridge:repl] Skipping: bridge not enabled`),null;if(!Q())return q(`no_oauth`,`[bridge:repl] Skipping: no OAuth tokens`),_?.(`failed`,`/login`),null;if(await P(),!se(`allow_remote_control`))return q(`policy_denied`,`[bridge:repl] Skipping: allow_remote_control policy not allowed`),_?.(`failed`,`disabled by your organization's policy`),null;if(!Ee()){let e=d();if(e.bridgeOauthDeadExpiresAt!=null&&(e.bridgeOauthDeadFailCount??0)>=3&&c()?.expiresAt===e.bridgeOauthDeadExpiresAt)return S(`[bridge:repl] Skipping: cross-process backoff (dead token seen ${e.bridgeOauthDeadFailCount} times)`),null;await l();let t=c();if(t&&t.expiresAt!==null&&t.expiresAt<=Date.now()){q(`oauth_expired_unrefreshable`,`[bridge:repl] Skipping: OAuth token expired and refresh failed (re-login required)`),_?.(`failed`,`/login`);let e=t.expiresAt;return s(t=>({...t,bridgeOauthDeadExpiresAt:e,bridgeOauthDeadFailCount:t.bridgeOauthDeadExpiresAt===e?(t.bridgeOauthDeadFailCount??0)+1:1})),null}}let E=X(),D=`remote-control-${me()}`,O=!1,k=!1;if(x)D=x,O=!0,k=!0;else{let e=i(),t=e?R(e):void 0;if(t)D=t,O=!0,k=!0;else if(v&&v.length>0)for(let e=v.length-1;e>=0;e--){let t=v[e];if(t.type!==`user`||t.isMeta||t.toolUseResult||t.isCompactSummary||t.origin&&t.origin.kind!==`human`||ge(t))continue;let n=ue(t.message.content);if(!n)continue;let r=_t(n);if(r){D=r,O=!0;break}}}let A=0,j,re=0,ie=(e,t,n)=>{O=!0,D=e,S(`[bridge:repl] derived title from message ${n}: ${e}`),Be(t,e,{baseUrl:E,getAccessToken:Q}).catch(()=>{})},ae=(e,t)=>{let n=++re,r=A;Je(e,AbortSignal.timeout(15e3)).then(e=>{e&&n===re&&j===t&&!R(i())&&ie(e,t,r)})},oe=(e,t)=>{if(k||R(i()))return!0;if(j!==void 0&&j!==t&&(A=0),j=t,A++,A===1&&!O){let n=_t(e);n&&ie(n,t,A),ae(e,t)}else if(A===3){let n=y?.();ae(n?Xe(pe(n)):e,t)}return A>=3},M=g(`tengu_bridge_initial_history_cap`,200,300*1e3),ce=Z()?`self-hosted`:await f();if(!ce)return q(`no_org_uuid`,`[bridge:repl] Skipping: no org UUID`),_?.(`failed`,`/login`),null;if(Ae()&&!ee){let e=await Ge();if(e)return q(`version_too_old`,`[bridge:repl] Skipping: ${e}`,!0),_?.(`failed`,"run `claude update` to upgrade"),null;S(`[bridge:repl] Using env-less bridge path (tengu_bridge_repl_v2)`);let{initEnvLessBridgeCore:t}=await import(`./remoteBridgeCore-IJI5koHz.js`);return t({baseUrl:E,orgUUID:ce,title:D,getAccessToken:Q,onAuth401:p,toSDKMessages:qe,initialHistoryCap:M,initialMessages:v,onInboundMessage:n,onUserMessage:oe,onPermissionResponse:r,onInterrupt:a,onSetModel:u,onSetMaxThinkingTokens:m,onSetPermissionMode:h,onStateChange:_,outboundOnly:w,tags:T})}let le=je();if(le)return q(`version_too_old`,`[bridge:repl] Skipping: ${le}`),_?.(`failed`,"run `claude update` to upgrade"),null;let N=await te(),de=await ne(),fe=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||E,F=`claude_code`;{let{isAssistantMode:t}=(Me(),e(Ne));t()&&(F=`claude_code_assistant`)}return pt({dir:o(),machineName:st(),branch:N,gitRepoUrl:de,title:D,baseUrl:E,sessionIngressUrl:fe,workerType:F,getAccessToken:Q,createSession:e=>He({...e,events:[],baseUrl:E,getAccessToken:Q}),archiveSession:e=>Ue(e,{baseUrl:E,getAccessToken:Q,timeoutMs:1500}).catch(e=>{S(`[bridge:repl] archiveBridgeSession threw: ${C(e)}`,{level:`error`})}),getCurrentTitle:()=>R(i())??D,onUserMessage:oe,toSDKMessages:qe,onAuth401:p,getPollIntervalConfig:$,initialHistoryCap:M,initialMessages:v,previouslyFlushedUUIDs:b,onInboundMessage:n,onPermissionResponse:r,onInterrupt:a,onSetModel:u,onSetMaxThinkingTokens:m,onSetPermissionMode:h,onStateChange:_,perpetual:ee})}var gt=50;function _t(e){let t=O(e),n=(/^(.*?[.!?])\s/.exec(t)?.[1]??t).replace(/\s+/g,` `).trim();if(n)return n.length>gt?n.slice(0,gt-1)+`…`:n}export{ht as initReplBridge};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{Ko as r,Pr as i,Tr as a}from"./paths-
|
|
1
|
+
import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{Ko as r,Pr as i,Tr as a}from"./paths-CEAy4QCs.js";import{D as o,E as s,J as c,O as l,U as u}from"./debug-otxXY3j-.js";import{o as d,s as f}from"./log-DSV4Ht5l.js";import{r as p,t as m}from"./execFileNoThrow-azCkYhmF.js";import{o as h,r as g}from"./stringUtils-KZoO4GUd.js";import{Er as _,Fr as v,Or as y,Uo as b,Wr as x,ck as S,hA as ee,it as C,ko as w,kr as te,mA as ne,tt as re}from"./loadAgentsDir-DC4jN6-f.js";import{n as T,r as ie}from"./xml-D7-jJqSA.js";import{X as E}from"./rcDebugLog-C0Bam8V9.js";import{tmpdir as ae}from"os";import{extname as oe,join as D}from"path";import{constants as se}from"fs";import{copyFile as ce,mkdir as O,mkdtemp as le,readFile as k,readdir as A,rm as ue,unlink as de,writeFile as j}from"fs/promises";import{execFileSync as fe}from"child_process";function M(){return a()}function pe(){return a()}function N(){return D(t(),`usage-data`)}function P(){return D(N(),`facets`)}function F(){return D(N(),`session-meta`)}function me(e){return K[oe(e).toLowerCase()]||null}function he(e){let t={},n={},r=0,i=0,a=0,o=0,s=0,c=[],l=0,u={},d=!1,f=0,p=0,m=new Set,h=[],_=[],v=!1,y=!1,b=!1,x=null;for(let S of e.messages){let e=S.timestamp;if(S.type===`assistant`&&S.message){e&&(x=e);let s=S.message.usage;s&&(a+=s.input_tokens||0,o+=s.output_tokens||0);let c=S.message.content;if(Array.isArray(c)){for(let e of c)if(e.type===`tool_use`&&`name`in e){let a=e.name;t[a]=(t[a]||0)+1,(a===`Agent`||a===`Task`)&&(d=!0),a.startsWith(`mcp__`)&&(v=!0),a===`WebSearch`&&(y=!0),a===`WebFetch`&&(b=!0);let o=e.input;if(o){let e=o.file_path||``;if(e){let t=me(e);t&&(n[t]=(n[t]||0)+1),(a===`Edit`||a===`Write`)&&m.add(e)}if(a===`Edit`){let e=o.old_string||``,t=o.new_string||``;for(let n of ee(e,t))n.added&&(f+=n.count||0),n.removed&&(p+=n.count||0)}if(a===`Write`){let e=o.content||``;e&&(f+=g(e,`
|
|
2
2
|
`)+1)}let t=o.command||``;t.includes(`git commit`)&&r++,t.includes(`git push`)&&i++}}}}if(S.type===`user`&&S.message){let t=S.message.content,n=!1;if(typeof t==`string`&&t.trim())n=!0;else if(Array.isArray(t)){for(let e of t)if(e.type===`text`&&`text`in e){n=!0;break}}if(n){if(e)try{let t=new Date(e).getHours();h.push(t),_.push(e)}catch{}if(x&&e){let t=new Date(x).getTime(),n=(new Date(e).getTime()-t)/1e3;n>2&&n<3600&&c.push(n)}}if(Array.isArray(t)){for(let e of t)if(e.type===`tool_result`&&`content`in e&&e.is_error){l++;let t=e.content,n=`Other`;if(typeof t==`string`){let e=t.toLowerCase();e.includes(`exit code`)?n=`Command Failed`:e.includes(`rejected`)||e.includes(`doesn't want`)?n=`User Rejected`:e.includes(`string to replace not found`)||e.includes(`no changes`)?n=`Edit Failed`:e.includes(`modified since read`)?n=`File Changed`:e.includes(`exceeds maximum`)||e.includes(`too large`)?n=`File Too Large`:(e.includes(`file not found`)||e.includes(`does not exist`))&&(n=`File Not Found`)}u[n]=(u[n]||0)+1}}if(typeof t==`string`)t.includes(`[Request interrupted by user`)&&s++;else if(Array.isArray(t)){for(let e of t)if(e.type===`text`&&`text`in e&&e.text.includes(`[Request interrupted by user`)){s++;break}}}}return{toolCounts:t,languages:n,gitCommits:r,gitPushes:i,inputTokens:a,outputTokens:o,userInterruptions:s,userResponseTimes:c,toolErrors:l,toolErrorCategories:u,usesTaskAgent:d,usesMcp:v,usesWebSearch:y,usesWebFetch:b,linesAdded:f,linesRemoved:p,filesModified:m,messageHours:h,userMessageTimestamps:_}}function ge(e){return!Number.isNaN(e.created.getTime())&&!Number.isNaN(e.modified.getTime())}function I(e){let t=he(e),n=te(e)||`unknown`,r=e.created.toISOString(),i=Math.round((e.modified.getTime()-e.created.getTime())/1e3/60),a=0,o=0;for(let t of e.messages)if(t.type===`assistant`&&o++,t.type===`user`&&t.message){let e=t.message.content,n=!1;if(typeof e==`string`&&e.trim())n=!0;else if(Array.isArray(e)){for(let t of e)if(t.type===`text`&&`text`in t){n=!0;break}}n&&a++}return{session_id:n,project_path:e.projectPath||``,start_time:r,duration_minutes:i,user_message_count:a,assistant_message_count:o,tool_counts:t.toolCounts,languages:t.languages,git_commits:t.gitCommits,git_pushes:t.gitPushes,input_tokens:t.inputTokens,output_tokens:t.outputTokens,first_prompt:e.firstPrompt||``,summary:e.summary,user_interruptions:t.userInterruptions,user_response_times:t.userResponseTimes,tool_errors:t.toolErrors,tool_error_categories:t.toolErrorCategories,uses_task_agent:t.usesTaskAgent,uses_mcp:t.usesMcp,uses_web_search:t.usesWebSearch,uses_web_fetch:t.usesWebFetch,lines_added:t.linesAdded,lines_removed:t.linesRemoved,files_modified:t.filesModified.size,message_hours:t.messageHours,user_message_timestamps:t.userMessageTimestamps}}function _e(e){let t=[],n=I(e);t.push(`Session: ${n.session_id.slice(0,8)}`),t.push(`Date: ${n.start_time}`),t.push(`Project: ${n.project_path}`),t.push(`Duration: ${n.duration_minutes} min`),t.push(``);for(let n of e.messages)if(n.type===`user`&&n.message){let e=n.message.content;if(typeof e==`string`)t.push(`[User]: ${e.slice(0,500)}`);else if(Array.isArray(e))for(let n of e)n.type===`text`&&`text`in n&&t.push(`[User]: ${n.text.slice(0,500)}`)}else if(n.type===`assistant`&&n.message){let e=n.message.content;if(Array.isArray(e))for(let n of e)n.type===`text`&&`text`in n?t.push(`[Assistant]: ${n.text.slice(0,300)}`):n.type===`tool_use`&&`name`in n&&t.push(`[Tool: ${n.name}]`)}return t.join(`
|
|
3
3
|
`)}async function ve(e){try{return w((await C({systemPrompt:E([]),userPrompt:Y+e,signal:new AbortController().signal,options:{model:M(),querySource:`insights`,agents:[],isNonInteractiveSession:!0,hasAppendSystemPrompt:!1,mcpTools:[],maxOutputTokensOverride:500}})).message.content)||e.slice(0,2e3)}catch{return e.slice(0,2e3)}}async function ye(e){let t=_e(e);if(t.length<=3e4)return t;let n=25e3,r=[];for(let e=0;e<t.length;e+=n)r.push(t.slice(e,e+n));let i=await Promise.all(r.map(ve)),a=I(e);return[`Session: ${a.session_id.slice(0,8)}`,`Date: ${a.start_time}`,`Project: ${a.project_path}`,`Duration: ${a.duration_minutes} min`,`[Long session - ${r.length} parts summarized]`,``].join(`
|
|
4
4
|
`)+i.join(`
|