@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,3 +1,3 @@
|
|
|
1
|
-
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{Sr as a,en as o,l as s,xr as c,zn as l}from"./state-ix0xIunV.js";import{AE as u,Ac as d,Cm as f,Db as ee,Eb as p,Ep as m,Ft as h,GE as g,HE as _,Jw as v,Kp as y,Kw as b,ME as x,NE as te,Ox as ne,PE as re,Qi as ie,Sp as ae,VE as oe,Vi as se,Vt as ce,WE as le,Y as ue,Z as de,_ as fe,_l as pe,eD as me,g as he,hl as ge,jE as _e,kc as ve,kx as ye,nD as be,p as xe,qp as Se,wm as Ce,yn as we}from"./loadAgentsDir-
|
|
1
|
+
import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{Sr as a,en as o,l as s,xr as c,zn as l}from"./state-ix0xIunV.js";import{AE as u,Ac as d,Cm as f,Db as ee,Eb as p,Ep as m,Ft as h,GE as g,HE as _,Jw as v,Kp as y,Kw as b,ME as x,NE as te,Ox as ne,PE as re,Qi as ie,Sp as ae,VE as oe,Vi as se,Vt as ce,WE as le,Y as ue,Z as de,_ as fe,_l as pe,eD as me,g as he,hl as ge,jE as _e,kc as ve,kx as ye,nD as be,p as xe,qp as Se,wm as Ce,yn as we}from"./loadAgentsDir-D206qwP3.js";import{n as Te,t as S}from"./cwd-CYmmnQVS.js";import{F as Ee,a as De,d as Oe,l as C,p as ke,z as Ae}from"./debug-BrXObCdR.js";import{g as je,n as Me}from"./settings-BovzmwMP.js";import{c as Ne,g as Pe}from"./config-DmomySWC.js";import{T as Fe,_ as Ie,g as Le,r as w,x as Re}from"./git-Do0wJvux.js";import{n as T,r as ze}from"./execFileNoThrow-D244NytW.js";import{o as Be,s as E}from"./log-BMCygSzM.js";import{i as Ve,n as He}from"./path-D5U-tm91.js";import{n as Ue,r as D}from"./analytics-BotDBGh0.js";import{a as We,s as Ge}from"./ripgrep-BXmXjAzA.js";import{i as Ke,t as qe}from"./detectRepository-BPr0VWNO.js";import{r as Je,t as Ye}from"./magicDocs-DWjL2k7P.js";import*as O from"path";import{statSync as Xe}from"fs";function Ze(e,t,n){if(t===0)return n?A:0;let r=e.charCodeAt(t-1);return Qe(r)?rt:$e(r)&&et(e.charCodeAt(t))?it:0}function Qe(e){return e===47||e===92||e===45||e===95||e===46||e===32}function $e(e){return e>=97&&e<=122}function et(e){return e>=65&&e<=90}function k(){return new Promise(e=>setImmediate(e))}function tt(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var nt,rt,it,at,A,ot,j,M,N,P,st,ct=e((()=>{n(),nt=16,rt=8,it=6,at=4,A=8,ot=3,j=1,M=100,N=64,P=new Int32Array(N),st=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await k(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await k(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=tt(e,M)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,N),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*24+A+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:ee,readyCount:p}=this;for(let e=0;e<p;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],p=a[0],m=0,h=[],g=r.indexOf(p);if(g===-1)continue;h[m++]=g;for(let e=g+1;e<r.length;e++){if(r.charCodeAt(e)!==p.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(h[m++]=e)}let _=u[e],v=ee[e],y=Math.max(0,32-(v>>2)),b=-1/0;for(let e=0;e<m;e++){P[0]=h[e];let n=0,o=0,u=P[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}P[e]=t;let i=t-u-1;i===0?o+=at:n+=ot+i*j,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*nt+o-n;f+=Ze(_,P[0],!0);for(let e=1;e<i;e++)f+=Ze(_,P[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:_,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:_,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let m=c.length,h=Math.max(m,1),g=Array(m);for(let e=0;e<m;e++){let t=c[e].path,n=e/h;g[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return g}}}));function F(){return R||(R=new st),R}function lt(){R=null,z=null,V++,H=null,U=[],W=[],G=[],B.clear(),K=null,q=null,J=0,Y=null,X=null,Z=null}function ut(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function dt(){let e=w(S());if(!e)return null;try{return Xe(O.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function ft(e,t,n){return n===t?e:e.map(e=>{let r=O.join(t,e);return O.relative(n,r)})}async function pt(e){if(e.length===0||!R||U.length===0)return;let t=await gt(e),n=[...U,...W,...G,...e,...t],r=ut(n);if(r===Z){C(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,C(`[FileIndex] rebuilt index with ${U.length} tracked + ${e.length} untracked files`)}async function mt(e,t){let n=`${e}:${t}`;if(q===n)return K;let r=Oe(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,Dt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>O.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,C(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return K=u,q=n,u}async function ht(e,t){let n=Date.now();C(`[FileIndex] getFilesUsingGit called`);let r=S(),i=w(r);if(!i)return C(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await T(Le(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(C(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return C(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=ft(o.stdout.trim().split(`
|
|
2
2
|
`).filter(Boolean),i,r),c=await mt(i,r);if(c){let e=s.length;s=c.filter(s),C(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}U=s;let l=Date.now()-n;if(C(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),D(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!H){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=V;H=T(Le(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===V&&e.code===0){let t=ft(e.stdout.trim().split(`
|
|
3
|
-
`).filter(Boolean),i,r),n=await mt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),C(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}C(`[FileIndex] background untracked fetch: ${t.length} files`),pt(t)}}).catch(e=>{C(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return C(`[FileIndex] git ls-files error: ${Ee(e)}`),null}}async function gt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)_t(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await k(),n=performance.now());return[...t].map(e=>e+O.sep)}function _t(e,t,n,r){for(let i=t;i<n;i++){let t=O.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=O.dirname(t);if(e===t)break;r.add(t),t=e}}}async function vt(e){return(await Promise.all(xe.map(t=>fe(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function yt(e,t){C(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await ht(e,t);if(n!==null)return C(`[FileIndex] using git ls-files result (${n.length} files)`),n;C(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await Ge(i,`.`,e)).map(e=>O.relative(S(),e)),o=Date.now()-r;return C(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),D(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function bt(){let e=AbortSignal.timeout(1e4),t=F();try{let n=Me(),r=Ne(),i=n.respectGitignore??r.respectGitignore??!0,a=S(),[o,s]=await Promise.all([yt(e,i),vt(a)]);W=s;let c=[...o,...s],l=await gt(c);G=l;let u=[...l,...c],d=ut(u);d===X?C(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,X=d,Z=null)}catch(e){E(e)}return t}function xt(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function St(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=xt(n,r),n===``)return``}return n}function I(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Ct(e,t){return e.search(t,Q).map(e=>I(e.path,e.score))}function L(){if(z)return;let e=dt();if(R&&!(e!==null&&e!==Y)&&Date.now()-J<kt)return;let t=V,n=Date.now();F(),z=bt().then(r=>t===V?(z=null,B.emit(),Y=e,J=Date.now(),C(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(C(`[FileIndex] Cache refresh failed: ${Ee(e)}`),E(e),t===V&&(z=null),F()))}async function wt(){let e=Oe(),t=S();try{return(await e.readdir(t)).map(e=>{let n=O.join(t,e.name),r=O.relative(t,n);return e.isDirectory()?r+O.sep:r})}catch(e){return E(e),[]}}async function Tt(e,t=!1){if(!e&&!t)return[];if(Me().fileSuggestion?.type===`command`)return(await ce({...h(),query:e})).slice(0,Q).map(I);if(e===``||e===`.`||e===`./`){let e=await wt();return L(),e.slice(0,Q).map(I)}let n=Date.now();try{let t=z!==null;L();let r=e,i=`.`+O.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=He(r));let a=R?Ct(R,r):[],o=Date.now()-n;return C(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),D(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return E(e),[]}}function Et(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var Dt,R,z,B,Ot,V,H,U,W,G,K,q,J,Y,X,Z,Q,kt,$=e((()=>{Dt=t(i(),1),he(),ct(),Ue(),Pe(),Te(),De(),Ae(),ze(),ke(),Ie(),we(),Be(),Ve(),We(),je(),a(),R=null,z=null,B=c(),Ot=B.subscribe,V=0,H=null,U=[],W=[],G=[],K=null,q=null,J=0,Y=null,X=null,Z=null,Q=15,kt=5e3}));function At(e=new Set){let t=e.size>0;x.cache.clear?.(),_e.cache.clear?.(),u.cache.clear?.(),le.cache.clear?.(),lt(),se(),t||be(),re(null),l(null),pe(),d(),_(`session_start`),ne(),p(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-Cb7gJvq4.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-CUAoGkU6.js`).then(({clearAttributionCaches:e})=>e()),qe(),ue(),t||b(),s(e),Re(),ae(),Ce(),Ye(),y(),import(`./SearchExtraToolsTool-
|
|
3
|
+
`).filter(Boolean),i,r),n=await mt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),C(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}C(`[FileIndex] background untracked fetch: ${t.length} files`),pt(t)}}).catch(e=>{C(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return C(`[FileIndex] git ls-files error: ${Ee(e)}`),null}}async function gt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)_t(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await k(),n=performance.now());return[...t].map(e=>e+O.sep)}function _t(e,t,n,r){for(let i=t;i<n;i++){let t=O.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=O.dirname(t);if(e===t)break;r.add(t),t=e}}}async function vt(e){return(await Promise.all(xe.map(t=>fe(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function yt(e,t){C(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await ht(e,t);if(n!==null)return C(`[FileIndex] using git ls-files result (${n.length} files)`),n;C(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await Ge(i,`.`,e)).map(e=>O.relative(S(),e)),o=Date.now()-r;return C(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),D(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function bt(){let e=AbortSignal.timeout(1e4),t=F();try{let n=Me(),r=Ne(),i=n.respectGitignore??r.respectGitignore??!0,a=S(),[o,s]=await Promise.all([yt(e,i),vt(a)]);W=s;let c=[...o,...s],l=await gt(c);G=l;let u=[...l,...c],d=ut(u);d===X?C(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,X=d,Z=null)}catch(e){E(e)}return t}function xt(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function St(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=xt(n,r),n===``)return``}return n}function I(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Ct(e,t){return e.search(t,Q).map(e=>I(e.path,e.score))}function L(){if(z)return;let e=dt();if(R&&!(e!==null&&e!==Y)&&Date.now()-J<kt)return;let t=V,n=Date.now();F(),z=bt().then(r=>t===V?(z=null,B.emit(),Y=e,J=Date.now(),C(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(C(`[FileIndex] Cache refresh failed: ${Ee(e)}`),E(e),t===V&&(z=null),F()))}async function wt(){let e=Oe(),t=S();try{return(await e.readdir(t)).map(e=>{let n=O.join(t,e.name),r=O.relative(t,n);return e.isDirectory()?r+O.sep:r})}catch(e){return E(e),[]}}async function Tt(e,t=!1){if(!e&&!t)return[];if(Me().fileSuggestion?.type===`command`)return(await ce({...h(),query:e})).slice(0,Q).map(I);if(e===``||e===`.`||e===`./`){let e=await wt();return L(),e.slice(0,Q).map(I)}let n=Date.now();try{let t=z!==null;L();let r=e,i=`.`+O.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=He(r));let a=R?Ct(R,r):[],o=Date.now()-n;return C(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),D(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return E(e),[]}}function Et(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var Dt,R,z,B,Ot,V,H,U,W,G,K,q,J,Y,X,Z,Q,kt,$=e((()=>{Dt=t(i(),1),he(),ct(),Ue(),Pe(),Te(),De(),Ae(),ze(),ke(),Ie(),we(),Be(),Ve(),We(),je(),a(),R=null,z=null,B=c(),Ot=B.subscribe,V=0,H=null,U=[],W=[],G=[],K=null,q=null,J=0,Y=null,X=null,Z=null,Q=15,kt=5e3}));function At(e=new Set){let t=e.size>0;x.cache.clear?.(),_e.cache.clear?.(),u.cache.clear?.(),le.cache.clear?.(),lt(),se(),t||be(),re(null),l(null),pe(),d(),_(`session_start`),ne(),p(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-Cb7gJvq4.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-CUAoGkU6.js`).then(({clearAttributionCaches:e})=>e()),qe(),ue(),t||b(),s(e),Re(),ae(),Ce(),Ye(),y(),import(`./SearchExtraToolsTool-C4uO-Zx3.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-TZjwTqdr.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-IAvMxKDl.js`).then(({clearPromptCache:e})=>e())}var jt=e((()=>{o(),ie(),g(),te(),$(),v(),me(),ee(),ge(),f(),Je(),m(),ve(),de(),oe(),Ke(),Fe(),ye(),Se()}));export{Tt as a,L as c,St as i,jt as n,$ as o,Et as r,Ot as s,At as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{F as n,I as r,S as i,a,l as o,w as s,z as c}from"./debug-BrXObCdR.js";import{M as l,j as u}from"./git-Do0wJvux.js";import{_n as d,ar as f,or as p,vn as m}from"./model-BQF64tZx.js";import{l as h,r as g}from"./proxy-CRN7jYIi.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-VKwMl0yg.js";import{n as C}from"./jwtUtils-DE2GPUcx.js";import{randomUUID as w}from"crypto";c(),a(),u(),h(),p(),d(),y(),S(),i(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(s(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await m(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}d(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,g({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),l(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||l(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,i,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let n=await this.http[e](`${this.sessionBaseUrl}${t}`,i,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":f()},validateStatus:j,timeout:s});if(n.status>=200&&n.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(n.status===409&&this.handleEpochMismatch(),n.status===401||n.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),l(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),l(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${n.status}`,{level:`warn`}),l(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:n.status}),n.status===429){let e=n.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(i){return o(`CCRClient: ${a} failed: ${n(i)}`,{level:`warn`}),l(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(i)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),l(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":f()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${r}/10): ${n(t)}`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),l(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{F as n,I as r,S as i,a,l as o,w as s,z as c}from"./debug-BrXObCdR.js";import{M as l,j as u}from"./git-Do0wJvux.js";import{_n as d,ar as f,or as p,vn as m}from"./model-CKkOnnnx.js";import{l as h,r as g}from"./proxy-CRN7jYIi.js";import{D as _,E as v,O as y,a as b,l as x,r as S}from"./rcDebugLog-CUy1_F23.js";import{n as C}from"./jwtUtils-DE2GPUcx.js";import{randomUUID as w}from"crypto";c(),a(),u(),h(),p(),d(),y(),S(),i(),e();var T=class extends Error{constructor(e,n){super(e),t(this,`retryAfterMs`,void 0),this.retryAfterMs=n}},E=class{constructor(e){t(this,`pending`,[]),t(this,`pendingAtClose`,0),t(this,`draining`,!1),t(this,`closed`,!1),t(this,`backpressureResolvers`,[]),t(this,`sleepResolve`,null),t(this,`flushResolvers`,[]),t(this,`droppedBatches`,0),t(this,`config`,void 0),this.config=e}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(e){if(this.closed)return;let t=Array.isArray(e)?e:[e];if(t.length!==0){for(;this.pending.length+t.length>this.config.maxQueueSize&&!this.closed;)await new Promise(e=>{this.backpressureResolvers.push(e)});this.closed||(this.pending.push(...t),this.drain())}}flush(){return this.pending.length===0&&!this.draining?Promise.resolve():(this.drain(),new Promise(e=>{this.flushResolvers.push(e)}))}close(){if(!this.closed){this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let e of this.backpressureResolvers)e();this.backpressureResolvers=[];for(let e of this.flushResolvers)e();this.flushResolvers=[]}}async drain(){if(this.draining||this.closed)return;this.draining=!0;let e=0;try{for(;this.pending.length>0&&!this.closed;){let t=this.takeBatch();if(t.length!==0){try{await this.config.send(t),e=0}catch(n){if(e++,this.config.maxConsecutiveFailures!==void 0&&e>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(t.length,e),e=0,this.releaseBackpressure();continue}this.pending=t.concat(this.pending);let r=n instanceof T?n.retryAfterMs:void 0;await this.sleep(this.retryDelay(e,r));continue}this.releaseBackpressure()}}}finally{if(this.draining=!1,this.pending.length===0){for(let e of this.flushResolvers)e();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:e,maxBatchBytes:t}=this.config;if(t===void 0)return this.pending.splice(0,e);let n=0,r=0;for(;r<this.pending.length&&r<e;){let e;try{e=Buffer.byteLength(s(this.pending[r]))}catch{this.pending.splice(r,1);continue}if(r>0&&n+e>t)break;n+=e,r++}return this.pending.splice(0,r)}retryDelay(e,t){let n=Math.random()*this.config.jitterMs;return t===void 0?Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+n:Math.max(this.config.baseDelayMs,Math.min(t,this.config.maxDelayMs))+n}releaseBackpressure(){let e=this.backpressureResolvers;this.backpressureResolvers=[];for(let t of e)t()}sleep(e){return new Promise(t=>{this.sleepResolve=t,setTimeout((e,t)=>{e.sleepResolve=null,t()},e,this,t)})}};e();var D=class{constructor(e){t(this,`inflight`,null),t(this,`pending`,null),t(this,`closed`,!1),t(this,`config`,void 0),this.config=e}enqueue(e){this.closed||(this.pending=this.pending?O(this.pending,e):e,this.drain())}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed||!this.pending)return;let e=this.pending;this.pending=null,this.inflight=this.sendWithRetry(e).then(()=>{this.inflight=null,this.pending&&!this.closed&&this.drain()})}async sendWithRetry(e){let t=e,n=0;for(;!this.closed;){if(await this.config.send(t))return;n++,await m(this.retryDelay(n)),this.pending&&!this.closed&&(t=O(t,this.pending),this.pending=null)}}retryDelay(e){return Math.min(this.config.baseDelayMs*2**(e-1),this.config.maxDelayMs)+Math.random()*this.config.jitterMs}};function O(e,t){let n={...e};for(let[e,r]of Object.entries(t))(e===`external_metadata`||e===`internal_metadata`)&&n[e]&&typeof n[e]==`object`&&typeof r==`object`&&r?n[e]={...n[e],...r}:n[e]=r;return n}d(),e();var k=2e4,A=100;function j(){return!0}var M=class extends Error{constructor(e){super(`CCRClient init failed: ${e}`),t(this,`reason`,void 0),this.reason=e}},N=10;function P(){return{byMessage:new Map,scopeToMessage:new Map}}function F(e){return`${e.session_id}:${e.parent_tool_use_id??``}`}function I(e,t){let n=[],r=new Map;for(let i of e){let e=i.event;switch(e.type){case`message_start`:{let r=e.message.id,a=t.scopeToMessage.get(F(i));a&&t.byMessage.delete(a),t.scopeToMessage.set(F(i),r),t.byMessage.set(r,[]),n.push(i);break}case`content_block_delta`:{let a=e.delta;if(a.type!==`text_delta`){n.push(i);break}let o=t.scopeToMessage.get(F(i)),s=o?t.byMessage.get(o):void 0;if(!s){n.push(i);break}let c=e.index,l=s[c]??(s[c]=[]);l.push(a.text);let u=r.get(l);if(u){u.event.delta={type:`text_delta`,text:l.join(``)};break}let d={type:`stream_event`,uuid:i.uuid,session_id:i.session_id,parent_tool_use_id:i.parent_tool_use_id,event:{type:`content_block_delta`,index:c,delta:{type:`text_delta`,text:l.join(``)}}};r.set(l,d),n.push(d);break}default:n.push(i)}}return n}function L(e,t){e.byMessage.delete(t.message.id);let n=F(t);e.scopeToMessage.get(n)===t.message.id&&e.scopeToMessage.delete(n)}var R=class{constructor(e,n,r){if(t(this,`workerEpoch`,0),t(this,`heartbeatIntervalMs`,void 0),t(this,`heartbeatJitterFraction`,void 0),t(this,`heartbeatTimer`,null),t(this,`heartbeatInFlight`,!1),t(this,`closed`,!1),t(this,`consecutiveAuthFailures`,0),t(this,`currentState`,null),t(this,`sessionBaseUrl`,void 0),t(this,`sessionId`,void 0),t(this,`http`,g({keepAlive:!0})),t(this,`streamEventBuffer`,[]),t(this,`streamEventTimer`,null),t(this,`streamTextAccumulator`,P()),t(this,`workerState`,void 0),t(this,`eventUploader`,void 0),t(this,`internalEventUploader`,void 0),t(this,`deliveryUploader`,void 0),t(this,`onEpochMismatch`,void 0),t(this,`getAuthHeaders`,void 0),this.onEpochMismatch=r?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=r?.heartbeatIntervalMs??k,this.heartbeatJitterFraction=r?.heartbeatJitterFraction??0,this.getAuthHeaders=r?.getAuthHeaders??v,n.protocol!==`http:`&&n.protocol!==`https:`)throw Error(`CCRClient: Expected http(s) URL, got ${n.protocol}`);let i=n.pathname.replace(/\/$/,``);this.sessionBaseUrl=`${n.protocol}//${n.host}${i}`,this.sessionId=i.split(`/`).pop()||``,this.workerState=new D({send:e=>this.request(`put`,`/worker`,{worker_epoch:this.workerEpoch,...e},`PUT worker`).then(e=>e.ok),baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.eventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:1e5,send:async e=>{let t=await this.request(`post`,`/worker/events`,{worker_epoch:this.workerEpoch,events:e},`client events`);if(!t.ok)throw new T(`client event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.internalEventUploader=new E({maxBatchSize:100,maxBatchBytes:10*1024*1024,maxQueueSize:200,send:async e=>{let t=await this.request(`post`,`/worker/internal-events`,{worker_epoch:this.workerEpoch,events:e},`internal events`);if(!t.ok)throw new T(`internal event POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),this.deliveryUploader=new E({maxBatchSize:64,maxQueueSize:64,send:async e=>{let t=await this.request(`post`,`/worker/events/delivery`,{worker_epoch:this.workerEpoch,updates:e.map(e=>({event_id:e.eventId,status:e.status}))},`delivery batch`);if(!t.ok)throw new T(`delivery POST failed`,t.retryAfterMs)},baseDelayMs:500,maxDelayMs:3e4,jitterMs:500}),e.setOnEvent(e=>{this.reportDelivery(e.event_id,`received`)})}async initialize(e){let t=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M(`no_auth_headers`);if(e===void 0){let t=process.env.CLAUDE_CODE_WORKER_EPOCH;e=t?parseInt(t,10):NaN}if(isNaN(e))throw new M(`missing_epoch`);this.workerEpoch=e;let n=this.getWorkerState();if(!(await this.request(`put`,`/worker`,{worker_status:`idle`,worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null,automation_state:null}},`PUT worker (init)`)).ok)throw new M(`worker_register_failed`);this.currentState=`idle`,this.startHeartbeat(),b(()=>{this.writeEvent({type:`keep_alive`})}),o(`CCRClient: initialized, epoch=${this.workerEpoch}`),l(`info`,`cli_worker_lifecycle_initialized`,{epoch:this.workerEpoch,duration_ms:Date.now()-t});let{metadata:r,durationMs:i}=await n;return this.closed||l(`info`,`cli_worker_state_restored`,{duration_ms:i,had_state:r!==null}),r}async getWorkerState(){let e=Date.now(),t=this.getAuthHeaders();return Object.keys(t).length===0?{metadata:null,durationMs:0}:{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,t,`worker_state`))?.worker?.external_metadata??null,durationMs:Date.now()-e}}async request(e,t,i,a,{timeout:s=1e4}={}){let c=this.getAuthHeaders();if(Object.keys(c).length===0)return{ok:!1};try{let n=await this.http[e](`${this.sessionBaseUrl}${t}`,i,{headers:{...c,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`,"User-Agent":f()},validateStatus:j,timeout:s});if(n.status>=200&&n.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(n.status===409&&this.handleEpochMismatch(),n.status===401||n.status===403){let e=_(),t=e?C(e):null;t!==null&&t*1e3<Date.now()&&(o(`CCRClient: session_token expired (exp=${new Date(t*1e3).toISOString()}) — no refresh was delivered, exiting`,{level:`error`}),l(`error`,`cli_worker_token_expired_no_refresh`),this.onEpochMismatch()),this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=N&&(o(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token — server-side auth unrecoverable, exiting`,{level:`error`}),l(`error`,`cli_worker_auth_failures_exhausted`),this.onEpochMismatch())}if(o(`CCRClient: ${a} returned ${n.status}`,{level:`warn`}),l(`warn`,`cli_worker_request_failed`,{method:e,path:t,status:n.status}),n.status===429){let e=n.headers?.[`retry-after`],t=typeof e==`string`?parseInt(e,10):NaN;if(!isNaN(t)&&t>=0)return{ok:!1,retryAfterMs:t*1e3}}return{ok:!1}}catch(i){return o(`CCRClient: ${a} failed: ${n(i)}`,{level:`warn`}),l(`warn`,`cli_worker_request_error`,{method:e,path:t,error_code:r(i)}),{ok:!1}}}reportState(e,t){e===this.currentState&&!t||(this.currentState=e,this.workerState.enqueue({worker_status:e,requires_action_details:t?{tool_name:t.tool_name,action_description:t.action_description,request_id:t.request_id}:null}))}reportMetadata(e){this.workerState.enqueue({external_metadata:e})}handleEpochMismatch(){o(`CCRClient: Epoch mismatch (409), shutting down`,{level:`error`}),l(`error`,`cli_worker_epoch_mismatch`),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let e=()=>{let e=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(t,this.heartbeatIntervalMs+e)},t=()=>{this.sendHeartbeat(),this.heartbeatTimer!==null&&e()};e()}stopHeartbeat(){this.heartbeatTimer&&(clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null)}async sendHeartbeat(){if(!this.heartbeatInFlight){this.heartbeatInFlight=!0;try{(await this.request(`post`,`/worker/heartbeat`,{session_id:this.sessionId,worker_epoch:this.workerEpoch},`Heartbeat`,{timeout:5e3})).ok&&o(`CCRClient: Heartbeat sent`)}finally{this.heartbeatInFlight=!1}}}async writeEvent(e){if(e.type===`stream_event`){this.streamEventBuffer.push(e),this.streamEventTimer||(this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),A));return}await this.flushStreamEventBuffer(),e.type===`assistant`&&L(this.streamTextAccumulator,e),await this.eventUploader.enqueue(this.toClientEvent(e))}toClientEvent(e){let t=e;return{payload:{...t,uuid:typeof t.uuid==`string`?t.uuid:w()}}}async flushStreamEventBuffer(){if(this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer.length===0)return;let e=this.streamEventBuffer;this.streamEventBuffer=[];let t=I(e,this.streamTextAccumulator);await this.eventUploader.enqueue(t.map(e=>({payload:e,ephemeral:!0})))}async writeInternalEvent(e,t,{isCompaction:n=!1,agentId:r}={}){let i={payload:{type:e,...t,uuid:typeof t.uuid==`string`?t.uuid:w()},...n&&{is_compaction:!0},...r&&{agent_id:r}};await this.internalEventUploader.enqueue(i)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{},`internal_events`)}async readSubagentInternalEvents(){return this.paginatedGet(`/worker/internal-events`,{subagents:`true`},`subagent_events`)}async paginatedGet(e,t,n){let r=this.getAuthHeaders();if(Object.keys(r).length===0)return null;let i=[],a;do{let o=new URL(`${this.sessionBaseUrl}${e}`);for(let[e,n]of Object.entries(t))o.searchParams.set(e,n);a&&o.searchParams.set(`cursor`,a);let s=await this.getWithRetry(o.toString(),r,n);if(!s)return null;i.push(...s.data??[]),a=s.next_cursor}while(a);return o(`CCRClient: Read ${i.length} internal events from ${e}${t.subagents?` (subagents)`:``}`),i}async getWithRetry(e,t,r){for(let r=1;r<=10;r++){let i;try{i=await this.http.get(e,{headers:{...t,"anthropic-version":`2023-06-01`,"User-Agent":f()},validateStatus:j,timeout:3e4})}catch(t){o(`CCRClient: GET ${e} failed (attempt ${r}/10): ${n(t)}`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500);continue}if(i.status>=200&&i.status<300)return i.data;i.status===409&&this.handleEpochMismatch(),o(`CCRClient: GET ${e} returned ${i.status} (attempt ${r}/10)`,{level:`warn`}),r<10&&await m(Math.min(500*2**(r-1),3e4)+Math.random()*500)}return o(`CCRClient: GET retries exhausted`,{level:`error`}),l(`error`,`cli_worker_get_retries_exhausted`,{context:r}),null}reportDelivery(e,t){this.deliveryUploader.enqueue({eventId:e,status:t})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){this.closed=!0,this.stopHeartbeat(),x(),this.streamEventTimer&&(clearTimeout(this.streamEventTimer),this.streamEventTimer=null),this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}};export{M as n,E as r,R as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./conversation-BWVTM40Y.js";var r;e((()=>{t(),r=async(e,t)=>(await n(t),{type:`text`,value:``})}))();export{r as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Lr as e,Rr as t}from"./model-CKkOnnnx.js";t();export{e as getOrganizationUUID};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-ix0xIunV.js";import{$d as r,Er as i,Xd as a,jr as o,mi as s}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-ix0xIunV.js";import{$d as r,Er as i,Xd as a,jr as o,mi as s}from"./loadAgentsDir-D206qwP3.js";async function c(e,t,r){if(!r||r.trim()===``)return e(`Please provide a color. Available colors: ${a.join(`, `)}, default`,{display:`system`}),null;let o=r.trim().toLowerCase();return l.includes(o)?(await s(n(),`default`,i()),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:void 0}})),e(`Session color reset to default`,{display:`system`}),null):a.includes(o)?(await s(n(),o,i()),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:e.standaloneAgentContext?.name??``,color:o}})),e(`Session color set to: ${o}`,{display:`system`}),null):(e(`Invalid color "${o}". Available colors: ${a.join(`, `)}, default`,{display:`system`}),null)}var l;e((()=>{t(),r(),o(),l=[`default`,`reset`,`none`,`gray`,`grey`]}))();export{c as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Qi as e,Vi as t,qi as n}from"./loadAgentsDir-D206qwP3.js";e();export{t as clearCommandsCache,n as getCommands};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as e,l as t}from"./commitAttribution-ChAgixdj.js";t();export{e as isInternalModelRepo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-ix0xIunV.js";import{n as i,t as a}from"./cwd-CYmmnQVS.js";import{a as o,p as s}from"./debug-BrXObCdR.js";import{T as c,_ as l,g as u,r as d,w as f}from"./git-Do0wJvux.js";import{n as p,r as m}from"./execFileNoThrow-D244NytW.js";import{o as h}from"./log-BMCygSzM.js";import{_ as g,mi as _,pi as v}from"./model-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-ix0xIunV.js";import{n as i,t as a}from"./cwd-CYmmnQVS.js";import{a as o,p as s}from"./debug-BrXObCdR.js";import{T as c,_ as l,g as u,r as d,w as f}from"./git-Do0wJvux.js";import{n as p,r as m}from"./execFileNoThrow-D244NytW.js";import{o as h}from"./log-BMCygSzM.js";import{_ as g,mi as _,pi as v}from"./model-CKkOnnnx.js";import{basename as y,extname as b,join as x,posix as S,sep as C}from"path";import{randomUUID as w}from"crypto";import{stat as T}from"fs/promises";function E(e){let t=S.sep+e.split(C).join(S.sep).replace(/^\/+/,``),n=y(e).toLowerCase(),r=b(e).toLowerCase();if(D.has(n)||O.has(r))return!0;let i=n.split(`.`);if(i.length>2){let e=`.`+i.slice(-2).join(`.`);if(O.has(e))return!0}for(let e of k)if(t.includes(e))return!0;for(let e of A)if(e.test(n))return!0;return!1}var D,O,k,A,j=e((()=>{D=new Set([`package-lock.json`,`yarn.lock`,`pnpm-lock.yaml`,`bun.lockb`,`bun.lock`,`composer.lock`,`gemfile.lock`,`cargo.lock`,`poetry.lock`,`pipfile.lock`,`shrinkwrap.json`,`npm-shrinkwrap.json`]),O=new Set([`.lock`,`.min.js`,`.min.css`,`.min.html`,`.bundle.js`,`.bundle.css`,`.generated.ts`,`.generated.js`,`.d.ts`]),k=[`/dist/`,`/build/`,`/out/`,`/output/`,`/node_modules/`,`/vendor/`,`/vendored/`,`/third_party/`,`/third-party/`,`/external/`,`/.next/`,`/.nuxt/`,`/.svelte-kit/`,`/coverage/`,`/__pycache__/`,`/.tox/`,`/venv/`,`/.venv/`,`/target/release/`,`/target/debug/`],A=[/^.*\.min\.[a-z]+$/i,/^.*-min\.[a-z]+$/i,/^.*\.bundle\.[a-z]+$/i,/^.*\.generated\.[a-z]+$/i,/^.*\.gen\.[a-z]+$/i,/^.*\.auto\.[a-z]+$/i,/^.*_generated\.[a-z]+$/i,/^.*_gen\.[a-z]+$/i,/^.*\.pb\.(go|js|ts|py|rb)$/i,/^.*_pb2?\.py$/i,/^.*\.pb\.h$/i,/^.*\.grpc\.[a-z]+$/i,/^.*\.swagger\.[a-z]+$/i,/^.*\.openapi\.[a-z]+$/i]}));function M(){return d(a())??r()}function N(){return W}function P(){return process.env.CLAUDE_CODE_ENTRYPOINT??`cli`}function F(){return{fileStates:new Map,sessionBaselines:new Map,surface:P(),startingHeadSha:null,promptCount:0,promptCountAtLastCommit:0,permissionPromptCount:0,permissionPromptCountAtLastCommit:0,escapeCount:0,escapeCountAtLastCommit:0}}async function I(e,t){let r=M(),i=n(),a={},o=[],s=new Set,c={},l=0,u=0,d=new Map,f=new Map;for(let t of e){s.add(t.surface);let e=t.sessionBaselines instanceof Map?t.sessionBaselines:new Map(Object.entries(t.sessionBaselines??{}));for(let[t,n]of e)f.has(t)||f.set(t,n);let n=t.fileStates instanceof Map?t.fileStates:new Map(Object.entries(t.fileStates??{}));for(let[e,t]of n){let n=d.get(e);n?d.set(e,{...t,claudeContribution:n.claudeContribution+t.claudeContribution}):d.set(e,t)}}let p=await Promise.all(t.map(async t=>{if(E(t))return{type:`generated`,file:t};let n=x(r,t),i=d.get(t),a=f.get(t),o=e[0].surface,s=0,c=0;if(await R(t))if(i)s=i.claudeContribution,c=0;else{let e=await L(t);c=e>0?e:100}else try{let e=await T(n);if(i)s=i.claudeContribution,c=0;else if(a){let n=await L(t);c=n>0?n:e.size}else c=e.size}catch{return null}s=Math.max(0,s),c=Math.max(0,c);let l=s+c,u=l>0?Math.round(s/l*100):0;return{type:`file`,file:t,claudeChars:s,humanChars:c,percent:u,surface:o}}));for(let e of p)if(e){if(e.type===`generated`){o.push(e.file);continue}a[e.file]={claudeChars:e.claudeChars,humanChars:e.humanChars,percent:e.percent,surface:e.surface},l+=e.claudeChars,u+=e.humanChars,c[e.surface]=(c[e.surface]??0)+e.claudeChars}let m=l+u,h=m>0?Math.round(l/m*100):0,g={};for(let[e,t]of Object.entries(c))g[e]={claudeChars:t,percent:m>0?Math.round(t/m*100):0};return{version:1,summary:{claudePercent:h,claudeChars:l,humanChars:u,surfaces:Array.from(s)},files:a,surfaceBreakdown:g,excludedGenerated:o,sessions:[i]}}async function L(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--stat`,`--`,e],{cwd:t,timeout:5e3});if(n.code!==0||!n.stdout)return 0;let r=n.stdout.split(`
|
|
2
2
|
`).filter(Boolean),i=0;for(let e of r)if(e.includes(`file changed`)||e.includes(`files changed`)){let t=e.match(/(\d+) insertions?/),n=e.match(/(\d+) deletions?/),r=t?parseInt(t[1],10):0,a=n?parseInt(n[1],10):0;i+=(r+a)*40}return i}catch{return 0}}async function R(e){let t=M();try{let n=await p(u(),[`diff`,`--cached`,`--name-status`,`--`,e],{cwd:t,timeout:5e3});if(n.code===0&&n.stdout)return n.stdout.trim().startsWith(`D `)}catch{}return!1}function z(e,t){let n={};for(let[t,r]of e.fileStates)n[t]=r;return{type:`attribution-snapshot`,messageId:t,surface:e.surface,fileStates:n,promptCount:e.promptCount,promptCountAtLastCommit:e.promptCountAtLastCommit,permissionPromptCount:e.permissionPromptCount,permissionPromptCountAtLastCommit:e.permissionPromptCountAtLastCommit,escapeCount:e.escapeCount,escapeCountAtLastCommit:e.escapeCountAtLastCommit}}function B(e){let t=F(),n=e[e.length-1];if(!n)return t;t.surface=n.surface;for(let[e,r]of Object.entries(n.fileStates))t.fileStates.set(e,r);return t.promptCount=n.promptCount??0,t.promptCountAtLastCommit=n.promptCountAtLastCommit??0,t.permissionPromptCount=n.permissionPromptCount??0,t.permissionPromptCountAtLastCommit=n.permissionPromptCountAtLastCommit??0,t.escapeCount=n.escapeCount??0,t.escapeCountAtLastCommit=n.escapeCountAtLastCommit??0,t}function V(e,t){t(B(e))}function H(e,t){let n={...e,promptCount:e.promptCount+1};return t(z(n,w())),n}var U,W,G,K=e((()=>{t(),i(),o(),m(),s(),j(),c(),l(),h(),g(),v(),U=`github.com:anthropics/claude-cli-internal,github.com/anthropics/claude-cli-internal,github.com:anthropics/anthropic,github.com/anthropics/anthropic,github.com:anthropics/apps,github.com/anthropics/apps,github.com:anthropics/casino,github.com/anthropics/casino,github.com:anthropics/dbt,github.com/anthropics/dbt,github.com:anthropics/dotfiles,github.com/anthropics/dotfiles,github.com:anthropics/terraform-config,github.com/anthropics/terraform-config,github.com:anthropics/hex-export,github.com/anthropics/hex-export,github.com:anthropics/feedback-v2,github.com/anthropics/feedback-v2,github.com:anthropics/labs,github.com/anthropics/labs,github.com:anthropics/argo-rollouts,github.com/anthropics/argo-rollouts,github.com:anthropics/starling-configs,github.com/anthropics/starling-configs,github.com:anthropics/ts-tools,github.com/anthropics/ts-tools,github.com:anthropics/ts-capsules,github.com/anthropics/ts-capsules,github.com:anthropics/feldspar-testing,github.com/anthropics/feldspar-testing,github.com:anthropics/trellis,github.com/anthropics/trellis,github.com:anthropics/claude-for-hiring,github.com/anthropics/claude-for-hiring,github.com:anthropics/forge-web,github.com/anthropics/forge-web,github.com:anthropics/infra-manifests,github.com/anthropics/infra-manifests,github.com:anthropics/mycro_manifests,github.com/anthropics/mycro_manifests,github.com:anthropics/mycro_configs,github.com/anthropics/mycro_configs,github.com:anthropics/mobile-apps,github.com/anthropics/mobile-apps`.split(`,`),W=null,G=_(async()=>{if(W!==null)return W===`internal`;let e=await f(M());if(!e)return W=`none`,!1;let t=U.some(t=>e.includes(t));return W=t?`internal`:`external`,t})}));export{P as a,H as c,G as d,B as f,M as i,K as l,I as n,L as o,z as p,F as r,N as s,V as t,R as u};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,ui as n}from"./src-CDCSSo0U2.js";import{en as r,rn as i}from"./state-ix0xIunV.js";import{Ao as a,DS as o,ES as s,Gu as c,KE as l,ME as u,NE as d,Sl as f,Wu as p,XE as m,ZE as h,_l as g,bE as _,dl as v,eD as y,fh as b,hl as x,jE as S,ll as C,lt as w,mE as T,ph as E,qE as D,tD as O,ut as k,vl as A,xl as j,yl as M,yn as N,zo as P}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{di as t,ui as n}from"./src-CDCSSo0U2.js";import{en as r,rn as i}from"./state-ix0xIunV.js";import{Ao as a,DS as o,ES as s,Gu as c,KE as l,ME as u,NE as d,Sl as f,Wu as p,XE as m,ZE as h,_l as g,bE as _,dl as v,eD as y,fh as b,hl as x,jE as S,ll as C,lt as w,mE as T,ph as E,qE as D,tD as O,ut as k,vl as A,xl as j,yl as M,yn as N,zo as P}from"./loadAgentsDir-D206qwP3.js";import{R as F,z as I}from"./debug-BrXObCdR.js";import{o as L,s as R}from"./log-BMCygSzM.js";function z(e,t){let r=b(`tip`),i=s(`app:toggleTranscript`,`Global`,`ctrl+o`),a=[...e.options.verbose?[]:[`(${i} to see full summary)`],...t?[t]:[],...r?[r]:[]];return n.dim(`Compacted `+a.join(`
|
|
2
2
|
`))}async function B(e,t){let n=e.getAppState(),r=await w(e.options.tools,e.options.mainLoopModel,Array.from(n.toolPermissionContext.additionalWorkingDirectories.keys()),e.options.mcpClients),i=p({mainThreadAgentDefinition:void 0,toolUseContext:e,customSystemPrompt:e.options.customSystemPrompt,defaultSystemPrompt:r,appendSystemPrompt:e.options.appendSystemPrompt}),[a,o]=await Promise.all([u(),S()]);return{systemPrompt:i,userContext:a,systemContext:o,toolUseContext:e,forkContextMessages:t}}var V;e((()=>{t(),r(),k(),d(),o(),y(),f(),m(),l(),x(),C(),T(),I(),N(),L(),P(),E(),c(),V=async(e,t)=>{let{abortController:n}=t,{messages:r}=t;if(r=a(r),r.length===0)throw Error(`No messages to compact`);let o=e.trim();try{if(!o){let e=await v(r,t.agentId);if(e)return u.cache.clear?.(),g(),O(t.options.querySource??`compact`,t.agentId),i(),h(),{type:`compact`,compactionResult:e,displayText:z(t)}}let e=(await D(r,t)).messages,n=await j(e,t,await B(t,e),!1,o,!1);return _(void 0),h(),u.cache.clear?.(),g(),{type:`compact`,compactionResult:n,displayText:z(t,n.userDisplayMessage)}}catch(e){throw n.signal.aborted?Error(`Compaction canceled.`):F(e,`Not enough messages to compact. Send a few more messages first, then try again.`)?Error(M):F(e,`Compaction interrupted · This may be due to network issues — please try again.`)?Error(A):(R(e),Error(`Error during compaction: ${e}`))}}}))();export{V as call};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./loadAgentsDir-D206qwP3.js";import{b as e,c as t,g as n,n as r,o as i,r as a,y as o}from"./config-DmomySWC.js";n();export{r as checkHasTrustDialogAccepted,a as enableConfigs,i as getCurrentProjectConfig,t as getGlobalConfig,o as saveCurrentProjectConfig,e as saveGlobalConfig};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,l as c,n as l,o as u}from"./envUtils-DSxRz_kt.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ai as f,Br as p,Di as m,Ei as h,Fi as g,Fr as _,Hr as v,Kr as ee,Pi as te,Pr as ne,Rr as re,Ti as ie,Ur as ae,Vr as oe,en as se,ji as ce,nt as le,ot as y,qr as ue,vi as de,vt as fe,wi as pe,yi as me,zr as he}from"./state-ix0xIunV.js";import{n as ge,t as _e}from"./cwd-CYmmnQVS.js";import{C as ve,I as b,S as ye,a as be,d as x,k as xe,l as S,nt as Se,p as Ce,rt as we,w as C,z as Te}from"./debug-BrXObCdR.js";import{Bn as Ee,Kn as De,Qt as Oe,Vn as ke,Xn as Ae,Yt as w,Zn as je,Zt as Me,c as T,en as Ne,g as Pe,n as Fe,qn as Ie}from"./settings-Dlp5JTa_.js";import{M as Le,_ as Re,j as ze,n as Be}from"./git-Do0wJvux.js";import{d as Ve,o as He,s as Ue,u as We}from"./log-BMCygSzM.js";import{m as Ge}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{a as E,i as Ke}from"./path-D5U-tm91.js";import{C as qe,f as Je}from"./file-DcZWPH2V.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-C-MRCL8J.js";import{n as $e,r as D}from"./analytics-BotDBGh0.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as nt,resolve as rt,sep as it}from"path";import{unwatchFile as at,watchFile as ot}from"fs";import{randomBytes as st}from"crypto";var j,ct=t((()=>{g(),ke(),ie(),h(),j=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)te(t,pe(e)),e=Ee(e);return t}:m}));function lt(e){return f(e,Ie,j)}var ut=t((()=>{ce(),ct(),De()}));function dt(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(c(e))return!1;if(s(e))return!0;if(c(process.env.CLAUDE_CODE_SIMPLE)||c(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Fe();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function ft(){return!1}function pt(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:l()}function mt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=nt(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=nt(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+it).normalize(`NFC`)}function ht(){return mt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function gt(){return mt(T(`policySettings`)?.autoMemoryDirectory??T(`flagSettings`)?.autoMemoryDirectory??T(`localSettings`)?.autoMemoryDirectory??T(`userSettings`)?.autoMemoryDirectory,!0)}function _t(){return ht()!==void 0}function vt(){return Be(y())??y()}function yt(){return A(M(),St)}function bt(e){return nt(e).startsWith(M())}var xt,St,M,Ct=t((()=>{o(),se(),u(),Re(),Ke(),Pe(),xt=`memory`,St=`MEMORY.md`,M=a(()=>(ht()??gt())||(A(A(pt(),`projects`),Ge(vt()),xt)+it).normalize(`NFC`),()=>y())}));function wt(e,t,n,i){if(!r(e))return e;t=v(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=oe(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:me(t[a+1])?[]:{})}Ae(c,l,u),c=c[l]}return e}var Tt=t((()=>{je(),ae(),de(),i(),p()}));function Et(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=re(e,o);n(s,o)&&wt(a,v(o,e),s)}return a}var Dt=t((()=>{he(),Tt(),ae()}));function N(e,t){if(e==null)return{};var n=ee(lt(e),function(e){return[e]});return t=ne(t),Et(e,n,function(e,n){return t(e,n[0])})}var Ot=t((()=>{ue(),_(),Dt(),ut()})),kt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),At=n((e=>{var t=kt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),jt=n(((e,t)=>{t.exports=At()})),Mt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Nt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Mt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Pt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Ft=n(((t,n)=>{var r=e(`path`),i=d(),a=jt(),o=Nt(),s=Pt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),It=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Lt=n(((e,t)=>{var n=Ft(),{toPromise:r,toSync:i,toSyncOptions:a}=It();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function P(){return F||(F=Lt()),F}function Rt(e,t){return P().lock(e,t)}function zt(e,t){return P().lockSync(e,t)}function Bt(e,t){return P().unlock(e,t)}function Vt(e,t){return P().check(e,t)}var F,Ht=t((()=>{}));function I(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Ut(){return G||(G=Wt())}function Wt(){if(fe())return!0;let e=B(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=E(_e());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=E(rt(n,`..`));if(t===n)break;n=t}return!1}function L(e){let t=K.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function R(e){let t=null;try{$t(w(),I,n=>{let r=e(n);return r===n?n:(t={...r,projects:Jt(n.projects)},t)})&&t&&z(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=V(w(),I);if(L(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Jt(r.projects)},Qt(w(),t,W),z(t)}}function Gt(){return X}function Kt(){let e=J+Y;e>0&&D(`tengu_config_cache_stats`,{cache_hits:J,cache_misses:Y,hit_rate:J/e}),J=0,Y=0}function qt(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Jt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Yt(){if(Z)return;Z=!0;let e=w();ot(e,{interval:hn,persistent:!1},t=>{t.mtimeMs<=K.mtime||x().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(K={config:qt({...I(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),we(async()=>{at(e),Z=!1})}function z(e){K={config:e,mtime:Date.now()},q=null}function B(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=x().statSync(w())}catch{}let t=qt(V(w(),I));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,Yt(),t}catch{return qt(V(w(),I))}}function Xt(){let e=B().remoteControlAtStartup;return e!==void 0&&e}function Zt(e){let t=B();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Qt(e,t,n){let r=k(e);x().mkdirSync(r),qe(e,C(N(t,(e,t)=>C(e)!==C(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++}function $t(e,t,n){let r=t(),i=k(e),a=x();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=zt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Claude instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),q&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&D(`tengu_config_stale_write`,{read_mtime:q.mtime,write_mtime:t.mtimeMs,read_size:q.size,write_size:t.size})}catch(e){if(b(e)!==`ENOENT`)throw e}let l=V(e,t);if(e===w()&&L(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=N(u,(e,t)=>C(e)!==C(r[t]));try{let t=O(e),n=tn();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return qe(e,C(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++,!0}finally{o&&o()}}function en(){if(Q)return;let e=Date.now();Le(`info`,`enable_configs_started`),Q=!0,V(w(),I,!0),Le(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function tn(){return A(l(),`backups`)}function nn(e){let t=x(),n=O(e),r=tn();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function V(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=x();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=ve(Xe(n));return{...t(),...e}}catch(n){throw new xe(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=nn(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof xe&&n)throw i;if(i instanceof xe){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!H){H=!0;try{Ue(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{H=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=tn();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=nn(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
|
|
1
|
+
import{i as e,n as t,t as n}from"./rolldown-runtime-DaDcL9Zw.js";import{n as r,t as i}from"./isObject-C6qM3WEW.js";import{n as a,t as o}from"./memoize-BK3gG5ob.js";import{c as s,l as c,n as l,o as u}from"./envUtils-DSxRz_kt.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ai as f,Br as p,Di as m,Ei as h,Fi as g,Fr as _,Hr as v,Kr as ee,Pi as te,Pr as ne,Rr as re,Ti as ie,Ur as ae,Vr as oe,en as se,ji as ce,nt as le,ot as y,qr as ue,vi as de,vt as fe,wi as pe,yi as me,zr as he}from"./state-ix0xIunV.js";import{n as ge,t as _e}from"./cwd-CYmmnQVS.js";import{C as ve,I as b,S as ye,a as be,d as x,k as xe,l as S,nt as Se,p as Ce,rt as we,w as C,z as Te}from"./debug-BrXObCdR.js";import{Bn as Ee,Kn as De,Qt as Oe,Vn as ke,Xn as Ae,Yt as w,Zn as je,Zt as Me,c as T,en as Ne,g as Pe,n as Fe,qn as Ie}from"./settings-BovzmwMP.js";import{M as Le,_ as Re,j as ze,n as Be}from"./git-Do0wJvux.js";import{d as Ve,o as He,s as Ue,u as We}from"./log-BMCygSzM.js";import{m as Ge}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{a as E,i as Ke}from"./path-D5U-tm91.js";import{C as qe,f as Je}from"./file-DcZWPH2V.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-C-MRCL8J.js";import{n as $e,r as D}from"./analytics-BotDBGh0.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as nt,resolve as rt,sep as it}from"path";import{unwatchFile as at,watchFile as ot}from"fs";import{randomBytes as st}from"crypto";var j,ct=t((()=>{g(),ke(),ie(),h(),j=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)te(t,pe(e)),e=Ee(e);return t}:m}));function lt(e){return f(e,Ie,j)}var ut=t((()=>{ce(),ct(),De()}));function dt(){let e=process.env.CLAUDE_CODE_DISABLE_AUTO_MEMORY;if(c(e))return!1;if(s(e))return!0;if(c(process.env.CLAUDE_CODE_SIMPLE)||c(process.env.CLAUDE_CODE_REMOTE)&&!process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR)return!1;let t=Fe();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function ft(){return!1}function pt(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:l()}function mt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=nt(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=nt(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+it).normalize(`NFC`)}function ht(){return mt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function gt(){return mt(T(`policySettings`)?.autoMemoryDirectory??T(`flagSettings`)?.autoMemoryDirectory??T(`localSettings`)?.autoMemoryDirectory??T(`userSettings`)?.autoMemoryDirectory,!0)}function _t(){return ht()!==void 0}function vt(){return Be(y())??y()}function yt(){return A(M(),St)}function bt(e){return nt(e).startsWith(M())}var xt,St,M,Ct=t((()=>{o(),se(),u(),Re(),Ke(),Pe(),xt=`memory`,St=`MEMORY.md`,M=a(()=>(ht()??gt())||(A(A(pt(),`projects`),Ge(vt()),xt)+it).normalize(`NFC`),()=>y())}));function wt(e,t,n,i){if(!r(e))return e;t=v(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=oe(t[a]),u=n;if(l===`__proto__`||l===`constructor`||l===`prototype`)return e;if(a!=s){var d=c[l];u=i?i(d,l,c):void 0,u===void 0&&(u=r(d)?d:me(t[a+1])?[]:{})}Ae(c,l,u),c=c[l]}return e}var Tt=t((()=>{je(),ae(),de(),i(),p()}));function Et(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=re(e,o);n(s,o)&&wt(a,v(o,e),s)}return a}var Dt=t((()=>{he(),Tt(),ae()}));function N(e,t){if(e==null)return{};var n=ee(lt(e),function(e){return[e]});return t=ne(t),Et(e,n,function(e,n){return t(e,n[0])})}var Ot=t((()=>{ue(),_(),Dt(),ut()})),kt=n(((e,t)=>{function n(e,t){typeof t==`boolean`&&(t={forever:t}),this._originalTimeouts=JSON.parse(JSON.stringify(e)),this._timeouts=e,this._options=t||{},this._maxRetryTime=t&&t.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}t.exports=n,n.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts},n.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timeouts=[],this._cachedTimeouts=null},n.prototype.retry=function(e){if(this._timeout&&clearTimeout(this._timeout),!e)return!1;var t=new Date().getTime();if(e&&t-this._operationStart>=this._maxRetryTime)return this._errors.unshift(Error(`RetryOperation timeout occurred`)),!1;this._errors.push(e);var n=this._timeouts.shift();if(n===void 0)if(this._cachedTimeouts)this._errors.splice(this._errors.length-1,this._errors.length),this._timeouts=this._cachedTimeouts.slice(0),n=this._timeouts.shift();else return!1;var r=this,i=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},n);return this._options.unref&&i.unref(),!0},n.prototype.attempt=function(e,t){this._fn=e,t&&(t.timeout&&(this._operationTimeout=t.timeout),t.cb&&(this._operationTimeoutCb=t.cb));var n=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){n._operationTimeoutCb()},n._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)},n.prototype.try=function(e){console.log(`Using RetryOperation.try() is deprecated`),this.attempt(e)},n.prototype.start=function(e){console.log(`Using RetryOperation.start() is deprecated`),this.attempt(e)},n.prototype.start=n.prototype.try,n.prototype.errors=function(){return this._errors},n.prototype.attempts=function(){return this._attempts},n.prototype.mainError=function(){if(this._errors.length===0)return null;for(var e={},t=null,n=0,r=0;r<this._errors.length;r++){var i=this._errors[r],a=i.message,o=(e[a]||0)+1;e[a]=o,o>=n&&(t=i,n=o)}return t}})),At=n((e=>{var t=kt();e.operation=function(n){return new t(e.timeouts(n),{forever:n&&n.forever,unref:n&&n.unref,maxRetryTime:n&&n.maxRetryTime})},e.timeouts=function(e){if(e instanceof Array)return[].concat(e);var t={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var n in e)t[n]=e[n];if(t.minTimeout>t.maxTimeout)throw Error(`minTimeout is greater than maxTimeout`);for(var r=[],i=0;i<t.retries;i++)r.push(this.createTimeout(i,t));return e&&e.forever&&!r.length&&r.push(this.createTimeout(i,t)),r.sort(function(e,t){return e-t}),r},e.createTimeout=function(e,t){var n=t.randomize?Math.random()+1:1,r=Math.round(n*t.minTimeout*t.factor**+e);return r=Math.min(r,t.maxTimeout),r},e.wrap=function(t,n,r){if(n instanceof Array&&(r=n,n=null),!r)for(var i in r=[],t)typeof t[i]==`function`&&r.push(i);for(var a=0;a<r.length;a++){var o=r[a],s=t[o];t[o]=function(r){var i=e.operation(n),a=Array.prototype.slice.call(arguments,1),o=a.pop();a.push(function(e){i.retry(e)||(e&&(arguments[0]=i.mainError()),o.apply(this,arguments))}),i.attempt(function(){r.apply(t,a)})}.bind(t,s),t[o].options=n}}})),jt=n(((e,t)=>{t.exports=At()})),Mt=n(((e,t)=>{t.exports=[`SIGABRT`,`SIGALRM`,`SIGHUP`,`SIGINT`,`SIGTERM`],process.platform!==`win32`&&t.exports.push(`SIGVTALRM`,`SIGXCPU`,`SIGXFSZ`,`SIGUSR2`,`SIGTRAP`,`SIGSYS`,`SIGQUIT`,`SIGIOT`),process.platform===`linux`&&t.exports.push(`SIGIO`,`SIGPOLL`,`SIGPWR`,`SIGSTKFLT`,`SIGUNUSED`)})),Nt=n(((t,n)=>{var r=global.process,i=function(e){return e&&typeof e==`object`&&typeof e.removeListener==`function`&&typeof e.emit==`function`&&typeof e.reallyExit==`function`&&typeof e.listeners==`function`&&typeof e.kill==`function`&&typeof e.pid==`number`&&typeof e.on==`function`};if(!i(r))n.exports=function(){return function(){}};else{var a=e(`assert`),o=Mt(),s=/^win/i.test(r.platform),c=e(`events`);typeof c!=`function`&&(c=c.EventEmitter);var l;r.__signal_exit_emitter__?l=r.__signal_exit_emitter__:(l=r.__signal_exit_emitter__=new c,l.count=0,l.emitted={}),l.infinite||(l.setMaxListeners(1/0),l.infinite=!0),n.exports=function(e,t){if(!i(global.process))return function(){};a.equal(typeof e,`function`,`a callback must be provided for exit handler`),p===!1&&m();var n=`exit`;return t&&t.alwaysLast&&(n=`afterexit`),l.on(n,e),function(){l.removeListener(n,e),l.listeners(`exit`).length===0&&l.listeners(`afterexit`).length===0&&u()}};var u=function(){!p||!i(global.process)||(p=!1,o.forEach(function(e){try{r.removeListener(e,f[e])}catch{}}),r.emit=_,r.reallyExit=h,--l.count)};n.exports.unload=u;var d=function(e,t,n){l.emitted[e]||(l.emitted[e]=!0,l.emit(e,t,n))},f={};o.forEach(function(e){f[e]=function(){i(global.process)&&r.listeners(e).length===l.count&&(u(),d(`exit`,null,e),d(`afterexit`,null,e),s&&e===`SIGHUP`&&(e=`SIGINT`),r.kill(r.pid,e))}}),n.exports.signals=function(){return o};var p=!1,m=function(){p||!i(global.process)||(p=!0,l.count+=1,o=o.filter(function(e){try{return r.on(e,f[e]),!0}catch{return!1}}),r.emit=v,r.reallyExit=g)};n.exports.load=m;var h=r.reallyExit,g=function(e){i(global.process)&&(r.exitCode=e||0,d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),h.call(r,r.exitCode))},_=r.emit,v=function(e,t){if(e===`exit`&&i(global.process)){t!==void 0&&(r.exitCode=t);var n=_.apply(this,arguments);return d(`exit`,r.exitCode,null),d(`afterexit`,r.exitCode,null),n}else return _.apply(this,arguments)}}})),Pt=n(((e,t)=>{var n=Symbol();function r(e,t,r){let i=t[n];if(i)return t.stat(e,(e,t)=>{if(e)return r(e);r(null,t.mtime,i)});let a=new Date(Math.ceil(Date.now()/1e3)*1e3+5);t.utimes(e,a,a,i=>{if(i)return r(i);t.stat(e,(e,i)=>{if(e)return r(e);let a=i.mtime.getTime()%1e3==0?`s`:`ms`;Object.defineProperty(t,n,{value:a}),r(null,i.mtime,a)})})}function i(e){let t=Date.now();return e===`s`&&(t=Math.ceil(t/1e3)*1e3),new Date(t)}t.exports.probe=r,t.exports.getMtime=i})),Ft=n(((t,n)=>{var r=e(`path`),i=d(),a=jt(),o=Nt(),s=Pt(),c={};function l(e,t){return t.lockfilePath||`${e}.lock`}function u(e,t,n){if(!t.realpath)return n(null,r.resolve(e));t.fs.realpath(e,n)}function f(e,t,n){let r=l(e,t);t.fs.mkdir(r,i=>{if(!i)return s.probe(r,t.fs,(e,i,a)=>{if(e)return t.fs.rmdir(r,()=>{}),n(e);n(null,i,a)});if(i.code!==`EEXIST`)return n(i);if(t.stale<=0)return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));t.fs.stat(r,(r,i)=>{if(r)return r.code===`ENOENT`?f(e,{...t,stale:0},n):n(r);if(!p(i,t))return n(Object.assign(Error(`Lock file is already being held`),{code:`ELOCKED`,file:e}));m(e,t,r=>{if(r)return n(r);f(e,{...t,stale:0},n)})})})}function p(e,t){return e.mtime.getTime()<Date.now()-t.stale}function m(e,t,n){t.fs.rmdir(l(e,t),e=>{if(e&&e.code!==`ENOENT`)return n(e);n()})}function h(e,t){let n=c[e];n.updateTimeout||(n.updateDelay=n.updateDelay||t.update,n.updateTimeout=setTimeout(()=>{n.updateTimeout=null,t.fs.stat(n.lockfilePath,(r,i)=>{let a=n.lastUpdate+t.stale<Date.now();if(r)return r.code===`ENOENT`||a?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));if(n.mtime.getTime()!==i.mtime.getTime())return g(e,n,Object.assign(Error(`Unable to update lock within the stale threshold`),{code:`ECOMPROMISED`}));let o=s.getMtime(n.mtimePrecision);t.fs.utimes(n.lockfilePath,o,o,r=>{let i=n.lastUpdate+t.stale<Date.now();if(!n.released){if(r)return r.code===`ENOENT`||i?g(e,n,Object.assign(r,{code:`ECOMPROMISED`})):(n.updateDelay=1e3,h(e,t));n.mtime=o,n.lastUpdate=Date.now(),n.updateDelay=null,h(e,t)}})})},n.updateDelay),n.updateTimeout.unref&&n.updateTimeout.unref())}function g(e,t,n){t.released=!0,t.updateTimeout&&clearTimeout(t.updateTimeout),c[e]===t&&delete c[e],t.options.onCompromised(n)}function _(e,t,n){t={stale:1e4,update:null,realpath:!0,retries:0,fs:i,onCompromised:e=>{throw e},...t},t.retries=t.retries||0,t.retries=typeof t.retries==`number`?{retries:t.retries}:t.retries,t.stale=Math.max(t.stale||0,2e3),t.update=t.update==null?t.stale/2:t.update||0,t.update=Math.max(Math.min(t.update,t.stale/2),1e3),u(e,t,(e,r)=>{if(e)return n(e);let i=a.operation(t.retries);i.attempt(()=>{f(r,t,(e,a,o)=>{if(i.retry(e))return;if(e)return n(i.mainError());let s=c[r]={lockfilePath:l(r,t),mtime:a,mtimePrecision:o,options:t,lastUpdate:Date.now()};h(r,t),n(null,e=>{if(s.released)return e&&e(Object.assign(Error(`Lock is already released`),{code:`ERELEASED`}));v(r,{...t,realpath:!1},e)})})})})}function v(e,t,n){t={fs:i,realpath:!0,...t},u(e,t,(e,r)=>{if(e)return n(e);let i=c[r];if(!i)return n(Object.assign(Error(`Lock is not acquired/owned by you`),{code:`ENOTACQUIRED`}));i.updateTimeout&&clearTimeout(i.updateTimeout),i.released=!0,delete c[r],m(r,t,n)})}function ee(e,t,n){t={stale:1e4,realpath:!0,fs:i,...t},t.stale=Math.max(t.stale||0,2e3),u(e,t,(e,r)=>{if(e)return n(e);t.fs.stat(l(r,t),(e,r)=>e?e.code===`ENOENT`?n(null,!1):n(e):n(null,!p(r,t)))})}function te(){return c}o(()=>{for(let e in c){let t=c[e].options;try{t.fs.rmdirSync(l(e,t))}catch{}}}),n.exports.lock=_,n.exports.unlock=v,n.exports.check=ee,n.exports.getLocks=te})),It=n(((e,t)=>{var n=d();function r(e){let t=[`mkdir`,`realpath`,`stat`,`rmdir`,`utimes`],n={...e};return t.forEach(t=>{n[t]=(...n)=>{let r=n.pop(),i;try{i=e[`${t}Sync`](...n)}catch(e){return r(e)}r(null,i)}}),n}function i(e){return(...t)=>new Promise((n,r)=>{t.push((e,t)=>{e?r(e):n(t)}),e(...t)})}function a(e){return(...t)=>{let n,r;if(t.push((e,t)=>{n=e,r=t}),e(...t),n)throw n;return r}}function o(e){if(e={...e},e.fs=r(e.fs||n),typeof e.retries==`number`&&e.retries>0||e.retries&&typeof e.retries.retries==`number`&&e.retries.retries>0)throw Object.assign(Error(`Cannot use retries with the sync api`),{code:`ESYNC`});return e}t.exports={toPromise:i,toSync:a,toSyncOptions:o}})),Lt=n(((e,t)=>{var n=Ft(),{toPromise:r,toSync:i,toSyncOptions:a}=It();async function o(e,t){return r(await r(n.lock)(e,t))}function s(e,t){return i(i(n.lock)(e,a(t)))}function c(e,t){return r(n.unlock)(e,t)}function l(e,t){return i(n.unlock)(e,a(t))}function u(e,t){return r(n.check)(e,t)}function d(e,t){return i(n.check)(e,a(t))}t.exports=o,t.exports.lock=o,t.exports.unlock=c,t.exports.lockSync=s,t.exports.unlockSync=l,t.exports.check=u,t.exports.checkSync=d}));function P(){return F||(F=Lt()),F}function Rt(e,t){return P().lock(e,t)}function zt(e,t){return P().lockSync(e,t)}function Bt(e,t){return P().unlock(e,t)}function Vt(e,t){return P().check(e,t)}var F,Ht=t((()=>{}));function I(){return{numStartups:0,installMethod:void 0,autoUpdates:void 0,theme:`dark`,preferredNotifChannel:`auto`,verbose:!1,editorMode:`normal`,autoCompactEnabled:!0,showTurnDuration:!0,hasSeenTasksHint:!1,hasUsedStash:!1,hasUsedBackgroundTask:!1,queuedCommandUpHintCount:0,diffTool:`auto`,customApiKeyResponses:{approved:[],rejected:[]},env:{},tipsHistory:{},memoryUsageCount:0,promptQueueUseCount:0,btwUseCount:0,todoFeatureEnabled:!0,showExpandedTodos:!1,messageIdleNotifThresholdMs:6e4,autoConnectIde:!1,autoInstallIdeExtension:!0,fileCheckpointingEnabled:!0,terminalProgressBarEnabled:!0,cachedStatsigGates:{},cachedDynamicConfigs:{},respectGitignore:!0}}function Ut(){return G||(G=Wt())}function Wt(){if(fe())return!0;let e=B(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=E(_e());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=E(rt(n,`..`));if(t===n)break;n=t}return!1}function L(e){let t=K.config;if(!t)return!1;let n=t.oauthAccount!==void 0&&e.oauthAccount===void 0,r=t.hasCompletedOnboarding===!0&&e.hasCompletedOnboarding!==!0;return n||r}function R(e){let t=null;try{$t(w(),I,n=>{let r=e(n);return r===n?n:(t={...r,projects:Jt(n.projects)},t)})&&t&&z(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=V(w(),I);if(L(r)){S(`saveGlobalConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let i=e(r);if(i===r)return;t={...i,projects:Jt(r.projects)},Qt(w(),t,W),z(t)}}function Gt(){return X}function Kt(){let e=J+Y;e>0&&D(`tengu_config_cache_stats`,{cache_hits:J,cache_misses:Y,hit_rate:J/e}),J=0,Y=0}function qt(e){if(e.installMethod!==void 0)return e;let t=e,n=`unknown`,r=e.autoUpdates??!0;switch(t.autoUpdaterStatus){case`migrated`:n=`local`;break;case`installed`:n=`native`;break;case`disabled`:r=!1;break;case`enabled`:case`no_permissions`:case`not_configured`:n=`global`;break;case void 0:break}return{...e,installMethod:n,autoUpdates:r}}function Jt(e){if(!e)return e;let t={},n=!1;for(let[r,i]of Object.entries(e)){let e=i;if(e.history!==void 0){n=!0;let{history:i,...a}=e;t[r]=a}else t[r]=i}return n?t:e}function Yt(){if(Z)return;Z=!0;let e=w();ot(e,{interval:hn,persistent:!1},t=>{t.mtimeMs<=K.mtime||x().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(K={config:qt({...I(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),we(async()=>{at(e),Z=!1})}function z(e){K={config:e,mtime:Date.now()},q=null}function B(){if(K.config)return J++,K.config;Y++;try{let e=null;try{e=x().statSync(w())}catch{}let t=qt(V(w(),I));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,Yt(),t}catch{return qt(V(w(),I))}}function Xt(){let e=B().remoteControlAtStartup;return e!==void 0&&e}function Zt(e){let t=B();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Qt(e,t,n){let r=k(e);x().mkdirSync(r),qe(e,C(N(t,(e,t)=>C(e)!==C(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++}function $t(e,t,n){let r=t(),i=k(e),a=x();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=zt(e,{lockfilePath:i,onCompromised:e=>{S(`Config lock compromised: ${e}`,{level:`error`})}});let c=Date.now()-s;if(c>100&&(S(`Lock acquisition took longer than expected - another Claude instance may be running`),D(`tengu_config_lock_contention`,{lock_time_ms:c})),q&&e===w())try{let t=a.statSync(e);(t.mtimeMs!==q.mtime||t.size!==q.size)&&D(`tengu_config_stale_write`,{read_mtime:q.mtime,write_mtime:t.mtimeMs,read_size:q.size,write_size:t.size})}catch(e){if(b(e)!==`ENOENT`)throw e}let l=V(e,t);if(e===w()&&L(l))return S(`saveConfigWithLock: re-read config is missing auth that cache has; refusing to write to avoid wiping ~/.claude.json. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{}),!1;let u=n(l);if(u===l)return!1;let d=N(u,(e,t)=>C(e)!==C(r[t]));try{let t=O(e),n=tn();try{a.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let r=a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse(),i=r[0],o=i?Number(i.split(`.backup.`).pop()):0,s=Number.isNaN(o)||Date.now()-o>=6e4;if(s){let r=A(n,`${t}.backup.${Date.now()}`);a.copyFileSync(e,r)}let c=s?a.readdirStringSync(n).filter(e=>e.startsWith(`${t}.backup.`)).sort().reverse():r;for(let e of c.slice(5))try{a.unlinkSync(A(n,e))}catch{}}catch(e){b(e)!==`ENOENT`&&S(`Failed to backup config: ${e}`,{level:`error`})}return qe(e,C(d,null,2),{encoding:`utf-8`,mode:384}),e===w()&&X++,!0}finally{o&&o()}}function en(){if(Q)return;let e=Date.now();Le(`info`,`enable_configs_started`),Q=!0,V(w(),I,!0),Le(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function tn(){return A(l(),`backups`)}function nn(e){let t=x(),n=O(e),r=tn();try{let e=t.readdirStringSync(r).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(e)return A(r,e)}catch{}let i=k(e);try{let r=t.readdirStringSync(i).filter(e=>e.startsWith(`${n}.backup.`)).sort().at(-1);if(r)return A(i,r);let a=`${e}.backup`;try{return t.statSync(a),a}catch{}}catch{}return null}function V(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=x();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=ve(Xe(n));return{...t(),...e}}catch(n){throw new xe(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=nn(e);return n&&process.stderr.write(`\nClaude configuration file not found at: ${e}\nA backup file exists at: ${n}\nYou can manually restore it by running: cp "${n}" "${e}"\n\n`),t()}if(i instanceof xe&&n)throw i;if(i instanceof xe){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!H){H=!0;try{Ue(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{H=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=tn();try{r.mkdirSync(n)}catch(e){if(b(e)!==`EEXIST`)throw e}let a=r.readdirStringSync(n).filter(e=>e.startsWith(`${t}.corrupted.`)),o,s=!1,c=r.readFileSync(e,{encoding:`utf-8`});for(let e of a)try{if(c===r.readFileSync(A(n,e),{encoding:`utf-8`})){s=!0;break}}catch{}if(!s){o=A(n,`${t}.corrupted.${Date.now()}`);try{r.copyFileSync(e,o),S(`Corrupted config backed up to: ${o}`,{level:`error`})}catch{}}let l=nn(e);o?process.stderr.write(`The corrupted file has been backed up to: ${o}\n`):s&&process.stderr.write(`The corrupted file has already been backed up.
|
|
2
2
|
`),l?process.stderr.write(`A backup file exists at: ${l}\nYou can manually restore it by running: cp "${l}" "${e}"\n\n`):process.stderr.write(`
|
|
3
3
|
`)}return t()}}function rn(){let e=$(),t=B();if(!t.projects)return U;let n=t.projects[e]??U;return typeof n.allowedTools==`string`&&(n.allowedTools=Qe(n.allowedTools)??[]),n}function an(e){let t=$(),n=null;try{$t(w(),I,r=>{let i=r.projects?.[t]??U,a=e(i);return a===i?r:(n={...r,projects:{...r.projects,[t]:a}},n)})&&n&&z(n)}catch(r){S(`Failed to save config with lock: ${r}`,{level:`error`});let i=V(w(),I);if(L(i)){S(`saveCurrentProjectConfig fallback: re-read config is missing auth that cache has; refusing to write. See GH #3117.`,{level:`error`}),D(`tengu_config_auth_loss_prevented`,{});return}let a=i.projects?.[t]??U,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Qt(w(),n,W),z(n)}}function on(){return ln()!==null}function sn(){return on()&&!c(process.env.FORCE_AUTOUPDATE_PLUGINS)}function cn(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function ln(){if(!c(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(c(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=We();if(e)return{type:`env`,envVar:e};let t=B();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function un(){let e=B();if(e.userID)return e.userID;let t=st(32).toString(`hex`);return R(e=>({...e,userID:t})),t}function dn(){if(!B().firstStartTime){let e=new Date().toISOString();R(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function fn(e){let t=le();switch(e){case`User`:return A(l(),`CLAUDE.md`);case`Local`:return A(t,`CLAUDE.local.md`);case`Project`:return A(t,`CLAUDE.md`);case`Managed`:return A(Oe(),`CLAUDE.md`);case`AutoMem`:return yt();default:return A(l(),`CLAUDE.md`)}}function pn(){return A(Oe(),`.claude`,`rules`)}function mn(){return A(l(),`rules`)}var H,U,W,G,K,q,J,Y,X,hn,Z,Q,$,gn=t((()=>{o(),Ot(),se(),Ct(),$e(),ge(),Se(),be(),ze(),Me(),u(),Te(),Je(),Ce(),Re(),Ze(),Ye(),Ht(),He(),Ke(),Ve(),Ne(),ye(),H=!1,U={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},W=I(),G=!1,{...W},{...U},K={config:null,mtime:0},q=null,J=0,Y=0,X=0,we(async()=>{Kt()}),hn=1e3,Z=!1,Q=!1,$=a(()=>{let e=le();return E(Be(e)||rt(e))})}));export{yt as A,j as B,Ht as C,N as D,Ot as E,bt as F,dt as I,ft as L,pt as M,_t as N,wt as O,Ct as P,lt as R,Vt as S,Bt as T,ct as V,on as _,ln as a,R as b,B as c,fn as d,un as f,gn as g,mn as h,cn as i,M as j,Tt as k,Gt as l,Xt as m,Ut as n,rn as o,$ as p,en as r,Zt as s,W as t,pn as u,dn as v,Rt as w,sn as x,an as y,ut as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-XKw6FI_m.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Config`})}))();export{a as call};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{I as r,P as i,fi as a,s as o,t as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Ao as l,KE as u,al as d,qE as f,rl as p,zo as m}from"./loadAgentsDir-Clu7Uk6a.js";import{dn as h,un as g}from"./settings-Dlp5JTa_.js";import{f as _,l as v}from"./file-DcZWPH2V.js";import{b as y,y as b}from"./startupProfiler-xa3NmN7Z.js";import{$t as x,an as S,bn as C,gn as w,vn as T,yn as ee}from"./prompt-Bg_1U0gO.js";import{n as E,t as D}from"./staticRender-BIxpgNUq.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),P(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=R&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<F||r<I)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=b(t);switch(e){case ee:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case x:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case w:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===x);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=F&&r>=I||a>=L&&n.resultTokens>=I&&t.push({severity:`info`,title:`File reads using ${b(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=z&&n>=B){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${v(e.path)} (${b(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${b(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function P(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<R&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var F,I,L,R,z,B,V=e((()=>{C(),S(),T(),_(),y(),F=15,I=1e4,L=5,R=80,z=5,B=5e3}));function H({suggestions:e}){return e.length===0?null:(0,U.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,U.jsxs)(r,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,U.jsxs)(r,{children:[(0,U.jsx)(o,{status:e.severity,withSpace:!0}),(0,U.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,U.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,b(e.savingsTokens)]}):null]}),(0,U.jsx)(r,{marginLeft:2,children:(0,U.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var U,W=e((()=>{t(),a(),s(),y(),U=c()}));function G(){return null}function K(e){let t=new Map;for(let n of e){let e=g(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of X){let r=t.get(e);r&&n.set(e,r)}return n}function q({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:a,percentage:o,gridRows:s,model:c,memoryFiles:l,mcpTools:u,deferredBuiltinTools:d=[],systemTools:f,systemPromptSections:p,agents:m,skills:h,messageBreakdown:g,cacheHitRate:_,cacheThreshold:y}=e,x=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==Y&&!e.isDeferred),S=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),C=d.length>0,w=t.find(e=>e.name===Y);return(0,J.jsxs)(r,{flexDirection:`column`,paddingLeft:1,children:[(0,J.jsx)(i,{bold:!0,children:`Context Usage`}),(0,J.jsxs)(r,{flexDirection:`row`,gap:2,children:[(0,J.jsx)(r,{flexDirection:`column`,flexShrink:0,children:s.map((e,t)=>(0,J.jsx)(r,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,J.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===Y?(0,J.jsx)(i,{color:e.color,children:`⛝ `},t):(0,J.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,J.jsxs)(r,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,J.jsxs)(i,{dimColor:!0,children:[c,` · `,b(n),`/`,b(a),` tokens (`,o,`%)`]}),(0,J.jsx)(G,{}),_!==void 0&&y!==void 0&&(0,J.jsxs)(i,{color:_<y?`warning`:void 0,children:[`Cache hit rate: `,_.toFixed(0),`%`,_<y?` (below ${y}% threshold)`:``]}),(0,J.jsx)(i,{children:` `}),(0,J.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),x.map((e,t)=>{let n=b(e.tokens),o=e.isDeferred?`N/A`:`${(e.tokens/a*100).toFixed(1)}%`,s=e.name===Y,c=e.name,l=e.isDeferred?` `:s?`⛝`:`⛁`;return(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{color:e.color,children:l}),(0,J.jsxs)(i,{children:[` `,c,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,o,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{dimColor:!0,children:`⛶`}),(0,J.jsx)(i,{children:` Free space: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/a*100).toFixed(1),`%)`]})]}),w&&w.tokens>0&&(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{color:w.color,children:`⛝`}),(0,J.jsxs)(i,{dimColor:!0,children:[` `,w.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(w.tokens),` tokens (`,(w.tokens/a*100).toFixed(1),`%)`]})]})]})]}),(0,J.jsxs)(r,{flexDirection:`column`,marginLeft:-1,children:[u.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`MCP tools`}),(0,J.jsxs)(i,{dimColor:!0,children:[` · /mcp`,S?` (loaded on-demand)`:``]})]}),u.some(e=>e.isLoaded)&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Loaded`}),u.filter(e=>e.isLoaded).map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),S&&u.some(e=>!e.isLoaded)&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Available`}),u.filter(e=>!e.isLoaded).map((e,t)=>(0,J.jsx)(r,{children:(0,J.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!S&&u.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),(f&&f.length>0||C)&&process.env.USER_TYPE===`ant`&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] System tools`}),C&&(0,J.jsx)(i,{dimColor:!0,children:` (some loaded on-demand)`})]}),(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Loaded`}),f?.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},`sys-${t}`)),d.filter(e=>e.isLoaded).map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},`def-${t}`))]}),C&&d.some(e=>!e.isLoaded)&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Available`}),d.filter(e=>!e.isLoaded).map((e,t)=>(0,J.jsx)(r,{children:(0,J.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]})]}),p&&p.length>0&&process.env.USER_TYPE===`ant`&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] System prompt sections`}),p.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),m.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`Custom agents`}),(0,J.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(K(m).entries()).map(([e,t])=>(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]},e))]}),l.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`Memory files`}),(0,J.jsx)(i,{dimColor:!0,children:` · /memory`})]}),l.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,v(e.path),`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),h&&h.tokens>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`Skills`}),(0,J.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(K(h.skillFrontmatter).entries()).map(([e,t])=>(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]},e))]}),g&&process.env.USER_TYPE===`ant`&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] Message breakdown`}),(0,J.jsxs)(r,{flexDirection:`column`,marginLeft:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Tool calls: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.toolCallTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Tool results: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.toolResultTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Attachments: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.attachmentTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Assistant messages (non-tool): `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.assistantMessageTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`User messages (non-tool-result): `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.userMessageTokens),` tokens`]})]})]}),g.toolCallsByType.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top tools`}),g.toolCallsByType.slice(0,5).map((e,t)=>(0,J.jsxs)(r,{marginLeft:1,children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[`calls `,b(e.callTokens),`, results `,b(e.resultTokens)]})]},t))]}),g.attachmentsByType.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top attachments`}),g.attachmentsByType.slice(0,5).map((e,t)=>(0,J.jsxs)(r,{marginLeft:1,children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]})]})]}),(0,J.jsx)(H,{suggestions:O(e)})]})}var J,Y,X,Z=e((()=>{a(),s(),V(),_(),y(),h(),W(),J=c(),Y=`Autocompact buffer`,X=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Q(e){return l(e)}async function te(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=Q(n),{messages:s}=await f(o),c=process.stdout.columns||80,l=r();return e(await E((0,$.jsx)(q,{data:await p(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{a(),Z(),u(),d(),m(),D(),$=c()}))();export{te as call};
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{I as r,P as i,fi as a,s as o,t as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{Ao as l,KE as u,al as d,qE as f,rl as p,zo as m}from"./loadAgentsDir-D206qwP3.js";import{dn as h,un as g}from"./settings-BovzmwMP.js";import{f as _,l as v}from"./file-DcZWPH2V.js";import{b as y,y as b}from"./startupProfiler-xa3NmN7Z.js";import{$t as x,an as S,bn as C,gn as w,vn as T,yn as ee}from"./prompt-BNHtszmZ.js";import{n as E,t as D}from"./staticRender-BIxpgNUq.js";function O(e){let t=[];return k(e,t),A(e,t),M(e,t),N(e,t),P(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function k(e,t){e.percentage>=R&&t.push({severity:`warning`,title:`Context is ${e.percentage}% full`,detail:e.isAutoCompactEnabled?`Autocompact will trigger soon, which discards older messages. Use /compact now to control what gets kept.`:`Autocompact is disabled. Use /compact to free space, or enable autocompact in /config.`})}function A(e,t){if(e.messageBreakdown)for(let n of e.messageBreakdown.toolCallsByType){let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100;if(i<F||r<I)continue;let a=j(n.name,r,i);a&&t.push(a)}}function j(e,t,n){let r=b(t);switch(e){case ee:return{severity:`warning`,title:`Bash results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Pipe output through head, tail, or grep to reduce result size. Avoid cat on large files — use Read with offset/limit instead.`,savingsTokens:Math.floor(t*.5)};case x:return{severity:`info`,title:`Read results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Use offset and limit parameters to read only the sections you need. Avoid re-reading entire files when you only need a few lines.`,savingsTokens:Math.floor(t*.3)};case w:return{severity:`info`,title:`Grep results using ${r} tokens (${n.toFixed(0)}%)`,detail:`Add more specific patterns or use the glob or type parameter to narrow file types. Consider Glob for file discovery instead of Grep.`,savingsTokens:Math.floor(t*.3)};default:return n>=20?{severity:`info`,title:`${e} using ${r} tokens (${n.toFixed(0)}%)`,detail:`This tool is consuming a significant portion of context.`,savingsTokens:Math.floor(t*.2)}:null}}function M(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===x);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=F&&r>=I||a>=L&&n.resultTokens>=I&&t.push({severity:`info`,title:`File reads using ${b(n.resultTokens)} tokens (${a.toFixed(0)}%)`,detail:`If you are re-reading files, consider referencing earlier reads. Use offset/limit for large files.`,savingsTokens:Math.floor(n.resultTokens*.3)})}function N(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=z&&n>=B){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${v(e.path)} (${b(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${b(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function P(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<R&&t.push({severity:`info`,title:`Autocompact is disabled`,detail:`Without autocompact, you will hit context limits and lose the conversation. Enable it in /config or use /compact manually.`})}var F,I,L,R,z,B,V=e((()=>{C(),S(),T(),_(),y(),F=15,I=1e4,L=5,R=80,z=5,B=5e3}));function H({suggestions:e}){return e.length===0?null:(0,U.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(i,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,U.jsxs)(r,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,U.jsxs)(r,{children:[(0,U.jsx)(o,{status:e.severity,withSpace:!0}),(0,U.jsx)(i,{bold:!0,children:e.title}),e.savingsTokens?(0,U.jsxs)(i,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,b(e.savingsTokens)]}):null]}),(0,U.jsx)(r,{marginLeft:2,children:(0,U.jsx)(i,{dimColor:!0,children:e.detail})})]},t))]})}var U,W=e((()=>{t(),a(),s(),y(),U=c()}));function G(){return null}function K(e){let t=new Map;for(let n of e){let e=g(n.source),r=t.get(e)||[];r.push(n),t.set(e,r)}for(let[e,n]of t.entries())t.set(e,n.sort((e,t)=>t.tokens-e.tokens));let n=new Map;for(let e of X){let r=t.get(e);r&&n.set(e,r)}return n}function q({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:a,percentage:o,gridRows:s,model:c,memoryFiles:l,mcpTools:u,deferredBuiltinTools:d=[],systemTools:f,systemPromptSections:p,agents:m,skills:h,messageBreakdown:g,cacheHitRate:_,cacheThreshold:y}=e,x=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==Y&&!e.isDeferred),S=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),C=d.length>0,w=t.find(e=>e.name===Y);return(0,J.jsxs)(r,{flexDirection:`column`,paddingLeft:1,children:[(0,J.jsx)(i,{bold:!0,children:`Context Usage`}),(0,J.jsxs)(r,{flexDirection:`row`,gap:2,children:[(0,J.jsx)(r,{flexDirection:`column`,flexShrink:0,children:s.map((e,t)=>(0,J.jsx)(r,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,J.jsx)(i,{dimColor:!0,children:`⛶ `},t):e.categoryName===Y?(0,J.jsx)(i,{color:e.color,children:`⛝ `},t):(0,J.jsx)(i,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,J.jsxs)(r,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,J.jsxs)(i,{dimColor:!0,children:[c,` · `,b(n),`/`,b(a),` tokens (`,o,`%)`]}),(0,J.jsx)(G,{}),_!==void 0&&y!==void 0&&(0,J.jsxs)(i,{color:_<y?`warning`:void 0,children:[`Cache hit rate: `,_.toFixed(0),`%`,_<y?` (below ${y}% threshold)`:``]}),(0,J.jsx)(i,{children:` `}),(0,J.jsx)(i,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),x.map((e,t)=>{let n=b(e.tokens),o=e.isDeferred?`N/A`:`${(e.tokens/a*100).toFixed(1)}%`,s=e.name===Y,c=e.name,l=e.isDeferred?` `:s?`⛝`:`⛁`;return(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{color:e.color,children:l}),(0,J.jsxs)(i,{children:[` `,c,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[n,` tokens (`,o,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{dimColor:!0,children:`⛶`}),(0,J.jsx)(i,{children:` Free space: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/a*100).toFixed(1),`%)`]})]}),w&&w.tokens>0&&(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{color:w.color,children:`⛝`}),(0,J.jsxs)(i,{dimColor:!0,children:[` `,w.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(w.tokens),` tokens (`,(w.tokens/a*100).toFixed(1),`%)`]})]})]})]}),(0,J.jsxs)(r,{flexDirection:`column`,marginLeft:-1,children:[u.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`MCP tools`}),(0,J.jsxs)(i,{dimColor:!0,children:[` · /mcp`,S?` (loaded on-demand)`:``]})]}),u.some(e=>e.isLoaded)&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Loaded`}),u.filter(e=>e.isLoaded).map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),S&&u.some(e=>!e.isLoaded)&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Available`}),u.filter(e=>!e.isLoaded).map((e,t)=>(0,J.jsx)(r,{children:(0,J.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!S&&u.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),(f&&f.length>0||C)&&process.env.USER_TYPE===`ant`&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] System tools`}),C&&(0,J.jsx)(i,{dimColor:!0,children:` (some loaded on-demand)`})]}),(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Loaded`}),f?.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},`sys-${t}`)),d.filter(e=>e.isLoaded).map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},`def-${t}`))]}),C&&d.some(e=>!e.isLoaded)&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:`Available`}),d.filter(e=>!e.isLoaded).map((e,t)=>(0,J.jsx)(r,{children:(0,J.jsxs)(i,{dimColor:!0,children:[`└ `,e.name]})},t))]})]}),p&&p.length>0&&process.env.USER_TYPE===`ant`&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] System prompt sections`}),p.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),m.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`Custom agents`}),(0,J.jsx)(i,{dimColor:!0,children:` · /agents`})]}),Array.from(K(m).entries()).map(([e,t])=>(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.agentType,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]},e))]}),l.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`Memory files`}),(0,J.jsx)(i,{dimColor:!0,children:` · /memory`})]}),l.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,v(e.path),`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]}),h&&h.tokens>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{bold:!0,children:`Skills`}),(0,J.jsx)(i,{dimColor:!0,children:` · /skills`})]}),Array.from(K(h.skillFrontmatter).entries()).map(([e,t])=>(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{dimColor:!0,children:e}),t.map((e,t)=>(0,J.jsxs)(r,{children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]},e))]}),g&&process.env.USER_TYPE===`ant`&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] Message breakdown`}),(0,J.jsxs)(r,{flexDirection:`column`,marginLeft:1,children:[(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Tool calls: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.toolCallTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Tool results: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.toolResultTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Attachments: `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.attachmentTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`Assistant messages (non-tool): `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.assistantMessageTokens),` tokens`]})]}),(0,J.jsxs)(r,{children:[(0,J.jsx)(i,{children:`User messages (non-tool-result): `}),(0,J.jsxs)(i,{dimColor:!0,children:[b(g.userMessageTokens),` tokens`]})]})]}),g.toolCallsByType.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top tools`}),g.toolCallsByType.slice(0,5).map((e,t)=>(0,J.jsxs)(r,{marginLeft:1,children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[`calls `,b(e.callTokens),`, results `,b(e.resultTokens)]})]},t))]}),g.attachmentsByType.length>0&&(0,J.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,J.jsx)(i,{bold:!0,children:`[ANT-ONLY] Top attachments`}),g.attachmentsByType.slice(0,5).map((e,t)=>(0,J.jsxs)(r,{marginLeft:1,children:[(0,J.jsxs)(i,{children:[`└ `,e.name,`: `]}),(0,J.jsxs)(i,{dimColor:!0,children:[b(e.tokens),` tokens`]})]},t))]})]})]}),(0,J.jsx)(H,{suggestions:O(e)})]})}var J,Y,X,Z=e((()=>{a(),s(),V(),_(),y(),h(),W(),J=c(),Y=`Autocompact buffer`,X=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function Q(e){return l(e)}async function te(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:i,tools:a}}=t,o=Q(n),{messages:s}=await f(o),c=process.stdout.columns||80,l=r();return e(await E((0,$.jsx)(q,{data:await p(s,i,async()=>l.toolPermissionContext,a,l.agentDefinitions,c,t,void 0,o)}))),null}var $;e((()=>{a(),Z(),u(),d(),m(),D(),$=c()}))();export{te as call};
|
package/dist/chunks/{context-noninteractive-BmC4o5xo.js → context-noninteractive-9hELVC29.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ao as t,KE as n,al as r,qE as i,rl as a,zo as o}from"./loadAgentsDir-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ao as t,KE as n,al as r,qE as i,rl as a,zo as o}from"./loadAgentsDir-D206qwP3.js";import{dn as s,un as c}from"./settings-BovzmwMP.js";import{b as l,y as u}from"./startupProfiler-xa3NmN7Z.js";async function d(e){let{messages:n,getAppState:r,options:{mainLoopModel:o,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=t(n),{messages:f}=await i(d),p=r();return a(f,o,async()=>p.toolPermissionContext,s,c,void 0,{options:{customSystemPrompt:l,appendSystemPrompt:u}},void 0,d)}async function f(e,t){return{type:`text`,value:p(await d(t))}}function p(e){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,model:a,memoryFiles:o,mcpTools:s,agents:l,skills:d,messageBreakdown:f,systemTools:p,systemPromptSections:m}=e,h=`## Context Usage
|
|
2
2
|
|
|
3
3
|
`;h+=`**Model:** ${a} \n`,h+=`**Tokens:** ${u(n)} / ${u(r)} (${i}%)\n`,h+=`
|
|
4
4
|
`;let g=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(g.length>0){h+=`### Estimated usage by category
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t,t as n}from"./context-noninteractive-9hELVC29.js";t();export{n as call,e as collectContextData};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./conversation-BWVTM40Y.js";e();export{t as clearConversation};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Fn as n,In as r,Rn as i,cn as a,en as o,ht as s,nt as c,q as l,un as u}from"./state-ix0xIunV.js";import{Au as d,Bl as f,Ci as p,Ct as m,Ei as h,Et as g,Gp as _,Il as v,Ky as y,LC as b,Mn as x,Wp as S,Zt as ee,ab as te,dn as C,dr as w,eg as T,fb as E,fi as D,jn as O,jr as k,ju as A,kn as j,nr as M,qy as N,tg as P,yn as F,zC as I}from"./loadAgentsDir-
|
|
1
|
+
import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Fn as n,In as r,Rn as i,cn as a,en as o,ht as s,nt as c,q as l,un as u}from"./state-ix0xIunV.js";import{Au as d,Bl as f,Ci as p,Ct as m,Ei as h,Et as g,Gp as _,Il as v,Ky as y,LC as b,Mn as x,Wp as S,Zt as ee,ab as te,dn as C,dr as w,eg as T,fb as E,fi as D,jn as O,jr as k,ju as A,kn as j,nr as M,qy as N,tg as P,yn as F,zC as I}from"./loadAgentsDir-D206qwP3.js";import{o as L,s as ne}from"./log-BMCygSzM.js";import{n as R,r as z}from"./analytics-BotDBGh0.js";import{C as B,y as V}from"./rcDebugLog-CUy1_F23.js";import{l as H,r as U}from"./commitAttribution-ChAgixdj.js";import{c as W,d as G}from"./debugUtils-NO5KtXqi.js";import{n as K,t as q}from"./caches-UeVVM3T0.js";import{randomUUID as J}from"crypto";function Y(e){Q=e,f(Z()??null).catch(()=>{})}function X(){return Q}function Z(){let e=X();return e?G(e.bridgeSessionId):void 0}var Q,$=t((()=>{v(),W(),Q=null}));function re(){let e=X();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:J()};e.writeSdkMessages([t])}async function ie({setMessages:t,readFileState:o,discoveredSkillNames:d,loadedNestedMemoryPaths:f,getAppState:g,setAppState:v,setConversationId:y}){let x=C();await ee(`clear`,{getAppState:g,setAppState:v,signal:AbortSignal.timeout(x),timeoutMs:x});let S=l();S&&z(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:S});let T=new Set,E=[],F=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(g)for(let e of Object.values(g().tasks))F(e)||A(e)&&(T.add(e.agentId),E.push(e));t(()=>[]),re();{let{setContextBlocked:t}=(V(),e(B));t(!1)}y&&y(J()),q(T),n(null),r(null),i(null),u(),_(c()),o.clear(),d?.clear(),f?.clear(),v&&v(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!F(r)){t[n]=r;continue}try{r.status===`running`&&(P(r)&&(r.shellCommand?.kill(),r.shellCommand?.cleanup(),r.cleanupTimeoutId&&clearTimeout(r.cleanupTimeoutId)),`abortController`in r&&r.abortController?.abort(),`unregisterCleanup`in r&&r.unregisterCleanup?.())}catch(e){ne(e)}j(n)}return{...e,tasks:t,attribution:U(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),te(),M(),a({setCurrentAsParent:!0}),process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_SESSION_ID&&(process.env.CLAUDE_CODE_SESSION_ID=s()),await D();for(let e of E)e.status===`running`&&O(e.id,w(b(e.agentId)));let{saveMode:I}=(k(),e(h));I(`normal`);let L=m();L&&p(L);let R=await N(`clear`);R.length>0&&t(()=>R)}var ae=t((()=>{$(),o(),R(),d(),T(),I(),H(),F(),L(),E(),S(),y(),k(),x(),g(),K()}));export{Y as i,ae as n,$ as r,ie as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,S as r,a as i,l as a,w as o}from"./debug-BrXObCdR.js";import{l as s,u as c}from"./oauth-BqJqV-2M.js";import{Bt as l,Ot as u}from"./model-
|
|
1
|
+
import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,S as r,a as i,l as a,w as o}from"./debug-BrXObCdR.js";import{l as s,u as c}from"./oauth-BqJqV-2M.js";import{Bt as l,Ot as u}from"./model-CKkOnnnx.js";import{i as d,t as f}from"./cliLaunch-BkPAatcs.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";i(),r(),e();function _(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}var v=2e3,y=15e3,b=3,x=class{constructor(e,n){t(this,`proc`,void 0),t(this,`options`,void 0),t(this,`connected`,!1),t(this,`disconnected`,!1),t(this,`readLoopAbort`,null),t(this,`reconnectAttempt`,0),t(this,`maxReconnectAttempts`,void 0),t(this,`userInitiatedDisconnect`,!1),t(this,`reconnecting`,!1),this.proc=e,this.options=n,this.maxReconnectAttempts=n.maxReconnectAttempts??b}connect(){this.connected||(this.readLoopAbort=new AbortController,this.startReadLoop(),this.monitorExit(),this.connected=!0,this.options.onConnected())}async startReadLoop(){let e=this.proc.stdout;if(!e){this.options.onError(Error(`SSH process stdout is not available`));return}let t=e.getReader(),n=new TextDecoder,r=``;try{for(;!this.disconnected;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.split(`
|
|
2
2
|
`);r=a.pop()??``;for(let e of a){let t=e.trim();t&&this.processLine(t)}}}catch(e){this.disconnected||this.options.onError(e instanceof Error?e:Error(String(e)))}finally{t.releaseLock(),!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}}monitorExit(){if(this.proc.exitCode!==null){this.userInitiatedDisconnect||this.handleProcessExit();return}this.proc.exited.then(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()}).catch(()=>{!this.disconnected&&!this.userInitiatedDisconnect&&this.handleProcessExit()})}async handleProcessExit(){if(!(this.disconnected||this.reconnecting)){if(this.connected=!1,!this.options.reconnect){this.disconnected=!0,this.options.onDisconnected();return}if(this.reconnectAttempt>=this.maxReconnectAttempts){this.disconnected=!0,this.options.onDisconnected();return}this.reconnecting=!0;try{await this.attemptReconnect()}finally{this.reconnecting=!1}}}async attemptReconnect(){let e=this.options.reconnect;for(;this.reconnectAttempt<this.maxReconnectAttempts;){this.reconnectAttempt++,this.options.onReconnecting(this.reconnectAttempt,this.maxReconnectAttempts);let t=Math.min(v*2**(this.reconnectAttempt-1),y);if(await new Promise(e=>setTimeout(e,t)),this.userInitiatedDisconnect)return;try{let t=await e();this.proc=t,this.reconnectAttempt=0,this.connected=!0,this.startReadLoop(),this.monitorExit(),this.options.onConnected();return}catch(e){a(`[SSH] reconnect attempt ${this.reconnectAttempt} failed: ${e instanceof Error?e.message:String(e)}`)}}this.disconnected=!0,this.options.onDisconnected()}processLine(e){let t;try{t=n(e)}catch{return}if(!_(t))return;let r=t;if(r.type===`control_request`){let e=r;e.request.subtype===`can_use_tool`?this.options.onPermissionRequest(e.request,e.request_id):(a(`[SSH] Unsupported control request subtype: ${e.request.subtype}`),this.sendErrorResponse(e.request_id,`Unsupported control request subtype: ${e.request.subtype}`));return}r.type!==`control_response`&&r.type!==`keep_alive`&&r.type!==`control_cancel_request`&&r.type!==`streamlined_text`&&r.type!==`streamlined_tool_use_summary`&&!(r.type===`system`&&r.subtype===`post_turn_summary`)&&this.options.onMessage(r)}writeToStdin(e){try{let t=this.proc.stdin;if(!t||typeof t==`number`||this.disconnected)return!1;let n=new TextEncoder().encode(e+`
|
|
3
3
|
`);return t.write(n),t.flush?.(),!0}catch{return!1}}async sendMessage(e){let t=o({type:`user`,message:{role:`user`,content:e},parent_tool_use_id:null,session_id:``});return this.writeToStdin(t)}sendInterrupt(){let e=o({type:`control_request`,request_id:crypto.randomUUID(),request:{subtype:`interrupt`}});this.writeToStdin(e)}respondToPermissionRequest(e,t){let n=o({type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}});this.writeToStdin(n)}sendErrorResponse(e,t){let n=o({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}});this.writeToStdin(n)}disconnect(){if(!this.disconnected){this.userInitiatedDisconnect=!0,this.disconnected=!0,this.connected=!1,this.readLoopAbort?.abort();try{let e=this.proc.stdin;e&&typeof e!=`number`&&e.end?.()}catch{}try{this.proc.kill()}catch{}}}isConnected(){return this.connected&&!this.disconnected}};l(),c(),i();var S=process.platform===`win32`;function C(){let e=process.env.ANTHROPIC_API_KEY;if(e)return{"x-api-key":e};let t=u();return t?.accessToken?{Authorization:`Bearer ${t.accessToken}`}:{}}function w(){return process.env.ANTHROPIC_BASE_URL||s().BASE_API_URL}async function T(e,t){if(t&&e.headers.get(`x-auth-nonce`)!==t)return new Response(`Forbidden`,{status:403});let n=w(),r=new URL(e.url),i=`${n}${r.pathname}${r.search}`,o=C();if(Object.keys(o).length===0)return new Response(JSON.stringify({error:`No API credentials available on local machine`}),{status:401,headers:{"content-type":`application/json`}});let s=new Headers(e.headers);for(let[e,t]of Object.entries(o))s.set(e,t);s.delete(`host`),s.delete(`x-auth-nonce`),a(`[SSHAuthProxy] ${e.method} ${r.pathname} -> ${i}`);try{let t=await fetch(i,{method:e.method,headers:s,body:e.body,duplex:`half`}),n=new Headers(t.headers);return n.delete(`content-encoding`),n.delete(`content-length`),new Response(t.body,{status:t.status,statusText:t.statusText,headers:n})}catch(e){let t=e instanceof Error?e.message:String(e);return a(`[SSHAuthProxy] upstream error: ${t}`),new Response(JSON.stringify({error:`Proxy upstream error: ${t}`}),{status:502,headers:{"content-type":`application/json`}})}}async function E(){let e=g();return S?O(e):D(e)}async function D(e){let t=`/tmp/claude-ssh-auth-${e}.sock`,n=Bun.serve({unix:t,fetch:e=>T(e,null)});return a(`[SSHAuthProxy] listening on unix:${t}`),{proxy:{stop(){n.stop(!0);try{h(t)}catch{}}},localAddress:t,authEnv:{ANTHROPIC_AUTH_SOCKET:t}}}async function O(e){let t=g(),n=Bun.serve({port:0,hostname:`127.0.0.1`,fetch:e=>T(e,t)}),r=n.port;return a(`[SSHAuthProxy] listening on TCP 127.0.0.1:${r} (nonce-protected)`),{proxy:{stop(){n.stop(!0)}},localAddress:`127.0.0.1:${r}`,authEnv:{ANTHROPIC_BASE_URL:`http://127.0.0.1:${r}`,ANTHROPIC_AUTH_NONCE:t}}}i();var k=15e3,A=class extends Error{constructor(e){super(e),this.name=`SSHProbeError`}};async function j(e,t){t?.(`Probing remote host…`);let n=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=10`,e,`CLAUDE_BIN=$(test -x "$HOME/.local/bin/claude" && echo "$HOME/.local/bin/claude" || command -v claude 2>/dev/null); echo "$CLAUDE_BIN"; $CLAUDE_BIN --version 2>/dev/null; uname -sm; pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`pipe`}),r=await Promise.race([n.exited,new Promise((e,t)=>setTimeout(()=>t(new A(`SSH probe timed out after ${k/1e3}s`)),k))]),i=await new Response(n.stdout).text(),o=await new Response(n.stderr).text();if(r!==0)throw new A(`SSH probe failed: ${o.trim()||`exit code ${r}`}`);let s=i.split(`
|
|
4
4
|
`).map(e=>e.trim()).filter(Boolean);a(`[SSHProbe] raw lines: ${JSON.stringify(s)}`);let c=s.findIndex(e=>/^(Linux|Darwin)\s/.test(e));if(c===-1)throw new A(`Could not detect remote platform (uname output missing)`);let l=c>=2&&s[c-2]||null,u=c>=1&&s[c-1]||null,d=u&&/^\d+\.\d+/.test(u)?u:null,f=l!==null&&l.startsWith(`/`),p=s[c+1]||`/`,[m,h]=s[c].split(/\s+/),g=m===`Darwin`?`darwin`:`linux`,_=h===`aarch64`||h===`arm64`?`arm64`:`x64`;return t?.(`Detected ${g}/${_}`),{hasBinary:f&&d!==null,remoteVersion:d,remotePlatform:g,remoteArch:_,defaultCwd:p,binaryPath:f?l:null}}i();var M=6e4,N=`~/.local/bin`,P=`claude-code-cli.js`,F=`claude`;async function I(e,t,n=M){let r=Bun.spawn([`ssh`,`-o`,`ConnectTimeout=10`,e,t],{stdout:`pipe`,stderr:`pipe`}),i=setTimeout(()=>r.kill(),n);try{let[e,t]=await Promise.all([new Response(r.stdout).text(),new Response(r.stderr).text()]),n=await r.exited;return{stdout:e.trim(),stderr:t.trim(),exitCode:n}}finally{clearTimeout(i)}}function L(){let e=p(import.meta.dir,`../..`),t=p(e,`dist/cli.js`);if(m(t))return t;let n=p(e,`src/entrypoints/cli.tsx`);if(m(n))return n;throw Error("Cannot find local CLI binary to deploy. Run `bun run build` first.")}async function R(e){let{host:t,remotePlatform:n,remoteArch:r,localVersion:i,onProgress:o}=e;if(n!==`linux`&&n!==`darwin`)throw Error(`Remote platform "${n}" is not supported. Only linux and darwin are supported.`);a(`[SSHDeploy] deploying to ${t} (${n}/${r}, v${i})`);let s=L();a(`[SSHDeploy] local binary: ${s}`),o?.(`Creating remote directory...`);let c=await I(t,`mkdir -p ${N}`);if(c.exitCode!==0)throw Error(`Failed to create remote directory: ${c.stderr}`);o?.(`Uploading binary...`);let l=`${N}/${P}`,u=Bun.spawn([`scp`,`-o`,`ConnectTimeout=10`,s,`${t}:${l}`],{stdout:`pipe`,stderr:`pipe`}),d=setTimeout(()=>u.kill(),M),f=await new Response(u.stderr).text(),p=await u.exited;if(clearTimeout(d),p!==0)throw Error(`SCP upload failed (exit ${p}): ${f.trim()}`);o?.(`Installing wrapper script...`);let m=await I(t,[`cat > ${N}/${F} << 'WRAPPER'`,`#!/bin/sh`,`exec bun ${N}/${P} "$@"`,`WRAPPER`,`chmod +x ${N}/${F}`].join(`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as e,i as t,n,r}from"./createSession-Cvl1Q50F.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{F as t,a as n,l as r,z as i}from"./debug-BrXObCdR.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-NO5KtXqi.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-
|
|
1
|
+
import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{F as t,a as n,l as r,z as i}from"./debug-BrXObCdR.js";import{c as a,d as o,i as s,o as c}from"./debugUtils-NO5KtXqi.js";async function l({environmentId:e,title:n,events:i,gitRepoUrl:a,branch:o,signal:c,baseUrl:l,getAccessToken:u,permissionMode:d}){let{getClaudeAIOAuthTokens:f}=await import(`./auth-DRTjfnGy.js`),{getOrganizationUUID:p}=await import(`./client-BzKQTXzF.js`),{getOauthConfig:m}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:h}=await import(`./api-BsFW57_Q.js`),{parseGitHubRepository:g}=await import(`./detectRepository-BTPgN89l.js`),{getDefaultBranch:_}=await import(`./git-CbcnOf0E.js`),{getMainLoopModel:v}=await import(`./model-DRXcJyU9.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-CqIQ_rvD.js`),x=u?.()??f()?.accessToken;if(!x)return r(`[bridge] No access token for session creation`),null;let S=b()?`self-hosted`:await p();if(!S)return r(`[bridge] No org UUID for session creation`),null;let C=null,w=null;if(a){let{parseGitRemote:e}=await import(`./detectRepository-BTPgN89l.js`),t=e(a);if(t){let{host:e,owner:n,name:r}=t,i=o||await _()||void 0;C={type:`git_repository`,url:`https://${e}/${n}/${r}`,revision:i},w={type:`git_repository`,git_info:{type:`github`,repo:`${n}/${r}`,branches:[`claude/${o||`task`}`]}}}else{let e=g(a);if(e){let[t,n]=e.split(`/`);if(t&&n){let e=o||await _()||void 0;C={type:`git_repository`,url:`https://github.com/${t}/${n}`,revision:e},w={type:`git_repository`,git_info:{type:`github`,repo:`${t}/${n}`,branches:[`claude/${o||`task`}`]}}}}}}let T={...n!==void 0&&{title:n},events:i,session_context:{sources:C?[C]:[],outcomes:w?[w]:[],model:v()},environment_id:e,source:`remote-control`,...d&&{permission_mode:d}},E={...h(x),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":S},D=`${l??m().BASE_API_URL}/v1/sessions`,O;try{O=await y.post(D,T,{headers:E,signal:c,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session creation request failed: ${t(e)}`),null}if(!(O.status===200||O.status===201)){let e=s(O.data);return r(`[bridge] Session creation failed with status ${O.status}${e?`: ${e}`:``}`),null}let k=O.data;return!k||typeof k!=`object`||!(`id`in k)||typeof k.id!=`string`?(r(`[bridge] No session ID in response`),null):k.id}async function u(e,n){let{getClaudeAIOAuthTokens:i}=await import(`./auth-DRTjfnGy.js`),{getOrganizationUUID:a}=await import(`./client-BzKQTXzF.js`),{getOauthConfig:o}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:c}=await import(`./api-BsFW57_Q.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-CqIQ_rvD.js`),d=n?.getAccessToken?.()??i()?.accessToken;if(!d)return r(`[bridge] No access token for session fetch`),null;let f=u()?`self-hosted`:await a();if(!f)return r(`[bridge] No org UUID for session fetch`),null;let p={...c(d),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":f},m=`${n?.baseUrl??o().BASE_API_URL}/v1/sessions/${e}`;r(`[bridge] Fetching session ${e}`);let h;try{h=await l.get(m,{headers:p,timeout:1e4,validateStatus:e=>e<500})}catch(e){return r(`[bridge] Session fetch request failed: ${t(e)}`),null}if(h.status!==200){let e=s(h.data);return r(`[bridge] Session fetch failed with status ${h.status}${e?`: ${e}`:``}`),null}return h.data}async function d(e,t){let{getClaudeAIOAuthTokens:n}=await import(`./auth-DRTjfnGy.js`),{getOrganizationUUID:i}=await import(`./client-BzKQTXzF.js`),{getOauthConfig:a}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:o}=await import(`./api-BsFW57_Q.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-CqIQ_rvD.js`),u=t?.getAccessToken?.()??n()?.accessToken;if(!u){r(`[bridge] No access token for session archive`);return}let d=l()?`self-hosted`:await i();if(!d){r(`[bridge] No org UUID for session archive`);return}let f={...o(u),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":d},p=`${t?.baseUrl??a().BASE_API_URL}/v1/sessions/${e}/archive`;r(`[bridge] Archiving session ${e}`);let m=await c.post(p,{},{headers:f,timeout:t?.timeoutMs??1e4,validateStatus:e=>e<500});if(m.status===200)r(`[bridge] Session ${e} archived successfully`);else{let e=s(m.data);r(`[bridge] Session archive failed with status ${m.status}${e?`: ${e}`:``}`)}}async function f(e,n,i){let{getClaudeAIOAuthTokens:a}=await import(`./auth-DRTjfnGy.js`),{getOrganizationUUID:c}=await import(`./client-BzKQTXzF.js`),{getOauthConfig:l}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:u}=await import(`./api-BsFW57_Q.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-CqIQ_rvD.js`),p=i?.getAccessToken?.()??a()?.accessToken;if(!p){r(`[bridge] No access token for session title update`);return}let m=f()?`self-hosted`:await c();if(!m){r(`[bridge] No org UUID for session title update`);return}let h={...u(p),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":m},g=o(e),_=`${i?.baseUrl??l().BASE_API_URL}/v1/sessions/${g}`;r(`[bridge] Updating session title: ${g} → ${n}`);try{let e=await d.patch(_,{title:n},{headers:h,timeout:1e4,validateStatus:e=>e<500});if(e.status===200)r(`[bridge] Session title updated successfully`);else{let t=s(e.data);r(`[bridge] Session title update failed with status ${e.status}${t?`: ${t}`:``}`)}}catch(e){r(`[bridge] Session title update request failed: ${t(e)}`)}}var p=e((()=>{n(),i(),c(),a()}));export{f as a,p as i,l as n,u as r,d as t};
|