@readmagic/workmate 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{AddWorkspaceDirectory-DJRkEz7o.js → AddWorkspaceDirectory-ClHi-Dr6.js} +1 -1
- package/dist/chunks/{App-iJu5qyiF.js → App-BP06lHmf.js} +1 -1
- package/dist/chunks/{ApproveApiKey-CRejTHUw.js → ApproveApiKey-Bsy8kr2a.js} +1 -1
- package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +1 -0
- package/dist/chunks/{AssistantSessionChooser-CBLQ1v-J.js → AssistantSessionChooser-CcocKoTJ.js} +1 -1
- package/dist/chunks/{BackgroundTasksDialog-CyoLEYWH.js → BackgroundTasksDialog-DNeBhGCf.js} +1 -1
- package/dist/chunks/{BypassPermissionsModeDialog-D1FCKVOi.js → BypassPermissionsModeDialog-BKj_3Idm.js} +1 -1
- package/dist/chunks/{ClaudeMdExternalIncludesDialog-CI0yF6sZ.js → ClaudeMdExternalIncludesDialog-BD-7yAZh.js} +1 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +1 -0
- package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +1 -0
- package/dist/chunks/{DesktopHandoff-D1rrMxeP.js → DesktopHandoff-BmPmCfT3.js} +1 -1
- package/dist/chunks/{DiffDialog-BKcfKx7O.js → DiffDialog-C4XSSjvV.js} +1 -1
- package/dist/chunks/Doctor-BhD-ZzZm.js +1 -0
- package/dist/chunks/{Doctor-Yco1McrL.js → Doctor-DEQe2q16.js} +1 -1
- package/dist/chunks/{ExitFlow-D3csukbB.js → ExitFlow-BttnAv-O.js} +1 -1
- package/dist/chunks/{Feedback-bEUtrHia.js → Feedback-BaYA8-SU.js} +1 -1
- package/dist/chunks/Grove-BJziCbZH.js +11 -0
- package/dist/chunks/Grove-sWm-oLBf.js +1 -0
- package/dist/chunks/{HybridTransport-9fTBC2Pv.js → HybridTransport-B8V6O6rM.js} +1 -1
- package/dist/chunks/{InvalidConfigDialog-9M-1nfZ6.js → InvalidConfigDialog-CHzBSJDf.js} +1 -1
- package/dist/chunks/{InvalidSettingsDialog-B2F6pryH.js → InvalidSettingsDialog-BKenH3bD.js} +1 -1
- package/dist/chunks/{MCPConnectionManager-MWpKjeZT.js → MCPConnectionManager-CNh9dNlk.js} +1 -1
- package/dist/chunks/{McpParsingWarnings-BPBb7Npe.js → McpParsingWarnings-Bj2-YL8o.js} +1 -1
- package/dist/chunks/{MessageSelector-DsQmqFt2.js → MessageSelector-DdR6wJhh.js} +1 -1
- package/dist/chunks/{Messages-B3sGRx5A.js → Messages-Ch6cboMV.js} +2 -2
- package/dist/chunks/{Onboarding-cHcnsBGp.js → Onboarding-BrAJp0aL.js} +1 -1
- package/dist/chunks/{OverageCreditUpsell-CWCD_RpM.js → OverageCreditUpsell-Ds1cB7RC.js} +1 -1
- package/dist/chunks/PluginSettings-CGqEzejq.js +17 -0
- package/dist/chunks/{PromptInputFooterSuggestions-D5sAO6y-.js → PromptInputFooterSuggestions-egs9VvUs.js} +1 -1
- package/dist/chunks/{PromptInputHelpMenu-n6hAdsto.js → PromptInputHelpMenu-SieM5NoY.js} +1 -1
- package/dist/chunks/{QueryEngine-cwdsr4dr.js → QueryEngine-CZZMl3PB.js} +1 -1
- package/dist/chunks/{REPL-CJzScgbZ.js → REPL-CG2N7E4Q.js} +6 -6
- package/dist/chunks/REPL-DvA910N_.js +1 -0
- package/dist/chunks/{RemoteCallout-CiA4rCEs.js → RemoteCallout-Cs-ro8_i.js} +1 -1
- package/dist/chunks/{RemoteSessionManager-zdHfmvfj.js → RemoteSessionManager-B740Dp6m.js} +1 -1
- package/dist/chunks/{ResumeConversation-Rxwd6HAJ.js → ResumeConversation-DzV2zmuX.js} +1 -1
- package/dist/chunks/{SSETransport-BPbhCa2f.js → SSETransport-DtpMDekF.js} +1 -1
- package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +1 -0
- package/dist/chunks/{Settings-CxI_KHUj.js → Settings-XKw6FI_m.js} +2 -2
- package/dist/chunks/{TeleportProgress-DrulEQ7z.js → TeleportProgress-rYaHIEfe.js} +1 -1
- package/dist/chunks/{TeleportRepoMismatchDialog-D3FOLr0P.js → TeleportRepoMismatchDialog-DY97YZMB.js} +1 -1
- package/dist/chunks/{TeleportResumeWrapper-DI5iRFND.js → TeleportResumeWrapper-jaQzyTCh.js} +1 -1
- package/dist/chunks/{ThemePicker-CQ7dfFtv.js → ThemePicker-BViWzLp3.js} +1 -1
- package/dist/chunks/{TrustDialog-CnVKrdxQ.js → TrustDialog-DGJ_BisZ.js} +1 -1
- package/dist/chunks/{ValidationErrorsList-CPYeuppg.js → ValidationErrorsList-B8pRiGuy.js} +1 -1
- package/dist/chunks/{WelcomeV2-C-UXdIng.js → WelcomeV2-DqnbSdIu.js} +1 -1
- package/dist/chunks/{add-dir-xTz4COgn.js → add-dir-C2Hu3oE4.js} +1 -1
- package/dist/chunks/{agentDisplay-BuSReYxu.js → agentDisplay-XoDJhr03.js} +1 -1
- package/dist/chunks/{agents-Du9KYHqN.js → agents-BIHTGDYh.js} +1 -1
- package/dist/chunks/{agents-CiLlKN2I.js → agents-C4QXeHIJ.js} +1 -1
- package/dist/chunks/{allErrors-P3utlEeA.js → allErrors-1896uQA1.js} +1 -1
- package/dist/chunks/{ant-CBIfqmAb.js → ant-B6k6cBts.js} +1 -1
- package/dist/chunks/api-BsFW57_Q.js +1 -0
- package/dist/chunks/{api-B-5jqiMg.js → api-gqTA-D7n.js} +1 -1
- package/dist/chunks/{assistant-XOnU01yl.js → assistant-DJ9hd4uC.js} +1 -1
- package/dist/chunks/auth-8Vd3_U8t.js +1 -0
- package/dist/chunks/{auth-DT2yxy94.js → auth-BnSrKyJe.js} +1 -1
- package/dist/chunks/auth-DRTjfnGy.js +1 -0
- package/dist/chunks/{autoMode-CEMflt3g.js → autoMode-BNukrVAB.js} +1 -1
- package/dist/chunks/{autonomy-_N8aDaA8.js → autonomy-BEmI7WVW.js} +1 -1
- package/dist/chunks/{autonomy-Cg5zweUa.js → autonomy-DGcy5Rml.js} +1 -1
- package/dist/chunks/{autonomyPanel-I4yCy3Fr.js → autonomyPanel-fhge09AG.js} +1 -1
- package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +1 -0
- package/dist/chunks/{backgroundHousekeeping-DhF2lrQ9.js → backgroundHousekeeping-BVMf_Tjn.js} +2 -2
- package/dist/chunks/{branch-BIX-pyHp.js → branch-Bpe-gocq.js} +1 -1
- package/dist/chunks/{break-cache-BQfgkNAo.js → break-cache-C_p7Kmx2.js} +3 -3
- package/dist/chunks/{bridge-CYskzVt8.js → bridge-D12Shbkj.js} +2 -2
- package/dist/chunks/{bridgeConfig-5p_w4s5r.js → bridgeConfig-BhxRF2vm.js} +1 -1
- package/dist/chunks/bridgeConfig-CqIQ_rvD.js +1 -0
- package/dist/chunks/bridgeEnabled-D0XC5kNh.js +1 -0
- package/dist/chunks/{bridgeEnabled-DhFrLTbG.js → bridgeEnabled-SbB-6zdY.js} +1 -1
- package/dist/chunks/{bridgeMain-BX2AkLPs.js → bridgeMain-DHUpZFgL.js} +6 -6
- package/dist/chunks/bridgeMain-DUbQjgCp.js +1 -0
- package/dist/chunks/{bridgeMessaging-B5Lbzr8e.js → bridgeMessaging-DHc5dOhB.js} +1 -1
- package/dist/chunks/{btw-CWWFO7u8.js → btw-D9hMM5d2.js} +1 -1
- package/dist/chunks/caches-CWzT7e6Y.js +1 -0
- package/dist/chunks/{caches-DPqPIogk.js → caches-UeVVM3T0.js} +2 -2
- package/dist/chunks/{ccrClient-CTLnU9Y1.js → ccrClient-Iza0L8Zw.js} +1 -1
- package/dist/chunks/{clear-DCAgZwc4.js → clear-B4d38ssF.js} +1 -1
- package/dist/chunks/client-BzKQTXzF.js +1 -0
- package/dist/chunks/{color-CmJGInHL.js → color-D8VOyoYl.js} +1 -1
- package/dist/chunks/commands-DDamMmo4.js +1 -0
- package/dist/chunks/commitAttribution-CgohL8vD.js +1 -0
- package/dist/chunks/{commitAttribution-CGZr7XNO.js → commitAttribution-ChAgixdj.js} +1 -1
- package/dist/chunks/{compact-C6-lMHgn.js → compact-IFHwxjZ9.js} +1 -1
- package/dist/chunks/config-DY5-_kk_.js +1 -0
- package/dist/chunks/{config-3m_9zSrj.js → config-DmomySWC.js} +1 -1
- package/dist/chunks/config-WxgxrQoP.js +1 -0
- package/dist/chunks/{context-C9V4GF0n.js → context-Cl6BJ2vm.js} +1 -1
- package/dist/chunks/{context-noninteractive-BmC4o5xo.js → context-noninteractive-9hELVC29.js} +1 -1
- package/dist/chunks/context-noninteractive-Beij5MfU.js +1 -0
- package/dist/chunks/conversation-BBB91hEw.js +1 -0
- package/dist/chunks/{conversation-CYqqk0o7.js → conversation-BWVTM40Y.js} +1 -1
- package/dist/chunks/{createSSHSession-BL6j0AU5.js → createSSHSession-BM-5pbv6.js} +1 -1
- package/dist/chunks/createSession-CoQtL5Rj.js +1 -0
- package/dist/chunks/{createSession-D_sgO1Xy.js → createSession-Cvl1Q50F.js} +1 -1
- package/dist/chunks/{crossProjectResume-D5hTOfnE.js → crossProjectResume-BasMLl2n.js} +1 -1
- package/dist/chunks/{datadog-UkGdjL8-.js → datadog-CpqEQbHa.js} +1 -1
- package/dist/chunks/{desktop-HbYKh-VK.js → desktop-B_L6T6jI.js} +1 -1
- package/dist/chunks/{diff-nTV17iWX.js → diff-CVzOodeg.js} +1 -1
- package/dist/chunks/doctor-1L0TFuGw.js +1 -0
- package/dist/chunks/{entry-CCFI6-gM.js → entry-DHVYCR26.js} +1 -1
- package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +1 -0
- package/dist/chunks/{envLessBridgeConfig-DXd10GXD.js → envLessBridgeConfig-Ck2-KMq0.js} +1 -1
- package/dist/chunks/{esm-CGoYrggU.js → esm-D5q6s4l8.js} +1 -1
- package/dist/chunks/{exit-ropaQiOr.js → exit-Bm1S_f3i.js} +1 -1
- package/dist/chunks/extra-usage-UHAWtypK.js +1 -0
- package/dist/chunks/{extra-usage-core-DLYHAInT.js → extra-usage-core-BFOolqoi.js} +1 -1
- package/dist/chunks/{extra-usage-noninteractive-D8iszH3c.js → extra-usage-noninteractive-cUGZy0en.js} +1 -1
- package/dist/chunks/{extra-usage-g2Pw4zt_.js → extra-usage-zDHVtWKZ.js} +1 -1
- package/dist/chunks/{extraUsage-C2Ylufhj.js → extraUsage-Dq66zzqR.js} +1 -1
- package/dist/chunks/extractMemories-BcaklA33.js +1 -0
- package/dist/chunks/fast-DALAHO3d.js +1 -0
- package/dist/chunks/{fast-Dx2fTmWr.js → fast-MS7WZpD8.js} +1 -1
- package/dist/chunks/{feedback-DCQ4pJ3v.js → feedback-Fw4m28ZC.js} +1 -1
- package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +1 -0
- package/dist/chunks/{firstPartyEventLogger-BNGPPBNP.js → firstPartyEventLogger-CoSUd0a1.js} +2 -2
- package/dist/chunks/{flushGate-XaheIZZT.js → flushGate-De-yppeo.js} +1 -1
- package/dist/chunks/{gemini-BCCLHK3K.js → gemini-BPziscyN.js} +1 -1
- package/dist/chunks/{generateRecap-BhvbixY2.js → generateRecap-jGDLI_wU.js} +1 -1
- package/dist/chunks/{generateSessionName-CN1oh7Fa.js → generateSessionName-hDJ6HBJ1.js} +1 -1
- package/dist/chunks/{githubRepoPathMapping-B4AM8luI.js → githubRepoPathMapping-qAoiyj6P.js} +1 -1
- package/dist/chunks/{goal-Bp6fyGqo.js → goal-CFx4eRkf.js} +1 -1
- package/dist/chunks/{grok-ax26ju8y.js → grok-Byblph7F.js} +1 -1
- package/dist/chunks/{grove-DrBVaZSN.js → grove-CpqjcGCb.js} +1 -1
- package/dist/chunks/{heapdump-JseysNDr.js → heapdump-C4kPlqGt.js} +1 -1
- package/dist/chunks/{help-DR9hKneR.js → help-B1h-faJ3.js} +1 -1
- package/dist/chunks/hooks-DPLIIpAD.js +1 -0
- package/dist/chunks/{hooks-C5n23H1E.js → hooks-X6J03MnA.js} +1 -1
- package/dist/chunks/hostGuard-BHI6Q8Mt.js +1 -0
- package/dist/chunks/inboundAttachments-BekVc0W-.js +1 -0
- package/dist/chunks/{inboundAttachments-Cp8XvLMZ.js → inboundAttachments-CUJE3KaU.js} +1 -1
- package/dist/chunks/{initReplBridge-DJs28ZkI.js → initReplBridge-JQ-afRx9.js} +1 -1
- package/dist/chunks/{install-C7qTB0V5.js → install-D5YORIJL.js} +1 -1
- package/dist/chunks/{instrumentation-CLZttr_u.js → instrumentation-Bw3CxPQf.js} +3 -3
- package/dist/chunks/{job-BhiazwPH.js → job-DOWtcltx.js} +1 -1
- package/dist/chunks/{keybindings-CkL8BzUt.js → keybindings-BLw5J-Zj.js} +1 -1
- package/dist/chunks/{language-DIw2871r.js → language-C6Fq-XOZ.js} +1 -1
- package/dist/chunks/language-Cqw5gYJR.js +1 -0
- package/dist/chunks/{launchAgentsPlatform-j-mWpwW1.js → launchAgentsPlatform-jWWf-Lk9.js} +1 -1
- package/dist/chunks/{launchLocalMemory-DmoXp0Xo.js → launchLocalMemory-kHeD0I0y.js} +1 -1
- package/dist/chunks/{launchLocalVault-1uKe0HjA.js → launchLocalVault-DLqkOjmb.js} +1 -1
- package/dist/chunks/{launchMemoryStores-SxDKjHJ3.js → launchMemoryStores-Ct7AVXrO.js} +1 -1
- package/dist/chunks/{launchOnboarding-CTtpnXcs.js → launchOnboarding-Cc6WwPX9.js} +1 -1
- package/dist/chunks/{launchSchedule-BDVnGhaL.js → launchSchedule-ZyvuvjgU.js} +1 -1
- package/dist/chunks/{launchSkillStore-SmMLxp4K.js → launchSkillStore-BejQnLog.js} +1 -1
- package/dist/chunks/{launchTeleport-B472ZSGz.js → launchTeleport-8CuYUfIR.js} +1 -1
- package/dist/chunks/{launchVault-CsyBgxle.js → launchVault-DIvIOuPh.js} +1 -1
- package/dist/chunks/{loadAgentsDir-Clu7Uk6a.js → loadAgentsDir-D206qwP3.js} +47 -47
- package/dist/chunks/loadAgentsDir-TZjwTqdr.js +1 -0
- package/dist/chunks/{loadPluginHooks-Cvd5VdjQ.js → loadPluginHooks-Ddhsyn0_.js} +1 -1
- package/dist/chunks/{localSearch-iA6JTk19.js → localSearch-CzrbOklu.js} +1 -1
- package/dist/chunks/localSearch-DrOAL6f4.js +1 -0
- package/dist/chunks/{logoV2Utils-YHBJLIrC.js → logoV2Utils-8M56V7oN.js} +1 -1
- package/dist/chunks/{magicDocs-Bf1fqnHN.js → magicDocs-DWjL2k7P.js} +1 -1
- package/dist/chunks/{main-gtV_TqXP.js → main-BohPzJFF.js} +16 -16
- package/dist/chunks/{mappers-C8lYERPX.js → mappers-BDMZFgKx.js} +1 -1
- package/dist/chunks/{mcp-Ci0OPVrR.js → mcp-Bt1ITh-Z.js} +1 -1
- package/dist/chunks/{mcp-CNuhEGP6.js → mcp-CwJ-AIpt.js} +2 -2
- package/dist/chunks/{mcp-CwIYauZl.js → mcp-W0LFoyFR.js} +1 -1
- package/dist/chunks/{memory-DCGqfQ1U.js → memory-3wV7m7UU.js} +1 -1
- package/dist/chunks/{mode-DO6g7nkX.js → mode-CUkHFkju.js} +1 -1
- package/dist/chunks/{model-DLXL0CNu.js → model-BY3auM2c.js} +1 -1
- package/dist/chunks/model-CKkOnnnx.js +1 -0
- package/dist/chunks/model-DRXcJyU9.js +1 -0
- package/dist/chunks/{nativeInstaller-OPuO2sm_.js → nativeInstaller-CA5d6_G7.js} +1 -1
- package/dist/chunks/{onChangeAppState-CHhRDkM7.js → onChangeAppState-DBmy2Ow_.js} +1 -1
- package/dist/chunks/{openai-HOebt-8k.js → openai-Cbomn0Ws.js} +1 -1
- package/dist/chunks/{overageCreditGrant-Bi1CTBAx.js → overageCreditGrant-DsUrmeBh.js} +1 -1
- package/dist/chunks/{panel-CrTPqXCv.js → panel-BSZGX6jN.js} +1 -1
- package/dist/chunks/{panelCall-D0eURklm.js → panelCall-BsVoL1uF.js} +1 -1
- package/dist/chunks/{partition-C8RSL3SQ.js → partition-BAakXjvj.js} +1 -1
- package/dist/chunks/{passes-BJci5SM_.js → passes-CLRt7Cvm.js} +1 -1
- package/dist/chunks/{permissions-JU9CGHgI.js → permissions-BVSFuwNP.js} +1 -1
- package/dist/chunks/{pidLock-Bd2e6xuT.js → pidLock-D5rUnDB-.js} +2 -2
- package/dist/chunks/{plan-D4gMsK7i.js → plan-SYZ4DXR8.js} +1 -1
- package/dist/chunks/{plugin-CwCo5Kik.js → plugin-Bfjzhmrk.js} +1 -1
- package/dist/chunks/{pluginAutoupdate-CO-n9bqe.js → pluginAutoupdate-reO2PgtQ.js} +1 -1
- package/dist/chunks/{pluginBlocklist-5qbaTRbV.js → pluginBlocklist-C3H2afWG.js} +1 -1
- package/dist/chunks/{pluginCliCommands-I-lsw_us.js → pluginCliCommands-lqdxdkQp.js} +1 -1
- package/dist/chunks/{pluginFlagging-DNPBbJZo.js → pluginFlagging-D9HKAGBC.js} +1 -1
- package/dist/chunks/{pluginOperations-Cz6eQ0Vu.js → pluginOperations-EN3EKLux.js} +1 -1
- package/dist/chunks/{pluginStartupCheck-DJ9fslCK.js → pluginStartupCheck-BY73BMT2.js} +1 -1
- package/dist/chunks/pluginStartupCheck-CwWOlveD.js +1 -0
- package/dist/chunks/{plugins-CzJIuPfb.js → plugins-Dn6ceWrT.js} +1 -1
- package/dist/chunks/policyLimits-CkTI5KEt.js +1 -0
- package/dist/chunks/{poor-Dha9p9RF.js → poor-j-y-bv8o.js} +1 -1
- package/dist/chunks/{poorMode-1NLYiS3Y.js → poorMode-DhzFKpPl.js} +1 -1
- package/dist/chunks/poorMode-V11s-3cf.js +1 -0
- package/dist/chunks/{print-BL4EUT5Z.js → print-Db_VXmfO.js} +4 -4
- package/dist/chunks/{privacy-settings-6ZWxR4Qt.js → privacy-settings-DHMJREbb.js} +1 -1
- package/dist/chunks/{processBashCommand-BZs9wggV.js → processBashCommand-BcM_fhV9.js} +1 -1
- package/dist/chunks/{processSlashCommand-D8lKLNzM.js → processSlashCommand-DEVo3GPX.js} +1 -1
- package/dist/chunks/{prompt-Bg_1U0gO.js → prompt-BNHtszmZ.js} +1 -1
- package/dist/chunks/prompt-CrX31AGm.js +1 -0
- package/dist/chunks/prompt-IAvMxKDl.js +1 -0
- package/dist/chunks/{promptEditor-BhYDmwdS.js → promptEditor-DeMrXUir.js} +1 -1
- package/dist/chunks/{protocolHandler-Dnb7lITm.js → protocolHandler-BHxBy84Z.js} +1 -1
- package/dist/chunks/{rate-limit-options-DVzT3eWH.js → rate-limit-options-DIudL9fb.js} +1 -1
- package/dist/chunks/{rcDebugLog-VKwMl0yg.js → rcDebugLog-CUy1_F23.js} +1 -1
- package/dist/chunks/{reconciler-BdRXZTJf.js → reconciler-BXpPyfSY.js} +1 -1
- package/dist/chunks/{referral-BlrMpBAV.js → referral-CUaIo_vT.js} +1 -1
- package/dist/chunks/{refresh-jwqnoK2h.js → refresh-CuaVBIQ0.js} +1 -1
- package/dist/chunks/{registerProtocol-CuKZAiCc.js → registerProtocol-B7Fzdofu.js} +1 -1
- package/dist/chunks/{release-notes-BgP8u7NE.js → release-notes-fbfv2DC0.js} +1 -1
- package/dist/chunks/{releaseNotes-CunqVlbU.js → releaseNotes-CxAHFLPl.js} +2 -2
- package/dist/chunks/{reload-plugins-CD9TzvFm.js → reload-plugins-B9IT9CFA.js} +1 -1
- package/dist/chunks/{remote-env-QaP_W_sv.js → remote-env-BOklGlll.js} +1 -1
- package/dist/chunks/{remoteBridgeCore-9-HVMo63.js → remoteBridgeCore-j0bG1zjv.js} +1 -1
- package/dist/chunks/{remoteManagedSettings-jZ6u8ZBT.js → remoteManagedSettings-Cq994lyc.js} +1 -1
- package/dist/chunks/{rename-29qxHf8W.js → rename-Iev7wQsI.js} +1 -1
- package/dist/chunks/{resume-D-SpOy_1.js → resume-y7MCTZHJ.js} +1 -1
- package/dist/chunks/{runtimeObserver-DOEcrylu.js → runtimeObserver-BZcJ1FbH.js} +1 -1
- package/dist/chunks/{runtimeObserver-Dm3LIUMp.js → runtimeObserver-CyzLASla.js} +2 -2
- package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +1 -0
- package/dist/chunks/{sandbox-toggle-B61AeBor.js → sandbox-toggle-CWpBO228.js} +1 -1
- package/dist/chunks/searchExtraTools-BUOUds7p.js +1 -0
- package/dist/chunks/{session-RwJCIIcs.js → session-DL4cA_8l.js} +1 -1
- package/dist/chunks/{sessionDiscovery-dkFeWcA3.js → sessionDiscovery-DAfNKqp1.js} +1 -1
- package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +1 -0
- package/dist/chunks/{sessionMemory-btARBn8H.js → sessionMemory-BS8_TbKj.js} +1 -1
- package/dist/chunks/sessionMemory-D5fSHXvZ.js +1 -0
- package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +1 -0
- package/dist/chunks/sessionObserver-ChfQtK2m.js +1 -0
- package/dist/chunks/{sessionObserver-CSOYgsvH.js → sessionObserver-ShbCwJ8x.js} +1 -1
- package/dist/chunks/sessionStorage-Cf5wmnyB.js +1 -0
- package/dist/chunks/{sessionTitle-CLOlPZ_M.js → sessionTitle-coed9IuJ.js} +1 -1
- package/dist/chunks/{sessionTracing-D8wr9j4X.js → sessionTracing-D9rUyiq0.js} +1 -1
- package/dist/chunks/{settings-Dlp5JTa_.js → settings-BovzmwMP.js} +2 -2
- package/dist/chunks/{settingsSync-QWA0VZSu.js → settingsSync-PqU9XGJq.js} +1 -1
- package/dist/chunks/{setup-UI9uv2-K.js → setup-B_FOvNpp.js} +2 -2
- package/dist/chunks/{shadowedRuleDetection-CXsmUY2o.js → shadowedRuleDetection-D1wsAdpp.js} +1 -1
- package/dist/chunks/{sideQuestion-CHpOVzY5.js → sideQuestion-wSi38p81.js} +1 -1
- package/dist/chunks/sinks-BpcRrN_T.js +1 -0
- package/dist/chunks/{sinks-1hFrW9HK.js → sinks-C_Dl1p4K.js} +2 -2
- package/dist/chunks/{skill-learning-Ck17rwH8.js → skill-learning-B5tmc7EX.js} +1 -1
- package/dist/chunks/{skillChangeDetector-s0F9Yf9a.js → skillChangeDetector-DNqohXxz.js} +1 -1
- package/dist/chunks/{skillGapStore-BJ1h2LVr.js → skillGapStore-D-kQKVDZ.js} +1 -1
- package/dist/chunks/{skillGapStore-DyqNKuNy.js → skillGapStore-Df5BWAk5.js} +2 -2
- package/dist/chunks/{skillGenerator-BT8NGzXT.js → skillGenerator-DbcdpAkw.js} +2 -2
- package/dist/chunks/skillLearning-C5cXZE6_.js +1 -0
- package/dist/chunks/{skillLearning-Cn9Uw0Kd.js → skillLearning-ClRiDcJH.js} +1 -1
- package/dist/chunks/{skillPanel-N0GoWjIi.js → skillPanel-LBd4E-MM.js} +3 -3
- package/dist/chunks/{skillSearchPanel-CTwtgTzy.js → skillSearchPanel-CErRnUwo.js} +2 -2
- package/dist/chunks/{skills-Bv3lH-aA.js → skills-CBKhfg_a.js} +1 -1
- package/dist/chunks/{stats-C1Ff6w4i.js → stats-BY4dskVg.js} +1 -1
- package/dist/chunks/{status-DyXiBa0m.js → status-BnJIXtKl.js} +2 -2
- package/dist/chunks/{status-FD7HVYS7.js → status-DU-B4SMW.js} +1 -1
- package/dist/chunks/{statusNoticeHelpers-kTp9Rdk6.js → statusNoticeHelpers-CzTuGNuC.js} +1 -1
- package/dist/chunks/{tag-RzOSA5T0.js → tag-B-wVW9Aj.js} +1 -1
- package/dist/chunks/{tasks-eJrOcdhB.js → tasks-CBVL005y.js} +1 -1
- package/dist/chunks/{teleport-ABA-hdmP.js → teleport-dtqQXM4x.js} +1 -1
- package/dist/chunks/{templateJobs-BnOBSFtq.js → templateJobs-D6998LcG.js} +1 -1
- package/dist/chunks/{terminalSetup-BfvmoJaK.js → terminalSetup-0SBdyKF5.js} +1 -1
- package/dist/chunks/{terminalSetup-D_P5iZmq.js → terminalSetup-CuV-qU6v.js} +1 -1
- package/dist/chunks/{theme-S0kVMVt4.js → theme-p0AooruD.js} +1 -1
- package/dist/chunks/thinkback-Catprqs_.js +1 -0
- package/dist/chunks/{thinkback-HyW_R_88.js → thinkback-DI2NpvG-.js} +1 -1
- package/dist/chunks/{thinkback-play-H6md4czq.js → thinkback-play-CqrIRx2o.js} +1 -1
- package/dist/chunks/{toolEventObserver-BAFzvePj.js → toolEventObserver-DTccwC3c.js} +1 -1
- package/dist/chunks/{toolEventObserver--Z6jENks.js → toolEventObserver-DlH73w-S.js} +1 -1
- package/dist/chunks/{toolPool-CR61XXm3.js → toolPool-B64V-jmK.js} +1 -1
- package/dist/chunks/{trustedDevice-Dn4rXbxT.js → trustedDevice-BTYoQCkC.js} +1 -1
- package/dist/chunks/trustedDevice-CiwjT_Y6.js +1 -0
- package/dist/chunks/{ultrareviewCommand-mYDTBCFD.js → ultrareviewCommand-BDFUS3hf.js} +1 -1
- package/dist/chunks/undercover-XYapZ_SS.js +1 -0
- package/dist/chunks/{undercover-CdapzvNH.js → undercover-vuTpCnQJ.js} +2 -2
- package/dist/chunks/{updateCCB-DPShheOr.js → updateCCB-DFL5Wt_I.js} +1 -1
- package/dist/chunks/{upgrade-BOeakAP6.js → upgrade-D5qwcaWQ.js} +1 -1
- package/dist/chunks/upgrade-DIg3j929.js +1 -0
- package/dist/chunks/{upload-BXQsDtLW.js → upload-B_yADHX9.js} +1 -1
- package/dist/chunks/{usage-iNQzY960.js → usage-C0SnnC-i.js} +1 -1
- package/dist/chunks/usage-CYJKE8N6.js +1 -0
- package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CntByfTQ.js → useExitOnCtrlCDWithKeybindings-DKIqRraH.js} +1 -1
- package/dist/chunks/useMainLoopModel-XetDUXd-.js +1 -0
- package/dist/chunks/{useManagePlugins-B8HD0RUh.js → useManagePlugins-B2KhKiu5.js} +1 -1
- package/dist/chunks/{useMergedTools-DfchLQZC.js → useMergedTools-CKvwz_Zt.js} +1 -1
- package/dist/chunks/{useSearchInput-H-8hJeFD.js → useSearchInput-D1Vr2Js1.js} +1 -1
- package/dist/chunks/{useSettingsErrors-BF5i5Xju.js → useSettingsErrors-B7BXHchG.js} +1 -1
- package/dist/chunks/{util-CoicMvOv.js → util-BaDs-wL5.js} +1 -1
- package/dist/chunks/{validatePlugin-z2fcngf8.js → validatePlugin-DtiYlXby.js} +1 -1
- package/dist/chunks/{vim-DdvQlLDm.js → vim-C-icQDz1.js} +1 -1
- package/dist/chunks/{workerRegistry-CzqQwCHC.js → workerRegistry-ChqPPIaO.js} +1 -1
- package/dist/chunks/worktree-DAn8ooa1.js +1 -0
- package/dist/cli.js +1 -1
- package/package.json +1 -1
- package/dist/chunks/ApproveApiKey-CKfn7U1R.js +0 -1
- package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +0 -1
- package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +0 -1
- package/dist/chunks/Doctor-CcJUwSQn.js +0 -1
- package/dist/chunks/Grove-DPkIjqg8.js +0 -1
- package/dist/chunks/Grove-Dsd7F39b.js +0 -11
- package/dist/chunks/PluginSettings-B0jbwB2M.js +0 -17
- package/dist/chunks/REPL-DlBJIPCw.js +0 -1
- package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +0 -1
- package/dist/chunks/api-BiwZmmsh.js +0 -1
- package/dist/chunks/auth-BQa4kzQo.js +0 -1
- package/dist/chunks/auth-UAJhZNmZ.js +0 -1
- package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +0 -1
- package/dist/chunks/bridgeConfig-DWEqKbXk.js +0 -1
- package/dist/chunks/bridgeEnabled-CjVCMwnq.js +0 -1
- package/dist/chunks/bridgeMain-6lollTtZ.js +0 -1
- package/dist/chunks/caches-C46fa77L.js +0 -1
- package/dist/chunks/client-Bup0Sgcn.js +0 -1
- package/dist/chunks/commands-BdB1eFvP.js +0 -1
- package/dist/chunks/commitAttribution-D6J3NuhB.js +0 -1
- package/dist/chunks/config-Bxt1UH1T.js +0 -1
- package/dist/chunks/config-CjjXZfNi.js +0 -1
- package/dist/chunks/context-noninteractive-DvGo1l7b.js +0 -1
- package/dist/chunks/conversation-CH9ouFai.js +0 -1
- package/dist/chunks/createSession-DUfOAeyE.js +0 -1
- package/dist/chunks/doctor-7fgVhEKL.js +0 -1
- package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +0 -1
- package/dist/chunks/extra-usage-CLhv1Z4g.js +0 -1
- package/dist/chunks/extractMemories-B2IAvbXM.js +0 -1
- package/dist/chunks/fast-_G6zcFye.js +0 -1
- package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +0 -1
- package/dist/chunks/hooks-BUJLxdFJ.js +0 -1
- package/dist/chunks/hostGuard-C5xydXZI.js +0 -1
- package/dist/chunks/inboundAttachments-C0nMTtCi.js +0 -1
- package/dist/chunks/language-DfOAuDFc.js +0 -1
- package/dist/chunks/loadAgentsDir-DTbJJff-.js +0 -1
- package/dist/chunks/localSearch-DKv8PRLD.js +0 -1
- package/dist/chunks/model-BQF64tZx.js +0 -1
- package/dist/chunks/model-DvrvG6BB.js +0 -1
- package/dist/chunks/pluginStartupCheck-CoW7073W.js +0 -1
- package/dist/chunks/policyLimits-BkjgMQD0.js +0 -1
- package/dist/chunks/poorMode-qlxqU8Hm.js +0 -1
- package/dist/chunks/prompt-CN7gBNKS.js +0 -1
- package/dist/chunks/prompt-D-zHhqp8.js +0 -1
- package/dist/chunks/sandbox-adapter-LzTcKwBp.js +0 -1
- package/dist/chunks/searchExtraTools-CbJJQqzH.js +0 -1
- package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +0 -1
- package/dist/chunks/sessionMemory-C4JAUZ6V.js +0 -1
- package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +0 -1
- package/dist/chunks/sessionObserver-DMvWci8-.js +0 -1
- package/dist/chunks/sessionStorage-Diyuvt20.js +0 -1
- package/dist/chunks/sinks-CXq8-7Qn.js +0 -1
- package/dist/chunks/skillLearning-1ZfYIzfL.js +0 -1
- package/dist/chunks/thinkback-C6gV2LpU.js +0 -1
- package/dist/chunks/trustedDevice-DUrFWupL.js +0 -1
- package/dist/chunks/undercover-k3JoOKAb.js +0 -1
- package/dist/chunks/upgrade-D7iGU0PQ.js +0 -1
- package/dist/chunks/usage-DbRdMJog.js +0 -1
- package/dist/chunks/useMainLoopModel-DHkRIgNs.js +0 -1
- package/dist/chunks/worktree-DMhP5T0p.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r,s as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{M as s,P as c,Tn as l,Un as u,Wn as d,Z as f,en as p,ht as m,ir as h,kn as g,ln as _,tn as v,vr as y}from"./state-ix0xIunV.js";import{$g as b,$w as x,Al as S,Ar as C,BT as ee,Bv as w,C as T,Cn as E,D,DD as te,DT as ne,E as O,ED as re,ET as ie,F_ as ae,Fc as k,G as oe,Gw as se,HC as ce,H_ as le,Hy as ue,I_ as de,Ib as fe,Ic as pe,Is as me,JS as A,Jy as j,KT as he,K_ as ge,Ks as _e,Ku as ve,Ky as ye,LD as M,LT as be,Lb as xe,Ls as Se,MT as Ce,Md as N,NC as we,ND as Te,NT as Ee,Nc as De,O_ as Oe,Oi as ke,P as Ae,PC as je,PD as Me,PT as Ne,Pc as Pe,Qi as Fe,Qw as Ie,RC as P,RD as F,R_ as Le,Rv as Re,SD as I,TT as ze,T_ as Be,Tb as Ve,UC as He,Ua as Ue,Us as We,Ut as Ge,Uy as L,V_ as R,Va as z,Vi as Ke,Vs as qe,W as Je,Wi as Ye,Ww as Xe,Xu as Ze,YC as Qe,Yy as $e,ZC as et,Zw as B,_c as V,_g as tt,_i as nt,_w as rt,aT as it,ag as at,as as ot,ax as st,b as ct,bb as lt,bc as ut,cC as dt,cT as ft,ca as pt,cf as mt,cg as ht,cr as gt,cs as _t,cu as vt,cw as yt,cy as bt,dg as xt,eT as St,e_ as Ct,ei as wt,ew as Tt,f as Et,fc as Dt,fi as Ot,fs as kt,gb as At,gc as jt,gi as Mt,go as Nt,h_ as Pt,hc as Ft,hg as It,hw as Lt,iT as Rt,ig as zt,ir as Bt,jd as Vt,jr as Ht,ki as Ut,kl as Wt,kr as Gt,lC as Kt,lf as qt,lx as Jt,mc as Yt,mg as Xt,ms as Zt,mw as Qt,nT as $t,n_ as en,ng as tn,o as nn,oC as rn,oT as an,os as on,pT as sn,pc as cn,pg as ln,pi as un,pw as dn,qS as fn,qT as pn,qi as mn,qu as hn,qy as gn,rT as _n,s as vn,sC as H,sT as yn,su as bn,sy as xn,tT as Sn,tw as Cn,ty as wn,uu as Tn,uw as En,vb as Dn,vc as On,vg as kn,vw as An,wb as jn,wn as Mn,x as Nn,xc as Pn,yD as Fn,yb as In,yc as Ln,yn as Rn,yw as zn,zC as Bn,zo as Vn,zy as Hn}from"./loadAgentsDir-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r,s as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{M as s,P as c,Tn as l,Un as u,Wn as d,Z as f,en as p,ht as m,ir as h,kn as g,ln as _,tn as v,vr as y}from"./state-ix0xIunV.js";import{$g as b,$w as x,Al as S,Ar as C,BT as ee,Bv as w,C as T,Cn as E,D,DD as te,DT as ne,E as O,ED as re,ET as ie,F_ as ae,Fc as k,G as oe,Gw as se,HC as ce,H_ as le,Hy as ue,I_ as de,Ib as fe,Ic as pe,Is as me,JS as A,Jy as j,KT as he,K_ as ge,Ks as _e,Ku as ve,Ky as ye,LD as M,LT as be,Lb as xe,Ls as Se,MT as Ce,Md as N,NC as we,ND as Te,NT as Ee,Nc as De,O_ as Oe,Oi as ke,P as Ae,PC as je,PD as Me,PT as Ne,Pc as Pe,Qi as Fe,Qw as Ie,RC as P,RD as F,R_ as Le,Rv as Re,SD as I,TT as ze,T_ as Be,Tb as Ve,UC as He,Ua as Ue,Us as We,Ut as Ge,Uy as L,V_ as R,Va as z,Vi as Ke,Vs as qe,W as Je,Wi as Ye,Ww as Xe,Xu as Ze,YC as Qe,Yy as $e,ZC as et,Zw as B,_c as V,_g as tt,_i as nt,_w as rt,aT as it,ag as at,as as ot,ax as st,b as ct,bb as lt,bc as ut,cC as dt,cT as ft,ca as pt,cf as mt,cg as ht,cr as gt,cs as _t,cu as vt,cw as yt,cy as bt,dg as xt,eT as St,e_ as Ct,ei as wt,ew as Tt,f as Et,fc as Dt,fi as Ot,fs as kt,gb as At,gc as jt,gi as Mt,go as Nt,h_ as Pt,hc as Ft,hg as It,hw as Lt,iT as Rt,ig as zt,ir as Bt,jd as Vt,jr as Ht,ki as Ut,kl as Wt,kr as Gt,lC as Kt,lf as qt,lx as Jt,mc as Yt,mg as Xt,ms as Zt,mw as Qt,nT as $t,n_ as en,ng as tn,o as nn,oC as rn,oT as an,os as on,pT as sn,pc as cn,pg as ln,pi as un,pw as dn,qS as fn,qT as pn,qi as mn,qu as hn,qy as gn,rT as _n,s as vn,sC as H,sT as yn,su as bn,sy as xn,tT as Sn,tw as Cn,ty as wn,uu as Tn,uw as En,vb as Dn,vc as On,vg as kn,vw as An,wb as jn,wn as Mn,x as Nn,xc as Pn,yD as Fn,yb as In,yc as Ln,yn as Rn,yw as zn,zC as Bn,zo as Vn,zy as Hn}from"./loadAgentsDir-D206qwP3.js";import{n as Un,t as Wn}from"./cwd-CYmmnQVS.js";import{C as Gn,F as U,S as Kn,W as qn,a as Jn,d as Yn,l as W,nt as Xn,o as Zn,p as Qn,rt as $n,w as G,z as er}from"./debug-BrXObCdR.js";import{St as tr,Y as nr,_n as rr,ct as ir,d as ar,f as or,g as sr,ht as cr,ot as K,yn as lr}from"./settings-BovzmwMP.js";import{L as ur,P as dr}from"./config-DmomySWC.js";import{i as fr,n as pr,o as q}from"./process-gEbdy6uY.js";import{M as mr,N as hr,j as gr}from"./git-Do0wJvux.js";import{U as _r,Y as vr,c as yr,i as br,o as xr,s as J}from"./log-BMCygSzM.js";import{i as Sr,n as Cr}from"./path-D5U-tm91.js";import{s as wr,u as Tr}from"./types-C-MRCL8J.js";import{n as Er,r as Y}from"./analytics-BotDBGh0.js";import{Bt as Dr,C as Or,Mn as kr,Si as Ar,Y as jr,_ as Mr,_n as Nr,bi as Pr,br as Fr,bt as Ir,et as Lr,ii as Rr,it as zr,jn as Br,o as Vr,oi as Hr,rt as Ur,tt as Wr,u as Gr,vn as Kr,wi as qr,x as Jr,xi as Yr,xr as Xr}from"./model-CKkOnnnx.js";import{Dt as Zr,En as Qr,Ot as $r,Tn as ei,Zt as ti,an as ni,dt as ri,ut as ii}from"./prompt-BNHtszmZ.js";import{c as ai,s as oi}from"./pluginFlagging-D9HKAGBC.js";import{a as si,o as ci,s as li}from"./fileStateCache-DDW5toIs.js";import{A as ui,C as di,D as fi,N as pi,O as mi,P as hi,_ as gi,d as _i,g as vi,h as yi,lt as bi,m as xi,u as Si,v as Ci,y as wi}from"./rcDebugLog-CUy1_F23.js";import{c as Ti,l as Ei}from"./commitAttribution-ChAgixdj.js";import{t as Di}from"./pollConfig-DH2oCtFS.js";import{r as Oi}from"./inboundAttachments-CUJE3KaU.js";import{i as ki,n as Ai,s as ji}from"./mappers-BDMZFgKx.js";import{n as Mi,r as Ni}from"./sessionTitle-coed9IuJ.js";import{n as Pi,t as Fi}from"./ccrClient-Iza0L8Zw.js";import{n as Ii,t as Li}from"./HybridTransport-B8V6O6rM.js";import{n as Ri,t as zi}from"./SSETransport-DtpMDekF.js";import{a as Bi,n as Vi,o as Hi}from"./grove-CpqjcGCb.js";import{o as Ui}from"./remoteManagedSettings-Cq994lyc.js";import{i as Wi,r as Gi}from"./auth-BnSrKyJe.js";import{t as Ki}from"./pluginBlocklist-C3H2afWG.js";import{t as qi}from"./onChangeAppState-DBmy2Ow_.js";import{t as Ji}from"./settingsSync-PqU9XGJq.js";import{a as Yi,c as Xi,n as Zi,o as Qi,r as $i,s as ea}from"./reconciler-BXpPyfSY.js";import{n as ta,t as na}from"./toolPool-B64V-jmK.js";import{n as ra,r as ia}from"./QueryEngine-CZZMl3PB.js";import{n as aa,r as oa}from"./sideQuestion-wSi38p81.js";import{n as sa,r as ca}from"./context-noninteractive-9hELVC29.js";import{a as la,o as ua,t as da}from"./skillChangeDetector-DNqohXxz.js";import{n as fa,t as pa}from"./refresh-CuaVBIQ0.js";import{dirname as ma,join as ha}from"path";import{PassThrough as ga}from"stream";import{randomUUID as X}from"crypto";import{readFile as _a,stat as va}from"fs/promises";import{URL as ya}from"url";import{cwd as Z}from"process";a(),p(),Un(),Xn(),er(),Kn(),Qn(),pr(),Jn(),gr(),vr(),xr(),Sr(),rr(),wr(),sr(),qr(),ei(),Hr(),Xr(),Br(),Nr(),Dr(),Mr(),ni(),Sn(),pi(),Bn(),dt(),mi(),xn(),_i(),on(),Vn(),Fe(),Ht(),Ji(),r(),Ri();function ba(e,t={},r,i){if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let n=new ya(e.href);return n.protocol===`wss:`?n.protocol=`https:`:n.protocol===`ws:`&&(n.protocol=`http:`),n.pathname=n.pathname.replace(/\/$/,``)+`/worker/events/stream`,new zi(n,t,r,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return n(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new Li(e,t,r,i):new Ii(e,t,r,i);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Ri();var xa=class extends Yi{constructor(e,t,r){let i=new ga({encoding:`utf8`});super(i,r),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=i,this.url=new ya(e);let a={},s=fi();s?a.Authorization=`Bearer ${s}`:W(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;c&&(a[`x-environment-runner-version`]=c);let l=()=>{let e={},t=fi();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e};if(this.transport=ba(this.url,a,m(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Zn(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&q(e.endsWith(`
|
|
2
2
|
`)?e:e+`
|
|
3
3
|
`)}),this.transport.setOnClose(()=>{this.inputStream.end()}),n(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof zi))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Fi(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{mr(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Pi?e.reason:`unknown`}),J(Error(`CCRClient initialization failed: ${U(e)}`)),rn(1,`other`)}),$n(async()=>this.ccrClient?.close()),Ut((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),ke(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};_n((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),Ci((e,t)=>{this.ccrClient?.reportState(e,t)}),gi(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=Di().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{W(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{W(`[remote-io] keep_alive write failed: ${U(e)}`)})},u),this.keepAliveTimer.unref?.()),$n(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
|
|
4
4
|
`)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&q(Qi(e)+`
|
|
@@ -16,8 +16,8 @@ import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r,s
|
|
|
16
16
|
`);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:q(w.result.endsWith(`
|
|
17
17
|
`)?w.result:w.result+`
|
|
18
18
|
`);break;case`error_during_execution`:q(`Execution error`);break;case`error_max_turns`:q(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:q(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:q(`Error: Failed to provide valid structured output after maximum retries.
|
|
19
|
-
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(St(),ur())try{let{drainPendingExtraction:e}=await import(`./extractMemories-B2IAvbXM.js`);await e()}catch{}H(w?.type===`result`&&w?.is_error?1:0)}function Ua(e,r,a,o,d,f,p,g,_,v,y,b){let x=!1,S,C=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{mr(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),rn(0)}),$n(async()=>{let t={};for(let e of ce(g()))xe(e)&&(t[e.type]=(t[e.type]??0)+1);mr(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:Si(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),vi(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:X(),session_id:m()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},re;y.enableAuthStatus&&(re=Fr.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:m()})}));let ae=e=>{let t=ji(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:X(),session_id:m()})};pn.add(ae);let k=d,oe=Qe(d,Z(),100),se=si(100),ue=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;b&&b.kind!==`none`&&ue&&(W(`[print.ts] Auto-resuming interrupted turn (kind: ${b.kind})`),Xa(k,b.message),ne({mode:`prompt`,value:b.message.message.content,uuid:X()}));let fe=Vt().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?Vr():Or(t),r=En(n),i=zr(e.value),a=kr(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),pe=y.userSpecifiedModel;function me(e,t){let n=Nt(e,Jr(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:m(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let A=[],j=[],he=new Set;function _e(t){for(let n of t){if(n.type!==`connected`||he.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(Re,async(n,r)=>{yr(t,`Elicitation request received in print mode: ${G(n)}`);let i=n.params.mode===`url`?`url`:`form`;Y(`tengu_mcp_elicitation_shown`,{mode:i});let a=await tt(t,n.params,r.signal);if(a)return yr(t,`Elicitation resolved by hook: ${G(a)}`),Y(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),u=await kn(t,l,r.signal,i,c);return Y(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(w,e=>{let{elicitationId:n}=e.params;yr(t,`Elicitation completion notification: ${n}`),Ge({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:X(),session_id:m()})}),he.add(t)}catch{}}}async function ye(){let t=new Set(Object.keys(p)),n=new Set(A.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=A.some(e=>e.type===`pending`),o=A.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of A)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Xt(p,(t,n)=>e.sendMcpMessage(t,n));A=r.clients,j=r.tools;let i=lr([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(K(t)))),...j]}})),zn(A)}}ye();let M={clients:[],tools:[],configs:{}},Se=e=>{let t=ve(e.toolPermissionContext,e.mcp.tools),n=Me(ta([...o,...j,...M.tools],t,e.toolPermissionContext.mode),`name`);y.permissionPromptToolName&&(n=n.filter(e=>!Qr(e,y.permissionPromptToolName)));let r=c();if(r&&!y.jsonSchema){let e=ii(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,Te=0;function Oe(){if(!N)return;let e=Math.min(Te,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);Te=k.length,t.length>0&&N.writeMessages(t)}let ke=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Ae(e){let t=async()=>{let t=new Set(A.map(e=>e.name)),n=await to(e,{configs:p,clients:A,tools:j},M,_);for(let e of Object.keys(p))delete p[e];if(Object.assign(p,n.newSdkState.configs),A=n.newSdkState.clients,j=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(A.map(e=>e.name)),n=lr([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(K(t)))),...j]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return ke=ke.then(t,t),ke}function je(){let e=g(),t=e.mcp.clients,n=Me([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...A.map(e=>e.name)]);return[...t,...A,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Be(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Ne(){try{await Promise.all([Promise.resolve(),hr(`headless_managed_settings_wait`,()=>Ui())]),await Pa()&&await He()}catch(e){J(e)}}let Pe=null;i()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Pe=Ne():Ne());let Fe=Da(()=>!x),P=a,I=v;async function Ve(){let{agentDefinitions:e}=await fa(_);P=await mn(Z());let t=I.filter(e=>e.source===`flagSettings`);I=[...e.allAgents,...t]}async function He(){let{servers:e}=await de(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(p))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Ae(t);r&&ye(),W(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=da.subscribe(()=>{Ke(),mn(Z()).then(e=>{P=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await ft({basePrompt:`<${_r}>${new Date().toLocaleTimeString()}</${_r}>`,currentDir:Z(),shouldCreate:()=>!C});if(C){await Rt({commands:e});return}for(let t of e)ne({...t,uuid:X()});L()})().catch(e=>{J(e),W(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};ee(()=>{E&&Ce(`now`).length>0&&E.abort(`interrupt`)});let L=async()=>{if(x)return;if(x=!0,S=void 0,yi(`running`),Fe.stop(),B(`run_entry`),await ye(),B(`after_updateSdkMcp`),Pe){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=Kr(e).then(()=>`timeout`);await Promise.race([Pe,t])===`timeout`&&(J(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),Y(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Pe;Pe=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-Cvd5VdjQ.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=ze(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Va(r,be(n));)i.push(ze(n));let a=await it(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Ba(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(y.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:m(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),l=[...s.mcp.clients,...A,...M.clients];_e(l);let u=Se(s);for(let e of o)$t(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:m(),uuid:X()})}let d=r.value,p=a.claimedCommands;if(e instanceof xa&&r.mode===`prompt`&&Y(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&Qt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=Xe(),B(`before_ask`),Tn();let h=r,v=!1;try{if(await Yr(h.workload??y.workload,async()=>{for await(let t of ra({commands:Me([...P,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:Z(),tools:u,verbose:y.verbose,mcpClients:l,thinkingConfig:y.thinkingConfig,maxTurns:y.maxTurns,maxBudgetUsd:y.maxBudgetUsd,taskBudget:y.taskBudget,canUseTool:f,userSpecifiedModel:pe,fallbackModel:y.fallbackModel,jsonSchema:c()??y.jsonSchema,mutableMessages:k,getReadFileCache:()=>se.size===0?oe:li(oe,se),setReadFileCache:e=>{oe=e;for(let[e,t]of se.entries()){let n=oe.get(e);(!n||t.timestamp>n.timestamp)&&oe.set(e,t)}se.clear()},customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:y.replayUserMessages,includePartialMessages:y.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:I,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:m(),uuid:X()})}}))if(Oe(),t.type===`result`){v=!!t.is_error;for(let e of ui())D.enqueue(e);ce(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&xe(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of ui())D.enqueue(e);D.enqueue(t)}}),v)await an({commands:p,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:Z(),priority:`later`,workload:h.workload??y.workload});else{let e=await an({commands:p,outcome:{type:`completed`},currentDir:Z(),priority:`later`,workload:h.workload??y.workload});for(let t of e)ne({...t,uuid:X()})}}catch(e){throw await an({commands:p,outcome:{type:`failed`,error:e},currentDir:Z(),priority:`later`,workload:h.workload??y.workload}),e}for(let e of o)$t(e,`completed`);if(Oe(),N?.sendResult(),y.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=Wt();if(!t)Lt(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await rt(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:X(),session_id:m()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Lt(`aborted`,void 0,void 0,`sdk`);return}J(qn(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}St(),vt(),Ie()}};do{for(let e of ui())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=ce(g()).some(e=>xe(e)),t=be(n)!==void 0;(e||t)&&(i=!0,t||(S=`waiting_for_agents`,await Kr(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:bi,modelUsage:{},permission_denials:[],uuid:X(),errors:[U(t),...br().map(e=>e.error)]})}catch{}O.abortController?.abort(),H(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Kt()){yi(`idle`);for(let e of ui())D.enqueue(e)}x=!1,Fe.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&be(n)===void 0&&!C){We();return}if(be(n)!==void 0){L();return}C&&(O.inflightPromise&&await Promise.race([O.inflightPromise,Kr(5e3)]),O.abortController?.abort(),O.abortController=null,await De(),Ue(),re?.(),pn.delete(ae),D.done())},R=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},z=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},qe=new Set;e.setUnexpectedResponseCallback(async e=>{await $a({message:e,setAppState:_,handledToolUseIds:qe,onEnqueued:()=>{L()}})});let Je=new Map,Ze=new Map,$e=new Set,et=new Map,V=null;return(async()=>{let t=!1;mr(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&$t(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,R(i);else if(o.subtype===`end_session`){W(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,R(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)p[e]={type:`sdk`,name:e};await Ka(i.request,i.request_id,t,D,a,fe,e,!!y.enableAuthStatus,y,v,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&h(!0),t=!0,Ee()&&L()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Ja(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e==="default"?Vr():e;pe=t,u(t),xi({model:t}),me(e,t),R(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?y.thinkingConfig=void 0:i.request.max_thinking_tokens===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},R(i);else if(i.request.subtype===`mcp_status`)R(i,{mcpServers:je()});else if(i.request.subtype===`get_context_usage`)try{let e=g(),t=await sa({messages:k,getAppState:g,options:{mainLoopModel:Gr(),tools:Se(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt}});R(i,{...t})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=A.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),R(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await qa(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?R(i,t):z(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid,t=ie(t=>t.uuid===e);R(i,{cancelled:t.length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=Cr(i.request.path),t=Math.floor((await va(e)).mtimeMs);if(t<=i.request.mtime){let n=await _a(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
19
|
+
Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(St(),ur())try{let{drainPendingExtraction:e}=await import(`./extractMemories-BcaklA33.js`);await e()}catch{}H(w?.type===`result`&&w?.is_error?1:0)}function Ua(e,r,a,o,d,f,p,g,_,v,y,b){let x=!1,S,C=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{mr(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),rn(0)}),$n(async()=>{let t={};for(let e of ce(g()))xe(e)&&(t[e.type]=(t[e.type]??0)+1);mr(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:Si(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),vi(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:X(),session_id:m()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},re;y.enableAuthStatus&&(re=Fr.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:m()})}));let ae=e=>{let t=ji(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:X(),session_id:m()})};pn.add(ae);let k=d,oe=Qe(d,Z(),100),se=si(100),ue=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;b&&b.kind!==`none`&&ue&&(W(`[print.ts] Auto-resuming interrupted turn (kind: ${b.kind})`),Xa(k,b.message),ne({mode:`prompt`,value:b.message.message.content,uuid:X()}));let fe=Vt().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?Vr():Or(t),r=En(n),i=zr(e.value),a=kr(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),pe=y.userSpecifiedModel;function me(e,t){let n=Nt(e,Jr(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:m(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let A=[],j=[],he=new Set;function _e(t){for(let n of t){if(n.type!==`connected`||he.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(Re,async(n,r)=>{yr(t,`Elicitation request received in print mode: ${G(n)}`);let i=n.params.mode===`url`?`url`:`form`;Y(`tengu_mcp_elicitation_shown`,{mode:i});let a=await tt(t,n.params,r.signal);if(a)return yr(t,`Elicitation resolved by hook: ${G(a)}`),Y(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),u=await kn(t,l,r.signal,i,c);return Y(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(w,e=>{let{elicitationId:n}=e.params;yr(t,`Elicitation completion notification: ${n}`),Ge({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:X(),session_id:m()})}),he.add(t)}catch{}}}async function ye(){let t=new Set(Object.keys(p)),n=new Set(A.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=A.some(e=>e.type===`pending`),o=A.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of A)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Xt(p,(t,n)=>e.sendMcpMessage(t,n));A=r.clients,j=r.tools;let i=lr([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(K(t)))),...j]}})),zn(A)}}ye();let M={clients:[],tools:[],configs:{}},Se=e=>{let t=ve(e.toolPermissionContext,e.mcp.tools),n=Me(ta([...o,...j,...M.tools],t,e.toolPermissionContext.mode),`name`);y.permissionPromptToolName&&(n=n.filter(e=>!Qr(e,y.permissionPromptToolName)));let r=c();if(r&&!y.jsonSchema){let e=ii(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,Te=0;function Oe(){if(!N)return;let e=Math.min(Te,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);Te=k.length,t.length>0&&N.writeMessages(t)}let ke=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Ae(e){let t=async()=>{let t=new Set(A.map(e=>e.name)),n=await to(e,{configs:p,clients:A,tools:j},M,_);for(let e of Object.keys(p))delete p[e];if(Object.assign(p,n.newSdkState.configs),A=n.newSdkState.clients,j=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(A.map(e=>e.name)),n=lr([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(K(t)))),...j]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return ke=ke.then(t,t),ke}function je(){let e=g(),t=e.mcp.clients,n=Me([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...A.map(e=>e.name)]);return[...t,...A,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Be(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Ne(){try{await Promise.all([Promise.resolve(),hr(`headless_managed_settings_wait`,()=>Ui())]),await Pa()&&await He()}catch(e){J(e)}}let Pe=null;i()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Pe=Ne():Ne());let Fe=Da(()=>!x),P=a,I=v;async function Ve(){let{agentDefinitions:e}=await fa(_);P=await mn(Z());let t=I.filter(e=>e.source===`flagSettings`);I=[...e.allAgents,...t]}async function He(){let{servers:e}=await de(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(p))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Ae(t);r&&ye(),W(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=da.subscribe(()=>{Ke(),mn(Z()).then(e=>{P=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await ft({basePrompt:`<${_r}>${new Date().toLocaleTimeString()}</${_r}>`,currentDir:Z(),shouldCreate:()=>!C});if(C){await Rt({commands:e});return}for(let t of e)ne({...t,uuid:X()});L()})().catch(e=>{J(e),W(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};ee(()=>{E&&Ce(`now`).length>0&&E.abort(`interrupt`)});let L=async()=>{if(x)return;if(x=!0,S=void 0,yi(`running`),Fe.stop(),B(`run_entry`),await ye(),B(`after_updateSdkMcp`),Pe){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=Kr(e).then(()=>`timeout`);await Promise.race([Pe,t])===`timeout`&&(J(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),Y(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Pe;Pe=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-Ddhsyn0_.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=ze(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Va(r,be(n));)i.push(ze(n));let a=await it(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Ba(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(y.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:m(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),l=[...s.mcp.clients,...A,...M.clients];_e(l);let u=Se(s);for(let e of o)$t(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:m(),uuid:X()})}let d=r.value,p=a.claimedCommands;if(e instanceof xa&&r.mode===`prompt`&&Y(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&Qt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=Xe(),B(`before_ask`),Tn();let h=r,v=!1;try{if(await Yr(h.workload??y.workload,async()=>{for await(let t of ra({commands:Me([...P,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:Z(),tools:u,verbose:y.verbose,mcpClients:l,thinkingConfig:y.thinkingConfig,maxTurns:y.maxTurns,maxBudgetUsd:y.maxBudgetUsd,taskBudget:y.taskBudget,canUseTool:f,userSpecifiedModel:pe,fallbackModel:y.fallbackModel,jsonSchema:c()??y.jsonSchema,mutableMessages:k,getReadFileCache:()=>se.size===0?oe:li(oe,se),setReadFileCache:e=>{oe=e;for(let[e,t]of se.entries()){let n=oe.get(e);(!n||t.timestamp>n.timestamp)&&oe.set(e,t)}se.clear()},customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:y.replayUserMessages,includePartialMessages:y.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:I,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:m(),uuid:X()})}}))if(Oe(),t.type===`result`){v=!!t.is_error;for(let e of ui())D.enqueue(e);ce(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&xe(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of ui())D.enqueue(e);D.enqueue(t)}}),v)await an({commands:p,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:Z(),priority:`later`,workload:h.workload??y.workload});else{let e=await an({commands:p,outcome:{type:`completed`},currentDir:Z(),priority:`later`,workload:h.workload??y.workload});for(let t of e)ne({...t,uuid:X()})}}catch(e){throw await an({commands:p,outcome:{type:`failed`,error:e},currentDir:Z(),priority:`later`,workload:h.workload??y.workload}),e}for(let e of o)$t(e,`completed`);if(Oe(),N?.sendResult(),y.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=Wt();if(!t)Lt(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await rt(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:X(),session_id:m()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Lt(`aborted`,void 0,void 0,`sdk`);return}J(qn(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}St(),vt(),Ie()}};do{for(let e of ui())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=ce(g()).some(e=>xe(e)),t=be(n)!==void 0;(e||t)&&(i=!0,t||(S=`waiting_for_agents`,await Kr(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:bi,modelUsage:{},permission_denials:[],uuid:X(),errors:[U(t),...br().map(e=>e.error)]})}catch{}O.abortController?.abort(),H(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Kt()){yi(`idle`);for(let e of ui())D.enqueue(e)}x=!1,Fe.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&be(n)===void 0&&!C){We();return}if(be(n)!==void 0){L();return}C&&(O.inflightPromise&&await Promise.race([O.inflightPromise,Kr(5e3)]),O.abortController?.abort(),O.abortController=null,await De(),Ue(),re?.(),pn.delete(ae),D.done())},R=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},z=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},qe=new Set;e.setUnexpectedResponseCallback(async e=>{await $a({message:e,setAppState:_,handledToolUseIds:qe,onEnqueued:()=>{L()}})});let Je=new Map,Ze=new Map,$e=new Set,et=new Map,V=null;return(async()=>{let t=!1;mr(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&$t(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,R(i);else if(o.subtype===`end_session`){W(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,R(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)p[e]={type:`sdk`,name:e};await Ka(i.request,i.request_id,t,D,a,fe,e,!!y.enableAuthStatus,y,v,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&h(!0),t=!0,Ee()&&L()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Ja(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e==="default"?Vr():e;pe=t,u(t),xi({model:t}),me(e,t),R(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?y.thinkingConfig=void 0:i.request.max_thinking_tokens===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},R(i);else if(i.request.subtype===`mcp_status`)R(i,{mcpServers:je()});else if(i.request.subtype===`get_context_usage`)try{let e=g(),t=await sa({messages:k,getAppState:g,options:{mainLoopModel:Gr(),tools:Se(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt}});R(i,{...t})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=A.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),R(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await qa(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?R(i,t):z(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid,t=ie(t=>t.uuid===e);R(i,{cancelled:t.length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=Cr(i.request.path),t=Math.floor((await va(e)).mtimeMs);if(t<=i.request.mtime){let n=await _a(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
|
|
20
20
|
`,`
|
|
21
|
-
`);se.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}R(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Ae(i.request.servers);R(i,e),t&&ye()}else if(i.request.subtype===`reload_plugins`)try{let e=await fa(_),t=I.filter(e=>e.source===`flagSettings`);I=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([mn(Z()),He(),Zt()]);r.status===`fulfilled`?P=r.value:J(r.reason),a.status===`rejected`&&J(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):J(o.reason),R(i,{commands:P.filter(e=>e.userInvocable!==!1).map(e=>({name:pt(e),description:Ye(e),argumentHint:e.argumentHint||``})),agents:I.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:je(),error_count:e.error_count})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;he.delete(t);let n=Le(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)z(i,`Server not found: ${t}`);else{let e=await ln(t,n),r=K(t);if(_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...F(n.mcp.commands,e=>Pt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:ai(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)_e([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;he.delete(t);let a=Le(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)z(i,`Server not found: ${t}`);else if(n){ge(t,!0);let e=await ln(t,a),n=K(t);if(_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...F(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...F(r.mcp.commands,e=>Pt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:ai(r.mcp.resources,t)}})),e.client.type===`connected`)_e([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}else{ge(t,!1);let n=[...r,...A,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await zt(t,a);let o=K(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:F(e.mcp.tools,e=>e.name?.startsWith(o)),commands:F(e.mcp.commands,e=>Pt(e,t)),resources:ai(e.mcp.resources,t)}})),R(i)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=Le(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Je.get(e)?.abort();let t=new AbortController;Je.set(e,t);let r,a=new Promise(e=>{r=e}),o=Ct(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{Ze.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?R(i,{authUrl:s,requiresUserAction:!0}):R(i,{requiresUserAction:!1}),et.set(e,o),o.then(async()=>{if(le(e)||$e.has(e))return;let t=await ln(e,n),r=K(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...F(n.mcp.commands,t=>Pt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ai(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{W(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Je.get(e)===t&&(Je.delete(e),Ze.delete(e),$e.delete(e),et.delete(e))})}catch(e){z(i,U(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=Ze.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)z(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{$e.add(e),n(t);let r=et.get(e);if(r)try{await r,R(i)}catch(e){z(i,e instanceof Error?e.message:`OAuth authentication failed`)}else R(i)}}else z(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;V?.service.cleanup(),Y(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Wi,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Gi(t),Y(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),V?.service===t&&(V=null)});V={service:t,flow:a},a.catch(e=>W(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);R(i,{manualUrl:e,automaticUrl:t})}catch(e){z(i,U(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!V)z(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&V.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=V;e.then(()=>{let e=Ir();R(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:Ar()}})},e=>z(i,U(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=Le(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Cannot clear auth for server type "${n.type}"`);else{await en(e,n);let t=await ln(e,n),r=K(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...F(n.mcp.commands,t=>Pt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ai(n.mcp.resources,e)}})),R(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=Gr(),t=s()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];l(r),te.notifyChange(`flagSettings`),`model`in n&&(n.model==null?u(void 0):u(String(n.model)));let a=Gr();if(a!==e){pe=a;let e=n.model?String(n.model):`default`;xi({model:a}),me(e,a)}R(i)}else if(i.request.subtype===`get_settings`){let e=Gr();R(i,{...ar(),applied:{model:e}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await qt(e,{getAppState:g,setAppState:_}),R(i,{})}catch(e){z(i,U(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:Xe()).signal;(async()=>{try{let r=await Mi(e,n);if(r&&t)try{nt(m(),r)}catch(e){J(e)}R(i,{title:r})}catch(e){z(i,U(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Wt(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:Xe()}}:await ia({tools:Se(g()),commands:P,mcpClients:[...g().mcp.clients,...A,...M.clients],messages:k,readFileState:oe,getAppState:g,setAppState:_,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,thinkingConfig:y.thinkingConfig,agents:I}),r=await oa({question:e,cacheSafeParams:n});R(i,{response:r.response})}catch(e){z(i,U(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),R(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)R(i,{session_url:we(N.bridgeSessionId,N.sessionIngressUrl),connect_url:st(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-DJs28ZkI.js`),r=await n({onInboundMessage(e){let t=$i(e);if(!t)return;let{content:n,uuid:r}=t;ne({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),L()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e==="default"?Vr():e;pe=t,u(t)},onSetMaxThinkingTokens(e){e===null?y.thinkingConfig=void 0:e===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),W(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:X(),session_id:m()})},initialMessages:k.length>0?k:void 0});r?(N=r,Te=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),R(i,{session_url:we(r.bridgeSessionId,r.sessionIngressUrl),connect_url:st(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):z(i,t??`Remote Control initialization failed`)}catch(e){z(i,U(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),R(i);else z(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){y.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=ki([n]);k.push(...e),n.type===`assistant`&&y.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=m(),t=await Bt(e,o.uuid);if(t||Ia.has(o.uuid)){W(`Skipping duplicate user message: ${o.uuid}`),y.replayUserMessages&&(W(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&$t(o.uuid,`completed`);continue}Ra(o.uuid)}ne({mode:`prompt`,value:await Oi(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:Ti(e.attribution,e=>{wt(e).catch(e=>{W(`Attribution: Failed to save snapshot: ${e}`)})})})),L()}C=!0,x||(O.inflightPromise&&await Promise.race([O.inflightPromise,Kr(5e3)]),O.abortController?.abort(),O.abortController=null,await De(),Ue(),re?.(),pn.delete(ae),D.done())})(),D}function Wa(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Je(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=E(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Xi(ea().parse(Tr(h.content[0].text)),e,r,i)};return t}function Ga(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Je(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Qr(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),H(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),H(1),Error(t)}i=Wa(r)}return i(t,r,a,o,s,c)}}async function Ka(e,t,n,r,i,a,o,s,c,l,p){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Et(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=f()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(d(t.agentType),!c.systemPrompt&&!vn(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&u(Or(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let h=or()?.outputStyle||`default`,v=await ot(Wn()),y=Ir();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});_(t)}e.jsonSchema&&g(e.jsonSchema);let b={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:pt(e),description:Ye(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:h,available_output_styles:Object.keys(v),models:a,account:{email:y?.email,organization:y?.organization,subscriptionType:y?.subscription,tokenSource:y?.tokenSource,apiKeySource:y?.apiKeySource,apiProvider:Ar()},pid:process.pid};if(Ur()&&Wr()){let e=p();b.fast_mode_state=jr(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:b}}),s){let e=Fr.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:m()})}}async function qa(e,t,n,r){if(!In())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Dn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await lt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await jn(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${U(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Ja(e,t,n,r){if(e.mode===`bypassPermissions`){if(D())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!O()){let e=Nn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${ct(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Ae(n.mode,e.mode,n),mode:e.mode}}function Ya(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:bi,modelUsage:{},permission_denials:[],uuid:X(),errors:[e]};process.stdout.write(G(t)+`
|
|
21
|
+
`);se.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}R(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Ae(i.request.servers);R(i,e),t&&ye()}else if(i.request.subtype===`reload_plugins`)try{let e=await fa(_),t=I.filter(e=>e.source===`flagSettings`);I=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([mn(Z()),He(),Zt()]);r.status===`fulfilled`?P=r.value:J(r.reason),a.status===`rejected`&&J(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):J(o.reason),R(i,{commands:P.filter(e=>e.userInvocable!==!1).map(e=>({name:pt(e),description:Ye(e),argumentHint:e.argumentHint||``})),agents:I.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:je(),error_count:e.error_count})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;he.delete(t);let n=Le(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)z(i,`Server not found: ${t}`);else{let e=await ln(t,n),r=K(t);if(_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...F(n.mcp.commands,e=>Pt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:ai(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)_e([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;he.delete(t);let a=Le(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)z(i,`Server not found: ${t}`);else if(n){ge(t,!0);let e=await ln(t,a),n=K(t);if(_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...F(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...F(r.mcp.commands,e=>Pt(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:ai(r.mcp.resources,t)}})),e.client.type===`connected`)_e([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}else{ge(t,!1);let n=[...r,...A,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await zt(t,a);let o=K(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:F(e.mcp.tools,e=>e.name?.startsWith(o)),commands:F(e.mcp.commands,e=>Pt(e,t)),resources:ai(e.mcp.resources,t)}})),R(i)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=Le(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Je.get(e)?.abort();let t=new AbortController;Je.set(e,t);let r,a=new Promise(e=>{r=e}),o=Ct(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{Ze.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?R(i,{authUrl:s,requiresUserAction:!0}):R(i,{requiresUserAction:!1}),et.set(e,o),o.then(async()=>{if(le(e)||$e.has(e))return;let t=await ln(e,n),r=K(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...F(n.mcp.commands,t=>Pt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ai(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{W(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Je.get(e)===t&&(Je.delete(e),Ze.delete(e),$e.delete(e),et.delete(e))})}catch(e){z(i,U(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=Ze.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)z(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{$e.add(e),n(t);let r=et.get(e);if(r)try{await r,R(i)}catch(e){z(i,e instanceof Error?e.message:`OAuth authentication failed`)}else R(i)}}else z(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;V?.service.cleanup(),Y(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Wi,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Gi(t),Y(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),V?.service===t&&(V=null)});V={service:t,flow:a},a.catch(e=>W(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);R(i,{manualUrl:e,automaticUrl:t})}catch(e){z(i,U(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!V)z(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&V.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=V;e.then(()=>{let e=Ir();R(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:Ar()}})},e=>z(i,U(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=Le(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Cannot clear auth for server type "${n.type}"`);else{await en(e,n);let t=await ln(e,n),r=K(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...F(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...F(n.mcp.commands,t=>Pt(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:ai(n.mcp.resources,e)}})),R(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=Gr(),t=s()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];l(r),te.notifyChange(`flagSettings`),`model`in n&&(n.model==null?u(void 0):u(String(n.model)));let a=Gr();if(a!==e){pe=a;let e=n.model?String(n.model):`default`;xi({model:a}),me(e,a)}R(i)}else if(i.request.subtype===`get_settings`){let e=Gr();R(i,{...ar(),applied:{model:e}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await qt(e,{getAppState:g,setAppState:_}),R(i,{})}catch(e){z(i,U(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:Xe()).signal;(async()=>{try{let r=await Mi(e,n);if(r&&t)try{nt(m(),r)}catch(e){J(e)}R(i,{title:r})}catch(e){z(i,U(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=Wt(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:Xe()}}:await ia({tools:Se(g()),commands:P,mcpClients:[...g().mcp.clients,...A,...M.clients],messages:k,readFileState:oe,getAppState:g,setAppState:_,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,thinkingConfig:y.thinkingConfig,agents:I}),r=await oa({question:e,cacheSafeParams:n});R(i,{response:r.response})}catch(e){z(i,U(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),R(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)R(i,{session_url:we(N.bridgeSessionId,N.sessionIngressUrl),connect_url:st(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-JQ-afRx9.js`),r=await n({onInboundMessage(e){let t=$i(e);if(!t)return;let{content:n,uuid:r}=t;ne({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),L()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e==="default"?Vr():e;pe=t,u(t)},onSetMaxThinkingTokens(e){e===null?y.thinkingConfig=void 0:e===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),W(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:X(),session_id:m()})},initialMessages:k.length>0?k:void 0});r?(N=r,Te=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),R(i,{session_url:we(r.bridgeSessionId,r.sessionIngressUrl),connect_url:st(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):z(i,t??`Remote Control initialization failed`)}catch(e){z(i,U(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),R(i);else z(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){y.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=ki([n]);k.push(...e),n.type===`assistant`&&y.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=m(),t=await Bt(e,o.uuid);if(t||Ia.has(o.uuid)){W(`Skipping duplicate user message: ${o.uuid}`),y.replayUserMessages&&(W(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&$t(o.uuid,`completed`);continue}Ra(o.uuid)}ne({mode:`prompt`,value:await Oi(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:Ti(e.attribution,e=>{wt(e).catch(e=>{W(`Attribution: Failed to save snapshot: ${e}`)})})})),L()}C=!0,x||(O.inflightPromise&&await Promise.race([O.inflightPromise,Kr(5e3)]),O.abortController?.abort(),O.abortController=null,await De(),Ue(),re?.(),pn.delete(ae),D.done())})(),D}function Wa(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Je(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=E(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Xi(ea().parse(Tr(h.content[0].text)),e,r,i)};return t}function Ga(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Je(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Qr(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),H(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),H(1),Error(t)}i=Wa(r)}return i(t,r,a,o,s,c)}}async function Ka(e,t,n,r,i,a,o,s,c,l,p){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Et(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=f()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(d(t.agentType),!c.systemPrompt&&!vn(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&u(Or(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let h=or()?.outputStyle||`default`,v=await ot(Wn()),y=Ir();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});_(t)}e.jsonSchema&&g(e.jsonSchema);let b={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:pt(e),description:Ye(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:h,available_output_styles:Object.keys(v),models:a,account:{email:y?.email,organization:y?.organization,subscriptionType:y?.subscription,tokenSource:y?.tokenSource,apiKeySource:y?.apiKeySource,apiProvider:Ar()},pid:process.pid};if(Ur()&&Wr()){let e=p();b.fast_mode_state=jr(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:b}}),s){let e=Fr.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:X(),session_id:m()})}}async function qa(e,t,n,r){if(!In())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Dn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await lt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await jn(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${U(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Ja(e,t,n,r){if(e.mode===`bypassPermissions`){if(D())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!O()){let e=Nn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${ct(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Ae(n.mode,e.mode,n),mode:e.mode}}function Ya(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:bi,modelUsage:{},permission_denials:[],uuid:X(),errors:[e]};process.stdout.write(G(t)+`
|
|
22
22
|
`)}else process.stderr.write(e+`
|
|
23
|
-
`)}function Xa(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function Za(e,t){let r=!v();if(t.continue)try{Y(`tengu_continue_print`,{});let n=await L(void 0,void 0);if(n)return t.forkSession||n.sessionId&&(y(P(n.sessionId),n.fullPath?ma(n.fullPath):null),r&&await Ot()),ua(n,e),un(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return J(e),H(1),{messages:[]}}if(t.teleport)try{if(!Ue(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(Y(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-
|
|
23
|
+
`)}function Xa(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function Za(e,t){let r=!v();if(t.continue)try{Y(`tengu_continue_print`,{});let n=await L(void 0,void 0);if(n)return t.forkSession||n.sessionId&&(y(P(n.sessionId),n.fullPath?ma(n.fullPath):null),r&&await Ot()),ua(n,e),un(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return J(e),H(1),{messages:[]}}if(t.teleport)try{if(!Ue(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(Y(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-dtqQXM4x.js`);await i();let a=await r(t.teleport),{branchError:o}=await e(a.branch);return{messages:n(a.log,o)}}catch(e){return J(e),H(1),{messages:[]}}if(t.resume)try{Y(`tengu_resume_print`,{});let i=Oa(typeof t.resume==`string`?t.resume:``);if(!i){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),Ya(e,t.outputFormat),H(1),{messages:[]}}if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([Gt(i.sessionId),t.restoredWorkerState]);n&&(e(qi(n)),typeof n.model==`string`&&u(n.model))}else i.isUrl&&i.ingressUrl&&n(process.env.ENABLE_SESSION_PERSISTENCE)&&await C(i.sessionId,i.ingressUrl);let a=await L(i.sessionId,i.jsonlFile||void 0);if(!a||a.messages.length===0)return i.isUrl||n(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(t.sessionStartHooksPromise??gn(`startup`))}:(Ya(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),H(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return Ya(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),H(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&(y(P(a.sessionId),a.fullPath?ma(a.fullPath):null),r&&await Ot()),ua(a,e),un(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return J(e),Ya(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),H(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??gn(`startup`))}}function Qa(e,t){let n;return n=typeof e==`string`?e.trim()===``?Tt([]):Tt([G({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new xa(t.sdkUrl,n,t.replayUserMessages):new Yi(n,t.replayUserMessages)}async function $a({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(W(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return W(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await gt(t);return a?(r.add(t),W(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),ne({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(W(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function eo(e){return{...e,scope:`dynamic`}}async function to(e,t,n,r){let{allowed:i,blocked:a}=ae(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await no(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function no(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!tn(r,eo(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){J(e)}await zt(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=eo(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await at(t,r);if(d.push(e),e.type===`connected`){let t=await ht(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=qn(e);u[t]=n.message,J(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=eo(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Ha as runHeadless};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,r as i}from"./analytics-BotDBGh0.js";import{a,i as o,o as s,r as c}from"./grove-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,r as i}from"./analytics-BotDBGh0.js";import{a,i as o,o as s,r as c}from"./grove-CpqjcGCb.js";import{n as l,r as u,t as d}from"./Grove-BJziCbZH.js";async function f(e){if(!await s())return e(m),null;let[t,n]=await Promise.all([o(),c()]);if(!t.success)return e(m),null;let r=t.data,a=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await o();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:a?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),a(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,fi as n,t as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Ap as a,BC as o,Gg as s,Hp as c,Jm as l,So as u,VC as d,Vp as f,Wg as p,Ym as m,Yo as h,_u as g,kp as _,vo as v,vu as y,xo as b,zo as x}from"./loadAgentsDir-
|
|
1
|
+
import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,fi as n,t as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Ap as a,BC as o,Gg as s,Hp as c,Jm as l,So as u,VC as d,Vp as f,Wg as p,Ym as m,Yo as h,_u as g,kp as _,vo as v,vu as y,xo as b,zo as x}from"./loadAgentsDir-D206qwP3.js";import{F as S,j as C,z as w}from"./debug-BrXObCdR.js";import{g as T,n as E}from"./settings-BovzmwMP.js";import{n as D,r as O}from"./analytics-BotDBGh0.js";import{Ot as k,kt as A}from"./prompt-BNHtszmZ.js";import{randomUUID as j}from"crypto";n(),r(),y(),m(),c();var M=i();function N({input:e,progress:n,verbose:r}){return(0,M.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(l,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),n?(0,M.jsx)(f,{fullOutput:n.fullOutput,output:n.output,elapsedTimeSeconds:n.elapsedTimeSeconds,totalLines:n.totalLines,verbose:r}):g.renderToolUseProgressMessage?.([],{verbose:r,tools:[],terminalSize:void 0})]})}w(),D(),p(),x(),T();function P(){return E().defaultShell??`bash`}y(),k(),d();async function F(t,n,r,i,c){let l=A()&&P()===`powershell`;O(`tengu_input_bash`,{powershell:l});let d=u({content:h({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),f;c({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{f=e?.jsx}},p=e=>{c({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),f]}),shouldHidePromptInput:!1,showSpinner:!1})},m=null;l&&(m=(a(),e(_)).PowerShellTool);let h=m??g,y=(m?await m.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,p):await g.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,p)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await s(h,{...y,stderr:``},j()),S=typeof x.content==`string`?x.content:o(y.stdout);return{messages:[v(),d,...r,u({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${o(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[v(),d,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[v(),d,...r,u({content:`<bash-stdout>${o(e.stdout)}</bash-stdout><bash-stderr>${o(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[v(),d,...r,u({content:`<bash-stderr>Command failed: ${o(S(e))}</bash-stderr>`})],shouldQuery:!1}}finally{c(null)}}export{F as processBashCommand};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nr as r,t as i}from"./state-ix0xIunV.js";import{$S as a,Al as o,Bo as s,C as c,DE as l,DT as u,Dc as d,Ec as f,Eo as p,G as m,Gh as h,Gw as g,Hx as _,JE as v,Jd as y,Jw as b,KE as x,Kh as S,Ki as C,OT as w,Ol as T,PT as E,QS as D,Qi as ee,Sl as te,So as O,Th as k,Ui as ne,Ux as re,W as ie,Wh as ae,Wo as oe,Ww as se,Yd as ce,Yo as A,Zi as le,_O as ue,aO as de,bl as fe,ca as j,dy as pe,eC as me,fy as M,gO as he,ho as N,hy as ge,jl as _e,k as P,kc as F,lT as I,nw as ve,oO as L,oy as ye,pT as be,qo as xe,qw as Se,sO as R,sy as Ce,tw as we,uT as Te,uy as Ee,vo as z,wE as De,wh as Oe,xo as ke,yo as Ae,zi as je,zo as Me}from"./loadAgentsDir-Clu7Uk6a.js";import{A as B,D as Ne,a as V,d as Pe,l as H,p as Fe,z as Ie}from"./debug-BrXObCdR.js";import{Mt as Le,jt as Re}from"./settings-Dlp5JTa_.js";import{T as U,Y as ze,o as Be,s as W,w as G}from"./log-BMCygSzM.js";import{f as Ve,l as He}from"./file-DcZWPH2V.js";import{n as Ue,r as K}from"./analytics-BotDBGh0.js";import{_n as We,bi as Ge,vn as Ke,yi as qe}from"./model-BQF64tZx.js";import{ct as Je,ot as Ye}from"./esm-CGoYrggU.js";import{E as Xe,T as Ze,w as Qe}from"./sessionTracing-D8wr9j4X.js";import{n as $e,t as et}from"./slashCommandParsing-RQb_7Xzt.js";import{randomUUID as q}from"crypto";function tt(e,t,n,r,i){let a=0;for(let o of Re){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{H(`Removing one-shot hook for event ${o} in skill '${r}'`),S(e,t,o,s)}:void 0;ae(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&H(`Registered ${a} hooks from skill '${r}'`)}var nt=e((()=>{Le(),V(),h()}));function J(){return!1}function rt(){if(!J())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function it(e,t,n,r,i,a,o){let s=ye(),c=e.pluginInfo?R(e.pluginInfo.repository).marketplace:void 0;K(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...M(e.pluginInfo)}});let{skillContent:l,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await _e(e,t,n);H(`Executing forked slash command /${e.name} with agent ${f.agentType}`);let m=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&rt();let h=!1;if(m.kairosEnabled&&(h=!0),h){let t=se(),r=j(e),i=qe(),c=e=>w({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),l=async()=>{if(!o?.runId)return;let e=await I({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)u(t)},m=async e=>{o?.runId&&await Te({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await Ke(Q);let o=n.options.refreshTools?.()??n.options.tools,u=[];for await(let r of k({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))u.push(r);let m=T(u,`Command completed`);H(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${m}\n</scheduled-task-result>`);try{await l()}catch(e){W(e)}})().catch(async e=>{W(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await m(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let g=[],_=[],v=`forked-command-${e.name}`,y=0,b=e=>(y++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:l,agentId:s},parentToolUseID:v,toolUseID:`${v}-${y}`,timestamp:new Date().toISOString(),uuid:q()}),x=()=>{i({jsx:ce(_,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};x();try{for await(let t of k({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){g.push(t);let e=xe([t]);if(t.type===`assistant`){let r=De(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(_.push(b(t)),x())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(_.push(b(t)),x())}}}finally{i(null)}let S=T(g,`Command completed`);return H(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(S=`[ANT-ONLY] API calls: ${He(Se(s))}\n${S}`),{messages:[O({content:A({inputString:`/${j(e)} ${t}`.trim(),precedingInputBlocks:r})}),O({content:`<local-command-stdout>\n${S}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:S}}function at(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function ot(e,t,n,i,a,o,c,l,u,d){let f=$e(e);if(!f){K(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[z(),...i,O({content:A({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:p,args:m,isMcp:h}=f,g=h?`mcp`:je().has(p)?p:`custom`;if(!le(p,a.options.commands)){let n=!1;try{await Pe().stat(`/${p}`),n=!0}catch{}if(at(p)&&!n){K(`tengu_input_slash_invalid`,{input:p});let e=`Unknown skill: ${p}`;return{messages:[z(),...i,O({content:A({inputString:e,precedingInputBlocks:t})}),...m?[Ae(`Args from unknown skill: ${m}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let a=q();return r(a),K(`tengu_input_prompt`,{}),Ze(`user_prompt`,{prompt_length:String(e.length),prompt:Xe(e),"prompt.id":a}),{messages:[O({content:A({inputString:e,precedingInputBlocks:t}),uuid:c}),...i],shouldQuery:!0}}let{messages:_,shouldQuery:v,allowedTools:y,model:b,command:x,resultText:S,nextInput:C,submitNextInput:w,deferAutonomyCompletion:T}=await st(p,m,o,a,t,n,l,u,c,d);if(_.length===0){let e={input:g};if(x.type===`prompt`&&x.pluginInfo){let{pluginManifest:t,repository:n}=x.pluginInfo,{marketplace:r}=R(n),i=L(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,M(x.pluginInfo))}return K(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:p,...x.type===`prompt`&&{skill_source:x.source},...x.loadedFrom&&{skill_loaded_from:x.loadedFrom},...x.kind&&{skill_kind:x.kind}}}),{messages:[],shouldQuery:!1,model:b,nextInput:C,submitNextInput:w,deferAutonomyCompletion:T}}if(_.length===2&&_[1].type===`user`&&typeof _[1].message.content==`string`&&_[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||K(`tengu_input_slash_invalid`,{input:p}),{messages:[z(),..._],shouldQuery:v,allowedTools:y,model:b};let E={input:g};if(x.type===`prompt`&&x.pluginInfo){let{pluginManifest:e,repository:t}=x.pluginInfo,{marketplace:n}=R(t),r=L(n);E._PROTO_plugin_name=e.name,n&&(E._PROTO_marketplace_name=n),E.plugin_repository=r?t:`third-party`,E.plugin_name=r?e.name:`third-party`,r&&e.version&&(E.plugin_version=e.version),Object.assign(E,M(x.pluginInfo))}K(`tengu_input_command`,{...E,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:p,...x.type===`prompt`&&{skill_source:x.source},...x.loadedFrom&&{skill_loaded_from:x.loadedFrom},...x.kind&&{skill_kind:x.kind}}});let D=_.length>0&&_[0]&&s(_[0]);return{messages:v||_.every(oe)||D?_:[z(),..._],shouldQuery:v,allowedTools:y,model:b,resultText:S,nextInput:C,submitNextInput:w,deferAutonomyCompletion:T}}async function st(e,t,n,r,i,a,o,s,c,l){let u=C(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&pe(e),u.userInvocable===!1)return{messages:[O({content:A({inputString:`/${e}`,precedingInputBlocks:i})}),O({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>O({content:e,isMeta:!0})),s=re()&&typeof n==`string`&&n.endsWith(` dismissed`),c=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[N(Y(u,c)),N(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[O({content:A({inputString:Y(u,c),precedingInputBlocks:i})}),O(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${he}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{W(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=O({content:A({inputString:Y(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=z(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[O({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return v(),{messages:fe(r),shouldQuery:!1,command:u}}return{messages:[e,N(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return W(t),{messages:[e,N(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await it(u,t,r,i,n,s??ie,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof Ne?{messages:[O({content:A({inputString:Y(u,t),precedingInputBlocks:i})}),ke({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[O({content:A({inputString:Y(u,t),precedingInputBlocks:i})}),O({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof B)return{messages:[O({content:A({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function Y(e,t){return p(j(e),t)}function X(e,t=`loading`){return[`<${G}>${e}</${G}>`,`<${U}>${e}</${U}>`,`<skill-format>true</skill-format>`].join(`
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nr as r,t as i}from"./state-ix0xIunV.js";import{$S as a,Al as o,Bo as s,C as c,DE as l,DT as u,Dc as d,Ec as f,Eo as p,G as m,Gh as h,Gw as g,Hx as _,JE as v,Jd as y,Jw as b,KE as x,Kh as S,Ki as C,OT as w,Ol as T,PT as E,QS as D,Qi as ee,Sl as te,So as O,Th as k,Ui as ne,Ux as re,W as ie,Wh as ae,Wo as oe,Ww as se,Yd as ce,Yo as A,Zi as le,_O as ue,aO as de,bl as fe,ca as j,dy as pe,eC as me,fy as M,gO as he,ho as N,hy as ge,jl as _e,k as P,kc as F,lT as I,nw as ve,oO as L,oy as ye,pT as be,qo as xe,qw as Se,sO as R,sy as Ce,tw as we,uT as Te,uy as Ee,vo as z,wE as De,wh as Oe,xo as ke,yo as Ae,zi as je,zo as Me}from"./loadAgentsDir-D206qwP3.js";import{A as B,D as Ne,a as V,d as Pe,l as H,p as Fe,z as Ie}from"./debug-BrXObCdR.js";import{Mt as Le,jt as Re}from"./settings-BovzmwMP.js";import{T as U,Y as ze,o as Be,s as W,w as G}from"./log-BMCygSzM.js";import{f as Ve,l as He}from"./file-DcZWPH2V.js";import{n as Ue,r as K}from"./analytics-BotDBGh0.js";import{_n as We,bi as Ge,vn as Ke,yi as qe}from"./model-CKkOnnnx.js";import{ct as Je,ot as Ye}from"./esm-D5q6s4l8.js";import{E as Xe,T as Ze,w as Qe}from"./sessionTracing-D9rUyiq0.js";import{n as $e,t as et}from"./slashCommandParsing-RQb_7Xzt.js";import{randomUUID as q}from"crypto";function tt(e,t,n,r,i){let a=0;for(let o of Re){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{H(`Removing one-shot hook for event ${o} in skill '${r}'`),S(e,t,o,s)}:void 0;ae(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&H(`Registered ${a} hooks from skill '${r}'`)}var nt=e((()=>{Le(),V(),h()}));function J(){return!1}function rt(){if(!J())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function it(e,t,n,r,i,a,o){let s=ye(),c=e.pluginInfo?R(e.pluginInfo.repository).marketplace:void 0;K(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...M(e.pluginInfo)}});let{skillContent:l,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await _e(e,t,n);H(`Executing forked slash command /${e.name} with agent ${f.agentType}`);let m=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&rt();let h=!1;if(m.kairosEnabled&&(h=!0),h){let t=se(),r=j(e),i=qe(),c=e=>w({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),l=async()=>{if(!o?.runId)return;let e=await I({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)u(t)},m=async e=>{o?.runId&&await Te({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await Ke(Q);let o=n.options.refreshTools?.()??n.options.tools,u=[];for await(let r of k({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))u.push(r);let m=T(u,`Command completed`);H(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${m}\n</scheduled-task-result>`);try{await l()}catch(e){W(e)}})().catch(async e=>{W(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await m(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let g=[],_=[],v=`forked-command-${e.name}`,y=0,b=e=>(y++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:l,agentId:s},parentToolUseID:v,toolUseID:`${v}-${y}`,timestamp:new Date().toISOString(),uuid:q()}),x=()=>{i({jsx:ce(_,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};x();try{for await(let t of k({agentDefinition:f,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){g.push(t);let e=xe([t]);if(t.type===`assistant`){let r=De(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(_.push(b(t)),x())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(_.push(b(t)),x())}}}finally{i(null)}let S=T(g,`Command completed`);return H(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(S=`[ANT-ONLY] API calls: ${He(Se(s))}\n${S}`),{messages:[O({content:A({inputString:`/${j(e)} ${t}`.trim(),precedingInputBlocks:r})}),O({content:`<local-command-stdout>\n${S}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:S}}function at(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function ot(e,t,n,i,a,o,c,l,u,d){let f=$e(e);if(!f){K(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[z(),...i,O({content:A({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:p,args:m,isMcp:h}=f,g=h?`mcp`:je().has(p)?p:`custom`;if(!le(p,a.options.commands)){let n=!1;try{await Pe().stat(`/${p}`),n=!0}catch{}if(at(p)&&!n){K(`tengu_input_slash_invalid`,{input:p});let e=`Unknown skill: ${p}`;return{messages:[z(),...i,O({content:A({inputString:e,precedingInputBlocks:t})}),...m?[Ae(`Args from unknown skill: ${m}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let a=q();return r(a),K(`tengu_input_prompt`,{}),Ze(`user_prompt`,{prompt_length:String(e.length),prompt:Xe(e),"prompt.id":a}),{messages:[O({content:A({inputString:e,precedingInputBlocks:t}),uuid:c}),...i],shouldQuery:!0}}let{messages:_,shouldQuery:v,allowedTools:y,model:b,command:x,resultText:S,nextInput:C,submitNextInput:w,deferAutonomyCompletion:T}=await st(p,m,o,a,t,n,l,u,c,d);if(_.length===0){let e={input:g};if(x.type===`prompt`&&x.pluginInfo){let{pluginManifest:t,repository:n}=x.pluginInfo,{marketplace:r}=R(n),i=L(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,M(x.pluginInfo))}return K(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:p,...x.type===`prompt`&&{skill_source:x.source},...x.loadedFrom&&{skill_loaded_from:x.loadedFrom},...x.kind&&{skill_kind:x.kind}}}),{messages:[],shouldQuery:!1,model:b,nextInput:C,submitNextInput:w,deferAutonomyCompletion:T}}if(_.length===2&&_[1].type===`user`&&typeof _[1].message.content==`string`&&_[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||K(`tengu_input_slash_invalid`,{input:p}),{messages:[z(),..._],shouldQuery:v,allowedTools:y,model:b};let E={input:g};if(x.type===`prompt`&&x.pluginInfo){let{pluginManifest:e,repository:t}=x.pluginInfo,{marketplace:n}=R(t),r=L(n);E._PROTO_plugin_name=e.name,n&&(E._PROTO_marketplace_name=n),E.plugin_repository=r?t:`third-party`,E.plugin_name=r?e.name:`third-party`,r&&e.version&&(E.plugin_version=e.version),Object.assign(E,M(x.pluginInfo))}K(`tengu_input_command`,{...E,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:p,...x.type===`prompt`&&{skill_source:x.source},...x.loadedFrom&&{skill_loaded_from:x.loadedFrom},...x.kind&&{skill_kind:x.kind}}});let D=_.length>0&&_[0]&&s(_[0]);return{messages:v||_.every(oe)||D?_:[z(),..._],shouldQuery:v,allowedTools:y,model:b,resultText:S,nextInput:C,submitNextInput:w,deferAutonomyCompletion:T}}async function st(e,t,n,r,i,a,o,s,c,l){let u=C(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&pe(e),u.userInvocable===!1)return{messages:[O({content:A({inputString:`/${e}`,precedingInputBlocks:i})}),O({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>O({content:e,isMeta:!0})),s=re()&&typeof n==`string`&&n.endsWith(` dismissed`),c=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[N(Y(u,c)),N(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[O({content:A({inputString:Y(u,c),precedingInputBlocks:i})}),O(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${he}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{W(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=O({content:A({inputString:Y(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=z(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[O({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return v(),{messages:fe(r),shouldQuery:!1,command:u}}return{messages:[e,N(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return W(t),{messages:[e,N(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await it(u,t,r,i,n,s??ie,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof Ne?{messages:[O({content:A({inputString:Y(u,t),precedingInputBlocks:i})}),ke({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[O({content:A({inputString:Y(u,t),precedingInputBlocks:i})}),O({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof B)return{messages:[O({content:A({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function Y(e,t){return p(j(e),t)}function X(e,t=`loading`){return[`<${G}>${e}</${G}>`,`<${U}>${e}</${U}>`,`<skill-format>true</skill-format>`].join(`
|
|
2
2
|
`)}function ct(e,t){return[`<${G}>${e}</${G}>`,`<${U}>/${e}</${U}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
|
|
3
3
|
`)}function lt(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?X(e.name,e.progressMessage):ct(e.name,t)}async function ut(e,t,n,r,i=[]){let a=ne(e,n);if(!a)throw new B(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,r,o=[],s=[],c){let l=await e.getPromptForCommand(t,r),u=!a(`hooks`)||me(e.source);if(e.hooks&&u){let t=n();tt(r.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let p=e.source?`${e.source}:${e.name}`:e.name,m=l.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-DaDcL9Zw.js";import{c as a,l as o,o as s}from"./envUtils-DSxRz_kt.js";import{n as c,t as l}from"./defineProperty-C-QyHrDq.js";import{E as u,M as d,P as f,T as p,n as m,r as h,t as g}from"./lazySchema-DcIJE_0i.js";import{M as _,S as v,w as y,z as b}from"./debug-BrXObCdR.js";import{J as x,Q as S,X as C,Y as w,Z as T,nt as E}from"./settings-
|
|
1
|
+
import{a as e,n as t,o as n,r,t as i}from"./rolldown-runtime-DaDcL9Zw.js";import{c as a,l as o,o as s}from"./envUtils-DSxRz_kt.js";import{n as c,t as l}from"./defineProperty-C-QyHrDq.js";import{E as u,M as d,P as f,T as p,n as m,r as h,t as g}from"./lazySchema-DcIJE_0i.js";import{M as _,S as v,w as y,z as b}from"./debug-BrXObCdR.js";import{J as x,Q as S,X as C,Y as w,Z as T,nt as E}from"./settings-BovzmwMP.js";import{U as D,Y as O}from"./log-BMCygSzM.js";import{i as k,o as A}from"./platform-BrYefG_2.js";import{_ as ee,u as j}from"./model-CKkOnnnx.js";import{join as M,parse as N,resolve as P,sep as F}from"node:path";import{createHash as I}from"node:crypto";import{appendFile as te,mkdir as ne,readFile as L,readdir as re,rm as ie,writeFile as ae}from"node:fs/promises";function oe(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function se(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function ce(e,t){return e.find(e=>se(e,t))}function le(e){return{...de,userFacingName:()=>e.name,...e}}var ue,de,fe=t((()=>{ue=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),de={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),R,pe=t((()=>{R=`Bash`}));function me(){return`A powerful search tool built on ripgrep
|
|
2
2
|
|
|
3
3
|
Usage:
|
|
4
4
|
- ALWAYS use ${z} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${R} command. The ${z} tool has been optimized for correct permissions and access.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e,r as t}from"./prompt-BNHtszmZ.js";t();export{e as isDeferredTool};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{fD as e,oD as t}from"./loadAgentsDir-D206qwP3.js";e();export{t as clearPromptCache};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{Rn as r,t as i}from"./src-CDCSSo0U2.js";import{Dg as a,Fg as o,Iy as s,Ly as c,aS as l,lS as u,sS as d,uS as f}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{Rn as r,t as i}from"./src-CDCSSo0U2.js";import{Dg as a,Fg as o,Iy as s,Ly as c,aS as l,lS as u,sS as d,uS as f}from"./loadAgentsDir-D206qwP3.js";import{E as p,S as m,a as h,d as g,l as _,p as v}from"./debug-BrXObCdR.js";import{n as y,t as b}from"./execSyncWrapper-CCMQShK-.js";import{r as x,t as S}from"./which-CKQnSouy.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!x(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,o=i.slice(1),s=D(n);if(s){let r=O(s,e,t),i={detached:!0,stdio:`ignore`},c;return c=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...o,...r],i),c.on(`error`,e=>_(`editor spawn failed: ${e}`,{level:`error`})),c.unref(),!0}let c=r.get(process.stdout);if(!c)return!1;let l=t&&j.test(C(a));c.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${l?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...o,...l?[`+${t}`,e]:[e]],r),i.error?(_(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{c.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),h(),S(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=g(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return b(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${o(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=d(n,u(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=g(),r=s();try{p(r,t?l(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
|
|
2
2
|
`)&&!i.endsWith(`
|
|
3
3
|
|
|
4
4
|
`)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{f(),i(),P(),y(),v(),a(),m(),c(),z={code:`code -w`,subl:`subl --wait`}}));export{P as a,N as i,R as n,k as o,B as r,I as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{S as e,a as t,l as n,w as r}from"./debug-BrXObCdR.js";import{c as i,g as a}from"./config-
|
|
1
|
+
import{S as e,a as t,l as n,w as r}from"./debug-BrXObCdR.js";import{c as i,g as a}from"./config-DmomySWC.js";import{r as o,t as s}from"./execFileNoThrow-D244NytW.js";import{n as c,t as l}from"./which-CKQnSouy.js";import{n as u,t as d}from"./githubRepoPathMapping-qAoiyj6P.js";import{n as f}from"./banner-CWkrK10u.js";import{a as p,i as m,n as h}from"./registerProtocol-B7Fzdofu.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";e(),m(),h(),a(),t(),o(),l();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=i().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let t=process.env.TERM_PROGRAM;if(t){let e=t.replace(/\.app$/i,``).toLowerCase(),n=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(n)return{name:n.name,command:n.app}}for(let e of y){let{code:t,stdout:n}=await s(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await s(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await c(e);if(t)return{name:_(e),command:t}}let t=await c(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await c(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await c(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await c(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await c(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,t){let r=await w();if(!r)return n(`No terminal emulator detected`,{level:`error`}),!1;n(`Launching in terminal: ${r.name} (${r.command})`);let i=[`--deep-link-origin`];switch(t.repo&&(i.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&i.push(`--prefill`,t.query),process.platform){case`darwin`:return E(r,e,i,t.cwd);case`linux`:return D(r,e,i,t.cwd);case`win32`:return O(r,e,i,t.cwd);default:return!1}}async function E(e,t,r,i){switch(e.command){case`iTerm`:{let{code:e}=await s(`osascript`,[`-e`,`tell application "iTerm"
|
|
2
2
|
if running then
|
|
3
3
|
create window with default profile
|
|
4
4
|
else
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n,t as r,y as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{ah as o,da as s,fa as c,ih as l,mx as u,oh as d,px as f,rh as p}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n,t as r,y as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{ah as o,da as s,fa as c,ih as l,mx as u,oh as d,px as f,rh as p}from"./loadAgentsDir-D206qwP3.js";import{n as m,r as h}from"./analytics-BotDBGh0.js";import{Bt as g,Ft as _,Nt as v,jt as y,ri as b,ti as x}from"./model-CKkOnnnx.js";import{n as S,t as C}from"./extra-usage-zDHVtWKZ.js";import{n as w,t as T}from"./upgrade-D5qwcaWQ.js";function E({onDone:e,context:t}){let[n,r]=(0,O.useState)(null),a=l(),s=_(),u=v(),d=y()?.hasExtraUsageEnabled===!0,p=s===`max`&&u===`default_claude_max_20x`,m=s===`team`||s===`enterprise`,g=(0,O.useMemo)(()=>{let e=[];if(o.isEnabled()){let t=x(),n=m&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:d?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}return!p&&!m&&c.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`}),[{label:`Stop and wait for limit to reset`,value:`cancel`},...e]},[!1,p,m,d,a.overageStatus,a.overageDisabledReason]);function b(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function S(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),T(e,t).then(e=>{e&&r(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),C(e,t).then(e=>{e&&r(e)})):n===`cancel`&&b()}return n||(0,k.jsx)(i,{title:`What do you want to do?`,onCancel:b,color:`suggestion`,children:(0,k.jsx)(f,{options:g,onChange:S,visibleOptionCount:g.length})})}async function D(e,t){return(0,k.jsx)(E,{onDone:e,context:t})}var O,k;e((()=>{O=t(n(),1),u(),r(),m(),p(),g(),b(),S(),d(),s(),w(),k=a()}))();export{D as call};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DSxRz_kt.js";import{en as i,gt as a,ht as o,sr as s,z as c}from"./state-ix0xIunV.js";import{F as l,a as u,d,l as f,nt as p,p as m,rt as h,z as g}from"./debug-BrXObCdR.js";import{M as _,j as ee}from"./git-Do0wJvux.js";import{Ar as te,Or as v,jr as ne,kr as re}from"./model-
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DSxRz_kt.js";import{en as i,gt as a,ht as o,sr as s,z as c}from"./state-ix0xIunV.js";import{F as l,a as u,d,l as f,nt as p,p as m,rt as h,z as g}from"./debug-BrXObCdR.js";import{M as _,j as ee}from"./git-Do0wJvux.js";import{Ar as te,Or as v,jr as ne,kr as re}from"./model-CKkOnnnx.js";import{join as ie}from"node:path";import{appendFileSync as ae,existsSync as oe,mkdirSync as se}from"node:fs";import{homedir as ce}from"node:os";import{randomUUID as y}from"crypto";var le=e((()=>{})),ue,de=e((()=>{ue={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),fe=e((()=>{}));function pe(e){return e}var me=e((()=>{})),he=e((()=>{le(),de(),fe(),me()}));function ge(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function _e(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=ge(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return ve[t]??t}var ve,ye=e((()=>{ve={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function be(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function xe(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function Se(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=be(t),r=xe();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return b[t]?b[t]:n&&x[n]?x[n]:t}var b,x,Ce=e((()=>{b={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},x={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function we(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Te(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=we(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var Ee=e((()=>{})),S,C=e((()=>{S=`_geminiThoughtSignature`}));function w(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function De(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=je(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=ke(t,r);e.parts.length>0&&n.push(e)}}let i=Oe(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function Oe(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|
|
2
2
|
|
|
3
3
|
`)}function ke(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:T(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>Ae(e,t))}:{role:`user`,parts:[]}}function Ae(e,t){if(typeof e==`string`)return T(e);if(e.type===`text`)return T(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Pe(n)}}]}if(e.type===`image`){let t=e.source;if(t?.type===`base64`&&typeof t.data==`string`)return[{inlineData:{mimeType:t.media_type||`image/png`,data:t.data}}];if(t?.type===`url`&&typeof t.url==`string`)return T(`[image: ${t.url}]`)}return[]}function je(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:T(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...T(e));continue}if(e.type===`text`){n.push(...T(e.text,E(e)));continue}if(e.type===`thinking`){let t=Me(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Ne(t.input)},...E(e)&&{thoughtSignature:E(e)}})}}return{role:`model`,parts:n}}function T(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Me(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Ne(e){if(typeof e==`string`){let t=w(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:t===null?{}:{value:t}}return e&&typeof e==`object`&&!Array.isArray(e)?e:e===void 0?{}:{value:e}}function Pe(e){let t=Fe(e.content);return t&&typeof t==`object`&&!Array.isArray(t)?e.is_error?{...t,is_error:!0}:t:{result:t,...e.is_error?{is_error:!0}:{}}}function Fe(e){if(typeof e==`string`)return w(e)??e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
|
|
4
4
|
`);return w(t)??t}return e??``}function E(e){let t=e[S];return typeof t==`string`&&t.length>0?t:void 0}var Ie=e((()=>{C()}));function Le(e){if(typeof e==`string`)return O.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&O.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function Re(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;if(typeof e==`string`)return`string`;if(typeof e==`boolean`)return`boolean`;if(typeof e==`number`)return Number.isInteger(e)?`integer`:`number`;if(typeof e==`object`)return`object`}function ze(e){let t=e.map(Re).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function Be(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function Ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,D(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function He(e){if(!Array.isArray(e))return;let t=e.map(e=>D(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function D(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=Le(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??ze(t.enum)):(n.enum=[t.const],r=r??Re(t.const)),r||(t.properties&&typeof t.properties==`object`?r=`object`:(t.items!==void 0||t.prefixItems!==void 0)&&(r=`array`)),t.nullable===!0&&(r=Be(r)),r&&(n.type=r),typeof t.title==`string`&&(n.title=t.title),typeof t.description==`string`&&(n.description=t.description),typeof t.format==`string`&&(n.format=t.format),typeof t.pattern==`string`&&(n.pattern=t.pattern),typeof t.minimum==`number`?n.minimum=t.minimum:typeof t.exclusiveMinimum==`number`&&(n.minimum=t.exclusiveMinimum),typeof t.maximum==`number`?n.maximum=t.maximum:typeof t.exclusiveMaximum==`number`&&(n.maximum=t.exclusiveMaximum),typeof t.minItems==`number`&&(n.minItems=t.minItems),typeof t.maxItems==`number`&&(n.maxItems=t.maxItems),typeof t.minLength==`number`&&(n.minLength=t.minLength),typeof t.maxLength==`number`&&(n.maxLength=t.maxLength),typeof t.minProperties==`number`&&(n.minProperties=t.minProperties),typeof t.maxProperties==`number`&&(n.maxProperties=t.maxProperties);let i=Ve(t.properties);if(i&&(n.properties=i,n.propertyOrdering=Object.keys(i)),Array.isArray(t.required)){let e=t.required.filter(e=>typeof e==`string`);e.length>0&&(n.required=e)}if(typeof t.additionalProperties==`boolean`)n.additionalProperties=t.additionalProperties;else{let e=D(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=D(t.items);Object.keys(a).length>0&&(n.items=a);let o=He(t.prefixItems);o&&(n.prefixItems=o);let s=He(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function Ue(e){let t=D(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function We(e){let t=e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e;return{name:t.name||``,description:t.description||``,parametersJsonSchema:Ue(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function Ge(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return{mode:`AUTO`};case`any`:return{mode:`ANY`};case`tool`:return{mode:`ANY`,allowedFunctionNames:typeof t.name==`string`?[t.name]:void 0};default:return}}var O,Ke=e((()=>{O=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*qe(e,t){let n=`msg_${y().replace(/-/g,``).slice(0,24)}`,r=!1,i=!1,a=0,o=null,s=!1,c,l=0,u=0,d=0;for await(let i of e){let e=i.usageMetadata;e&&(l=e.promptTokenCount??l,u=(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0),d=e.cachedContentTokenCount??d),r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}});let f=i.candidates?.[0],p=f?.content?.parts??[];for(let e of p){if(e.functionCall){o&&(yield{type:`content_block_stop`,index:o.index},o=null),s=!0;let t=a++;yield{type:`content_block_start`,index:t,content_block:{type:`tool_use`,id:`toolu_${y().replace(/-/g,``).slice(0,24)}`,name:e.functionCall.name||``,input:{}}},e.thoughtSignature&&(yield{type:`content_block_delta`,index:t,delta:{type:`signature_delta`,signature:e.thoughtSignature}}),e.functionCall.args&&Object.keys(e.functionCall.args).length>0&&(yield{type:`content_block_delta`,index:t,delta:{type:`input_json_delta`,partial_json:JSON.stringify(e.functionCall.args)}}),yield{type:`content_block_stop`,index:t};continue}let t=Je(e);if(t){(!o||o.type!==t)&&(o&&(yield{type:`content_block_stop`,index:o.index}),o={index:a++,type:t},yield{type:`content_block_start`,index:o.index,content_block:t===`thinking`?{type:`thinking`,thinking:``,signature:``}:{type:`text`,text:``}}),e.text&&(yield{type:`content_block_delta`,index:o.index,delta:t===`thinking`?{type:`thinking_delta`,thinking:e.text}:{type:`text_delta`,text:e.text}}),e.thoughtSignature&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}});continue}e.thoughtSignature&&o&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}})}f?.finishReason&&(c=f.finishReason)}r&&(o&&(yield{type:`content_block_stop`,index:o.index}),i||(yield{type:`message_delta`,delta:{stop_reason:Ye(c,s),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_creation_input_tokens:0,cache_read_input_tokens:d}},yield{type:`message_stop`},i=!0))}function Je(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function Ye(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var Xe=e((()=>{}));function k(e){if(!e||typeof e!=`object`)return null;let t=e,n=0;for(;t&&n<5;){if(t instanceof Error&&`code`in t&&typeof t.code==`string`){let e=t.code,n=nt.has(e);return{code:e,message:t.message,isSSLError:n}}if(t instanceof Error&&`cause`in t&&t.cause!==t)t=t.cause,n++;else break}return null}function Ze(e){let t=k(e);return t?.isSSLError?`SSL certificate error (${t.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`:null}function A(e){if(e.includes(`<!DOCTYPE html`)||e.includes(`<html`)){let t=e.match(/<title>([^<]+)<\/title>/);return t&&t[1]?t[1].trim():``}return e}function Qe(e){let t=e.message;return t?A(t):``}function $e(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function et(e){if(!$e(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=A(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=A(r);if(e.length>0)return e}return null}function tt(e){let t=k(e);if(t){let{code:e,isSSLError:n}=t;if(e===`ETIMEDOUT`)return`Request timed out. Check your internet connection and proxy settings`;if(n)switch(e){case`UNABLE_TO_VERIFY_LEAF_SIGNATURE`:case`UNABLE_TO_GET_ISSUER_CERT`:case`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`:return`Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates`;case`CERT_HAS_EXPIRED`:return`Unable to connect to API: SSL certificate has expired`;case`CERT_REVOKED`:return`Unable to connect to API: SSL certificate has been revoked`;case`DEPTH_ZERO_SELF_SIGNED_CERT`:case`SELF_SIGNED_CERT_IN_CHAIN`:return`Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates`;case`ERR_TLS_CERT_ALTNAME_INVALID`:case`HOSTNAME_MISMATCH`:return`Unable to connect to API: SSL certificate hostname mismatch`;case`CERT_NOT_YET_VALID`:return`Unable to connect to API: SSL certificate is not yet valid`;default:return`Unable to connect to API: SSL error (${e})`}}if(e.message===`Connection error.`)return t?.code?`Unable to connect to API (${t.code})`:`Unable to connect to API. Check your internet connection`;if(!e.message)return et(e)??`API error (status ${e.status??`unknown`})`;let n=Qe(e);return n!==e.message&&n.length>0?n:e.message}var nt,rt=e((()=>{nt=new Set([`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_SIGNATURE_FAILURE`,`CERT_NOT_YET_VALID`,`CERT_HAS_EXPIRED`,`CERT_REVOKED`,`CERT_REJECTED`,`CERT_UNTRUSTED`,`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`CERT_CHAIN_TOO_LONG`,`PATH_LENGTH_EXCEEDED`,`ERR_TLS_CERT_ALTNAME_INVALID`,`HOSTNAME_MISMATCH`,`ERR_TLS_HANDSHAKE_TIMEOUT`,`ERR_SSL_WRONG_VERSION_NUMBER`,`ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC`])}));function it(e,t,n){let r=[],i=at(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...ot(t));break;case`assistant`:r.push(...ct(t));break;default:break}return r}function at(e){return!e||e.length===0?``:e.filter(Boolean).join(`
|