@readmagic/workmate 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (445) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-qFZy3FOD.js → AddWorkspaceDirectory-ag2JTpmU.js} +1 -1
  2. package/dist/chunks/{App-DW4elk6E.js → App-BuKmqFPm.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CIWOi_7v.js +1 -0
  4. package/dist/chunks/ApproveApiKey-M6U-NafA.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-BuRFF1fQ.js → BypassPermissionsModeDialog-B05t83wa.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CDrArsSX.js → ClaudeMdExternalIncludesDialog-CSywJdVL.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +1 -0
  10. package/dist/chunks/{DiffDialog-BIcwpgSr.js → DiffDialog-DUbFrzKu.js} +3 -3
  11. package/dist/chunks/Doctor-BcnUfJ4I.js +1 -0
  12. package/dist/chunks/Doctor-Dz4TuYas.js +3 -0
  13. package/dist/chunks/ExitFlow-BwyAtIHx.js +2 -0
  14. package/dist/chunks/{Grove-BmirUB6V.js → Grove-BDoVj02t.js} +2 -2
  15. package/dist/chunks/{HybridTransport-BVmSUHf0.js → HybridTransport-C_U0IJfz.js} +4 -4
  16. package/dist/chunks/{InvalidConfigDialog-WRywkKeS.js → InvalidConfigDialog-bih293Xt.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-C4n3A72C.js → InvalidSettingsDialog-Br8kQOHz.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +1 -0
  19. package/dist/chunks/MCPToolListView-DJ06N1DG.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-CH4yyMAL.js → McpParsingWarnings-COa71S9q.js} +1 -1
  21. package/dist/chunks/MessageSelector-o4ULADFg.js +3 -0
  22. package/dist/chunks/Messages-qqwHuAW5.js +11 -0
  23. package/dist/chunks/{Onboarding-BboWs1pp.js → Onboarding-BzuQjney.js} +1 -1
  24. package/dist/chunks/{PromptInputFooterSuggestions-BpC9COmh.js → PromptInputFooterSuggestions-to5eYBvI.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-CfMFx-TF.js +1 -0
  26. package/dist/chunks/QueryEngine-Dt0BKUeF.js +1 -0
  27. package/dist/chunks/REPL-CUbEDqEl.js +133 -0
  28. package/dist/chunks/REPL-DMaKNhTa.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-Bf44A0Ol.js +2 -0
  30. package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +1 -0
  31. package/dist/chunks/{SSETransport-1KBBUikF.js → SSETransport-DN4tCDEh.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +1 -0
  33. package/dist/chunks/Settings-DfdcmvOV.js +2 -0
  34. package/dist/chunks/{TeleportProgress-BmgPAZAi.js → TeleportProgress-C2LQVLav.js} +1 -1
  35. package/dist/chunks/{TeleportRepoMismatchDialog-sgxNOeM_.js → TeleportRepoMismatchDialog-BZL8Zblz.js} +1 -1
  36. package/dist/chunks/{TeleportResumeWrapper-GptvrUdv.js → TeleportResumeWrapper-wPiIs8xg.js} +1 -1
  37. package/dist/chunks/{ThemePicker-gAMqqD1P.js → ThemePicker-BT_NaRQC.js} +1 -1
  38. package/dist/chunks/{TrustDialog-CWt-4Evl.js → TrustDialog-ACaJ_m7A.js} +1 -1
  39. package/dist/chunks/{ValidationErrorsList-De3kzHtz.js → ValidationErrorsList-C-hWdy_8.js} +1 -1
  40. package/dist/chunks/WelcomeV2-ZQRKlcT4.js +1 -0
  41. package/dist/chunks/add-dir-SAKTkw0S.js +1 -0
  42. package/dist/chunks/{agentDisplay-5gnCQwUY.js → agentDisplay-CuSHqgZc.js} +1 -1
  43. package/dist/chunks/{agents-Bz1MLp4A.js → agents-CMC0iQP4.js} +1 -1
  44. package/dist/chunks/agents-ZgRKpjHv.js +103 -0
  45. package/dist/chunks/allErrors-_cOQksHC.js +1 -0
  46. package/dist/chunks/{api-DzccRM_z.js → api-BbJfMXRS.js} +1 -1
  47. package/dist/chunks/api-DS1MiW01.js +1 -0
  48. package/dist/chunks/{auth-Cjnyy10u.js → auth-7mJGtlZp.js} +2 -2
  49. package/dist/chunks/auth-DGZzCbU0.js +1 -0
  50. package/dist/chunks/auth-DN1MUpB8.js +1 -0
  51. package/dist/chunks/{autoMode-CQ5nqP9c.js → autoMode-CBtY7ACs.js} +6 -6
  52. package/dist/chunks/autonomy-DuQmYhq6.js +15 -0
  53. package/dist/chunks/{autonomy-CPUCe-YU.js → autonomy-lJV7yWUl.js} +1 -1
  54. package/dist/chunks/autonomyPanel-DAQm6lDz.js +1 -0
  55. package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +1 -0
  56. package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +17 -0
  57. package/dist/chunks/{banner-BJZNMppT.js → banner-1Wyeyawe.js} +1 -1
  58. package/dist/chunks/{bg-w3Vlsm3Y.js → bg-CJ0YWFli.js} +2 -2
  59. package/dist/chunks/bg-CeUrRz_7.js +1 -0
  60. package/dist/chunks/branch-k3kirqbA.js +3 -0
  61. package/dist/chunks/{break-cache-DXV0brco.js → break-cache-CAoZ9b72.js} +2 -2
  62. package/dist/chunks/bridgeConfig-CzRUPn-D.js +1 -0
  63. package/dist/chunks/{bridgeConfig-vORehbGG.js → bridgeConfig-UgaUfuP6.js} +1 -1
  64. package/dist/chunks/bridgeMessaging-Ci5H68MX.js +1 -0
  65. package/dist/chunks/{bridgePointer-D4W9GpWw.js → bridgePointer-BL8-lGvN.js} +1 -1
  66. package/dist/chunks/bridgeStatusUtil-C36w15ge.js +1 -0
  67. package/dist/chunks/{btw-DDUC_t0w.js → btw-nVoVuIae.js} +1 -1
  68. package/dist/chunks/caches-B8sM3Zys.js +1 -0
  69. package/dist/chunks/caches-Bp9MZ7IE.js +1 -0
  70. package/dist/chunks/{capacityWake-L7b1mMft.js → capacityWake-BOySRJUJ.js} +1 -1
  71. package/dist/chunks/ccrClient-Br4LAofR.js +1 -0
  72. package/dist/chunks/{claudeDesktop-CAmnheYx.js → claudeDesktop-Bgds1-YT.js} +1 -1
  73. package/dist/chunks/{clear-DdWexxbM.js → clear-C4Vtnbye.js} +1 -1
  74. package/dist/chunks/{cliLaunch-BWWOgBFh.js → cliLaunch-BTpfAGGI.js} +1 -1
  75. package/dist/chunks/{client-CoXtVRzi.js → client-B9404qIP.js} +1 -1
  76. package/dist/chunks/client-BCAbKdNz.js +1 -0
  77. package/dist/chunks/client-CJE6gEvU.js +1 -0
  78. package/dist/chunks/commands-DL-BzoMQ.js +1 -0
  79. package/dist/chunks/compact-Cx7BPXLU.js +2 -0
  80. package/dist/chunks/config-S5OW4Xqr.js +1 -0
  81. package/dist/chunks/config-aRiTrtCv.js +3 -0
  82. package/dist/chunks/{config-CVvUNkj2.js → config-kB2eazPX.js} +1 -1
  83. package/dist/chunks/{context-BWcfhhDj.js → context-BN7DEjoH.js} +1 -1
  84. package/dist/chunks/{context-noninteractive-c7jGVWHQ.js → context-noninteractive-D91W2B8e.js} +5 -5
  85. package/dist/chunks/context-noninteractive-DPacEFJ1.js +1 -0
  86. package/dist/chunks/conversation-D5Nbu9eT.js +1 -0
  87. package/dist/chunks/conversation-hcUx9e-C.js +1 -0
  88. package/dist/chunks/{createSSHSession-DP7B8yvb.js → createSSHSession-DecOR6M5.js} +6 -6
  89. package/dist/chunks/createSession-D27zvmOs.js +1 -0
  90. package/dist/chunks/createSession-DRqkLZWt.js +1 -0
  91. package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +40 -0
  92. package/dist/chunks/cwd-Cfdf7z7s.js +1 -0
  93. package/dist/chunks/cwd-ClLru_7T.js +1 -0
  94. package/dist/chunks/datadog-bm551AVV.js +1 -0
  95. package/dist/chunks/debug-BecbSVoN.js +39 -0
  96. package/dist/chunks/{debugUtils-CezNYZ-4.js → debugUtils-CmJfIUxW.js} +1 -1
  97. package/dist/chunks/{detached-CkPpYMJj.js → detached-CIyF0M5O.js} +1 -1
  98. package/dist/chunks/detectRepository-C15umvKN.js +1 -0
  99. package/dist/chunks/detectRepository-DDfLfKcM.js +1 -0
  100. package/dist/chunks/{diff-DHzz9WAp.js → diff-DeK4bwjw.js} +1 -1
  101. package/dist/chunks/{directoryCompletion-D5AvL7TF.js → directoryCompletion-BJCu19HJ.js} +1 -1
  102. package/dist/chunks/doctor-BJORBomU.js +1 -0
  103. package/dist/chunks/earlyInput-BEjRkAtH.js +1 -0
  104. package/dist/chunks/{earlyInput-BTC_Wucv.js → earlyInput-IghoCjG5.js} +1 -1
  105. package/dist/chunks/entry-mdegyj8z.js +14 -0
  106. package/dist/chunks/esm-Ka3lhafK.js +1 -0
  107. package/dist/chunks/{execFileNoThrow-5SylUnAI.js → execFileNoThrow-DHyW8FMX.js} +2 -2
  108. package/dist/chunks/execSyncWrapper-CDzB0BM1.js +1 -0
  109. package/dist/chunks/exit-CF3KBl-S.js +1 -0
  110. package/dist/chunks/{extraUsage-Dt5mw35U.js → extraUsage-BrKbpBK-.js} +1 -1
  111. package/dist/chunks/extractMemories-4lBn134y.js +1 -0
  112. package/dist/chunks/fast-0Vi354KI.js +1 -0
  113. package/dist/chunks/{fast-ClYQcEv5.js → fast-DWn40OcQ.js} +1 -1
  114. package/dist/chunks/featureCheck-D6FjD-nt.js +1 -0
  115. package/dist/chunks/featureCheck-JOur3pHb.js +1 -0
  116. package/dist/chunks/{fileSuggestions-fNxREjpe.js → fileSuggestions-C7Pwq2yj.js} +3 -3
  117. package/dist/chunks/firstPartyEventLogger-BHjBQH0J.js +5 -0
  118. package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +1 -0
  119. package/dist/chunks/flushGate-DdJjxCes.js +1 -0
  120. package/dist/chunks/{gemini-fZ0VPU2A.js → gemini-DHv2iVfy.js} +1 -1
  121. package/dist/chunks/generateSessionName-DhS_6oHd.js +1 -0
  122. package/dist/chunks/{genericProcessUtils-BmDSLcMf.js → genericProcessUtils-B2HcDYhg.js} +1 -1
  123. package/dist/chunks/git-DBlOv64X.js +6 -0
  124. package/dist/chunks/git-DF4RFFaT.js +1 -0
  125. package/dist/chunks/githubRepoPathMapping-CK56bUDe.js +1 -0
  126. package/dist/chunks/{goal-IasZVqKh.js → goal-BZG4gtnb.js} +3 -3
  127. package/dist/chunks/{grok-Dk3LyzMa.js → grok-BS57ZhyW.js} +1 -1
  128. package/dist/chunks/{grove-BE4fQ6tG.js → grove-_zlQ83yR.js} +2 -2
  129. package/dist/chunks/help-C_2tdXHC.js +1 -0
  130. package/dist/chunks/{hooks-BrKy5XWQ.js → hooks-C7Bn7MBe.js} +2 -2
  131. package/dist/chunks/hooks-DT80Arzc.js +1 -0
  132. package/dist/chunks/initReplBridge-NkZRcM77.js +1 -0
  133. package/dist/chunks/{install-CVGZ55wV.js → install-Du-DSVzj.js} +1 -1
  134. package/dist/chunks/{instrumentation-BmWotlxR.js → instrumentation-DMs3b82f.js} +5 -5
  135. package/dist/chunks/intl-D2kgJmX7.js +1 -0
  136. package/dist/chunks/{job-DEXxW_Zo.js → job-rbX1VZmp.js} +1 -1
  137. package/dist/chunks/jwtUtils-OzxN2zts.js +1 -0
  138. package/dist/chunks/keybindings-CwdC_8S0.js +2 -0
  139. package/dist/chunks/{launchLocalMemory-CLSSVFoj.js → launchLocalMemory-BLRCK1_o.js} +2 -2
  140. package/dist/chunks/{launchOnboarding-BkJfKviO.js → launchOnboarding-Al_X75Vz.js} +1 -1
  141. package/dist/chunks/{loadAgentsDir-CKSb56Gp.js → loadAgentsDir-BL93ulMm.js} +2197 -2332
  142. package/dist/chunks/loadAgentsDir-eVKq8efm.js +1 -0
  143. package/dist/chunks/loadPluginHooks-B0au35a4.js +1 -0
  144. package/dist/chunks/{localSearch-CPOnyi8I.js → localSearch-C5ipegd9.js} +1 -1
  145. package/dist/chunks/localSearch-CZlFfR_X.js +1 -0
  146. package/dist/chunks/log-Dauqle-Z.js +1 -0
  147. package/dist/chunks/{logoV2Utils-we1sfJvf.js → logoV2Utils-CkvOihX7.js} +1 -1
  148. package/dist/chunks/{magicDocs-DmKlTQvK.js → magicDocs-DLav5QK0.js} +3 -3
  149. package/dist/chunks/main-CVNWNAoh.js +513 -0
  150. package/dist/chunks/{main-ClXu1ilx.js → main-LMyE3jXY.js} +4 -4
  151. package/dist/chunks/managedEnv-CYepSnm8.js +1 -0
  152. package/dist/chunks/{managedEnv-Cl7YbYzf.js → managedEnv-DJSCuqCb.js} +1 -1
  153. package/dist/chunks/{mappers-xQC-Z4-h.js → mappers-DQxMcezy.js} +1 -1
  154. package/dist/chunks/mcp-BAbbEaBA.js +1 -0
  155. package/dist/chunks/mcp-Ct4Sum6A.js +6 -0
  156. package/dist/chunks/mcp-D5HkCqUh.js +2 -0
  157. package/dist/chunks/{memoize-FJv2HV1u.js → memoize-FeyE7JEh.js} +1 -1
  158. package/dist/chunks/memory-COa7aUbx.js +1 -0
  159. package/dist/chunks/{mode-lYTs0XHs.js → mode-Bl2RZC8M.js} +2 -2
  160. package/dist/chunks/model-B7rtZ7KV.js +1 -0
  161. package/dist/chunks/model-Bgh_r4lg.js +1 -0
  162. package/dist/chunks/model-DiuEAv6h.js +1 -0
  163. package/dist/chunks/{modelOptions-efCGKnXT.js → modelOptions-BtEZe5BB.js} +1 -1
  164. package/dist/chunks/nativeInstaller-BEwayifa.js +1 -0
  165. package/dist/chunks/omit--yH_T4rf.js +1 -0
  166. package/dist/chunks/onChangeAppState-ZdwI7boX.js +1 -0
  167. package/dist/chunks/{openai-DJLYqiRl.js → openai-DWs4D-nQ.js} +3 -3
  168. package/dist/chunks/panel-CoNfXy3K.js +1 -0
  169. package/dist/chunks/{parser-BdCj2GrE.js → parser-BH4u7QiV.js} +1 -1
  170. package/dist/chunks/parser-BMIaRErw.js +1 -0
  171. package/dist/chunks/partition-DLcW5Oo_.js +1 -0
  172. package/dist/chunks/permissions-CaucYK3s.js +3 -0
  173. package/dist/chunks/pidLock-DgOBc1Xo.js +3 -0
  174. package/dist/chunks/{plan-BeoIjNPv.js → plan-BNYDTnQd.js} +1 -1
  175. package/dist/chunks/{platform-D6IMiyqT.js → platform-B0uTQc9P.js} +1 -1
  176. package/dist/chunks/plugin-BN-of1_H.js +17 -0
  177. package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +1 -0
  178. package/dist/chunks/pluginBlocklist-DXQlbG0P.js +1 -0
  179. package/dist/chunks/pluginCliCommands-CfdVNs8D.js +1 -0
  180. package/dist/chunks/pluginFlagging-DcJ_FQuv.js +1 -0
  181. package/dist/chunks/pluginOperations-DnhzFbYI.js +2 -0
  182. package/dist/chunks/pluginStartupCheck-CKBFaMFr.js +1 -0
  183. package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +1 -0
  184. package/dist/chunks/{plugins-pmipe7kE.js → plugins-CBW7kPyp.js} +4 -4
  185. package/dist/chunks/{poorMode-BxsyllUK.js → poorMode-B_xEvuEV.js} +1 -1
  186. package/dist/chunks/poorMode-yH1o41cQ.js +1 -0
  187. package/dist/chunks/print-BZOx09SU.js +26 -0
  188. package/dist/chunks/processBashCommand-dcCNCiBp.js +1 -0
  189. package/dist/chunks/processSlashCommand-YDiM63Qr.js +5 -0
  190. package/dist/chunks/prompt-CXGy0llt.js +1 -0
  191. package/dist/chunks/prompt-DovNDmcx.js +1 -0
  192. package/dist/chunks/{prompt-CybUvG8G.js → prompt-Dx7IWhBt.js} +34 -34
  193. package/dist/chunks/{promptEditor-0Ug93P2I.js → promptEditor-WCkmpejM.js} +2 -2
  194. package/dist/chunks/{protocolHandler-ClfbHTjI.js → protocolHandler-BiVWrpHi.js} +4 -4
  195. package/dist/chunks/{proxy-Blq4W6Ox.js → proxy-CVn7o19p.js} +3 -3
  196. package/dist/chunks/reconciler-C2Nd_e4n.js +1 -0
  197. package/dist/chunks/refresh-B84H2Ezd.js +1 -0
  198. package/dist/chunks/{registerProtocol-3_ozAuDK.js → registerProtocol-E0Iu5hEx.js} +2 -2
  199. package/dist/chunks/{reload-plugins-Dn1ibOiI.js → reload-plugins-D-3AUT9g.js} +1 -1
  200. package/dist/chunks/{remoteBridgeCore-Dpg6Se9C.js → remoteBridgeCore-CV6we3ZA.js} +1 -1
  201. package/dist/chunks/remoteManagedSettings-D26Q09-7.js +1 -0
  202. package/dist/chunks/rename-CSavuBIE.js +1 -0
  203. package/dist/chunks/{renderOptions-CLcco6fc.js → renderOptions-DDLbSMQU.js} +1 -1
  204. package/dist/chunks/resume-CROylN3J.js +2 -0
  205. package/dist/chunks/ripgrep-2M1GkXqJ.js +1 -0
  206. package/dist/chunks/{ripgrep-DkL2S7-I.js → ripgrep-C1ydIMzT.js} +5 -5
  207. package/dist/chunks/{runtimeObserver-DonWCJOx.js → runtimeObserver-L7pSIWBT.js} +4 -4
  208. package/dist/chunks/{runtimeObserver-B0xfyLiA.js → runtimeObserver-OU8KrZQG.js} +1 -1
  209. package/dist/chunks/sandbox-adapter-6UwMLh6e.js +1 -0
  210. package/dist/chunks/{sandbox-toggle-CSdnHWp-.js → sandbox-toggle-YrQNWGsr.js} +1 -1
  211. package/dist/chunks/searchExtraTools-Bdv5HJ74.js +1 -0
  212. package/dist/chunks/{session-BbQlh2S5.js → session-DUYsfPy_.js} +2 -2
  213. package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +1 -0
  214. package/dist/chunks/sessionObserver-B0zucj_c.js +1 -0
  215. package/dist/chunks/{sessionObserver-XV6N0XER.js → sessionObserver-Dv3Ba8eA.js} +2 -2
  216. package/dist/chunks/sessionState-D-SaBzWD.js +11 -0
  217. package/dist/chunks/sessionStorage-BM1x51Z7.js +1 -0
  218. package/dist/chunks/{sessionTitle-E1FvsKM9.js → sessionTitle-uCuYaNif.js} +2 -2
  219. package/dist/chunks/{sessionTracing-ClGQ08jM.js → sessionTracing-Bqb3vJTt.js} +3 -3
  220. package/dist/chunks/settings-BG15IFYx.js +1 -0
  221. package/dist/chunks/settings-D4CpDv2y.js +20 -0
  222. package/dist/chunks/settingsSync-BSrpnyqo.js +1 -0
  223. package/dist/chunks/setup-C62oq4AZ.js +3 -0
  224. package/dist/chunks/{shadowedRuleDetection-B9iSx6mB.js → shadowedRuleDetection-BzAZ57p2.js} +1 -1
  225. package/dist/chunks/{shellQuote-Bth6IZgX.js → shellQuote-DS6WrivY.js} +2 -2
  226. package/dist/chunks/{sideQuestion-D2dPToW8.js → sideQuestion-CvMBBjI8.js} +3 -3
  227. package/dist/chunks/sinks-WJ7nzLQs.js +1 -0
  228. package/dist/chunks/sinks-f7qYjbKJ.js +2 -0
  229. package/dist/chunks/skillChangeDetector-U5kRU5nd.js +1 -0
  230. package/dist/chunks/{skillGapStore-DylpOKJ6.js → skillGapStore-CqaT8c0C.js} +2 -2
  231. package/dist/chunks/{skillLifecycle-GK-8eyyn.js → skillLifecycle-CnR8IqJM.js} +2 -2
  232. package/dist/chunks/skillSearchPanel-D9qrOXpI.js +21 -0
  233. package/dist/chunks/{skills-t6krW8GZ.js → skills-BgcFh0vy.js} +1 -1
  234. package/dist/chunks/startupProfiler-B4HBBbHN.js +1 -0
  235. package/dist/chunks/{startupProfiler-jeId9f2i.js → startupProfiler-CmH_aVy2.js} +3 -3
  236. package/dist/chunks/state-BemZdQIl.js +1 -0
  237. package/dist/chunks/state-D_lk6z-C.js +1 -0
  238. package/dist/chunks/{stats-BJBhl-Lc.js → stats-B8uQ-UDi.js} +1 -1
  239. package/dist/chunks/{status-BtsnKNVY.js → status-BekdWoIj.js} +1 -1
  240. package/dist/chunks/{status-nZQEar7T.js → status-D6KlRJmR.js} +2 -2
  241. package/dist/chunks/statusNoticeHelpers-BMM8_uJ1.js +1 -0
  242. package/dist/chunks/{stringUtils-CbS6OkmE.js → stringUtils-C8PaYpQF.js} +1 -1
  243. package/dist/chunks/switcher-Ck9CrXrr.js +1 -0
  244. package/dist/chunks/{switcher-77h2J5HC.js → switcher-DnAhkyIn.js} +1 -1
  245. package/dist/chunks/syncCache-ClP9aBqK.js +1 -0
  246. package/dist/chunks/{tasks-BNrdmF9p.js → tasks-Dmh6qikm.js} +1 -1
  247. package/dist/chunks/teleport-DH3IuAUQ.js +1 -0
  248. package/dist/chunks/{templateJobs-Dkv4I9c1.js → templateJobs-CxqU-s5i.js} +1 -1
  249. package/dist/chunks/{terminalSetup-DQopnSPR.js → terminalSetup-BKGcmlWp.js} +1 -1
  250. package/dist/chunks/{terminalSetup-DTGm1Eo2.js → terminalSetup-Cy19F1Js.js} +4 -4
  251. package/dist/chunks/{theme-BjpBVRf5.js → theme-U7lMFHQ0.js} +1 -1
  252. package/dist/chunks/{tmux-CMRiI6CD.js → tmux-D5EvHWi3.js} +1 -1
  253. package/dist/chunks/{toolEventObserver-D-sNBvOe.js → toolEventObserver-D9qjoVl5.js} +1 -1
  254. package/dist/chunks/toolPool-69mfSPAs.js +1 -0
  255. package/dist/chunks/trustedDevice-B6AKlsl_.js +1 -0
  256. package/dist/chunks/trustedDevice-DL0pWP4_.js +1 -0
  257. package/dist/chunks/{types-DWRxAH0E.js → types-DafcFtmb.js} +2 -2
  258. package/dist/chunks/udsClient-CWnfsgFP.js +1 -0
  259. package/dist/chunks/updateCCB-C6XftzIG.js +11 -0
  260. package/dist/chunks/{upstreamproxy-DDVMwoRi.js → upstreamproxy-CXmjxHpl.js} +2 -2
  261. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-D2FvHieH.js → useExitOnCtrlCDWithKeybindings-DEEJhm_W.js} +1 -1
  262. package/dist/chunks/useMainLoopModel-6w7mhwhU.js +1 -0
  263. package/dist/chunks/useManagePlugins-CjnsO-Of.js +1 -0
  264. package/dist/chunks/{useMergedTools-B-Z9XQ6U.js → useMergedTools-DbhqKk1-.js} +1 -1
  265. package/dist/chunks/{useSearchInput-C6d6nt9S.js → useSearchInput-gUDbkLaC.js} +1 -1
  266. package/dist/chunks/useSettingsErrors-CgPad-H0.js +1 -0
  267. package/dist/chunks/{userAgent-Ng_TTjWr.js → userAgent-CU7Ndh79.js} +1 -1
  268. package/dist/chunks/util-B4oMhJKh.js +1 -0
  269. package/dist/chunks/validatePlugin-y_O_tCEL.js +1 -0
  270. package/dist/chunks/{vim-3mUqsEJm.js → vim-w37BfGZ5.js} +1 -1
  271. package/dist/chunks/{which-DznMOwny.js → which-BRWBO7Gu.js} +1 -1
  272. package/dist/chunks/windowsPaths-BY-IVNwQ.js +1 -0
  273. package/dist/chunks/windowsPaths-DtWHLjmE.js +1 -0
  274. package/dist/chunks/{workSecret-DtiFreRl.js → workSecret-BEhXgH2M.js} +1 -1
  275. package/dist/chunks/workerRegistry-Bq9bS5pw.js +6 -0
  276. package/dist/chunks/worktree-4SUJ4dtz.js +1 -0
  277. package/dist/cli.js +1 -1
  278. package/package.json +2 -3
  279. package/dist/chunks/ApproveApiKey-D05WywHU.js +0 -1
  280. package/dist/chunks/ApproveApiKey-DHAbdwkC.js +0 -1
  281. package/dist/chunks/BackgroundTasksDialog-QgFwoaaC.js +0 -2
  282. package/dist/chunks/ClaudeMdExternalIncludesDialog-DpecRCAt.js +0 -1
  283. package/dist/chunks/ConsoleOAuthFlow-D1MYL1dJ.js +0 -1
  284. package/dist/chunks/Doctor-D160J8Ad.js +0 -3
  285. package/dist/chunks/Doctor-VhJi2cmL.js +0 -1
  286. package/dist/chunks/ExitFlow-CoWHhKHJ.js +0 -2
  287. package/dist/chunks/MCPConnectionManager-DPFe4hPh.js +0 -1
  288. package/dist/chunks/MCPToolListView-BPmE0C2o.js +0 -1
  289. package/dist/chunks/MessageSelector-kOn2GaU-.js +0 -3
  290. package/dist/chunks/Messages-4EnHFeh1.js +0 -11
  291. package/dist/chunks/PromptInputHelpMenu-BvcAzbSi.js +0 -1
  292. package/dist/chunks/QueryEngine-J6ElcO16.js +0 -1
  293. package/dist/chunks/REPL-DBjbAJsm.js +0 -133
  294. package/dist/chunks/REPL-oBemMXvp.js +0 -1
  295. package/dist/chunks/RemoteSessionManager-CoIyFKKa.js +0 -2
  296. package/dist/chunks/ResumeConversation-wBG8OD9P.js +0 -1
  297. package/dist/chunks/SearchExtraToolsTool-BugrzImr.js +0 -1
  298. package/dist/chunks/Settings-DptKuJE7.js +0 -2
  299. package/dist/chunks/WelcomeV2-BWF-cJOu.js +0 -1
  300. package/dist/chunks/add-dir-DBVT1cEK.js +0 -1
  301. package/dist/chunks/agents-CnwTOlqO.js +0 -103
  302. package/dist/chunks/allErrors-DYw_q14e.js +0 -1
  303. package/dist/chunks/api-DXDXTFGa.js +0 -1
  304. package/dist/chunks/attributionTrailer-oKKrF3z8.js +0 -1
  305. package/dist/chunks/auth-CnLb6RWc.js +0 -1
  306. package/dist/chunks/auth-D-SGHS0K.js +0 -1
  307. package/dist/chunks/autonomy-dSJl0hN1.js +0 -15
  308. package/dist/chunks/autonomyPanel-Ccr9ilei.js +0 -1
  309. package/dist/chunks/backgroundHousekeeping--cs5crp7.js +0 -17
  310. package/dist/chunks/backgroundHousekeeping-CcbHitKC.js +0 -1
  311. package/dist/chunks/bg-DWloqGwk.js +0 -1
  312. package/dist/chunks/branch-CG0AKS1J.js +0 -3
  313. package/dist/chunks/bridgeConfig-Dmc1ZDev.js +0 -1
  314. package/dist/chunks/bridgeMessaging-DlczTV9X.js +0 -1
  315. package/dist/chunks/caches-1IFb6_M_.js +0 -1
  316. package/dist/chunks/caches-CB8MHqy2.js +0 -1
  317. package/dist/chunks/ccrClient-CG6HTv_n.js +0 -1
  318. package/dist/chunks/client-Crrwkw7g.js +0 -1
  319. package/dist/chunks/client-D8hKghba.js +0 -1
  320. package/dist/chunks/color-Cuq0c6xy.js +0 -1
  321. package/dist/chunks/commands-D3sESsTp.js +0 -1
  322. package/dist/chunks/compact-DIpwuBDq.js +0 -2
  323. package/dist/chunks/config-D4G8_MqJ.js +0 -3
  324. package/dist/chunks/config-q9D4hFiK.js +0 -1
  325. package/dist/chunks/context-noninteractive-Bwt9A3XD.js +0 -1
  326. package/dist/chunks/conversation-Bjo_8kia.js +0 -1
  327. package/dist/chunks/conversation-DrHZIQX2.js +0 -1
  328. package/dist/chunks/createSession-CPo6GBSb.js +0 -1
  329. package/dist/chunks/createSession-DnykRoia.js +0 -1
  330. package/dist/chunks/crossProjectResume-D2A-qjgP.js +0 -40
  331. package/dist/chunks/cwd--q1ONL7P.js +0 -1
  332. package/dist/chunks/cwd-L4wygFqJ.js +0 -1
  333. package/dist/chunks/daemon-D2vFIVOz.js +0 -2
  334. package/dist/chunks/datadog-DrmHyl3_.js +0 -1
  335. package/dist/chunks/debug-BdqxZ7rV.js +0 -39
  336. package/dist/chunks/detectRepository-DA1Q_Skc.js +0 -1
  337. package/dist/chunks/detectRepository-DvxoaPlk.js +0 -1
  338. package/dist/chunks/doctor-PWqB46xd.js +0 -1
  339. package/dist/chunks/earlyInput-xcoTbKQn.js +0 -1
  340. package/dist/chunks/entry-4JtoJONR.js +0 -14
  341. package/dist/chunks/esm-DcIr7tVd.js +0 -1
  342. package/dist/chunks/execSyncWrapper-DKuxVTaf.js +0 -1
  343. package/dist/chunks/exit-OW9g7b9A.js +0 -1
  344. package/dist/chunks/extractMemories-1VlmCGwa.js +0 -1
  345. package/dist/chunks/fast-CrvLdpy3.js +0 -1
  346. package/dist/chunks/featureCheck-CrJeuheQ.js +0 -1
  347. package/dist/chunks/featureCheck-HslM03dr.js +0 -1
  348. package/dist/chunks/firstPartyEventLogger-BBXEQUf0.js +0 -1
  349. package/dist/chunks/firstPartyEventLogger-DhEPWcit.js +0 -5
  350. package/dist/chunks/flushGate-ch-Tvwjj.js +0 -1
  351. package/dist/chunks/generateRecap-BIBVlB__.js +0 -1
  352. package/dist/chunks/generateSessionName-nZj_VvKZ.js +0 -1
  353. package/dist/chunks/git-B9uvt96d.js +0 -6
  354. package/dist/chunks/git-BfS5Hk4S.js +0 -1
  355. package/dist/chunks/githubRepoPathMapping-Cqx3pSfc.js +0 -1
  356. package/dist/chunks/help-D2-v9Ug9.js +0 -1
  357. package/dist/chunks/hooks-DGd02IKF.js +0 -1
  358. package/dist/chunks/initReplBridge-RhCAlmHE.js +0 -1
  359. package/dist/chunks/intl-cKc-V6Mq.js +0 -1
  360. package/dist/chunks/jwtUtils-C9sdGhvT.js +0 -1
  361. package/dist/chunks/keybindings-BRdSOSUD.js +0 -2
  362. package/dist/chunks/language-C0cIpKE2.js +0 -1
  363. package/dist/chunks/language-CxThoWRC.js +0 -1
  364. package/dist/chunks/loadAgentsDir-8UprzS4w.js +0 -1
  365. package/dist/chunks/loadPluginHooks-LbaURHVH.js +0 -1
  366. package/dist/chunks/localSearch-DNjbr4S9.js +0 -1
  367. package/dist/chunks/log-CTFl4qpD.js +0 -1
  368. package/dist/chunks/main-BIiwW4mM.js +0 -605
  369. package/dist/chunks/managedEnv-CpiiQx_v.js +0 -1
  370. package/dist/chunks/mcp-B_m1XBDt.js +0 -6
  371. package/dist/chunks/mcp-BiyfH9Sd.js +0 -1
  372. package/dist/chunks/mcp-BjlaPUWX.js +0 -2
  373. package/dist/chunks/memory-LN8f_p2b.js +0 -1
  374. package/dist/chunks/model-C2e73CJD.js +0 -1
  375. package/dist/chunks/model-CvmS-Esk.js +0 -1
  376. package/dist/chunks/model-DJ8mFfuR.js +0 -1
  377. package/dist/chunks/nativeInstaller-DQIFwdat.js +0 -1
  378. package/dist/chunks/omit-CLPZGevl.js +0 -1
  379. package/dist/chunks/onChangeAppState-DhBO34OK.js +0 -1
  380. package/dist/chunks/panel-q0_iT9cg.js +0 -1
  381. package/dist/chunks/panelCall-sum-3zvi.js +0 -1
  382. package/dist/chunks/parser-BcdhBGx0.js +0 -1
  383. package/dist/chunks/partition-CpfoVrg1.js +0 -1
  384. package/dist/chunks/permissions-DTb9wkAP.js +0 -3
  385. package/dist/chunks/pidLock-BR5M6RQw.js +0 -3
  386. package/dist/chunks/pipeTransport-B3TIkTAp.js +0 -1
  387. package/dist/chunks/plugin-D_dHjTud.js +0 -17
  388. package/dist/chunks/pluginAutoupdate-BHKlOOXI.js +0 -1
  389. package/dist/chunks/pluginBlocklist-D93Hd1GF.js +0 -1
  390. package/dist/chunks/pluginCliCommands-vv0wNt4O.js +0 -1
  391. package/dist/chunks/pluginFlagging-CxuRF2Vc.js +0 -1
  392. package/dist/chunks/pluginOperations-BTq4AjYB.js +0 -2
  393. package/dist/chunks/pluginStartupCheck-B6leNWq9.js +0 -1
  394. package/dist/chunks/pluginStartupCheck-DBOCHUHQ.js +0 -1
  395. package/dist/chunks/poorMode-iV1NwC5L.js +0 -1
  396. package/dist/chunks/print-CAUvczBM.js +0 -23
  397. package/dist/chunks/processBashCommand-CdeQg_c6.js +0 -1
  398. package/dist/chunks/processSlashCommand-CbkshIC6.js +0 -5
  399. package/dist/chunks/prompt-RBn4JdEg.js +0 -1
  400. package/dist/chunks/prompt-Rb8zXlDo.js +0 -1
  401. package/dist/chunks/reconciler-Drq3HSkj.js +0 -4
  402. package/dist/chunks/refresh-D8TLHO_T.js +0 -1
  403. package/dist/chunks/remoteManagedSettings-CCrq-qL-.js +0 -1
  404. package/dist/chunks/rename-CKsSc7Z3.js +0 -1
  405. package/dist/chunks/replBridgeHandle-DNC797_T.js +0 -1
  406. package/dist/chunks/resume-B1a5gLVR.js +0 -2
  407. package/dist/chunks/ripgrep-BisRODQ2.js +0 -1
  408. package/dist/chunks/sandbox-adapter-BnBOSkKJ.js +0 -1
  409. package/dist/chunks/searchExtraTools-DbgfnQkH.js +0 -1
  410. package/dist/chunks/sessionFileAccessHooks-Xfr1NiXG.js +0 -1
  411. package/dist/chunks/sessionMemory-7UOFdp29.js +0 -1
  412. package/dist/chunks/sessionMemory-fAzgAS7Q.js +0 -1
  413. package/dist/chunks/sessionMemoryUtils-DVjFw5Bd.js +0 -1
  414. package/dist/chunks/sessionObserver-Cl26OdaW.js +0 -1
  415. package/dist/chunks/sessionState-BvECKycx.js +0 -11
  416. package/dist/chunks/sessionStorage-DSj9yZkl.js +0 -1
  417. package/dist/chunks/settings-B-R9ZJNY.js +0 -1
  418. package/dist/chunks/settings-Xbq6AaD-.js +0 -20
  419. package/dist/chunks/settingsSync-NCN0a4sc.js +0 -1
  420. package/dist/chunks/setup-uZ0dSekt.js +0 -3
  421. package/dist/chunks/sinks-C7q46rvE.js +0 -2
  422. package/dist/chunks/sinks-D3bXeHlQ.js +0 -1
  423. package/dist/chunks/skillChangeDetector-C1EJ7rUL.js +0 -1
  424. package/dist/chunks/skillSearchPanel-mpaC62y4.js +0 -21
  425. package/dist/chunks/startupProfiler-BaiXZ9tr.js +0 -1
  426. package/dist/chunks/state-B4HwLt8i.js +0 -1
  427. package/dist/chunks/state-Bs5xweDL.js +0 -1
  428. package/dist/chunks/statusNoticeHelpers-DMqRGFOh.js +0 -1
  429. package/dist/chunks/switcher-B2CYzCC_.js +0 -1
  430. package/dist/chunks/syncCache-By_-buUC.js +0 -1
  431. package/dist/chunks/teleport-mdnhIZBj.js +0 -1
  432. package/dist/chunks/toolPool-Di30gn_Y.js +0 -1
  433. package/dist/chunks/trustedDevice-CupLMpO8.js +0 -1
  434. package/dist/chunks/trustedDevice-j1u2TG5U.js +0 -1
  435. package/dist/chunks/udsClient-Cm3HqYUu.js +0 -1
  436. package/dist/chunks/updateCCB-BlUAU2Vp.js +0 -11
  437. package/dist/chunks/useMainLoopModel-ylPQNj7Z.js +0 -1
  438. package/dist/chunks/useManagePlugins-BbWJNLe8.js +0 -1
  439. package/dist/chunks/useSettingsErrors-DKh4rkGi.js +0 -1
  440. package/dist/chunks/util-D-X8i5Z2.js +0 -1
  441. package/dist/chunks/validatePlugin-DSw08u76.js +0 -1
  442. package/dist/chunks/windowsPaths-1mgenSWa.js +0 -1
  443. package/dist/chunks/windowsPaths-BVztIhXM.js +0 -1
  444. package/dist/chunks/workerRegistry-DdOYjLm3.js +0 -6
  445. package/dist/chunks/worktree-BX1ULzrw.js +0 -1
@@ -0,0 +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-BDhHQY0-.js";import{t as d}from"./graceful-fs-DDVg0cja.js";import{Ar as f,Ci as p,Cr as m,Dr as h,Er as g,Fr as _,Or as v,Pr as ee,Si as te,Sr as ne,Wt as re,et as ie,fi as ae,gt as oe,hi as se,it as ce,jr as le,kr as ue,mi as de,oi as fe,pi as pe,si as me,vi as he,yi as ge}from"./state-BemZdQIl.js";import{n as _e,t as ve}from"./cwd-Cfdf7z7s.js";import{C as y,F as b,O as x,R as ye,S as be,c as S,f as xe,i as Se,nt as Ce,tt as we,u as C,x as Te}from"./debug-BecbSVoN.js";import{Cr as Ee,Dr as De,Fn as Oe,Or as ke,Qt as Ae,Xt as je,Yt as Me,_r as Ne,c as w,cr as Pe,g as Fe,lr as T,n as Ie,qt as E,vr as Le,wn as Re,wr as ze}from"./settings-D4CpDv2y.js";import{O as Be,k as Ve,m as He,n as Ue}from"./git-DBlOv64X.js";import{d as We,o as Ge,s as Ke,u as qe}from"./log-Dauqle-Z.js";import{m as Je}from"./sessionStoragePortable-JZnGwqUM.js";import{f as Ye,p as Xe,s as Ze,u as Qe}from"./types-DafcFtmb.js";import{n as $e,r as D}from"./analytics-DJobLaWP.js";import{homedir as et}from"os";import{basename as O,dirname as k,isAbsolute as tt,join as A,normalize as j,resolve as nt,sep as rt}from"path";import{unwatchFile as it,watchFile as at}from"fs";import{randomBytes as ot}from"crypto";var M,st=t((()=>{p(),Le(),pe(),de(),M=Object.getOwnPropertySymbols?function(e){for(var t=[];e;)te(t,ae(e)),e=Ne(e);return t}:se}));function ct(e){return he(e,ze,M)}var lt=t((()=>{ge(),st(),Ee()}));function ut(){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=Ie();return t.autoMemoryEnabled===void 0||t.autoMemoryEnabled}function dt(){return!1}function ft(){return process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR?process.env.CLAUDE_CODE_REMOTE_MEMORY_DIR:l()}function pt(e,t){if(!e)return;let n=e;if(t&&(n.startsWith(`~/`)||n.startsWith(`~\\`))){let e=n.slice(2),t=j(e||`.`);if(t===`.`||t===`..`)return;n=A(et(),e)}let r=j(n).replace(/[/\\]+$/,``);if(!(!tt(r)||r.length<3||/^[A-Za-z]:$/.test(r)||r.startsWith(`\\\\`)||r.startsWith(`//`)||r.includes(`\0`)))return(r+rt).normalize(`NFC`)}function mt(){return pt(process.env.CLAUDE_COWORK_MEMORY_PATH_OVERRIDE,!1)}function ht(){return pt(w(`policySettings`)?.autoMemoryDirectory??w(`flagSettings`)?.autoMemoryDirectory??w(`localSettings`)?.autoMemoryDirectory??w(`userSettings`)?.autoMemoryDirectory,!0)}function gt(){return mt()!==void 0}function _t(){return Ue(ce())??ce()}function vt(){return A(N(),xt)}function yt(e){return j(e).startsWith(N())}var bt,xt,N,St=t((()=>{o(),re(),u(),He(),Pe(),Fe(),bt=`memory`,xt=`MEMORY.md`,N=a(()=>(mt()??ht())||(A(A(ft(),`projects`),Je(_t()),bt)+rt).normalize(`NFC`),()=>ce())}));function Ct(e,t,n,i){if(!r(e))return e;t=f(t,e);for(var a=-1,o=t.length,s=o-1,c=e;c!=null&&++a<o;){var l=ue(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])?[]:{})}De(c,l,u),c=c[l]}return e}var wt=t((()=>{ke(),le(),fe(),i(),v()}));function Tt(e,t,n){for(var r=-1,i=t.length,a={};++r<i;){var o=t[r],s=g(e,o);n(s,o)&&Ct(a,f(o,e),s)}return a}var Et=t((()=>{h(),wt(),le()}));function P(e,t){if(e==null)return{};var n=ee(ct(e),function(e){return[e]});return t=ne(t),Tt(e,n,function(e,n){return t(e,n[0])})}var Dt=t((()=>{_(),m(),Et(),lt()})),Ot=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}})),kt=n((e=>{var t=Ot();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}}})),At=n(((e,t)=>{t.exports=kt()})),jt=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`)})),Mt=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=jt(),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)}}})),Nt=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})),Pt=n(((t,n)=>{var r=e(`path`),i=d(),a=At(),o=Mt(),s=Nt(),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})),Ft=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}})),It=n(((e,t)=>{var n=Pt(),{toPromise:r,toSync:i,toSyncOptions:a}=Ft();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 F(){return I||(I=It()),I}function Lt(e,t){return F().lock(e,t)}function Rt(e,t){return F().lockSync(e,t)}function zt(e,t){return F().check(e,t)}var I,Bt=t((()=>{}));function L(){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 Vt(){return fn||(fn=Ht())}function Ht(){if(oe())return!0;let e=B(),t=$();if(e.projects?.[t]?.hasTrustDialogAccepted)return!0;let n=T(ve());for(;;){if(e.projects?.[n]?.hasTrustDialogAccepted)return!0;let t=T(nt(n,`..`));if(t===n)break;n=t}return!1}function R(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 Ut(e){let t=null;try{Zt(E(),L,n=>{let r=e(n);return r===n?n:(t={...r,projects:Kt(n.projects)},t)})&&t&&z(t)}catch(n){S(`Failed to save config with lock: ${n}`,{level:`error`});let r=H(E(),L);if(R(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:Kt(r.projects)},Xt(E(),t,G),z(t)}}function Wt(){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 Gt(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 Kt(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 qt(){if(Z)return;Z=!0;let e=E();at(e,{interval:pn,persistent:!1},t=>{t.mtimeMs<=K.mtime||C().readFile(e,{encoding:`utf-8`}).then(e=>{if(t.mtimeMs<=K.mtime)return;let n=Qe(Xe(e));typeof n!=`object`||!n||(K={config:Gt({...L(),...n}),mtime:t.mtimeMs},q={mtime:t.mtimeMs,size:t.size})}).catch(()=>{})}),Ce(async()=>{it(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=C().statSync(E())}catch{}let t=Gt(H(E(),L));return K={config:t,mtime:e?.mtimeMs??Date.now()},q=e?{mtime:e.mtimeMs,size:e.size}:null,qt(),t}catch{return Gt(H(E(),L))}}function Jt(){let e=B().remoteControlAtStartup;return e!==void 0&&e}function Yt(e){let t=B();return t.customApiKeyResponses?.approved?.includes(e)?`approved`:t.customApiKeyResponses?.rejected?.includes(e)?`rejected`:`new`}function Xt(e,t,n){let r=k(e);C().mkdirSync(r),Oe(e,y(P(t,(e,t)=>y(e)!==y(n[t])),null,2),{encoding:`utf-8`,mode:384}),e===E()&&X++}function Zt(e,t,n){let r=t(),i=k(e),a=C();a.mkdirSync(i);let o;try{let i=`${e}.lock`,s=Date.now();o=Rt(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===E())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=H(e,t);if(e===E()&&R(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=P(u,(e,t)=>y(e)!==y(r[t]));try{let t=O(e),n=V();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 Oe(e,y(d,null,2),{encoding:`utf-8`,mode:384}),e===E()&&X++,!0}finally{o&&o()}}function Qt(){if(Q)return;let e=Date.now();Ve(`info`,`enable_configs_started`),Q=!0,H(E(),L,!0),Ve(`info`,`enable_configs_completed`,{duration_ms:Date.now()-e})}function V(){return A(l(),`backups`)}function $t(e){let t=C(),n=O(e),r=V();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 H(e,t,n){if(!Q)throw Error(`Config accessed before allowed.`);let r=C();try{let n=r.readFileSync(e,{encoding:`utf-8`});try{let e=be(Xe(n));return{...t(),...e}}catch(n){throw new x(n instanceof Error?n.message:String(n),e,t())}}catch(i){if(b(i)===`ENOENT`){let n=$t(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 x&&n)throw i;if(i instanceof x){if(S(`Config file corrupted, resetting to defaults: ${i.message}`,{level:`error`}),!U){U=!0;try{Ke(i);let t=!1;try{r.statSync(`${e}.backup`),t=!0}catch{}D(`tengu_config_parse_error`,{has_backup:t})}finally{U=!1}}process.stderr.write(`\nClaude configuration file at ${e} is corrupted: ${i.message}\n`);let t=O(e),n=V();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=$t(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
+ `),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
+ `)}return t()}}function en(){let e=$(),t=B();if(!t.projects)return W;let n=t.projects[e]??W;return typeof n.allowedTools==`string`&&(n.allowedTools=Qe(n.allowedTools)??[]),n}function tn(e){let t=$(),n=null;try{Zt(E(),L,r=>{let i=r.projects?.[t]??W,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=H(E(),L);if(R(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]??W,o=e(a);if(o===a)return;n={...i,projects:{...i.projects,[t]:o}},Xt(E(),n,G),z(n)}}function nn(){return on()!==null}function rn(){return nn()&&!c(process.env.FORCE_AUTOUPDATE_PLUGINS)}function an(e){switch(e.type){case`development`:return`development build`;case`env`:return`${e.envVar} set`;case`config`:return`config`}}function on(){if(!c(process.env.ENABLE_AUTOUPDATER))return{type:`config`};if(c(process.env.DISABLE_AUTOUPDATER))return{type:`env`,envVar:`DISABLE_AUTOUPDATER`};let e=qe();if(e)return{type:`env`,envVar:e};let t=B();return t.autoUpdates===!1&&(t.installMethod!==`native`||t.autoUpdatesProtectedForNative!==!0)?{type:`config`}:null}function sn(){let e=B();if(e.userID)return e.userID;let t=ot(32).toString(`hex`);return Ut(e=>({...e,userID:t})),t}function cn(){if(!B().firstStartTime){let e=new Date().toISOString();Ut(t=>({...t,firstStartTime:t.firstStartTime??e}))}}function ln(e){let t=ie();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(je(),`CLAUDE.md`);case`AutoMem`:return vt();default:return A(l(),`CLAUDE.md`)}}function un(){return A(je(),`.claude`,`rules`)}function dn(){return A(l(),`rules`)}var U,W,G,fn,K,q,J,Y,X,pn,Z,Q,$,mn=t((()=>{o(),Dt(),re(),St(),$e(),_e(),we(),Se(),Be(),Me(),u(),ye(),Re(),xe(),He(),Ze(),Ye(),Bt(),Ge(),Pe(),We(),Ae(),Te(),U=!1,W={allowedTools:[],mcpContextUris:[],mcpServers:{},enabledMcpjsonServers:[],disabledMcpjsonServers:[],hasTrustDialogAccepted:!1,projectOnboardingSeenCount:0,hasClaudeMdExternalIncludesApproved:!1,hasClaudeMdExternalIncludesWarningShown:!1},G=L(),fn=!1,{...G},{...W},K={config:null,mtime:0},q=null,J=0,Y=0,X=0,Ce(async()=>{Wt()}),pn=1e3,Z=!1,Q=!1,$=a(()=>{let e=ie();return T(Ue(e)||nt(e))})}));export{ft as A,Lt as C,wt as D,Ct as E,dt as F,ct as I,lt as L,St as M,yt as N,vt as O,ut as P,M as R,Bt as S,P as T,cn as _,on as a,rn as b,B as c,sn as d,$ as f,nn as g,mn as h,an as i,gt as j,N as k,un as l,dn as m,Vt as n,en as o,Jt as p,Qt as r,Yt as s,G as t,ln as u,tn as v,Dt as w,zt as x,Ut as y,st as z};
@@ -1 +1 @@
1
- import{c as e,h as t,n,o as r,r as i,v as a,y as o}from"./config-D4G8_MqJ.js";t();export{n as checkHasTrustDialogAccepted,i as enableConfigs,r as getCurrentProjectConfig,e as getGlobalConfig,a as saveCurrentProjectConfig,o as saveGlobalConfig};
1
+ import{c as e,h as t,n,o as r,r as i,v as a,y as o}from"./config-aRiTrtCv.js";t();export{n as checkHasTrustDialogAccepted,i as enableConfigs,r as getCurrentProjectConfig,e as getGlobalConfig,a as saveCurrentProjectConfig,o as saveGlobalConfig};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./figures-5ThXQEtq.js";import{Ay as r,Ig as i,Pg as a,Qa as o,Wa as s,ky as c}from"./loadAgentsDir-CKSb56Gp.js";import{I as l,P as u,fi as d,s as f,t as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Cn as h,bn as g,cn as _,sn as v}from"./settings-Xbq6AaD-.js";import{_ as y,v as b}from"./startupProfiler-jeId9f2i.js";import{Jt as x,dn as S,en as C,hn as w,mn as T,pn as E}from"./prompt-CybUvG8G.js";import{n as D,t as O}from"./staticRender-DrU6eWoq.js";function k(e){let t=[];return A(e,t),j(e,t),N(e,t),P(e,t),F(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function A(e,t){e.percentage>=z&&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 j(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<I||r<L)continue;let a=M(n.name,r,i);a&&t.push(a)}}function M(e,t,n){let r=y(t);switch(e){case T: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 S: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 N(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>=I&&r>=L||a>=R&&n.resultTokens>=L&&t.push({severity:`info`,title:`File reads using ${y(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 P(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=B&&n>=V){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${g(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function F(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<z&&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 I,L,R,z,B,V,H=e((()=>{w(),C(),E(),h(),b(),I=15,L=1e4,R=5,z=80,B=5,V=5e3}));function U({suggestions:e}){return e.length===0?null:(0,W.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,W.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(f,{status:e.severity,withSpace:!0}),(0,W.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,W.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,W.jsx)(l,{marginLeft:2,children:(0,W.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var W,G=e((()=>{t(),d(),p(),b(),W=m()}));function K(){return null}function q(e){let t=new Map;for(let n of e){let e=v(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 Z){let r=t.get(e);r&&n.set(e,r)}return n}function J({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:h}=e,_=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==X&&!e.isDeferred),v=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===X);return(0,Y.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,Y.jsx)(u,{bold:!0,children:`Context Usage`}),(0,Y.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,Y.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,Y.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===X?(0,Y.jsx)(u,{color:e.color,children:`⛝ `},t):(0,Y.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,Y.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,Y.jsxs)(u,{dimColor:!0,children:[o,` · `,y(n),`/`,y(r),` tokens (`,i,`%)`]}),(0,Y.jsx)(K,{}),m!==void 0&&h!==void 0&&(0,Y.jsxs)(u,{color:m<h?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<h?` (below ${h}% threshold)`:``]}),(0,Y.jsx)(u,{children:` `}),(0,Y.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),_.map((e,t)=>{let n=y(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===X,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{color:e.color,children:s}),(0,Y.jsxs)(u,{children:[` `,o,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{dimColor:!0,children:`⛶`}),(0,Y.jsx)(u,{children:` Free space: `}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{color:b.color,children:`⛝`}),(0,Y.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,Y.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`MCP tools`}),(0,Y.jsxs)(u,{dimColor:!0,children:[` · /mcp`,v?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),v&&c.some(e=>!e.isLoaded)&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,Y.jsx)(l,{children:(0,Y.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!v&&c.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`Custom agents`}),(0,Y.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(q(f).entries()).map(([e,t])=>(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`Memory files`}),(0,Y.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,g(e.path),`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`Skills`}),(0,Y.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(q(p.skillFrontmatter).entries()).map(([e,t])=>(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,Y.jsx)(U,{suggestions:k(e)})]})}var Y,X,Z,Q=e((()=>{d(),p(),H(),h(),b(),_(),G(),Y=m(),X=`Autocompact buffer`,Z=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ee(e){return s(e)}async function te(e,t){let{messages:n,getAppState:i,options:{mainLoopModel:o,tools:s}}=t,c=ee(n),{messages:l}=await r(c),u=process.stdout.columns||80,d=i();return e(await D((0,$.jsx)(J,{data:await a(l,o,async()=>d.toolPermissionContext,s,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{d(),Q(),c(),i(),o(),O(),$=m()}))();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{Ba as r,Ev as i,Ma as a,Tv as o,fv as s,mv as c}from"./loadAgentsDir-BL93ulMm.js";import{I as l,P as u,fi as d,s as f,t as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{cn as h,ln as g,wn as _,xn as v}from"./settings-D4CpDv2y.js";import{_ as y,v as b}from"./startupProfiler-CmH_aVy2.js";import{Et as x,Zt as S,an as C,on as w,rn as T,wt as E}from"./prompt-Dx7IWhBt.js";import{n as D,t as O}from"./staticRender-DrU6eWoq.js";function k(e){let t=[];return A(e,t),j(e,t),N(e,t),P(e,t),F(e,t),t.sort((e,t)=>e.severity===t.severity?(t.savingsTokens??0)-(e.savingsTokens??0):e.severity===`warning`?-1:1),t}function A(e,t){e.percentage>=z&&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 j(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<I||r<L)continue;let a=M(n.name,r,i);a&&t.push(a)}}function M(e,t,n){let r=y(t);switch(e){case C: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 S: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 E: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 N(e,t){if(!e.messageBreakdown)return;let n=e.messageBreakdown.toolCallsByType.find(e=>e.name===S);if(!n)return;let r=n.callTokens+n.resultTokens,i=r/e.rawMaxTokens*100,a=n.resultTokens/e.rawMaxTokens*100;i>=I&&r>=L||a>=R&&n.resultTokens>=L&&t.push({severity:`info`,title:`File reads using ${y(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 P(e,t){let n=e.memoryFiles.reduce((e,t)=>e+t.tokens,0),r=n/e.rawMaxTokens*100;if(r>=B&&n>=V){let i=[...e.memoryFiles].sort((e,t)=>t.tokens-e.tokens).slice(0,3).map(e=>`${v(e.path)} (${y(e.tokens)})`).join(`, `);t.push({severity:`info`,title:`Memory files using ${y(n)} tokens (${r.toFixed(0)}%)`,detail:`Largest: ${i}. Use /memory to review and prune stale entries.`,savingsTokens:Math.floor(n*.3)})}}function F(e,t){!e.isAutoCompactEnabled&&e.percentage>=50&&e.percentage<z&&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 I,L,R,z,B,V,H=e((()=>{w(),T(),x(),_(),b(),I=15,L=1e4,R=5,z=80,B=5,V=5e3}));function U({suggestions:e}){return e.length===0?null:(0,W.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,W.jsx)(u,{bold:!0,children:`Suggestions`}),e.map((e,t)=>(0,W.jsxs)(l,{flexDirection:`column`,marginTop:t===0?0:1,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(f,{status:e.severity,withSpace:!0}),(0,W.jsx)(u,{bold:!0,children:e.title}),e.savingsTokens?(0,W.jsxs)(u,{dimColor:!0,children:[` `,n.arrowRight,` save ~`,y(e.savingsTokens)]}):null]}),(0,W.jsx)(l,{marginLeft:2,children:(0,W.jsx)(u,{dimColor:!0,children:e.detail})})]},t))]})}var W,G=e((()=>{t(),d(),p(),b(),W=m()}));function K(){return null}function q(e){let t=new Map;for(let n of e){let e=h(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 Z){let r=t.get(e);r&&n.set(e,r)}return n}function J({data:e}){let{categories:t,totalTokens:n,rawMaxTokens:r,percentage:i,gridRows:a,model:o,memoryFiles:s,mcpTools:c,deferredBuiltinTools:d=[],agents:f,skills:p,cacheHitRate:m,cacheThreshold:h}=e,g=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==X&&!e.isDeferred),_=t.some(e=>e.isDeferred&&e.name.includes(`MCP`)),b=t.find(e=>e.name===X);return(0,Y.jsxs)(l,{flexDirection:`column`,paddingLeft:1,children:[(0,Y.jsx)(u,{bold:!0,children:`Context Usage`}),(0,Y.jsxs)(l,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(l,{flexDirection:`column`,flexShrink:0,children:a.map((e,t)=>(0,Y.jsx)(l,{flexDirection:`row`,marginLeft:-1,children:e.map((e,t)=>e.categoryName===`Free space`?(0,Y.jsx)(u,{dimColor:!0,children:`⛶ `},t):e.categoryName===X?(0,Y.jsx)(u,{color:e.color,children:`⛝ `},t):(0,Y.jsx)(u,{color:e.color,children:e.squareFullness>=.7?`⛁ `:`⛀ `},t))},t))}),(0,Y.jsxs)(l,{flexDirection:`column`,gap:0,flexShrink:0,children:[(0,Y.jsxs)(u,{dimColor:!0,children:[o,` · `,y(n),`/`,y(r),` tokens (`,i,`%)`]}),(0,Y.jsx)(K,{}),m!==void 0&&h!==void 0&&(0,Y.jsxs)(u,{color:m<h?`warning`:void 0,children:[`Cache hit rate: `,m.toFixed(0),`%`,m<h?` (below ${h}% threshold)`:``]}),(0,Y.jsx)(u,{children:` `}),(0,Y.jsx)(u,{dimColor:!0,italic:!0,children:`Estimated usage by category`}),g.map((e,t)=>{let n=y(e.tokens),i=e.isDeferred?`N/A`:`${(e.tokens/r*100).toFixed(1)}%`,a=e.name===X,o=e.name,s=e.isDeferred?` `:a?`⛝`:`⛁`;return(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{color:e.color,children:s}),(0,Y.jsxs)(u,{children:[` `,o,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[n,` tokens (`,i,`)`]})]},t)}),(t.find(e=>e.name===`Free space`)?.tokens??0)>0&&(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{dimColor:!0,children:`⛶`}),(0,Y.jsx)(u,{children:` Free space: `}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(t.find(e=>e.name===`Free space`)?.tokens||0),` (`,((t.find(e=>e.name===`Free space`)?.tokens||0)/r*100).toFixed(1),`%)`]})]}),b&&b.tokens>0&&(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{color:b.color,children:`⛝`}),(0,Y.jsxs)(u,{dimColor:!0,children:[` `,b.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(b.tokens),` tokens (`,(b.tokens/r*100).toFixed(1),`%)`]})]})]})]}),(0,Y.jsxs)(l,{flexDirection:`column`,marginLeft:-1,children:[c.length>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`MCP tools`}),(0,Y.jsxs)(u,{dimColor:!0,children:[` · /mcp`,_?` (loaded on-demand)`:``]})]}),c.some(e=>e.isLoaded)&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:`Loaded`}),c.filter(e=>e.isLoaded).map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),_&&c.some(e=>!e.isLoaded)&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:`Available`}),c.filter(e=>!e.isLoaded).map((e,t)=>(0,Y.jsx)(l,{children:(0,Y.jsxs)(u,{dimColor:!0,children:[`└ `,e.name]})},t))]}),!_&&c.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),f.length>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`Custom agents`}),(0,Y.jsx)(u,{dimColor:!0,children:` · /agents`})]}),Array.from(q(f).entries()).map(([e,t])=>(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.agentType,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]}),s.length>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`Memory files`}),(0,Y.jsx)(u,{dimColor:!0,children:` · /memory`})]}),s.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,v(e.path),`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]}),p&&p.tokens>0&&(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsxs)(l,{children:[(0,Y.jsx)(u,{bold:!0,children:`Skills`}),(0,Y.jsx)(u,{dimColor:!0,children:` · /skills`})]}),Array.from(q(p.skillFrontmatter).entries()).map(([e,t])=>(0,Y.jsxs)(l,{flexDirection:`column`,marginTop:1,children:[(0,Y.jsx)(u,{dimColor:!0,children:e}),t.map((e,t)=>(0,Y.jsxs)(l,{children:[(0,Y.jsxs)(u,{children:[`└ `,e.name,`: `]}),(0,Y.jsxs)(u,{dimColor:!0,children:[y(e.tokens),` tokens`]})]},t))]},e))]})]}),(0,Y.jsx)(U,{suggestions:k(e)})]})}var Y,X,Z,Q=e((()=>{d(),p(),H(),_(),b(),g(),G(),Y=m(),X=`Autocompact buffer`,Z=[`Project`,`User`,`Managed`,`Plugin`,`Built-in`]}));function ee(e){return a(e)}async function te(e,t){let{messages:n,getAppState:r,options:{mainLoopModel:a,tools:o}}=t,c=ee(n),{messages:l}=await i(c),u=process.stdout.columns||80,d=r();return e(await D((0,$.jsx)(J,{data:await s(l,a,async()=>d.toolPermissionContext,o,d.agentDefinitions,u,t,void 0,c)}))),null}var $;e((()=>{d(),Q(),o(),c(),r(),O(),$=m()}))();export{te as call};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ay as t,Ig as n,Pg as r,Qa as i,Wa as a,ky as o}from"./loadAgentsDir-CKSb56Gp.js";import{cn as s,sn as c}from"./settings-Xbq6AaD-.js";import{_ as l,v as u}from"./startupProfiler-jeId9f2i.js";async function d(e){let{messages:n,getAppState:i,options:{mainLoopModel:o,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=a(n),{messages:f}=await t(d),p=i();return r(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:u,skills:d}=e,f=`## Context Usage
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ba as t,Ev as n,Ma as r,Tv as i,fv as a,mv as o}from"./loadAgentsDir-BL93ulMm.js";import{cn as s,ln as c}from"./settings-D4CpDv2y.js";import{_ as l,v as u}from"./startupProfiler-CmH_aVy2.js";async function d(e){let{messages:t,getAppState:i,options:{mainLoopModel:o,tools:s,agentDefinitions:c,customSystemPrompt:l,appendSystemPrompt:u}}=e,d=r(t),{messages:f}=await n(d),p=i();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:c,agents:u,skills:d}=e,f=`## Context Usage
2
2
 
3
3
  `;f+=`**Model:** ${a} \n`,f+=`**Tokens:** ${l(n)} / ${l(r)} (${i}%)\n`,f+=`
4
4
  `;let p=t.filter(e=>e.tokens>0&&e.name!==`Free space`&&e.name!==`Autocompact buffer`);if(p.length>0){f+=`### Estimated usage by category
@@ -6,11 +6,11 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ay as t,Ig as n,Pg as
6
6
  `,f+=`| Category | Tokens | Percentage |
7
7
  `,f+=`|----------|--------|------------|
8
8
  `;for(let e of p){let t=(e.tokens/r*100).toFixed(1);f+=`| ${e.name} | ${l(e.tokens)} | ${t}% |\n`}let e=t.find(e=>e.name===`Free space`);if(e&&e.tokens>0){let t=(e.tokens/r*100).toFixed(1);f+=`| Free space | ${l(e.tokens)} | ${t}% |\n`}let n=t.find(e=>e.name===`Autocompact buffer`);if(n&&n.tokens>0){let e=(n.tokens/r*100).toFixed(1);f+=`| Autocompact buffer | ${l(n.tokens)} | ${e}% |\n`}f+=`
9
- `}if(s.length>0){f+=`### MCP Tools
9
+ `}if(c.length>0){f+=`### MCP Tools
10
10
 
11
11
  `,f+=`| Tool | Server | Tokens |
12
12
  `,f+=`|------|--------|--------|
13
- `;for(let e of s)f+=`| ${e.name} | ${e.serverName} | ${l(e.tokens)} |\n`;f+=`
13
+ `;for(let e of c)f+=`| ${e.name} | ${e.serverName} | ${l(e.tokens)} |\n`;f+=`
14
14
  `}if(u.length>0){f+=`### Custom Agents
15
15
 
16
16
  `,f+=`| Agent Type | Source | Tokens |
@@ -25,5 +25,5 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ay as t,Ig as n,Pg as
25
25
 
26
26
  `,f+=`| Skill | Source | Tokens |
27
27
  `,f+=`|-------|--------|--------|
28
- `;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${c(e.source)} | ${l(e.tokens)} |\n`;f+=`
29
- `}return f}var m=e((()=>{o(),n(),u(),i(),s()}));export{d as n,m as r,f as t};
28
+ `;for(let e of d.skillFrontmatter)f+=`| ${e.name} | ${s(e.source)} | ${l(e.tokens)} |\n`;f+=`
29
+ `}return f}var m=e((()=>{i(),o(),u(),t(),c()}));export{d as n,m as r,f as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./context-noninteractive-D91W2B8e.js";t();export{n as call,e as collectContextData};
@@ -0,0 +1 @@
1
+ import{a as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";import{An as n,B_ as r,Bs as i,Cr as a,ME as o,On as s,St as c,TE as l,Tt as u,Vs as d,Xt as f,Yh as p,Yn as m,_i as h,c_ as g,dw as _,ii as v,ir as y,jn as b,mi as x,n_ as S,o_ as C,qh as w,r_ as T,un as E,uw as D,vc as O,vn as k,z_ as A}from"./loadAgentsDir-BL93ulMm.js";import{Dn as j,G as M,Qt as N,Tn as P,Wt as F,en as I,et as L,wn as R}from"./state-BemZdQIl.js";import{o as z,s as B}from"./log-Dauqle-Z.js";import{n as V,r as H}from"./analytics-DJobLaWP.js";import{_ as U,x as W}from"./sessionState-D-SaBzWD.js";import{n as G,t as K}from"./caches-Bp9MZ7IE.js";import{randomUUID as q}from"crypto";function J(){return Y}var Y,X=t((()=>{O(),Y=null}));function Z(){let e=J();if(!e)return;e.markTranscriptReset?.();let t={type:`status`,subtype:`status`,status:`conversation_cleared`,message:`conversation_cleared`,uuid:q()};e.writeSdkMessages([t])}async function Q({setMessages:t,readFileState:i,discoveredSkillNames:o,loadedNestedMemoryPaths:u,getAppState:p,setAppState:g,setConversationId:b}){let S=E();await f(`clear`,{getAppState:p,setAppState:g,signal:AbortSignal.timeout(S),timeoutMs:S});let D=M();D&&H(`tengu_cache_eviction_hint`,{scope:`conversation_clear`,last_request_id:D});let O=new Set,k=[],A=e=>`isBackgrounded`in e&&e.isBackgrounded===!1;if(p)for(let e of Object.values(p().tasks))A(e)||d(e)&&(O.add(e.agentId),k.push(e));t(()=>[]),Z();{let{setContextBlocked:t}=(U(),e(W));t(!1)}b&&b(q()),K(O),R(null),P(null),j(null),I(),_(L()),i.clear(),o?.clear(),u?.clear(),g&&g(e=>{let t={};for(let[n,r]of Object.entries(e.tasks)){if(!A(r)){t[n]=r;continue}try{r.status===`running`&&(T(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){B(e)}s(n)}return{...e,tasks:t,attribution:w(),standaloneAgentContext:void 0,fileHistory:{snapshots:[],trackedFiles:new Set,snapshotSequence:0},mcp:{clients:[],tools:[],commands:[],resources:{},pluginReconnectKey:e.mcp.pluginReconnectKey}}}),l(),m(),N({setCurrentAsParent:!0}),await v();for(let e of k)e.status===`running`&&n(e.id,y(C(e.agentId)));let{saveMode:F}=(a(),e(h));F(`normal`);let z=c();z&&x(z);let V=await r(`clear`);V.length>0&&t(()=>V)}var $=t((()=>{X(),F(),V(),i(),S(),g(),p(),k(),z(),o(),D(),A(),a(),b(),u(),G()}));export{$ as n,Q as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./conversation-D5Nbu9eT.js";e();export{t as clearConversation};
@@ -1,6 +1,6 @@
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-BdqxZ7rV.js";import{l as s,u as c}from"./oauth-C9VBDB0Y.js";import{Bt as l,Ot as u}from"./model-C2e73CJD.js";import{i as d,t as f}from"./cliLaunch-BWWOgBFh.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
- `);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
- `);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
- `).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(`
5
- `));if(m.exitCode!==0)throw Error(`Failed to install wrapper script: ${m.stderr}`);o?.(`Verifying installation...`);let h=await I(t,`${N}/${F} --version`);if(h.exitCode!==0)throw Error(`Binary deployed but verification failed (exit ${h.exitCode}): ${h.stderr}`);return a(`[SSHDeploy] deployed successfully, remote version: ${h.stdout}`),o?.(`Deployed v${h.stdout}`),`${N}/${F}`}d(),i(),r();var z=3e4,B=20,V=class extends Error{constructor(e){super(e),this.name=`SSHSessionError`}};async function H(e,t){let{host:n,localVersion:r,extraCliArgs:i,remoteBin:o}=e,s=t?.onProgress,c,l=`/`;if(o){s?.(`Using custom remote binary, skipping probe/deploy…`),c=o,a(`[SSH] custom remoteBin: ${o}`);try{let e=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=5`,n,`pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`ignore`});await e.exited;let t=(await new Response(e.stdout).text()).trim();t.startsWith(`/`)&&(l=t)}catch{}}else{let e=await j(n,s);a(`[SSH] probe result: ${JSON.stringify(e)}`),l=e.defaultCwd,c=e.binaryPath??`~/.local/bin/claude`,(!e.hasBinary||e.remoteVersion!==r)&&(s?.(e.hasBinary?`Updating remote binary (${e.remoteVersion} → ${r})…`:`Deploying binary to remote…`),c=await R({host:n,remotePlatform:e.remotePlatform,remoteArch:e.remoteArch,localVersion:r,onProgress:s}))}let{proxy:u,localAddress:d,authEnv:f}=await E();a(`[SSH] auth proxy listening on ${d}`);let p=g().slice(0,8),m=process.platform===`win32`,h=[];for(let[e,t]of Object.entries(f))h.push(`${e}=${t}`);h.push(c,`--output-format`,`stream-json`,`--input-format`,`stream-json`,`--verbose`,`-p`),e.cwd&&h.push(`--cwd`,e.cwd),e.permissionMode&&h.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&h.push(`--dangerously-skip-permissions`),h.push(...i);let _=[`ssh`];if(m){let e=d.split(`:`)[1],t=1e4+Math.floor(Math.random()*5e4);_.push(`-R`,`${t}:127.0.0.1:${e}`);let n=h.findIndex(e=>e.startsWith(`ANTHROPIC_BASE_URL=`));n!==-1&&(h[n]=`ANTHROPIC_BASE_URL=http://127.0.0.1:${t}`)}else{let e=`/tmp/claude-ssh-auth-${p}.sock`;_.push(`-R`,`${e}:${d}`),_.push(`-o`,`StreamLocalBindUnlink=yes`);let t=h.indexOf(`ANTHROPIC_AUTH_SOCKET=${f.ANTHROPIC_AUTH_SOCKET}`);t!==-1&&(h[t]=`ANTHROPIC_AUTH_SOCKET=${e}`)}_.push(n,h.join(` `)),s?.(`Starting remote session…`),a(`[SSH] spawning: ${_.join(` `)}`);let v;try{v=Bun.spawn(_,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`})}catch(e){throw u.stop(),new V(`Failed to spawn SSH process: ${e instanceof Error?e.message:String(e)}`)}let y=[];G(v,y);let b;if(o){let t=await Promise.race([v.exited.then(e=>e),new Promise(e=>setTimeout(()=>e(null),3e3))]);if(t!==null){u.stop();let e=y.join(``).trim();throw new V(`Remote process exited immediately (code ${t})${e?`: ${e}`:``}`)}b=e.cwd||l||`/`}else try{b=await W(v,e.cwd||l)}catch(e){throw u.stop(),v.kill(),e}a(`[SSH] remote session initialized, remoteCwd=${b}`);let S=v,C=async()=>{a(`[SSH] reconnect: re-spawning SSH process with --continue`);let e=[..._],t=e.length-1,n=e[t];n.includes(`--continue`)||(e[t]=n.replace(/ -p(?:\s|$)/,` -p --continue `));let r=Bun.spawn(e,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`}),i=[];return G(r,i),await W(r,b),S=r,y.length=0,y.push(...i),r};return{remoteCwd:b,get proc(){return S},proxy:u,createManager(e){return new x(S,{...e,reconnect:C})},getStderrTail(){return y.slice(-20).join(``)}}}async function U(e){let{proxy:t,authEnv:n}=await E(),r=[`--output-format`,`stream-json`,`--input-format`,`stream-json`,`-p`];e.cwd&&r.push(`--cwd`,e.cwd),e.permissionMode&&r.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&r.push(`--dangerously-skip-permissions`);let i=f(r),o;try{o=Bun.spawn([i.execPath,...i.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...i.env,...n}})}catch(e){throw t.stop(),new V(`Failed to spawn local CLI process: ${e instanceof Error?e.message:String(e)}`)}a(`[SSH] local session spawned, waiting for init message...`);let s=[];G(o,s);let c;try{c=await W(o,e.cwd)}catch(e){throw t.stop(),o.kill(),e}a(`[SSH] local session initialized, remoteCwd=${c}`);let l=o,u=async()=>{a(`[SSH] local reconnect: re-spawning CLI with --continue`);let e=[...r];e.includes(`--continue`)||e.push(`--continue`);let t=f(e),i=Bun.spawn([t.execPath,...t.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...t.env,...n}}),o=[];return G(i,o),await W(i,c),l=i,s.length=0,s.push(...o),i};return{remoteCwd:c,get proc(){return l},proxy:t,createManager(e){return new x(l,{...e,reconnect:u})},getStderrTail(){return s.slice(-20).join(``)}}}async function W(e,t){let r=e.stdout;if(!r)throw new V(`Child process stdout is not readable`);let i=r.getReader(),a=new TextDecoder,o=``,s=Date.now()+z;try{for(;Date.now()<s;){let e=s-Date.now(),r=await Promise.race([i.read(),new Promise((t,n)=>setTimeout(()=>n(new V(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)),e))]);if(r.done)throw new V(`Child process exited before sending init message`);o+=a.decode(r.value,{stream:!0});let c=o.split(`
6
- `);o=c.pop()??``;for(let e of c){let r=e.trim();if(r)try{let e=n(r);if(e.type===`system`&&e.subtype===`init`)return i.releaseLock(),e.cwd||t||process.cwd()}catch{}}}}catch(e){throw i.releaseLock(),e instanceof V?e:new V(`Error reading init message: ${e instanceof Error?e.message:String(e)}`)}throw i.releaseLock(),new V(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)}function G(e,t){let n=e.stderr;if(!n)return;let r=n.getReader(),i=new TextDecoder;(async()=>{try{for(;;){let{done:e,value:n}=await r.read();if(e)break;t.push(i.decode(n,{stream:!0})),t.length>B*2&&t.splice(0,t.length-B)}}catch{}})()}export{V as SSHSessionError,U as createLocalSSHSession,H as createSSHSession};
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{C as n,S as r,c as i,i as a,x as o}from"./debug-BecbSVoN.js";import{l as s,u as c}from"./oauth-C9VBDB0Y.js";import{Bt as l,Ot as u}from"./model-Bgh_r4lg.js";import{i as d,t as f}from"./cliLaunch-BTpfAGGI.js";import{resolve as p}from"path";import{existsSync as m,unlinkSync as h}from"fs";import{randomUUID as g}from"crypto";a(),o(),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
+ `);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){i(`[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=r(e)}catch{return}if(!_(t))return;let n=t;if(n.type===`control_request`){let e=n;e.request.subtype===`can_use_tool`?this.options.onPermissionRequest(e.request,e.request_id):(i(`[SSH] Unsupported control request subtype: ${e.request.subtype}`),this.sendErrorResponse(e.request_id,`Unsupported control request subtype: ${e.request.subtype}`));return}n.type!==`control_response`&&n.type!==`keep_alive`&&n.type!==`control_cancel_request`&&n.type!==`streamlined_text`&&n.type!==`streamlined_tool_use_summary`&&!(n.type===`system`&&n.subtype===`post_turn_summary`)&&this.options.onMessage(n)}writeToStdin(e){try{let t=this.proc.stdin;if(!t||typeof t==`number`||this.disconnected)return!1;let n=new TextEncoder().encode(e+`
3
+ `);return t.write(n),t.flush?.(),!0}catch{return!1}}async sendMessage(e){let t=n({type:`user`,message:{role:`user`,content:e},parent_tool_use_id:null,session_id:``});return this.writeToStdin(t)}sendInterrupt(){let e=n({type:`control_request`,request_id:crypto.randomUUID(),request:{subtype:`interrupt`}});this.writeToStdin(e)}respondToPermissionRequest(e,t){let r=n({type:`control_response`,response:{subtype:`success`,request_id:e,response:{behavior:t.behavior,...t.behavior===`allow`?{updatedInput:t.updatedInput}:{message:t.message}}}});this.writeToStdin(r)}sendErrorResponse(e,t){let r=n({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}});this.writeToStdin(r)}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(),a();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),a=`${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`),i(`[SSHAuthProxy] ${e.method} ${r.pathname} -> ${a}`);try{let t=await fetch(a,{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 i(`[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 i(`[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 i(`[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}}}a();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))]),a=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=a.split(`
4
+ `).map(e=>e.trim()).filter(Boolean);i(`[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}}a();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:a,onProgress:o}=e;if(n!==`linux`&&n!==`darwin`)throw Error(`Remote platform "${n}" is not supported. Only linux and darwin are supported.`);i(`[SSHDeploy] deploying to ${t} (${n}/${r}, v${a})`);let s=L();i(`[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(`
5
+ `));if(m.exitCode!==0)throw Error(`Failed to install wrapper script: ${m.stderr}`);o?.(`Verifying installation...`);let h=await I(t,`${N}/${F} --version`);if(h.exitCode!==0)throw Error(`Binary deployed but verification failed (exit ${h.exitCode}): ${h.stderr}`);return i(`[SSHDeploy] deployed successfully, remote version: ${h.stdout}`),o?.(`Deployed v${h.stdout}`),`${N}/${F}`}d(),a(),o();var z=3e4,B=20,V=class extends Error{constructor(e){super(e),this.name=`SSHSessionError`}};async function H(e,t){let{host:n,localVersion:r,extraCliArgs:a,remoteBin:o}=e,s=t?.onProgress,c,l=`/`;if(o){s?.(`Using custom remote binary, skipping probe/deploy…`),c=o,i(`[SSH] custom remoteBin: ${o}`);try{let e=Bun.spawn([`ssh`,`-o`,`BatchMode=yes`,`-o`,`ConnectTimeout=5`,n,`pwd`],{stdin:`ignore`,stdout:`pipe`,stderr:`ignore`});await e.exited;let t=(await new Response(e.stdout).text()).trim();t.startsWith(`/`)&&(l=t)}catch{}}else{let e=await j(n,s);i(`[SSH] probe result: ${JSON.stringify(e)}`),l=e.defaultCwd,c=e.binaryPath??`~/.local/bin/claude`,(!e.hasBinary||e.remoteVersion!==r)&&(s?.(e.hasBinary?`Updating remote binary (${e.remoteVersion} → ${r})…`:`Deploying binary to remote…`),c=await R({host:n,remotePlatform:e.remotePlatform,remoteArch:e.remoteArch,localVersion:r,onProgress:s}))}let{proxy:u,localAddress:d,authEnv:f}=await E();i(`[SSH] auth proxy listening on ${d}`);let p=g().slice(0,8),m=process.platform===`win32`,h=[];for(let[e,t]of Object.entries(f))h.push(`${e}=${t}`);h.push(c,`--output-format`,`stream-json`,`--input-format`,`stream-json`,`--verbose`,`-p`),e.cwd&&h.push(`--cwd`,e.cwd),e.permissionMode&&h.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&h.push(`--dangerously-skip-permissions`),h.push(...a);let _=[`ssh`];if(m){let e=d.split(`:`)[1],t=1e4+Math.floor(Math.random()*5e4);_.push(`-R`,`${t}:127.0.0.1:${e}`);let n=h.findIndex(e=>e.startsWith(`ANTHROPIC_BASE_URL=`));n!==-1&&(h[n]=`ANTHROPIC_BASE_URL=http://127.0.0.1:${t}`)}else{let e=`/tmp/claude-ssh-auth-${p}.sock`;_.push(`-R`,`${e}:${d}`),_.push(`-o`,`StreamLocalBindUnlink=yes`);let t=h.indexOf(`ANTHROPIC_AUTH_SOCKET=${f.ANTHROPIC_AUTH_SOCKET}`);t!==-1&&(h[t]=`ANTHROPIC_AUTH_SOCKET=${e}`)}_.push(n,h.join(` `)),s?.(`Starting remote session…`),i(`[SSH] spawning: ${_.join(` `)}`);let v;try{v=Bun.spawn(_,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`})}catch(e){throw u.stop(),new V(`Failed to spawn SSH process: ${e instanceof Error?e.message:String(e)}`)}let y=[];G(v,y);let b;if(o){let t=await Promise.race([v.exited.then(e=>e),new Promise(e=>setTimeout(()=>e(null),3e3))]);if(t!==null){u.stop();let e=y.join(``).trim();throw new V(`Remote process exited immediately (code ${t})${e?`: ${e}`:``}`)}b=e.cwd||l||`/`}else try{b=await W(v,e.cwd||l)}catch(e){throw u.stop(),v.kill(),e}i(`[SSH] remote session initialized, remoteCwd=${b}`);let S=v,C=async()=>{i(`[SSH] reconnect: re-spawning SSH process with --continue`);let e=[..._],t=e.length-1,n=e[t];n.includes(`--continue`)||(e[t]=n.replace(/ -p(?:\s|$)/,` -p --continue `));let r=Bun.spawn(e,{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`}),a=[];return G(r,a),await W(r,b),S=r,y.length=0,y.push(...a),r};return{remoteCwd:b,get proc(){return S},proxy:u,createManager(e){return new x(S,{...e,reconnect:C})},getStderrTail(){return y.slice(-20).join(``)}}}async function U(e){let{proxy:t,authEnv:n}=await E(),r=[`--output-format`,`stream-json`,`--input-format`,`stream-json`,`-p`];e.cwd&&r.push(`--cwd`,e.cwd),e.permissionMode&&r.push(`--permission-mode`,e.permissionMode),e.dangerouslySkipPermissions&&r.push(`--dangerously-skip-permissions`);let a=f(r),o;try{o=Bun.spawn([a.execPath,...a.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...a.env,...n}})}catch(e){throw t.stop(),new V(`Failed to spawn local CLI process: ${e instanceof Error?e.message:String(e)}`)}i(`[SSH] local session spawned, waiting for init message...`);let s=[];G(o,s);let c;try{c=await W(o,e.cwd)}catch(e){throw t.stop(),o.kill(),e}i(`[SSH] local session initialized, remoteCwd=${c}`);let l=o,u=async()=>{i(`[SSH] local reconnect: re-spawning CLI with --continue`);let e=[...r];e.includes(`--continue`)||e.push(`--continue`);let t=f(e),a=Bun.spawn([t.execPath,...t.args],{stdin:`pipe`,stdout:`pipe`,stderr:`pipe`,env:{...t.env,...n}}),o=[];return G(a,o),await W(a,c),l=a,s.length=0,s.push(...o),a};return{remoteCwd:c,get proc(){return l},proxy:t,createManager(e){return new x(l,{...e,reconnect:u})},getStderrTail(){return s.slice(-20).join(``)}}}async function W(e,t){let n=e.stdout;if(!n)throw new V(`Child process stdout is not readable`);let i=n.getReader(),a=new TextDecoder,o=``,s=Date.now()+z;try{for(;Date.now()<s;){let e=s-Date.now(),n=await Promise.race([i.read(),new Promise((t,n)=>setTimeout(()=>n(new V(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)),e))]);if(n.done)throw new V(`Child process exited before sending init message`);o+=a.decode(n.value,{stream:!0});let c=o.split(`
6
+ `);o=c.pop()??``;for(let e of c){let n=e.trim();if(n)try{let e=r(n);if(e.type===`system`&&e.subtype===`init`)return i.releaseLock(),e.cwd||t||process.cwd()}catch{}}}}catch(e){throw i.releaseLock(),e instanceof V?e:new V(`Error reading init message: ${e instanceof Error?e.message:String(e)}`)}throw i.releaseLock(),new V(`Remote CLI did not initialize within 30 seconds. Check SSH connectivity and remote binary.`)}function G(e,t){let n=e.stderr;if(!n)return;let r=n.getReader(),i=new TextDecoder;(async()=>{try{for(;;){let{done:e,value:n}=await r.read();if(e)break;t.push(i.decode(n,{stream:!0})),t.length>B*2&&t.splice(0,t.length-B)}}catch{}})()}export{V as SSHSessionError,U as createLocalSSHSession,H as createSSHSession};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./createSession-DRqkLZWt.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{P as t,R as n,c as r,i}from"./debug-BecbSVoN.js";import{i as a,t as o}from"./sessionIdCompat-DMayYBrf.js";import{i as s,o as c}from"./debugUtils-CmJfIUxW.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-DN1MUpB8.js`),{getOrganizationUUID:p}=await import(`./client-CJE6gEvU.js`),{getOauthConfig:m}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:h}=await import(`./api-DS1MiW01.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DDfLfKcM.js`),{getDefaultBranch:_}=await import(`./git-DF4RFFaT.js`),{getMainLoopModel:v}=await import(`./model-B7rtZ7KV.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-CzRUPn-D.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-DDfLfKcM.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-DN1MUpB8.js`),{getOrganizationUUID:a}=await import(`./client-CJE6gEvU.js`),{getOauthConfig:o}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:c}=await import(`./api-DS1MiW01.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-CzRUPn-D.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-DN1MUpB8.js`),{getOrganizationUUID:i}=await import(`./client-CJE6gEvU.js`),{getOauthConfig:a}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:o}=await import(`./api-DS1MiW01.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-CzRUPn-D.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:o}=await import(`./auth-DN1MUpB8.js`),{getOrganizationUUID:c}=await import(`./client-CJE6gEvU.js`),{getOauthConfig:l}=await import(`./oauth-BN2I0_jl.js`),{getOAuthHeaders:u}=await import(`./api-DS1MiW01.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-CzRUPn-D.js`),p=i?.getAccessToken?.()??o()?.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=a(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((()=>{i(),n(),c(),o()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -0,0 +1,40 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$c as n,Cr as r,Dr as i,Ei as a,Fp as o,GC as s,Gu as c,Ir as l,Iu as u,Pp as d,Pu as f,TT as ee,Ti as te,Tr as ne,Wu as re,ZC as p,dd as ie,ed as ae,hr as m,li as h,sr as oe,td as se,tl as g,ud as ce,wT as le}from"./loadAgentsDir-BL93ulMm.js";import{C as ue,D as _,Gr as v,H as de,I as y,P as b,T as x,Wt as fe,Xn as pe,ai as me,di as S,fi as C,hn as he,k as ge,ot as _e,p as ve,t as w,ui as ye}from"./src-P_wYS_NJ2.js";import{t as T}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as be,et as xe,pt as Se}from"./state-BemZdQIl.js";import{S as E,c as D,i as Ce,x as we}from"./debug-BecbSVoN.js";import{Ln as O,Rn as Te}from"./settings-D4CpDv2y.js";import{i as Ee,m as De}from"./git-DBlOv64X.js";import{a as k,o as Oe,s as ke}from"./log-Dauqle-Z.js";import{n as Ae,r as A}from"./analytics-DJobLaWP.js";import{C as j,d as je,m as Me,v as Ne}from"./startupProfiler-CmH_aVy2.js";import{_ as M,h as N}from"./model-Bgh_r4lg.js";import{i as Pe,r as Fe}from"./shellQuote-DS6WrivY.js";import{n as Ie,t as Le}from"./useExitOnCtrlCDWithKeybindings-DEEJhm_W.js";import{t as Re}from"./SearchBox-C9vUA4IM.js";import{n as ze,t as Be}from"./useSearchInput-gUDbkLaC.js";import{n as P,t as F}from"./Messages-qqwHuAW5.js";function Ve({log:e,onExit:t,onSelect:r}){let[a,o]=I.useState(null);I.useEffect(()=>{o(null),i(e)&&l(e).then(o)},[e]);let s=i(e)&&a===null,c=a??e,u=m(c)||``,f=n();return fe(`confirm:no`,t,{context:`Confirmation`}),fe(`confirm:yes`,(0,I.useCallback)(()=>{r(a??e)},[r,a,e]),{context:`Confirmation`}),s?(0,L.jsxs)(y,{flexDirection:`column`,padding:1,children:[(0,L.jsx)(ve,{message:`Loading session…`}),(0,L.jsx)(b,{dimColor:!0,children:(0,L.jsx)(x,{children:(0,L.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,L.jsxs)(y,{flexDirection:`column`,children:[(0,L.jsx)(F,{messages:c.messages,tools:f,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:u,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,L.jsxs)(y,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,L.jsxs)(b,{children:[Me(c.modified),` · `,c.messageCount,` messages`,c.gitBranch?` · ${c.gitBranch}`:``]}),(0,L.jsx)(b,{dimColor:!0,children:(0,L.jsxs)(x,{children:[(0,L.jsx)(_,{shortcut:`Enter`,action:`resume`}),(0,L.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var I,L,He=e((()=>{I=t(C(),1),w(),s(),g(),Ne(),r(),o(),P(),L=T()}));function R(e,t){if(e===B)return 5;let n=v(e),r=t?Math.min(n,t-V-H):n;return Math.max(0,r)+V+H}function Ue(e,t){let n=t-V-H;return v(e)<=n?e:n<=1?e.charAt(0):j(e,n)}function We({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(Ye,W),s=n-a-o-2,c=Math.max(0,Math.min(t,e.length-1)),l=Math.max(20,Math.floor(s/2)),u=e.map(e=>R(e,l)),d=0,f=e.length;if(u.reduce((e,t,n)=>e+t+ +(n<u.length-1),0)>s){let t=s-Je,n=u[c]??0;for(d=c,f=c+1;d>0||f<e.length;){let r=d>0,i=f<e.length;if(r){let e=(u[d-1]??0)+1;if(n+e<=t){d--,n+=e;continue}}if(i){let e=(u[f]??0)+1;if(n+e<=t){f++,n+=e;continue}}break}}let ee=d,te=e.length-f,ne=e.slice(d,f),re=ne.map((e,t)=>d+t);return(0,z.jsxs)(y,{flexDirection:`row`,gap:1,children:[(0,z.jsx)(b,{color:`suggestion`,children:i}),ee>0&&(0,z.jsxs)(b,{dimColor:!0,children:[U,ee]}),ne.map((e,t)=>{let n=re[t]===c,r=e===B?e:`#${Ue(e,l-V)}`;return(0,z.jsxs)(b,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),te>0?(0,z.jsxs)(b,{dimColor:!0,children:[Ge,te,Ke]}):(0,z.jsx)(b,{dimColor:!0,children:qe})]})}var z,B,V,H,U,Ge,Ke,qe,Je,Ye,W,G=e((()=>{C(),w(),Ne(),z=T(),B=`All`,V=2,H=1,U=`← `,Ge=`→`,Ke=` (tab to cycle)`,qe=`(tab to cycle)`,Je=5,Ye=18,W=14}));function Xe({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:c=!1,isNodeExpanded:l,onExpand:u,onCollapse:d,getParentPrefix:f,getChildPrefix:ee,onUpFromFirstItem:te}){let[ne,re]=K.useState(new Set),p=K.useRef(!1),ie=K.useRef(null),m=K.useCallback(e=>l?l(e):ne.has(e),[l,ne]),h=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=m(e.id);if(t.push({node:e,depth:r,isExpanded:o,hasChildren:a,parentId:i}),a&&o&&e.children)for(let t of e.children)n(t,r+1,e.id)}for(let t of e)n(t,0);return t},[e,m]),oe=K.useCallback(e=>e?`▼ `:`▶ `,[]),se=K.useCallback(e=>` ▸ `,[]),g=f??oe,ce=ee??se,le=K.useCallback(e=>{let t=``;return e.hasChildren?t=g(e.isExpanded):e.depth>0&&(t=ce(e.depth)),t+e.node.label},[g,ce]),ue=K.useMemo(()=>h.map(e=>({label:le(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[h,le]),_=K.useMemo(()=>{let e=new Map;return h.forEach(t=>e.set(t.node.id,t.node)),e},[h]),v=K.useCallback(e=>h.find(t=>t.node.id===e),[h]),de=K.useCallback((e,t)=>{let n=v(e);!n||!n.hasChildren||(t?u?u(e):re(t=>new Set(t).add(e)):d?d(e):re(t=>{let n=new Set(t);return n.delete(e),n}))},[v,u,d]);return(0,Ze.jsx)(y,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=v(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),de(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),de(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),p.current=!0,de(t.parentId,!1),r)){let e=_.get(t.parentId);e&&r(e)}}}},children:(0,Ze.jsx)(ae,{options:ue,onChange:K.useCallback(e=>{let n=_.get(e);n&&t(n)},[_,t]),onFocus:K.useCallback(e=>{if(p.current){p.current=!1;return}if(ie.current!==e&&(ie.current=e,r)){let t=_.get(e);t&&r(t)}},[r,_]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:c,onUpFromFirstItem:te})})}var K,Ze,Qe=e((()=>{K=t(C(),1),w(),se(),Ze=T()}));function $e(e,t){return j(e.replace(/\s+/g,` `).trim(),t)}function et({before:e,match:t,after:n},r){return ye.dim(e)+r(t)+ye.dim(n)}function tt(e,t,n){let r=e.toLowerCase().indexOf(t.toLowerCase());if(r===-1)return null;let i=r+t.length,a=Math.max(0,r-n),o=Math.min(e.length,i+n),s=e.slice(a,r),c=e.slice(r,i),l=e.slice(i,o);return{before:(a>0?`…`:``)+s.replace(/\s+/g,` `).trimStart(),match:c.trim(),after:l.replace(/\s+/g,` `).trimEnd()+(o<e.length?`…`:``)}}function nt(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?lt:i?ut:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${$e(k(e),l)}${c}${s}`}function rt(e,t){let{isChild:n=!1,showProjectPath:r=!1}=t||{},i=n?` `:``,a=je(e),o=r&&e.projectPath?` · ${e.projectPath}`:``;return i+a+o}function it({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:r,onSelect:i,onLogsChanged:a,onLoadMore:o,initialSearchQuery:s,showAllProjects:c=!1,onToggleAllProjects:l,onAgenticSearch:u}){let ee=_e(),p=n===void 0?ee.columns:n,ie=Ie(r),se=pe(),g=ne(),[le]=de(),v=re(le),S=q.useMemo(()=>e=>me(e,v.warning),[v.warning]),[C,ve]=q.useState(null),[w,ye]=q.useState(!1),[T,be]=q.useState(!1),[E,D]=q.useState(!1),Ce=q.useMemo(()=>xe(),[]),[we,O]=q.useState(``),[Te,De]=q.useState(0),[Oe,ke]=q.useState(new Set),[Ae,j]=q.useState(null),[Me,Ne]=q.useState(1),[M,N]=q.useState(`list`),[Pe,Fe]=q.useState(null),Le=q.useRef(null),[Re,Be]=q.useState(0),[P,F]=q.useState({status:`idle`}),[I,L]=q.useState(!1),He=q.useRef(null),{query:R,setQuery:Ue,cursorOffset:z}=ze({isActive:M===`search`&&P.status!==`searching`,onExit:()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:s||``}),B=q.useDeferredValue(R),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,Ge]=q.useState(null),[Ke,qe]=q.useState(!1);q.useEffect(()=>{Ee().then(e=>ve(e)),te(Ce).then(e=>{D(e.length>1)})},[Ce]);let Je=q.useMemo(()=>new Map(e.map(e=>[e,ot(e)])),[e]),Ye=q.useMemo(()=>null,[e,Je,!1]),W=q.useMemo(()=>ct(e),[e]),G=W.length>0,K=q.useMemo(()=>G?[`All`,...W]:[],[G,W]),Ze=K.length>0&&Re<K.length?Re:0,Qe=K[Ze],it=Qe===`All`?void 0:Qe,at=+!!G,lt=q.useMemo(()=>{let t=e;return g&&(t=e.filter(e=>{let t=Se(),n=m(e);return!!(t&&n===t||e.customTitle||oe(e.messages)||e.firstPrompt||e.customTitle)})),it!==void 0&&(t=t.filter(e=>e.tag===it)),w&&C&&(t=t.filter(e=>e.gitBranch===C)),E&&!T&&(t=t.filter(e=>e.projectPath===Ce)),t},[e,g,it,w,C,E,T,Ce]),ut=q.useMemo(()=>{if(!R)return lt;let e=R.toLowerCase();return lt.filter(t=>{let n=k(t).toLowerCase(),r=(t.gitBranch||``).toLowerCase(),i=(t.tag||``).toLowerCase(),a=t.prNumber?`pr #${t.prNumber} ${t.prRepository||``}`.toLowerCase():``;return n.includes(e)||r.includes(e)||i.includes(e)||a.includes(e)})},[lt,R]);q.useEffect(()=>{},[B,V,!1]),q.useEffect(()=>{Ge(null),qe(!1)},[V,Ye,!1]);let{filteredLogs:Y,snippets:X}=q.useMemo(()=>{let e=new Map,t=ut;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=tt(t.searchableText,V,dt);n&&e.set(t.log,n)}let n=new Set(t.map(e=>e.messages[0]?.uuid)),r=U.results.map(e=>e.log).filter(e=>!n.has(e.messages[0]?.uuid));t=[...t,...r]}return{filteredLogs:t,snippets:e}},[ut,U,V]),Z=q.useMemo(()=>P.status===`results`&&P.results.length>0?P.results:Y,[P,Y]),Q=Math.max(30,p-4),ft=q.useMemo(()=>{if(!g)return[];let e=st(Z);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=Z.indexOf(n),i=X.get(n),a=i?et(i,S):null;if(t.length===1){let t=rt(n,{showProjectPath:c});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:nt(n,Q),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=Z.indexOf(t),i=X.get(t),a=i?et(i,S):null,o=rt(t,{isChild:!0,showProjectPath:c});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:nt(t,Q,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),l=rt(n,{showProjectPath:c});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:nt(n,Q,{isGroupHeader:!0,forkCount:o}),description:a?`${l}\n ${a}`:l,dimDescription:!0,children:s}})},[g,Z,Q,c,X,S]),pt=q.useMemo(()=>g?[]:Z.map((e,t)=>{let n=$e(k(e)+(e.isSidechain?` (sidechain)`:``),Q),r=je(e),i=c&&e.projectPath?` · ${e.projectPath}`:``,a=X.get(e),o=a?et(a,S):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[g,Z,S,Q,c,X]),$=Ae?.value.log??null,mt=()=>{if(!g||!$)return``;let e=m($);if(!e)return``;let t=Z.filter(t=>m(t)===e);if(!(t.length>1))return``;let n=Oe.has(e);return t.indexOf($)>0||n?`← to collapse`:`→ to expand`},ht=q.useCallback(async()=>{let e=$?m($):void 0;if(!$||!e){N(`list`),O(``);return}we.trim()&&(await h(e,we.trim(),$.fullPath),g&&a&&a()),N(`list`),O(``)},[$,we,a,g]),gt=q.useCallback(()=>{N(`list`),A(`tengu_session_search_toggled`,{enabled:!1})},[]),_t=q.useCallback(()=>{N(`search`),A(`tengu_session_search_toggled`,{enabled:!0})},[]),vt=q.useCallback(async()=>{if(!R.trim()||!u||!0)return;He.current?.abort();let t=new AbortController;He.current=t,F({status:`searching`}),A(`tengu_agentic_search_started`,{query_length:R.length});try{let n=await u(R,e,t.signal);if(t.signal.aborted)return;F({status:`results`,results:n,query:R}),A(`tengu_agentic_search_completed`,{query_length:R.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;F({status:`error`,message:e instanceof Error?e.message:`Search failed`}),A(`tengu_agentic_search_error`,{query_length:R.length})}},[R,u,!1,e]);q.useEffect(()=>{P.status!==`idle`&&P.status!==`searching`&&(P.status===`results`&&P.query!==R||P.status===`error`)&&F({status:`idle`})},[R,P]),q.useEffect(()=>()=>{He.current?.abort()},[]);let yt=q.useRef(P.status);q.useEffect(()=>{let e=yt.current;if(yt.current=P.status,e===`searching`&&P.status===`results`){if(g&&ft.length>0)j(ft[0]);else if(!g&&Z.length>0){let e=Z[0];j({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[P.status,g,ft,Z]);let bt=q.useCallback(e=>{let t=parseInt(e,10),n=Z[t];!n||Le.current===t.toString()||(Le.current=t.toString(),j({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Ne(t+1))},[Z]),xt=q.useCallback(e=>{j(e);let t=Z.findIndex(t=>m(t)===m(e.value.log));t>=0&&Ne(t+1)},[Z]);fe(`confirm:no`,()=>{He.current?.abort(),F({status:`idle`}),A(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:M!==`preview`&&P.status===`searching`}),fe(`confirm:no`,()=>{N(`list`),O(``)},{context:`Settings`,isActive:M===`rename`&&P.status!==`searching`}),fe(`confirm:no`,()=>{Ue(``),L(!1),r?.()},{context:`Confirmation`,isActive:M!==`preview`&&M!==`rename`&&M!==`search`&&I&&P.status!==`searching`}),he((e,t)=>{if(M!==`preview`&&P.status!==`searching`&&M!==`rename`)if(M===`search`)e.toLowerCase()===`n`&&t.ctrl?gt():(t.return||t.downArrow)&&R.trim();else{if(I){if(t.return){vt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){N(`search`),L(!1);return}}if(G&&t.tab){let e=t.shift?-1:1;Be(t=>{let n=((t<K.length?t:0)+K.length+e)%K.length,r=K[n];return A(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:W.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&l)l(),A(`tengu_session_all_projects_toggled`,{enabled:!c});else if(r===`b`&&t.ctrl){let e=!w;ye(e),A(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&E){let e=!T;be(e),A(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(N(`search`),A(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&$?(N(`rename`),O(``),A(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&$?(Fe($),N(`preview`),A(`tengu_session_preview_opened`,{messageCount:$.messageCount})):$&&n&&e.length>0&&!/^\s+$/.test(e)&&(N(`search`),Ue(e),A(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let St=[];w&&C&&St.push(C),E&&!T&&St.push(`current worktree`);let Ct=8+ +(St.length>0&&M!==`search`)+at,wt=Math.max(1,Math.floor((t-Ct-2)/3));return q.useEffect(()=>{if(!o)return;let e=wt*2;Me+e>=Z.length&&o(wt*3)},[Me,wt,Z.length,o]),e.length===0?null:M===`preview`&&Pe&&g?(0,J.jsx)(Ve,{log:Pe,onExit:()=>{N(`list`),Fe(null)},onSelect:i}):(0,J.jsxs)(y,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsx)(ue,{color:`suggestion`})}),(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsx)(b,{children:` `})}),G?(0,J.jsx)(We,{tabs:K,selectedIndex:Ze,availableWidth:p,showAllProjects:c}):(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsxs)(b,{bold:!0,color:`suggestion`,children:[`Resume Session`,M===`list`&&Z.length>wt&&(0,J.jsxs)(b,{dimColor:!0,children:[` `,`(`,Me,` of `,Z.length,`)`]})]})}),(0,J.jsx)(ge,{query:R,isFocused:M===`search`,isTerminalFocused:se,cursorOffset:z}),St.length>0&&M!==`search`&&(0,J.jsx)(y,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsx)(x,{children:St})})}),(0,J.jsx)(y,{flexShrink:0,children:(0,J.jsx)(b,{children:` `})}),P.status===`searching`&&(0,J.jsxs)(y,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(f,{}),(0,J.jsx)(b,{children:` Searching…`})]}),P.status===`results`&&P.results.length>0&&(0,J.jsx)(y,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(b,{dimColor:!0,italic:!0,children:`Claude found these results:`})}),P.status===`results`&&P.results.length===0&&Y.length===0&&(0,J.jsx)(y,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(b,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),P.status===`error`&&Y.length===0&&(0,J.jsx)(y,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(b,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!R.trim()&&u&&!1,P.status===`searching`?null:M===`rename`&&$?(0,J.jsxs)(y,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(b,{bold:!0,children:`Rename session:`}),(0,J.jsx)(y,{paddingTop:1,children:(0,J.jsx)(ce,{value:we,onChange:O,onSubmit:ht,placeholder:k($,`Enter new session name`),columns:p,cursorOffset:Te,onChangeCursorOffset:De,showCursor:!0})})]}):g?(0,J.jsx)(Xe,{nodes:ft,onSelect:e=>{i(e.value.log)},onFocus:xt,onCancel:r,focusNodeId:Ae?.id,visibleOptionCount:wt,layout:`expanded`,isDisabled:M===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(M===`search`||w)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?Oe.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(ke(e=>new Set(e).add(t)),A(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&ke(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:_t}):(0,J.jsx)(ae,{options:pt,onChange:e=>{let t=Z[parseInt(e,10)];t&&i(t)},visibleOptionCount:wt,onCancel:r,onFocus:bt,defaultFocusValue:Ae?.id.toString(),layout:`expanded`,isDisabled:M===`search`||I,onUpFromFirstItem:_t}),(0,J.jsx)(y,{paddingLeft:2,children:ie.pending?(0,J.jsxs)(b,{dimColor:!0,children:[`Press `,ie.keyName,` again to exit`]}):M===`rename`?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(_,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):P.status===`searching`?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(b,{children:`Searching with Claude…`}),(0,J.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(_,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(_,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):M===`search`?(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[(0,J.jsx)(b,{children:`Type to Search`}),(0,J.jsx)(_,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(b,{dimColor:!0,children:(0,J.jsxs)(x,{children:[l&&(0,J.jsx)(_,{shortcut:`Ctrl+A`,action:`show ${c?`current dir`:`all projects`}`}),C&&(0,J.jsx)(_,{shortcut:`Ctrl+B`,action:`toggle branch`}),E&&(0,J.jsx)(_,{shortcut:`Ctrl+W`,action:`show ${T?`current worktree`:`all worktrees`}`}),(0,J.jsx)(_,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(_,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(b,{children:`Type to search`}),(0,J.jsx)(d,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),mt()&&(0,J.jsx)(b,{children:mt()})]})})})]})}function at(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function ot(e){let t=(e.messages.length<=Y?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(at).filter(Boolean).join(` `),n=`${[e.customTitle,e.summary,e.firstPrompt,e.gitBranch,e.tag,e.prNumber?`PR #${e.prNumber}`:void 0,e.prRepository].filter(Boolean).join(` `)} ${t}`.trim();return n.length>Z?n.slice(0,Z):n}function st(e){let t=new Map;for(let n of e){let e=m(n);if(e){let r=t.get(e);r?r.push(n):t.set(e,[n])}}return t.forEach(e=>e.sort((e,t)=>new Date(t.modified).getTime()-new Date(e.modified).getTime())),t}function ct(e){let t=new Set;for(let n of e)n.tag&&t.add(n.tag);return Array.from(t).sort((e,t)=>e.localeCompare(t))}var q,J,lt,ut,Y,X,Z,dt,Q=e((()=>{S(),q=t(C(),1),be(),Le(),Be(),p(),w(),s(),Ae(),Ne(),a(),De(),Oe(),r(),c(),o(),se(),Re(),He(),u(),G(),ie(),Qe(),J=T(),lt=2,ut=4,Y=2e3,X=1e3,Z=5e4,dt=50}));function ft(e){if(e.type!==`user`&&e.type!==`assistant`)return``;let t=`message`in e?e.message?.content:void 0;return t?typeof t==`string`?t:Array.isArray(t)?t.map(e=>typeof e==`string`?e:`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(` `):``:``}function pt(e){if(e.length===0)return``;let t=(e.length<=gt?e:[...e.slice(0,gt/2),...e.slice(-100/2)]).map(ft).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>ht?t.slice(0,ht)+`…`:t}function $(e,t){return!!(k(e).toLowerCase().includes(t)||e.customTitle?.toLowerCase().includes(t)||e.tag?.toLowerCase().includes(t)||e.gitBranch?.toLowerCase().includes(t)||e.summary?.toLowerCase().includes(t)||e.firstPrompt?.toLowerCase().includes(t)||e.messages&&e.messages.length>0&&pt(e.messages).toLowerCase().includes(t))}async function mt(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),a=t.filter(e=>$(e,r)),o;if(a.length>=_t)o=a.slice(0,_t);else{let e=t.filter(e=>!$(e,r)),n=_t-a.length;o=[...a,...e.slice(0,n)]}D(`Agentic search: ${o.length}/${t.length} logs, query="${e}", matching: ${a.length}, with messages: ${O(o,e=>e.messages?.length>0)}`);let s=o.map(async e=>{if(i(e))try{return await l(e)}catch(t){return ke(t),e}return e}),c=await Promise.all(s);D(`Agentic search: loaded ${O(c,e=>e.messages?.length>0)}/${o.length} logs with transcripts`);let u=`Sessions:
2
+ ${c.map((e,t)=>{let n=[`${t}:`],r=k(e);if(n.push(r),e.customTitle&&e.customTitle!==r&&n.push(`[custom title: ${e.customTitle}]`),e.tag&&n.push(`[tag: ${e.tag}]`),e.gitBranch&&n.push(`[branch: ${e.gitBranch}]`),e.summary&&n.push(`- Summary: ${e.summary}`),e.firstPrompt&&e.firstPrompt!==`No prompt`&&n.push(`- First message: ${e.firstPrompt.slice(0,300)}`),e.messages&&e.messages.length>0){let t=pt(e.messages);t&&n.push(`- Transcript: ${t}`)}return n.join(` `)}).join(`
3
+ `)}
4
+
5
+ Search query: "${e}"
6
+
7
+ Find the sessions that are most relevant to this query.`;D(`Agentic search prompt (first 500 chars): ${u.slice(0,500)}...`);try{let e=N();D(`Agentic search using model: ${e}`);let t=(await ee({model:e,system:vt,messages:[{role:`user`,content:u}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(!t||t.type!==`text`)return D(`No text content in agentic search response`),[];D(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return D(`Could not find JSON in agentic search response`),[];let i=(E(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<c.length).map(e=>c[e]);return D(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return ke(e),D(`Agentic search error: ${e}`),[]}}var ht,gt,_t,vt,yt=e((()=>{Te(),Ce(),Oe(),M(),r(),le(),we(),ht=2e3,gt=100,_t=100,vt=`Your goal is to find relevant sessions based on a user's search query.
8
+
9
+ You will be given a list of sessions with their metadata and a search query. Identify which sessions are most relevant to the query.
10
+
11
+ Each session may include:
12
+ - Title (display name or custom title)
13
+ - Tag (user-assigned category, shown as [tag: name] - users tag sessions with /tag command to categorize them)
14
+ - Branch (git branch name, shown as [branch: name])
15
+ - Summary (AI-generated summary)
16
+ - First message (beginning of the conversation)
17
+ - Transcript (excerpt of conversation content)
18
+
19
+ IMPORTANT: Tags are user-assigned labels that indicate the session's topic or category. If the query matches a tag exactly or partially, those sessions should be highly prioritized.
20
+
21
+ For each session, consider (in order of priority):
22
+ 1. Exact tag matches (highest priority - user explicitly categorized this session)
23
+ 2. Partial tag matches or tag-related terms
24
+ 3. Title matches (custom titles or first message content)
25
+ 4. Branch name matches
26
+ 5. Summary and transcript content matches
27
+ 6. Semantic similarity and related concepts
28
+
29
+ CRITICAL: Be VERY inclusive in your matching. Include sessions that:
30
+ - Contain the query term anywhere in any field
31
+ - Are semantically related to the query (e.g., "testing" matches sessions about "tests", "unit tests", "QA", etc.)
32
+ - Discuss topics that could be related to the query
33
+ - Have transcripts that mention the concept even in passing
34
+
35
+ When in doubt, INCLUDE the session. It's better to return too many results than too few. The user can easily scan through results, but missing relevant sessions is frustrating.
36
+
37
+ Return sessions ordered by relevance (most relevant first). If truly no sessions have ANY connection to the query, return an empty array - but this should be rare.
38
+
39
+ Respond with ONLY the JSON object, no markdown formatting:
40
+ {"relevant_indices": [2, 5, 0]}`}));function bt(e,t){let n=xe();if(!t||!e.projectPath||e.projectPath===n)return{isCrossProject:!1};let r=m(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${Pe([e.projectPath])} && claude --resume ${r}`,projectPath:e.projectPath}}var xt=e((()=>{be(),Fe(),r()}));export{it as a,yt as i,xt as n,Q as o,mt as r,bt as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{O as t,Wt as n,et as r}from"./state-BemZdQIl.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??t()}function s(){try{return o()}catch{return r()}}var c,l=e((()=>{n(),c=new i}));export{a as i,l as n,o as r,s as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./cwd-Cfdf7z7s.js";e();export{t as getCwd};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{n as r,t as i}from"./axios-DaWTGg7G.js";import{d as a,h as o}from"./config-aRiTrtCv.js";import{o as s,s as c}from"./log-Dauqle-Z.js";import{W as l,_ as u,ai as d,r as f,si as p,z as m}from"./model-Bgh_r4lg.js";import{Z as h,et as g}from"./esm-Ka3lhafK.js";import{f as _,p as v}from"./firstPartyEventLogger-BHjBQH0J.js";import{createHash as y}from"crypto";function b(e){return e.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}async function x(){if(N.length===0)return;let e=N;N=[];try{await r.post(E,e,{headers:{"Content-Type":`application/json`,"DD-API-KEY":D},timeout:A})}catch(e){c(e)}}function S(){P||(P=setTimeout(()=>{P=null,x()},T()).unref())}async function C(){P&&(clearTimeout(P),P=null),await x()}async function w(e,t){if(d()!==`firstParty`)return;let n=F;if(n===null&&(n=await I()),!(!n||!j.has(e)))try{let{envContext:n,...r}=await h({model:t.model,betas:t.betas}),i={...r,...n,...t,userBucket:R()};if(typeof i.toolName==`string`&&i.toolName.startsWith(`mcp__`)&&(i.toolName=`mcp`),typeof i.model==`string`){let e=f(i.model.replace(/\[1m]$/i,``));i.model=e in m?e:`other`}if(typeof i.version==`string`&&(i.version=i.version.replace(/^(\d+\.\d+\.\d+-dev\.\d{8})\.t\d+\.sha[a-f0-9]+$/,`$1`)),i.status!==void 0&&i.status!==null){let e=String(i.status);i.http_status=e;let t=e.charAt(0);t>=`1`&&t<=`5`&&(i.http_status_range=`${t}xx`),delete i.status}let a=i,o={ddsource:`nodejs`,ddtags:[`event:${e}`,...M.filter(e=>a[e]!==void 0&&a[e]!==null).map(e=>`${b(e)}:${a[e]}`)].join(`,`),message:e,service:`claude-code`,hostname:`claude-code`,env:process.env.USER_TYPE};for(let[e,t]of Object.entries(i))t!=null&&(o[b(e)]=t);N.push(o),N.length>=k?(P&&(clearTimeout(P),P=null),x()):S()}catch(e){c(e)}}function T(){return parseInt(process.env.CLAUDE_CODE_DATADOG_FLUSH_INTERVAL_MS||``,10)||O}var E,D,O,k,A,j,M,N,P,F,I,L,R,z=e((()=>{i(),n(),o(),s(),u(),p(),l(),_(),g(),E=process.env.DATADOG_LOGS_ENDPOINT??``,D=process.env.DATADOG_API_KEY??``,O=15e3,k=100,A=5e3,j=new Set(`tengu_api_error.tengu_api_success.tengu_cancel.tengu_compact_failed.tengu_exit.tengu_flicker.tengu_init.tengu_model_fallback_triggered.tengu_oauth_error.tengu_oauth_success.tengu_oauth_token_refresh_failure.tengu_oauth_token_refresh_success.tengu_oauth_token_refresh_lock_acquiring.tengu_oauth_token_refresh_lock_acquired.tengu_oauth_token_refresh_starting.tengu_oauth_token_refresh_completed.tengu_oauth_token_refresh_lock_releasing.tengu_oauth_token_refresh_lock_released.tengu_query_error.tengu_session_file_read.tengu_started.tengu_tool_use_error.tengu_tool_use_granted_in_prompt_permanent.tengu_tool_use_granted_in_prompt_temporary.tengu_tool_use_rejected_in_prompt.tengu_tool_use_success.tengu_uncaught_exception.tengu_unhandled_rejection.tengu_voice_recording_started.tengu_voice_toggled.tengu_team_mem_sync_pull.tengu_team_mem_sync_push.tengu_team_mem_sync_started.tengu_team_mem_entries_capped`.split(`.`)),M=[`arch`,`clientType`,`errorType`,`http_status_range`,`http_status`,`model`,`platform`,`provider`,`skillMode`,`subscriptionType`,`toolName`,`userBucket`,`userType`,`version`,`versionBase`],N=[],P=null,F=null,I=t(async()=>{if(v()||!E||!D)return F=!1,!1;try{return F=!0,!0}catch(e){return c(e),F=!1,!1}}),L=30,R=t(()=>{let e=a(),t=y(`sha256`).update(e).digest(`hex`);return parseInt(t.slice(0,8),16)%L})}));export{C as n,w as r,z as t};