@readmagic/workmate 0.0.6 → 0.0.8

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 (556) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-CwLtQld4.js +1 -0
  2. package/dist/chunks/App-Ba52HvYC.js +1 -0
  3. package/dist/chunks/{ApproveApiKey-Bsy8kr2a.js → ApproveApiKey-CEIfuUh0.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-D2MLQu2P.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-IGDrkbWl.js +2 -0
  6. package/dist/chunks/{BypassPermissionsModeDialog-BKj_3Idm.js → BypassPermissionsModeDialog-GYhq--JR.js} +1 -1
  7. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BD-7yAZh.js → ClaudeMdExternalIncludesDialog-C-CTa-95.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-Catv6BCJ.js +1 -0
  9. package/dist/chunks/ConsoleOAuthFlow-BeQXqUtX.js +1 -0
  10. package/dist/chunks/{DiffDialog-C4XSSjvV.js → DiffDialog-AC5DSJrq.js} +6 -6
  11. package/dist/chunks/Doctor-B9Rxsoy0.js +1 -0
  12. package/dist/chunks/Doctor-lhUBhEy5.js +3 -0
  13. package/dist/chunks/{ExitFlow-BttnAv-O.js → ExitFlow-Cu8SoQHs.js} +2 -2
  14. package/dist/chunks/Grove-Bc4CofEj.js +11 -0
  15. package/dist/chunks/{HybridTransport-B8V6O6rM.js → HybridTransport-BJPOG2wl.js} +3 -3
  16. package/dist/chunks/{InvalidConfigDialog-CHzBSJDf.js → InvalidConfigDialog-BI13il58.js} +1 -1
  17. package/dist/chunks/{InvalidSettingsDialog-BKenH3bD.js → InvalidSettingsDialog-CtOheV1K.js} +1 -1
  18. package/dist/chunks/MCPConnectionManager-ao-P3xSA.js +1 -0
  19. package/dist/chunks/MCPToolListView-dkofcJs4.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-Bj2-YL8o.js → McpParsingWarnings-BS4JoR5l.js} +1 -1
  21. package/dist/chunks/MessageSelector-B88b2ypw.js +3 -0
  22. package/dist/chunks/Messages-BPeI7lLV.js +11 -0
  23. package/dist/chunks/Onboarding-c2fQ8Io_.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-egs9VvUs.js → PromptInputFooterSuggestions-D1cH9sDX.js} +1 -1
  25. package/dist/chunks/{PromptInputHelpMenu-SieM5NoY.js → PromptInputHelpMenu-DDD5WuK0.js} +1 -1
  26. package/dist/chunks/QueryEngine-Cv_meCam.js +1 -0
  27. package/dist/chunks/REPL-BXhAQOXb.js +139 -0
  28. package/dist/chunks/REPL-YqjLnr3A.js +1 -0
  29. package/dist/chunks/RemoteSessionManager-CT7T8BaR.js +2 -0
  30. package/dist/chunks/ResumeConversation-CIZCjms9.js +1 -0
  31. package/dist/chunks/{SSETransport-DtpMDekF.js → SSETransport-CrwbKuVt.js} +3 -3
  32. package/dist/chunks/SearchExtraToolsTool-Dx6093yw.js +1 -0
  33. package/dist/chunks/Settings-CyUm0AtU.js +2 -0
  34. package/dist/chunks/{TeleportProgress-rYaHIEfe.js → TeleportProgress-C3qyp5zy.js} +1 -1
  35. package/dist/chunks/TeleportRepoMismatchDialog-BV--nyYn.js +1 -0
  36. package/dist/chunks/TeleportResumeWrapper-Blo2cZg-.js +1 -0
  37. package/dist/chunks/ThemePicker-EQ6hPUeI.js +1 -0
  38. package/dist/chunks/TrustDialog-BukWGvHZ.js +1 -0
  39. package/dist/chunks/{ValidationErrorsList-B8pRiGuy.js → ValidationErrorsList-DokTJQwi.js} +1 -1
  40. package/dist/chunks/{WelcomeV2-DqnbSdIu.js → WelcomeV2-Ci9VwPYh.js} +1 -1
  41. package/dist/chunks/{add-dir-C2Hu3oE4.js → add-dir-DPQV0qml.js} +1 -1
  42. package/dist/chunks/{agentDisplay-XoDJhr03.js → agentDisplay-DBQYOaOh.js} +1 -1
  43. package/dist/chunks/agents-DmybpgDN.js +103 -0
  44. package/dist/chunks/{agents-C4QXeHIJ.js → agents-HlKk68Qc.js} +1 -1
  45. package/dist/chunks/allErrors-BPn_2TrB.js +1 -0
  46. package/dist/chunks/analytics-CkYUHW_U.js +1 -0
  47. package/dist/chunks/ant-DjdvlLOo.js +1 -0
  48. package/dist/chunks/api-AMgj1zf_.js +1 -0
  49. package/dist/chunks/api-CF5IVtj0.js +1 -0
  50. package/dist/chunks/{asciicast-CbAjUHT_.js → asciicast-BJNYO5sh.js} +1 -1
  51. package/dist/chunks/asciicast-CH6hdK0a.js +1 -0
  52. package/dist/chunks/auth-CNjDn1VY.js +15 -0
  53. package/dist/chunks/auth-CZzP483s.js +1 -0
  54. package/dist/chunks/auth-DDSBm_Yj.js +1 -0
  55. package/dist/chunks/{autoMode-BNukrVAB.js → autoMode-Cr0AhS1G.js} +5 -5
  56. package/dist/chunks/{autonomy-BEmI7WVW.js → autonomy-ARUQt-Lu.js} +1 -1
  57. package/dist/chunks/autonomy-D4xZLOdJ.js +15 -0
  58. package/dist/chunks/{autonomyPanel-fhge09AG.js → autonomyPanel-BQK9MoeB.js} +1 -1
  59. package/dist/chunks/backgroundHousekeeping--eBgphcg.js +17 -0
  60. package/dist/chunks/backgroundHousekeeping-VV1V_Y2Z.js +1 -0
  61. package/dist/chunks/{banner-CWkrK10u.js → banner-Ca7rki2V.js} +2 -2
  62. package/dist/chunks/bg-BK_9J6F6.js +1 -0
  63. package/dist/chunks/{bg-WnYN5ifx.js → bg-DxRHF1yn.js} +2 -2
  64. package/dist/chunks/{branch-Bpe-gocq.js → branch-BYq0zpzT.js} +1 -1
  65. package/dist/chunks/{break-cache-C_p7Kmx2.js → break-cache-BKvoMOZx.js} +2 -2
  66. package/dist/chunks/bridgeConfig-C82un7rJ.js +1 -0
  67. package/dist/chunks/{bridgeConfig-BhxRF2vm.js → bridgeConfig-jDEva6Eh.js} +1 -1
  68. package/dist/chunks/bridgeMessaging-YqYdl6ej.js +1 -0
  69. package/dist/chunks/bridgePointer-DIM0sj0x.js +1 -0
  70. package/dist/chunks/btw-CUV3nRrE.js +1 -0
  71. package/dist/chunks/caches-BZ59_En6.js +1 -0
  72. package/dist/chunks/caches-Cg-HtWKG.js +1 -0
  73. package/dist/chunks/capacityWake-CKOiRELo.js +3 -0
  74. package/dist/chunks/ccrClient-BC2q3k44.js +1 -0
  75. package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-DQXL5bGm.js} +1 -1
  76. package/dist/chunks/{clear-B4d38ssF.js → clear-1etSJhdg.js} +1 -1
  77. package/dist/chunks/{cliLaunch-BkPAatcs.js → cliLaunch-CQjLYRzM.js} +1 -1
  78. package/dist/chunks/client-DQXvVKND.js +1 -0
  79. package/dist/chunks/client-DQwf_b9o.js +17 -0
  80. package/dist/chunks/client-DkgC-mFB.js +1 -0
  81. package/dist/chunks/color-CBsNbt1s.js +1 -0
  82. package/dist/chunks/commands-qM5z_Uld.js +1 -0
  83. package/dist/chunks/compact-BclJiRJe.js +2 -0
  84. package/dist/chunks/completionCache-BMHAktkM.js +1 -0
  85. package/dist/chunks/config-CE058cvr.js +3 -0
  86. package/dist/chunks/config-D81avYye.js +1 -0
  87. package/dist/chunks/config-DpOOllGk.js +1 -0
  88. package/dist/chunks/context-noninteractive-Ct_ttQfP.js +29 -0
  89. package/dist/chunks/context-noninteractive-DJb8H_hN.js +1 -0
  90. package/dist/chunks/context-sR9fJmXE.js +1 -0
  91. package/dist/chunks/conversation-D48Kt3ar.js +1 -0
  92. package/dist/chunks/conversation-fOFTa7k5.js +1 -0
  93. package/dist/chunks/{createSSHSession-BM-5pbv6.js → createSSHSession-BmHXA2me.js} +1 -1
  94. package/dist/chunks/createSession-C4rukWkv.js +1 -0
  95. package/dist/chunks/createSession-CSwlW2T2.js +1 -0
  96. package/dist/chunks/crossProjectResume-lDFB2ZcY.js +40 -0
  97. package/dist/chunks/cwd-5Xr-Qka6.js +1 -0
  98. package/dist/chunks/cwd-C5ce-7WB.js +1 -0
  99. package/dist/chunks/{daemon-YtZbMQtn.js → daemon-ZtpTZWgQ.js} +1 -1
  100. package/dist/chunks/{datadog-CpqEQbHa.js → datadog-BJn5ECIu.js} +1 -1
  101. package/dist/chunks/{debug-BrXObCdR.js → debug-RZ4NuXyS.js} +1 -1
  102. package/dist/chunks/debugUtils-D30M1cbN.js +1 -0
  103. package/dist/chunks/{detached-TYk4hMFj.js → detached-jrVP11oU.js} +1 -1
  104. package/dist/chunks/{detectRepository-BPr0VWNO.js → detectRepository-CFiHe6Rv.js} +1 -1
  105. package/dist/chunks/detectRepository-DqQvyj_a.js +1 -0
  106. package/dist/chunks/{diff-CVzOodeg.js → diff-BKiK3xHv.js} +1 -1
  107. package/dist/chunks/directoryCompletion-BagQcynj.js +1 -0
  108. package/dist/chunks/doctor-BEHYm34V.js +1 -0
  109. package/dist/chunks/{entry-DHVYCR26.js → entry-BzL1MFQG.js} +4 -4
  110. package/dist/chunks/esm-BLPbfHQd.js +1 -0
  111. package/dist/chunks/{execFileNoThrow-D244NytW.js → execFileNoThrow-CCX-JY8h.js} +1 -1
  112. package/dist/chunks/{execSyncWrapper-CCMQShK-.js → execSyncWrapper-dhRSYGFW.js} +1 -1
  113. package/dist/chunks/exit-DE2YiAhQ.js +1 -0
  114. package/dist/chunks/{lazySchema-DcIJE_0i.js → external-CEp-aPkt.js} +1 -1
  115. package/dist/chunks/extraUsage-Dw7AXiH7.js +1 -0
  116. package/dist/chunks/extractMemories-DxTUMiv3.js +1 -0
  117. package/dist/chunks/fast-CHmMkIpE.js +1 -0
  118. package/dist/chunks/fast-uQASHWqR.js +1 -0
  119. package/dist/chunks/fileSuggestions-Dyu2kQtE.js +3 -0
  120. package/dist/chunks/firstPartyEventLogger-D5ohKbIe.js +5 -0
  121. package/dist/chunks/firstPartyEventLogger-LsNY6yOt.js +1 -0
  122. package/dist/chunks/flushGate-Cnsu4HET.js +1 -0
  123. package/dist/chunks/gemini-Cudre91e.js +1 -0
  124. package/dist/chunks/{generateRecap-jGDLI_wU.js → generateRecap-CiFxXlmH.js} +1 -1
  125. package/dist/chunks/generateSessionName-DitoBxJT.js +1 -0
  126. package/dist/chunks/{genericProcessUtils-CdQTApYX.js → genericProcessUtils-DVfMHhfy.js} +1 -1
  127. package/dist/chunks/git-BerW9bId.js +6 -0
  128. package/dist/chunks/git-D6dOU2mT.js +1 -0
  129. package/dist/chunks/githubRepoPathMapping-DGr0kJ8D.js +1 -0
  130. package/dist/chunks/{goal-CFx4eRkf.js → goal-DuUayfDg.js} +3 -3
  131. package/dist/chunks/grok-tRbmZzEh.js +1 -0
  132. package/dist/chunks/grove-Cv19v6Sv.js +7 -0
  133. package/dist/chunks/help-DkqxbFDM.js +1 -0
  134. package/dist/chunks/{hooks-X6J03MnA.js → hooks-BZJTWD07.js} +2 -2
  135. package/dist/chunks/hooks-CsP42iOp.js +1 -0
  136. package/dist/chunks/initReplBridge-DdsSWVqN.js +1 -0
  137. package/dist/chunks/{install-D5YORIJL.js → install-BI---dv0.js} +1 -1
  138. package/dist/chunks/{instrumentation-Bw3CxPQf.js → instrumentation-CcWzhGfE.js} +4 -4
  139. package/dist/chunks/{job-DOWtcltx.js → job-B0ftcqPF.js} +1 -1
  140. package/dist/chunks/{jwtUtils-DE2GPUcx.js → jwtUtils-C0cE-1Ey.js} +1 -1
  141. package/dist/chunks/keybindings-DZU3vwo3.js +2 -0
  142. package/dist/chunks/language-DHhXLb_Y.js +1 -0
  143. package/dist/chunks/{language-C6Fq-XOZ.js → language-s-dLbdVz.js} +1 -1
  144. package/dist/chunks/launchLocalMemory-twLxpPvg.js +3 -0
  145. package/dist/chunks/{launchOnboarding-Cc6WwPX9.js → launchOnboarding-BWz2XSb9.js} +1 -1
  146. package/dist/chunks/lazySchema-B4D4qJVE.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-D206qwP3.js → loadAgentsDir-ByO8eJqU.js} +1724 -1993
  148. package/dist/chunks/loadAgentsDir-CMNFLt7R.js +1 -0
  149. package/dist/chunks/loadPluginHooks-BPnxcgrL.js +1 -0
  150. package/dist/chunks/{localSearch-CzrbOklu.js → localSearch-CHHCH16D.js} +1 -1
  151. package/dist/chunks/localSearch-DzQODFap.js +1 -0
  152. package/dist/chunks/log-CZ0zYP_c.js +1 -0
  153. package/dist/chunks/logoV2Utils-CGUJ-5gY.js +1 -0
  154. package/dist/chunks/{magicDocs-DWjL2k7P.js → magicDocs-C5i5ruuU.js} +3 -3
  155. package/dist/chunks/{main-D862LI_d.js → main-BLD4QAQg.js} +2 -2
  156. package/dist/chunks/{main-BohPzJFF.js → main-D4Uk-WUs.js} +89 -86
  157. package/dist/chunks/managedEnv-C-9XSN14.js +1 -0
  158. package/dist/chunks/managedEnv-DLVRBaA9.js +1 -0
  159. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
  160. package/dist/chunks/{mappers-BDMZFgKx.js → mappers-CHRFic5q.js} +1 -1
  161. package/dist/chunks/mcp-BMVdGknC.js +1 -0
  162. package/dist/chunks/mcp-COS5RJFS.js +6 -0
  163. package/dist/chunks/mcp-tGsOW1GN.js +2 -0
  164. package/dist/chunks/memoize-B8hfb1JN.js +1 -0
  165. package/dist/chunks/memory-DR6poqeH.js +1 -0
  166. package/dist/chunks/{mode-CUkHFkju.js → mode-QV-NW1Wd.js} +2 -2
  167. package/dist/chunks/model-BF_4ebyl.js +1 -0
  168. package/dist/chunks/{model-BY3auM2c.js → model-BNU_ulDJ.js} +1 -1
  169. package/dist/chunks/model-CwO-g1RW.js +1 -0
  170. package/dist/chunks/nativeInstaller-B-lNJjM-.js +1 -0
  171. package/dist/chunks/observationStore-BpjlK0pG.js +3 -0
  172. package/dist/chunks/omit-DZCEXri5.js +1 -0
  173. package/dist/chunks/onChangeAppState-BmfM5g-D.js +1 -0
  174. package/dist/chunks/openai-DPH6rXOZ.js +10 -0
  175. package/dist/chunks/{panel-BSZGX6jN.js → panel-mD094ALT.js} +1 -1
  176. package/dist/chunks/{panelCall-BsVoL1uF.js → panelCall-SbffM7G4.js} +1 -1
  177. package/dist/chunks/parser-DrBC8nWp.js +1 -0
  178. package/dist/chunks/{parser-DFwaTGf7.js → parser-dbHRgXb8.js} +1 -1
  179. package/dist/chunks/partition-DKuAFJkc.js +1 -0
  180. package/dist/chunks/{path-D5U-tm91.js → path-Cv9QMBAX.js} +1 -1
  181. package/dist/chunks/permissions-ey-bfanE.js +3 -0
  182. package/dist/chunks/{pidLock-D5rUnDB-.js → pidLock-DJnS_38v.js} +2 -2
  183. package/dist/chunks/{pipeTransport-CqCnc-Ys.js → pipeTransport-DVOKR4c_.js} +1 -1
  184. package/dist/chunks/{plan-SYZ4DXR8.js → plan-Brg9XnRr.js} +1 -1
  185. package/dist/chunks/{platform-BrYefG_2.js → platform-DCXXznJg.js} +1 -1
  186. package/dist/chunks/plugin-CRwa39Y1.js +17 -0
  187. package/dist/chunks/pluginAutoupdate-D0LIP7cy.js +1 -0
  188. package/dist/chunks/{pluginBlocklist-C3H2afWG.js → pluginBlocklist-PwHHD3nj.js} +1 -1
  189. package/dist/chunks/pluginCliCommands-BJM5Bdpf.js +1 -0
  190. package/dist/chunks/pluginFlagging-pBxSselw.js +1 -0
  191. package/dist/chunks/pluginOperations-C7p_Qr2r.js +2 -0
  192. package/dist/chunks/pluginStartupCheck-C0HqhG6D.js +1 -0
  193. package/dist/chunks/pluginStartupCheck-Di4LjHXf.js +1 -0
  194. package/dist/chunks/{plugins-Dn6ceWrT.js → plugins-DUKNjLq6.js} +4 -4
  195. package/dist/chunks/pollConfig-BgpfHQPJ.js +1 -0
  196. package/dist/chunks/{poorMode-DhzFKpPl.js → poorMode-CYXmr_mU.js} +1 -1
  197. package/dist/chunks/poorMode-CejPNCp-.js +1 -0
  198. package/dist/chunks/print-gyTOCJzk.js +23 -0
  199. package/dist/chunks/processBashCommand-Cze9vCm6.js +1 -0
  200. package/dist/chunks/processSlashCommand-BRajh1v7.js +5 -0
  201. package/dist/chunks/prompt-B7joRiqj.js +139 -0
  202. package/dist/chunks/prompt-DqSMh2x9.js +1 -0
  203. package/dist/chunks/prompt-Eysh8Et_.js +1 -0
  204. package/dist/chunks/{promptEditor-DeMrXUir.js → promptEditor-R_acDAgI.js} +2 -2
  205. package/dist/chunks/{protocolHandler-BHxBy84Z.js → protocolHandler-RNKkhq91.js} +1 -1
  206. package/dist/chunks/{proxy-CRN7jYIi.js → proxy-BmtEnJ02.js} +1 -1
  207. package/dist/chunks/rcDebugLog-CARUIORE.js +1 -0
  208. package/dist/chunks/reconciler-BfkO6X2X.js +4 -0
  209. package/dist/chunks/refresh-C1X3sptR.js +1 -0
  210. package/dist/chunks/registerProtocol-DoKqmqu2.js +36 -0
  211. package/dist/chunks/{reload-plugins-B9IT9CFA.js → reload-plugins-C0osFcNh.js} +1 -1
  212. package/dist/chunks/remoteBridgeCore-Cddqv2WW.js +1 -0
  213. package/dist/chunks/remoteManagedSettings-B1mnRDmA.js +1 -0
  214. package/dist/chunks/rename-B3tf-YiD.js +1 -0
  215. package/dist/chunks/{renderOptions-BUJB9nAm.js → renderOptions-ChLwxtVu.js} +1 -1
  216. package/dist/chunks/replBridgeHandle-CNwNIijW.js +1 -0
  217. package/dist/chunks/{resume-y7MCTZHJ.js → resume-Be1G_GBL.js} +2 -2
  218. package/dist/chunks/ripgrep-C2PhTJDh.js +1 -0
  219. package/dist/chunks/{ripgrep-BXmXjAzA.js → ripgrep-gaT9Njwi.js} +1 -1
  220. package/dist/chunks/{runtimeObserver-BZcJ1FbH.js → runtimeObserver-CsIwinzh.js} +1 -1
  221. package/dist/chunks/runtimeObserver-Dbxxw4ls.js +10 -0
  222. package/dist/chunks/sandbox-adapter-C6GBuJPB.js +1 -0
  223. package/dist/chunks/sandbox-toggle-jEySONTW.js +1 -0
  224. package/dist/chunks/searchExtraTools-C_UTryh_.js +1 -0
  225. package/dist/chunks/session-DDI1Eb2x.js +2 -0
  226. package/dist/chunks/sessionFileAccessHooks-DfJ7Htfl.js +1 -0
  227. package/dist/chunks/sessionIdCompat-DMayYBrf.js +1 -0
  228. package/dist/chunks/sessionMemory-CQBxPkTQ.js +1 -0
  229. package/dist/chunks/sessionMemory-s0ALUHvc.js +1 -0
  230. package/dist/chunks/sessionMemoryUtils-xt7dTHGC.js +1 -0
  231. package/dist/chunks/sessionObserver-C2sYqWL3.js +1 -0
  232. package/dist/chunks/sessionObserver-DoYc0ZOP.js +20 -0
  233. package/dist/chunks/sessionState-CjNY991n.js +11 -0
  234. package/dist/chunks/sessionStorage-DqsY-7pi.js +1 -0
  235. package/dist/chunks/{sessionTitle-coed9IuJ.js → sessionTitle-B0OYf5nM.js} +3 -3
  236. package/dist/chunks/sessionTracing-CwsXt_uA.js +11 -0
  237. package/dist/chunks/settings-BWtOA9A7.js +1 -0
  238. package/dist/chunks/settings-hQDLwPVj.js +20 -0
  239. package/dist/chunks/settingsSync-DdFagwHV.js +1 -0
  240. package/dist/chunks/setup-DzC22EkN.js +3 -0
  241. package/dist/chunks/{shadowedRuleDetection-D1wsAdpp.js → shadowedRuleDetection-C86PTj1m.js} +1 -1
  242. package/dist/chunks/{shellQuote-DkSy9MYE.js → shellQuote-BUVKMu_P.js} +1 -1
  243. package/dist/chunks/{sideQuestion-wSi38p81.js → sideQuestion-C780iYwd.js} +3 -3
  244. package/dist/chunks/sinks-5G_xhc1Q.js +1 -0
  245. package/dist/chunks/{sinks-C_Dl1p4K.js → sinks-Cftq7Es0.js} +2 -2
  246. package/dist/chunks/skillChangeDetector-plLveEbf.js +1 -0
  247. package/dist/chunks/skillGapStore-Dc1arohs.js +5 -0
  248. package/dist/chunks/skillLifecycle-DP6mY1Kp.js +8 -0
  249. package/dist/chunks/{skillSearchPanel-CErRnUwo.js → skillSearchPanel-CpLTImaL.js} +4 -4
  250. package/dist/chunks/{skills-CBKhfg_a.js → skills-zGYaYfFV.js} +1 -1
  251. package/dist/chunks/{src-D06Xyj4g.js → src-BN7QRYLl.js} +1 -1
  252. package/dist/chunks/startupProfiler-DCn_NxMH.js +3 -0
  253. package/dist/chunks/startupProfiler-JbpAkfNE.js +1 -0
  254. package/dist/chunks/{state-ix0xIunV.js → state-C2OSZkV1.js} +1 -1
  255. package/dist/chunks/state-DU9lRJ9x.js +1 -0
  256. package/dist/chunks/{stats-BY4dskVg.js → stats-Duk7_xjQ.js} +1 -1
  257. package/dist/chunks/{status-BnJIXtKl.js → status-CFw-FpZM.js} +2 -2
  258. package/dist/chunks/{status-DU-B4SMW.js → status-peiVB_2j.js} +1 -1
  259. package/dist/chunks/statusNoticeHelpers-B5U5c9PE.js +1 -0
  260. package/dist/chunks/{stringUtils-DGLPkqJ4.js → stringUtils-B6FudhoZ.js} +1 -1
  261. package/dist/chunks/switcher-BAMqSX7Z.js +1 -0
  262. package/dist/chunks/switcher-hgBgVzLb.js +1 -0
  263. package/dist/chunks/syncCache-Zl9kZRRl.js +1 -0
  264. package/dist/chunks/{tasks-CBVL005y.js → tasks-BxpyRhmD.js} +1 -1
  265. package/dist/chunks/teleport-CwxeD5vL.js +1 -0
  266. package/dist/chunks/{templateJobs-D6998LcG.js → templateJobs-DR5fKFiO.js} +1 -1
  267. package/dist/chunks/{terminalSetup-0SBdyKF5.js → terminalSetup-DgRBt-JJ.js} +1 -1
  268. package/dist/chunks/terminalSetup-DlaFWI81.js +33 -0
  269. package/dist/chunks/{theme-p0AooruD.js → theme-Bz6esfST.js} +1 -1
  270. package/dist/chunks/{tmux-BY7IdQ1f.js → tmux-DSU9tYIo.js} +1 -1
  271. package/dist/chunks/{toolEventObserver-DTccwC3c.js → toolEventObserver-BSekCkM2.js} +1 -1
  272. package/dist/chunks/toolPool-B7SIoDw5.js +1 -0
  273. package/dist/chunks/{trustedDevice-BTYoQCkC.js → trustedDevice-B0x9X0fb.js} +1 -1
  274. package/dist/chunks/trustedDevice-CjHQtVkO.js +1 -0
  275. package/dist/chunks/{types-C-MRCL8J.js → types-D7_37tP2.js} +2 -2
  276. package/dist/chunks/{udsClient-BuCtv7dN.js → udsClient-CHoMMH28.js} +1 -1
  277. package/dist/chunks/{up-BHkC97_C.js → up-B8wBSpLg.js} +1 -1
  278. package/dist/chunks/{updateCCB-DFL5Wt_I.js → updateCCB-D_kGQKPT.js} +1 -1
  279. package/dist/chunks/{upstreamproxy-DyR_eXO8.js → upstreamproxy-Hmq-n8fw.js} +1 -1
  280. package/dist/chunks/useExitOnCtrlCDWithKeybindings-Cce612uS.js +1 -0
  281. package/dist/chunks/useMainLoopModel-BICP6_Fi.js +1 -0
  282. package/dist/chunks/useManagePlugins-DtbY_vPL.js +1 -0
  283. package/dist/chunks/useMergedTools-Ckx2IEhF.js +1 -0
  284. package/dist/chunks/{useSearchInput-D1Vr2Js1.js → useSearchInput-BAgljZUl.js} +1 -1
  285. package/dist/chunks/useSettingsErrors-CAJR_wpd.js +1 -0
  286. package/dist/chunks/userAgent-BxTG7IMk.js +1 -0
  287. package/dist/chunks/{util-BaDs-wL5.js → util-DDtmyq_r.js} +1 -1
  288. package/dist/chunks/validatePlugin-AHl-g4ct.js +1 -0
  289. package/dist/chunks/{vim-C-icQDz1.js → vim-kg-mRVbu.js} +1 -1
  290. package/dist/chunks/{which-CKQnSouy.js → which-CHLNJmtJ.js} +1 -1
  291. package/dist/chunks/windowsPaths-Pmx8LDR6.js +1 -0
  292. package/dist/chunks/{windowsPaths-DtapVxOo.js → windowsPaths-o62uq6LF.js} +1 -1
  293. package/dist/chunks/{workSecret-CNWiR2uQ.js → workSecret-DG9shvG0.js} +1 -1
  294. package/dist/chunks/workerRegistry-C7H_lsQX.js +6 -0
  295. package/dist/chunks/worktree-O2p-mJdF.js +1 -0
  296. package/dist/cli.js +1 -1
  297. package/package.json +1 -1
  298. package/dist/chunks/AddWorkspaceDirectory-ClHi-Dr6.js +0 -1
  299. package/dist/chunks/App-BP06lHmf.js +0 -1
  300. package/dist/chunks/ApproveApiKey-a2ZonQ3n.js +0 -1
  301. package/dist/chunks/AssistantSessionChooser-CcocKoTJ.js +0 -1
  302. package/dist/chunks/BackgroundTasksDialog-DNeBhGCf.js +0 -2
  303. package/dist/chunks/ClaudeMdExternalIncludesDialog-DFivNFuo.js +0 -1
  304. package/dist/chunks/ConsoleOAuthFlow-CS3zjEPF.js +0 -1
  305. package/dist/chunks/DesktopHandoff-BmPmCfT3.js +0 -1
  306. package/dist/chunks/Dialog-vfLXEPed.js +0 -1
  307. package/dist/chunks/Doctor-BhD-ZzZm.js +0 -1
  308. package/dist/chunks/Doctor-DEQe2q16.js +0 -3
  309. package/dist/chunks/Feedback-BaYA8-SU.js +0 -2
  310. package/dist/chunks/Grove-BJziCbZH.js +0 -11
  311. package/dist/chunks/Grove-sWm-oLBf.js +0 -1
  312. package/dist/chunks/ListItem-vfLXEPed.js +0 -1
  313. package/dist/chunks/MCPConnectionManager-CNh9dNlk.js +0 -1
  314. package/dist/chunks/MessageSelector-DdR6wJhh.js +0 -3
  315. package/dist/chunks/Messages-Ch6cboMV.js +0 -11
  316. package/dist/chunks/Onboarding-BrAJp0aL.js +0 -1
  317. package/dist/chunks/OverageCreditUpsell-Ds1cB7RC.js +0 -1
  318. package/dist/chunks/PluginSettings-CGqEzejq.js +0 -17
  319. package/dist/chunks/QueryEngine-CZZMl3PB.js +0 -1
  320. package/dist/chunks/REPL-CG2N7E4Q.js +0 -142
  321. package/dist/chunks/REPL-DvA910N_.js +0 -1
  322. package/dist/chunks/RemoteCallout-Cs-ro8_i.js +0 -1
  323. package/dist/chunks/RemoteSessionManager-B740Dp6m.js +0 -2
  324. package/dist/chunks/ResumeConversation-DzV2zmuX.js +0 -1
  325. package/dist/chunks/SearchExtraToolsTool-C4uO-Zx3.js +0 -1
  326. package/dist/chunks/Settings-XKw6FI_m.js +0 -2
  327. package/dist/chunks/TeleportRepoMismatchDialog-DY97YZMB.js +0 -1
  328. package/dist/chunks/TeleportResumeWrapper-jaQzyTCh.js +0 -1
  329. package/dist/chunks/ThemePicker-BViWzLp3.js +0 -1
  330. package/dist/chunks/TrustDialog-DGJ_BisZ.js +0 -1
  331. package/dist/chunks/TungstenTool-Cb7gJvq4.js +0 -1
  332. package/dist/chunks/TungstenTool-CxMQVCuF.js +0 -1
  333. package/dist/chunks/agents-BIHTGDYh.js +0 -103
  334. package/dist/chunks/allErrors-1896uQA1.js +0 -1
  335. package/dist/chunks/analytics-BotDBGh0.js +0 -1
  336. package/dist/chunks/ant-B6k6cBts.js +0 -1
  337. package/dist/chunks/api-BsFW57_Q.js +0 -1
  338. package/dist/chunks/api-gqTA-D7n.js +0 -1
  339. package/dist/chunks/asciicast-BsWpcxrc.js +0 -1
  340. package/dist/chunks/assistant-C83quuNj.js +0 -1
  341. package/dist/chunks/assistant-DJ9hd4uC.js +0 -1
  342. package/dist/chunks/assistant-z2o4-UJe.js +0 -1
  343. package/dist/chunks/auth-8Vd3_U8t.js +0 -1
  344. package/dist/chunks/auth-BnSrKyJe.js +0 -15
  345. package/dist/chunks/auth-DRTjfnGy.js +0 -1
  346. package/dist/chunks/autonomy-DGcy5Rml.js +0 -15
  347. package/dist/chunks/backgroundHousekeeping-3i_d_WW5.js +0 -1
  348. package/dist/chunks/backgroundHousekeeping-BVMf_Tjn.js +0 -17
  349. package/dist/chunks/bg-B0iMGM9C.js +0 -1
  350. package/dist/chunks/bridge-D12Shbkj.js +0 -2
  351. package/dist/chunks/bridgeConfig-CqIQ_rvD.js +0 -1
  352. package/dist/chunks/bridgeEnabled-D0XC5kNh.js +0 -1
  353. package/dist/chunks/bridgeEnabled-SbB-6zdY.js +0 -1
  354. package/dist/chunks/bridgeMain-DHUpZFgL.js +0 -68
  355. package/dist/chunks/bridgeMain-DUbQjgCp.js +0 -1
  356. package/dist/chunks/bridgeMessaging-DHc5dOhB.js +0 -1
  357. package/dist/chunks/bridgePointer-MqLe5Asm.js +0 -1
  358. package/dist/chunks/browser-BmZuQom6.js +0 -1
  359. package/dist/chunks/btw-D9hMM5d2.js +0 -1
  360. package/dist/chunks/caches-CWzT7e6Y.js +0 -1
  361. package/dist/chunks/caches-UeVVM3T0.js +0 -3
  362. package/dist/chunks/capacityWake-CV_x9H8j.js +0 -1
  363. package/dist/chunks/ccrClient-Iza0L8Zw.js +0 -1
  364. package/dist/chunks/client-BzKQTXzF.js +0 -1
  365. package/dist/chunks/color-D8VOyoYl.js +0 -1
  366. package/dist/chunks/commands-DDamMmo4.js +0 -1
  367. package/dist/chunks/commitAttribution-CgohL8vD.js +0 -1
  368. package/dist/chunks/commitAttribution-ChAgixdj.js +0 -2
  369. package/dist/chunks/compact-IFHwxjZ9.js +0 -2
  370. package/dist/chunks/completionCache-MN3_MqK8.js +0 -4
  371. package/dist/chunks/completionCache-c4aiyZ_f.js +0 -1
  372. package/dist/chunks/config-DY5-_kk_.js +0 -1
  373. package/dist/chunks/config-DmomySWC.js +0 -3
  374. package/dist/chunks/config-WxgxrQoP.js +0 -1
  375. package/dist/chunks/context-Cl6BJ2vm.js +0 -1
  376. package/dist/chunks/context-noninteractive-9hELVC29.js +0 -54
  377. package/dist/chunks/context-noninteractive-Beij5MfU.js +0 -1
  378. package/dist/chunks/conversation-BBB91hEw.js +0 -1
  379. package/dist/chunks/conversation-BWVTM40Y.js +0 -1
  380. package/dist/chunks/createSession-CoQtL5Rj.js +0 -1
  381. package/dist/chunks/createSession-Cvl1Q50F.js +0 -1
  382. package/dist/chunks/cron-3LntnnhJ.js +0 -1
  383. package/dist/chunks/crossProjectResume-BasMLl2n.js +0 -40
  384. package/dist/chunks/cwd--nvsx73T.js +0 -1
  385. package/dist/chunks/cwd-CYmmnQVS.js +0 -1
  386. package/dist/chunks/debugUtils-NO5KtXqi.js +0 -1
  387. package/dist/chunks/desktop-B_L6T6jI.js +0 -1
  388. package/dist/chunks/detectRepository-BTPgN89l.js +0 -1
  389. package/dist/chunks/directoryCompletion-CW2ckkQg.js +0 -1
  390. package/dist/chunks/doctor-1L0TFuGw.js +0 -1
  391. package/dist/chunks/envLessBridgeConfig-CN0_44-p.js +0 -1
  392. package/dist/chunks/envLessBridgeConfig-Ck2-KMq0.js +0 -1
  393. package/dist/chunks/esm-D5q6s4l8.js +0 -1
  394. package/dist/chunks/exit-Bm1S_f3i.js +0 -1
  395. package/dist/chunks/extra-usage-UHAWtypK.js +0 -1
  396. package/dist/chunks/extra-usage-core-BFOolqoi.js +0 -1
  397. package/dist/chunks/extra-usage-noninteractive-cUGZy0en.js +0 -1
  398. package/dist/chunks/extra-usage-zDHVtWKZ.js +0 -1
  399. package/dist/chunks/extraUsage-Dq66zzqR.js +0 -1
  400. package/dist/chunks/extractMemories-BcaklA33.js +0 -1
  401. package/dist/chunks/fast-DALAHO3d.js +0 -1
  402. package/dist/chunks/fast-MS7WZpD8.js +0 -1
  403. package/dist/chunks/feedback-Fw4m28ZC.js +0 -1
  404. package/dist/chunks/file-DcZWPH2V.js +0 -12
  405. package/dist/chunks/fileStateCache-DDW5toIs.js +0 -1
  406. package/dist/chunks/files-Cz1-PK3r.js +0 -2
  407. package/dist/chunks/firstPartyEventLogger-CS9jVz6D.js +0 -1
  408. package/dist/chunks/firstPartyEventLogger-CoSUd0a1.js +0 -5
  409. package/dist/chunks/flushGate-De-yppeo.js +0 -1
  410. package/dist/chunks/gemini-BPziscyN.js +0 -1
  411. package/dist/chunks/generateSessionName-hDJ6HBJ1.js +0 -1
  412. package/dist/chunks/git-CbcnOf0E.js +0 -1
  413. package/dist/chunks/git-Do0wJvux.js +0 -6
  414. package/dist/chunks/githubRepoPathMapping-qAoiyj6P.js +0 -1
  415. package/dist/chunks/grok-Byblph7F.js +0 -1
  416. package/dist/chunks/grove-CpqjcGCb.js +0 -7
  417. package/dist/chunks/heapdump-C4kPlqGt.js +0 -5
  418. package/dist/chunks/help-B1h-faJ3.js +0 -1
  419. package/dist/chunks/hooks-DPLIIpAD.js +0 -1
  420. package/dist/chunks/hostGuard-BHI6Q8Mt.js +0 -1
  421. package/dist/chunks/inboundAttachments-BekVc0W-.js +0 -1
  422. package/dist/chunks/inboundAttachments-CUJE3KaU.js +0 -1
  423. package/dist/chunks/index.min-D75yiGLN.js +0 -1
  424. package/dist/chunks/initReplBridge-JQ-afRx9.js +0 -1
  425. package/dist/chunks/keybindings-BLw5J-Zj.js +0 -2
  426. package/dist/chunks/language-Cqw5gYJR.js +0 -1
  427. package/dist/chunks/launchAgentsPlatform-jWWf-Lk9.js +0 -1
  428. package/dist/chunks/launchCommand-1qkTCKpf.js +0 -1
  429. package/dist/chunks/launchLocalMemory-kHeD0I0y.js +0 -3
  430. package/dist/chunks/launchLocalVault-DLqkOjmb.js +0 -3
  431. package/dist/chunks/launchMemoryStores-Ct7AVXrO.js +0 -1
  432. package/dist/chunks/launchSchedule-ZyvuvjgU.js +0 -1
  433. package/dist/chunks/launchSkillStore-BejQnLog.js +0 -1
  434. package/dist/chunks/launchTeleport-8CuYUfIR.js +0 -3
  435. package/dist/chunks/launchVault-DIvIOuPh.js +0 -1
  436. package/dist/chunks/loadAgentsDir-TZjwTqdr.js +0 -1
  437. package/dist/chunks/loadPluginHooks-Ddhsyn0_.js +0 -1
  438. package/dist/chunks/localSearch-DrOAL6f4.js +0 -1
  439. package/dist/chunks/log-BMCygSzM.js +0 -1
  440. package/dist/chunks/logoV2Utils-8M56V7oN.js +0 -1
  441. package/dist/chunks/mcp-Bt1ITh-Z.js +0 -1
  442. package/dist/chunks/mcp-CwJ-AIpt.js +0 -6
  443. package/dist/chunks/mcp-W0LFoyFR.js +0 -2
  444. package/dist/chunks/memoize-B0zhbT8Z.js +0 -1
  445. package/dist/chunks/memory-3wV7m7UU.js +0 -1
  446. package/dist/chunks/model-CKkOnnnx.js +0 -1
  447. package/dist/chunks/model-DRXcJyU9.js +0 -1
  448. package/dist/chunks/nativeInstaller-CA5d6_G7.js +0 -1
  449. package/dist/chunks/observationStore-DzCdXq8U.js +0 -4
  450. package/dist/chunks/onChangeAppState-DBmy2Ow_.js +0 -1
  451. package/dist/chunks/openai-Cbomn0Ws.js +0 -10
  452. package/dist/chunks/output-style-BM3qAHLA.js +0 -1
  453. package/dist/chunks/overageCreditGrant-DsUrmeBh.js +0 -1
  454. package/dist/chunks/panel-Be-OxtqL.js +0 -1
  455. package/dist/chunks/parser-Bf6iasPV.js +0 -1
  456. package/dist/chunks/partition-BAakXjvj.js +0 -1
  457. package/dist/chunks/passes-CLRt7Cvm.js +0 -1
  458. package/dist/chunks/permissions-BVSFuwNP.js +0 -3
  459. package/dist/chunks/permissions-CeYKbtSC.js +0 -1
  460. package/dist/chunks/permissions-Cn_6f8CB.js +0 -1
  461. package/dist/chunks/plugin-Bfjzhmrk.js +0 -1
  462. package/dist/chunks/pluginAutoupdate-reO2PgtQ.js +0 -1
  463. package/dist/chunks/pluginCliCommands-lqdxdkQp.js +0 -1
  464. package/dist/chunks/pluginFlagging-D9HKAGBC.js +0 -1
  465. package/dist/chunks/pluginOperations-EN3EKLux.js +0 -2
  466. package/dist/chunks/pluginStartupCheck-BY73BMT2.js +0 -1
  467. package/dist/chunks/pluginStartupCheck-CwWOlveD.js +0 -1
  468. package/dist/chunks/policyLimits-CkTI5KEt.js +0 -1
  469. package/dist/chunks/pollConfig-DH2oCtFS.js +0 -1
  470. package/dist/chunks/poor-j-y-bv8o.js +0 -1
  471. package/dist/chunks/poorMode-V11s-3cf.js +0 -1
  472. package/dist/chunks/print-Db_VXmfO.js +0 -23
  473. package/dist/chunks/privacy-settings-DHMJREbb.js +0 -1
  474. package/dist/chunks/processBashCommand-BcM_fhV9.js +0 -1
  475. package/dist/chunks/processSlashCommand-DEVo3GPX.js +0 -5
  476. package/dist/chunks/prompt-BNHtszmZ.js +0 -139
  477. package/dist/chunks/prompt-CrX31AGm.js +0 -1
  478. package/dist/chunks/prompt-IAvMxKDl.js +0 -1
  479. package/dist/chunks/rate-limit-options-DIudL9fb.js +0 -1
  480. package/dist/chunks/rcDebugLog-CUy1_F23.js +0 -11
  481. package/dist/chunks/reconciler-BXpPyfSY.js +0 -4
  482. package/dist/chunks/referral-CUaIo_vT.js +0 -1
  483. package/dist/chunks/refresh-CuaVBIQ0.js +0 -1
  484. package/dist/chunks/registerProtocol-B7Fzdofu.js +0 -36
  485. package/dist/chunks/release-notes-fbfv2DC0.js +0 -4
  486. package/dist/chunks/releaseNotes-CxAHFLPl.js +0 -2
  487. package/dist/chunks/remote-env-BOklGlll.js +0 -1
  488. package/dist/chunks/remoteBridgeCore-j0bG1zjv.js +0 -1
  489. package/dist/chunks/remoteManagedSettings-Cq994lyc.js +0 -1
  490. package/dist/chunks/rename-Iev7wQsI.js +0 -1
  491. package/dist/chunks/ripgrep-BfIpz5uC.js +0 -1
  492. package/dist/chunks/runtimeObserver-CyzLASla.js +0 -10
  493. package/dist/chunks/sandbox-adapter-Cu1FYrkh.js +0 -1
  494. package/dist/chunks/sandbox-toggle-CWpBO228.js +0 -1
  495. package/dist/chunks/sanitization-DV-94a9Z.js +0 -1
  496. package/dist/chunks/searchExtraTools-BUOUds7p.js +0 -1
  497. package/dist/chunks/semver-BMRJYn3q.js +0 -1
  498. package/dist/chunks/session-DL4cA_8l.js +0 -2
  499. package/dist/chunks/sessionDiscovery-DAfNKqp1.js +0 -1
  500. package/dist/chunks/sessionFileAccessHooks-2cgIIxPk.js +0 -1
  501. package/dist/chunks/sessionMemory-BS8_TbKj.js +0 -1
  502. package/dist/chunks/sessionMemory-D5fSHXvZ.js +0 -1
  503. package/dist/chunks/sessionMemoryUtils-BWUztNh6.js +0 -1
  504. package/dist/chunks/sessionObserver-ChfQtK2m.js +0 -1
  505. package/dist/chunks/sessionObserver-ShbCwJ8x.js +0 -20
  506. package/dist/chunks/sessionStorage-Cf5wmnyB.js +0 -1
  507. package/dist/chunks/sessionTracing-D9rUyiq0.js +0 -11
  508. package/dist/chunks/settings-BovzmwMP.js +0 -19
  509. package/dist/chunks/settingsSync-PqU9XGJq.js +0 -1
  510. package/dist/chunks/setup-B_FOvNpp.js +0 -3
  511. package/dist/chunks/sinks-BpcRrN_T.js +0 -1
  512. package/dist/chunks/skill-learning-B5tmc7EX.js +0 -5
  513. package/dist/chunks/skillChangeDetector-DNqohXxz.js +0 -1
  514. package/dist/chunks/skillGapStore-D-kQKVDZ.js +0 -1
  515. package/dist/chunks/skillGapStore-Df5BWAk5.js +0 -5
  516. package/dist/chunks/skillGenerator-DbcdpAkw.js +0 -8
  517. package/dist/chunks/skillLearning-C5cXZE6_.js +0 -1
  518. package/dist/chunks/skillLearning-ClRiDcJH.js +0 -1
  519. package/dist/chunks/skillPanel-LBd4E-MM.js +0 -28
  520. package/dist/chunks/slashCommandParsing-RQb_7Xzt.js +0 -1
  521. package/dist/chunks/startupProfiler-DIWVcO4e.js +0 -1
  522. package/dist/chunks/startupProfiler-xa3NmN7Z.js +0 -3
  523. package/dist/chunks/state-BOa-3Av3.js +0 -1
  524. package/dist/chunks/statusNoticeHelpers-CzTuGNuC.js +0 -1
  525. package/dist/chunks/stickers-D5teCKMN.js +0 -1
  526. package/dist/chunks/systemPromptSections-CR_AoPIX.js +0 -1
  527. package/dist/chunks/systemPromptSections-DN0HGVye.js +0 -1
  528. package/dist/chunks/tag-B-wVW9Aj.js +0 -11
  529. package/dist/chunks/teleport-dtqQXM4x.js +0 -1
  530. package/dist/chunks/terminalSetup-CuV-qU6v.js +0 -33
  531. package/dist/chunks/thinkback-Catprqs_.js +0 -1
  532. package/dist/chunks/thinkback-DI2NpvG-.js +0 -1
  533. package/dist/chunks/thinkback-play-CqrIRx2o.js +0 -1
  534. package/dist/chunks/toolEventObserver-DlH73w-S.js +0 -1
  535. package/dist/chunks/toolPool-B64V-jmK.js +0 -1
  536. package/dist/chunks/trustedDevice-CiwjT_Y6.js +0 -1
  537. package/dist/chunks/tui-C2yuCuOU.js +0 -6
  538. package/dist/chunks/types-Bh9S_JG5.js +0 -3
  539. package/dist/chunks/types-DHkZVzJe.js +0 -1
  540. package/dist/chunks/ultrareviewCommand-BDFUS3hf.js +0 -3
  541. package/dist/chunks/undercover-XYapZ_SS.js +0 -1
  542. package/dist/chunks/undercover-vuTpCnQJ.js +0 -31
  543. package/dist/chunks/upgrade-D5qwcaWQ.js +0 -1
  544. package/dist/chunks/upgrade-DIg3j929.js +0 -1
  545. package/dist/chunks/upload-B_yADHX9.js +0 -1
  546. package/dist/chunks/usage-C0SnnC-i.js +0 -1
  547. package/dist/chunks/usage-CYJKE8N6.js +0 -1
  548. package/dist/chunks/useExitOnCtrlCDWithKeybindings-DKIqRraH.js +0 -1
  549. package/dist/chunks/useMainLoopModel-XetDUXd-.js +0 -1
  550. package/dist/chunks/useManagePlugins-B2KhKiu5.js +0 -1
  551. package/dist/chunks/useMergedTools-CKvwz_Zt.js +0 -1
  552. package/dist/chunks/useSettingsErrors-B7BXHchG.js +0 -1
  553. package/dist/chunks/validatePlugin-DtiYlXby.js +0 -1
  554. package/dist/chunks/windowsPaths-9pEkw0oV.js +0 -1
  555. package/dist/chunks/workerRegistry-ChqPPIaO.js +0 -1
  556. package/dist/chunks/worktree-DAn8ooa1.js +0 -1
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{F as t,a as n,l as r,z as i}from"./debug-RZ4NuXyS.js";import{i as a,t as o}from"./sessionIdCompat-DMayYBrf.js";import{i as s,o as c}from"./debugUtils-D30M1cbN.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-CZzP483s.js`),{getOrganizationUUID:p}=await import(`./client-DQXvVKND.js`),{getOauthConfig:m}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:h}=await import(`./api-AMgj1zf_.js`),{parseGitHubRepository:g}=await import(`./detectRepository-DqQvyj_a.js`),{getDefaultBranch:_}=await import(`./git-D6dOU2mT.js`),{getMainLoopModel:v}=await import(`./model-BF_4ebyl.js`),{default:y}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:b}=await import(`./bridgeConfig-C82un7rJ.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-DqQvyj_a.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-CZzP483s.js`),{getOrganizationUUID:a}=await import(`./client-DQXvVKND.js`),{getOauthConfig:o}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:c}=await import(`./api-AMgj1zf_.js`),{default:l}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:u}=await import(`./bridgeConfig-C82un7rJ.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-CZzP483s.js`),{getOrganizationUUID:i}=await import(`./client-DQXvVKND.js`),{getOauthConfig:a}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:o}=await import(`./api-AMgj1zf_.js`),{default:c}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:l}=await import(`./bridgeConfig-C82un7rJ.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-CZzP483s.js`),{getOrganizationUUID:c}=await import(`./client-DQXvVKND.js`),{getOauthConfig:l}=await import(`./oauth-C8X_p8Gc.js`),{getOAuthHeaders:u}=await import(`./api-AMgj1zf_.js`),{default:d}=await import(`./axios-BHBm_hhU.js`),{isSelfHostedBridge:f}=await import(`./bridgeConfig-C82un7rJ.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((()=>{n(),i(),c(),o()}));export{f as a,p as i,l as n,u as r,d as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,n,r}from"./createSession-C4rukWkv.js";t();export{n as createBridgeSession,r as getBridgeSession,e as updateBridgeSessionTitle};
@@ -0,0 +1,40 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{C as i,D as a,Gr as o,H as s,I as c,P as l,T as u,Wt as d,Xn as f,ai as p,di as m,fi as h,hn as ee,k as te,ot as ne,p as re,t as g,ui as _}from"./src-CDCSSo0U2.js";import{t as v}from"./jsx-runtime-Bb4Xn-E0.js";import{$t as y,mt as ie,tt as ae}from"./state-C2OSZkV1.js";import{Bp as oe,Cp as se,Cr as b,Fi as x,Fr as S,Jp as ce,Nr as le,Pi as ue,Pw as C,Wr as w,bf as de,dp as fe,hl as pe,hr as me,im as he,jr as T,pl as E,pp as ge,qp as D,rm as _e,vi as ve,wp as O,xw as ye,yf as k,zp as be}from"./loadAgentsDir-ByO8eJqU.js";import{C as xe,S as A,a as Se,l as j}from"./debug-RZ4NuXyS.js";import{In as Ce,Ln as we}from"./settings-hQDLwPVj.js";import{i as Te,m as Ee}from"./git-BerW9bId.js";import{a as De,o as Oe,s as ke}from"./log-CZ0zYP_c.js";import{n as Ae,r as M}from"./analytics-CkYUHW_U.js";import{f as je,h as Me,w as Ne,y as Pe}from"./startupProfiler-DCn_NxMH.js";import{_ as Fe,h as N}from"./model-CwO-g1RW.js";import{i as P,r as Ie}from"./shellQuote-BUVKMu_P.js";import{n as Le,t as Re}from"./useExitOnCtrlCDWithKeybindings-Cce612uS.js";import{t as ze}from"./SearchBox-vfLXEPed.js";import{n as Be,t as Ve}from"./useSearchInput-BAgljZUl.js";import{d as He,n as F,t as Ue,u as We}from"./Messages-BPeI7lLV.js";import{sep as I}from"path";function Ge({log:e,onExit:t,onSelect:n}){let[r,i]=L.useState(null);L.useEffect(()=>{i(null),S(e)&&w(e).then(i)},[e]);let o=S(e)&&r===null,s=r??e,f=b(s)||``,p=E();return d(`confirm:no`,t,{context:`Confirmation`}),d(`confirm:yes`,(0,L.useCallback)(()=>{n(r??e)},[n,r,e]),{context:`Confirmation`}),o?(0,R.jsxs)(c,{flexDirection:`column`,padding:1,children:[(0,R.jsx)(re,{message:`Loading session…`}),(0,R.jsx)(l,{dimColor:!0,children:(0,R.jsx)(u,{children:(0,R.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})})})]}):(0,R.jsxs)(c,{flexDirection:`column`,children:[(0,R.jsx)(Ue,{messages:s.messages,tools:p,commands:[],verbose:!0,toolJSX:null,toolUseConfirmQueue:[],inProgressToolUseIDs:new Set,isMessageSelectorVisible:!1,conversationId:f,screen:`transcript`,streamingToolUses:[],showAllInTranscript:!0,isLoading:!1}),(0,R.jsxs)(c,{flexShrink:0,flexDirection:`column`,borderTopDimColor:!0,borderBottom:!1,borderLeft:!1,borderRight:!1,borderStyle:`single`,paddingLeft:2,children:[(0,R.jsxs)(l,{children:[Me(s.modified),` · `,s.messageCount,` messages`,s.gitBranch?` · ${s.gitBranch}`:``]}),(0,R.jsx)(l,{dimColor:!0,children:(0,R.jsxs)(u,{children:[(0,R.jsx)(a,{shortcut:`Enter`,action:`resume`}),(0,R.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})]})}var L,R,z=e((()=>{L=t(h(),1),g(),C(),pe(),Pe(),T(),ce(),F(),R=v()}));function Ke(e,t){if(e===V)return 5;let n=o(e),r=t?Math.min(n,t-H-U):n;return Math.max(0,r)+H+U}function qe(e,t){let n=t-H-U;return o(e)<=n?e:n<=1?e.charAt(0):Ne(e,n)}function Je({tabs:e,selectedIndex:t,availableWidth:n,showAllProjects:r=!1}){let i=r?`Resume (All Projects)`:`Resume`,a=i.length+1,o=Math.max(et,W),s=n-a-o-2,u=Math.max(0,Math.min(t,e.length-1)),d=Math.max(20,Math.floor(s/2)),f=e.map(e=>Ke(e,d)),p=0,m=e.length;if(f.reduce((e,t,n)=>e+t+ +(n<f.length-1),0)>s){let t=s-$e,n=f[u]??0;for(p=u,m=u+1;p>0||m<e.length;){let r=p>0,i=m<e.length;if(r){let e=(f[p-1]??0)+1;if(n+e<=t){p--,n+=e;continue}}if(i){let e=(f[m]??0)+1;if(n+e<=t){m++,n+=e;continue}}break}}let h=p,ee=e.length-m,te=e.slice(p,m),ne=te.map((e,t)=>p+t);return(0,B.jsxs)(c,{flexDirection:`row`,gap:1,children:[(0,B.jsx)(l,{color:`suggestion`,children:i}),h>0&&(0,B.jsxs)(l,{dimColor:!0,children:[Ye,h]}),te.map((e,t)=>{let n=ne[t]===u,r=e===V?e:`#${qe(e,d-H)}`;return(0,B.jsxs)(l,{backgroundColor:n?`suggestion`:void 0,color:n?`inverseText`:void 0,bold:n,children:[` `,r,` `]},e)}),ee>0?(0,B.jsxs)(l,{dimColor:!0,children:[Xe,ee,Ze]}):(0,B.jsx)(l,{dimColor:!0,children:Qe})]})}var B,V,H,U,Ye,Xe,Ze,Qe,$e,et,W,G=e((()=>{h(),g(),Pe(),B=v(),V=`All`,H=2,U=1,Ye=`← `,Xe=`→`,Ze=` (tab to cycle)`,Qe=`(tab to cycle)`,$e=5,et=18,W=14}));function tt({nodes:e,onSelect:t,onCancel:n,onFocus:r,focusNodeId:i,visibleOptionCount:a,layout:o=`expanded`,isDisabled:s=!1,hideIndexes:l=!1,isNodeExpanded:u,onExpand:d,onCollapse:f,getParentPrefix:p,getChildPrefix:m,onUpFromFirstItem:h}){let[ee,te]=K.useState(new Set),ne=K.useRef(!1),re=K.useRef(null),g=K.useCallback(e=>u?u(e):ee.has(e),[u,ee]),_=K.useMemo(()=>{let t=[];function n(e,r,i){let a=!!e.children&&e.children.length>0,o=g(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,g]),v=K.useCallback(e=>e?`▼ `:`▶ `,[]),y=K.useCallback(e=>` ▸ `,[]),ie=p??v,ae=m??y,oe=K.useCallback(e=>{let t=``;return e.hasChildren?t=ie(e.isExpanded):e.depth>0&&(t=ae(e.depth)),t+e.node.label},[ie,ae]),se=K.useMemo(()=>_.map(e=>({label:oe(e),description:e.node.description,dimDescription:e.node.dimDescription??!0,value:e.node.id})),[_,oe]),b=K.useMemo(()=>{let e=new Map;return _.forEach(t=>e.set(t.node.id,t.node)),e},[_]),x=K.useCallback(e=>_.find(t=>t.node.id===e),[_]),S=K.useCallback((e,t)=>{let n=x(e);!n||!n.hasChildren||(t?d?d(e):te(t=>new Set(t).add(e)):f?f(e):te(t=>{let n=new Set(t);return n.delete(e),n}))},[x,d,f]);return(0,nt.jsx)(c,{tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(!i||s)return;let t=x(i);if(t){if(e.key===`right`&&t.hasChildren)e.preventDefault(),S(i,!0);else if(e.key===`left`){if(t.hasChildren&&t.isExpanded)e.preventDefault(),S(i,!1);else if(t.parentId!==void 0&&(e.preventDefault(),ne.current=!0,S(t.parentId,!1),r)){let e=b.get(t.parentId);e&&r(e)}}}},children:(0,nt.jsx)(be,{options:se,onChange:K.useCallback(e=>{let n=b.get(e);n&&t(n)},[b,t]),onFocus:K.useCallback(e=>{if(ne.current){ne.current=!1;return}if(re.current!==e&&(re.current=e,r)){let t=b.get(e);t&&r(t)}},[r,b]),onCancel:n,defaultFocusValue:i,visibleOptionCount:a,layout:o,isDisabled:s,hideIndexes:l,onUpFromFirstItem:h})})}var K,nt,rt=e((()=>{K=t(h(),1),g(),oe(),nt=v()}));function it(e,t){return Ne(e.replace(/\s+/g,` `).trim(),t)}function at({before:e,match:t,after:n},r){return _.dim(e)+r(t)+_.dim(n)}function ot(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 st(e,t,n){let{isGroupHeader:r=!1,isChild:i=!1,forkCount:a=0}=n||{},o=r&&a>0?mt:i?ht:0,s=r&&a>0?` (+${a} other ${a===1?`session`:`sessions`})`:``,c=e.isSidechain?` (sidechain)`:``,l=t-o-c.length-s.length;return`${it(De(e),l)}${c}${s}`}function ct(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 lt({logs:e,maxHeight:t=1/0,forceWidth:n,onCancel:o,onSelect:m,onLogsChanged:h,onLoadMore:re,initialSearchQuery:g,showAllProjects:_=!1,onToggleAllProjects:v,onAgenticSearch:y}){let oe=ne(),x=n===void 0?oe.columns:n,S=Le(o),ce=f(),C=le(),w=process.env.USER_TYPE===`ant`,[de]=s(),pe=se(de),he=q.useMemo(()=>e=>p(e,pe.warning),[pe.warning]),T=process.env.USER_TYPE===`ant`,[E,ge]=q.useState(null),[O,ye]=q.useState(!1),[k,xe]=q.useState(!1),[A,Se]=q.useState(!1),j=q.useMemo(()=>ae(),[]),[Ce,we]=q.useState(``),[Ee,Oe]=q.useState(0),[ke,Ae]=q.useState(new Set),[Me,Ne]=q.useState(null),[Pe,Fe]=q.useState(1),[N,P]=q.useState(`list`),[Ie,Re]=q.useState(null),ze=q.useRef(null),[Ve,He]=q.useState(0),[F,Ue]=q.useState({status:`idle`}),[I,L]=q.useState(!1),R=q.useRef(null),{query:z,setQuery:Ke,cursorOffset:qe}=Be({isActive:N===`search`&&F.status!==`searching`,onExit:()=>{P(`list`),M(`tengu_session_search_toggled`,{enabled:!1})},onExitUp:()=>{P(`list`),M(`tengu_session_search_toggled`,{enabled:!1})},passthroughCtrlKeys:[`n`],initialQuery:g||``}),B=q.useDeferredValue(z),[V,H]=q.useState(``);q.useEffect(()=>{if(!B){H(``);return}let e=setTimeout(H,300,B);return()=>clearTimeout(e)},[B]);let[U,Ye]=q.useState(null),[Xe,Ze]=q.useState(!1);q.useEffect(()=>{Te().then(e=>ge(e)),ue(j).then(e=>{Se(e.length>1)})},[j]);let Qe=q.useMemo(()=>new Map(e.map(e=>[e,dt(e)])),[e]),$e=q.useMemo(()=>w?new We(e.map(e=>({log:e,searchableText:Qe.get(e)??``})).filter(e=>e.searchableText),{keys:[`searchableText`],threshold:gt,ignoreLocation:!0,includeScore:!0}):null,[e,Qe,w]),et=q.useMemo(()=>pt(e),[e]),W=et.length>0,G=q.useMemo(()=>W?[`All`,...et]:[],[W,et]),K=G.length>0&&Ve<G.length?Ve:0,nt=G[K],rt=nt===`All`?void 0:nt,lt=+!!W,ut=q.useMemo(()=>{let t=e;return C&&(t=e.filter(e=>{let t=ie(),n=b(e);return!!(t&&n===t||e.customTitle||me(e.messages)||e.firstPrompt||e.customTitle)})),rt!==void 0&&(t=t.filter(e=>e.tag===rt)),O&&E&&(t=t.filter(e=>e.gitBranch===E)),A&&!k&&(t=t.filter(e=>e.projectPath===j)),t},[e,C,rt,O,E,A,k,j]),mt=q.useMemo(()=>{if(!z)return ut;let e=z.toLowerCase();return ut.filter(t=>{let n=De(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)})},[ut,z]);q.useEffect(()=>{w&&B&&B!==V&&Ze(!0)},[B,V,w]),q.useEffect(()=>{if(!w||!V||!$e){Ye(null),Ze(!1);return}let e=setTimeout((e,t,n,r)=>{let i=e.search(t);i.sort((e,t)=>{let n=new Date(e.item.log.modified).getTime(),r=new Date(t.item.log.modified).getTime()-n;return Math.abs(r)>_t?r:(e.score??1)-(t.score??1)}),n({results:i.map(e=>({log:e.item.log,score:e.score,searchableText:e.item.searchableText})),query:t}),r(!1)},0,$e,V,Ye,Ze);return()=>{clearTimeout(e)}},[V,$e,w]);let{filteredLogs:ht,snippets:Y}=q.useMemo(()=>{let e=new Map,t=mt;if(U&&V&&U.query===V){for(let t of U.results)if(t.searchableText){let n=ot(t.searchableText,V,vt);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}},[mt,U,V]),X=q.useMemo(()=>F.status===`results`&&F.results.length>0?F.results:ht,[F,ht]),Z=Math.max(30,x-4),yt=q.useMemo(()=>{if(!C)return[];let e=ft(X);return Array.from(e.entries()).map(([e,t])=>{let n=t[0],r=X.indexOf(n),i=Y.get(n),a=i?at(i,he):null;if(t.length===1){let t=ct(n,{showProjectPath:_});return{id:`log:${e}:0`,value:{log:n,indexInFiltered:r},label:st(n,Z),description:a?`${t}\n ${a}`:t,dimDescription:!0}}let o=t.length-1,s=t.slice(1).map((t,n)=>{let r=X.indexOf(t),i=Y.get(t),a=i?at(i,he):null,o=ct(t,{isChild:!0,showProjectPath:_});return{id:`log:${e}:${n+1}`,value:{log:t,indexInFiltered:r},label:st(t,Z,{isChild:!0}),description:a?`${o}\n ${a}`:o,dimDescription:!0}}),c=ct(n,{showProjectPath:_});return{id:`group:${e}`,value:{log:n,indexInFiltered:r},label:st(n,Z,{isGroupHeader:!0,forkCount:o}),description:a?`${c}\n ${a}`:c,dimDescription:!0,children:s}})},[C,X,Z,_,Y,he]),bt=q.useMemo(()=>C?[]:X.map((e,t)=>{let n=it(De(e)+(e.isSidechain?` (sidechain)`:``),Z),r=je(e),i=_&&e.projectPath?` · ${e.projectPath}`:``,a=Y.get(e),o=a?at(a,he):null;return{label:n,description:o?`${r}${i}\n ${o}`:r+i,dimDescription:!0,value:t.toString()}}),[C,X,he,Z,_,Y]),Q=Me?.value.log??null,xt=()=>{if(!C||!Q)return``;let e=b(Q);if(!e)return``;let t=X.filter(t=>b(t)===e);if(!(t.length>1))return``;let n=ke.has(e);return t.indexOf(Q)>0||n?`← to collapse`:`→ to expand`},St=q.useCallback(async()=>{let e=Q?b(Q):void 0;if(!Q||!e){P(`list`),we(``);return}Ce.trim()&&(await ve(e,Ce.trim(),Q.fullPath),C&&h&&h()),P(`list`),we(``)},[Q,Ce,h,C]),Ct=q.useCallback(()=>{P(`list`),M(`tengu_session_search_toggled`,{enabled:!1})},[]),wt=q.useCallback(()=>{P(`search`),M(`tengu_session_search_toggled`,{enabled:!0})},[]),Tt=q.useCallback(async()=>{if(!z.trim()||!y||!T)return;R.current?.abort();let t=new AbortController;R.current=t,Ue({status:`searching`}),M(`tengu_agentic_search_started`,{query_length:z.length});try{let n=await y(z,e,t.signal);if(t.signal.aborted)return;Ue({status:`results`,results:n,query:z}),M(`tengu_agentic_search_completed`,{query_length:z.length,results_count:n.length})}catch(e){if(t.signal.aborted)return;Ue({status:`error`,message:e instanceof Error?e.message:`Search failed`}),M(`tengu_agentic_search_error`,{query_length:z.length})}},[z,y,T,e]);q.useEffect(()=>{F.status!==`idle`&&F.status!==`searching`&&(F.status===`results`&&F.query!==z||F.status===`error`)&&Ue({status:`idle`})},[z,F]),q.useEffect(()=>()=>{R.current?.abort()},[]);let Et=q.useRef(F.status);q.useEffect(()=>{let e=Et.current;if(Et.current=F.status,e===`searching`&&F.status===`results`){if(C&&yt.length>0)Ne(yt[0]);else if(!C&&X.length>0){let e=X[0];Ne({id:`0`,value:{log:e,indexInFiltered:0},label:``})}}},[F.status,C,yt,X]);let Dt=q.useCallback(e=>{let t=parseInt(e,10),n=X[t];!n||ze.current===t.toString()||(ze.current=t.toString(),Ne({id:t.toString(),value:{log:n,indexInFiltered:t},label:``}),Fe(t+1))},[X]),Ot=q.useCallback(e=>{Ne(e);let t=X.findIndex(t=>b(t)===b(e.value.log));t>=0&&Fe(t+1)},[X]);d(`confirm:no`,()=>{R.current?.abort(),Ue({status:`idle`}),M(`tengu_agentic_search_cancelled`,{})},{context:`Confirmation`,isActive:N!==`preview`&&F.status===`searching`}),d(`confirm:no`,()=>{P(`list`),we(``)},{context:`Settings`,isActive:N===`rename`&&F.status!==`searching`}),d(`confirm:no`,()=>{Ke(``),L(!1),o?.()},{context:`Confirmation`,isActive:N!==`preview`&&N!==`rename`&&N!==`search`&&I&&F.status!==`searching`}),ee((e,t)=>{if(N!==`preview`&&F.status!==`searching`&&N!==`rename`)if(N===`search`)e.toLowerCase()===`n`&&t.ctrl?Ct():(t.return||t.downArrow)&&z.trim()&&y&&T&&F.status!==`results`&&L(!0);else{if(I){if(t.return){Tt(),L(!1);return}else if(t.downArrow){L(!1);return}else if(t.upArrow){P(`search`),L(!1);return}}if(W&&t.tab){let e=t.shift?-1:1;He(t=>{let n=((t<G.length?t:0)+G.length+e)%G.length,r=G[n];return M(`tengu_session_tag_filter_changed`,{is_all:r===`All`,tag_count:et.length}),n});return}let n=!t.ctrl&&!t.meta,r=e.toLowerCase();if(r===`a`&&t.ctrl&&v)v(),M(`tengu_session_all_projects_toggled`,{enabled:!_});else if(r===`b`&&t.ctrl){let e=!O;ye(e),M(`tengu_session_branch_filter_toggled`,{enabled:e})}else if(r===`w`&&t.ctrl&&A){let e=!k;xe(e),M(`tengu_session_worktree_filter_toggled`,{enabled:e})}else r===`/`&&n?(P(`search`),M(`tengu_session_search_toggled`,{enabled:!0})):r===`r`&&t.ctrl&&Q?(P(`rename`),we(``),M(`tengu_session_rename_started`,{})):r===`v`&&t.ctrl&&Q?(Re(Q),P(`preview`),M(`tengu_session_preview_opened`,{messageCount:Q.messageCount})):Q&&n&&e.length>0&&!/^\s+$/.test(e)&&(P(`search`),Ke(e),M(`tengu_session_search_toggled`,{enabled:!0}))}},{isActive:!0});let kt=[];O&&E&&kt.push(E),A&&!k&&kt.push(`current worktree`);let At=8+ +(kt.length>0&&N!==`search`)+lt,$=Math.max(1,Math.floor((t-At-2)/3));return q.useEffect(()=>{if(!re)return;let e=$*2;Pe+e>=X.length&&re($*3)},[Pe,$,X.length,re]),e.length===0?null:N===`preview`&&Ie&&C?(0,J.jsx)(Ge,{log:Ie,onExit:()=>{P(`list`),Re(null)},onSelect:m}):(0,J.jsxs)(c,{flexDirection:`column`,height:t-1,children:[(0,J.jsx)(c,{flexShrink:0,children:(0,J.jsx)(i,{color:`suggestion`})}),(0,J.jsx)(c,{flexShrink:0,children:(0,J.jsx)(l,{children:` `})}),W?(0,J.jsx)(Je,{tabs:G,selectedIndex:K,availableWidth:x,showAllProjects:_}):(0,J.jsx)(c,{flexShrink:0,children:(0,J.jsxs)(l,{bold:!0,color:`suggestion`,children:[`Resume Session`,N===`list`&&X.length>$&&(0,J.jsxs)(l,{dimColor:!0,children:[` `,`(`,Pe,` of `,X.length,`)`]})]})}),(0,J.jsx)(te,{query:z,isFocused:N===`search`,isTerminalFocused:ce,cursorOffset:qe}),kt.length>0&&N!==`search`&&(0,J.jsx)(c,{flexShrink:0,paddingLeft:2,children:(0,J.jsx)(l,{dimColor:!0,children:(0,J.jsx)(u,{children:kt})})}),(0,J.jsx)(c,{flexShrink:0,children:(0,J.jsx)(l,{children:` `})}),F.status===`searching`&&(0,J.jsxs)(c,{paddingLeft:1,flexShrink:0,children:[(0,J.jsx)(fe,{}),(0,J.jsx)(l,{children:` Searching…`})]}),F.status===`results`&&F.results.length>0&&(0,J.jsx)(c,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(l,{dimColor:!0,italic:!0,children:`Claude found these results:`})}),F.status===`results`&&F.results.length===0&&ht.length===0&&(0,J.jsx)(c,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(l,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),F.status===`error`&&ht.length===0&&(0,J.jsx)(c,{paddingLeft:1,marginBottom:1,flexShrink:0,children:(0,J.jsx)(l,{dimColor:!0,italic:!0,children:`No matching sessions found.`})}),!!z.trim()&&y&&T&&F.status!==`searching`&&F.status!==`results`&&F.status!==`error`&&(0,J.jsxs)(c,{flexShrink:0,flexDirection:`column`,children:[(0,J.jsxs)(c,{flexDirection:`row`,gap:1,children:[(0,J.jsx)(l,{color:I?`suggestion`:void 0,children:I?r.pointer:` `}),(0,J.jsx)(l,{color:I?`suggestion`:void 0,bold:I,children:`Search deeply using Claude →`})]}),(0,J.jsx)(c,{height:1})]}),F.status===`searching`?null:N===`rename`&&Q?(0,J.jsxs)(c,{paddingLeft:2,flexDirection:`column`,children:[(0,J.jsx)(l,{bold:!0,children:`Rename session:`}),(0,J.jsx)(c,{paddingTop:1,children:(0,J.jsx)(_e,{value:Ce,onChange:we,onSubmit:St,placeholder:De(Q,`Enter new session name`),columns:x,cursorOffset:Ee,onChangeCursorOffset:Oe,showCursor:!0})})]}):C?(0,J.jsx)(tt,{nodes:yt,onSelect:e=>{m(e.value.log)},onFocus:Ot,onCancel:o,focusNodeId:Me?.id,visibleOptionCount:$,layout:`expanded`,isDisabled:N===`search`||I,hideIndexes:!1,isNodeExpanded:e=>{if(N===`search`||O)return!0;let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;return t?ke.has(t):!1},onExpand:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&(Ae(e=>new Set(e).add(t)),M(`tengu_session_group_expanded`,{}))},onCollapse:e=>{let t=typeof e==`string`&&e.startsWith(`group:`)?e.substring(6):null;t&&Ae(e=>{let n=new Set(e);return n.delete(t),n})},onUpFromFirstItem:wt}):(0,J.jsx)(be,{options:bt,onChange:e=>{let t=X[parseInt(e,10)];t&&m(t)},visibleOptionCount:$,onCancel:o,onFocus:Dt,defaultFocusValue:Me?.id.toString(),layout:`expanded`,isDisabled:N===`search`||I,onUpFromFirstItem:wt}),(0,J.jsx)(c,{paddingLeft:2,children:S.pending?(0,J.jsxs)(l,{dimColor:!0,children:[`Press `,S.keyName,` again to exit`]}):N===`rename`?(0,J.jsx)(l,{dimColor:!0,children:(0,J.jsxs)(u,{children:[(0,J.jsx)(a,{shortcut:`Enter`,action:`save`}),(0,J.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):F.status===`searching`?(0,J.jsx)(l,{dimColor:!0,children:(0,J.jsxs)(u,{children:[(0,J.jsx)(l,{children:`Searching with Claude…`}),(0,J.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):I?(0,J.jsx)(l,{dimColor:!0,children:(0,J.jsxs)(u,{children:[(0,J.jsx)(a,{shortcut:`Enter`,action:`search`}),(0,J.jsx)(a,{shortcut:`↓`,action:`skip`}),(0,J.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})}):N===`search`?(0,J.jsx)(l,{dimColor:!0,children:(0,J.jsxs)(u,{children:[(0,J.jsx)(l,{children:Xe&&w?`Searching…`:`Type to Search`}),(0,J.jsx)(a,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`clear`})]})}):(0,J.jsx)(l,{dimColor:!0,children:(0,J.jsxs)(u,{children:[v&&(0,J.jsx)(a,{shortcut:`Ctrl+A`,action:`show ${_?`current dir`:`all projects`}`}),E&&(0,J.jsx)(a,{shortcut:`Ctrl+B`,action:`toggle branch`}),A&&(0,J.jsx)(a,{shortcut:`Ctrl+W`,action:`show ${k?`current worktree`:`all worktrees`}`}),(0,J.jsx)(a,{shortcut:`Ctrl+V`,action:`preview`}),(0,J.jsx)(a,{shortcut:`Ctrl+R`,action:`rename`}),(0,J.jsx)(l,{children:`Type to search`}),(0,J.jsx)(D,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`}),xt()&&(0,J.jsx)(l,{children:xt()})]})})})]})}function ut(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 dt(e){let t=(e.messages.length<=Y?e.messages:[...e.messages.slice(0,X),...e.messages.slice(-1e3)]).map(ut).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 ft(e){let t=new Map;for(let n of e){let e=b(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 pt(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,mt,ht,Y,X,Z,gt,_t,vt,yt=e((()=>{m(),n(),He(),q=t(h(),1),y(),Re(),Ve(),ye(),g(),C(),Ae(),Pe(),x(),Ee(),Oe(),T(),O(),ce(),oe(),ze(),z(),ge(),G(),he(),rt(),J=v(),mt=2,ht=4,Y=2e3,X=1e3,Z=5e4,gt=.3,_t=60*1e3,vt=50}));function bt(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 Q(e){if(e.length===0)return``;let t=(e.length<=wt?e:[...e.slice(0,wt/2),...e.slice(-100/2)]).map(bt).filter(Boolean).join(` `).replace(/\s+/g,` `).trim();return t.length>Ct?t.slice(0,Ct)+`…`:t}function xt(e,t){return!!(De(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&&Q(e.messages).toLowerCase().includes(t))}async function St(e,t,n){if(!e.trim()||t.length===0)return[];let r=e.toLowerCase(),i=t.filter(e=>xt(e,r)),a;if(i.length>=Tt)a=i.slice(0,Tt);else{let e=t.filter(e=>!xt(e,r)),n=Tt-i.length;a=[...i,...e.slice(0,n)]}j(`Agentic search: ${a.length}/${t.length} logs, query="${e}", matching: ${i.length}, with messages: ${Ce(a,e=>e.messages?.length>0)}`);let o=a.map(async e=>{if(S(e))try{return await w(e)}catch(t){return ke(t),e}return e}),s=await Promise.all(o);j(`Agentic search: loaded ${Ce(s,e=>e.messages?.length>0)}/${a.length} logs with transcripts`);let c=`Sessions:
2
+ ${s.map((e,t)=>{let n=[`${t}:`],r=De(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=Q(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.`;j(`Agentic search prompt (first 500 chars): ${c.slice(0,500)}...`);try{let e=N();j(`Agentic search using model: ${e}`);let t=(await de({model:e,system:Et,messages:[{role:`user`,content:c}],signal:n,querySource:`session_search`})).content.find(e=>e.type===`text`);if(!t||t.type!==`text`)return j(`No text content in agentic search response`),[];j(`Agentic search response: ${t.text}`);let r=t.text.match(/\{[\s\S]*\}/);if(!r)return j(`Could not find JSON in agentic search response`),[];let i=(xe(r[0]).relevant_indices||[]).filter(e=>e>=0&&e<s.length).map(e=>s[e]);return j(`Agentic search found ${i.length} relevant sessions`),i}catch(e){return ke(e),j(`Agentic search error: ${e}`),[]}}var Ct,wt,Tt,Et,Dt=e((()=>{we(),Se(),Oe(),Fe(),T(),k(),A(),Ct=2e3,wt=100,Tt=100,Et=`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 Ot(e,t,n){let r=ae();if(!t||!e.projectPath||e.projectPath===r)return{isCrossProject:!1};if(process.env.USER_TYPE!==`ant`){let t=b(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${P([e.projectPath])} && claude --resume ${t}`,projectPath:e.projectPath}}if(n.some(t=>e.projectPath===t||e.projectPath.startsWith(t+I)))return{isCrossProject:!0,isSameRepoWorktree:!0,projectPath:e.projectPath};let i=b(e);return{isCrossProject:!0,isSameRepoWorktree:!1,command:`cd ${P([e.projectPath])} && claude --resume ${i}`,projectPath:e.projectPath}}var kt=e((()=>{y(),Ie(),T()}));export{lt as a,Dt as i,kt as n,yt as o,St as r,Ot as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./cwd-C5ce-7WB.js";e();export{t as getCwd};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$t as t,O as n,tt as r}from"./state-C2OSZkV1.js";import{AsyncLocalStorage as i}from"async_hooks";function a(e,t){return c.run(e,t)}function o(){return c.getStore()??n()}function s(){try{return o()}catch{return r()}}var c,l=e((()=>{t(),c=new i}));export{a as i,l as n,o as r,s as t};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,r){let i=r?r.trim().split(/\s+/):[],a=i[0]||`status`;return a===`attach`?(e("Use `claude daemon attach` from the CLI. Attach is not available inside the REPL.",{display:`system`}),null):(e((await n(async()=>{if(a===`bg`)await(await import(`./bg-B0iMGM9C.js`)).handleBgStart(i.slice(1));else{let{daemonMain:e}=await import(`./main-D862LI_d.js`);await e([a,...i.slice(1)])}})).join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,r){let i=r?r.trim().split(/\s+/):[],a=i[0]||`status`;return a===`attach`?(e("Use `claude daemon attach` from the CLI. Attach is not available inside the REPL.",{display:`system`}),null):(e((await n(async()=>{if(a===`bg`)await(await import(`./bg-BK_9J6F6.js`)).handleBgStart(i.slice(1));else{let{daemonMain:e}=await import(`./main-BLD4QAQg.js`);await e([a,...i.slice(1)])}})).join(`
2
2
  `)||`Done.`,{display:`system`}),null)}async function n(e){let t=[],n=console.log,r=console.error;console.log=(...e)=>t.push(e.map(String).join(` `)),console.error=(...e)=>t.push(e.map(String).join(` `));try{await e()}finally{console.log=n,console.error=r}return t}e((()=>{}))();export{t as call};
@@ -1 +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{f as a,g as o}from"./config-DmomySWC.js";import{o as s,s as c}from"./log-BMCygSzM.js";import{Si as l,W as u,_ as d,r as f,wi as p,z as m}from"./model-CKkOnnnx.js";import{Z as h,et as g}from"./esm-D5q6s4l8.js";import{f as _,p as v}from"./firstPartyEventLogger-CoSUd0a1.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(l()!==`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`),process.env.USER_TYPE!==`ant`&&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(),d(),p(),u(),_(),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_brief_mode_enabled.tengu_brief_mode_toggled.tengu_brief_send.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`,`kairosActive`,`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};
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{f as a,g as o}from"./config-CE058cvr.js";import{o as s,s as c}from"./log-CZ0zYP_c.js";import{W as l,_ as u,bi as d,r as f,vi as p,z as m}from"./model-CwO-g1RW.js";import{Z as h,et as g}from"./esm-BLPbfHQd.js";import{f as _,p as v}from"./firstPartyEventLogger-D5ohKbIe.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(p()!==`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`),process.env.USER_TYPE!==`ant`&&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(),d(),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_brief_mode_enabled.tengu_brief_mode_toggled.tengu_brief_send.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`,`kairosActive`,`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};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{en as l,ht as u}from"./state-ix0xIunV.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n&&n[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r&&r[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,x=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new Fe({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Le(t,a,r,i,o):t===401?new Re(t,a,r,i,o):t===403?new ze(t,a,r,i,o):t===404?new Be(t,a,r,i,o):t===409?new Ve(t,a,r,i,o):t===422?new He(t,a,r,i,o):t===429?new Ue(t,a,r,i,o):t>=500?new We(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Fe=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Ie=class extends Fe{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{},We=class extends y{}}));function Ge(e){return typeof e==`object`?e??{}:{}}function Ke(e){if(!e)return!0;for(let t in e)return!1;return!0}function qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Je,Ye,Xe,Ze,Qe,$e,et=e((()=>{x(),Je=/^[a-z][a-z0-9+.-]*:/i,Ye=e=>Je.test(e),Xe=e=>(Xe=Array.isArray,Xe(e)),Ze=Xe,Qe=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},$e=e=>{try{return JSON.parse(e)}catch{return}}})),tt,nt=e((()=>{tt=e=>new Promise(t=>setTimeout(t,e))})),S,rt=e((()=>{S=`0.81.0`}));function it(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function at(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var ot,st,ct,lt,ut,dt,ft=e((()=>{rt(),ot=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,st=()=>{let e=it();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(Deno.build.os),"X-Stainless-Arch":ct(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(globalThis.process.platform??`unknown`),"X-Stainless-Arch":ct(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=at();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},ct=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,lt=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),dt=()=>ut??(ut=st())}));function pt(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function mt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ht(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return mt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function gt(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function _t(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var vt=e((()=>{})),yt,bt=e((()=>{yt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function xt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var St=e((()=>{x()}));function Ct(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function wt(e){let t;return(Et??(t=new globalThis.TextEncoder,Et=t.encode.bind(t)))(e)}function Tt(e){let t;return(Dt??(t=new globalThis.TextDecoder,Dt=t.decode.bind(t)))(e)}var Et,Dt,Ot=e((()=>{}));function kt(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function At(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var C,w,T,jt=e((()=>{_(),Ot(),T=class{constructor(){C.set(this,void 0),w.set(this,void 0),h(this,C,new Uint8Array,`f`),h(this,w,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?wt(e):e;h(this,C,Ct([g(this,C,`f`),t]),`f`);let n=[],r;for(;(r=kt(g(this,C,`f`),g(this,w,`f`)))!=null;){if(r.carriage&&g(this,w,`f`)==null){h(this,w,r.index,`f`);continue}if(g(this,w,`f`)!=null&&(r.index!==g(this,w,`f`)+1||r.carriage)){n.push(Tt(g(this,C,`f`).subarray(0,g(this,w,`f`)-1))),h(this,C,g(this,C,`f`).subarray(g(this,w,`f`)),`f`),h(this,w,null,`f`);continue}let e=g(this,w,`f`)===null?r.preceding:r.preceding-1,t=Tt(g(this,C,`f`).subarray(0,e));n.push(t),h(this,C,g(this,C,`f`).subarray(r.index),`f`),h(this,w,null,`f`)}return n}flush(){return g(this,C,`f`).length?this.decode(`
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{l as i,n as a,o}from"./envUtils-DSxRz_kt.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{$t as l,mt as u}from"./state-C2OSZkV1.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n&&n[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n&&n[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r&&r[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i&&i[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,We,x=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new Fe({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Le(t,a,r,i,o):t===401?new Re(t,a,r,i,o):t===403?new ze(t,a,r,i,o):t===404?new Be(t,a,r,i,o):t===409?new Ve(t,a,r,i,o):t===422?new He(t,a,r,i,o):t===429?new Ue(t,a,r,i,o):t>=500?new We(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},Fe=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Ie=class extends Fe{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{},We=class extends y{}}));function Ge(e){return typeof e==`object`?e??{}:{}}function Ke(e){if(!e)return!0;for(let t in e)return!1;return!0}function qe(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var Je,Ye,Xe,Ze,Qe,$e,et=e((()=>{x(),Je=/^[a-z][a-z0-9+.-]*:/i,Ye=e=>Je.test(e),Xe=e=>(Xe=Array.isArray,Xe(e)),Ze=Xe,Qe=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},$e=e=>{try{return JSON.parse(e)}catch{return}}})),tt,nt=e((()=>{tt=e=>new Promise(t=>setTimeout(t,e))})),S,rt=e((()=>{S=`0.81.0`}));function it(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function at(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var ot,st,ct,lt,ut,dt,ft=e((()=>{rt(),ot=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,st=()=>{let e=it();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(Deno.build.os),"X-Stainless-Arch":ct(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":lt(globalThis.process.platform??`unknown`),"X-Stainless-Arch":ct(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=at();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":S,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},ct=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,lt=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),dt=()=>ut??(ut=st())}));function pt(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function mt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function ht(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return mt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function gt(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function _t(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var vt=e((()=>{})),yt,bt=e((()=>{yt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function xt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var St=e((()=>{x()}));function Ct(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function wt(e){let t;return(Et??(t=new globalThis.TextEncoder,Et=t.encode.bind(t)))(e)}function Tt(e){let t;return(Dt??(t=new globalThis.TextDecoder,Dt=t.decode.bind(t)))(e)}var Et,Dt,Ot=e((()=>{}));function kt(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function At(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var C,w,T,jt=e((()=>{_(),Ot(),T=class{constructor(){C.set(this,void 0),w.set(this,void 0),h(this,C,new Uint8Array,`f`),h(this,w,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?wt(e):e;h(this,C,Ct([g(this,C,`f`),t]),`f`);let n=[],r;for(;(r=kt(g(this,C,`f`),g(this,w,`f`)))!=null;){if(r.carriage&&g(this,w,`f`)==null){h(this,w,r.index,`f`);continue}if(g(this,w,`f`)!=null&&(r.index!==g(this,w,`f`)+1||r.carriage)){n.push(Tt(g(this,C,`f`).subarray(0,g(this,w,`f`)-1))),h(this,C,g(this,C,`f`).subarray(g(this,w,`f`)),`f`),h(this,w,null,`f`);continue}let e=g(this,w,`f`)===null?r.preceding:r.preceding-1,t=Tt(g(this,C,`f`).subarray(0,e));n.push(t),h(this,C,g(this,C,`f`).subarray(r.index),`f`),h(this,w,null,`f`)}return n}flush(){return g(this,C,`f`).length?this.decode(`
2
2
  `):[]}},C=new WeakMap,w=new WeakMap,T.NEWLINE_CHARS=new Set([`
3
3
  `,`\r`]),T.NEWLINE_REGEXP=/\r\n|[\n\r]/g}));function Mt(){}function Nt(e,t,n){return!t||Pt[e]>Pt[n]?Mt:t[e].bind(t)}function E(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return It;let r=Lt.get(t);if(r&&r[0]===n)return r[1];let i={error:Nt(`error`,t,n),warn:Nt(`warn`,t,n),info:Nt(`info`,t,n),debug:Nt(`debug`,t,n)};return Lt.set(t,[n,i]),i}var Pt,Ft,It,Lt,D,Rt=e((()=>{et(),Pt={off:0,error:200,warn:300,info:400,debug:500},Ft=(e,t,n)=>{if(e){if(qe(Pt,e))return e;E(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Pt))}`)}},It={error:Mt,warn:Mt,info:Mt,debug:Mt},Lt=new WeakMap,D=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t]))),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e)}));async function*zt(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new v(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new v(`Attempted to iterate over a response with no body`);let n=new Ut,r=new T,i=gt(e.body);for await(let e of Bt(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Bt(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?wt(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=At(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function Vt(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}var Ht,O,Ut,Wt=e((()=>{_(),x(),vt(),jt(),Pe(),et(),Ot(),Rt(),O=class e{constructor(e,t,n){this.iterator=e,Ht.set(this,void 0),this.controller=t,h(this,Ht,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?E(r):console;async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of zt(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=$e(e.data)??e.data,r=n?.error?.type;throw new y(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new T,n=gt(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ht=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,g(this,Ht,`f`)),new e(()=>i(n),this.controller,g(this,Ht,`f`))]}toReadableStream(){let e=this,t;return mt({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=wt(JSON.stringify(n)+`
4
4
  `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Ut=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{F as t,S as n,a as r,l as i,w as a,z as o}from"./debug-RZ4NuXyS.js";import{n as s,r as c}from"./analytics-CkYUHW_U.js";function l(e){return e.replace(_,(e,t,n)=>n.length<v?`"${t}":"[REDACTED]"`:`"${t}":"${`${n.slice(0,8)}...${n.slice(-4)}`}"`)}function u(e){let t=e.replace(/\n/g,`\\n`);return t.length<=g?t:t.slice(0,g)+`... (${t.length} chars)`}function d(e){let t=l(typeof e==`string`?e:a(e));return t.length<=g?t:t.slice(0,g)+`... (${t.length} chars)`}function f(e){let n=t(e);if(e&&typeof e==`object`&&`response`in e){let t=e.response;if(t?.data&&typeof t.data==`object`){let e=t.data,r=typeof e.message==`string`?e.message:typeof e.error==`object`&&e.error&&`message`in e.error&&typeof e.error.message==`string`?e.error.message:void 0;if(r)return`${n}: ${r}`}}return n}function p(e){if(e&&typeof e==`object`&&`response`in e&&e.response&&typeof e.response.status==`number`)return e.response.status}function m(e){if(!(!e||typeof e!=`object`)){if(`message`in e&&typeof e.message==`string`)return e.message;if(`error`in e&&e.error!==null&&typeof e.error==`object`&&`message`in e.error&&typeof e.error.message==`string`)return e.error.message}}function h(e,t,n){t&&i(t),c(`tengu_bridge_repl_skipped`,{reason:e,...n!==void 0&&{v2:n}})}var g,_,v,y=e((()=>{s(),r(),o(),n(),g=2e3,_=RegExp(`"(${[`session_ingress_token`,`environment_secret`,`access_token`,`secret`,`token`].join(`|`)})"\\s*:\\s*"([^"]*)"`,`g`),v=16}));export{p as a,m as i,u as n,y as o,f as r,h as s,d as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{i as r,o as i,t as a}from"./cliLaunch-BkPAatcs.js";import{dirname as o}from"path";import{closeSync as s,createReadStream as c,mkdirSync as l,openSync as u,readSync as d,statSync as f,unwatchFile as p,watchFile as m}from"fs";import{createInterface as h}from"readline";async function g(e){let t=0;try{if(t=f(e).size,t>0){let n=h({input:c(e,{start:0,end:t-1})});for await(let e of n)process.stdout.write(e+`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{i as r,o as i,t as a}from"./cliLaunch-CQjLYRzM.js";import{dirname as o}from"path";import{closeSync as s,createReadStream as c,mkdirSync as l,openSync as u,readSync as d,statSync as f,unwatchFile as p,watchFile as m}from"fs";import{createInterface as h}from"readline";async function g(e){let t=0;try{if(t=f(e).size,t>0){let n=h({input:c(e,{start:0,end:t-1})});for await(let e of n)process.stdout.write(e+`
2
2
  `)}}catch{}return console.log(`
3
3
  [tail] Watching for new output... (Ctrl+C to detach)
4
4
  `),new Promise(n=>{let r=()=>{p(e),process.removeListener(`SIGINT`,r),console.log(`
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-CYmmnQVS.js";import{a as r,l as i}from"./debug-BrXObCdR.js";import{_ as a,p as o}from"./git-Do0wJvux.js";function s(){p.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(p.has(e))return p.get(e)??null;try{let t=await o();if(i(`Git remote URL: ${t}`),!t)return i(`No git remote URL found`),p.set(e,null),null;let n=u(t);return i(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),p.set(e,n),n}catch(t){return i(`Error detecting repository: ${t}`),p.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return f(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return f(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){let t=e.trim(),n=u(t);if(n)return n.host===`github.com`?`${n.owner}/${n.name}`:null;if(!t.includes(`://`)&&!t.includes(`@`)&&t.includes(`/`)){let e=t.split(`/`);if(e.length===2&&e[0]&&e[1]){let t=e[1].replace(/\.git$/,``);return`${e[0]}/${t}`}}return i(`Could not parse repository from: ${t}`),null}function f(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var p,m=e((()=>{t(),r(),a(),p=new Map}));export{d as a,m as i,c as n,u as o,l as r,s as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-C5ce-7WB.js";import{a as r,l as i}from"./debug-RZ4NuXyS.js";import{m as a,u as o}from"./git-BerW9bId.js";function s(){p.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(p.has(e))return p.get(e)??null;try{let t=await o();if(i(`Git remote URL: ${t}`),!t)return i(`No git remote URL found`),p.set(e,null),null;let n=u(t);return i(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),p.set(e,n),n}catch(t){return i(`Error detecting repository: ${t}`),p.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return f(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return f(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){let t=e.trim(),n=u(t);if(n)return n.host===`github.com`?`${n.owner}/${n.name}`:null;if(!t.includes(`://`)&&!t.includes(`@`)&&t.includes(`/`)){let e=t.split(`/`);if(e.length===2&&e[0]&&e[1]){let t=e[1].replace(/\.git$/,``);return`${e[0]}/${t}`}}return i(`Could not parse repository from: ${t}`),null}function f(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var p,m=e((()=>{t(),r(),a(),p=new Map}));export{d as a,m as i,c as n,u as o,l as r,s as t};
@@ -0,0 +1 @@
1
+ import{a as e,i as t,o as n}from"./detectRepository-CFiHe6Rv.js";t();export{e as parseGitHubRepository,n as parseGitRemote};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-C4XSSjvV.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-AC5DSJrq.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-C5ce-7WB.js";import{d as r,p as i}from"./debug-RZ4NuXyS.js";import{o as a,s as o}from"./log-CZ0zYP_c.js";import{a as s,i as c}from"./memoize-B8hfb1JN.js";import{i as l,n as u}from"./path-Cv9QMBAX.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||n(),prefix:``};let r=u(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:r,prefix:``}:{directory:f(r),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await r().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return o(e),[]}}async function _(e,t={}){let{basePath:r=n(),maxResults:i=10}=t,{directory:a,prefix:o}=h(e,r),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,i).map(e=>({id:e.path,displayText:e.name+`/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,i=w.get(n);if(i)return i;try{let i=(await r().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,i),i}catch(e){return o(e),[]}}async function b(e,t={}){let{basePath:r=n(),maxResults:i=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,r),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,i),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.`+m))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?t+`/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{s(),t(),i(),a(),l(),x=500,S=300*1e3,C=new c({max:x,ttl:S}),w=new c({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-lhUBhEy5.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
@@ -1,6 +1,6 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,E as r,I as i,M as a,N as o,P as s,S as c,T as l,b as u,d,g as f,h as p,r as m}from"./lazySchema-DcIJE_0i.js";import{Or as h,Zn as g,_t as _,en as v,kr as y,nt as b,vr as x}from"./state-ix0xIunV.js";import{G as ee,Hy as te,Md as ne,Qi as re,Vy as S,W as ie,Xu as ae,Yu as oe,_f as se,aw as ce,gr as C,i as le,iw as ue,jd as de,jr as fe,o as pe,qi as me,va as he,vf as ge,ya as _e}from"./loadAgentsDir-D206qwP3.js";import{f as ve,g as ye}from"./settings-BovzmwMP.js";import{g as be,r as xe}from"./config-DmomySWC.js";import{l as w,p as T,r as Se}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{_ as Ce,u as we}from"./model-CKkOnnnx.js";import{Tn as Te,wn as Ee}from"./prompt-BNHtszmZ.js";import{o as De,t as Oe}from"./fileStateCache-DDW5toIs.js";import{t as ke}from"./QueryEngine-CZZMl3PB.js";import{dirname as Ae}from"node:path";import{randomUUID as E}from"node:crypto";import{Readable as je,Writable as Me}from"node:stream";import{unlink as Ne}from"node:fs/promises";import*as D from"node:path/posix";import{isAbsolute as Pe,resolve as Fe}from"node:path/posix";m();var O={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},k={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},Ie=r({_meta:n(a(),s()).nullish(),terminal:f().optional().default(!1)}),Le=r({_meta:n(a(),s()).nullish(),label:a().nullish(),name:a(),optional:f().optional().default(!1),secret:f().optional().default(!0)}),Re=r({_meta:n(a(),s()).nullish(),description:a().nullish(),id:a(),name:a()}),ze=r({_meta:n(a(),s()).nullish(),description:a().nullish(),id:a(),link:a().nullish(),name:a(),vars:p(Le)}),Be=r({_meta:n(a(),s()).nullish(),args:p(a()).optional(),description:a().nullish(),env:n(a(),a()).optional(),id:a(),name:a()}),Ve=o([ze.and(r({type:c(`env_var`)})),Be.and(r({type:c(`terminal`)})),Re]),He=r({_meta:n(a(),s()).nullish(),methodId:a()}),Ue=r({_meta:n(a(),s()).nullish()}),We=r({_meta:n(a(),s()).nullish(),blob:a(),mimeType:a().nullish(),uri:a()}),Ge=r({default:f().nullish(),description:a().nullish(),title:a().nullish()}),Ke=r({_meta:n(a(),s()).nullish()}),qe=r({_meta:n(a(),s()).nullish()}),Je=r({amount:l(),currency:a()}),Ye=r({_meta:n(a(),s()).nullish(),terminalId:a()}),Xe=r({_meta:n(a(),s()).nullish(),newText:a(),oldText:a().nullish(),path:a()}),Ze=o([a(),l(),l(),f(),p(a())]),Qe=u(o([r({content:n(a(),Ze).nullish()}).and(r({action:c(`accept`)})),r({action:c(`decline`)}),r({action:c(`cancel`)})]),r({_meta:n(a(),s()).nullish()})),$e=r({_meta:n(a(),s()).nullish()}),et=a(),tt=r({_meta:n(a(),s()).nullish(),elicitationId:et}),nt=c(`object`),rt=c(`string`),it=r({_meta:n(a(),s()).nullish()}),at=r({_meta:n(a(),s()).nullish(),form:$e.nullish(),url:it.nullish()}),ot=r({const:a(),title:a()}),st=r({_meta:n(a(),s()).nullish(),name:a(),value:a()}),ct=r({code:o([c(-32700),c(-32600),c(-32601),c(-32602),c(-32603),c(-32800),c(-32e3),c(-32002),c(-32042),l().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:s().optional(),message:a()}),lt=s(),ut=s(),dt=s(),ft=r({_meta:n(a(),s()).nullish(),readTextFile:f().optional().default(!1),writeTextFile:f().optional().default(!1)}),pt=r({_meta:n(a(),s()).nullish(),name:a(),value:a()}),mt=r({_meta:n(a(),s()).nullish(),name:a(),title:a().nullish(),version:a()}),ht=r({default:l().nullish(),description:a().nullish(),maximum:l().nullish(),minimum:l().nullish(),title:a().nullish()}),gt=r({_meta:n(a(),s()).nullish()}),_t=r({_meta:n(a(),s()).nullish(),additionalDirectories:p(a()).optional(),cursor:a().nullish(),cwd:a().nullish()}),vt=r({_meta:n(a(),s()).nullish()}),yt=r({_meta:n(a(),s()).nullish(),logout:vt.nullish()}),bt=r({_meta:n(a(),s()).nullish()}),xt=r({_meta:n(a(),s()).nullish()}),St=r({_meta:n(a(),s()).nullish(),http:f().optional().default(!1),sse:f().optional().default(!1)}),Ct=r({_meta:n(a(),s()).nullish(),headers:p(pt),name:a(),url:a()}),wt=r({_meta:n(a(),s()).nullish(),headers:p(pt),name:a(),url:a()}),Tt=r({_meta:n(a(),s()).nullish(),args:p(a()),command:a(),env:p(st),name:a()}),A=o([Ct.and(r({type:c(`http`)})),wt.and(r({type:c(`sse`)})),Tt]),j=a(),Et=r({_meta:n(a(),s()).nullish(),description:a().nullish(),modelId:j,name:a()}),Dt=o([c(`error`),c(`warning`),c(`information`),c(`hint`)]),Ot=r({_meta:n(a(),s()).nullish()}),kt=r({_meta:n(a(),s()).nullish()}),At=r({_meta:n(a(),s()).nullish()}),jt=r({_meta:n(a(),s()).nullish()}),Mt=r({_meta:n(a(),s()).nullish()}),Nt=r({_meta:n(a(),s()).nullish(),maxCount:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=r({diff:a(),uri:a()}),Ft=r({endLine:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:a()}),It=r({_meta:n(a(),s()).nullish()}),Lt=r({_meta:n(a(),s()).nullish()}),Rt=r({languageId:a(),text:a(),uri:a()}),zt=r({_meta:n(a(),s()).nullish(),maxCount:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Bt=o([c(`rejected`),c(`ignored`),c(`replaced`),c(`cancelled`)]),Vt=r({excerpts:p(Ft),uri:a()}),Ht=r({_meta:n(a(),s()).nullish()}),Ut=r({_meta:n(a(),s()).nullish()}),Wt=r({name:a(),owner:a(),remoteUrl:a()}),Gt=r({_meta:n(a(),s()).nullish()}),Kt=r({_meta:n(a(),s()).nullish(),jump:It.nullish(),rename:Ut.nullish(),searchAndReplace:Gt.nullish()}),qt=r({id:a(),isRegex:f().nullish(),replace:a(),search:a(),uri:a()}),Jt=o([c(`automatic`),c(`diagnostic`),c(`manual`)]),Yt=r({_meta:n(a(),s()).nullish(),maxCount:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Xt=r({_meta:n(a(),s()).nullish(),diagnostics:Ot.nullish(),editHistory:Nt.nullish(),openFiles:Lt.nullish(),recentFiles:zt.nullish(),relatedSnippets:Ht.nullish(),userActions:Yt.nullish()}),Zt=r({_meta:n(a(),s()).nullish(),additionalDirectories:p(a()).optional(),cwd:a(),mcpServers:p(A)}),Qt=r({default:l().nullish(),description:a().nullish(),maximum:l().nullish(),minimum:l().nullish(),title:a().nullish()}),$t=a(),en=o([c(`allow_once`),c(`allow_always`),c(`reject_once`),c(`reject_always`)]),tn=r({_meta:n(a(),s()).nullish(),kind:en,name:a(),optionId:$t}),nn=o([c(`high`),c(`medium`),c(`low`)]),rn=o([c(`pending`),c(`in_progress`),c(`completed`)]),an=r({_meta:n(a(),s()).nullish(),content:a(),priority:nn,status:rn}),on=r({_meta:n(a(),s()).nullish(),entries:p(an)}),M=r({character:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),sn=r({id:a(),position:M,uri:a()}),cn=r({id:a(),newName:a(),position:M,uri:a()}),ln=r({action:a(),position:M,timestampMs:l(),uri:a()}),un=o([c(`utf-16`),c(`utf-32`),c(`utf-8`)]),dn=r({_meta:n(a(),s()).nullish(),auth:Ie.optional().default({terminal:!1}),elicitation:at.nullish(),fs:ft.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Kt.nullish(),positionEncodings:p(un).optional(),terminal:f().optional().default(!1)}),fn=r({_meta:n(a(),s()).nullish(),audio:f().optional().default(!1),embeddedContext:f().optional().default(!1),image:f().optional().default(!1)}),pn=l().int().gte(0).lte(65535),mn=r({_meta:n(a(),s()).nullish(),clientCapabilities:dn.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:mt.nullish(),protocolVersion:pn}),N=r({end:M,start:M}),hn=r({message:a(),range:N,severity:Dt,uri:a()}),gn=r({languageId:a(),lastFocusedMs:l().nullish(),uri:a(),visibleRange:N.nullish()}),_n=r({_meta:n(a(),s()).nullish(),diagnostics:p(hn).nullish(),editHistory:p(Pt).nullish(),openFiles:p(gn).nullish(),recentFiles:p(Rt).nullish(),relatedSnippets:p(Vt).nullish(),userActions:p(ln).nullish()}),vn=r({newText:a(),range:N}),yn=o([r({cursorPosition:M.nullish(),edits:p(vn),id:a(),uri:a()}).and(r({kind:c(`edit`)})),sn.and(r({kind:c(`jump`)})),cn.and(r({kind:c(`rename`)})),qt.and(r({kind:c(`searchAndReplace`)}))]),bn=r({_meta:n(a(),s()).nullish(),content:a()}),xn=r({_meta:n(a(),s()).nullish()}),P=o([l(),a()]).nullable();r({_meta:n(a(),s()).nullish(),requestId:P});var Sn=r({requestId:P}),Cn=d([`assistant`,`user`]),F=r({_meta:n(a(),s()).nullish(),audience:p(Cn).nullish(),lastModified:a().nullish(),priority:l().nullish()}),wn=r({_meta:n(a(),s()).nullish(),annotations:F.nullish(),data:a(),mimeType:a()}),Tn=r({_meta:n(a(),s()).nullish(),annotations:F.nullish(),data:a(),mimeType:a(),uri:a().nullish()}),En=r({_meta:n(a(),s()).nullish(),annotations:F.nullish(),description:a().nullish(),mimeType:a().nullish(),name:a(),size:l().nullish(),title:a().nullish(),uri:a()}),Dn=r({_meta:n(a(),s()).nullish(),optionId:$t}),On=o([r({outcome:c(`cancelled`)}),Dn.and(r({outcome:c(`selected`)}))]),kn=r({_meta:n(a(),s()).nullish(),outcome:On}),An=r({_meta:n(a(),s()).nullish()}),jn=r({_meta:n(a(),s()).nullish()}),Mn=r({currentValue:f()}),Nn=a(),Pn=a(),Fn=o([c(`mode`),c(`model`),c(`thought_level`),a()]),I=a(),In=r({_meta:n(a(),s()).nullish(),description:a().nullish(),name:a(),value:I}),Ln=r({_meta:n(a(),s()).nullish(),group:Nn,name:a(),options:p(In)}),L=u(o([r({currentValue:I,options:o([p(In),p(Ln)])}).and(r({type:c(`select`)})),Mn.and(r({type:c(`boolean`)}))]),r({_meta:n(a(),s()).nullish(),category:Fn.nullish(),description:a().nullish(),id:Pn,name:a()})),Rn=r({_meta:n(a(),s()).nullish(),configOptions:p(L)}),zn=r({_meta:n(a(),s()).nullish()}),R=a(),Bn=r({_meta:n(a(),s()).nullish(),id:a(),sessionId:R}),Vn=r({_meta:n(a(),s()).nullish(),sessionId:R}),Hn=r({_meta:n(a(),s()).nullish(),sessionId:R}),Un=r({_meta:n(a(),s()).nullish(),sessionId:R}),Wn=r({_meta:n(a(),s()).nullish(),args:p(a()).optional(),command:a(),cwd:a().nullish(),env:p(st).optional(),outputByteLimit:l().nullish(),sessionId:R}),Gn=r({_meta:n(a(),s()).nullish(),sessionId:R,uri:a()}),Kn=r({_meta:n(a(),s()).nullish(),position:M,sessionId:R,uri:a(),version:l(),visibleRange:N}),qn=r({_meta:n(a(),s()).nullish(),languageId:a(),sessionId:R,text:a(),uri:a(),version:l()}),Jn=r({_meta:n(a(),s()).nullish(),sessionId:R,uri:a()}),Yn=r({_meta:n(a(),s()).nullish(),additionalDirectories:p(a()).optional(),cwd:a(),mcpServers:p(A).optional(),sessionId:R}),Xn=r({_meta:n(a(),s()).nullish(),sessionId:R,terminalId:a()}),Zn=r({_meta:n(a(),s()).nullish(),additionalDirectories:p(a()).optional(),cwd:a(),mcpServers:p(A),sessionId:R}),Qn=r({_meta:n(a(),s()).nullish(),limit:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:a(),sessionId:R}),$n=r({_meta:n(a(),s()).nullish(),id:a(),reason:Bt.nullish(),sessionId:R}),er=r({_meta:n(a(),s()).nullish(),sessionId:R,terminalId:a()}),tr=r({_meta:n(a(),s()).nullish(),additionalDirectories:p(a()).optional(),cwd:a(),mcpServers:p(A).optional(),sessionId:R}),nr=r({_meta:n(a(),s()).nullish(),additionalDirectories:p(a()).optional(),cwd:a(),sessionId:R,title:a().nullish(),updatedAt:a().nullish()}),rr=r({_meta:n(a(),s()).nullish(),nextCursor:a().nullish(),sessions:p(nr)}),ir=r({_meta:n(a(),s()).nullish(),title:a().nullish(),updatedAt:a().nullish()}),ar=r({_meta:n(a(),s()).nullish()}),z=a(),or=r({_meta:n(a(),s()).nullish(),currentModeId:z}),sr=r({_meta:n(a(),s()).nullish(),description:a().nullish(),id:z,name:a()}),B=r({_meta:n(a(),s()).nullish(),availableModes:p(sr),currentModeId:z}),V=r({_meta:n(a(),s()).nullish(),availableModels:p(Et),currentModelId:j}),cr=r({_meta:n(a(),s()).nullish(),configOptions:p(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),lr=r({_meta:n(a(),s()).nullish(),configOptions:p(L).nullish(),models:V.nullish(),modes:B.nullish()}),ur=r({_meta:n(a(),s()).nullish(),configOptions:p(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),dr=r({_meta:n(a(),s()).nullish(),configOptions:p(L).nullish(),models:V.nullish(),modes:B.nullish()}),fr=r({_meta:n(a(),s()).nullish()}),pr=r({_meta:n(a(),s()).nullish(),additionalDirectories:An.nullish(),close:jn.nullish(),fork:zn.nullish(),list:ar.nullish(),resume:fr.nullish()}),mr=u(o([r({type:c(`boolean`),value:f()}),r({value:I})]),r({_meta:n(a(),s()).nullish(),configId:Pn,sessionId:R})),hr=r({_meta:n(a(),s()).nullish(),configOptions:p(L)}),gr=r({_meta:n(a(),s()).nullish(),modeId:z,sessionId:R}),_r=r({_meta:n(a(),s()).nullish()}),vr=r({_meta:n(a(),s()).nullish(),modelId:j,sessionId:R}),yr=r({_meta:n(a(),s()).nullish()}),br=r({_meta:n(a(),s()).nullish(),sessionId:R}),xr=o([c(`end_turn`),c(`max_tokens`),c(`max_turn_requests`),c(`refusal`),c(`cancelled`)]),Sr=o([c(`email`),c(`uri`),c(`date`),c(`date-time`)]),Cr=r({default:a().nullish(),description:a().nullish(),enum:p(a()).nullish(),format:Sr.nullish(),maxLength:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:p(ot).nullish(),pattern:a().nullish(),title:a().nullish()}),wr=r({_meta:n(a(),s()).nullish(),context:_n.nullish(),position:M,selection:N.nullish(),sessionId:R,triggerKind:Jt,uri:a(),version:l()}),Tr=r({_meta:n(a(),s()).nullish(),suggestions:p(yn)}),Er=r({_meta:n(a(),s()).nullish(),terminalId:a()}),Dr=r({_meta:n(a(),s()).nullish(),exitCode:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:a().nullish()}),Or=r({_meta:n(a(),s()).nullish(),sessionId:R,terminalId:a()}),kr=r({_meta:n(a(),s()).nullish(),exitStatus:Dr.nullish(),output:a(),truncated:f()}),Ar=r({_meta:n(a(),s()).nullish(),annotations:F.nullish(),text:a()}),jr=r({range:N.nullish(),text:a()}),Mr=r({_meta:n(a(),s()).nullish(),contentChanges:p(jr),sessionId:R,uri:a(),version:l()});r({method:a(),params:o([Vn,qn,Mr,Gn,Jn,Kn,Bn,$n,lt]).nullish()});var Nr=o([c(`full`),c(`incremental`)]),Pr=r({_meta:n(a(),s()).nullish(),syncKind:Nr}),Fr=r({_meta:n(a(),s()).nullish(),didChange:Pr.nullish(),didClose:kt.nullish(),didFocus:At.nullish(),didOpen:jt.nullish(),didSave:Mt.nullish()}),Ir=r({_meta:n(a(),s()).nullish(),document:Fr.nullish()}),Lr=r({_meta:n(a(),s()).nullish(),context:Xt.nullish(),events:Ir.nullish()}),Rr=r({_meta:n(a(),s()).nullish(),auth:yt.optional().default({}),loadSession:f().optional().default(!1),mcpCapabilities:St.optional().default({http:!1,sse:!1}),nes:Lr.nullish(),positionEncoding:un.nullish(),promptCapabilities:fn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:pr.optional().default({})}),zr=r({_meta:n(a(),s()).nullish(),agentCapabilities:Rr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:mt.nullish(),authMethods:p(Ve).optional().default([]),protocolVersion:pn}),Br=o([r({_meta:n(a(),s()).nullish(),mimeType:a().nullish(),text:a(),uri:a()}),We]),Vr=r({_meta:n(a(),s()).nullish(),annotations:F.nullish(),resource:Br}),H=o([Ar.and(r({type:c(`text`)})),Tn.and(r({type:c(`image`)})),wn.and(r({type:c(`audio`)})),En.and(r({type:c(`resource_link`)})),Vr.and(r({type:c(`resource`)}))]),Hr=r({_meta:n(a(),s()).nullish(),content:H}),U=r({_meta:n(a(),s()).nullish(),content:H,messageId:a().nullish()}),Ur=r({_meta:n(a(),s()).nullish(),messageId:a().nullish(),prompt:p(H),sessionId:R}),Wr=r({anyOf:p(ot)}),Gr=o([Hr.and(r({type:c(`content`)})),Xe.and(r({type:c(`diff`)})),Er.and(r({type:c(`terminal`)}))]),W=a(),Kr=r({sessionId:R,toolCallId:W.nullish()}),qr=u(o([Kr,Sn]),r({elicitationId:et,url:a().url()})),Jr=r({_meta:n(a(),s()).nullish(),line:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:a()}),Yr=o([c(`pending`),c(`in_progress`),c(`completed`),c(`failed`)]),Xr=o([c(`read`),c(`edit`),c(`delete`),c(`move`),c(`search`),c(`execute`),c(`think`),c(`fetch`),c(`switch_mode`),c(`other`)]),Zr=r({_meta:n(a(),s()).nullish(),content:p(Gr).optional(),kind:Xr.optional(),locations:p(Jr).optional(),rawInput:s().optional(),rawOutput:s().optional(),status:Yr.optional(),title:a(),toolCallId:W}),Qr=r({_meta:n(a(),s()).nullish(),content:p(Gr).nullish(),kind:Xr.nullish(),locations:p(Jr).nullish(),rawInput:s().optional(),rawOutput:s().optional(),status:Yr.nullish(),title:a().nullish(),toolCallId:W}),$r=r({_meta:n(a(),s()).nullish(),options:p(tn),sessionId:R,toolCall:Qr}),ei=r({_meta:n(a(),s()).nullish(),hint:a()}),ti=r({_meta:n(a(),s()).nullish(),description:a(),input:ei.nullish(),name:a()}),ni=r({_meta:n(a(),s()).nullish(),availableCommands:p(ti)}),ri=o([r({enum:p(a()),type:rt}),Wr]),ii=r({default:p(a()).nullish(),description:a().nullish(),items:ri,maxItems:l().nullish(),minItems:l().nullish(),title:a().nullish()}),ai=o([Cr.and(r({type:c(`string`)})),Qt.and(r({type:c(`number`)})),ht.and(r({type:c(`integer`)})),Ge.and(r({type:c(`boolean`)})),ii.and(r({type:c(`array`)}))]),oi=r({description:a().nullish(),properties:n(a(),ai).optional().default({}),required:p(a()).nullish(),title:a().nullish(),type:nt.optional().default(`object`)}),si=u(o([u(o([Kr,Sn]),r({requestedSchema:oi})).and(r({mode:c(`form`)})),qr.and(r({mode:c(`url`)}))]),r({_meta:n(a(),s()).nullish(),message:a()})),ci=r({cachedReadTokens:l().nullish(),cachedWriteTokens:l().nullish(),inputTokens:l(),outputTokens:l(),thoughtTokens:l().nullish(),totalTokens:l()});o([r({id:P,result:o([zr,Ue,xt,ur,lr,rr,cr,dr,qe,_r,hr,r({_meta:n(a(),s()).nullish(),stopReason:xr,usage:ci.nullish(),userMessageId:a().nullish()}),yr,br,Tr,Ke,dt])}),r({error:ct,id:P})]);var li=r({_meta:n(a(),s()).nullish(),cost:Je.nullish(),size:l(),used:l()}),ui=o([U.and(r({sessionUpdate:c(`user_message_chunk`)})),U.and(r({sessionUpdate:c(`agent_message_chunk`)})),U.and(r({sessionUpdate:c(`agent_thought_chunk`)})),Zr.and(r({sessionUpdate:c(`tool_call`)})),Qr.and(r({sessionUpdate:c(`tool_call_update`)})),on.and(r({sessionUpdate:c(`plan`)})),ni.and(r({sessionUpdate:c(`available_commands_update`)})),or.and(r({sessionUpdate:c(`current_mode_update`)})),Rn.and(r({sessionUpdate:c(`config_option_update`)})),ir.and(r({sessionUpdate:c(`session_info_update`)})),li.and(r({sessionUpdate:c(`usage_update`)}))]),di=r({_meta:n(a(),s()).nullish(),sessionId:R,update:ui});r({method:a(),params:o([di,tt,lt]).nullish()});var fi=r({_meta:n(a(),s()).nullish(),sessionId:R,terminalId:a()}),pi=r({_meta:n(a(),s()).nullish(),exitCode:l().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:a().nullish()}),mi=r({name:a(),uri:a()}),hi=r({_meta:n(a(),s()).nullish(),repository:Wt.nullish(),workspaceFolders:p(mi).nullish(),workspaceUri:a().nullish()});r({id:P,method:a(),params:o([mn,He,bt,Zt,Zn,_t,Yn,tr,Un,gr,mr,Ur,vr,hi,wr,Hn,ut]).nullish()});var gi=r({_meta:n(a(),s()).nullish(),content:a(),path:a(),sessionId:R});r({id:P,method:a(),params:o([gi,Qn,$r,Wn,Or,er,fi,Xn,si,ut]).nullish()}),o([r({id:P,result:o([r({_meta:n(a(),s()).nullish()}),bn,kn,Ye,kr,xn,pi,gt,Qe,dt])}),r({error:ct,id:P})]),e();function _i(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,C as r,M as i,O as a,P as o,b as s,j as c,l,m as u,p as d,v as f,w as p}from"./external-CEp-aPkt.js";import{r as m}from"./lazySchema-B4D4qJVE.js";import{$t as h,Dr as g,Er as _,Yn as v,gr as y,gt as b,tt as x}from"./state-C2OSZkV1.js";import{Cu as ee,G as te,Gl as ne,W as re,Wi as ie,Wl as ae,Yi as oe,Zx as se,gr as S,hc as ce,hl as le,i as ue,jr as de,mc as fe,ml as pe,np as me,o as he,qx as ge,tp as C,wu as _e}from"./loadAgentsDir-ByO8eJqU.js";import{f as ve,g as ye}from"./settings-hQDLwPVj.js";import{g as be,r as xe}from"./config-CE058cvr.js";import{l as Se,p as w,r as T}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{_ as Ce,u as we}from"./model-CwO-g1RW.js";import{bn as Te,xn as Ee}from"./prompt-B7joRiqj.js";import{n as De,r as Oe}from"./managedEnv-C-9XSN14.js";import{t as ke}from"./QueryEngine-Cv_meCam.js";import{dirname as Ae}from"node:path";import{randomUUID as E}from"node:crypto";import{Readable as je,Writable as Me}from"node:stream";import{unlink as Ne}from"node:fs/promises";import*as D from"node:path/posix";import{isAbsolute as Pe,resolve as Fe}from"node:path/posix";m();var O={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},k={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},Ie=p({_meta:a(n(),i()).nullish(),terminal:u().optional().default(!1)}),Le=p({_meta:a(n(),i()).nullish(),label:n().nullish(),name:n(),optional:u().optional().default(!1),secret:u().optional().default(!0)}),Re=p({_meta:a(n(),i()).nullish(),description:n().nullish(),id:n(),name:n()}),ze=p({_meta:a(n(),i()).nullish(),description:n().nullish(),id:n(),link:n().nullish(),name:n(),vars:d(Le)}),Be=p({_meta:a(n(),i()).nullish(),args:d(n()).optional(),description:n().nullish(),env:a(n(),n()).optional(),id:n(),name:n()}),Ve=c([ze.and(p({type:s(`env_var`)})),Be.and(p({type:s(`terminal`)})),Re]),He=p({_meta:a(n(),i()).nullish(),methodId:n()}),Ue=p({_meta:a(n(),i()).nullish()}),We=p({_meta:a(n(),i()).nullish(),blob:n(),mimeType:n().nullish(),uri:n()}),Ge=p({default:u().nullish(),description:n().nullish(),title:n().nullish()}),Ke=p({_meta:a(n(),i()).nullish()}),qe=p({_meta:a(n(),i()).nullish()}),Je=p({amount:r(),currency:n()}),Ye=p({_meta:a(n(),i()).nullish(),terminalId:n()}),Xe=p({_meta:a(n(),i()).nullish(),newText:n(),oldText:n().nullish(),path:n()}),Ze=c([n(),r(),r(),u(),d(n())]),Qe=f(c([p({content:a(n(),Ze).nullish()}).and(p({action:s(`accept`)})),p({action:s(`decline`)}),p({action:s(`cancel`)})]),p({_meta:a(n(),i()).nullish()})),$e=p({_meta:a(n(),i()).nullish()}),et=n(),tt=p({_meta:a(n(),i()).nullish(),elicitationId:et}),nt=s(`object`),rt=s(`string`),it=p({_meta:a(n(),i()).nullish()}),at=p({_meta:a(n(),i()).nullish(),form:$e.nullish(),url:it.nullish()}),ot=p({const:n(),title:n()}),st=p({_meta:a(n(),i()).nullish(),name:n(),value:n()}),ct=p({code:c([s(-32700),s(-32600),s(-32601),s(-32602),s(-32603),s(-32800),s(-32e3),s(-32002),s(-32042),r().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:i().optional(),message:n()}),lt=i(),ut=i(),dt=i(),ft=p({_meta:a(n(),i()).nullish(),readTextFile:u().optional().default(!1),writeTextFile:u().optional().default(!1)}),pt=p({_meta:a(n(),i()).nullish(),name:n(),value:n()}),mt=p({_meta:a(n(),i()).nullish(),name:n(),title:n().nullish(),version:n()}),ht=p({default:r().nullish(),description:n().nullish(),maximum:r().nullish(),minimum:r().nullish(),title:n().nullish()}),gt=p({_meta:a(n(),i()).nullish()}),_t=p({_meta:a(n(),i()).nullish(),additionalDirectories:d(n()).optional(),cursor:n().nullish(),cwd:n().nullish()}),vt=p({_meta:a(n(),i()).nullish()}),yt=p({_meta:a(n(),i()).nullish(),logout:vt.nullish()}),bt=p({_meta:a(n(),i()).nullish()}),xt=p({_meta:a(n(),i()).nullish()}),St=p({_meta:a(n(),i()).nullish(),http:u().optional().default(!1),sse:u().optional().default(!1)}),Ct=p({_meta:a(n(),i()).nullish(),headers:d(pt),name:n(),url:n()}),wt=p({_meta:a(n(),i()).nullish(),headers:d(pt),name:n(),url:n()}),Tt=p({_meta:a(n(),i()).nullish(),args:d(n()),command:n(),env:d(st),name:n()}),A=c([Ct.and(p({type:s(`http`)})),wt.and(p({type:s(`sse`)})),Tt]),j=n(),Et=p({_meta:a(n(),i()).nullish(),description:n().nullish(),modelId:j,name:n()}),Dt=c([s(`error`),s(`warning`),s(`information`),s(`hint`)]),Ot=p({_meta:a(n(),i()).nullish()}),kt=p({_meta:a(n(),i()).nullish()}),At=p({_meta:a(n(),i()).nullish()}),jt=p({_meta:a(n(),i()).nullish()}),Mt=p({_meta:a(n(),i()).nullish()}),Nt=p({_meta:a(n(),i()).nullish(),maxCount:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=p({diff:n(),uri:n()}),Ft=p({endLine:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:n()}),It=p({_meta:a(n(),i()).nullish()}),Lt=p({_meta:a(n(),i()).nullish()}),Rt=p({languageId:n(),text:n(),uri:n()}),zt=p({_meta:a(n(),i()).nullish(),maxCount:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Bt=c([s(`rejected`),s(`ignored`),s(`replaced`),s(`cancelled`)]),Vt=p({excerpts:d(Ft),uri:n()}),Ht=p({_meta:a(n(),i()).nullish()}),Ut=p({_meta:a(n(),i()).nullish()}),Wt=p({name:n(),owner:n(),remoteUrl:n()}),Gt=p({_meta:a(n(),i()).nullish()}),Kt=p({_meta:a(n(),i()).nullish(),jump:It.nullish(),rename:Ut.nullish(),searchAndReplace:Gt.nullish()}),qt=p({id:n(),isRegex:u().nullish(),replace:n(),search:n(),uri:n()}),Jt=c([s(`automatic`),s(`diagnostic`),s(`manual`)]),Yt=p({_meta:a(n(),i()).nullish(),maxCount:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Xt=p({_meta:a(n(),i()).nullish(),diagnostics:Ot.nullish(),editHistory:Nt.nullish(),openFiles:Lt.nullish(),recentFiles:zt.nullish(),relatedSnippets:Ht.nullish(),userActions:Yt.nullish()}),Zt=p({_meta:a(n(),i()).nullish(),additionalDirectories:d(n()).optional(),cwd:n(),mcpServers:d(A)}),Qt=p({default:r().nullish(),description:n().nullish(),maximum:r().nullish(),minimum:r().nullish(),title:n().nullish()}),$t=n(),en=c([s(`allow_once`),s(`allow_always`),s(`reject_once`),s(`reject_always`)]),tn=p({_meta:a(n(),i()).nullish(),kind:en,name:n(),optionId:$t}),nn=c([s(`high`),s(`medium`),s(`low`)]),rn=c([s(`pending`),s(`in_progress`),s(`completed`)]),an=p({_meta:a(n(),i()).nullish(),content:n(),priority:nn,status:rn}),on=p({_meta:a(n(),i()).nullish(),entries:d(an)}),M=p({character:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),sn=p({id:n(),position:M,uri:n()}),cn=p({id:n(),newName:n(),position:M,uri:n()}),ln=p({action:n(),position:M,timestampMs:r(),uri:n()}),un=c([s(`utf-16`),s(`utf-32`),s(`utf-8`)]),dn=p({_meta:a(n(),i()).nullish(),auth:Ie.optional().default({terminal:!1}),elicitation:at.nullish(),fs:ft.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Kt.nullish(),positionEncodings:d(un).optional(),terminal:u().optional().default(!1)}),fn=p({_meta:a(n(),i()).nullish(),audio:u().optional().default(!1),embeddedContext:u().optional().default(!1),image:u().optional().default(!1)}),pn=r().int().gte(0).lte(65535),mn=p({_meta:a(n(),i()).nullish(),clientCapabilities:dn.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:mt.nullish(),protocolVersion:pn}),N=p({end:M,start:M}),hn=p({message:n(),range:N,severity:Dt,uri:n()}),gn=p({languageId:n(),lastFocusedMs:r().nullish(),uri:n(),visibleRange:N.nullish()}),_n=p({_meta:a(n(),i()).nullish(),diagnostics:d(hn).nullish(),editHistory:d(Pt).nullish(),openFiles:d(gn).nullish(),recentFiles:d(Rt).nullish(),relatedSnippets:d(Vt).nullish(),userActions:d(ln).nullish()}),vn=p({newText:n(),range:N}),yn=c([p({cursorPosition:M.nullish(),edits:d(vn),id:n(),uri:n()}).and(p({kind:s(`edit`)})),sn.and(p({kind:s(`jump`)})),cn.and(p({kind:s(`rename`)})),qt.and(p({kind:s(`searchAndReplace`)}))]),bn=p({_meta:a(n(),i()).nullish(),content:n()}),xn=p({_meta:a(n(),i()).nullish()}),P=c([r(),n()]).nullable();p({_meta:a(n(),i()).nullish(),requestId:P});var Sn=p({requestId:P}),Cn=l([`assistant`,`user`]),F=p({_meta:a(n(),i()).nullish(),audience:d(Cn).nullish(),lastModified:n().nullish(),priority:r().nullish()}),wn=p({_meta:a(n(),i()).nullish(),annotations:F.nullish(),data:n(),mimeType:n()}),Tn=p({_meta:a(n(),i()).nullish(),annotations:F.nullish(),data:n(),mimeType:n(),uri:n().nullish()}),En=p({_meta:a(n(),i()).nullish(),annotations:F.nullish(),description:n().nullish(),mimeType:n().nullish(),name:n(),size:r().nullish(),title:n().nullish(),uri:n()}),Dn=p({_meta:a(n(),i()).nullish(),optionId:$t}),On=c([p({outcome:s(`cancelled`)}),Dn.and(p({outcome:s(`selected`)}))]),kn=p({_meta:a(n(),i()).nullish(),outcome:On}),An=p({_meta:a(n(),i()).nullish()}),jn=p({_meta:a(n(),i()).nullish()}),Mn=p({currentValue:u()}),Nn=n(),Pn=n(),Fn=c([s(`mode`),s(`model`),s(`thought_level`),n()]),I=n(),In=p({_meta:a(n(),i()).nullish(),description:n().nullish(),name:n(),value:I}),Ln=p({_meta:a(n(),i()).nullish(),group:Nn,name:n(),options:d(In)}),L=f(c([p({currentValue:I,options:c([d(In),d(Ln)])}).and(p({type:s(`select`)})),Mn.and(p({type:s(`boolean`)}))]),p({_meta:a(n(),i()).nullish(),category:Fn.nullish(),description:n().nullish(),id:Pn,name:n()})),Rn=p({_meta:a(n(),i()).nullish(),configOptions:d(L)}),zn=p({_meta:a(n(),i()).nullish()}),R=n(),Bn=p({_meta:a(n(),i()).nullish(),id:n(),sessionId:R}),Vn=p({_meta:a(n(),i()).nullish(),sessionId:R}),Hn=p({_meta:a(n(),i()).nullish(),sessionId:R}),Un=p({_meta:a(n(),i()).nullish(),sessionId:R}),Wn=p({_meta:a(n(),i()).nullish(),args:d(n()).optional(),command:n(),cwd:n().nullish(),env:d(st).optional(),outputByteLimit:r().nullish(),sessionId:R}),Gn=p({_meta:a(n(),i()).nullish(),sessionId:R,uri:n()}),Kn=p({_meta:a(n(),i()).nullish(),position:M,sessionId:R,uri:n(),version:r(),visibleRange:N}),qn=p({_meta:a(n(),i()).nullish(),languageId:n(),sessionId:R,text:n(),uri:n(),version:r()}),Jn=p({_meta:a(n(),i()).nullish(),sessionId:R,uri:n()}),Yn=p({_meta:a(n(),i()).nullish(),additionalDirectories:d(n()).optional(),cwd:n(),mcpServers:d(A).optional(),sessionId:R}),Xn=p({_meta:a(n(),i()).nullish(),sessionId:R,terminalId:n()}),Zn=p({_meta:a(n(),i()).nullish(),additionalDirectories:d(n()).optional(),cwd:n(),mcpServers:d(A),sessionId:R}),Qn=p({_meta:a(n(),i()).nullish(),limit:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:n(),sessionId:R}),$n=p({_meta:a(n(),i()).nullish(),id:n(),reason:Bt.nullish(),sessionId:R}),er=p({_meta:a(n(),i()).nullish(),sessionId:R,terminalId:n()}),tr=p({_meta:a(n(),i()).nullish(),additionalDirectories:d(n()).optional(),cwd:n(),mcpServers:d(A).optional(),sessionId:R}),nr=p({_meta:a(n(),i()).nullish(),additionalDirectories:d(n()).optional(),cwd:n(),sessionId:R,title:n().nullish(),updatedAt:n().nullish()}),rr=p({_meta:a(n(),i()).nullish(),nextCursor:n().nullish(),sessions:d(nr)}),ir=p({_meta:a(n(),i()).nullish(),title:n().nullish(),updatedAt:n().nullish()}),ar=p({_meta:a(n(),i()).nullish()}),z=n(),or=p({_meta:a(n(),i()).nullish(),currentModeId:z}),sr=p({_meta:a(n(),i()).nullish(),description:n().nullish(),id:z,name:n()}),B=p({_meta:a(n(),i()).nullish(),availableModes:d(sr),currentModeId:z}),V=p({_meta:a(n(),i()).nullish(),availableModels:d(Et),currentModelId:j}),cr=p({_meta:a(n(),i()).nullish(),configOptions:d(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),lr=p({_meta:a(n(),i()).nullish(),configOptions:d(L).nullish(),models:V.nullish(),modes:B.nullish()}),ur=p({_meta:a(n(),i()).nullish(),configOptions:d(L).nullish(),models:V.nullish(),modes:B.nullish(),sessionId:R}),dr=p({_meta:a(n(),i()).nullish(),configOptions:d(L).nullish(),models:V.nullish(),modes:B.nullish()}),fr=p({_meta:a(n(),i()).nullish()}),pr=p({_meta:a(n(),i()).nullish(),additionalDirectories:An.nullish(),close:jn.nullish(),fork:zn.nullish(),list:ar.nullish(),resume:fr.nullish()}),mr=f(c([p({type:s(`boolean`),value:u()}),p({value:I})]),p({_meta:a(n(),i()).nullish(),configId:Pn,sessionId:R})),hr=p({_meta:a(n(),i()).nullish(),configOptions:d(L)}),gr=p({_meta:a(n(),i()).nullish(),modeId:z,sessionId:R}),_r=p({_meta:a(n(),i()).nullish()}),vr=p({_meta:a(n(),i()).nullish(),modelId:j,sessionId:R}),yr=p({_meta:a(n(),i()).nullish()}),br=p({_meta:a(n(),i()).nullish(),sessionId:R}),xr=c([s(`end_turn`),s(`max_tokens`),s(`max_turn_requests`),s(`refusal`),s(`cancelled`)]),Sr=c([s(`email`),s(`uri`),s(`date`),s(`date-time`)]),Cr=p({default:n().nullish(),description:n().nullish(),enum:d(n()).nullish(),format:Sr.nullish(),maxLength:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:d(ot).nullish(),pattern:n().nullish(),title:n().nullish()}),wr=p({_meta:a(n(),i()).nullish(),context:_n.nullish(),position:M,selection:N.nullish(),sessionId:R,triggerKind:Jt,uri:n(),version:r()}),Tr=p({_meta:a(n(),i()).nullish(),suggestions:d(yn)}),Er=p({_meta:a(n(),i()).nullish(),terminalId:n()}),Dr=p({_meta:a(n(),i()).nullish(),exitCode:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:n().nullish()}),Or=p({_meta:a(n(),i()).nullish(),sessionId:R,terminalId:n()}),kr=p({_meta:a(n(),i()).nullish(),exitStatus:Dr.nullish(),output:n(),truncated:u()}),Ar=p({_meta:a(n(),i()).nullish(),annotations:F.nullish(),text:n()}),jr=p({range:N.nullish(),text:n()}),Mr=p({_meta:a(n(),i()).nullish(),contentChanges:d(jr),sessionId:R,uri:n(),version:r()});p({method:n(),params:c([Vn,qn,Mr,Gn,Jn,Kn,Bn,$n,lt]).nullish()});var Nr=c([s(`full`),s(`incremental`)]),Pr=p({_meta:a(n(),i()).nullish(),syncKind:Nr}),Fr=p({_meta:a(n(),i()).nullish(),didChange:Pr.nullish(),didClose:kt.nullish(),didFocus:At.nullish(),didOpen:jt.nullish(),didSave:Mt.nullish()}),Ir=p({_meta:a(n(),i()).nullish(),document:Fr.nullish()}),Lr=p({_meta:a(n(),i()).nullish(),context:Xt.nullish(),events:Ir.nullish()}),Rr=p({_meta:a(n(),i()).nullish(),auth:yt.optional().default({}),loadSession:u().optional().default(!1),mcpCapabilities:St.optional().default({http:!1,sse:!1}),nes:Lr.nullish(),positionEncoding:un.nullish(),promptCapabilities:fn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:pr.optional().default({})}),zr=p({_meta:a(n(),i()).nullish(),agentCapabilities:Rr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:mt.nullish(),authMethods:d(Ve).optional().default([]),protocolVersion:pn}),Br=c([p({_meta:a(n(),i()).nullish(),mimeType:n().nullish(),text:n(),uri:n()}),We]),Vr=p({_meta:a(n(),i()).nullish(),annotations:F.nullish(),resource:Br}),H=c([Ar.and(p({type:s(`text`)})),Tn.and(p({type:s(`image`)})),wn.and(p({type:s(`audio`)})),En.and(p({type:s(`resource_link`)})),Vr.and(p({type:s(`resource`)}))]),Hr=p({_meta:a(n(),i()).nullish(),content:H}),U=p({_meta:a(n(),i()).nullish(),content:H,messageId:n().nullish()}),Ur=p({_meta:a(n(),i()).nullish(),messageId:n().nullish(),prompt:d(H),sessionId:R}),Wr=p({anyOf:d(ot)}),Gr=c([Hr.and(p({type:s(`content`)})),Xe.and(p({type:s(`diff`)})),Er.and(p({type:s(`terminal`)}))]),W=n(),Kr=p({sessionId:R,toolCallId:W.nullish()}),qr=f(c([Kr,Sn]),p({elicitationId:et,url:n().url()})),Jr=p({_meta:a(n(),i()).nullish(),line:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:n()}),Yr=c([s(`pending`),s(`in_progress`),s(`completed`),s(`failed`)]),Xr=c([s(`read`),s(`edit`),s(`delete`),s(`move`),s(`search`),s(`execute`),s(`think`),s(`fetch`),s(`switch_mode`),s(`other`)]),Zr=p({_meta:a(n(),i()).nullish(),content:d(Gr).optional(),kind:Xr.optional(),locations:d(Jr).optional(),rawInput:i().optional(),rawOutput:i().optional(),status:Yr.optional(),title:n(),toolCallId:W}),Qr=p({_meta:a(n(),i()).nullish(),content:d(Gr).nullish(),kind:Xr.nullish(),locations:d(Jr).nullish(),rawInput:i().optional(),rawOutput:i().optional(),status:Yr.nullish(),title:n().nullish(),toolCallId:W}),$r=p({_meta:a(n(),i()).nullish(),options:d(tn),sessionId:R,toolCall:Qr}),ei=p({_meta:a(n(),i()).nullish(),hint:n()}),ti=p({_meta:a(n(),i()).nullish(),description:n(),input:ei.nullish(),name:n()}),ni=p({_meta:a(n(),i()).nullish(),availableCommands:d(ti)}),ri=c([p({enum:d(n()),type:rt}),Wr]),ii=p({default:d(n()).nullish(),description:n().nullish(),items:ri,maxItems:r().nullish(),minItems:r().nullish(),title:n().nullish()}),ai=c([Cr.and(p({type:s(`string`)})),Qt.and(p({type:s(`number`)})),ht.and(p({type:s(`integer`)})),Ge.and(p({type:s(`boolean`)})),ii.and(p({type:s(`array`)}))]),oi=p({description:n().nullish(),properties:a(n(),ai).optional().default({}),required:d(n()).nullish(),title:n().nullish(),type:nt.optional().default(`object`)}),si=f(c([f(c([Kr,Sn]),p({requestedSchema:oi})).and(p({mode:s(`form`)})),qr.and(p({mode:s(`url`)}))]),p({_meta:a(n(),i()).nullish(),message:n()})),ci=p({cachedReadTokens:r().nullish(),cachedWriteTokens:r().nullish(),inputTokens:r(),outputTokens:r(),thoughtTokens:r().nullish(),totalTokens:r()});c([p({id:P,result:c([zr,Ue,xt,ur,lr,rr,cr,dr,qe,_r,hr,p({_meta:a(n(),i()).nullish(),stopReason:xr,usage:ci.nullish(),userMessageId:n().nullish()}),yr,br,Tr,Ke,dt])}),p({error:ct,id:P})]);var li=p({_meta:a(n(),i()).nullish(),cost:Je.nullish(),size:r(),used:r()}),ui=c([U.and(p({sessionUpdate:s(`user_message_chunk`)})),U.and(p({sessionUpdate:s(`agent_message_chunk`)})),U.and(p({sessionUpdate:s(`agent_thought_chunk`)})),Zr.and(p({sessionUpdate:s(`tool_call`)})),Qr.and(p({sessionUpdate:s(`tool_call_update`)})),on.and(p({sessionUpdate:s(`plan`)})),ni.and(p({sessionUpdate:s(`available_commands_update`)})),or.and(p({sessionUpdate:s(`current_mode_update`)})),Rn.and(p({sessionUpdate:s(`config_option_update`)})),ir.and(p({sessionUpdate:s(`session_info_update`)})),li.and(p({sessionUpdate:s(`usage_update`)}))]),di=p({_meta:a(n(),i()).nullish(),sessionId:R,update:ui});p({method:n(),params:c([di,tt,lt]).nullish()});var fi=p({_meta:a(n(),i()).nullish(),sessionId:R,terminalId:n()}),pi=p({_meta:a(n(),i()).nullish(),exitCode:r().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:n().nullish()}),mi=p({name:n(),uri:n()}),hi=p({_meta:a(n(),i()).nullish(),repository:Wt.nullish(),workspaceFolders:d(mi).nullish(),workspaceUri:n().nullish()});p({id:P,method:n(),params:c([mn,He,bt,Zt,Zn,_t,Yn,tr,Un,gr,mr,Ur,vr,hi,wr,Hn,ut]).nullish()});var gi=p({_meta:a(n(),i()).nullish(),content:n(),path:n(),sessionId:R});p({id:P,method:n(),params:c([gi,Qn,$r,Wn,Or,er,fi,Xn,si,ut]).nullish()}),c([p({id:P,result:c([p({_meta:a(n(),i()).nullish()}),bn,kn,Ye,kr,xn,pi,gt,Qe,dt])}),p({error:ct,id:P})]),e();function _i(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
2
2
  `);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
3
- `,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}m();var vi,yi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case O.initialize:{let e=mn.parse(t);return r.initialize(e)}case O.session_new:{let e=Zt.parse(t);return r.newSession(e)}case O.session_load:{if(!r.loadSession)throw G.methodNotFound(e);let n=Zn.parse(t);return r.loadSession(n)}case O.session_list:{if(!r.listSessions)throw G.methodNotFound(e);let n=_t.parse(t);return r.listSessions(n)}case O.session_fork:{if(!r.unstable_forkSession)throw G.methodNotFound(e);let n=Yn.parse(t);return r.unstable_forkSession(n)}case O.session_resume:{if(!r.unstable_resumeSession)throw G.methodNotFound(e);let n=tr.parse(t);return r.unstable_resumeSession(n)}case O.session_close:{if(!r.unstable_closeSession)throw G.methodNotFound(e);let n=Un.parse(t);return r.unstable_closeSession(n)}case O.session_set_mode:{if(!r.setSessionMode)throw G.methodNotFound(e);let n=gr.parse(t);return await r.setSessionMode(n)??{}}case O.authenticate:{let e=He.parse(t);return await r.authenticate(e)??{}}case O.logout:{if(!r.unstable_logout)throw G.methodNotFound(e);let n=bt.parse(t);return await r.unstable_logout(n)??{}}case O.session_prompt:{let e=Ur.parse(t);return r.prompt(e)}case O.session_set_model:{if(!r.unstable_setSessionModel)throw G.methodNotFound(e);let n=vr.parse(t);return await r.unstable_setSessionModel(n)??{}}case O.session_set_config_option:{if(!r.setSessionConfigOption)throw G.methodNotFound(e);let n=mr.parse(t);return r.setSessionConfigOption(n)}case O.nes_start:{if(!r.unstable_startNes)throw G.methodNotFound(e);let n=hi.parse(t);return r.unstable_startNes(n)}case O.nes_suggest:{if(!r.unstable_suggestNes)throw G.methodNotFound(e);let n=wr.parse(t);return r.unstable_suggestNes(n)}case O.nes_close:{if(!r.unstable_closeNes)throw G.methodNotFound(e);let n=Hn.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw G.methodNotFound(e)}},a=async(e,t)=>{switch(e){case O.session_cancel:{let e=Vn.parse(t);return r.cancel(e)}case O.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=qn.parse(t);return r.unstable_didOpenDocument(e)}case O.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Mr.parse(t);return r.unstable_didChangeDocument(e)}case O.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Gn.parse(t);return r.unstable_didCloseDocument(e)}case O.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Jn.parse(t);return r.unstable_didSaveDocument(e)}case O.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Kn.parse(t);return r.unstable_didFocusDocument(e)}case O.nes_accept:{if(!r.unstable_acceptNes)return;let e=Bn.parse(t);return r.unstable_acceptNes(e)}case O.nes_reject:{if(!r.unstable_rejectNes)return;let e=$n.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw G.methodNotFound(e)}};this.connection=new xi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(k.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(k.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(k.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(k.fs_write_text_file,e)??{}}async createTerminal(e){return new bi((await this.connection.sendRequest(k.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(k.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(k.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};vi=Symbol.asyncDispose;var bi=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(k.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(k.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(k.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(k.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[vi](){await this.release()}},xi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof i)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof i)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new G(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},G=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};h(),v(),ye(),Te(),be(),De(),ce(),ae(),_e(),re(),ee(),pe();function K(e,t){if(e)return t?Pe(e)?e:Fe(t,e):e}var Si=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,Ci={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function wi(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=Ci[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!Si)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Ti(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ei=256;function Di(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ei?t:t.slice(0,Ei-1)+`…`}function q(e,t){if(!t)return e;let n=D.resolve(t),r=D.resolve(e);return r.startsWith(n+D.sep)||r===n?D.relative(n,r):e}function Oi(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return t+`
3
+ `,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}m();var vi,yi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case O.initialize:{let e=mn.parse(t);return r.initialize(e)}case O.session_new:{let e=Zt.parse(t);return r.newSession(e)}case O.session_load:{if(!r.loadSession)throw G.methodNotFound(e);let n=Zn.parse(t);return r.loadSession(n)}case O.session_list:{if(!r.listSessions)throw G.methodNotFound(e);let n=_t.parse(t);return r.listSessions(n)}case O.session_fork:{if(!r.unstable_forkSession)throw G.methodNotFound(e);let n=Yn.parse(t);return r.unstable_forkSession(n)}case O.session_resume:{if(!r.unstable_resumeSession)throw G.methodNotFound(e);let n=tr.parse(t);return r.unstable_resumeSession(n)}case O.session_close:{if(!r.unstable_closeSession)throw G.methodNotFound(e);let n=Un.parse(t);return r.unstable_closeSession(n)}case O.session_set_mode:{if(!r.setSessionMode)throw G.methodNotFound(e);let n=gr.parse(t);return await r.setSessionMode(n)??{}}case O.authenticate:{let e=He.parse(t);return await r.authenticate(e)??{}}case O.logout:{if(!r.unstable_logout)throw G.methodNotFound(e);let n=bt.parse(t);return await r.unstable_logout(n)??{}}case O.session_prompt:{let e=Ur.parse(t);return r.prompt(e)}case O.session_set_model:{if(!r.unstable_setSessionModel)throw G.methodNotFound(e);let n=vr.parse(t);return await r.unstable_setSessionModel(n)??{}}case O.session_set_config_option:{if(!r.setSessionConfigOption)throw G.methodNotFound(e);let n=mr.parse(t);return r.setSessionConfigOption(n)}case O.nes_start:{if(!r.unstable_startNes)throw G.methodNotFound(e);let n=hi.parse(t);return r.unstable_startNes(n)}case O.nes_suggest:{if(!r.unstable_suggestNes)throw G.methodNotFound(e);let n=wr.parse(t);return r.unstable_suggestNes(n)}case O.nes_close:{if(!r.unstable_closeNes)throw G.methodNotFound(e);let n=Hn.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw G.methodNotFound(e)}},a=async(e,t)=>{switch(e){case O.session_cancel:{let e=Vn.parse(t);return r.cancel(e)}case O.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=qn.parse(t);return r.unstable_didOpenDocument(e)}case O.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Mr.parse(t);return r.unstable_didChangeDocument(e)}case O.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Gn.parse(t);return r.unstable_didCloseDocument(e)}case O.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Jn.parse(t);return r.unstable_didSaveDocument(e)}case O.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Kn.parse(t);return r.unstable_didFocusDocument(e)}case O.nes_accept:{if(!r.unstable_acceptNes)return;let e=Bn.parse(t);return r.unstable_acceptNes(e)}case O.nes_reject:{if(!r.unstable_rejectNes)return;let e=$n.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw G.methodNotFound(e)}};this.connection=new xi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(k.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(k.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(k.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(k.fs_write_text_file,e)??{}}async createTerminal(e){return new bi((await this.connection.sendRequest(k.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(k.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(k.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};vi=Symbol.asyncDispose;var bi=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(k.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(k.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(k.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(k.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[vi](){await this.release()}},xi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof o)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof G)return e.toResult();if(e instanceof o)return G.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return G.internalError(t?JSON.parse(t):{}).toResult()}catch{return G.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new G(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},G=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};_(),h(),ye(),Ee(),be(),se(),le(),ce(),oe(),te(),he(),Oe();function K(e,t){if(e)return t?Pe(e)?e:Fe(t,e):e}var Si=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,Ci={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function wi(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=Ci[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!Si)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Ti(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ei=256;function Di(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ei?t:t.slice(0,Ei-1)+`…`}function q(e,t){if(!t)return e;let n=D.resolve(t),r=D.resolve(e);return r.startsWith(n+D.sep)||r===n?D.relative(n,r):e}function Oi(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return t+`
4
4
  `+e+(e.endsWith(`
5
5
  `)?``:`
6
6
  `)+t}function J(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?q(t,n):`File`,c=K(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?q(e,n):void 0,a=K(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?q(e,n):void 0,o=K(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=K(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function ki(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:Ai(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function Ai(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
@@ -10,5 +10,5 @@ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,E as r,I as i,M
10
10
 
11
11
  Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Ii(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=E());let r=Pi(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=E()),s=m);let c=Ni(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
12
12
 
13
- Compacting completed.`}}});break;default:Li.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function X(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Li.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=E();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=Y(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:E()});for(let e of t)await n.sessionUpdate(e)}}}function Bi(e,t,n,r,i,a,o,s){return async(n,c,l,u,d,f)=>{let p=Hi(r);if(n.name===`ExitPlanMode`)return Vi(e,t,d,c,p,i,a,o,s);if(f!==void 0)return f;try{let e=await ie(n,c,l,u,d);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:d}}let m=J({name:n.name,id:d,input:c},p,i),h={toolCallId:d,title:m.title,kind:m.kind,status:`pending`,rawInput:c},g=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:h,options:g});if(n.outcome.outcome===`cancelled`)return s?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:d};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:c}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Vi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=J({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Hi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}Ce(),ne(),se(),w(),e(),te(),fe();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`claude-code`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||b(),n=await Se(t),r=await ge({dir:t}),i=[];for(let e of r){if(!e.cwd||await Se(e.cwd)!==n)continue;let t=Di(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Ui(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await T(e.sessionId);if(t)try{await Ne(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw G.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Ui(e){let t;try{let n=await C(e);n&&n.messages.length>0&&(t=S(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Wi=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Gi(e){return Wi.includes(e)}function Ki(e,t,n){if(t){let t=qi(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Xi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return Ji(n)??`default`}function qi(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return wi(e,t)}function Ji(e){if(e!=null)try{return wi(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Yi(e,t){return!!e&&Object.hasOwn(e,t)}function Xi(){return Zi()}function Zi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Qi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function $i(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function ea(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}v();function ta(){return ve().permissions?.defaultMode}async function na(e,t={}){xe();let n=t.sessionId??E(),r=e.cwd;x(n,_()),g(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}y(),he();try{let i=Ee(),a=oe(i),o=e._meta,s=Yi(o,`permissionMode`),c=Ki(s?o?.permissionMode:void 0,s,ta()),l=$(this),u=this.conn,d=Bi(u,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,l,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),f=Xi(),p={...ue(),toolPermissionContext:{...i,mode:c,isBypassPermissionsModeAvailable:f}},[m,h]=await Promise.all([me(r),le(r)]);p.agentDefinitions=h;let g=new ke({cwd:r,tools:a,commands:m,mcpClients:[],agents:h.activeAgents,canUseTool:d,getAppState:()=>p,setAppState:e=>{let t=e(p);Object.assign(p,t)},readFileCache:new Oe(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),_={currentModeId:c,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},...f?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},v=de(),y=we(),b={availableModels:v.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:y};g.setModel(y);let x=Qi(_,b),ee={queryEngine:g,cancelled:!1,cancelGeneration:0,cwd:r,modes:_,models:b,configOptions:x,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:l,appState:p,commands:m,sessionFingerprint:Ti({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,ee),{sessionId:n,modes:_,models:b,configOptions:x}}finally{a&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:na}),te(),fe(),v(),w();async function ra(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Ti({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await T(e.sessionId,e.cwd);return x(e.sessionId,r?Ae(r.filePath):null),g(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await T(e.sessionId,e.cwd),i=r?Ae(r.filePath):null;x(e.sessionId,i),g(e.cwd);let a;if(r)try{let t=await C(e.sessionId);t&&t.messages.length>0&&(a=S(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await X(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ia(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function aa(e){try{let t=await C(e.sessionId);if(!t||t.messages.length===0)return;let n=S(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await X(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function oa(e,t){if(!Gi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function sa(e,t,n){let r=this.sessions.get(e);r&&(ea(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:ra,teardownSession:ia,replaySessionHistory:aa,applySessionMode:oa,updateConfigOption:sa});function ca(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(la(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
14
- `)}function la(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function ua(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),da(e),n}da(e)}function da(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}v();async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=ca(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=E();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),x(e.sessionId,_());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await zi(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await ma(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Claude Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=ua(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function pa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=$i(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),ea(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function ma(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=Di(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:fa,setSessionConfigOption:pa}),be(),_e();function ha(e,t){let n=je.toWeb(e);return _i(Me.toWeb(t),n)}async function ga(){xe(),he();let e=ha(process.stdin,process.stdout),t,n=new yi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ga as runAcpAgent};
13
+ Compacting completed.`}}});break;default:Li.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function X(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Li.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=E();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=Y(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:E()});for(let e of t)await n.sessionUpdate(e)}}}function Bi(e,t,n,r,i,a,o,s){return async(n,c,l,u,d,f)=>{let p=Hi(r);if(n.name===`ExitPlanMode`)return Vi(e,t,d,c,p,i,a,o,s);if(f!==void 0)return f;try{let e=await re(n,c,l,u,d);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:d}}let m=J({name:n.name,id:d,input:c},p,i),h={toolCallId:d,title:m.title,kind:m.kind,status:`pending`,rawInput:c},g=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:h,options:g});if(n.outcome.outcome===`cancelled`)return s?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:d};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:c}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Vi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=J({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Hi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}Ce(),ne(),ee(),Se(),e(),me(),de();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`claude-code`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||x(),n=await T(t),r=await _e({dir:t}),i=[];for(let e of r){if(!e.cwd||await T(e.cwd)!==n)continue;let t=Di(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Ui(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await w(e.sessionId);if(t)try{await Ne(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw G.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Ui(e){let t;try{let n=await S(e);n&&n.messages.length>0&&(t=C(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Wi=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Gi(e){return Wi.includes(e)}function Ki(e,t,n){if(t){let t=qi(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Xi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return Ji(n)??`default`}function qi(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return wi(e,t)}function Ji(e){if(e!=null)try{return wi(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Yi(e,t){return!!e&&Object.hasOwn(e,t)}function Xi(){return Zi()}function Zi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Qi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function $i(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function ea(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}h();function ta(){return ve().permissions?.defaultMode}async function na(e,t={}){xe();let n=t.sessionId??E(),r=e.cwd;y(n,b()),v(r);let i=process.cwd(),a=!1;try{process.chdir(r),a=!0}catch{}g(),De();try{let i=Te(),a=pe(i),o=e._meta,s=Yi(o,`permissionMode`),c=Ki(s?o?.permissionMode:void 0,s,ta()),l=$(this),u=this.conn,d=Bi(u,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,l,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),f=Xi(),p={...fe(),toolPermissionContext:{...i,mode:c,isBypassPermissionsModeAvailable:f}},[m,h]=await Promise.all([ie(r),ue(r)]);p.agentDefinitions=h;let g=new ke({cwd:r,tools:a,commands:m,mcpClients:[],agents:h.activeAgents,canUseTool:d,getAppState:()=>p,setAppState:e=>{let t=e(p);Object.assign(p,t)},readFileCache:new ge(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),_={currentModeId:c,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},...f?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},v=ae(),y=we(),b={availableModels:v.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:y};g.setModel(y);let x=Qi(_,b),ee={queryEngine:g,cancelled:!1,cancelGeneration:0,cwd:r,modes:_,models:b,configOptions:x,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:l,appState:p,commands:m,sessionFingerprint:Ti({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,ee),{sessionId:n,modes:_,models:b,configOptions:x}}finally{a&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:na}),me(),de(),h(),Se();async function ra(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Ti({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await w(e.sessionId,e.cwd);return y(e.sessionId,r?Ae(r.filePath):null),v(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await w(e.sessionId,e.cwd),i=r?Ae(r.filePath):null;y(e.sessionId,i),v(e.cwd);let a;if(r)try{let t=await S(e.sessionId);t&&t.messages.length>0&&(a=C(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await X(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ia(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function aa(e){try{let t=await S(e.sessionId);if(!t||t.messages.length===0)return;let n=C(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await X(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function oa(e,t){if(!Gi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function sa(e,t,n){let r=this.sessions.get(e);r&&(ea(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:ra,teardownSession:ia,replaySessionHistory:aa,applySessionMode:oa,updateConfigOption:sa});function ca(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(la(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
14
+ `)}function la(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function ua(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),da(e),n}da(e)}function da(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}h();async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=ca(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=E();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),y(e.sessionId,b());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await zi(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await ma(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Claude Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=ua(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function pa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=$i(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),ea(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function ma(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=Di(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:fa,setSessionConfigOption:pa}),be(),Oe();function ha(e,t){let n=je.toWeb(e);return _i(Me.toWeb(t),n)}async function ga(){xe(),De();let e=ha(process.stdin,process.stdout),t,n=new yi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ga as runAcpAgent};