claude-code-best 2.5.0 → 2.6.0

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 (614) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-Cj5bvJgD.js +1 -0
  2. package/dist/chunks/App-2tgSv9lb.js +1 -0
  3. package/dist/chunks/ApproveApiKey-DWa-XTLb.js +1 -0
  4. package/dist/chunks/ApproveApiKey-SIUwkD8j.js +1 -0
  5. package/dist/chunks/AssistantSessionChooser-DF9eeJZS.js +1 -0
  6. package/dist/chunks/BackgroundTasksDialog-DXJdube9.js +2 -0
  7. package/dist/chunks/BypassPermissionsModeDialog-BOSW4Zdy.js +1 -0
  8. package/dist/chunks/ClaudeInChromeOnboarding-BW4XHmkw.js +1 -0
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-B8oAAHSI.js +1 -0
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-Bz0JyaOG.js +1 -0
  11. package/dist/chunks/ConsoleOAuthFlow-DYhmGSkx.js +1 -0
  12. package/dist/chunks/DesktopHandoff-CcsM_OAS.js +1 -0
  13. package/dist/chunks/DevChannelsDialog-DXRgY00D.js +1 -0
  14. package/dist/chunks/Dialog-DYFGqyDs.js +1 -0
  15. package/dist/chunks/DiffDialog-PvNZfZby.js +3 -0
  16. package/dist/chunks/Doctor--B1HUENo.js +1 -0
  17. package/dist/chunks/Doctor-CE_jL9jC.js +3 -0
  18. package/dist/chunks/ExitFlow-C4ybxKPn.js +2 -0
  19. package/dist/chunks/Feedback-B5rPGl_C.js +2 -0
  20. package/dist/chunks/Grove-C2YjB3zL.js +1 -0
  21. package/dist/chunks/Grove-CKVpREDU.js +11 -0
  22. package/dist/chunks/HybridTransport-Byjvz-DL.js +4 -0
  23. package/dist/chunks/ITermBackend-Co9XpeS4.js +1 -0
  24. package/dist/chunks/InProcessTransport-DB52dh4f.js +1 -0
  25. package/dist/chunks/InvalidConfigDialog-CNsqbNU3.js +1 -0
  26. package/dist/chunks/InvalidSettingsDialog-ClnZaN6b.js +1 -0
  27. package/dist/chunks/ListItem-OFARanN7.js +1 -0
  28. package/dist/chunks/MCPConnectionManager-CDsa79pu.js +1 -0
  29. package/dist/chunks/McpParsingWarnings-DZkzoeZf.js +1 -0
  30. package/dist/chunks/MessageSelector-CkeGQPNM.js +3 -0
  31. package/dist/chunks/Messages-PfbzLYOU.js +11 -0
  32. package/dist/chunks/Onboarding-BwoGQB4g.js +1 -0
  33. package/dist/chunks/OverageCreditUpsell-Q5g2YjQw.js +1 -0
  34. package/dist/chunks/PermissionDialog-5MlJf7ew.js +1 -0
  35. package/dist/chunks/PluginSettings-B2ASJ0Rx.js +17 -0
  36. package/dist/chunks/PressEnterToContinue-BdA9zDGs.js +1 -0
  37. package/dist/chunks/PromptInputFooterSuggestions-D4lMVCqj.js +1 -0
  38. package/dist/chunks/PromptInputHelpMenu-BvLtS6an.js +1 -0
  39. package/dist/chunks/QueryEngine-Av0G5fze.js +1 -0
  40. package/dist/chunks/REPL-DCwqua0C.js +1 -0
  41. package/dist/chunks/REPL-Dh8vzGmF.js +97 -0
  42. package/dist/chunks/RemoteCallout-BV_hoz98.js +1 -0
  43. package/dist/chunks/RemoteSessionManager-Cxoy1ud2.js +2 -0
  44. package/dist/chunks/ResumeConversation-B3WuB8rs.js +1 -0
  45. package/dist/chunks/SSETransport-pIm26VJq.js +4 -0
  46. package/dist/chunks/SearchBox-DfOmUoaI.js +1 -0
  47. package/dist/chunks/SearchExtraToolsTool-D70C-cmA.js +1 -0
  48. package/dist/chunks/SentryErrorBoundary-B6EWoJml.js +2 -0
  49. package/dist/chunks/SentryErrorBoundary-oJUBarGg.js +1 -0
  50. package/dist/chunks/Settings-CreAhCsb.js +2 -0
  51. package/dist/chunks/TeleportProgress-DPzGpyyM.js +1 -0
  52. package/dist/chunks/TeleportRepoMismatchDialog-DqWQX6j8.js +1 -0
  53. package/dist/chunks/TeleportResumeWrapper-DPSO0S49.js +1 -0
  54. package/dist/chunks/ThemePicker-DueihHcy.js +1 -0
  55. package/dist/chunks/TmuxBackend-BNaZNAeP.js +9 -0
  56. package/dist/chunks/TrustDialog-CIzAlGn9.js +1 -0
  57. package/dist/chunks/TungstenTool-C5IqKVr0.js +1 -0
  58. package/dist/chunks/TungstenTool-V-Bwqlx3.js +1 -0
  59. package/dist/chunks/ValidationErrorsList-1k1qbsRo.js +2 -0
  60. package/dist/chunks/WelcomeV2-CR6TtXXM.js +1 -0
  61. package/dist/chunks/WindowsTerminalBackend-C5SeTXqC.js +2 -0
  62. package/dist/chunks/add-dir-DAMizKzF.js +1 -0
  63. package/dist/chunks/agentDisplay-B9z7i8b_.js +1 -0
  64. package/dist/chunks/agents-D5u0p1UC.js +103 -0
  65. package/dist/chunks/agents-DCh_gEvJ.js +2 -0
  66. package/dist/chunks/ajv-B_OpU_Uh.js +8 -0
  67. package/dist/chunks/analytics-DqMQntaB.js +1 -0
  68. package/dist/chunks/ant-DRJq-cEg.js +1 -0
  69. package/dist/chunks/api-B6URs6nc.js +1 -0
  70. package/dist/chunks/api-Dz_3z1kl.js +1 -0
  71. package/dist/chunks/asciicast-aoKFhc7C.js +1 -0
  72. package/dist/chunks/asciicast-o5Zg4dJt.js +4 -0
  73. package/dist/chunks/assistant-BRGDWkKB.js +1 -0
  74. package/dist/chunks/assistant-tPxOUa-Z.js +1 -0
  75. package/dist/chunks/assistant-zVegFdAO.js +1 -0
  76. package/dist/chunks/attributionHooks-PygdohOh.js +1 -0
  77. package/dist/chunks/attributionTrailer-BpvhXgRP.js +1 -0
  78. package/dist/chunks/auth-CqURlg4d.js +1 -0
  79. package/dist/chunks/auth-D4isgfuK.js +1 -0
  80. package/dist/chunks/autoMode-DVt4K4I2.js +45 -0
  81. package/dist/chunks/autoModeDenials-Cp6VFdsm.js +1 -0
  82. package/dist/chunks/autonomy-BZzW8QJZ.js +1 -0
  83. package/dist/chunks/autonomy-Ffv0QIyl.js +19 -0
  84. package/dist/chunks/autonomyPanel-MwuzDvv_.js +1 -0
  85. package/dist/chunks/axios-DLnc2dVy.js +1 -0
  86. package/dist/chunks/axios-DhfaybwJ.js +12 -0
  87. package/dist/chunks/backgroundHousekeeping-CYnAG60-.js +17 -0
  88. package/dist/chunks/backgroundHousekeeping-DUmxC6h0.js +1 -0
  89. package/dist/chunks/banner-CVXH2xts.js +2 -0
  90. package/dist/chunks/base64-js-DIVSFswY.js +1 -0
  91. package/dist/chunks/bedrockClient-qi1-JCOK.js +15 -0
  92. package/dist/chunks/bg-DK0E4ZtW.js +9 -0
  93. package/dist/chunks/bg-Dbh5z3Y8.js +1 -0
  94. package/dist/chunks/branch-DXefFdDE.js +3 -0
  95. package/dist/chunks/break-cache-ByJ7U2Ts.js +8 -0
  96. package/dist/chunks/bridge-qr4GQW_c.js +2 -0
  97. package/dist/chunks/bridgeConfig-CJ-KznTS.js +1 -0
  98. package/dist/chunks/bridgeConfig-CNbOKpAg.js +1 -0
  99. package/dist/chunks/bridgeEnabled-5vsPrjuq.js +1 -0
  100. package/dist/chunks/bridgeEnabled-BUJTCUHY.js +1 -0
  101. package/dist/chunks/bridgeMain-BimZwc2P.js +68 -0
  102. package/dist/chunks/bridgeMain-DYL4fl6A.js +1 -0
  103. package/dist/chunks/bridgeMessaging-BiE0CTqq.js +1 -0
  104. package/dist/chunks/bridgePointer-FvAMj3re.js +1 -0
  105. package/dist/chunks/browser-fLRXxIsQ.js +1 -0
  106. package/dist/chunks/btw-FpimqEqk.js +1 -0
  107. package/dist/chunks/buddy-BA3Cr067.js +3 -0
  108. package/dist/chunks/bundledMode-kSQejuY4.js +1 -0
  109. package/dist/chunks/bypassPermissionsKillswitch-CSC9p8mO.js +1 -0
  110. package/dist/chunks/caches-BUBkfP2Q.js +3 -0
  111. package/dist/chunks/caches-CTfNpKhW.js +1 -0
  112. package/dist/chunks/capacityWake-BXlUpptF.js +1 -0
  113. package/dist/chunks/ccrClient-BOxUn9EJ.js +1 -0
  114. package/dist/chunks/ccshareResume-DWLjTF22.js +1 -0
  115. package/dist/chunks/changeDetector-Y9KV5LgG.js +1 -0
  116. package/dist/chunks/channelNotification-CC7Xb06W.js +1 -0
  117. package/dist/chunks/channelNotification-l3EXKDNB.js +1 -0
  118. package/dist/chunks/chokidar-BcI3rIKm.js +1 -0
  119. package/dist/chunks/chokidar-SzksMqYp.js +1 -0
  120. package/dist/chunks/chrome-BnKyWWQL.js +1 -0
  121. package/dist/chunks/chromeNativeHost-4U39yLtd.js +1 -0
  122. package/dist/chunks/chunk-DR8-3Aex.js +1 -0
  123. package/dist/chunks/classPrivateFieldSet2-EAQNhHs8.js +1 -0
  124. package/dist/chunks/claudeDesktop-D0S1eq1F.js +1 -0
  125. package/dist/chunks/cleanup-Bg_gFgcj.js +1 -0
  126. package/dist/chunks/clear-OUVFUt8Z.js +1 -0
  127. package/dist/chunks/cliLaunch-BQa48gsr.js +1 -0
  128. package/dist/chunks/client-B47ZvTMo.js +1 -0
  129. package/dist/chunks/client-CPn1wQyc.js +7 -0
  130. package/dist/chunks/client-_sjL0I7A.js +35 -0
  131. package/dist/chunks/color-D5MCzz9h.js +1 -0
  132. package/dist/chunks/color-convert-ULbeSgNC.js +1 -0
  133. package/dist/chunks/commands-FJGWgQsa.js +1 -0
  134. package/dist/chunks/commitAttribution-BFshsh2H.js +2 -0
  135. package/dist/chunks/commitAttribution-DSv9FggK.js +1 -0
  136. package/dist/chunks/common-B379wT22.js +1 -0
  137. package/dist/chunks/common-B_BC3eMY.js +1 -0
  138. package/dist/chunks/common-CMCv4N_v.js +1 -0
  139. package/dist/chunks/compact-DWNaf1wR.js +3 -0
  140. package/dist/chunks/companion-CyK_Dr1U.js +1 -0
  141. package/dist/chunks/completionCache-DHfUBBMH.js +1 -0
  142. package/dist/chunks/completionCache-DORrtxkS.js +4 -0
  143. package/dist/chunks/computerUseLock-BjoDJH2h.js +1 -0
  144. package/dist/chunks/config-BdCuh6eA.js +1 -0
  145. package/dist/chunks/config-DNz6Eitr.js +1 -0
  146. package/dist/chunks/connectHeadless-CwsFt-Mh.js +1 -0
  147. package/dist/chunks/constants-41VpZw2G.js +1 -0
  148. package/dist/chunks/context-BOjdTj0i.js +1 -0
  149. package/dist/chunks/context-noninteractive-Bd2HO-vU.js +1 -0
  150. package/dist/chunks/context-noninteractive-k2ibficU.js +54 -0
  151. package/dist/chunks/controlMessageCompat-BJhFiS7u.js +1 -0
  152. package/dist/chunks/conversation-BP0phkOY.js +1 -0
  153. package/dist/chunks/conversation-Ci8O_eZ-.js +1 -0
  154. package/dist/chunks/copy-B0VUJ2rH.js +7 -0
  155. package/dist/chunks/createSSHSession-DqmkCS_k.js +6 -0
  156. package/dist/chunks/createSession-B9MhWusY.js +1 -0
  157. package/dist/chunks/createSession-CJEsHz58.js +1 -0
  158. package/dist/chunks/cron-DiW7eIPP.js +1 -0
  159. package/dist/chunks/cronJitterConfig-BzPaa52I.js +6 -0
  160. package/dist/chunks/crossProjectResume-tWsqBUHc.js +40 -0
  161. package/dist/chunks/cwd--iizewsn.js +1 -0
  162. package/dist/chunks/cwd-BgpSJxd7.js +1 -0
  163. package/dist/chunks/daemon-VYRit6Aq.js +2 -0
  164. package/dist/chunks/dangerousBackend-BU_PHGR2.js +1 -0
  165. package/dist/chunks/datadog-Bd1s_VFj.js +1 -0
  166. package/dist/chunks/datadog-DJowkWhh.js +1 -0
  167. package/dist/chunks/debug-DM5ezCBS.js +1 -0
  168. package/dist/chunks/debug-UI3T040K.js +5 -0
  169. package/dist/chunks/debugUtils-BBMFODKH.js +1 -0
  170. package/dist/chunks/defineProperty-80gRi2ZW.js +1 -0
  171. package/dist/chunks/desktop-BDowrzvG.js +1 -0
  172. package/dist/chunks/detached-D300jlhj.js +5 -0
  173. package/dist/chunks/detect-libc-DNuQfUvI.js +1 -0
  174. package/dist/chunks/detectRepository-CBk3S2zv.js +1 -0
  175. package/dist/chunks/detectRepository-DCTvg4p0.js +1 -0
  176. package/dist/chunks/detection-CQsNad64.js +1 -0
  177. package/dist/chunks/detection-DJ-vTbBf.js +1 -0
  178. package/dist/chunks/diff-auU5sUOw.js +1 -0
  179. package/dist/chunks/directoryCompletion-DP_4B1GL.js +1 -0
  180. package/dist/chunks/dist-CanSxOZ1.js +5 -0
  181. package/dist/chunks/dist-Cg1a1Exw.js +29 -0
  182. package/dist/chunks/dist-Q7YNoZ0H.js +20 -0
  183. package/dist/chunks/dist-es-4z5T3Jzm.js +1 -0
  184. package/dist/chunks/dist-es-B2jg52tM2.js +1 -0
  185. package/dist/chunks/dist-es-B6OXHQ1S.js +1 -0
  186. package/dist/chunks/dist-es-B8NEy5hc.js +1 -0
  187. package/dist/chunks/dist-es-BVGppqE4.js +1 -0
  188. package/dist/chunks/dist-es-Bcw5GZko.js +1 -0
  189. package/dist/chunks/dist-es-BoIJpncb.js +9 -0
  190. package/dist/chunks/dist-es-Bu_Fshi1.js +1 -0
  191. package/dist/chunks/dist-es-C-1vn4OP2.js +1 -0
  192. package/dist/chunks/dist-es-C41b_0B5.js +1 -0
  193. package/dist/chunks/dist-es-CCZYybbG2.js +1 -0
  194. package/dist/chunks/dist-es-CLK1mey-.js +1 -0
  195. package/dist/chunks/dist-es-CQz2aNf72.js +1 -0
  196. package/dist/chunks/dist-es-CSfI8B8l.js +1 -0
  197. package/dist/chunks/dist-es-CUZBYppo.js +1 -0
  198. package/dist/chunks/dist-es-CZkzHpjF.js +1 -0
  199. package/dist/chunks/dist-es-Cbf0_D8d.js +5 -0
  200. package/dist/chunks/dist-es-ChHe-SVL.js +1 -0
  201. package/dist/chunks/dist-es-ClYOf0My.js +1 -0
  202. package/dist/chunks/dist-es-D-kJbj4A2.js +1 -0
  203. package/dist/chunks/dist-es-D1LN6CJd.js +1 -0
  204. package/dist/chunks/dist-es-DC1sC3ph.js +1 -0
  205. package/dist/chunks/dist-es-DGn8uOwQ2.js +1 -0
  206. package/dist/chunks/dist-es-DK5fTeKM2.js +1 -0
  207. package/dist/chunks/dist-es-DN7otr6F.js +1 -0
  208. package/dist/chunks/dist-es-DPM0mPK5.js +1 -0
  209. package/dist/chunks/dist-es-DqZAh3nG.js +1 -0
  210. package/dist/chunks/dist-es-DuAZyxJ02.js +5 -0
  211. package/dist/chunks/dist-es-HVQrM0oE.js +1 -0
  212. package/dist/chunks/dist-es-OVleIB54.js +1 -0
  213. package/dist/chunks/dist-es-UAs0rdXg.js +1 -0
  214. package/dist/chunks/dist-es-WvMMuHmx2.js +1 -0
  215. package/dist/chunks/dist-es-fjXft-jH.js +1 -0
  216. package/dist/chunks/dist-es-hdN_ShpZ.js +3 -0
  217. package/dist/chunks/dist-es-neiUvMJb.js +1 -0
  218. package/dist/chunks/dist-es-yMYpDtui2.js +1 -0
  219. package/dist/chunks/dist-es-zjcbuB72.js +1 -0
  220. package/dist/chunks/distRoot-CcxmnzqQ.js +1 -0
  221. package/dist/chunks/doctor-bKPp6AeL.js +1 -0
  222. package/dist/chunks/earlyInput-JGJo1zcC.js +1 -0
  223. package/dist/chunks/earlyInput-tRkbxFv2.js +2 -0
  224. package/dist/chunks/effort-BQj2QnnA.js +9 -0
  225. package/dist/chunks/entry-CUu6-QhT.js +14 -0
  226. package/dist/chunks/env-chR0gV31.js +1 -0
  227. package/dist/chunks/envLessBridgeConfig-CixkwbRF.js +1 -0
  228. package/dist/chunks/envLessBridgeConfig-Ju4W58xf.js +1 -0
  229. package/dist/chunks/envUtils-BWeoiL4Y.js +1 -0
  230. package/dist/chunks/escHotkey-Cyz0yyh1.js +259 -0
  231. package/dist/chunks/esm--xjzB1hI.js +1 -0
  232. package/dist/chunks/esm-B2HIF0XY.js +1 -0
  233. package/dist/chunks/esm-BGQPWnJy.js +1 -0
  234. package/dist/chunks/esm-C-1qL9Mn.js +1 -0
  235. package/dist/chunks/esm-C3jcs1DH.js +1 -0
  236. package/dist/chunks/esm-C97WL9nC.js +1 -0
  237. package/dist/chunks/esm-CIL-SKM8.js +1 -0
  238. package/dist/chunks/esm-CJlBxjtx.js +1 -0
  239. package/dist/chunks/esm-CsGLyWmS.js +56 -0
  240. package/dist/chunks/esm-DQHmDm-H.js +1 -0
  241. package/dist/chunks/esm-DcdOXSzi.js +1 -0
  242. package/dist/chunks/esm-DhNYgGTV.js +1 -0
  243. package/dist/chunks/esm-DxPW7qPs.js +1 -0
  244. package/dist/chunks/esm-FBUWr3vI.js +1 -0
  245. package/dist/chunks/esm-QgL6y---.js +10 -0
  246. package/dist/chunks/esm-v0kPjgVS.js +1 -0
  247. package/dist/chunks/esm-vIn-YV_h.js +1 -0
  248. package/dist/chunks/event-streams-BV7ngMXu.js +1 -0
  249. package/dist/chunks/eventLoopStallDetector-Dnh1fc31.js +1 -0
  250. package/dist/chunks/execAsync-BkA6ogic.js +1 -0
  251. package/dist/chunks/execFileNoThrow-CuQN1sz8.js +1 -0
  252. package/dist/chunks/execSyncWrapper-C2XQnFVo.js +1 -0
  253. package/dist/chunks/execa-CGue6Z3n.js +34 -0
  254. package/dist/chunks/executor-4EeD8GNm.js +1561 -0
  255. package/dist/chunks/executor-BHEuNh5F.js +1 -0
  256. package/dist/chunks/exit-DijkO8eo.js +1 -0
  257. package/dist/chunks/exit-_obETqBv.js +2 -0
  258. package/dist/chunks/export-DA-bBZkX.js +2 -0
  259. package/dist/chunks/exportRenderer-3y4tGdSB.js +1 -0
  260. package/dist/chunks/extra-usage-CS6VwKJt.js +1 -0
  261. package/dist/chunks/extra-usage-DGHEQOrY.js +1 -0
  262. package/dist/chunks/extra-usage-core-DOgT4u4i.js +1 -0
  263. package/dist/chunks/extra-usage-noninteractive-DYnfiRlV.js +1 -0
  264. package/dist/chunks/extraUsage-CfxgfpX_.js +1 -0
  265. package/dist/chunks/extractMemories-jvjCvtpC.js +1 -0
  266. package/dist/chunks/fast-Bbtx_Bs1.js +1 -0
  267. package/dist/chunks/fast-CzRUJBTK.js +1 -0
  268. package/dist/chunks/featureCheck-Cm0YNDXO.js +1 -0
  269. package/dist/chunks/featureCheck-p7OeCYzj.js +1 -0
  270. package/dist/chunks/feedback-FoXtdHAV.js +1 -0
  271. package/dist/chunks/figures-gfT9mM8P.js +1 -0
  272. package/dist/chunks/fileStateCache-C7-TxF8G.js +1 -0
  273. package/dist/chunks/files-DYvAZGxp.js +2 -0
  274. package/dist/chunks/firstPartyEventLogger-KIwaBY-E.js +1 -0
  275. package/dist/chunks/flushGate-C2Icy43G.js +1 -0
  276. package/dist/chunks/foundry-sdk-BFN5VDFQ.js +1 -0
  277. package/dist/chunks/fpsMetrics-DeezdcwV.js +1 -0
  278. package/dist/chunks/fuse-Ch_OAlm3.js +1 -0
  279. package/dist/chunks/gates-CbQLZHtm.js +1 -0
  280. package/dist/chunks/gates-DSI3vpwO.js +1 -0
  281. package/dist/chunks/gemini-BrNJGX4k.js +1 -0
  282. package/dist/chunks/generateRecap-B0fvSCjo.js +1 -0
  283. package/dist/chunks/generateSessionName-DvRYa39O.js +1 -0
  284. package/dist/chunks/genericProcessUtils-BGvcwuPt.js +23 -0
  285. package/dist/chunks/getMachineId-bsd-BMtYGBUL.js +1 -0
  286. package/dist/chunks/getMachineId-darwin-CiLdFH7z.js +2 -0
  287. package/dist/chunks/getMachineId-linux-Cr27rIeY.js +1 -0
  288. package/dist/chunks/getMachineId-unsupported-ceiBLwAN.js +1 -0
  289. package/dist/chunks/getMachineId-win-DFTmsQHq.js +1 -0
  290. package/dist/chunks/git-CN3qtTb_.js +6 -0
  291. package/dist/chunks/git-D23Mzu_K.js +1 -0
  292. package/dist/chunks/githubRepoPathMapping-Dut3d6nn.js +1 -0
  293. package/dist/chunks/graceful-fs-Cgc0rjGF.js +2 -0
  294. package/dist/chunks/grok-Ftoheab3.js +1 -0
  295. package/dist/chunks/growthbook-BynnuVTn.js +1 -0
  296. package/dist/chunks/hash-BRmOQc3c.js +1 -0
  297. package/dist/chunks/heapdump-hQ_w0LPC.js +5 -0
  298. package/dist/chunks/help-DQsHHv6r.js +1 -0
  299. package/dist/chunks/hooks-BLLL4iPv.js +1 -0
  300. package/dist/chunks/hooks-BhVDc8yb.js +79 -0
  301. package/dist/chunks/hostAdapter-D1eWmmhu.js +1 -0
  302. package/dist/chunks/hostGuard-zim_4F9V.js +1 -0
  303. package/dist/chunks/httpAuthSchemes-Wq4XWeLL.js +13 -0
  304. package/dist/chunks/ide-CPmMXLL-.js +2 -0
  305. package/dist/chunks/inboundAttachments-Bmf6vYsE.js +1 -0
  306. package/dist/chunks/inboundAttachments-D-p91z3w.js +1 -0
  307. package/dist/chunks/index.min-BJnb9GQI.js +1 -0
  308. package/dist/chunks/initReplBridge-BiHXpDEY.js +1 -0
  309. package/dist/chunks/insights-CTlTyvjj.js +822 -0
  310. package/dist/chunks/install-IPuD3Lq8.js +1 -0
  311. package/dist/chunks/install-github-app-Bmu_sA9e.js +147 -0
  312. package/dist/chunks/install-slack-app-Rfl81Jqo.js +1 -0
  313. package/dist/chunks/instinctParser-DHMa8xa0.js +1 -0
  314. package/dist/chunks/instrumentation-DWwmOmr0.js +12 -0
  315. package/dist/chunks/intl-Pse97ORk.js +1 -0
  316. package/dist/chunks/isObject-DaxDnPKm.js +1 -0
  317. package/dist/chunks/isSymbol-Dp3irZaY.js +1 -0
  318. package/dist/chunks/job-BXEt0izn.js +2 -0
  319. package/dist/chunks/json-bigint-OxRwRvup.js +8 -0
  320. package/dist/chunks/jsx-runtime-D-D469L8.js +1 -0
  321. package/dist/chunks/jws-2vqRyZtR.js +3 -0
  322. package/dist/chunks/jwtUtils-CpXwh_du.js +1 -0
  323. package/dist/chunks/keybindings-DRDgVvqz.js +2 -0
  324. package/dist/chunks/lang-D3ZHlfT6.js +1 -0
  325. package/dist/chunks/language-B_-BfBT4.js +1 -0
  326. package/dist/chunks/language-DcSjogBx.js +1 -0
  327. package/dist/chunks/launchAgentsPlatform-BPm_VMln.js +1 -0
  328. package/dist/chunks/launchAutofixPr-D2qac07g.js +2 -0
  329. package/dist/chunks/launchCommand-Du91jxMC.js +1 -0
  330. package/dist/chunks/launchLocalMemory-D_hBbXKE.js +3 -0
  331. package/dist/chunks/launchLocalVault-CPzNWvQ9.js +3 -0
  332. package/dist/chunks/launchMemoryStores-Djq2KhKb.js +1 -0
  333. package/dist/chunks/launchOnboarding-Bh6E7vdc.js +8 -0
  334. package/dist/chunks/launchSchedule-C988bQ-5.js +1 -0
  335. package/dist/chunks/launchSkillStore-DqrP6Gme.js +1 -0
  336. package/dist/chunks/launchTeleport-DFhybaq_.js +3 -0
  337. package/dist/chunks/launchVault-p_CSK4ZQ.js +1 -0
  338. package/dist/chunks/lazySchema-2sOku3cX.js +1 -0
  339. package/dist/chunks/lib-B4Q0Nrpb.js +14 -0
  340. package/dist/chunks/lib-Ca3QWJjN.js +2 -0
  341. package/dist/chunks/lib-inCisXen.js +8 -0
  342. package/dist/chunks/loadAgentsDir-Ci5mr0vm.js +4601 -0
  343. package/dist/chunks/loadAgentsDir-vB1QEZ7H.js +1 -0
  344. package/dist/chunks/loadPluginHooks-xYCEZ6t5.js +1 -0
  345. package/dist/chunks/loadSso-sDs471GC.js +1 -0
  346. package/dist/chunks/localSearch-DtVqtfvk.js +1 -0
  347. package/dist/chunks/localSearch-Vpn6W5aY.js +1 -0
  348. package/dist/chunks/lockfile-DBwdlC3K.js +1 -0
  349. package/dist/chunks/log-CzsijfHZ.js +1 -0
  350. package/dist/chunks/login-D-N78G6r.js +1 -0
  351. package/dist/chunks/login-D9IWjvza.js +1 -0
  352. package/dist/chunks/logoV2Utils-SAulcC5x.js +1 -0
  353. package/dist/chunks/logout-CFggVS-9.js +1 -0
  354. package/dist/chunks/magicDocs-BfoeYhin.js +57 -0
  355. package/dist/chunks/main-C6be1KFk.js +31 -0
  356. package/dist/chunks/main-DhMlhVj3.js +1108 -0
  357. package/dist/chunks/mappers-uIrAj-Wd.js +1 -0
  358. package/dist/chunks/mcp-CAYGNxCb.js +1 -0
  359. package/dist/chunks/mcp-COQap0SM.js +6 -0
  360. package/dist/chunks/mcp-DlM0OC6R.js +2 -0
  361. package/dist/chunks/mcpServer-1SnOWb8_.js +1 -0
  362. package/dist/chunks/mcpServer-DXvS3v4x.js +1 -0
  363. package/dist/chunks/memoize-DNnuA2aU.js +1 -0
  364. package/dist/chunks/memoize-DxwLawI2.js +1 -0
  365. package/dist/chunks/memory-XccPLQLt.js +1 -0
  366. package/dist/chunks/mobile-umu5P0cM.js +2 -0
  367. package/dist/chunks/modalContext-CmSKRyea.js +1 -0
  368. package/dist/chunks/model-CbiDGGJU.js +1 -0
  369. package/dist/chunks/model-DdbcxKub.js +1 -0
  370. package/dist/chunks/normalization-Cox8C0dP.js +1 -0
  371. package/dist/chunks/oauth-CdZEzMww.js +1 -0
  372. package/dist/chunks/oauth-CmensepG.js +1 -0
  373. package/dist/chunks/observationStore-tvkldXUo.js +4 -0
  374. package/dist/chunks/onChangeAppState-Dp0JIXd8.js +1 -0
  375. package/dist/chunks/open-CDditBQ-.js +1 -0
  376. package/dist/chunks/openai-6KcHd4Hw.js +10 -0
  377. package/dist/chunks/openaiShared-D5lOejS1.js +16 -0
  378. package/dist/chunks/output-style-XDb9-2Kk.js +1 -0
  379. package/dist/chunks/overageCreditGrant-DYiB4sr-.js +1 -0
  380. package/dist/chunks/p-map-9Ud1LOrJ.js +1 -0
  381. package/dist/chunks/p-map-D7WEmnBE.js +1 -0
  382. package/dist/chunks/package-BhL7chzt.js +1 -0
  383. package/dist/chunks/panel-ByW1omJn.js +1 -0
  384. package/dist/chunks/panel-Bz_8td5D.js +1 -0
  385. package/dist/chunks/parseConnectUrl-BS6i9JPo.js +1 -0
  386. package/dist/chunks/parser-CmngCwjB.js +1 -0
  387. package/dist/chunks/parser-SWIZo39J.js +1 -0
  388. package/dist/chunks/passes-Cbc6T_Tj.js +1 -0
  389. package/dist/chunks/path-C4kbwvSH.js +1 -0
  390. package/dist/chunks/paths-Q2255dD7.js +39 -0
  391. package/dist/chunks/permissions-BLzPHh_3.js +3 -0
  392. package/dist/chunks/permissions-DXLfdE7b.js +1 -0
  393. package/dist/chunks/permissions-Ps_D01ZB.js +1 -0
  394. package/dist/chunks/pipeTransport-D7NIp3aA.js +1 -0
  395. package/dist/chunks/plan-DloFVJK7.js +1 -0
  396. package/dist/chunks/platform-CuyedWpe.js +2 -0
  397. package/dist/chunks/plist-BO4ZqMZc.js +6 -0
  398. package/dist/chunks/plugin-XR9IBPMM.js +1 -0
  399. package/dist/chunks/pluginAutoupdate-Cr9hP0zG.js +1 -0
  400. package/dist/chunks/pluginBlocklist-CM9uP8CY.js +1 -0
  401. package/dist/chunks/pluginCliCommands-BQkrvES5.js +1 -0
  402. package/dist/chunks/pluginFlagging-CJ1--2Kw.js +1 -0
  403. package/dist/chunks/pluginOperations-B0rLuSvo.js +2 -0
  404. package/dist/chunks/pluginStartupCheck-Bjdc8zhz.js +1 -0
  405. package/dist/chunks/pluginStartupCheck-Cu2ezD51.js +1 -0
  406. package/dist/chunks/plugins-BgOP_8TX.js +4 -0
  407. package/dist/chunks/policyLimits-CKy_gTEt.js +1 -0
  408. package/dist/chunks/pollConfig-DhptuhFw.js +1 -0
  409. package/dist/chunks/poller-Ds0Y6Cir.js +1 -0
  410. package/dist/chunks/poor-DF0aqXDx.js +1 -0
  411. package/dist/chunks/poorMode-C5Frra4j.js +1 -0
  412. package/dist/chunks/poorMode-DJvjO2nW.js +1 -0
  413. package/dist/chunks/postCommitAttribution-Ehmwzzuq.js +1 -0
  414. package/dist/chunks/print-CPtR0KTa.js +39 -0
  415. package/dist/chunks/privacy-settings-e-7lc7Un.js +1 -0
  416. package/dist/chunks/process-CWupreF6.js +1 -0
  417. package/dist/chunks/process-DMKLUQIO.js +1 -0
  418. package/dist/chunks/processBashCommand-D5dC6Mya.js +1 -0
  419. package/dist/chunks/processSlashCommand-DHRUtZ-C.js +6 -0
  420. package/dist/chunks/projectContext-0fpRKUeH.js +1 -0
  421. package/dist/chunks/projectContext-eXMSfgdZ.js +1 -0
  422. package/dist/chunks/prompt-4tea6NJQ.js +54 -0
  423. package/dist/chunks/prompt-CQC-mh6u.js +1 -0
  424. package/dist/chunks/prompt-DEPUnJdB.js +222 -0
  425. package/dist/chunks/prompt-DawxLANl.js +1 -0
  426. package/dist/chunks/promptEditor-Ci-h04-5.js +4 -0
  427. package/dist/chunks/protocolHandler-DhqM32qE.js +13 -0
  428. package/dist/chunks/protocols-CAyQOlkr.js +7 -0
  429. package/dist/chunks/proxy-CfZp-wce.js +99 -0
  430. package/dist/chunks/rate-limit-options-B0l29Zx8.js +1 -0
  431. package/dist/chunks/rcDebugLog-BbPkkigY.js +11 -0
  432. package/dist/chunks/referral-ByevBJrE.js +1 -0
  433. package/dist/chunks/refresh-B_CwwIRX.js +1 -0
  434. package/dist/chunks/registerProtocol-DzhaQH02.js +36 -0
  435. package/dist/chunks/registry-DkHA4cRu.js +1 -0
  436. package/dist/chunks/release-notes-CZthYkei.js +4 -0
  437. package/dist/chunks/releaseNotes-CwKpIsyd.js +2 -0
  438. package/dist/chunks/reload-plugins-DxWfXvrN.js +1 -0
  439. package/dist/chunks/remote-env-BiRLWIrh.js +1 -0
  440. package/dist/chunks/remoteBridgeCore-nz1fPY1U.js +1 -0
  441. package/dist/chunks/remoteControlServer-FzLUxh2B.js +3 -0
  442. package/dist/chunks/rename-DmGuyncE.js +1 -0
  443. package/dist/chunks/renderOptions-BiyC2rj1.js +1 -0
  444. package/dist/chunks/resume-7GeU7RMS.js +2 -0
  445. package/dist/chunks/rewind-CXplHgh_.js +1 -0
  446. package/dist/chunks/rollback-DbSpxmJE.js +11 -0
  447. package/dist/chunks/runtimeObserver-Duod-ign.js +10 -0
  448. package/dist/chunks/runtimeObserver-OgM9ZYxZ.js +1 -0
  449. package/dist/chunks/sandbox-adapter-CxkhKgaa.js +1 -0
  450. package/dist/chunks/sandbox-toggle-Cc96R6Ox.js +1 -0
  451. package/dist/chunks/sanitization-CYp-9DbE.js +1 -0
  452. package/dist/chunks/satisfies-BaHgd_ie.js +1 -0
  453. package/dist/chunks/schemas-BGAvj1T4.js +40 -0
  454. package/dist/chunks/sdk-DEtgRZvI.js +1 -0
  455. package/dist/chunks/sdkHeapDumpMonitor--fevrC5z.js +1 -0
  456. package/dist/chunks/searchExtraTools-DQ6e601b.js +1 -0
  457. package/dist/chunks/semver-Cq33BYay.js +1 -0
  458. package/dist/chunks/semver-Tw0AFar5.js +1 -0
  459. package/dist/chunks/sentry-BUHYuYGj.js +13 -0
  460. package/dist/chunks/server-C5XZSlto.js +1 -0
  461. package/dist/chunks/server-DzOdtq8A.js +1 -0
  462. package/dist/chunks/serverBanner-WlSYP-f8.js +1 -0
  463. package/dist/chunks/serverLog-DtsUvDiY.js +1 -0
  464. package/dist/chunks/session-DgLqm7ZI.js +2 -0
  465. package/dist/chunks/sessionDataUploader-Ctjo1bgR.js +1 -0
  466. package/dist/chunks/sessionDiscovery-DgNea6qa.js +1 -0
  467. package/dist/chunks/sessionFileAccessHooks-7Svz-7S-.js +1 -0
  468. package/dist/chunks/sessionManager-Dw72ZUTg.js +1 -0
  469. package/dist/chunks/sessionMemory-DIrR3zvb.js +1 -0
  470. package/dist/chunks/sessionMemory-_dmj8lcH.js +1 -0
  471. package/dist/chunks/sessionMemoryUtils-BdQtSkRx.js +1 -0
  472. package/dist/chunks/sessionObserver-CuWMVPlT.js +20 -0
  473. package/dist/chunks/sessionObserver-_adufOGQ.js +1 -0
  474. package/dist/chunks/sessionStorage-W7okgAlQ.js +1 -0
  475. package/dist/chunks/sessionStoragePortable-BI9q2WcJ.js +3 -0
  476. package/dist/chunks/sessionTitle-DzkMzHer.js +14 -0
  477. package/dist/chunks/sessionTracing-DTjmc0EF.js +11 -0
  478. package/dist/chunks/settingsSync-CfYDkakY.js +1 -0
  479. package/dist/chunks/setup-BKUG46jQ.js +9 -0
  480. package/dist/chunks/setup-CmLngvpJ.js +1 -0
  481. package/dist/chunks/setup-TqJ7-Nxh.js +2 -0
  482. package/dist/chunks/shadowedRuleDetection-DesT0yKM.js +1 -0
  483. package/dist/chunks/shellQuote-DgjT8KBA.js +1 -0
  484. package/dist/chunks/sideQuestion-BAq0YyKY.js +20 -0
  485. package/dist/chunks/signin-QEeYpJZw.js +1 -0
  486. package/dist/chunks/sink-B3uP8Cf8.js +1 -0
  487. package/dist/chunks/sink-CaWMZBw_.js +1 -0
  488. package/dist/chunks/sinks-COcy5GnB.js +2 -0
  489. package/dist/chunks/sinks-oFfsKySL.js +1 -0
  490. package/dist/chunks/skill-learning-DOIMPtWE.js +5 -0
  491. package/dist/chunks/skillChangeDetector-CA_Tdx8N.js +1 -0
  492. package/dist/chunks/skillGapStore-CWuw1dYh.js +1 -0
  493. package/dist/chunks/skillGapStore-DpEoKhn-.js +5 -0
  494. package/dist/chunks/skillGenerator-9y3Q4YoO.js +8 -0
  495. package/dist/chunks/skillLearning-BhM09bQD.js +1 -0
  496. package/dist/chunks/skillLearning-_o2D06yM.js +1 -0
  497. package/dist/chunks/skillPanel-Dt24mZTZ.js +28 -0
  498. package/dist/chunks/skillSearchPanel-gaXN64Fu.js +21 -0
  499. package/dist/chunks/skills-Dx3dMHYk.js +1 -0
  500. package/dist/chunks/slashCommandParsing-Cari0pNg.js +1 -0
  501. package/dist/chunks/sleep-8Eb9j_Ly.js +1 -0
  502. package/dist/chunks/sprites-5OAB-Ui2.js +1 -0
  503. package/dist/chunks/src-BIPP3_mo.js +26 -0
  504. package/dist/chunks/src-BJz1KAd_.js +6 -0
  505. package/dist/chunks/src-BRAdBA8A.js +1 -0
  506. package/dist/chunks/src-BRC_BuUP.js +1 -0
  507. package/dist/chunks/src-BaB-bpCj.js +5 -0
  508. package/dist/chunks/src-BlLavFUS.js +7 -0
  509. package/dist/chunks/src-C5yhFG0C.js +19 -0
  510. package/dist/chunks/src-CI_jaaBj.js +2 -0
  511. package/dist/chunks/src-CRsA-Z4y.js +1 -0
  512. package/dist/chunks/src-CYLfL70h.js +1 -0
  513. package/dist/chunks/src-DJXCzwyJ.js +1 -0
  514. package/dist/chunks/src-DJXKJavk.js +1 -0
  515. package/dist/chunks/src-Di342QoJ.js +53 -0
  516. package/dist/chunks/src-DsMd9Q9e.js +2 -0
  517. package/dist/chunks/src-DzH9IdOo.js +1 -0
  518. package/dist/chunks/src-hdbPEvzO.js +9 -0
  519. package/dist/chunks/src-poaoYkuc.js +1 -0
  520. package/dist/chunks/src-x7u_sB6m.js +1 -0
  521. package/dist/chunks/sso-oidc-BX1MlBX0.js +1 -0
  522. package/dist/chunks/startupProfiler-DnXZaX4A.js +3 -0
  523. package/dist/chunks/startupProfiler-SOE--nM9.js +1 -0
  524. package/dist/chunks/state-B2GIOsTB.js +1 -0
  525. package/dist/chunks/state-Ce1HlR-H.js +1 -0
  526. package/dist/chunks/state-sIHsFpDu.js +1 -0
  527. package/dist/chunks/staticRender-Br64h1E1.js +1 -0
  528. package/dist/chunks/stats-TUExo9iU.js +1 -0
  529. package/dist/chunks/status-Dghaz1my.js +1 -0
  530. package/dist/chunks/statusNoticeHelpers-DVZSSXeK.js +1 -0
  531. package/dist/chunks/stdio-BEEzuxaZ.js +1 -0
  532. package/dist/chunks/stdio-D4cT86R0.js +3 -0
  533. package/dist/chunks/stickers-2K05wjSp.js +1 -0
  534. package/dist/chunks/store-DhI7Lcan.js +1 -0
  535. package/dist/chunks/sts-BDFJ-6QE.js +1 -0
  536. package/dist/chunks/subprocessEnv-CggQWZCx.js +1 -0
  537. package/dist/chunks/subprocessEnv-DV6q6o6w.js +1 -0
  538. package/dist/chunks/supports-color-lkzOMQ6u.js +1 -0
  539. package/dist/chunks/systemPromptSections-BcN_XBTx.js +1 -0
  540. package/dist/chunks/systemPromptSections-DB93ZNWP.js +1 -0
  541. package/dist/chunks/systemTheme-dDbitcxB.js +1 -0
  542. package/dist/chunks/tag-ZcVkzFjz.js +11 -0
  543. package/dist/chunks/tasks-DbB33ekt.js +1 -0
  544. package/dist/chunks/teamHelpers-BmN9nKz-.js +1 -0
  545. package/dist/chunks/teamHelpers-yeTNtZbb.js +1 -0
  546. package/dist/chunks/teammate-DMYOtLTK.js +1 -0
  547. package/dist/chunks/teammateModeSnapshot-CPjJJDL1.js +1 -0
  548. package/dist/chunks/teammateModeSnapshot-CsNIJTKi.js +1 -0
  549. package/dist/chunks/teleport-JHgpwZIh.js +1 -0
  550. package/dist/chunks/templateJobs-Db630FZD.js +12 -0
  551. package/dist/chunks/terminalSetup-DJqWE8fc.js +33 -0
  552. package/dist/chunks/terminalSetup-ygKHrVKR.js +1 -0
  553. package/dist/chunks/theme-MmfFhdTD.js +1 -0
  554. package/dist/chunks/thinkback-CrNirB0V.js +1 -0
  555. package/dist/chunks/thinkback-Quc7KPmi.js +1 -0
  556. package/dist/chunks/thinkback-play-CQ1s7oqg.js +1 -0
  557. package/dist/chunks/tmux-CvbhsfwG.js +1 -0
  558. package/dist/chunks/toolEventObserver-BqMplcIk.js +1 -0
  559. package/dist/chunks/toolEventObserver-DBq2XBYY.js +1 -0
  560. package/dist/chunks/toolPool-BkCtTKXz.js +1 -0
  561. package/dist/chunks/toolPool-C7bOwJfR.js +1 -0
  562. package/dist/chunks/trustedDevice-C9Zevohz.js +1 -0
  563. package/dist/chunks/trustedDevice-DEuQUTbz.js +1 -0
  564. package/dist/chunks/tui-BVc2q4Xv.js +6 -0
  565. package/dist/chunks/turndown.es-Bv06VjMb.js +69 -0
  566. package/dist/chunks/types-CQ1wrnQ0.js +1 -0
  567. package/dist/chunks/types-Csi32ZXh.js +17 -0
  568. package/dist/chunks/types-RJTEOuIt.js +3 -0
  569. package/dist/chunks/udsClient-BvG_Jip0.js +1 -0
  570. package/dist/chunks/ultrareviewCommand-DrlfRrXq.js +3 -0
  571. package/dist/chunks/undercover-CBeHiWUd.js +1 -0
  572. package/dist/chunks/undercover-DKn95mh9.js +31 -0
  573. package/dist/chunks/up-D-U4wUCe.js +12 -0
  574. package/dist/chunks/updateCCB-CJ7dCUan.js +11 -0
  575. package/dist/chunks/upgrade-Degqbu8S.js +1 -0
  576. package/dist/chunks/upgrade-ucJ-lnlY.js +1 -0
  577. package/dist/chunks/upload-pTZQCPLt.js +1 -0
  578. package/dist/chunks/upstreamproxy-DcLeL2XX.js +11 -0
  579. package/dist/chunks/usage-D96a7Cke.js +1 -0
  580. package/dist/chunks/usage-DVQMUMcC.js +1 -0
  581. package/dist/chunks/useKeybinding-FsOnjW6T.js +1 -0
  582. package/dist/chunks/useMainLoopModel-B7ch2o9K.js +1 -0
  583. package/dist/chunks/useManagePlugins-BfGzHMvO.js +1 -0
  584. package/dist/chunks/useMergedTools-TemEvCrX.js +1 -0
  585. package/dist/chunks/useSearchInput-B-V4kIa-.js +1 -0
  586. package/dist/chunks/useSettingsErrors-B2JGz1s8.js +1 -0
  587. package/dist/chunks/useVoice-BuwYDm2U.js +1 -0
  588. package/dist/chunks/util-CeIKZmj9.js +1 -0
  589. package/dist/chunks/utils-CwhszpkT.js +1 -0
  590. package/dist/chunks/v4-f1i_CNUT.js +1 -0
  591. package/dist/chunks/validatePlugin-BlVho93x.js +1 -0
  592. package/dist/chunks/vertex-sdk-CSGw3fvU.js +9 -0
  593. package/dist/chunks/vim-DUZQCWUP.js +1 -0
  594. package/dist/chunks/voice-BkRIHZiM.js +2 -0
  595. package/dist/chunks/voice-DXiiy8HX.js +8 -0
  596. package/dist/chunks/voiceModeEnabled-CPQUE3PU.js +1 -0
  597. package/dist/chunks/voiceModeEnabled-DB8GCzAF.js +1 -0
  598. package/dist/chunks/voiceStreamSTT-DgoDscHn.js +1 -0
  599. package/dist/chunks/voiceStreamSTT-Dr_wH1Kh.js +1 -0
  600. package/dist/chunks/which-DqSAIvp2.js +1 -0
  601. package/dist/chunks/windowsPaths-C9CigqoF.js +1 -0
  602. package/dist/chunks/windowsPaths-swxCp7bX.js +2 -0
  603. package/dist/chunks/workSecret-mS2OrpxF.js +1 -0
  604. package/dist/chunks/workerRegistry-CT7_kjvY.js +1 -0
  605. package/dist/chunks/worktree-DU3xtwKW.js +1 -0
  606. package/dist/chunks/worktreeModeEnabled-Db6b_Iy_.js +1 -0
  607. package/dist/chunks/worktreeModeEnabled-THQb19xR.js +1 -0
  608. package/dist/chunks/wrapper-BSK0MCQH.js +1 -0
  609. package/dist/chunks/wrapper-D5qL1aQL.js +6 -0
  610. package/dist/chunks/xdg-CBxMmQux.js +1 -0
  611. package/dist/chunks/xml-DD_ldd3X.js +1 -0
  612. package/dist/chunks/zod-DT6hytkp.js +1 -0
  613. package/dist/cli.js +1 -10978
  614. package/package.json +1 -1
@@ -0,0 +1,17 @@
1
+ import{a as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,H as a,X as o,cn as s}from"./state-sIHsFpDu.js";import{Fa as c,Mr as l,Na as u,Pr as d,S as f,co as p,no as ee,oo as te}from"./paths-Q2255dD7.js";import{K as ne,V as m,d as h,h as re,p as g,s as ie,w as _}from"./debug-UI3T040K.js";import{n as ae,r as v}from"./analytics-DqMQntaB.js";import{n as y,t as b}from"./cwd--iizewsn.js";import{o as x,s as S,v as C,y as w}from"./log-CzsijfHZ.js";import{E as T,O as E,T as oe}from"./teammate-DMYOtLTK.js";import{$S as se,AE as ce,Ab as le,Ar as ue,CD as de,Co as D,DD as O,Fb as k,Gl as A,IE as j,Lo as M,ME as N,Mb as P,SD as F,So as I,Wl as L,ZS as R,bo as z,fC as B,jE as V,jO as H,jb as fe,pt as pe,rt as me,tt as U,uC as he,vS as ge,wt as _e,xr as ve,yS as ye}from"./loadAgentsDir-Ci5mr0vm.js";import{Bn as be,Vn as xe}from"./prompt-DEPUnJdB.js";import{X as Se}from"./rcDebugLog-BbPkkigY.js";import{n as Ce,r as we}from"./magicDocs-BfoeYhin.js";import{n as Te,t as Ee}from"./pluginAutoupdate-Cr9hP0zG.js";import{n as De,r as Oe}from"./registerProtocol-DzhaQH02.js";import{homedir as ke}from"os";import{join as W}from"path";import"crypto";import*as G from"fs/promises";r(),s(),y(),_(),re(),ie(),w(),te(),c(),d(),f(),xe(),O(),ce(),A(),ue(),we(),U(),x(),m(),M(),H(),U(),de(),m(),x(),M(),H();async function Ae(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),a=n(b(),`.claude`,`skills`,e,`SKILL.md`),o;try{o=await r.readFile(a,`utf-8`)}catch{S(Error(`Failed to read skill file for improvement: ${a}`));return}let s=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
+ `),c=l(),d=j()?V({sessionId:i(),model:c,provider:u(),name:`skill-improvement-apply`}):null,f=await me({messages:[z({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
+
4
+ <current_skill_file>
5
+ ${o}
6
+ </current_skill_file>
7
+
8
+ <improvements>
9
+ ${s}
10
+ </improvements>
11
+
12
+ Rules:
13
+ - Integrate the improvements naturally into the existing structure
14
+ - Preserve frontmatter (--- block) exactly as-is
15
+ - Preserve the overall format and style
16
+ - Do not remove existing content unless an improvement explicitly replaces it
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:Se([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:F().signal,options:{getToolPermissionContext:async()=>be(),model:c,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[],langfuseTrace:d}});N(d);let p=I(D(Array.isArray(f.message.content)?f.message.content:[]).trim(),`updated_file`);if(!p){S(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(a,p,`utf-8`)}catch(e){S(ne(e))}}ae(),se(),oe(),x(),P(),ye(),fe(),B(),_e();var je=30;function K(){let e=((ee()||{}).cleanupPeriodDays??je)*24*60*60*1e3;return new Date(Date.now()-e)}function Me(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function Ne(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function q(e,t,n){let r={messages:0,errors:0};try{let i=await g().readdir(e);for(let a of i)try{Ne(a.name)<t&&(await g().unlink(W(e,a.name)),n?r.messages++:r.errors++)}catch(e){S(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&S(e)}return r}async function Pe(){let e=g(),t=K(),n=C.errors(),r=C.baseLogs(),i=await q(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>W(r,e.name));for(let n of a)i=Me(i,await q(n,t,!0)),await Y(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&S(e)}return i}async function J(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Y(e,t){try{await t.rmdir(e)}catch{}}async function Fe(){let e=K(),t={messages:0,errors:0},n=ve(),r=g(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=W(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=W(i,n.name),o=W(a,he),s;try{s=await r.readdir(o)}catch{await Y(a,r);continue}for(let n of s)if(n.isFile())try{await J(W(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=W(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Y(i,r)}await Y(o,r),await Y(a,r)}await Y(i,r)}return t}async function Ie(e,t,n=!0){let r=K(),i={messages:0,errors:0},a=g(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await J(W(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Y(e,a),i}function Le(){return Ie(W(n(),`plans`),`.md`)}async function Re(){let e=K(),t={messages:0,errors:0},r=g();try{let i=W(n(),`file-history`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));await Promise.all(o.map(async n=>{try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}})),await Y(i,r)}catch(e){S(e)}return t}async function ze(){let e=K(),t={messages:0,errors:0},r=g();try{let i=W(n(),`session-env`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));for(let n of o)try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}await Y(i,r)}catch(e){S(e)}return t}async function X(){let e=K(),t={messages:0,errors:0},r=g(),i=W(n(),`debug`),a;try{a=await r.readdir(i)}catch{return t}for(let n of a)if(!(!n.isFile()||!n.name.endsWith(`.txt`)||n.name===`latest`))try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}return t}var Z=1440*60*1e3;async function Q(){let e=W(n(),`.npm-cache-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){h(`npm cache cleanup: skipping, ran recently`);return}}catch{}try{await T(e,{retries:0,realpath:!1})}catch{h(`npm cache cleanup: skipping, lock held`);return}h(`npm cache cleanup: starting`);let r=W(ke(),`.npm`,`_cacache`),i=Date.now();try{let n=await import(`./lib-inCisXen.js`).then(e=>t(e.default,1)),a=i-Z,o=n.ls.stream(r),s=[];for await(let e of o)e.key.includes(`@anthropic-ai/claude-`)&&s.push({key:e.key,time:e.time});let c=new Map;for(let e of s){let t=e.key.lastIndexOf(`@`),n=t>0?e.key.slice(0,t):e.key,r=c.get(n)??[];r.push(e),c.set(n,r)}let l=[];for(let[,e]of c){e.sort((e,t)=>t.time-e.time);for(let t=0;t<e.length;t++){let n=e[t];(n.time<a||t>=5)&&l.push(n.key)}}await Promise.all(l.map(e=>n.rm.entry(r,e))),await G.writeFile(e,new Date().toISOString());let u=Date.now()-i;l.length>0?h(`npm cache cleanup: Removed ${l.length} old @anthropic-ai entries in ${u}ms`):h(`npm cache cleanup: completed in ${u}ms`),v(`tengu_npm_cache_cleanup`,{success:!0,durationMs:u,entriesRemoved:l.length})}catch(e){S(e),v(`tengu_npm_cache_cleanup`,{success:!1,durationMs:Date.now()-i})}finally{await E(e,{realpath:!1}).catch(()=>{})}}async function Be(){let e=W(n(),`.version-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){h(`version cleanup: skipping, ran recently`);return}}catch{}try{await T(e,{retries:0,realpath:!1})}catch{h(`version cleanup: skipping, lock held`);return}h(`version cleanup: starting (throttled)`);try{await k(),await G.writeFile(e,new Date().toISOString())}catch(e){S(e)}finally{await E(e,{realpath:!1}).catch(()=>{})}}async function Ve(){let{errors:e}=le();if(e.length>0&&p(`cleanupPeriodDays`)){h(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await Pe(),await Fe(),await Le(),await Re(),await ze(),await X(),await R(),await ge(K());let t=await pe(K());t>0&&v(`tengu_worktree_cleanup`,{removed:t}),process.env.USER_TYPE===`ant`&&await Q()}s(),P(),Te();var He=(De(),e(Oe)),Ue=1440*60*1e3,$=600*1e3;function We(){Ce(),import(`./extractMemories-jvjCvtpC.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),L(),Ee(),a()&&He.ensureDeepLinkProtocolRegistered();let e=!0;async function t(){if(a()&&o()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Ve()),a()&&o()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await k()}setTimeout(t,$).unref(),process.env.USER_TYPE===`ant`&&setInterval(()=>{Q(),Be()},Ue).unref()}export{Ae as n,We as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-CYnAG60-.js";export{e as startBackgroundHousekeeping};
@@ -0,0 +1,2 @@
1
+ import{C as e,E as t,s as n,v as r}from"./git-CN3qtTb_.js";import{g as i,m as a,x as o}from"./startupProfiler-DnXZaX4A.js";import{homedir as s}from"os";import{join as c,sep as l}from"path";import{stat as u}from"fs/promises";o(),t(),r();var d=10080*60*1e3,f=1e3;function p(e){let t=[`This session was opened by an external deep link in ${g(e.cwd)}`];if(e.repo){let n=e.lastFetch?i(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>d;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — CLAUDE.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>f?`The prompt below (${a(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
+ `)}async function m(t){let r=await n(t);if(!r)return;let i=await e(r),[a,o]=await Promise.all([h(c(r,`FETCH_HEAD`)),i?h(c(i,`FETCH_HEAD`)):Promise.resolve(void 0)]);return a&&o?a>o?a:o:a??o}async function h(e){try{let{mtime:t}=await u(e);return t}catch{return}}function g(e){let t=s();return e===t?`~`:e.startsWith(t+l)?`~`+e.slice(t.length):e}export{m as n,p as t};
@@ -0,0 +1 @@
1
+ import{t as e}from"./chunk-DR8-3Aex.js";var t=e((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}}));export{t};
@@ -0,0 +1,15 @@
1
+ import{a as e,n as t,r as n,t as r}from"./chunk-DR8-3Aex.js";import{_ as i,a,b as o,c as s,f as c,h as l,i as u,l as d,n as f,o as p,r as m,s as h}from"./client-_sjL0I7A.js";import{Fr as ee,Jr as te,Kr as ne,Rr as re,Ur as ie,Wr as ae,Xr as oe,Yr as se,Zr as ce,qr as le,t as ue}from"./dist-es-CLK1mey-.js";import{A as de,M as fe,j as pe}from"./protocols-CAyQOlkr.js";import{t as me}from"./sdk-DEtgRZvI.js";import{Readable as he}from"stream";import{Buffer as ge}from"buffer";import _e from"assert";import"https";import"http";var g=n({__assign:()=>y,__asyncDelegator:()=>Me,__asyncGenerator:()=>je,__asyncValues:()=>Ne,__await:()=>_,__awaiter:()=>Ce,__classPrivateFieldGet:()=>Le,__classPrivateFieldSet:()=>Re,__createBinding:()=>Te,__decorate:()=>be,__exportStar:()=>Ee,__extends:()=>ve,__generator:()=>we,__importDefault:()=>Ie,__importStar:()=>Fe,__makeTemplateObject:()=>Pe,__metadata:()=>Se,__param:()=>xe,__read:()=>Oe,__rest:()=>ye,__spread:()=>ke,__spreadArrays:()=>Ae,__values:()=>De});function ve(e,t){v(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function ye(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function be(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function xe(e,t){return function(n,r){t(n,r,e)}}function Se(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function Ce(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function we(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function Te(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function Ee(e,t){for(var n in e)n!==`default`&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function De(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function Oe(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function ke(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(Oe(arguments[t]));return e}function Ae(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function _(e){return this instanceof _?(this.v=e,this):new _(e)}function je(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof _?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Me(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:_(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function Ne(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof De==`function`?De(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Pe(e,t){return Object.defineProperty?Object.defineProperty(e,`raw`,{value:t}):e.raw=t,e}function Fe(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Ie(e){return e&&e.__esModule?e:{default:e}}function Le(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function Re(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var v,y,b=t((()=>{v=function(e,t){return v=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},v(e,t)},y=function(){return y=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},y.apply(this,arguments)}})),ze=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.MAX_HASHABLE_LENGTH=e.INIT=e.KEY=e.DIGEST_LENGTH=e.BLOCK_SIZE=void 0,e.BLOCK_SIZE=64,e.DIGEST_LENGTH=32,e.KEY=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),e.INIT=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],e.MAX_HASHABLE_LENGTH=2**53-1})),Be=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RawSha256=void 0;var t=ze();e.RawSha256=function(){function e(){this.state=Int32Array.from(t.INIT),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw Error(`Attempted to update an already finished hash.`);var n=0,r=e.byteLength;if(this.bytesHashed+=r,this.bytesHashed*8>t.MAX_HASHABLE_LENGTH)throw Error(`Cannot hash more than 2^53 - 1 bits`);for(;r>0;)this.buffer[this.bufferLength++]=e[n++],r--,this.bufferLength===t.BLOCK_SIZE&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=this.bytesHashed*8,n=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(n.setUint8(this.bufferLength++,128),r%t.BLOCK_SIZE>=t.BLOCK_SIZE-8){for(var i=this.bufferLength;i<t.BLOCK_SIZE;i++)n.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<t.BLOCK_SIZE-8;i++)n.setUint8(i,0);n.setUint32(t.BLOCK_SIZE-8,Math.floor(e/4294967296),!0),n.setUint32(t.BLOCK_SIZE-4,e),this.hashBuffer(),this.finished=!0}for(var a=new Uint8Array(t.DIGEST_LENGTH),i=0;i<8;i++)a[i*4]=this.state[i]>>>24&255,a[i*4+1]=this.state[i]>>>16&255,a[i*4+2]=this.state[i]>>>8&255,a[i*4+3]=this.state[i]>>>0&255;return a},e.prototype.hashBuffer=function(){for(var e=this,n=e.buffer,r=e.state,i=r[0],a=r[1],o=r[2],s=r[3],c=r[4],l=r[5],u=r[6],d=r[7],f=0;f<t.BLOCK_SIZE;f++){if(f<16)this.temp[f]=(n[f*4]&255)<<24|(n[f*4+1]&255)<<16|(n[f*4+2]&255)<<8|n[f*4+3]&255;else{var p=this.temp[f-2],m=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10;p=this.temp[f-15];var h=(p>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[f]=(m+this.temp[f-7]|0)+(h+this.temp[f-16]|0)}var ee=(((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))+(c&l^~c&u)|0)+(d+(t.KEY[f]+this.temp[f]|0)|0)|0,te=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&a^i&o^a&o)|0;d=u,u=l,l=c,c=s+ee|0,s=o,o=a,a=i,i=ee+te|0}r[0]+=i,r[1]+=a,r[2]+=o,r[3]+=s,r[4]+=c,r[5]+=l,r[6]+=u,r[7]+=d},e}()})),Ve,He,Ue=t((()=>{Ve=e=>{let t=[];for(let n=0,r=e.length;n<r;n++){let r=e.charCodeAt(n);if(r<128)t.push(r);else if(r<2048)t.push(r>>6|192,r&63|128);else if(n+1<e.length&&(r&64512)==55296&&(e.charCodeAt(n+1)&64512)==56320){let i=65536+((r&1023)<<10)+(e.charCodeAt(++n)&1023);t.push(i>>18|240,i>>12&63|128,i>>6&63|128,i&63|128)}else t.push(r>>12|224,r>>6&63|128,r&63|128)}return Uint8Array.from(t)},He=e=>{let t=``;for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r<128)t+=String.fromCharCode(r);else if(192<=r&&r<224){let i=e[++n];t+=String.fromCharCode((r&31)<<6|i&63)}else if(240<=r&&r<365){let i=`%`+[r,e[++n],e[++n],e[++n]].map(e=>e.toString(16)).join(`%`);t+=decodeURIComponent(i)}else t+=String.fromCharCode((r&15)<<12|(e[++n]&63)<<6|e[++n]&63)}return t}}));function We(e){return new TextEncoder().encode(e)}function Ge(e){return new TextDecoder(`utf-8`).decode(e)}var Ke=t((()=>{})),qe=n({fromUtf8:()=>Je,toUtf8:()=>Ye}),Je,Ye,Xe=t((()=>{Ue(),Ke(),Je=e=>typeof TextEncoder==`function`?We(e):Ve(e),Ye=e=>typeof TextDecoder==`function`?Ge(e):He(e)})),Ze=r((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.convertToBuffer=void 0;var n=(Xe(),e(qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),Qe=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),$e=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),et=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),tt=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=Ze();Object.defineProperty(e,`convertToBuffer`,{enumerable:!0,get:function(){return t.convertToBuffer}});var n=Qe();Object.defineProperty(e,`isEmptyData`,{enumerable:!0,get:function(){return n.isEmptyData}});var r=$e();Object.defineProperty(e,`numToUint8`,{enumerable:!0,get:function(){return r.numToUint8}});var i=et();Object.defineProperty(e,`uint32ArrayFrom`,{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),nt=r((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.Sha256=void 0;var n=(b(),e(g)),r=ze(),i=Be(),a=tt();t.Sha256=function(){function e(e){this.secret=e,this.hash=new i.RawSha256,this.reset()}return e.prototype.update=function(e){if(!((0,a.isEmptyData)(e)||this.error))try{this.hash.update((0,a.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new i.RawSha256,this.secret){this.outer=new i.RawSha256;var e=o(this.secret),t=new Uint8Array(r.BLOCK_SIZE);t.set(e);for(var n=0;n<r.BLOCK_SIZE;n++)e[n]^=54,t[n]^=92;this.hash.update(e),this.outer.update(t);for(var n=0;n<e.byteLength;n++)e[n]=0}},e}();function o(e){var t=(0,a.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var n=new i.RawSha256;n.update(t),t=n.digest()}var o=new Uint8Array(r.BLOCK_SIZE);return o.set(t),o}})),rt=r((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),(b(),e(g)).__exportStar(nt(),t)})),it=t((()=>{})),at=t((()=>{it()})),ot=t((()=>{})),st,ct=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(st||(st={}))})),lt,ut=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(lt||(lt={}))})),dt=t((()=>{})),ft=t((()=>{})),pt=t((()=>{})),mt=t((()=>{})),ht=t((()=>{ct(),ut(),dt(),ft(),pt(),mt()})),gt=t((()=>{})),_t=t((()=>{})),vt=t((()=>{})),yt=t((()=>{})),bt=t((()=>{})),xt=t((()=>{})),St=t((()=>{})),Ct=t((()=>{bt(),xt(),St()})),wt=t((()=>{})),Tt=t((()=>{})),Et,Dt=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(Et||(Et={}))})),Ot=t((()=>{})),kt=t((()=>{})),At=t((()=>{})),jt=t((()=>{})),Mt=t((()=>{})),Nt=t((()=>{Ot(),kt(),At(),jt(),Mt()})),Pt=t((()=>{})),Ft,It=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(Ft||(Ft={}))})),Lt=t((()=>{It()})),Rt=t((()=>{})),zt=t((()=>{Lt(),Rt(),It()})),Bt,Vt=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(Bt||(Bt={}))})),Ht=t((()=>{})),Ut=t((()=>{})),Wt=t((()=>{})),Gt=t((()=>{})),Kt=t((()=>{})),qt=t((()=>{Ut(),Wt(),Gt(),Kt()})),Jt=t((()=>{})),Yt=t((()=>{})),Xt=t((()=>{})),Zt,Qt=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(Zt||(Zt={}))})),$t=t((()=>{})),en=t((()=>{})),tn=t((()=>{})),nn=t((()=>{})),rn=t((()=>{})),an=t((()=>{})),on=t((()=>{})),sn=t((()=>{})),cn=t((()=>{})),ln,un=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(ln||(ln={}))})),dn=t((()=>{})),fn=t((()=>{})),pn=t((()=>{})),mn=t((()=>{})),hn=t((()=>{})),gn=t((()=>{})),_n=t((()=>{ot(),ht(),gt(),_t(),vt(),yt(),Ct(),wt(),Tt(),Dt(),Nt(),Pt(),zt(),Vt(),Ht(),qt(),Jt(),Yt(),Xt(),Qt(),$t(),en(),tn(),nn(),rn(),an(),on(),sn(),cn(),un(),dn(),fn(),pn(),mn(),hn(),gn()})),vn=t((()=>{_n()})),yn=t((()=>{})),bn=t((()=>{}));function xn(e){return Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})}var Sn,Cn=t((()=>{Sn=class e{constructor(e){this.method=e.method||`GET`,this.hostname=e.hostname||`localhost`,this.port=e.port,this.query=e.query||{},this.headers=e.headers||{},this.body=e.body,this.protocol=e.protocol?e.protocol.slice(-1)===`:`?e.protocol:`${e.protocol}:`:`https:`,this.path=e.path?e.path.charAt(0)===`/`?e.path:`/${e.path}`:`/`,this.username=e.username,this.password=e.password,this.fragment=e.fragment}static isInstance(e){if(!e)return!1;let t=e;return`method`in t&&`protocol`in t&&`hostname`in t&&`path`in t&&typeof t.query==`object`&&typeof t.headers==`object`}clone(){let t=new e({...this,headers:{...this.headers}});return t.query&&(t.query=xn(t.query)),t}}})),wn=t((()=>{})),Tn=t((()=>{})),En=t((()=>{})),x=t((()=>{at(),vn(),yn(),bn(),Cn(),wn(),Tn(),En()}));function Dn(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in C)t[n/2]=C[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function S(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=On[e[n]];return t}var On,C,w=t((()=>{On={},C={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),On[e]=t,C[t]=e}})),kn=t((()=>{})),An,jn=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(An||(An={}))})),Mn,Nn=t((()=>{(function(e){e.HEADER=`header`,e.QUERY=`query`})(Mn||(Mn={}))})),Pn=t((()=>{})),Fn=t((()=>{})),In=t((()=>{})),Ln=t((()=>{})),Rn=t((()=>{jn(),Nn(),Pn(),Fn(),In(),Ln()})),zn=t((()=>{})),Bn=t((()=>{})),Vn=t((()=>{})),Hn=t((()=>{})),Un=t((()=>{})),Wn=t((()=>{})),Gn=t((()=>{})),Kn=t((()=>{Un(),Wn(),Gn()})),qn=t((()=>{})),Jn=t((()=>{})),Yn,Xn=t((()=>{(function(e){e.HTTP=`http`,e.HTTPS=`https`})(Yn||(Yn={}))})),Zn=t((()=>{})),Qn=t((()=>{})),$n=t((()=>{})),er=t((()=>{})),tr=t((()=>{})),nr=t((()=>{Zn(),Qn(),$n(),er(),tr()})),rr=t((()=>{})),ir,ar=t((()=>{(function(e){e.MD5=`md5`,e.CRC32=`crc32`,e.CRC32C=`crc32c`,e.SHA1=`sha1`,e.SHA256=`sha256`})(ir||(ir={}))})),or=t((()=>{ar()})),sr=t((()=>{})),cr=t((()=>{or(),sr(),ar()})),lr=t((()=>{})),ur,dr=t((()=>{(function(e){e[e.HEADER=0]=`HEADER`,e[e.TRAILER=1]=`TRAILER`})(ur||(ur={}))})),fr=t((()=>{})),pr=t((()=>{})),mr=t((()=>{})),hr=t((()=>{})),gr=t((()=>{})),_r=t((()=>{pr(),mr(),hr(),gr()})),vr=t((()=>{})),yr=t((()=>{})),br=t((()=>{})),xr,Sr=t((()=>{(function(e){e.PROFILE=`profile`,e.SSO_SESSION=`sso-session`,e.SERVICES=`services`})(xr||(xr={}))})),Cr=t((()=>{})),wr=t((()=>{})),Tr=t((()=>{})),Er=t((()=>{})),Dr=t((()=>{})),Or=t((()=>{})),kr=t((()=>{})),Ar=t((()=>{})),jr=t((()=>{})),Mr,Nr=t((()=>{(function(e){e.HTTP_0_9=`http/0.9`,e.HTTP_1_0=`http/1.0`,e.TDS_8_0=`tds/8.0`})(Mr||(Mr={}))})),Pr=t((()=>{})),Fr=t((()=>{})),Ir=t((()=>{})),Lr=t((()=>{})),Rr=t((()=>{})),zr=t((()=>{})),Br=t((()=>{kn(),Rn(),zn(),Bn(),Vn(),Hn(),Kn(),qn(),Jn(),Xn(),nr(),rr(),cr(),lr(),dr(),fr(),_r(),vr(),yr(),br(),Sr(),Cr(),wr(),Tr(),Er(),Dr(),Or(),kr(),Ar(),jr(),Nr(),Pr(),Fr(),Ir(),Lr(),Rr(),zr()})),Vr=t((()=>{Br()})),Hr,Ur=t((()=>{Hr=e=>{if(typeof e==`function`)return e;let t=Promise.resolve(e);return()=>t}})),Wr=t((()=>{Vr(),Ur()})),T,Gr,Kr=t((()=>{T=e=>encodeURIComponent(e).replace(/[!'()*]/g,Gr),Gr=e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`})),qr=t((()=>{})),Jr=t((()=>{Kr(),qr()})),Yr,Xr=t((()=>{Yr=e=>typeof ArrayBuffer==`function`&&e instanceof ArrayBuffer||Object.prototype.toString.call(e)===`[object ArrayBuffer]`})),Zr,Qr=t((()=>{Zr=(e,t)=>{if(typeof e!=`string`)throw TypeError(`The "input" argument must be of type string. Received type ${typeof e} (${e})`);return t?ge.from(e,t):ge.from(e)}})),E,$r=t((()=>{Qr(),E=e=>{let t=Zr(e,`utf8`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength/Uint8Array.BYTES_PER_ELEMENT)}})),D,ei=t((()=>{$r(),D=e=>typeof e==`string`?E(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)})),ti=t((()=>{})),O=t((()=>{$r(),ei(),ti()})),ni,ri,ii,ai,oi,si,ci,li,ui,di,fi,pi,mi,hi,gi,_i,k,vi,yi,bi,A=t((()=>{ni=`X-Amz-Algorithm`,ri=`X-Amz-Credential`,ii=`X-Amz-Date`,ai=`X-Amz-SignedHeaders`,oi=`X-Amz-Expires`,si=`X-Amz-Signature`,ci=`X-Amz-Security-Token`,li=`authorization`,ui=ii.toLowerCase(),di=`date`,fi=[li,ui,di],si.toLowerCase(),pi=`x-amz-content-sha256`,mi=ci.toLowerCase(),hi={authorization:!0,"cache-control":!0,connection:!0,expect:!0,from:!0,"keep-alive":!0,"max-forwards":!0,pragma:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,"x-amzn-trace-id":!0},gi=/^proxy-/,_i=/^sec-/,k=`AWS4-HMAC-SHA256`,vi=`AWS4-HMAC-SHA256-PAYLOAD`,yi=`UNSIGNED-PAYLOAD`,bi=`aws4_request`})),j,M,N,xi,Si,Ci=t((()=>{w(),O(),A(),j={},M=[],N=(e,t,n)=>`${e}/${t}/${n}/${bi}`,xi=async(e,t,n,r,i)=>{let a=`${n}:${r}:${i}:${S(await Si(e,t.secretAccessKey,t.accessKeyId))}:${t.sessionToken}`;if(a in j)return j[a];for(M.push(a);M.length>50;)delete j[M.shift()];let o=`AWS4${t.secretAccessKey}`;for(let t of[n,r,i,bi])o=await Si(e,o,t);return j[a]=o},Si=(e,t,n)=>{let r=new e(t);return r.update(D(n)),r.digest()}})),wi,Ti=t((()=>{A(),wi=({headers:e},t,n)=>{let r={};for(let i of Object.keys(e).sort()){if(e[i]==null)continue;let a=i.toLowerCase();(a in hi||t?.has(a)||gi.test(a)||_i.test(a))&&(!n||n&&!n.has(a))||(r[a]=e[i].trim().replace(/\s+/g,` `))}return r}})),Ei,Di=t((()=>{Jr(),A(),Ei=({query:e={}})=>{let t=[],n={};for(let r of Object.keys(e).sort()){if(r.toLowerCase()===`x-amz-signature`)continue;t.push(r);let i=e[r];typeof i==`string`?n[r]=`${T(r)}=${T(i)}`:Array.isArray(i)&&(n[r]=i.slice(0).reduce((e,t)=>e.concat([`${T(r)}=${T(t)}`]),[]).sort().join(`&`))}return t.map(e=>n[e]).filter(e=>e).join(`&`)}})),P,Oi=t((()=>{Xr(),w(),O(),A(),P=async({headers:e,body:t},n)=>{for(let t of Object.keys(e))if(t.toLowerCase()===`x-amz-content-sha256`)return e[t];if(t==null)return`e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855`;if(typeof t==`string`||ArrayBuffer.isView(t)||Yr(t)){let e=new n;return e.update(D(t)),S(await e.digest())}return yi}}));function ki(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var Ai,ji,Mi,Ni,Pi=t((()=>{w(),O(),Ai=class{format(e){let t=[];for(let n of Object.keys(e)){let r=E(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=E(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(Ni.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!Mi.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(Dn(e.value.replace(/\-/g,``)),1),u}}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(ji||(ji={})),Mi=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/,Ni=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&ki(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&ki(e),parseInt(S(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),Fi,Ii=t((()=>{Fi=(e,t)=>{e=e.toLowerCase();for(let n of Object.keys(t))if(e===n.toLowerCase())return!0;return!1}})),Li,Ri,zi=t((()=>{Li=({headers:e,query:t,...n})=>({...n,headers:{...e},query:t?Ri(t):void 0}),Ri=e=>Object.keys(e).reduce((t,n)=>{let r=e[n];return{...t,[n]:Array.isArray(r)?[...r]:r}},{})})),Bi,Vi=t((()=>{zi(),Bi=(e,t={})=>{let{headers:n,query:r={}}=typeof e.clone==`function`?e.clone():Li(e);for(let e of Object.keys(n)){let i=e.toLowerCase();i.slice(0,6)===`x-amz-`&&!t.unhoistableHeaders?.has(i)&&(r[e]=n[e],delete n[e])}return{...e,headers:n,query:r}}})),Hi,Ui=t((()=>{zi(),A(),Hi=e=>{e=typeof e.clone==`function`?e.clone():Li(e);for(let t of Object.keys(e.headers))fi.indexOf(t.toLowerCase())>-1&&delete e.headers[t];return e}})),Wi,Gi,Ki=t((()=>{Wi=e=>Gi(e).toISOString().replace(/\.\d{3}Z$/,`Z`),Gi=e=>typeof e==`number`?new Date(e*1e3):typeof e==`string`?Number(e)?new Date(Number(e)*1e3):new Date(e):e})),qi,F,Ji,Yi=t((()=>{w(),Wr(),Jr(),O(),A(),Ci(),Ti(),Di(),Oi(),Pi(),Ii(),Vi(),Ui(),Ki(),qi=class{constructor({applyChecksum:e,credentials:t,region:n,service:r,sha256:i,uriEscapePath:a=!0}){this.headerFormatter=new Ai,this.service=r,this.sha256=i,this.uriEscapePath=a,this.applyChecksum=typeof e==`boolean`?e:!0,this.regionProvider=Hr(n),this.credentialProvider=Hr(t)}async presign(e,t={}){let{signingDate:n=new Date,expiresIn:r=3600,unsignableHeaders:i,unhoistableHeaders:a,signableHeaders:o,signingRegion:s,signingService:c}=t,l=await this.credentialProvider();this.validateResolvedCredentials(l);let u=s??await this.regionProvider(),{longDate:d,shortDate:f}=F(n);if(r>604800)return Promise.reject(`Signature version 4 presigned URLs must have an expiration date less than one week in the future`);let p=N(f,u,c??this.service),m=Bi(Hi(e),{unhoistableHeaders:a});l.sessionToken&&(m.query[ci]=l.sessionToken),m.query[ni]=k,m.query[ri]=`${l.accessKeyId}/${p}`,m.query[ii]=d,m.query[oi]=r.toString(10);let h=wi(m,i,o);return m.query[ai]=Ji(h),m.query[si]=await this.getSignature(d,p,this.getSigningKey(l,u,f,c),this.createCanonicalRequest(m,h,await P(e,this.sha256))),m}async sign(e,t){return typeof e==`string`?this.signString(e,t):e.headers&&e.payload?this.signEvent(e,t):e.message?this.signMessage(e,t):this.signRequest(e,t)}async signEvent({headers:e,payload:t},{signingDate:n=new Date,priorSignature:r,signingRegion:i,signingService:a}){let o=i??await this.regionProvider(),{shortDate:s,longDate:c}=F(n),l=N(s,o,a??this.service),u=await P({headers:{},body:t},this.sha256),d=new this.sha256;d.update(e);let f=[vi,c,l,r,S(await d.digest()),u].join(`
2
+ `);return this.signString(f,{signingDate:n,signingRegion:o,signingService:a})}async signMessage(e,{signingDate:t=new Date,signingRegion:n,signingService:r}){return this.signEvent({headers:this.headerFormatter.format(e.message.headers),payload:e.message.body},{signingDate:t,signingRegion:n,signingService:r,priorSignature:e.priorSignature}).then(t=>({message:e.message,signature:t}))}async signString(e,{signingDate:t=new Date,signingRegion:n,signingService:r}={}){let i=await this.credentialProvider();this.validateResolvedCredentials(i);let a=n??await this.regionProvider(),{shortDate:o}=F(t),s=new this.sha256(await this.getSigningKey(i,a,o,r));return s.update(D(e)),S(await s.digest())}async signRequest(e,{signingDate:t=new Date,signableHeaders:n,unsignableHeaders:r,signingRegion:i,signingService:a}={}){let o=await this.credentialProvider();this.validateResolvedCredentials(o);let s=i??await this.regionProvider(),c=Hi(e),{longDate:l,shortDate:u}=F(t),d=N(u,s,a??this.service);c.headers[ui]=l,o.sessionToken&&(c.headers[mi]=o.sessionToken);let f=await P(c,this.sha256);!Fi(`x-amz-content-sha256`,c.headers)&&this.applyChecksum&&(c.headers[pi]=f);let p=wi(c,r,n),m=await this.getSignature(l,d,this.getSigningKey(o,s,u,a),this.createCanonicalRequest(c,p,f));return c.headers[li]=`${k} Credential=${o.accessKeyId}/${d}, SignedHeaders=${Ji(p)}, Signature=${m}`,c}createCanonicalRequest(e,t,n){let r=Object.keys(t).sort();return`${e.method}
3
+ ${this.getCanonicalPath(e)}
4
+ ${Ei(e)}
5
+ ${r.map(e=>`${e}:${t[e]}`).join(`
6
+ `)}
7
+
8
+ ${r.join(`;`)}
9
+ ${n}`}async createStringToSign(e,t,n){let r=new this.sha256;return r.update(D(n)),`${k}
10
+ ${e}
11
+ ${t}
12
+ ${S(await r.digest())}`}getCanonicalPath({path:e}){if(this.uriEscapePath){let t=[];for(let n of e.split(`/`))n?.length!==0&&n!==`.`&&(n===`..`?t.pop():t.push(n));return T(`${e?.startsWith(`/`)?`/`:``}${t.join(`/`)}${t.length>0&&e?.endsWith(`/`)?`/`:``}`).replace(/%2F/g,`/`)}return e}async getSignature(e,t,n,r){let i=await this.createStringToSign(e,t,r),a=new this.sha256(await n);return a.update(D(i)),S(await a.digest())}getSigningKey(e,t,n,r){return xi(this.sha256,e,n,t,r||this.service)}validateResolvedCredentials(e){if(typeof e!=`object`||typeof e.accessKeyId!=`string`||typeof e.secretAccessKey!=`string`)throw Error(`Resolved credential object is not valid`)}},F=e=>{let t=Wi(e).replace(/[\-:]/g,``);return{longDate:t,shortDate:t.slice(0,8)}},Ji=e=>Object.keys(e).sort().join(`;`)})),Xi=t((()=>{Yi(),Ti(),Di(),Oi(),Vi(),Ui(),Ci()})),Zi,Qi,$i,ea=t((()=>{Zi=rt(),de(),x(),Xi(),Qi=()=>import(`./dist-es-DGn8uOwQ2.js`).then(({fromNodeProviderChain:e})=>e({clientConfig:{requestHandler:new fe({requestInit:e=>({...e})})}})).catch(e=>{throw Error(`Failed to import '@aws-sdk/credential-providers'.You can provide a custom \`providerChainResolver\` in the client options if your runtime does not have access to '@aws-sdk/credential-providers': \`new AnthropicBedrock({ providerChainResolver })\` Original error: ${e.message}`)}),$i=async(e,t)=>{_e(e.method,`Expected request method property to be set`);let n;n=t.awsAccessKey&&t.awsSecretKey?{accessKeyId:t.awsAccessKey,secretAccessKey:t.awsSecretKey,...t.awsSessionToken!=null&&{sessionToken:t.awsSessionToken}}:await(await(t.providerChainResolver?t.providerChainResolver():Qi()))();let r=new qi({service:`bedrock`,region:t.regionName,credentials:n,sha256:Zi.Sha256}),i=new URL(t.url),a=e.headers?Symbol.iterator in e.headers?Object.fromEntries(Array.from(e.headers).map(e=>[...e])):{...e.headers}:{};delete a.connection,a.host=i.hostname;let o=new Sn({method:e.method.toUpperCase(),protocol:i.protocol,path:i.pathname,headers:a,body:e.body});return(await r.sign(o)).headers}})),ta=r((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.convertToBuffer=void 0;var n=(Xe(),e(qe)),r=typeof Buffer<`u`&&Buffer.from?function(e){return Buffer.from(e,`utf8`)}:n.fromUtf8;function i(e){return e instanceof Uint8Array?e:typeof e==`string`?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}t.convertToBuffer=i})),na=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isEmptyData=void 0;function t(e){return typeof e==`string`?e.length===0:e.byteLength===0}e.isEmptyData=t})),ra=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.numToUint8=void 0;function t(e){return new Uint8Array([(e&4278190080)>>24,(e&16711680)>>16,(e&65280)>>8,e&255])}e.numToUint8=t})),ia=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.uint32ArrayFrom=void 0;function t(e){if(!Uint32Array.from){for(var t=new Uint32Array(e.length),n=0;n<e.length;)t[n]=e[n],n+=1;return t}return Uint32Array.from(e)}e.uint32ArrayFrom=t})),aa=r((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.uint32ArrayFrom=e.numToUint8=e.isEmptyData=e.convertToBuffer=void 0;var t=ta();Object.defineProperty(e,`convertToBuffer`,{enumerable:!0,get:function(){return t.convertToBuffer}});var n=na();Object.defineProperty(e,`isEmptyData`,{enumerable:!0,get:function(){return n.isEmptyData}});var r=ra();Object.defineProperty(e,`numToUint8`,{enumerable:!0,get:function(){return r.numToUint8}});var i=ia();Object.defineProperty(e,`uint32ArrayFrom`,{enumerable:!0,get:function(){return i.uint32ArrayFrom}})})),oa=r((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AwsCrc32=void 0;var n=(b(),e(g)),r=aa(),i=sa();t.AwsCrc32=function(){function e(){this.crc32=new i.Crc32}return e.prototype.update=function(e){(0,r.isEmptyData)(e)||this.crc32.update((0,r.convertToBuffer)(e))},e.prototype.digest=function(){return n.__awaiter(this,void 0,void 0,function(){return n.__generator(this,function(e){return[2,(0,r.numToUint8)(this.crc32.digest())]})})},e.prototype.reset=function(){this.crc32=new i.Crc32},e}()})),sa=r((t=>{Object.defineProperty(t,`__esModule`,{value:!0}),t.AwsCrc32=t.Crc32=t.crc32=void 0;var n=(b(),e(g)),r=aa();function i(e){return new a().update(e).digest()}t.crc32=i;var a=function(){function e(){this.checksum=4294967295}return e.prototype.update=function(e){var t,r;try{for(var i=n.__values(e),a=i.next();!a.done;a=i.next()){var s=a.value;this.checksum=this.checksum>>>8^o[(this.checksum^s)&255]}}catch(e){t={error:e}}finally{try{a&&!a.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return this},e.prototype.digest=function(){return(this.checksum^4294967295)>>>0},e}();t.Crc32=a;var o=(0,r.uint32ArrayFrom)([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]),s=oa();Object.defineProperty(t,`AwsCrc32`,{enumerable:!0,get:function(){return s.AwsCrc32}})}));function ca(e){if(e.length%2!=0)throw Error(`Hex encoded strings must have an even number length`);let t=new Uint8Array(e.length/2);for(let n=0;n<e.length;n+=2){let r=e.slice(n,n+2).toLowerCase();if(r in L)t[n/2]=L[r];else throw Error(`Cannot decode unrecognized sequence ${r} as hexadecimal`)}return t}function I(e){let t=``;for(let n=0;n<e.byteLength;n++)t+=la[e[n]];return t}var la,L,ua=t((()=>{la={},L={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();t.length===1&&(t=`0${t}`),la[e]=t,L[t]=e}}));function da(e){for(let t=0;t<8;t++)e[t]^=255;for(let t=7;t>-1&&(e[t]++,e[t]===0);t--);}var R,fa=t((()=>{ua(),R=class e{constructor(e){if(this.bytes=e,e.byteLength!==8)throw Error(`Int64 buffers must be exactly 8 bytes`)}static fromNumber(t){if(t>0x8000000000000000||t<-0x8000000000000000)throw Error(`${t} is too large (or, if negative, too small) to represent as an Int64`);let n=new Uint8Array(8);for(let e=7,r=Math.abs(Math.round(t));e>-1&&r>0;e--,r/=256)n[e]=r;return t<0&&da(n),new e(n)}valueOf(){let e=this.bytes.slice(0),t=e[0]&128;return t&&da(e),parseInt(I(e),16)*(t?-1:1)}toString(){return String(this.valueOf())}}})),pa,ma,ha,ga,_a,va,ya,ba,xa,Sa,Ca,wa,Ta=t((()=>{ua(),fa(),pa=class{constructor(e,t){this.toUtf8=e,this.fromUtf8=t}format(e){let t=[];for(let n of Object.keys(e)){let r=this.fromUtf8(n);t.push(Uint8Array.from([r.byteLength]),r,this.formatHeaderValue(e[n]))}let n=new Uint8Array(t.reduce((e,t)=>e+t.byteLength,0)),r=0;for(let e of t)n.set(e,r),r+=e.byteLength;return n}formatHeaderValue(e){switch(e.type){case`boolean`:return Uint8Array.from([+!e.value]);case`byte`:return Uint8Array.from([2,e.value]);case`short`:let t=new DataView(new ArrayBuffer(3));return t.setUint8(0,3),t.setInt16(1,e.value,!1),new Uint8Array(t.buffer);case`integer`:let n=new DataView(new ArrayBuffer(5));return n.setUint8(0,4),n.setInt32(1,e.value,!1),new Uint8Array(n.buffer);case`long`:let r=new Uint8Array(9);return r[0]=5,r.set(e.value.bytes,1),r;case`binary`:let i=new DataView(new ArrayBuffer(3+e.value.byteLength));i.setUint8(0,6),i.setUint16(1,e.value.byteLength,!1);let a=new Uint8Array(i.buffer);return a.set(e.value,3),a;case`string`:let o=this.fromUtf8(e.value),s=new DataView(new ArrayBuffer(3+o.byteLength));s.setUint8(0,7),s.setUint16(1,o.byteLength,!1);let c=new Uint8Array(s.buffer);return c.set(o,3),c;case`timestamp`:let l=new Uint8Array(9);return l[0]=8,l.set(R.fromNumber(e.value.valueOf()).bytes,1),l;case`uuid`:if(!wa.test(e.value))throw Error(`Invalid UUID received: ${e.value}`);let u=new Uint8Array(17);return u[0]=9,u.set(ca(e.value.replace(/\-/g,``)),1),u}}parse(e){let t={},n=0;for(;n<e.byteLength;){let r=e.getUint8(n++),i=this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,r));switch(n+=r,e.getUint8(n++)){case 0:t[i]={type:ha,value:!0};break;case 1:t[i]={type:ha,value:!1};break;case 2:t[i]={type:ga,value:e.getInt8(n++)};break;case 3:t[i]={type:_a,value:e.getInt16(n,!1)},n+=2;break;case 4:t[i]={type:va,value:e.getInt32(n,!1)},n+=4;break;case 5:t[i]={type:ya,value:new R(new Uint8Array(e.buffer,e.byteOffset+n,8))},n+=8;break;case 6:let r=e.getUint16(n,!1);n+=2,t[i]={type:ba,value:new Uint8Array(e.buffer,e.byteOffset+n,r)},n+=r;break;case 7:let a=e.getUint16(n,!1);n+=2,t[i]={type:xa,value:this.toUtf8(new Uint8Array(e.buffer,e.byteOffset+n,a))},n+=a;break;case 8:t[i]={type:Sa,value:new Date(new R(new Uint8Array(e.buffer,e.byteOffset+n,8)).valueOf())},n+=8;break;case 9:let o=new Uint8Array(e.buffer,e.byteOffset+n,16);n+=16,t[i]={type:Ca,value:`${I(o.subarray(0,4))}-${I(o.subarray(4,6))}-${I(o.subarray(6,8))}-${I(o.subarray(8,10))}-${I(o.subarray(10))}`};break;default:throw Error(`Unrecognized header type tag`)}}return t}},(function(e){e[e.boolTrue=0]=`boolTrue`,e[e.boolFalse=1]=`boolFalse`,e[e.byte=2]=`byte`,e[e.short=3]=`short`,e[e.integer=4]=`integer`,e[e.long=5]=`long`,e[e.byteArray=6]=`byteArray`,e[e.string=7]=`string`,e[e.timestamp=8]=`timestamp`,e[e.uuid=9]=`uuid`})(ma||(ma={})),ha=`boolean`,ga=`byte`,_a=`short`,va=`integer`,ya=`long`,ba=`binary`,xa=`string`,Sa=`timestamp`,Ca=`uuid`,wa=/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/}));function Ea({byteLength:e,byteOffset:t,buffer:n}){if(e<ka)throw Error(`Provided message too short to accommodate event stream message overhead`);let r=new DataView(n,t,e),i=r.getUint32(0,!1);if(e!==i)throw Error(`Reported message length does not match received message length`);let a=r.getUint32(Oa,!1),o=r.getUint32(z,!1),s=r.getUint32(e-B,!1),c=new Da.Crc32().update(new Uint8Array(n,t,z));if(o!==c.digest())throw Error(`The prelude checksum specified in the message (${o}) does not match the calculated CRC32 checksum (${c.digest()})`);if(c.update(new Uint8Array(n,t+z,e-(z+B))),s!==c.digest())throw Error(`The message checksum (${c.digest()}) did not match the expected value of ${s}`);return{headers:new DataView(n,t+z+B,a),body:new Uint8Array(n,t+z+B+a,i-a-(z+B+B))}}var Da,Oa,z,B,ka,Aa=t((()=>{Da=sa(),Oa=4,z=Oa*2,B=4,ka=z+B*2})),ja,Ma,Na=t((()=>{ja=sa(),Ta(),Aa(),Ma=class{constructor(e,t){this.headerMarshaller=new pa(e,t),this.messageBuffer=[],this.isEndOfStream=!1}feed(e){this.messageBuffer.push(this.decode(e))}endOfStream(){this.isEndOfStream=!0}getMessage(){let e=this.messageBuffer.pop(),t=this.isEndOfStream;return{getMessage(){return e},isEndOfStream(){return t}}}getAvailableMessages(){let e=this.messageBuffer;this.messageBuffer=[];let t=this.isEndOfStream;return{getMessages(){return e},isEndOfStream(){return t}}}encode({headers:e,body:t}){let n=this.headerMarshaller.format(e),r=n.byteLength+t.byteLength+16,i=new Uint8Array(r),a=new DataView(i.buffer,i.byteOffset,i.byteLength),o=new ja.Crc32;return a.setUint32(0,r,!1),a.setUint32(4,n.byteLength,!1),a.setUint32(8,o.update(i.subarray(0,8)).digest(),!1),i.set(n,12),i.set(t,n.byteLength+12),a.setUint32(r-4,o.update(i.subarray(8,r-4)).digest(),!1),i}decode(e){let{headers:t,body:n}=Ea(e);return{headers:this.headerMarshaller.parse(t),body:n}}formatHeaders(e){return this.headerMarshaller.format(e)}}})),Pa=t((()=>{})),Fa,Ia=t((()=>{Fa=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.decoder.decode(e)}}})),La,Ra=t((()=>{La=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream)yield this.options.encoder.encode(e);this.options.includeEndFrame&&(yield new Uint8Array)}}})),za,Ba=t((()=>{za=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.messageStream){let t=await this.options.deserializer(e);t!==void 0&&(yield t)}}}})),Va,Ha=t((()=>{Va=class{constructor(e){this.options=e}[Symbol.asyncIterator](){return this.asyncIterator()}async*asyncIterator(){for await(let e of this.options.inputStream)yield this.options.serializer(e)}}})),Ua=t((()=>{Na(),Ta(),fa(),Pa(),Ia(),Ra(),Ba(),Ha()}));function Wa(e){let t=0,n=0,r=null,i=null,a=e=>{if(typeof e!=`number`)throw Error(`Attempted to allocate an event message where size was not a number: `+e);t=e,n=4,r=new Uint8Array(e),new DataView(r.buffer).setUint32(0,e,!1)},o=async function*(){let o=e[Symbol.asyncIterator]();for(;;){let{value:e,done:s}=await o.next();if(s){if(!t)return;if(t===n)yield r;else throw Error(`Truncated event message received.`);return}let c=e.length,l=0;for(;l<c;){if(!r){let t=c-l;i||(i=new Uint8Array(4));let r=Math.min(4-n,t);if(i.set(e.slice(l,l+r),n),n+=r,l+=r,n<4)break;a(new DataView(i.buffer).getUint32(0,!1)),i=null}let o=Math.min(t-n,c-l);r.set(e.slice(l,l+o),n),n+=o,l+=o,t&&t===n&&(yield r,r=null,t=0,n=0)}}};return{[Symbol.asyncIterator]:o}}var Ga=t((()=>{}));function Ka(e,t){return async function(n){let{value:r}=n.headers[`:message-type`];if(r===`error`){let e=Error(n.headers[`:error-message`].value||`UnknownError`);throw e.name=n.headers[`:error-code`].value,e}else if(r===`exception`){let r=n.headers[`:exception-type`].value,i=await e({[r]:n});if(i.$unknown){let e=Error(t(n.body));throw e.name=r,e}throw i[r]}else if(r===`event`){let t=await e({[n.headers[`:event-type`].value]:n});return t.$unknown?void 0:t}else throw Error(`Unrecognizable event type: ${n.headers[`:event-type`].value}`)}}var qa=t((()=>{})),Ja,Ya=t((()=>{Ua(),Ga(),qa(),Ja=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.eventStreamCodec=new Ma(e,t),this.utfEncoder=e}deserialize(e,t){return new za({messageStream:new Fa({inputStream:Wa(e),decoder:this.eventStreamCodec}),deserializer:Ka(t,this.utfEncoder)})}serialize(e,t){return new La({messageStream:new Va({inputStream:e,serializer:t}),encoder:this.eventStreamCodec,includeEndFrame:!0})}}})),Xa=t((()=>{Ya()})),Za=t((()=>{Ya(),Xa()}));async function*Qa(e){let t=!1,n=!1,r=[];for(e.on(`error`,e=>{if(t||(t=!0),e)throw e}),e.on(`data`,e=>{r.push(e)}),e.on(`end`,()=>{t=!0});!n;){let e=await new Promise(e=>setTimeout(()=>e(r.shift()),0));e&&(yield e),n=t&&r.length===0}}var $a=t((()=>{})),eo,to=t((()=>{Za(),$a(),eo=class{constructor({utf8Encoder:e,utf8Decoder:t}){this.universalMarshaller=new Ja({utf8Decoder:t,utf8Encoder:e})}deserialize(e,t){let n=typeof e[Symbol.asyncIterator]==`function`?e:Qa(e);return this.universalMarshaller.deserialize(n,t)}serialize(e,t){return he.from(this.universalMarshaller.serialize(e,t))}}})),no=t((()=>{to()})),ro=t((()=>{to(),no()})),io,ao,oo=t((()=>{ce(),io=/^[A-Za-z0-9+/]*={0,2}$/,ao=e=>{if(e.length*3%4!=0)throw TypeError(`Incorrect padding on base64 string.`);if(!io.exec(e))throw TypeError(`Invalid base64 string.`);let t=oe(e,`base64`);return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}})),so,co=t((()=>{ce(),ne(),so=e=>{let t;if(t=typeof e==`string`?te(e):e,typeof t!=`object`||typeof t.byteOffset!=`number`||typeof t.byteLength!=`number`)throw Error(`@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.`);return se(t.buffer,t.byteOffset,t.byteLength).toString(`base64`)}})),lo=t((()=>{oo(),co()})),uo=t((()=>{})),fo=t((()=>{})),po=t((()=>{fo()})),mo=t((()=>{po()}));function ho(e,t=`utf-8`){return t===`base64`?so(e):le(e)}function go(e,t){return t===`base64`?V.mutate(ao(e)):V.mutate(te(e))}var _o=t((()=>{lo(),ne(),vo()})),V,vo=t((()=>{_o(),V=class e extends Uint8Array{static fromString(e,t=`utf-8`){switch(typeof e){case`string`:return go(e,t);default:throw Error(`Unsupported conversion from ${typeof e} to Uint8ArrayBlobAdapter.`)}}static mutate(t){return Object.setPrototypeOf(t,e.prototype),t}transformToString(e=`utf-8`){return ho(this,e)}}})),yo=t((()=>{})),bo=t((()=>{})),xo=t((()=>{})),So=t((()=>{bo(),xo()})),Co=t((()=>{So()})),wo=t((()=>{x(),Co()})),To=t((()=>{x(),Co()})),Eo=t((()=>{})),Do=t((()=>{wo(),To(),Eo()})),Oo=t((()=>{Do()})),ko=t((()=>{vo(),yo(),Oo()})),Ao,jo=t((()=>{ko(),Ao=async(e=new Uint8Array,t)=>{if(e instanceof Uint8Array)return V.mutate(e);if(!e)return V.mutate(new Uint8Array);let n=t.streamCollector(e);return V.mutate(await n)}})),Mo=t((()=>{po(),_n()})),No=t((()=>{})),Po=t((()=>{})),Fo,Io,Lo,Ro,H,zo,Bo,Vo=t((()=>{Fo=e=>{if(e!=null){if(Number.isInteger(e)&&!Number.isNaN(e))return e;throw TypeError(`Expected integer, got ${typeof e}: ${e}`)}},Io=e=>Lo(e,32),Lo=(e,t)=>{let n=Fo(e);if(n!==void 0&&Ro(n,t)!==n)throw TypeError(`Expected ${t}-bit integer, got ${e}`);return n},Ro=(e,t)=>{switch(t){case 32:return Int32Array.of(e)[0];case 16:return Int16Array.of(e)[0];case 8:return Int8Array.of(e)[0]}},H=e=>{if(e!=null){if(typeof e==`string`)return e;if([`boolean`,`number`,`bigint`].includes(typeof e))return Bo.warn(zo(`Expected string, got ${typeof e}: ${e}`)),String(e);throw TypeError(`Expected string, got ${typeof e}: ${e}`)}},zo=e=>String(TypeError(e).stack||e).split(`
13
+ `).slice(0,5).filter(e=>!e.includes(`stackTraceWarning`)).join(`
14
+ `),Bo={warn:console.warn}})),Ho=t((()=>{})),U,Uo=t((()=>{U=(e,t={})=>(Object.entries(t).filter(([,e])=>e!==void 0).forEach(([t,n])=>{(e[t]==null||e[t]===``)&&(e[t]=n)}),e.message=e.message||e.Message||`UnknownError`,delete e.Message,e)})),Wo=t((()=>{})),Go=t((()=>{})),Ko=t((()=>{})),qo=t((()=>{_n()})),Jo=t((()=>{qo()})),Yo=t((()=>{Jo()})),Xo=t((()=>{})),Zo=t((()=>{})),Qo=t((()=>{})),W,$o=t((()=>{W=function(){let e=Object.getPrototypeOf(this).constructor,t=new(Function.bind.apply(String,[null,...arguments]));return Object.setPrototypeOf(t,e.prototype),t},W.prototype=Object.create(String.prototype,{constructor:{value:W,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf(W,String)}));function G(e,t,n){let r,i,a;if(t===void 0&&n===void 0)r={},a=e;else{if(r=e,typeof t==`function`)return i=t,a=n,es(r,i,a);a=t}for(let e of Object.keys(a)){if(!Array.isArray(a[e])){r[e]=a[e];continue}ts(r,null,a,e)}return r}var K,es,ts,ns,rs,is=t((()=>{K=(e,t)=>{let n={};for(let r in t)ts(n,e,t,r);return n},es=(e,t,n)=>G(e,Object.entries(n).reduce((e,[n,r])=>(Array.isArray(r)?e[n]=r:typeof r==`function`?e[n]=[t,r()]:e[n]=[t,r],e),{})),ts=(e,t,n,r)=>{if(t!==null){let i=n[r];typeof i==`function`&&(i=[,i]);let[a=ns,o=rs,s=r]=i;(typeof a==`function`&&a(t[s])||typeof a!=`function`&&a)&&(e[r]=o(t[s]));return}let[i,a]=n[r];if(typeof a==`function`){let t,n=i===void 0&&(t=a())!=null,o=typeof i==`function`&&!!i(void 0)||typeof i!=`function`&&!!i;n?e[r]=t:o&&(e[r]=a())}else{let t=i===void 0&&a!=null,n=typeof i==`function`&&!!i(a)||typeof i!=`function`&&!!i;(t||n)&&(e[r]=a)}},ns=e=>e!=null,rs=e=>e})),as=t((()=>{})),os=t((()=>{})),ss=t((()=>{})),cs=t((()=>{})),ls=t((()=>{uo(),mo(),jo(),Mo(),No(),Po(),Ho(),Wo(),Go(),Ko(),Yo(),Uo(),Xo(),Zo(),Qo(),$o(),is(),Vo(),as(),os(),ss(),cs()})),us,ds,fs,ps,ms,hs,gs,_s,vs,ys,bs,q,xs,J,Ss=t((()=>{ls(),ue(),us=async(e,t)=>{let n=G({}),r=e.body,i=K(r,{message:H});return Object.assign(n,i),U(new ee({$metadata:q(e),...n}),e.body)},ds=async(e,t)=>{let n=G({}),r=e.body,i=K(r,{message:H,originalMessage:H,originalStatusCode:Io});return Object.assign(n,i),U(new re({$metadata:q(e),...n}),e.body)},fs=async(e,t)=>{let n=G({}),r=e.body,i=K(r,{message:H});return Object.assign(n,i),U(new ie({$metadata:q(e),...n}),e.body)},ps=async(e,t)=>{let n=G({}),r=e.body,i=K(r,{message:H});return Object.assign(n,i),U(new ae({$metadata:q(e),...n}),e.body)},ms=(e,t)=>t.eventStreamMarshaller.deserialize(e,async n=>n.chunk==null?n.internalServerException==null?n.modelStreamErrorException==null?n.validationException==null?n.throttlingException==null?{$unknown:e}:{throttlingException:await vs(n.throttlingException,t)}:{validationException:await ys(n.validationException,t)}:{modelStreamErrorException:await gs(n.modelStreamErrorException,t)}:{internalServerException:await hs(n.internalServerException,t)}:{chunk:await _s(n.chunk,t)}),hs=async(e,t)=>us({...e,body:await J(e.body,t)},t),gs=async(e,t)=>ds({...e,body:await J(e.body,t)},t),_s=async(e,t)=>{let n={},r=await J(e.body,t);return Object.assign(n,bs(r,t)),n},vs=async(e,t)=>fs({...e,body:await J(e.body,t)},t),ys=async(e,t)=>ps({...e,body:await J(e.body,t)},t),bs=(e,t)=>K(e,{bytes:t.base64Decoder}),q=e=>({httpStatusCode:e.statusCode,requestId:e.headers[`x-amzn-requestid`]??e.headers[`x-amzn-request-id`]??e.headers[`x-amz-request-id`]??``,extendedRequestId:e.headers[`x-amz-id-2`]??``,cfId:e.headers[`x-amz-cf-id`]??``}),xs=(e,t)=>Ao(e,t).then(e=>t.utf8Encoder(e)),J=(e,t)=>xs(e,t).then(e=>e.length?JSON.parse(e):{})}));function Cs(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}}}var ws=t((()=>{})),Ts=t((()=>{o()}));function Es(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var Y,Ds,Os,X=t((()=>{Ts(),Y=e=>(Y=Array.isArray,Y(e)),Ds=Y,Os=e=>{try{return JSON.parse(e)}catch{return}}}));function Z(){}function Q(e,t,n){return!t||As[e]>As[n]?Z:t[e].bind(t)}function ks(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return js;let r=Ms.get(t);if(r&&r[0]===n)return r[1];let i={error:Q(`error`,t,n),warn:Q(`warn`,t,n),info:Q(`info`,t,n),debug:Q(`debug`,t,n)};return Ms.set(t,[n,i]),i}var As,js,Ms,Ns=t((()=>{X(),As={off:0,error:200,warn:300,info:400,debug:500},js={error:Z,warn:Z,info:Z,debug:Z},Ms=new WeakMap}));function Ps(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Fs,Is,Ls,Rs,zs=t((()=>{ro(),lo(),de(),s(),d(),me(),Ss(),ws(),X(),Ns(),Fs=e=>new TextDecoder(`utf-8`).decode(e),Is=e=>new TextEncoder().encode(e),Ls=()=>({base64Decoder:ao,base64Encoder:so,utf8Decoder:Is,utf8Encoder:Fs,eventStreamMarshaller:new eo({utf8Encoder:Fs,utf8Decoder:Is}),streamCollector:pe}),Rs=class e extends c{static fromSSEResponse(t,n,r){let a=!1,o=r?ks(r):console;async function*s(){if(!t.body)throw n.abort(),new i(`Attempted to iterate over a response with no body`);let e=ms(Cs(t.body),Ls());for await(let t of e)t.chunk&&t.chunk.bytes?yield{event:`chunk`,data:Fs(t.chunk.bytes),raw:[]}:t.internalServerException?yield{event:`error`,data:`InternalServerException`,raw:[]}:t.modelStreamErrorException?yield{event:`error`,data:`ModelStreamErrorException`,raw:[]}:t.validationException?yield{event:`error`,data:`ValidationException`,raw:[]}:t.throttlingException&&(yield{event:`error`,data:`ThrottlingException`,raw:[]})}async function*c(){if(a)throw Error("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");a=!0;let e=!1;try{for await(let e of s()){if(e.event===`chunk`)try{yield JSON.parse(e.data)}catch(t){throw o.error(`Could not parse message into JSON:`,e.data),o.error(`From chunk:`,e.raw),t}if(e.event===`error`){let n=e.data,r=Os(n),i=r?void 0:n;throw l.generate(void 0,r,i,t.headers)}}e=!0}catch(e){if(Ps(e))return;throw e}finally{e||n.abort()}}return new e(c,n)}}})),$,Bs=t((()=>{$=e=>{if(globalThis.process!==void 0)return globalThis.process.env?.[e]?.trim()||void 0;if(globalThis.Deno!==void 0)return globalThis.Deno.env?.get?.(e)?.trim()||void 0}}));function*Vs(e){if(!e)return;if(Hs in e){let{values:t,nulls:n}=e;yield*t.entries();for(let e of n)yield[e,null];return}let t=!1,n;e instanceof Headers?n=e.entries():Ds(e)?n=e:(t=!0,n=Object.entries(e??{}));for(let e of n){let n=e[0];if(typeof n!=`string`)throw TypeError(`expected header name to be a string`);let r=Ds(e[1])?e[1]:[e[1]],i=!1;for(let e of r)e!==void 0&&(t&&!i&&(i=!0,yield[n,null]),yield[n,e])}}var Hs,Us,Ws=t((()=>{X(),Hs=Symbol.for(`brand.privateNullableHeaders`),Us=e=>{let t=new Headers,n=new Set;for(let r of e){let e=new Set;for(let[i,a]of Vs(r)){let r=i.toLowerCase();e.has(r)||(t.delete(i),e.add(r)),a===null?(t.delete(i),n.add(r)):(t.append(i,a),n.delete(r))}}return{[Hs]:!0,values:t,nulls:n}}}));function Gs(e){return e.replace(/[^A-Za-z0-9\-._~!$&'()*+,;=:@]+/g,encodeURIComponent)}var Ks,qs,Js,Ys=t((()=>{Ts(),Ks=Object.freeze(Object.create(null)),qs=(e=Gs)=>function(t,...n){if(t.length===1)return t[0];let r=!1,a=[],o=t.reduce((t,i,o)=>{/[?#]/.test(i)&&(r=!0);let s=n[o],c=(r?encodeURIComponent:e)(``+s);return o!==n.length&&(s==null||typeof s==`object`&&s.toString===Object.getPrototypeOf(Object.getPrototypeOf(s.hasOwnProperty??Ks)??Ks)?.toString)&&(c=s+``,a.push({start:t.length+i.length,length:c.length,error:`Value of type ${Object.prototype.toString.call(s).slice(8,-1)} is not a valid path parameter`})),t+i+(o===n.length?``:c)},``),s=o.split(/[?#]/,1)[0],c=/(?<=^|\/)(?:\.|%2e){1,2}(?=\/|$)/gi,l;for(;(l=c.exec(s))!==null;)a.push({start:l.index,length:l[0].length,error:`Value "${l[0]}" can\'t be safely passed as a path parameter`});if(a.sort((e,t)=>e.start-t.start),a.length>0){let e=0,t=a.reduce((t,n)=>{let r=` `.repeat(n.start-e),i=`^`.repeat(n.length);return e=n.start+n.length,t+r+i},``);throw new i(`Path parameters result in path with invalid segments:\n${a.map(e=>e.error).join(`
15
+ `)}\n${o}\n${t}`)}return o},Js=qs(Gs)}));function Xs(e){let t=new a(e);return delete t.batches,delete t.countTokens,t}function Zs(e){let t=new h(e);return delete t.promptCaching,delete t.messages.batches,delete t.messages.countTokens,t}var Qs,$s,ec,tc=t((()=>{m(),u(),ea(),zs(),Bs(),X(),Ws(),Ys(),Ns(),Qs=`bedrock-2023-05-31`,$s=new Set([`/v1/complete`,`/v1/messages`,`/v1/messages?beta=true`]),ec=class extends f{constructor({awsRegion:e=$(`AWS_REGION`)??`us-east-1`,baseURL:t=$(`ANTHROPIC_BEDROCK_BASE_URL`)??`https://bedrock-runtime.${e}.amazonaws.com`,apiKey:n=$(`AWS_BEARER_TOKEN_BEDROCK`),awsSecretKey:r=null,awsAccessKey:i=null,awsSessionToken:a=null,providerChainResolver:o=null,...s}={}){super({baseURL:t,authToken:n,...s}),this.skipAuth=!1,this.messages=Xs(this),this.completions=new p(this),this.beta=Zs(this),i!=null!=(r!=null)&&ks(this).warn("Warning: Passing only one of `awsAccessKey` or `awsSecretKey` is deprecated. Please provide both keys, or provide neither and rely on the AWS credential provider chain."),this.awsSecretKey=r,this.awsAccessKey=i,this.awsRegion=e,this.awsSessionToken=a,this.skipAuth=s.skipAuth??!1,this.providerChainResolver=o}validateHeaders(){}async prepareRequest(e,{url:t,options:n}){if(this.skipAuth){e.headers.delete(`Authorization`);return}if(this.authToken)return;let r=this.awsRegion;if(!r)throw Error("Expected `awsRegion` option to be passed to the client or the `AWS_REGION` environment variable to be present");e.headers=Us([await $i(e,{url:t,regionName:r,awsAccessKey:this.awsAccessKey,awsSecretKey:this.awsSecretKey,awsSessionToken:this.awsSessionToken,fetchOptions:this.fetchOptions,providerChainResolver:this.providerChainResolver}),e.headers]).values}async buildRequest(e){if(e.__streamClass=Rs,Es(e.body)&&(e.body={...e.body}),Es(e.body)&&(e.body.anthropic_version||(e.body.anthropic_version=Qs),e.headers&&!e.body.anthropic_beta)){let t=Us([e.headers]).values.get(`anthropic-beta`);t!=null&&(e.body.anthropic_beta=t.split(`,`))}if($s.has(e.path)&&e.method===`post`){if(!Es(e.body))throw Error(`Expected request body to be an object for post /v1/messages`);let t=e.body.model;e.body.model=void 0;let n=e.body.stream;e.body.stream=void 0,n?e.path=Js`/model/${t}/invoke-with-response-stream`:e.path=Js`/model/${t}/invoke`}return super.buildRequest(e)}}})),nc=t((()=>{rt(),x(),Xi()})),rc=t((()=>{Ws(),Ts(),m(),u(),nc()})),ic=t((()=>{tc(),tc(),rc()})),ac;t((()=>{ic(),ac=class extends ec{async buildRequest(e){let t=await super.buildRequest(e),n=t?.req;if(!n||typeof n.body!=`string`||n.body.length===0)return t;let r;try{r=JSON.parse(n.body)}catch{return t}if(!(`anthropic_beta`in r))return t;delete r.anthropic_beta;let i=JSON.stringify(r);n.body=i;let a=String(new TextEncoder().encode(i).length),o=n.headers;if(typeof Headers<`u`&&o instanceof Headers)o.has(`content-length`)&&o.set(`content-length`,a);else if(o&&typeof o==`object`){let e=o;`content-length`in e&&(e[`content-length`]=a)}return t}}}))();export{ac as BedrockClient};
@@ -0,0 +1,9 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{T as r,w as i}from"./debug-UI3T040K.js";import{a,i as o}from"./genericProcessUtils-BGvcwuPt.js";import{join as s}from"path";import{randomUUID as c}from"crypto";import{readFile as l,readdir as u,unlink as d}from"fs/promises";async function f(){if(process.platform===`win32`){let{DetachedEngine:e}=await import(`./detached-D300jlhj.js`);return new e}let{TmuxEngine:e}=await import(`./tmux-CvbhsfwG.js`),t=new e;if(await t.available())return t;let{DetachedEngine:n}=await import(`./detached-D300jlhj.js`);return new n}var p=e((()=>{}));function m(){return s(t(),`sessions`)}async function h(){let e=m(),t;try{t=await u(e)}catch{return[]}let n=[];for(let i of t)if(/^\d+\.json$/.test(i)){if(!a(parseInt(i.slice(0,-5),10))){d(s(e,i)).catch(()=>{});continue}try{let t=r(await l(s(e,i),`utf-8`));n.push(t)}catch{}}return n}function g(e,t){let n=parseInt(t,10);return e.find(e=>e.sessionId===t||e.pid===n||e.name&&e.name===t)}function _(e){return new Date(e).toLocaleString()}function v(e){return e.engine?e.engine:e.tmuxSessionName?`tmux`:`detached`}async function y(e){let t=await h();if(t.length===0){console.log(`No active sessions.`);return}console.log(`${t.length} active session${t.length>1?`s`:``}:\n`);for(let e of t){let t=v(e),n=[` PID: ${e.pid}`,` Kind: ${e.kind}`,` Engine: ${t}`,` Session: ${e.sessionId}`,` CWD: ${e.cwd}`];e.name&&n.push(` Name: ${e.name}`),e.startedAt&&n.push(` Started: ${_(e.startedAt)}`),e.status&&n.push(` Status: ${e.status}`),e.waitingFor&&n.push(` Waiting for: ${e.waitingFor}`),e.bridgeSessionId&&n.push(` Bridge: ${e.bridgeSessionId}`),e.tmuxSessionName&&n.push(` Tmux: ${e.tmuxSessionName}`),e.logPath&&n.push(` Log: ${e.logPath}`),console.log(n.join(`
2
+ `)),console.log()}}async function b(e){let t=await h();if(!e){if(t.length===0){console.log(`No active sessions.`);return}if(t.length===1)e=t[0].sessionId;else{console.log(`Multiple sessions active. Specify one:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}}let n=g(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}if(!n.logPath){console.log(`No log path recorded for session ${n.sessionId}`);return}try{let e=await l(n.logPath,`utf-8`);process.stdout.write(e)}catch(e){console.error(`Failed to read log file: ${n.logPath}`),console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function x(e){let t=await h();if(!e){let n=t.filter(e=>e.tmuxSessionName||e.engine===`detached`);if(n.length===0){console.log("No background sessions to attach to. Start one with `claude daemon bg`.");return}if(n.length===1)e=n[0].sessionId;else{console.log(`Multiple background sessions. Specify one:`);for(let e of n){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId,n=v(e);console.log(` ${t} PID=${e.pid} engine=${n}`)}return}}let n=g(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}let r=v(n);try{if(r===`tmux`){let{TmuxEngine:e}=await import(`./tmux-CvbhsfwG.js`),t=new e;if(!await t.available()){console.error(`tmux is no longer available. Cannot attach to tmux session.`),process.exitCode=1;return}await t.attach(n)}else{let{DetachedEngine:e}=await import(`./detached-D300jlhj.js`);await new e().attach(n)}}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}async function S(e){let t=await h();if(!e){if(t.length===0){console.log(`No active sessions to kill.`);return}console.log(`Specify a session to kill:`);for(let e of t){let t=e.name?`${e.name} (${e.sessionId})`:e.sessionId;console.log(` ${t} PID=${e.pid}`)}return}let n=g(t,e);if(!n){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(`Killing session ${n.sessionId} (PID: ${n.pid})...`);try{process.kill(n.pid,`SIGTERM`)}catch{console.log(`Session already exited.`);return}if(await new Promise(e=>setTimeout(e,2e3)),a(n.pid))try{process.kill(n.pid,`SIGKILL`),console.log(`Session force-killed.`)}catch{console.log(`Session exited during grace period.`)}else console.log(`Session stopped.`);d(s(m(),`${n.pid}.json`)).catch(()=>{})}async function C(e){let n=await f(),r=e.filter(e=>e!==`--bg`&&e!==`--background`);if(!n.supportsInteractiveInput&&!r.some(e=>e===`-p`||e===`--print`||e===`--pipe`)){console.error(`Error: Background sessions with detached engine require -p/--print flag.
3
+ The detached engine has no terminal for interactive input.
4
+
5
+ Usage:
6
+ claude daemon bg -p "your prompt here"
7
+ echo "prompt" | claude daemon bg --pipe`),process.platform!==`win32`&&console.error(`
8
+ Alternatively, install tmux for interactive background sessions:
9
+ ${process.platform===`darwin`?`brew install tmux`:`sudo apt install tmux`}`),process.exitCode=1;return}let i=`claude-bg-${c().slice(0,8)}`,a=s(t(),`sessions`,`logs`,`${i}.log`);try{let e=await n.start({sessionName:i,args:r,env:{...process.env},logPath:a,cwd:process.cwd()});console.log(`Background session started: ${e.sessionName}`),console.log(` Engine: ${e.engineUsed}`),console.log(` Log: ${e.logPath}`),console.log(),console.log(`Use \`claude daemon attach ${e.sessionName}\` to reconnect.`),console.log("Use `claude daemon status` to check status."),console.log(`Use \`claude daemon kill ${e.sessionName}\` to stop.`)}catch(e){console.error(e instanceof Error?e.message:String(e)),process.exitCode=1}}var w=e((()=>{n(),o(),i(),p()}));export{S as a,y as c,w as i,g as n,h as o,C as r,b as s,x as t};
@@ -0,0 +1 @@
1
+ import{a as e,c as t,i as n,r,s as i,t as a}from"./bg-DK0E4ZtW.js";n();export{a as attachHandler,r as handleBgStart,e as killHandler,i as logsHandler,t as psHandler};
@@ -0,0 +1,3 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n,ot as r}from"./state-sIHsFpDu.js";import{jo as i,ko as a}from"./paths-Q2255dD7.js";import{E as o,w as s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{c as u,s as d}from"./types-Csi32ZXh.js";import{Ar as f,Er as p,Ir as m,Si as h,Tr as g,_i as _,br as v}from"./loadAgentsDir-Ci5mr0vm.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let n=y(),i=t(),a=v(r()),s=p(n),c=g();await b(a,{recursive:!0,mode:448});let l;try{l=await x(c)}catch{throw Error(`No conversation to branch`)}if(l.length===0)throw Error(`No conversation to branch`);let d=u(l),f=d.filter(e=>m(e)&&!e.isSidechain),h=d.filter(e=>e.type===`content-replacement`&&e.sessionId===i).flatMap(e=>e.replacements);if(f.length===0)throw Error(`No messages to branch`);let _=null,C=[],w=[];for(let e of f){let t={...e,sessionId:n,parentUuid:_,isSidechain:!1,forkedFrom:{sessionId:i,messageUuid:e.uuid}},r={...e,sessionId:n};w.push(r),C.push(o(t)),e.type!==`progress`&&(_=e.uuid)}if(h.length>0){let e={type:`content-replacement`,sessionId:n,replacements:h};C.push(o(e))}return await S(s,C.join(`
2
+ `)+`
3
+ `,{encoding:`utf8`,mode:384}),{sessionId:n,title:e,forkPath:s,serializedMessages:w,contentReplacementRecords:h}}async function T(e){let t=`${e} (Branch)`;if((await h(t,{exact:!0})).length===0)return t;let n=await h(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${a(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let o=2;for(;r.has(o);)o++;return`${e} (Branch ${o})`}async function E(e,n,r){let i=r?.trim()||void 0,a=t();try{let{sessionId:t,title:r,forkPath:o,serializedMessages:s,contentReplacementRecords:c}=await w(i),u=new Date,d=C(s.find(e=>e.type===`user`)),f=await T(r??d);await _(t,f,o),l(`tengu_conversation_forked`,{message_count:s.length,has_custom_title:!!r});let p={date:u.toISOString().split(`T`)[0],messages:s,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:s.length,isSidechain:!1,sessionId:t,customTitle:f,contentReplacements:c},m=r?` "${r}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${a}`}`;return n.resume?(await n.resume(t,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${t}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{n(),c(),d(),f(),s(),i()}))();export{E as call,C as deriveFirstPrompt};
@@ -0,0 +1,8 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{U as r,cn as i}from"./state-sIHsFpDu.js";import{join as a}from"node:path";import{appendFileSync as o,existsSync as s,mkdirSync as c,readFileSync as l,unlinkSync as u,writeFileSync as d}from"node:fs";function f(){return a(t(),`.next-request-no-cache`)}function p(){return a(t(),`.break-cache-always`)}function m(){return a(t(),`break-cache-events.jsonl`)}function h(){try{let e=l(m(),`utf8`).trim().split(`
2
+ `).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,JSON.stringify(r)+`
3
+ `,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
4
+ `)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
5
+ `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: Anthropic prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
6
+ `)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
7
+ `)}}var y,b,x,S=e((()=>{i(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The Anthropic prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
8
+ `),b={type:`local-jsx`,name:`break-cache`,description:`Manage prompt-cache breaking. Open actions or run: once, status, always, off`,isHidden:!1,isEnabled:()=>!r(),argumentHint:`[once|status|always|off|--clear]`,bridgeSafe:!0,getBridgeInvocationError:e=>e.trim()?void 0:`Use /break-cache once/status/always/off over Remote Control.`,load:()=>import(`./panel-ByW1omJn.js`)},x={type:`local`,name:`break-cache`,description:`Force the next (or all) API call(s) to miss prompt cache. Scopes: once, status, always, off`,isHidden:!1,isEnabled:()=>r(),supportsNonInteractive:!0,bridgeSafe:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
@@ -0,0 +1,2 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{d as u,s as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{MS as m,Mx as h,PS as g,jS as _,kx as v}from"./loadAgentsDir-Ci5mr0vm.js";import{t as y}from"./useKeybinding-FsOnjW6T.js";import{a as b,t as x}from"./bridgeConfig-CJ-KznTS.js";import{n as S,r as C,s as w,t as T}from"./bridgeEnabled-5vsPrjuq.js";import{a as E,i as D,n as O}from"./types-RJTEOuIt.js";import{t as k}from"./lib-B4Q0Nrpb.js";import{i as A,n as j}from"./envLessBridgeConfig-Ju4W58xf.js";import{n as M,r as N}from"./RemoteCallout-BV_hoz98.js";function P({onDone:e,name:t}){let n=g(),r=m(e=>e.replBridgeConnected),i=m(e=>e.replBridgeEnabled),a=m(e=>e.replBridgeOutboundOnly),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{if((r||i)&&!a){s(!0);return}let o=!1;return(async()=>{let r=await I();if(!o){if(r){p(`tengu_bridge_command`,{action:`preflight_failed`}),e(r,{display:`system`});return}if(N()){n(e=>e.showRemoteCallout?e:{...e,showRemoteCallout:!0,replBridgeInitialName:t}),e(``,{display:`system`});return}p(`tengu_bridge_command`,{action:`connect`}),n(e=>e.replBridgeEnabled&&!e.replBridgeOutboundOnly?e:{...e,replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1,replBridgeInitialName:t}),e(`Remote Control connecting…`,{display:`system`})}})(),()=>{o=!0}},[]),o?(0,B.jsx)(F,{onDone:e}):null}function F({onDone:e}){h(`bridge-disconnect-dialog`);let t=g(),n=m(e=>e.replBridgeSessionUrl),s=m(e=>e.replBridgeConnectUrl),l=m(e=>e.replBridgeSessionActive),[u,d]=(0,z.useState)(2),[f,_]=(0,z.useState)(!1),[v,y]=(0,z.useState)(``),b=l?n:s;(0,z.useEffect)(()=>{if(!f||!b){y(``);return}(0,R.toString)(b,{type:`utf8`,errorCorrectionLevel:`L`,small:!0}).then(y).catch(()=>y(``))},[f,b]);function x(){t(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),p(`tengu_bridge_command`,{action:`disconnect`}),e(D,{display:`system`})}function S(){_(e=>!e)}function C(){e(void 0,{display:`skip`})}o({"select:next":()=>d(e=>(e+1)%3),"select:previous":()=>d(e=>(e-1+3)%3),"select:accept":()=>{u===0?x():u===1?S():C()}},{context:`Select`});let w=v?v.split(`
2
+ `).filter(e=>e.length>0):[];return(0,B.jsx)(a,{title:`Remote Control`,onCancel:C,hideInputGuide:!0,children:(0,B.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,B.jsxs)(r,{children:[`This session is available via Remote Control`,b?` at ${b}`:``,`.`]}),f&&w.length>0&&(0,B.jsx)(c,{flexDirection:`column`,children:w.map((e,t)=>(0,B.jsx)(r,{children:e},t))}),(0,B.jsxs)(c,{flexDirection:`column`,children:[(0,B.jsx)(i,{isFocused:u===0,children:(0,B.jsx)(r,{children:`Disconnect this session`})}),(0,B.jsx)(i,{isFocused:u===1,children:(0,B.jsx)(r,{children:f?`Hide QR code`:`Show QR code`})}),(0,B.jsx)(i,{isFocused:u===2,children:(0,B.jsx)(r,{children:`Continue`})})]}),(0,B.jsx)(r,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function I(){let{waitForPolicyLimitsToLoad:e,isPolicyAllowed:t}=await import(`./policyLimits-CKy_gTEt.js`);if(await e(),!t(`allow_remote_control`))return`Remote Control is disabled by your organization's policy.`;let n=await S();if(n)return n;let r=w();if(r){let{isAssistantMode:e}=await import(`./assistant-zVegFdAO.js`);e()&&(r=!1)}return(r?await j():T())||(x()?(u(`[bridge] Prerequisites passed, enabling bridge`),null):O)}async function L(e,t,n){return(0,B.jsx)(P,{onDone:e,name:n.trim()||void 0})}var R,z,B;e((()=>{R=k(),n(),z=t(n(),1),b(),C(),A(),E(),s(),M(),v(),y(),f(),_(),d(),B=l()}))();export{L as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Jt as t,on as n}from"./paths-Q2255dD7.js";import{l as r,u as i}from"./oauth-CdZEzMww.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??t()?.accessToken}function c(){return o()??r().BASE_API_URL}function l(){return!!o()}var u=e((()=>{i(),n()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n,t as r}from"./bridgeConfig-CJ-KznTS.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{s as t}from"./envUtils-BWeoiL4Y.js";import{S as n,Zt as r,_ as i,an as a,dn as o,g as s,l as c,on as l}from"./paths-Q2255dD7.js";import{i as u,r as d}from"./semver-Tw0AFar5.js";import{a as f,o as p}from"./bridgeConfig-CJ-KznTS.js";function m(){return p()?!0:_()&&i(`tengu_ccr_bridge`,!1)}async function h(){return p()?!0:_()&&await c(`tengu_ccr_bridge`)}async function g(){return p()?null:_()?v()?y()?.organizationUuid?await c(`tengu_ccr_bridge`)?null:`Remote Control is not yet enabled for your account.`:"Unable to determine your organization for Remote Control eligibility. Run `claude auth login` to refresh your account information.":"Remote Control requires a full-scope login token. Long-lived tokens (from `claude setup-token` or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only for security reasons. Run `claude auth login` to use Remote Control.":"Remote Control requires a claude.ai subscription. Run `claude auth login` to sign in with your claude.ai account."}function _(){try{return o()}catch{return!1}}function v(){try{return a()}catch{return!1}}function y(){try{return r()}catch{return}}function b(){return i(`tengu_bridge_repl_v2`,!1)}function x(){return i(`tengu_bridge_repl_v2_cse_shim_enabled`,!0)}function S(){{let e=s(`tengu_bridge_min_version`,{minVersion:`0.0.0`});if(e.minVersion&&u(`2.6.0`,e.minVersion))return`Your version of Claude Code (2.6.0) is too old for Remote Control.\nVersion ${e.minVersion} or higher is required. Run \`claude update\` to update.`}return null}var C=e((()=>{n(),f(),l(),t(),d()}));export{h as a,m as i,g as n,x as o,C as r,b as s,S as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./bridgeEnabled-5vsPrjuq.js";t();export{n as checkBridgeMinVersion,e as getBridgeDisabledReason};
@@ -0,0 +1,68 @@
1
+ import{d as e,s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Cn as r,In as i,Ln as a,t as o}from"./src-Di342QoJ.js";import{Gs as s,M as c,S as l,Us as u,Ws as d,l as f,z as p}from"./paths-Q2255dD7.js";import{E as m,L as h,T as g,V as _,d as v,s as y,w as b}from"./debug-UI3T040K.js";import{i as x,n as S,r as C}from"./analytics-DqMQntaB.js";import{F as w,P as T}from"./git-CN3qtTb_.js";import{o as E,s as D}from"./log-CzsijfHZ.js";import{E as O,d as k,x as A}from"./startupProfiler-DnXZaX4A.js";import{n as j,t as M}from"./sleep-8Eb9j_Ly.js";import{Aa as N,Da as P,Ma as F,Oa as ee,aE as I,ab as te,db as ne,gt as L,ib as R,ja as z,ka as B,kt as re,lb as V,nb as H,oE as U,ob as W,sb as G,ub as K,wt as q}from"./loadAgentsDir-Ci5mr0vm.js";import{n as ie,t as J}from"./rcDebugLog-BbPkkigY.js";import{c as Y,d as ae,f as oe,n as se,o as ce,r as le}from"./debugUtils-BBMFODKH.js";import{r as ue,t as de}from"./datadog-Bd1s_VFj.js";import{a as X,i as fe}from"./trustedDevice-C9Zevohz.js";import{a as Z,t as pe}from"./types-RJTEOuIt.js";import{t as Q}from"./lib-B4Q0Nrpb.js";import{i as me,n as he,r as ge}from"./cliLaunch-BQa48gsr.js";import{t as _e}from"./capacityWake-BXlUpptF.js";import{t as $}from"./jwtUtils-CpXwh_du.js";import{t as ve}from"./pollConfig-DhptuhFw.js";import{a as ye,i as be,n as xe,r as Se,t as Ce}from"./workSecret-mS2OrpxF.js";import{hostname as we,tmpdir as Te}from"os";import{basename as Ee,dirname as De,join as Oe,resolve as ke}from"path";import{createWriteStream as Ae}from"fs";import{randomUUID as je}from"crypto";import{spawn as Me}from"child_process";import{createInterface as Ne}from"readline";t(),S(),_(),b(),T(),E(),A(),M(),c(),l(),U(),de(),ce(),J(),Z(),B(),q(),me(),a();var Pe=Q();s(),o(),y(),V();var Fe={type:`utf8`,errorCorrectionLevel:`L`,small:!0};async function Ie(e){return(await(0,Pe.toString)(e,Fe)).split(`
2
+ `).filter(e=>e.length>0)}function Le(e){let t=e.write??(e=>process.stdout.write(e)),n=e.verbose,a=0,o=`idle`,s=`Ready`,c=``,l=``,f=``,p=``,m=``,h=``,g=null,_=[],y=!1,b=null,x=0,S=0,C=1,w=null,T=`single-session`,E=new Map,D=null,A=0;function j(e){let t=process.stdout.columns||80,n=0;for(let i of e.split(`
3
+ `)){if(i.length===0){n++;continue}let e=r(i);n+=Math.max(1,Math.ceil(e/t))}return e.endsWith(`
4
+ `)&&n--,n}function M(e){t(e),a+=j(e)}function N(){a<=0||(v(`[bridge:ui] clearStatusLines count=${a}`),t(`\x1b[${a}A`),t(`\x1B[J`),a=0)}function P(e){N(),t(e)}function F(e){Ie(e).then(e=>{_=e,z()}).catch(e=>{v(`QR code generation failed: ${e}`,{level:`error`})})}function ee(){N();let e=d[A%d.length],t=``;c&&(t+=i.dim(` · `)+i.dim(c)),l&&(t+=i.dim(` · `)+i.dim(l)),M(`${i.yellow(e)} ${i.yellow(`Connecting`)}${t}\n`)}function I(){L(),ee(),D=setInterval(()=>{A++,ee()},150)}function L(){D&&(clearInterval(D),D=null)}function z(){if(o===`reconnecting`||o===`failed`)return;N();let e=o===`idle`;if(y)for(let e of _)M(`${i.dim(e)}\n`);let t=u,n=e?i.green:i.cyan,r=(e?i.green:i.cyan)(s),a=``;if(c&&(a+=i.dim(` · `)+i.dim(c)),l&&T!==`worktree`&&(a+=i.dim(` · `)+i.dim(l)),process.env.USER_TYPE===`ant`&&f&&M(`${i.yellow(`[ANT-ONLY] Logs:`)} ${i.dim(f)}\n`),M(`${n(t)} ${r}${a}\n`),C>1){let e=T===`worktree`?`New sessions will be created in an isolated worktree`:`New sessions will be created in the current directory`;M(` ${i.dim(`Capacity: ${S}/${C} \u00b7 ${e}`)}\n`);for(let[,e]of E){let t=ne(e.title?O(e.title,35):i.dim(`Attached`),e.url),n=e.activity;M(` ${t}${n&&n.type!==`result`&&n.type!==`error`?i.dim(` ${O(n.summary,40)}`):``}
5
+ `)}}if(C===1){let e=T===`single-session`?`Single session · exits when complete`:T===`worktree`?`Capacity: ${S}/1 \u00b7 New sessions will be created in an isolated worktree`:`Capacity: ${S}/1 \u00b7 New sessions will be created in the current directory`;M(` ${i.dim(e)}\n`)}C===1&&!e&&b&&Date.now()-x<3e4&&M(` ${i.dim(O(b,60))}\n`);let d=g??p;if(d){M(`
6
+ `);let t=e?G(d):R(d),n=y?i.dim.italic(`space to hide QR code`):i.dim.italic(`space to show QR code`),r=w?i.dim.italic(` · w to toggle spawn mode`):``;M(`${i.dim(t)}\n`),M(`${n}${r}\n`)}}return{printBanner(e,r){m=e.sessionIngressUrl,h=r,p=te(r,m),F(p),n&&t(i.dim(`Remote Control`)+` v2.6.0
7
+ `),n&&(e.spawnMode!==`single-session`&&(t(i.dim(`Spawn mode: `)+`${e.spawnMode}\n`),t(i.dim(`Max concurrent sessions: `)+`${e.maxSessions}\n`)),t(i.dim(`Environment ID: `)+`${r}\n`)),e.sandbox&&t(i.dim(`Sandbox: `)+`${i.green(`Enabled`)}\n`),t(`
8
+ `),I()},logSessionStart(e,t){if(n){let n=O(t,80);P(i.dim(`[${K()}]`)+` Session started: ${i.white(`"${n}"`)} (${i.dim(e)})\n`)}},logSessionComplete(e,t){P(i.dim(`[${K()}]`)+` Session ${i.green(`completed`)} (${k(t)}) ${i.dim(e)}\n`)},logSessionFailed(e,t){P(i.dim(`[${K()}]`)+` Session ${i.red(`failed`)}: ${t} ${i.dim(e)}\n`)},logStatus(e){P(i.dim(`[${K()}]`)+` ${e}\n`)},logVerbose(e){n&&P(i.dim(`[${K()}] ${e}`)+`
9
+ `)},logError(e){P(i.red(`[${K()}] Error: ${e}`)+`
10
+ `)},logReconnected(e){P(i.dim(`[${K()}]`)+` ${i.green(`Reconnected`)} after ${k(e)}\n`)},setRepoInfo(e,t){c=e,l=t},setDebugLogPath(e){f=e},updateIdleStatus(){L(),o=`idle`,s=`Ready`,b=null,x=0,g=null,F(p),z()},setAttached(e){L(),o=`attached`,s=`Connected`,b=null,x=0,C<=1&&(g=W(e,h,m),F(g)),z()},updateReconnectingStatus(e,t){if(L(),N(),o=`reconnecting`,y)for(let e of _)M(`${i.dim(e)}\n`);let n=d[A%d.length];A++,M(`${i.yellow(n)} ${i.yellow(`Reconnecting`)} ${i.dim(`·`)} ${i.dim(`retrying in ${e}`)} ${i.dim(`·`)} ${i.dim(`disconnected ${t}`)}\n`)},updateFailedStatus(e){L(),N(),o=`failed`;let t=``;c&&(t+=i.dim(` · `)+i.dim(c)),l&&(t+=i.dim(` · `)+i.dim(l)),M(`${i.red(`×`)} ${i.red(`Remote Control Failed`)}${t}\n`),M(`${i.dim(H)}\n`),e&&M(`${i.red(e)}\n`)},updateSessionStatus(e,t,n,r){n.type===`tool_start`&&(b=n.summary,x=Date.now()),z()},clearStatus(){L(),N()},toggleQr(){y=!y,z()},updateSessionCount(e,t,n){S===e&&C===t&&T===n||(S=e,C=t,T=n)},setSpawnModeDisplay(e){w!==e&&(w=e,e&&(T=e))},addSession(e,t){E.set(e,{url:t})},updateSessionActivity(e,t){let n=E.get(e);n&&(n.activity=t)},setSessionTitle(e,t){let n=E.get(e);n&&(n.title=t,!(o===`reconnecting`||o===`failed`)&&(C===1&&(o=`titled`,s=O(t,40)),z()))},removeSession(e){E.delete(e)},refreshDisplay(){o===`reconnecting`||o===`failed`||z()}}}Y();var Re=10,ze=10;function Be(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}var Ve={Read:`Reading`,Write:`Writing`,Edit:`Editing`,MultiEdit:`Editing`,Bash:`Running`,Glob:`Searching`,Grep:`Searching`,WebFetch:`Fetching`,WebSearch:`Searching`,Task:`Running task`,FileReadTool:`Reading`,FileWriteTool:`Writing`,FileEditTool:`Editing`,GlobTool:`Searching`,GrepTool:`Searching`,BashTool:`Running`,NotebookEditTool:`Editing notebook`,LSP:`LSP`};function He(e,t){let n=Ve[e]??e,r=t.file_path??t.filePath??t.pattern??t.command?.slice(0,60)??t.url??t.query??``;return r?`${n} ${r}`:n}function Ue(e,t,n){let r;try{r=g(e)}catch{return[]}if(!r||typeof r!=`object`)return[];let i=r,a=[],o=Date.now();switch(i.type){case`assistant`:{let e=i.message;if(!e)break;let r=e.content;if(!Array.isArray(r))break;for(let e of r){if(!e||typeof e!=`object`)continue;let r=e;if(r.type===`tool_use`){let e=r.name??`Tool`,i=r.input??{},s=He(e,i);a.push({type:`tool_start`,summary:s,timestamp:o}),n(`[bridge:activity] sessionId=${t} tool_use name=${e} ${Ge(i)}`)}else if(r.type===`text`){let e=r.text??``;e.length>0&&(a.push({type:`text`,summary:e.slice(0,80),timestamp:o}),n(`[bridge:activity] sessionId=${t} text "${e.slice(0,100)}"`))}}break}case`result`:{let e=i.subtype;if(e===`success`)a.push({type:`result`,summary:`Session completed`,timestamp:o}),n(`[bridge:activity] sessionId=${t} result subtype=success`);else if(e){let r=i.errors?.[0]??`Error: ${e}`;a.push({type:`error`,summary:r,timestamp:o}),n(`[bridge:activity] sessionId=${t} result subtype=${e} error="${r}"`)}else n(`[bridge:activity] sessionId=${t} result subtype=undefined`);break}default:break}return a}function We(e){if(e.parent_tool_use_id!=null||e.isSynthetic||e.isReplay)return;let t=e.message?.content,n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let e of t)if(e&&typeof e==`object`&&e.type===`text`){n=e.text;break}}return n=n?.trim(),n||void 0}function Ge(e){let t=[];for(let[n,r]of Object.entries(e))if(typeof r==`string`&&t.push(`${n}="${r.slice(0,100)}"`),t.length>=3)break;return t.join(` `)}function Ke(e){return{spawn(t,n){let r=Be(t.sessionId),i;if(e.debugFile){let t=e.debugFile.lastIndexOf(`.`);i=t>0?`${e.debugFile.slice(0,t)}-${r}${e.debugFile.slice(t)}`:`${e.debugFile}-${r}`}else (e.verbose||process.env.USER_TYPE===`ant`)&&(i=Oe(Te(),`claude`,`bridge-session-${r}.log`));let a=null,o;e.debugFile&&(o=Oe(De(e.debugFile),`bridge-transcript-${r}.jsonl`),a=Ae(o,{flags:`a`}),a.on(`error`,t=>{e.onDebug(`[bridge:session] Transcript write error: ${t.message}`),a=null}),e.onDebug(`[bridge:session] Transcript log: ${o}`));let s=[...e.scriptArgs,`--print`,`--sdk-url`,t.sdkUrl,`--session-id`,t.sessionId,`--input-format`,`stream-json`,`--output-format`,`stream-json`,`--replay-user-messages`,...e.verbose?[`--verbose`]:[],...i?[`--debug-file`,i]:[],...e.permissionMode?[`--permission-mode`,e.permissionMode]:[]],c={...e.env,CLAUDE_CODE_OAUTH_TOKEN:void 0,CLAUDE_CODE_ENVIRONMENT_KIND:`bridge`,...e.sandbox&&{CLAUDE_CODE_FORCE_SANDBOX:`1`},CLAUDE_CODE_SESSION_ACCESS_TOKEN:t.accessToken,CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2:`1`,...t.useCcrV2&&{CLAUDE_CODE_USE_CCR_V2:`1`,CLAUDE_CODE_WORKER_EPOCH:String(t.workerEpoch)}};e.onDebug(`[bridge:session] Spawning sessionId=${t.sessionId} sdkUrl=${t.sdkUrl} accessToken=${t.accessToken?`present`:`MISSING`}`),e.onDebug(`[bridge:session] Child args: ${s.join(` `)}`),i&&e.onDebug(`[bridge:session] Debug log: ${i}`);let l=Me(e.execPath,s,{cwd:n,stdio:[`pipe`,`pipe`,`pipe`],env:c,windowsHide:!0});e.onDebug(`[bridge:session] sessionId=${t.sessionId} pid=${l.pid}`);let u=[],d=null,f=[],p=!1,h=!1;l.stderr&&Ne({input:l.stderr}).on(`line`,t=>{e.verbose&&process.stderr.write(t+`
11
+ `),f.length>=ze&&f.shift(),f.push(t)}),l.stdout&&Ne({input:l.stdout}).on(`line`,n=>{a&&a.write(n+`
12
+ `),e.onDebug(`[bridge:ws] sessionId=${t.sessionId} <<< ${se(n)}`),e.verbose&&process.stderr.write(n+`
13
+ `);let r=Ue(n,t.sessionId,e.onDebug);for(let n of r)u.length>=Re&&u.shift(),u.push(n),d=n,e.onActivity?.(t.sessionId,n);{let r;try{r=g(n)}catch{}if(r&&typeof r==`object`){let n=r;if(n.type===`control_request`)n.request?.subtype===`can_use_tool`&&e.onPermissionRequest&&e.onPermissionRequest(t.sessionId,r,t.accessToken);else if(n.type===`user`&&!h&&t.onFirstUserMessage){let e=We(n);e&&(h=!0,t.onFirstUserMessage(e))}}}});let _=new Promise(n=>{l.on(`close`,(r,i)=>{a&&(a.end(),a=null),i===`SIGTERM`||i===`SIGINT`?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} interrupted signal=${i} pid=${l.pid}`),n(`interrupted`)):r===0?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} completed exit_code=0 pid=${l.pid}`),n(`completed`)):(e.onDebug(`[bridge:session] sessionId=${t.sessionId} failed exit_code=${r} pid=${l.pid}`),n(`failed`))}),l.on(`error`,r=>{e.onDebug(`[bridge:session] sessionId=${t.sessionId} spawn error: ${r.message}`),n(`failed`)})}),v={sessionId:t.sessionId,done:_,activities:u,accessToken:t.accessToken,lastStderr:f,get currentActivity(){return d},kill(){l.killed||(e.onDebug(`[bridge:session] Sending SIGTERM to sessionId=${t.sessionId} pid=${l.pid}`),process.platform===`win32`?l.kill():l.kill(`SIGTERM`))},forceKill(){!p&&l.pid&&(p=!0,e.onDebug(`[bridge:session] Sending SIGKILL to sessionId=${t.sessionId} pid=${l.pid}`),process.platform===`win32`?l.kill():l.kill(`SIGKILL`))},writeStdin(n){l.stdin&&!l.stdin.destroyed&&(e.onDebug(`[bridge:ws] sessionId=${t.sessionId} >>> ${se(n)}`),l.stdin.write(n))},updateAccessToken(n){v.accessToken=n,v.writeStdin(m({type:`update_environment_variables`,variables:{CLAUDE_CODE_SESSION_ACCESS_TOKEN:n}})+`
14
+ `),e.onDebug(`[bridge:session] Sent token refresh via stdin for sessionId=${t.sessionId}`)}};return v}}}y(),V(),ce(),X();var qe={connInitialMs:2e3,connCapMs:12e4,connGiveUpMs:6e5,generalInitialMs:500,generalCapMs:3e4,generalGiveUpMs:6e5},Je=1e3,Ye=32;async function Xe(){return f(`tengu_ccr_bridge_multi_session`)}function Ze(e){return e.connCapMs*2}function Qe(){let e=[...he()],t=ge();return t&&e.push(t),e}function $e(e,t,n){try{return e.spawn(t,n)}catch(e){let t=h(e);return D(Error(`Session spawn failed: ${t}`)),t}}async function et(t,r,i,a,o,s,c,l=qe,u,d){let f=new AbortController;c.aborted?f.abort():c.addEventListener(`abort`,()=>f.abort(),{once:!0});let p=f.signal,m=new Map,g=new Map,_=new Map,y=new Map,b=new Map,x=new Map,S=new Set,T=new Map,E=new Set,O=new Set,A=_e(p);async function M(){ie(`heartbeat: checking ${m.size} active session(s)`);let e=!1,t=!1,n=[];for(let[i]of m){let o=_.get(i),s=b.get(i);if(!(!o||!s))try{await a.heartbeatWork(r,o,s),e=!0}catch(e){v(`[bridge:heartbeat] Failed for sessionId=${i} workId=${o}: ${h(e)}`),e instanceof P&&(C(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),e.status===401||e.status===403?n.push(i):t=!0)}}for(let e of n){s.logVerbose(`Session ${e} token expired — re-queuing via bridge/reconnect`);try{await a.reconnectSession(r,e),v(`[bridge:heartbeat] Re-queued sessionId=${e} via bridge/reconnect`)}catch(t){s.logError(`Failed to refresh session ${e} token: ${h(t)}`),v(`[bridge:heartbeat] reconnectSession(${e}) failed: ${h(t)}`,{level:`error`})}}return t?`fatal`:n.length>0?`auth_failed`:e?`ok`:`failed`}let ee=new Set,te=d?$({getAccessToken:d,onRefresh:(e,t)=>{let n=m.get(e);n&&(ee.has(e)?(s.logVerbose(`Refreshing session ${e} token via bridge/reconnect`),a.reconnectSession(r,e).catch(t=>{s.logError(`Failed to refresh session ${e} token: ${h(t)}`),v(`[bridge:token] reconnectSession(${e}) failed: ${h(t)}`,{level:`error`})})):n.updateAccessToken(t))},label:`bridge`}):null,ne=Date.now(),R=new Set;function B(e){R.add(e),e.finally(()=>R.delete(e))}let V=0,H=0,U=null,W=null,G=null,K=null,q=!1;if(v(`[bridge:work] Starting poll loop spawnMode=${t.spawnMode} maxSessions=${t.maxSessions} environmentId=${r}`),w(`info`,`bridge_loop_started`,{max_sessions:t.maxSessions,spawn_mode:t.spawnMode}),process.env.USER_TYPE===`ant`){let e;if(t.debugFile){let n=t.debugFile.lastIndexOf(`.`);e=n>0?`${t.debugFile.slice(0,n)}-*${t.debugFile.slice(n)}`:`${t.debugFile}-*`}else e=Oe(Te(),`claude`,`bridge-session-*.log`);s.setDebugLogPath(e)}s.printBanner(t,r),s.updateSessionCount(0,t.maxSessions,t.spawnMode),u&&s.setAttached(u);function J(){s.updateSessionCount(m.size,t.maxSessions,t.spawnMode);for(let[e,t]of m){let n=t.currentActivity;n&&s.updateSessionActivity(y.get(e)??e,n)}if(m.size===0){s.updateIdleStatus();return}let[e,n]=[...m.entries()].pop(),r=g.get(e);if(!r)return;let i=n.currentActivity;if(!i||i.type===`result`||i.type===`error`){t.maxSessions>1&&s.refreshDisplay();return}let a=k(Date.now()-r),o=n.activities.filter(e=>e.type===`tool_start`).slice(-5).map(e=>e.summary);s.updateSessionStatus(e,a,i,o)}function Y(){oe(),J(),K=setInterval(J,Je)}function oe(){K&&(clearInterval(K),K=null)}function se(e,n,i){return o=>{let c=_.get(e);ie(`session done: sessionId=${e} workId=${c??`none`} status=${o} wasTimedOut=${E.has(e)} duration=${Math.round((Date.now()-n)/1e3)}s stderr=${i.lastStderr.length>0?i.lastStderr.join(`\\n`).slice(0,500):`(none)`}`),m.delete(e),g.delete(e),_.delete(e),b.delete(e);let u=y.get(e)??e;y.delete(e),s.removeSession(u),O.delete(u),ee.delete(e);let d=x.get(e);d&&(clearTimeout(d),x.delete(e)),te?.cancel(e),A.wake();let j=E.delete(e),M=j&&o===`interrupted`?`failed`:o,N=Date.now()-n;v(`[bridge:session] sessionId=${e} workId=${c??`unknown`} exited status=${M} duration=${k(N)}`),C(`tengu_bridge_session_done`,{status:M,duration_ms:N}),w(`info`,`bridge_session_done`,{status:M,duration_ms:N}),s.clearStatus(),oe();let P=i.lastStderr.length>0?i.lastStderr.join(`
15
+ `):void 0,F;switch(M){case`completed`:s.logSessionComplete(e,N);break;case`failed`:!j&&!p.aborted&&(F=P??`Process exited with error`,s.logSessionFailed(e,F),D(Error(`Bridge session failed: ${F}`)));break;case`interrupted`:s.logVerbose(`Session ${e} interrupted`);break}M!==`interrupted`&&c&&(B(ot(a,r,c,s,l.stopWorkBaseDelayMs)),S.add(c));let I=T.get(e);if(I&&(T.delete(e),B(re(I.worktreePath,I.worktreeBranch,I.gitRoot,I.hookBased).catch(e=>s.logVerbose(`Failed to remove worktree ${I.worktreePath}: ${h(e)}`)))),M!==`interrupted`&&!p.aborted)if(t.spawnMode!==`single-session`)B(a.archiveSession(u).catch(t=>s.logVerbose(`Failed to archive session ${e}: ${h(t)}`))),v(`[bridge:session] Session ${M}, returning to idle (multi-session mode)`);else{v(`[bridge:session] Session ${M}, aborting poll loop to tear down environment`),f.abort();return}p.aborted||Y()}}for(u||Y();!p.aborted;){let c=ve();try{ie(`poll: envId=${r} activeSessions=${m.size}`);let d=await a.pollForWork(r,i,p,c.reclaim_older_than_ms);if(U!==null||W!==null){let e=Date.now()-(U??W??Date.now());s.logReconnected(e),v(`[bridge:poll] Reconnected after ${k(e)}`),C(`tengu_bridge_reconnected`,{disconnected_ms:e})}if(V=0,H=0,U=null,W=null,G=null,!d){if(m.size>=t.maxSessions){let e=c.multisession_poll_interval_ms_at_capacity;if(c.non_exclusive_heartbeat_interval_ms>0){C(`tengu_bridge_heartbeat_mode_entered`,{active_sessions:m.size,heartbeat_interval_ms:c.non_exclusive_heartbeat_interval_ms});let n=e>0?Date.now()+e:null,r=`ok`,i=0;for(;!p.aborted&&m.size>=t.maxSessions&&(n===null||Date.now()<n);){let e=ve();if(e.non_exclusive_heartbeat_interval_ms<=0)break;let t=A.signal();if(r=await M(),r===`auth_failed`||r===`fatal`){t.cleanup();break}i++,await j(e.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}let a=r===`auth_failed`||r===`fatal`?r:p.aborted?`shutdown`:m.size<t.maxSessions?`capacity_changed`:n!==null&&Date.now()>=n?`poll_due`:`config_disabled`;if(C(`tengu_bridge_heartbeat_mode_exited`,{reason:a,heartbeat_cycles:i,active_sessions:m.size}),a===`poll_due`&&v(`[bridge:poll] Heartbeat poll_due after ${i} cycles — falling through to pollForWork`),r===`auth_failed`||r===`fatal`){let t=A.signal();await j(e>0?e:c.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}}else if(e>0){let t=A.signal();await j(e,t.signal),t.cleanup()}}else await j(m.size>0?c.multisession_poll_interval_ms_partial_capacity:c.multisession_poll_interval_ms_not_at_capacity,p);continue}let f=m.size>=t.maxSessions;if(S.has(d.id)){if(v(`[bridge:work] Skipping already-completed workId=${d.id}`),f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}else await j(1e3,p);continue}let N;try{N=Se(d.secret)}catch(e){let t=h(e);if(s.logError(`Failed to decode work secret for workId=${d.id}: ${t}`),C(`tengu_bridge_work_secret_failed`,{}),S.add(d.id),B(ot(a,r,d.id,s,l.stopWorkBaseDelayMs)),f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}continue}let P=async()=>{v(`[bridge:work] Acknowledging workId=${d.id}`);try{await a.acknowledgeWork(r,d.id,N.session_ingress_token)}catch(e){v(`[bridge:work] Acknowledge failed workId=${d.id}: ${h(e)}`)}},ne=d.data.type;switch(d.data.type){case`healthcheck`:await P(),v(`[bridge:work] Healthcheck received`),s.logVerbose(`Healthcheck received`);break;case`session`:{let i=d.data.id;ie(`work received: type=session sessionId=${i} workId=${d.id}`);try{F(i,`session_id`)}catch{await P(),s.logError(`Invalid session_id received: ${i}`);break}let c=m.get(i);if(c){c.updateAccessToken(N.session_ingress_token),b.set(i,N.session_ingress_token),_.set(i,d.id),te?.schedule(i,N.session_ingress_token),v(`[bridge:work] Updated access token for existing sessionId=${i} workId=${d.id}`),await P();break}if(m.size>=t.maxSessions){v(`[bridge:work] At capacity (${m.size}/${t.maxSessions}), cannot spawn new session for workId=${d.id}`);break}await P();let f=Date.now(),k,A=!1,M;if(N.use_code_sessions===!0||n(process.env.CLAUDE_BRIDGE_USE_CCR_V2)){k=Ce(t.apiBaseUrl,i);for(let e=1;e<=2;e++)try{M=await be(k,N.session_ingress_token),A=!0,v(`[bridge:session] CCR v2: registered worker sessionId=${i} epoch=${M} attempt=${e}`);break}catch(t){let n=h(t);if(e<2){if(v(`[bridge:session] CCR v2: registerWorker attempt ${e} failed, retrying: ${n}`),await j(2e3,p),p.aborted)break;continue}s.logError(`CCR v2 worker registration failed for session ${i}: ${n}`),D(Error(`registerWorker failed: ${n}`)),S.add(d.id),B(ot(a,r,d.id,s,l.stopWorkBaseDelayMs))}if(!A)break}else k=xe(t.sessionIngressUrl,i);let ne=t.spawnMode,R=t.dir,z=0;if(ne===`worktree`&&(u===void 0||!ye(i,u))){let e=Date.now();try{let t=await L(`bridge-${Be(i)}`);z=Date.now()-e,T.set(i,{worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,gitRoot:t.gitRoot,hookBased:t.hookBased}),R=t.worktreePath,v(`[bridge:session] Created worktree for sessionId=${i} at ${t.worktreePath}`)}catch(e){let t=h(e);s.logError(`Failed to create worktree for session ${i}: ${t}`),D(Error(`Worktree creation failed: ${t}`)),S.add(d.id),B(ot(a,r,d.id,s,l.stopWorkBaseDelayMs));break}}v(`[bridge:session] Spawning sessionId=${i} sdkUrl=${k}`);let V=ae(i);ie(`spawning session: sessionId=${i} sdkUrl=${k} useCcrV2=${A} workerEpoch=${M} dir=${R} accessToken=${N.session_ingress_token?N.session_ingress_token.slice(0,8)+`...`:`NONE`}`);let H=$e(o,{sessionId:i,sdkUrl:k,accessToken:N.session_ingress_token,useCcrV2:A,workerEpoch:M,onFirstUserMessage:e=>{if(O.has(V))return;O.add(V);let n=mt(e);s.setSessionTitle(V,n),v(`[bridge:title] derived title for ${V}: ${n}`),import(`./createSession-B9MhWusY.js`).then(({updateBridgeSessionTitle:e})=>e(V,n,{baseUrl:t.apiBaseUrl})).catch(e=>v(`[bridge:title] failed to update title for ${V}: ${e}`,{level:`error`}))}},R);if(typeof H==`string`){s.logError(`Failed to spawn session ${i}: ${H}`);let e=T.get(i);e&&(T.delete(i),B(re(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased).catch(t=>s.logVerbose(`Failed to remove worktree ${e.worktreePath}: ${h(t)}`)))),S.add(d.id),B(ot(a,r,d.id,s,l.stopWorkBaseDelayMs));break}let U=H,W=Date.now()-f;C(`tengu_bridge_session_started`,{active_sessions:m.size,spawn_mode:ne,in_worktree:T.has(i),spawn_duration_ms:W,worktree_create_ms:z,inProtectedNamespace:e()}),w(`info`,`bridge_session_started`,{spawn_mode:ne,in_worktree:T.has(i),spawn_duration_ms:W,worktree_create_ms:z}),m.set(i,U),_.set(i,d.id),b.set(i,N.session_ingress_token),y.set(i,V);let G=Date.now();g.set(i,G),s.logSessionStart(i,`Session ${i}`);let K=Be(i),q;if(t.debugFile){let e=t.debugFile.lastIndexOf(`.`);q=e>0?`${t.debugFile.slice(0,e)}-${K}${t.debugFile.slice(e)}`:`${t.debugFile}-${K}`}else (t.verbose||process.env.USER_TYPE===`ant`)&&(q=Oe(Te(),`claude`,`bridge-session-${K}.log`));q&&s.logVerbose(`Debug log: ${q}`),s.addSession(V,I(V,t.sessionIngressUrl)),Y(),s.setAttached(V),ht(V,t.apiBaseUrl).then(e=>{e&&m.has(i)&&(O.add(V),s.setSessionTitle(V,e),v(`[bridge:title] server title for ${V}: ${e}`))}).catch(e=>v(`[bridge:title] failed to fetch title for ${V}: ${e}`,{level:`error`}));let J=t.sessionTimeoutMs??864e5;if(J>0){let e=setTimeout(st,J,i,J,s,E,U);x.set(i,e)}A&&ee.add(i),te?.schedule(i,N.session_ingress_token),U.done.then(se(i,G,U));break}default:await P(),v(`[bridge:work] Unknown work type: ${ne}, skipping`);break}if(f){let e=A.signal();c.non_exclusive_heartbeat_interval_ms>0?(await M(),await j(c.non_exclusive_heartbeat_interval_ms,e.signal)):c.multisession_poll_interval_ms_at_capacity>0&&await j(c.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}}catch(e){if(p.aborted)break;if(e instanceof P){q=!0,N(e.errorType)?s.logStatus(e.message):z(e)?v(`[bridge:work] Suppressed 403 error: ${e.message}`):(s.logError(e.message),D(e)),C(`tengu_bridge_fatal_error`,{status:e.status,error_type:e.errorType}),w(N(e.errorType)?`info`:`error`,`bridge_fatal_error`,{status:e.status,error_type:e.errorType});break}let t=le(e);if(ie(`poll error: ${t} isConn=${nt(e)} isServer=${rt(e)} activeSessions=${m.size}`),nt(e)||rt(e)){let e=Date.now();G!==null&&e-G>Ze(l)&&(v(`[bridge:work] Detected system sleep (${Math.round((e-G)/1e3)}s gap), resetting error budget`),w(`info`,`bridge_poll_sleep_detected`,{gapMs:e-G}),U=null,V=0,W=null,H=0),G=e,U||(U=e);let n=e-U;if(n>=l.connGiveUpMs){s.logError(`Server unreachable for ${Math.round(n/6e4)} minutes, giving up.`),C(`tengu_bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),w(`error`,`bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),q=!0;break}W=null,H=0,V=V?Math.min(V*2,l.connCapMs):l.connInitialMs;let r=it(V);s.logVerbose(`Connection error, retrying in ${at(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),s.updateReconnectingStatus(at(r),k(n)),ve().non_exclusive_heartbeat_interval_ms>0&&await M(),await j(r,p)}else{let e=Date.now();G!==null&&e-G>Ze(l)&&(v(`[bridge:work] Detected system sleep (${Math.round((e-G)/1e3)}s gap), resetting error budget`),w(`info`,`bridge_poll_sleep_detected`,{gapMs:e-G}),U=null,V=0,W=null,H=0),G=e,W||(W=e);let n=e-W;if(n>=l.generalGiveUpMs){s.logError(`Persistent errors for ${Math.round(n/6e4)} minutes, giving up.`),C(`tengu_bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),w(`error`,`bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),q=!0;break}U=null,V=0,H=H?Math.min(H*2,l.generalCapMs):l.generalInitialMs;let r=it(H);s.logVerbose(`Poll failed, retrying in ${at(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),s.updateReconnectingStatus(at(r),k(n)),ve().non_exclusive_heartbeat_interval_ms>0&&await M(),await j(r,p)}}}oe(),s.clearStatus();let ce=Date.now()-ne;C(`tengu_bridge_shutdown`,{active_sessions:m.size,loop_duration_ms:ce}),w(`info`,`bridge_shutdown`,{active_sessions:m.size,loop_duration_ms:ce});let ue=new Set(m.keys());u&&ue.add(u);let de=new Map(y);if(m.size>0){v(`[bridge:shutdown] Shutting down ${m.size} active session(s)`),s.logStatus(`Shutting down ${m.size} active session(s)\u2026`);let e=new Map(_);for(let[e,t]of m.entries())v(`[bridge:shutdown] Sending SIGTERM to sessionId=${e}`),t.kill();let t=new AbortController;await Promise.race([Promise.allSettled([...m.values()].map(e=>e.done)),j(l.shutdownGraceMs??3e4,t.signal)]),t.abort();for(let[e,t]of m.entries())v(`[bridge:shutdown] Force-killing stuck sessionId=${e}`),t.forceKill();for(let e of x.values())clearTimeout(e);if(x.clear(),te?.cancelAll(),T.size>0){let e=[...T.values()];T.clear(),v(`[bridge:shutdown] Cleaning up ${e.length} worktree(s)`),await Promise.allSettled(e.map(e=>re(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased)))}await Promise.allSettled([...e.entries()].map(([e,t])=>a.stopWork(r,t,!0).catch(n=>s.logVerbose(`Failed to stop work ${t} for session ${e}: ${h(n)}`))))}if(R.size>0&&await Promise.allSettled([...R]),t.spawnMode===`single-session`&&u&&!q){s.logStatus("Resume this session by running `claude remote-control --continue`"),v(`[bridge:shutdown] Skipping archive+deregister to allow resume of session ${u}`);return}ue.size>0&&(v(`[bridge:shutdown] Archiving ${ue.size} session(s)`),await Promise.allSettled([...ue].map(e=>a.archiveSession(de.get(e)??ae(e)).catch(t=>s.logVerbose(`Failed to archive session ${e}: ${h(t)}`)))));try{await a.deregisterEnvironment(r),v(`[bridge:shutdown] Environment deregistered, bridge offline`),s.logVerbose(`Environment deregistered.`)}catch(e){s.logVerbose(`Failed to deregister environment: ${h(e)}`)}let{clearBridgePointer:X}=await import(`./bridgePointer-FvAMj3re.js`);await X(t.dir),s.logVerbose(`Environment offline.`)}var tt=new Set([`ECONNREFUSED`,`ECONNRESET`,`ETIMEDOUT`,`ENETUNREACH`,`EHOSTUNREACH`]);function nt(e){return!!(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&tt.has(e.code))}function rt(e){return!!e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&e.code===`ERR_BAD_RESPONSE`}function it(e){return Math.max(0,e+e*.25*(2*Math.random()-1))}function at(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}async function ot(e,t,n,r,i=1e3){for(let a=1;a<=3;a++)try{await e.stopWork(t,n,!1),v(`[bridge:work] stopWork succeeded for workId=${n} on attempt ${a}/3`);return}catch(e){if(e instanceof P){z(e)?v(`[bridge:work] Suppressed stopWork 403 for ${n}: ${e.message}`):r.logError(`Failed to stop work ${n}: ${e.message}`),w(`error`,`bridge_stop_work_failed`,{attempts:a,fatal:!0});return}let t=h(e);if(a<3){let e=it(i*2**(a-1));r.logVerbose(`Failed to stop work ${n} (attempt ${a}/3), retrying in ${at(e)}: ${t}`),await j(e)}else r.logError(`Failed to stop work ${n} after 3 attempts: ${t}`),w(`error`,`bridge_stop_work_failed`,{attempts:3})}}function st(e,t,n,r,i){v(`[bridge:session] sessionId=${e} timed out after ${k(t)}`),C(`tengu_bridge_session_timeout`,{timeout_ms:t}),n.logSessionFailed(e,`Session timed out after ${k(t)}`),r.add(e),i.kill()}var ct=[`session`,`same-dir`,`worktree`];function lt(e){return e===`session`?`single-session`:e===`same-dir`?`same-dir`:e===`worktree`?`worktree`:`--spawn requires one of: ${ct.join(`, `)} (got: ${e??`<missing>`})`}function ut(e){let t=e===void 0?NaN:parseInt(e,10);return isNaN(t)||t<1?`--capacity requires a positive integer (got: ${e??`<missing>`})`:t}function dt(e){let t=!1,n=!1,r,i,a,o,s=!1,c,l,u,d,f=!1;for(let m=0;m<e.length;m++){let h=e[m];if(h===`--help`||h===`-h`)s=!0;else if(h===`--verbose`||h===`-v`)t=!0;else if(h===`--sandbox`)n=!0;else if(h===`--no-sandbox`)n=!1;else if(h===`--debug-file`&&m+1<e.length)r=ke(e[++m]);else if(h.startsWith(`--debug-file=`))r=ke(h.slice(13));else if(h===`--session-timeout`&&m+1<e.length)i=parseInt(e[++m],10)*1e3;else if(h.startsWith(`--session-timeout=`))i=parseInt(h.slice(18),10)*1e3;else if(h===`--permission-mode`&&m+1<e.length)a=e[++m];else if(h.startsWith(`--permission-mode=`))a=h.slice(18);else if(h===`--name`&&m+1<e.length)o=e[++m];else if(h.startsWith(`--name=`))o=h.slice(7);else if(h===`--session-id`&&m+1<e.length){if(d=e[++m],!d)return p(`--session-id requires a value`)}else if(h.startsWith(`--session-id=`)){if(d=h.slice(13),!d)return p(`--session-id requires a value`)}else if(h===`--continue`||h===`-c`)f=!0;else if(h===`--spawn`||h.startsWith(`--spawn=`)){if(c!==void 0)return p(`--spawn may only be specified once`);let t=lt(h.startsWith(`--spawn=`)?h.slice(8):e[++m]);if(t===`single-session`||t===`same-dir`||t===`worktree`)c=t;else return p(t)}else if(h===`--capacity`||h.startsWith(`--capacity=`)){if(l!==void 0)return p(`--capacity may only be specified once`);let t=ut(h.startsWith(`--capacity=`)?h.slice(11):e[++m]);if(typeof t==`number`)l=t;else return p(t)}else if(h===`--create-session-in-dir`)u=!0;else if(h===`--no-create-session-in-dir`)u=!1;else return p(`Unknown argument: ${h}\nRun 'claude remote-control --help' for usage.`)}if(c===`single-session`&&l!==void 0)return p(`--capacity cannot be used with --spawn=session (single-session mode has fixed capacity 1).`);if((d||f)&&(c!==void 0||l!==void 0||u!==void 0))return p(`--session-id and --continue cannot be used with --spawn, --capacity, or --create-session-in-dir.`);if(d&&f)return p(`--session-id and --continue cannot be used together.`);return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s};function p(e){return{verbose:t,sandbox:n,debugFile:r,sessionTimeoutMs:i,permissionMode:a,name:o,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f,help:s,error:e}}}async function ft(){let{EXTERNAL_PERMISSION_MODES:e}=await import(`./permissions-Ps_D01ZB.js`),t=e.join(`, `),n=await Xe(),r=`
16
+ Remote Control - Connect your local environment to claude.ai/code
17
+
18
+ USAGE
19
+ claude remote-control [options]
20
+ OPTIONS
21
+ --name <name> Name for the session (shown in claude.ai/code)
22
+ -c, --continue Resume the last session in this directory
23
+ --session-id <id> Resume a specific session by ID (cannot be
24
+ used with spawn flags or --continue)
25
+ --permission-mode <mode> Permission mode for spawned sessions
26
+ (${t})
27
+ --debug-file <path> Write debug logs to file
28
+ -v, --verbose Enable verbose output
29
+ -h, --help Show this help
30
+ ${n?` --spawn <mode> Spawn mode: same-dir, worktree, session
31
+ (default: same-dir)
32
+ --capacity <N> Max concurrent sessions in worktree or
33
+ same-dir mode (default: ${Ye})
34
+ --[no-]create-session-in-dir Pre-create a session in the current
35
+ directory; in worktree mode this session
36
+ stays in cwd while on-demand sessions get
37
+ isolated worktrees (default: on)
38
+ `:``}
39
+ DESCRIPTION
40
+ Remote Control allows you to control sessions on your local device from
41
+ claude.ai/code (https://claude.ai/code). Run this command in the
42
+ directory you want to work in, then connect from the Claude app or web.
43
+ ${n?`
44
+ Remote Control runs as a persistent server that accepts multiple concurrent
45
+ sessions in the current directory. One session is pre-created on start so
46
+ you have somewhere to type immediately. Use --spawn=worktree to isolate
47
+ each on-demand session in its own git worktree, or --spawn=session for
48
+ the classic single-session mode (exits when that session ends). Press 'w'
49
+ during runtime to toggle between same-dir and worktree.
50
+ `:``}
51
+ NOTES
52
+ - You must be logged in with a Claude account that has a subscription
53
+ - Run \`claude\` first in the directory to accept the workspace trust dialog
54
+ ${n?` - Worktree mode requires a git repository or WorktreeCreate/WorktreeRemove hooks
55
+ `:``}`;console.log(r)}var pt=80;function mt(e){return O(e.replace(/\s+/g,` `).trim(),pt)}async function ht(e,t){let{getBridgeSession:n}=await import(`./createSession-B9MhWusY.js`);return(await n(e,{baseUrl:t}))?.title||void 0}async function gt(e){let t=dt(e);if(t.help){await ft();return}t.error&&(console.error(`Error: ${t.error}`),process.exit(1));let{verbose:n,sandbox:r,debugFile:i,sessionTimeoutMs:a,permissionMode:o,name:s,spawnMode:c,capacity:l,createSessionInDir:u,sessionId:d,continueSession:f}=t,m=d,g,_=c!==void 0||l!==void 0||u!==void 0;if(o!==void 0){let{PERMISSION_MODES:e}=await import(`./permissions-Ps_D01ZB.js`),t=e;t.includes(o)||(console.error(`Error: Invalid permission mode '${o}'. Valid modes: ${t.join(`, `)}`),process.exit(1))}let y=ke(`.`),{enableConfigs:b,checkHasTrustDialogAccepted:S}=await import(`./config-BdCuh6eA.js`);b();let{initSinks:T}=await import(`./sinks-oFfsKySL.js`);T();let E=await Xe();_&&!E&&(await x(`tengu_bridge_multi_session_denied`,{used_spawn:c!==void 0,used_capacity:l!==void 0,used_create_session_in_dir:u!==void 0}),await Promise.race([Promise.all([p(),ue()]),j(500,void 0,{unref:!0})]).catch(()=>{}),console.error(`Error: Multi-session Remote Control is not enabled for your account yet.`),process.exit(1));let{setOriginalCwd:O,setCwdState:k}=await import(`./state-B2GIOsTB.js`);O(y),k(y),S()||(console.error(`Error: Workspace not trusted. Please run \`claude\` in ${y} first to review and accept the workspace trust dialog.`),process.exit(1));let{clearOAuthTokenCache:A,checkAndRefreshOAuthTokenIfNeeded:M}=await import(`./auth-CqURlg4d.js`),{getBridgeAccessToken:N,getBridgeBaseUrl:I}=await import(`./bridgeConfig-CNbOKpAg.js`);N()||(console.error(pe),process.exit(1));let{getGlobalConfig:te,saveGlobalConfig:ne,getCurrentProjectConfig:L,saveCurrentProjectConfig:R}=await import(`./config-BdCuh6eA.js`);if(!te().remoteDialogSeen){let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});console.log(`
56
+ Remote Control lets you access this CLI session from the web (claude.ai/code)
57
+ or the Claude app, so you can pick up where you left off on any device.
58
+
59
+ You can disconnect remote access anytime by running /remote-control again.
60
+ `);let t=await new Promise(t=>{e.question(`Enable Remote Control? (y/n) `,t)});e.close(),ne(e=>e.remoteDialogSeen?e:{...e,remoteDialogSeen:!0}),t.toLowerCase()!==`y`&&t.toLowerCase()!==`yes`&&process.exit(0)}if(f){let{readBridgePointerAcrossWorktrees:e}=await import(`./bridgePointer-FvAMj3re.js`),t=await e(y);t||(console.error("Error: No recent session found in this directory or its worktrees. Run `claude remote-control` to start a new one."),process.exit(1));let{pointer:n,dir:r}=t,i=Math.round(n.ageMs/6e4),a=i<60?`${i}m`:`${Math.round(i/60)}h`,o=r===y?``:` from worktree ${r}`;console.error(`Resuming session ${n.sessionId} (${a} ago)${o}\u2026`),m=n.sessionId,g=r}let z=I();z.startsWith(`http://`)&&!z.includes(`localhost`)&&!z.includes(`127.0.0.1`)&&(console.error(`Error: Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`),process.exit(1));let B=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||z,{getBranch:re,getRemoteUrl:V,findGitRoot:H}=await import(`./git-D23Mzu_K.js`),{hasWorktreeCreateHook:U}=await import(`./hooks-BLLL4iPv.js`),W=U()||H(y)!==null,G=E?L().remoteControlSpawnMode:void 0;if(G===`worktree`&&!W&&(console.error(`Warning: Saved spawn mode is worktree but this directory is not a git repository. Falling back to same-dir.`),G=void 0,R(e=>e.remoteControlSpawnMode===void 0?e:{...e,remoteControlSpawnMode:void 0})),E&&!G&&W&&c===void 0&&!m&&process.stdin.isTTY){let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout});console.log(`
61
+ Claude Remote Control is launching in spawn mode which lets you create new sessions in this project from Claude Code on Web or your Mobile app. Learn more here: https://code.claude.com/docs/en/remote-control
62
+
63
+ Spawn mode for this project:
64
+ [1] same-dir — sessions share the current directory (default)
65
+ [2] worktree — each session gets an isolated git worktree
66
+
67
+ This can be changed later or explicitly set with --spawn=same-dir or --spawn=worktree.
68
+ `);let t=await new Promise(t=>{e.question(`Choose [1/2] (default: 1): `,t)});e.close();let n=t.trim()===`2`?`worktree`:`same-dir`;G=n,C(`tengu_bridge_spawn_mode_chosen`,{spawn_mode:n}),R(e=>e.remoteControlSpawnMode===n?e:{...e,remoteControlSpawnMode:n})}let K,q;m?(q=`single-session`,K=`resume`):c===void 0?G===void 0?(q=E?`same-dir`:`single-session`,K=`gate_default`):(q=G,K=`saved`):(q=c,K=`flag`);let ie=q===`single-session`?1:l??Ye,J=u??!0;if(!m){let{clearBridgePointer:e}=await import(`./bridgePointer-FvAMj3re.js`);await e(y)}q===`worktree`&&!W&&(console.error(`Error: Worktree mode requires a git repository or WorktreeCreate hooks configured. Use --spawn=session for single-session mode.`),process.exit(1));let Y=await re(),ae=await V(),se=we(),ce=je(),{handleOAuth401Error:le}=await import(`./auth-CqURlg4d.js`),de=ee({baseUrl:z,getAccessToken:N,runnerVersion:`2.6.0`,onDebug:v,onAuth401:le,getTrustedDeviceToken:fe}),X;if(m){try{F(m,`sessionId`)}catch{console.error(`Error: Invalid session ID "${m}". Session IDs must not contain unsafe characters.`),process.exit(1)}await M(),A();let{getBridgeSession:e}=await import(`./createSession-B9MhWusY.js`),t=await e(m,{baseUrl:z,getAccessToken:N});if(!t){if(g){let{clearBridgePointer:e}=await import(`./bridgePointer-FvAMj3re.js`);await e(g)}console.error(`Error: Session ${m} not found. It may have been archived or expired, or your login may have lapsed (run \`claude /login\`).`),process.exit(1)}if(!t.environment_id){if(g){let{clearBridgePointer:e}=await import(`./bridgePointer-FvAMj3re.js`);await e(g)}console.error(`Error: Session ${m} has no environment_id. It may never have been attached to a bridge.`),process.exit(1)}X=t.environment_id,v(`[bridge:init] Resuming session ${m} on environment ${X}`)}let Z={dir:y,machineName:se,branch:Y,gitRepoUrl:ae,maxSessions:ie,spawnMode:q,verbose:n,sandbox:r,bridgeId:ce,workerType:`claude_code`,environmentId:je(),reuseEnvironmentId:X,apiBaseUrl:z,sessionIngressUrl:B,debugFile:i,sessionTimeoutMs:a};v(`[bridge:init] bridgeId=${ce}${X?` reuseEnvironmentId=${X}`:``} dir=${y} branch=${Y} gitRepoUrl=${ae} machine=${se}`),v(`[bridge:init] apiBaseUrl=${z} sessionIngressUrl=${B}`),v(`[bridge:init] sandbox=${r}${i?` debugFile=${i}`:``}`);let Q,me;try{let e=await de.registerBridgeEnvironment(Z);Q=e.environment_id,me=e.environment_secret}catch(e){C(`tengu_bridge_registration_failed`,{status:e instanceof P?e.status:void 0}),console.error(e instanceof P&&e.status===404?`Remote Control environments are not available for your account.`:`Error: ${h(e)}`),process.exit(1)}let he;if(m)if(X&&Q!==X)D(Error(`Bridge resume env mismatch: requested ${X}, backend returned ${Q}. Falling back to fresh session.`)),console.warn(`Warning: Could not resume session ${m} — its environment has expired. Creating a fresh session instead.`);else{let e=oe(m),t=e===m?[m]:[m,e],n=!1,r;for(let e of t)try{await de.reconnectSession(Q,e),v(`[bridge:init] Session ${e} re-queued via bridge/reconnect`),he=m,n=!0;break}catch(t){r=t,v(`[bridge:init] reconnectSession(${e}) failed: ${h(t)}`)}if(!n){let e=r,t=e instanceof P;if(g&&t){let{clearBridgePointer:e}=await import(`./bridgePointer-FvAMj3re.js`);await e(g)}console.error(t?`Error: ${h(e)}`:`Error: Failed to reconnect session ${m}: ${h(e)}\nThe session may still be resumable — try running the same command again.`),process.exit(1)}}v(`[bridge:init] Registered, server environmentId=${Q}`);let ge=ve();C(`tengu_bridge_started`,{max_sessions:Z.maxSessions,has_debug_file:!!Z.debugFile,sandbox:Z.sandbox,verbose:Z.verbose,heartbeat_interval_ms:ge.non_exclusive_heartbeat_interval_ms,spawn_mode:Z.spawnMode,spawn_mode_source:K,multi_session_gate:E,pre_create_session:J,worktree_available:W}),w(`info`,`bridge_started`,{max_sessions:Z.maxSessions,sandbox:Z.sandbox,spawn_mode:Z.spawnMode});let _e=Ke({execPath:process.execPath,scriptArgs:Qe(),env:process.env,verbose:n,sandbox:r,debugFile:i,permissionMode:o,onDebug:v,onActivity:(e,t)=>{v(`[bridge:activity] sessionId=${e} ${t.type} ${t.summary}`)},onPermissionRequest:(e,t,n)=>{v(`[bridge:perm] sessionId=${e} tool=${t.request.tool_name} request_id=${t.request_id} (not auto-approving)`)}}),$=Le({verbose:n}),{parseGitHubRepository:ye}=await import(`./detectRepository-DCTvg4p0.js`),be=ae?ye(ae):null,xe=be?be.split(`/`).pop():Ee(y);$.setRepoInfo(xe,Y);let Se=q!==`single-session`&&W;Se&&$.setSpawnModeDisplay(q);let Ce=e=>{if(e[0]===3||e[0]===4){process.emit(`SIGINT`);return}if(e[0]===32){$.toggleQr();return}if(e[0]===119){if(!Se)return;let e=Z.spawnMode===`same-dir`?`worktree`:`same-dir`;Z.spawnMode=e,C(`tengu_bridge_spawn_mode_toggled`,{spawn_mode:e}),$.logStatus(e===`worktree`?`Spawn mode: worktree (new sessions get isolated git worktrees)`:`Spawn mode: same-dir (new sessions share the current directory)`),$.setSpawnModeDisplay(e),$.refreshDisplay(),R(t=>t.remoteControlSpawnMode===e?t:{...t,remoteControlSpawnMode:e});return}};process.stdin.isTTY&&(process.stdin.setRawMode(!0),process.stdin.resume(),process.stdin.on(`data`,Ce));let Te=new AbortController,De=()=>{v(`[bridge:shutdown] SIGINT received, shutting down`),Te.abort()},Oe=()=>{v(`[bridge:shutdown] SIGTERM received, shutting down`),Te.abort()};process.on(`SIGINT`,De),process.on(`SIGTERM`,Oe);let Ae=he||null;if(J&&!he){let{createBridgeSession:e}=await import(`./createSession-B9MhWusY.js`);try{Ae=await e({environmentId:Q,title:s,events:[],gitRepoUrl:ae,branch:Y,signal:Te.signal,baseUrl:z,getAccessToken:N,permissionMode:o}),Ae&&v(`[bridge:init] Created initial session ${Ae}`)}catch(e){v(`[bridge:init] Session creation failed (non-fatal): ${h(e)}`)}}let Me=null;if(Ae&&q===`single-session`){let{writeBridgePointer:e}=await import(`./bridgePointer-FvAMj3re.js`),t={sessionId:Ae,environmentId:Q,source:`standalone`};await e(Z.dir,t),Me=setInterval(e,3600*1e3,Z.dir,t),Me.unref?.()}try{await et(Z,Q,me,de,_e,$,Te.signal,void 0,Ae??void 0,async()=>(A(),await M(),N()))}finally{Me!==null&&clearInterval(Me),process.off(`SIGINT`,De),process.off(`SIGTERM`,Oe),process.stdin.off(`data`,Ce),process.stdin.isTTY&&process.stdin.setRawMode(!1),process.stdin.pause()}process.exit(0)}var _t=class extends Error{constructor(e){super(e),this.name=`BridgeHeadlessPermanentError`}};async function vt(e,t){let{dir:n,log:r}=e;process.chdir(n);let{setOriginalCwd:i,setCwdState:a}=await import(`./state-B2GIOsTB.js`);i(n),a(n);let{enableConfigs:o,checkHasTrustDialogAccepted:s}=await import(`./config-BdCuh6eA.js`);o();let{initSinks:c}=await import(`./sinks-oFfsKySL.js`);if(c(),!s())throw new _t(`Workspace not trusted: ${n}. Run \`claude\` in that directory first to accept the trust dialog.`);if(!e.getAccessToken())throw Error(pe);let{getBridgeBaseUrl:l}=await import(`./bridgeConfig-CNbOKpAg.js`),u=l();if(u.startsWith(`http://`)&&!u.includes(`localhost`)&&!u.includes(`127.0.0.1`))throw new _t(`Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`);let d=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||u,{getBranch:f,getRemoteUrl:p,findGitRoot:m}=await import(`./git-D23Mzu_K.js`),{hasWorktreeCreateHook:g}=await import(`./hooks-BLLL4iPv.js`);if(e.spawnMode===`worktree`&&!(g()||m(n)!==null))throw new _t(`Worktree mode requires a git repository or WorktreeCreate hooks. Directory ${n} has neither.`);let _=await f(),v=await p(),y=we(),b=je(),x={dir:n,machineName:y,branch:_,gitRepoUrl:v,maxSessions:e.capacity,spawnMode:e.spawnMode,verbose:!1,sandbox:e.sandbox,bridgeId:b,workerType:`claude_code`,environmentId:je(),apiBaseUrl:u,sessionIngressUrl:d,sessionTimeoutMs:e.sessionTimeoutMs},S=ee({baseUrl:u,getAccessToken:e.getAccessToken,runnerVersion:`2.6.0`,onDebug:r,onAuth401:e.onAuth401,getTrustedDeviceToken:fe}),C,w;try{let e=await S.registerBridgeEnvironment(x);C=e.environment_id,w=e.environment_secret}catch(e){throw Error(`Bridge registration failed: ${h(e)}`)}let T=Ke({execPath:process.execPath,scriptArgs:Qe(),env:process.env,verbose:!1,sandbox:e.sandbox,permissionMode:e.permissionMode,onDebug:r}),E=yt(r);E.printBanner(x,C);let D;if(e.createSessionOnStart){let{createBridgeSession:n}=await import(`./createSession-B9MhWusY.js`);try{let i=await n({environmentId:C,title:e.name,events:[],gitRepoUrl:v,branch:_,signal:t,baseUrl:u,getAccessToken:e.getAccessToken,permissionMode:e.permissionMode});i&&(D=i,r(`created initial session ${i}`))}catch(e){r(`session pre-creation failed (non-fatal): ${h(e)}`)}}await et(x,C,w,S,T,E,t,void 0,D,async()=>e.getAccessToken())}function yt(e){let t=()=>{};return{printBanner:(t,n)=>e(`registered environmentId=${n} dir=${t.dir} spawnMode=${t.spawnMode} capacity=${t.maxSessions}`),logSessionStart:(t,n)=>e(`session start ${t}`),logSessionComplete:(t,n)=>e(`session complete ${t} (${n}ms)`),logSessionFailed:(t,n)=>e(`session failed ${t}: ${n}`),logStatus:e,logVerbose:e,logError:t=>e(`error: ${t}`),logReconnected:t=>e(`reconnected after ${t}ms`),addSession:(t,n)=>e(`session attached ${t}`),removeSession:t=>e(`session detached ${t}`),updateIdleStatus:t,updateReconnectingStatus:t,updateSessionStatus:t,updateSessionActivity:t,updateSessionCount:t,updateFailedStatus:t,setSpawnModeDisplay:t,setRepoInfo:t,setDebugLogPath:t,setAttached:t,setSessionTitle:t,clearStatus:t,toggleQr:t,refreshDisplay:t}}export{dt as a,rt as i,gt as n,vt as o,nt as r,et as s,_t as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./bridgeMain-BimZwc2P.js";export{e as bridgeMain};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./defineProperty-80gRi2ZW.js";import{L as n,T as r,V as i,d as a,s as o,w as s}from"./debug-UI3T040K.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{B as u,J as d,K as f,M as p,S as m,T as h,W as g,X as _,et as v,g as y,m as b,z as x}from"./log-CzsijfHZ.js";import{P as S,Z as C,n as w,t as T}from"./rcDebugLog-BbPkkigY.js";import{t as E}from"./controlMessageCompat-BJhFiS7u.js";import{randomUUID as D}from"crypto";c(),S(),o(),T(),b(),i(),s(),v(),e();function O(e){return typeof e==`object`&&!!e&&`type`in e&&typeof e.type==`string`}function k(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_response`&&`response`in e}function A(e){return typeof e==`object`&&!!e&&`type`in e&&e.type===`control_request`&&`request_id`in e&&`request`in e}function j(e){return(e.type===`user`||e.type===`assistant`)&&e.isVirtual?!1:e.type===`user`||e.type===`assistant`||e.type===`system`&&e.subtype===`local_command`}function M(e){if(e.type!==`user`||e.isMeta||e.toolUseResult||e.isCompactSummary||e.origin&&e.origin.kind!==`human`)return;let t=e.message.content,n;if(typeof t==`string`)n=t;else for(let e of t??[])if(e.type===`text`){n=e.text;break}if(n)return y(n)||void 0}var N=`system-reminder`,P=/\s*<([a-z][\w-]*)(?:\s[^>]*)?>[\s\S]*?<\/\1>\s*/gy,F=new Set([m,h,p,x,u,g,f,d,_]);function I(e){let t=e.message?.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&typeof e==`object`&&e.type===`text`&&typeof e.text==`string`).map(e=>e.text).join(``):``}function L(e){let t=e.trim();if(!t)return null;P.lastIndex=0;let n=[];for(;P.lastIndex<t.length;){let e=P.exec(t);if(!e)return null;n.push(e[1])}return n.length>0?n:null}function R(e){if(e.type!==`user`||e.isVisibleInTranscriptOnly)return!1;if(e.toolUseResult!==void 0||!e.isMeta)return!0;let t=L(I(e));return t?t.some(e=>e!==`local-command-caveat`&&e!==N&&F.has(e)):!0}function z(e){return e.some(R)}function B(e,t,i,o,s,c){try{let n=E(r(e));if(k(n)){a(`[bridge:repl] Ingress message type=control_response`),s?.(n);return}if(A(n)){a(`[bridge:repl] Inbound control_request subtype=${n.request.subtype}`),c?.(n);return}if(!O(n))return;let u=`uuid`in n&&typeof n.uuid==`string`?n.uuid:void 0;if(u&&t.has(u)){a(`[bridge:repl] Ignoring echo: type=${n.type} uuid=${u}`);return}if(u&&i.has(u)){a(`[bridge:repl] Ignoring re-delivered inbound: type=${n.type} uuid=${u}`);return}a(`[bridge:repl] Ingress message type=${n.type}${u?` uuid=${u}`:``}`),n.type===`user`?(u&&i.add(u),l(`tengu_bridge_message_received`,{is_repl:!0}),o?.(n)):a(`[bridge:repl] Ignoring non-user inbound message: type=${n.type}`)}catch(e){a(`[bridge:repl] Failed to parse ingress message: ${n(e)}`)}}var V=`This session is outbound-only. Enable Remote Control locally to allow inbound control.`;function H(e,t){let{transport:n,sessionId:r,outboundOnly:i,onInterrupt:o,onSetModel:s,onSetMaxThinkingTokens:c,onSetPermissionMode:l}=t;if(!n){a(`[bridge:repl] Cannot respond to control_request: transport not configured`);return}let u,d=e.request;if(i&&d.subtype!==`initialize`){u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:V}};let t={...u,session_id:r};n.write(t),a(`[bridge:repl] Rejected ${d.subtype} (outbound-only) request_id=${e.request_id}`);return}switch(d.subtype){case`initialize`:u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:{commands:[],output_style:`normal`,available_output_styles:[`normal`],models:[],account:{},pid:process.pid}}};break;case`set_model`:s?.(d.model),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_max_thinking_tokens`:c?.(d.max_thinking_tokens??null),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;case`set_permission_mode`:{let t=l?.(d.mode)??{ok:!1,error:`set_permission_mode is not supported in this context (onSetPermissionMode callback not registered)`};u=t.ok?{type:`control_response`,response:{subtype:`success`,request_id:e.request_id}}:{type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t.error}};break}case`interrupt`:o?.(),u={type:`control_response`,response:{subtype:`success`,request_id:e.request_id}};break;default:u={type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:`REPL bridge does not handle control_request subtype: ${d.subtype}`}}}let f={...u,session_id:r};n.write(f),w(`control_response: subtype=${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`),a(`[bridge:repl] Sent control_response for ${d.subtype} request_id=${e.request_id} result=${u.response.subtype}`)}function U(e){return{type:`result_success`,subtype:`success`,duration_ms:0,duration_api_ms:0,is_error:!1,num_turns:0,result:``,stop_reason:null,total_cost_usd:0,usage:{...C},modelUsage:{},permission_denials:[],session_id:e,uuid:D()}}var W=class{constructor(e){t(this,`capacity`,void 0),t(this,`ring`,void 0),t(this,`set`,new Set),t(this,`writeIdx`,0),this.capacity=e,this.ring=Array(e)}add(e){if(this.set.has(e))return;let t=this.ring[this.writeIdx];t!==void 0&&this.set.delete(t),this.ring[this.writeIdx]=e,this.set.add(e),this.writeIdx=(this.writeIdx+1)%this.capacity}has(e){return this.set.has(e)}clear(){this.set.clear(),this.ring.fill(void 0),this.writeIdx=0}};export{j as a,z as c,H as i,M as n,U as o,B as r,R as s,W as t};
@@ -0,0 +1 @@
1
+ import{Ln as e,vt as t,wn as n}from"./schemas-BGAvj1T4.js";import{t as r}from"./v4-f1i_CNUT.js";import{E as i,T as a,U as o,V as s,d as c,s as l,w as u}from"./debug-UI3T040K.js";import{c as d,g as f,h as p,l as m,p as h}from"./sessionStoragePortable-BI9q2WcJ.js";import{n as g,t as _}from"./lazySchema-2sOku3cX.js";import{dirname as v,join as y}from"path";import{mkdir as b,readFile as x,stat as S,unlink as C,writeFile as w}from"fs/promises";r(),l(),s(),f(),_(),m(),u();var T=50,E=g(()=>n({sessionId:e(),environmentId:e(),source:t([`standalone`,`repl`])}));function D(e){return y(d(),h(e),`bridge-pointer.json`)}async function O(e,t){let n=D(e);try{await b(v(n),{recursive:!0}),await w(n,i(t),`utf8`),c(`[bridge:pointer] wrote ${n}`)}catch(e){c(`[bridge:pointer] write failed: ${e}`,{level:`warn`})}}async function k(e){let t=D(e),n,r;try{r=(await S(t)).mtimeMs,n=await x(t,`utf8`)}catch{return null}let i=E().safeParse(M(n));if(!i.success)return c(`[bridge:pointer] invalid schema, clearing: ${t}`),await j(e),null;let a=Math.max(0,Date.now()-r);return a>144e5?(c(`[bridge:pointer] stale (>4h mtime), clearing: ${t}`),await j(e),null):{...i.data,ageMs:a}}async function A(e){let t=await k(e);if(t)return{pointer:t,dir:e};let n=await p(e);if(n.length<=1)return null;if(n.length>T)return c(`[bridge:pointer] ${n.length} worktrees exceeds fanout cap ${T}, skipping`),null;let r=h(e),i=n.filter(e=>h(e)!==r),a=await Promise.all(i.map(async e=>{let t=await k(e);return t?{pointer:t,dir:e}:null})),o=null;for(let e of a)e&&(!o||e.pointer.ageMs<o.pointer.ageMs)&&(o=e);return o&&c(`[bridge:pointer] fanout found pointer in worktree ${o.dir} (ageMs=${o.pointer.ageMs})`),o}async function j(e){let t=D(e);try{await C(t),c(`[bridge:pointer] cleared ${t}`)}catch(e){o(e)||c(`[bridge:pointer] clear failed: ${e}`,{level:`warn`})}}function M(e){try{return a(e)}catch{return null}}export{j as clearBridgePointer,k as readBridgePointer,A as readBridgePointerAcrossWorktrees,O as writeBridgePointer};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{r as t,t as n}from"./execFileNoThrow-CuQN1sz8.js";function r(e){let t;try{t=new URL(e)}catch{throw Error(`Invalid URL format: ${e}`)}if(t.protocol!==`http:`&&t.protocol!==`https:`)throw Error(`Invalid URL protocol: must use http:// or https://, got ${t.protocol}`)}async function i(e){try{let t=process.platform;if(t===`win32`){let{code:t}=await n(`explorer`,[e]);return t===0}let{code:r}=await n(t===`darwin`?`open`:`xdg-open`,[e]);return r===0}catch{return!1}}async function a(e){try{r(e);let t=process.env.BROWSER,i=process.platform;if(i===`win32`){if(t){let{code:r}=await n(t,[`"${e}"`]);return r===0}let{code:r}=await n(`rundll32`,[`url,OpenURL`,e],{});return r===0}else{let{code:r}=await n(t||(i===`darwin`?`open`:`xdg-open`),[e]);return r===0}}catch{return!1}}var o=e((()=>{t()}));export{a as n,i as r,o as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Ct as n,F as r,Rn as i,Tt as a,W as o,b as s,t as c,x as l}from"./src-Di342QoJ.js";import{t as u}from"./jsx-runtime-D-D469L8.js";import{Ac as d,Gs as f,Pc as p}from"./paths-Q2255dD7.js";import{L as m,V as h}from"./debug-UI3T040K.js";import{Bg as g,CD as _,Hg as v,Lo as y,Lw as b,Ly as x,Ml as S,Oo as C,Ry as w,SD as T,dk as E,dt as D,fk as O,ft as k,jO as A,jl as j,pk as M}from"./loadAgentsDir-Ci5mr0vm.js";import{X as N}from"./rcDebugLog-BbPkkigY.js";import{n as P,r as F}from"./sideQuestion-BAq0YyKY.js";import{i as I,n as L}from"./modalContext-CmSKRyea.js";function R({question:e,context:t,onDone:n}){let[i,c]=(0,H.useState)(null),[u,d]=(0,H.useState)(null),[f,p]=(0,H.useState)(0),h=(0,H.useRef)(null),{rows:_}=I(r());a(()=>p(e=>e+1),i||u?null:80);function v(e){if(e.key===`escape`||e.key===`return`||e.key===` `||e.ctrl&&(e.key===`c`||e.key===`d`)){e.preventDefault(),n(void 0,{display:`skip`});return}(e.key===`up`||e.ctrl&&e.key===`p`)&&(e.preventDefault(),h.current?.scrollBy(-K)),(e.key===`down`||e.ctrl&&e.key===`n`)&&(e.preventDefault(),h.current?.scrollBy(K))}(0,H.useEffect)(()=>{let n=T();async function r(){try{let r=await F({question:e,cacheSafeParams:await B(t)});n.signal.aborted||(r.response?c(r.response):d(`No response received`))}catch(e){n.signal.aborted||d(m(e)||`Failed to get response`)}}return r(),()=>{n.abort()}},[e,t]);let y=Math.max(5,_-W-G);return(0,U.jsxs)(l,{flexDirection:`column`,paddingLeft:2,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:v,children:[(0,U.jsxs)(l,{children:[(0,U.jsxs)(s,{color:`warning`,bold:!0,children:[`/btw`,` `]}),(0,U.jsx)(s,{dimColor:!0,children:e})]}),(0,U.jsx)(l,{marginTop:1,marginLeft:2,maxHeight:y,children:(0,U.jsx)(o,{ref:h,flexDirection:`column`,flexGrow:1,children:u?(0,U.jsx)(s,{color:`error`,children:u}):i?(0,U.jsx)(g,{children:i}):(0,U.jsxs)(l,{children:[(0,U.jsx)(x,{frame:f,messageColor:`warning`}),(0,U.jsx)(s,{color:`warning`,children:`Answering...`})]})})}),(i||u)&&(0,U.jsx)(l,{marginTop:1,children:(0,U.jsxs)(s,{dimColor:!0,children:[`↑`,`/`,`↓`,` to scroll · Space, Enter, or Escape to dismiss`]})})]})}function z(e){let t=e.at(-1);return t?.type===`assistant`&&t.message.stop_reason===null?e.slice(0,-1):e}async function B(e){let t=C(z(e.messages)),n=j();if(n)return{systemPrompt:n.systemPrompt,userContext:n.userContext,systemContext:n.systemContext,toolUseContext:e,forkContextMessages:t};let[r,i,a]=await Promise.all([D(e.options.tools,e.options.mainLoopModel,[],e.options.mcpClients),O(),E()]);return{systemPrompt:N(r),userContext:i,systemContext:a,toolUseContext:e,forkContextMessages:t}}async function V(e,t,n){let r=n?.trim();return r?(p(e=>({...e,btwUseCount:e.btwUseCount+1})),(0,U.jsx)(R,{question:r,context:t,onDone:e})):(e(`Usage: /btw <your question>`,{display:`system`}),null)}var H,U,W,G,K;e((()=>{i(),H=t(i(),1),n(),v(),w(),f(),k(),L(),M(),b(),c(),_(),d(),h(),S(),y(),P(),A(),U=u(),W=5,G=6,K=3}))();export{V as call};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i,x as a,xt as o}from"./src-Di342QoJ.js";import{t as s}from"./jsx-runtime-D-D469L8.js";import{Ac as c,Jt as l,Pc as u,Sc as d,St as f,on as p,wt as m}from"./paths-Q2255dD7.js";import{l as h,u as g}from"./oauth-CdZEzMww.js";import{a as _,i as v,n as y,o as b,r as x,s as S,t as C,v as w}from"./companion-CyK_Dr1U.js";import{r as T,t as E}from"./sprites-5OAB-Ui2.js";function D({name:e,value:t}){let n=Math.round(Math.max(0,Math.min(100,t))/10),i=`█`.repeat(n)+`░`.repeat(10-n);return(0,k.jsxs)(r,{children:[e.padEnd(10),` `,i,` `,String(t).padStart(3)]})}function O({companion:e,lastReaction:t,onDone:n}){let i=_[e.rarity],s=b[e.rarity],c=T(e,0);return o(()=>{n?.(void 0,{display:`skip`})},{isActive:n!==void 0}),(0,k.jsxs)(a,{flexDirection:`column`,borderStyle:`round`,borderColor:i,paddingX:j,paddingY:1,width:A,flexShrink:0,children:[(0,k.jsxs)(a,{justifyContent:`space-between`,children:[(0,k.jsxs)(r,{bold:!0,color:i,children:[s,` `,e.rarity.toUpperCase()]}),(0,k.jsx)(r,{color:i,children:e.species.toUpperCase()})]}),e.shiny&&(0,k.jsxs)(r,{color:`warning`,bold:!0,children:[`✨`,` SHINY `,`✨`]}),(0,k.jsx)(a,{flexDirection:`column`,marginY:1,children:c.map((e,t)=>(0,k.jsx)(r,{color:i,children:e},t))}),(0,k.jsx)(r,{bold:!0,children:e.name}),(0,k.jsx)(a,{marginY:1,children:(0,k.jsxs)(r,{dimColor:!0,italic:!0,children:[`"`,e.personality,`"`]})}),(0,k.jsx)(a,{flexDirection:`column`,children:S.map(t=>(0,k.jsx)(D,{name:t,value:e.stats[t]??0},t))}),t&&(0,k.jsxs)(a,{flexDirection:`column`,marginTop:1,children:[(0,k.jsx)(r,{dimColor:!0,children:`last said`}),(0,k.jsx)(a,{borderStyle:`round`,borderColor:`inactive`,paddingX:1,children:(0,k.jsx)(r,{dimColor:!0,italic:!0,children:t})})]})]})}var k,A,j,M=e((()=>{i(),E(),w(),k=s(),A=40,j=2}));function N(e,t){let n=y();if(!n||d().companionMuted)return;let r=P(e,n.name),i=Date.now();if(!r&&i-R<z)return;let a=I(e);a.trim()&&(R=i,L(n,a,r).then(e=>{e&&(B.push(e),B.length>V&&B.shift(),t(e))}).catch(()=>{}))}function P(e,t){let n=RegExp(`\\b${F(t)}\\b`,`i`);for(let t=e.length-1;t>=Math.max(0,e.length-3);t--){let r=e[t];if(r?.type!==`user`)continue;let i=r.message?.content;if(typeof i==`string`&&n.test(i))return!0}return!1}function F(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function I(e){return e.slice(-12).filter(e=>e.type===`user`||e.type===`assistant`).map(e=>{let t=e.type===`user`?`user`:`claude`,n=e.message?.content;return`${t}: ${typeof n==`string`?n.slice(0,300):Array.isArray(n)?n.filter(e=>e?.type===`text`).map(e=>e.text).join(` `).slice(0,300):``}`}).join(`
2
+ `).slice(0,5e3)}async function L(e,t,n){let r=l();if(!r?.accessToken)return null;let i=d().oauthAccount?.organizationUuid;if(!i)return null;let a=`${h().BASE_API_URL}/api/organizations/${i}/claude_code/buddy_react`,o=await fetch(a,{method:`POST`,headers:{Authorization:`Bearer ${r.accessToken}`,"Content-Type":`application/json`,"User-Agent":f()},body:JSON.stringify({name:e.name.slice(0,32),personality:e.personality.slice(0,200),species:e.species,rarity:e.rarity,stats:e.stats,transcript:t,reason:n?`addressed`:`turn`,recent:B.map(e=>e.slice(0,200)),addressed:n}),signal:AbortSignal.timeout(1e4)});if(!o.ok)return null;try{return(await o.json()).reaction?.trim()||null}catch{return null}}var R,z,B,V,H=e((()=>{x(),c(),p(),g(),m(),R=0,z=45e3,B=[],V=8}));function U(e){return e.charAt(0).toUpperCase()+e.slice(1)}async function W(e,t,n){let r=n?.trim().toLowerCase()??``,i=t.setAppState;if(r===`off`)return u(e=>({...e,companionMuted:!0})),e(`companion muted`,{display:`system`}),null;if(r===`on`)return u(e=>({...e,companionMuted:!1})),e(`companion unmuted`,{display:`system`}),null;if(r===`pet`){let n=y();return n?(u(e=>({...e,companionMuted:!1})),i?.(e=>({...e,companionPetAt:Date.now()})),N(t.messages??[],e=>i?.(t=>t.companionReaction===e?t:{...t,companionReaction:e})),e(`petted ${n.name}`,{display:`system`}),null):(e(`no companion yet · run /buddy first`,{display:`system`}),null)}let a=y();if(a&&d().companionMuted&&u(e=>({...e,companionMuted:!1})),a){let n=t.getAppState?.()?.companionReaction;return G.createElement(O,{companion:a,lastReaction:n,onDone:e})}let o=C(),s=v(o),c=K[s.bones.species]??`Buddy`,l=q[s.bones.species]??`Mysterious and code-savvy.`,f={name:c,personality:l,seed:o,hatchedAt:Date.now()};u(e=>({...e,companion:f}));let p=b[s.bones.rarity],m=T(s.bones,0),h=s.bones.shiny?` ✨ Shiny!`:``;return e([`A wild companion appeared!`,``,...m,``,`${c} the ${U(s.bones.species)}${h}`,`Rarity: ${p} (${s.bones.rarity})`,`"${l}"`,``,`Your companion will now appear beside your input box!`,`Say its name to get its take · /buddy pet · /buddy off`].join(`
3
+ `),{display:`system`}),null}var G,K,q;e((()=>{G=t(n(),1),x(),w(),E(),M(),c(),H(),K={duck:`Waddles`,goose:`Goosberry`,blob:`Gooey`,cat:`Whiskers`,dragon:`Ember`,octopus:`Inky`,owl:`Hoots`,penguin:`Waddleford`,turtle:`Shelly`,snail:`Trailblazer`,ghost:`Casper`,axolotl:`Axie`,capybara:`Chill`,cactus:`Spike`,robot:`Byte`,rabbit:`Flops`,mushroom:`Spore`,chonk:`Chonk`},q={duck:`Quirky and easily amused. Leaves rubber duck debugging tips everywhere.`,goose:`Assertive and honks at bad code. Takes no prisoners in code reviews.`,blob:`Adaptable and goes with the flow. Sometimes splits into two when confused.`,cat:`Independent and judgmental. Watches you type with mild disdain.`,dragon:`Fiery and passionate about architecture. Hoards good variable names.`,octopus:`Multitasker extraordinaire. Wraps tentacles around every problem at once.`,owl:`Wise but verbose. Always says "let me think about that" for exactly 3 seconds.`,penguin:`Cool under pressure. Slides gracefully through merge conflicts.`,turtle:`Patient and thorough. Believes slow and steady wins the deploy.`,snail:`Methodical and leaves a trail of useful comments. Never rushes.`,ghost:`Ethereal and appears at the worst possible moments with spooky insights.`,axolotl:`Regenerative and cheerful. Recovers from any bug with a smile.`,capybara:`Zen master. Remains calm while everything around is on fire.`,cactus:`Prickly on the outside but full of good intentions. Thrives on neglect.`,robot:`Efficient and literal. Processes feedback in binary.`,rabbit:`Energetic and hops between tasks. Finishes before you start.`,mushroom:`Quietly insightful. Grows on you over time.`,chonk:`Big, warm, and takes up the whole couch. Prioritizes comfort over elegance.`}}))();export{W as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";function t(){return process.versions.bun!==void 0}function n(){return typeof Bun<`u`&&Array.isArray(Bun.embeddedFiles)&&Bun.embeddedFiles.length>0}var r=e((()=>{}));export{n,t as r,r as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{K as a,V as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{L as l,MS as u,NS as d,PS as f,jS as p,w as m}from"./loadAgentsDir-Ci5mr0vm.js";async function h(e,t,n){{if(y)return;y=!0;let{updateContext:r,notification:i}=await l(e,n);t(e=>{let t=r(e.toolPermissionContext),n=t===e.toolPermissionContext?e:{...e,toolPermissionContext:t};return i?{...n,notifications:{...n.notifications,queue:[...n.notifications.queue,{key:`auto-mode-gate-notification`,text:i,color:`warning`,priority:`high`}]}}:n})}}function g(){y=!1}function _(){let e=u(e=>e.mainLoopModel),t=u(e=>e.mainLoopModelForSession),n=u(e=>e.fastMode),i=f(),o=d(),s=(0,v.useRef)(!0);(0,v.useEffect)(()=>{r()||(s.current?s.current=!1:g(),h(o.getState().toolPermissionContext,i,n).catch(e=>{c(Error(`Auto mode gate check failed`,{cause:a(e)}))}))},[e,t,n])}var v,y,b=e((()=>{v=t(n(),1),o(),s(),i(),p(),m(),y=!1}));export{_ as i,b as n,g as r,h as t};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./defineProperty-80gRi2ZW.js";import{p as i}from"./zod-DT6hytkp.js";import{Fr as a,Pr as o,Zn as s,cn as c,u as l}from"./state-sIHsFpDu.js";import{Ac as u,Ka as d,Sc as f,oo as p}from"./paths-Q2255dD7.js";import{L as m,V as h,d as g,h as _,p as v,s as ee}from"./debug-UI3T040K.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{n as x,t as S}from"./cwd--iizewsn.js";import{E as te,S as ne,_ as re,r as ie,v as ae}from"./git-CN3qtTb_.js";import{o as oe,s as C}from"./log-CzsijfHZ.js";import{i as se,n as ce}from"./path-C4kbwvSH.js";import{n as w,r as le}from"./execFileNoThrow-CuQN1sz8.js";import{$S as ue,Ac as de,ED as fe,Gm as pe,Hd as me,Ik as he,Nt as ge,Pk as _e,Q as ve,QS as ye,Sh as be,Sk as xe,Wm as Se,X as Ce,Xi as we,_ as Te,_l as Ee,bm as De,dk as Oe,fk as ke,hl as Ae,kc as je,lA as Me,m as Ne,mk as Pe,ny as Fe,pk as Ie,ry as Le,uA as Re,uk as ze,v as Be,wD as Ve,wm as He,xh as Ue,xk as We,yn as Ge,zd as Ke,zi as qe,zt as Je}from"./loadAgentsDir-Ci5mr0vm.js";import{Gt as Ye,Wt as Xe}from"./prompt-DEPUnJdB.js";import{a as Ze,t as Qe}from"./detectRepository-CBk3S2zv.js";import{r as $e,t as et}from"./magicDocs-BfoeYhin.js";import*as T from"path";import{statSync as tt}from"fs";function E(e,t,n){if(t===0)return n?j:0;let r=e.charCodeAt(t-1);return nt(r)?k:rt(r)&&it(e.charCodeAt(t))?A:0}function nt(e){return e===47||e===92||e===45||e===95||e===46||e===32}function rt(e){return e>=97&&e<=122}function it(e){return e>=65&&e<=90}function D(){return new Promise(e=>setImmediate(e))}function at(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var O,k,A,ot,j,M,st,ct,N,P,lt,ut=e((()=>{n(),O=16,k=8,A=6,ot=4,j=8,M=3,st=1,ct=100,N=64,P=new Int32Array(N),lt=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await D(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await D(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=at(e,ct)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,N),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*(O+k)+j+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){P[0]=g[e];let n=0,o=0,u=P[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}P[e]=t;let i=t-u-1;i===0?o+=ot:n+=M+i*st,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*O+o-n;f+=E(v,P[0],!0);for(let e=1;e<i;e++)f+=E(v,P[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function F(){return R||(R=new lt),R}function dt(){R=null,z=null,V++,H=null,U=[],W=[],G=[],B.clear(),K=null,q=null,J=0,Y=null,X=null,Z=null}function ft(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function pt(){let e=ie(S());if(!e)return null;try{return tt(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function mt(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function ht(e){if(e.length===0||!R||U.length===0)return;let t=await vt(e),n=[...U,...W,...G,...e,...t],r=ft(n);if(r===Z){g(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await R.loadFromFileListAsync(n).done,Z=r,g(`[FileIndex] rebuilt index with ${U.length} tracked + ${e.length} untracked files`)}async function gt(e,t){let n=`${e}:${t}`;if(q===n)return K;let r=v(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,kt.default)(),s=!1,c=a.flatMap(e=>i.map(t=>T.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,g(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return K=u,q=n,u}async function _t(e,t){let n=Date.now();g(`[FileIndex] getFilesUsingGit called`);let r=S(),i=ie(r);if(!i)return g(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await w(re(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(g(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return g(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=mt(o.stdout.trim().split(`
2
+ `).filter(Boolean),i,r),c=await gt(i,r);if(c){let e=s.length;s=c.filter(s),g(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}U=s;let l=Date.now()-n;if(g(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),b(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!H){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=V;H=w(re(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===V&&e.code===0){let t=mt(e.stdout.trim().split(`
3
+ `).filter(Boolean),i,r),n=await gt(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),g(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}g(`[FileIndex] background untracked fetch: ${t.length} files`),ht(t)}}).catch(e=>{g(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{H=null})}return s}catch(e){return g(`[FileIndex] git ls-files error: ${m(e)}`),null}}async function vt(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)yt(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await D(),n=performance.now());return[...t].map(e=>e+T.sep)}function yt(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function bt(e){return(await Promise.all(Ne.map(t=>Be(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function xt(e,t){g(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await _t(e,t);if(n!==null)return g(`[FileIndex] using git ls-files result (${n.length} files)`),n;g(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await Re(i,`.`,e)).map(e=>T.relative(S(),e)),o=Date.now()-r;return g(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),b(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function St(){let e=AbortSignal.timeout(1e4),t=F();try{let n=d(),r=f(),i=n.respectGitignore??r.respectGitignore??!0,a=S(),[o,s]=await Promise.all([xt(e,i),bt(a)]);W=s;let c=[...o,...s],l=await vt(c);G=l;let u=[...l,...c],p=ft(u);p===X?g(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,X=p,Z=null)}catch(e){C(e)}return t}function Ct(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function wt(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=Ct(n,r),n===``)return``}return n}function I(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Tt(e,t){return e.search(t,Q).map(e=>I(e.path,e.score))}function L(){if(z)return;let e=pt();if(R&&!(e!==null&&e!==Y)&&Date.now()-J<jt)return;let t=V,n=Date.now();F(),z=St().then(r=>t===V?(z=null,B.emit(),Y=e,J=Date.now(),g(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(g(`[FileIndex] Cache refresh failed: ${m(e)}`),C(e),t===V&&(z=null),F()))}async function Et(){let e=v(),t=S();try{return(await e.readdir(t)).map(e=>{let n=T.join(t,e.name),r=T.relative(t,n);return e.isDirectory()?r+T.sep:r})}catch(e){return C(e),[]}}async function Dt(e,t=!1){if(!e&&!t)return[];if(d().fileSuggestion?.type===`command`)return(await Je({...ge(),query:e})).slice(0,Q).map(I);if(e===``||e===`.`||e===`./`){let e=await Et();return L(),e.slice(0,Q).map(I)}let n=Date.now();try{let t=z!==null;L();let r=e,i=`.`+T.sep;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=ce(r));let a=R?Tt(R,r):[],o=Date.now()-n;return g(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),b(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return C(e),[]}}function Ot(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var kt,R,z,B,At,V,H,U,W,G,K,q,J,Y,X,Z,Q,jt,$=e((()=>{kt=t(i(),1),Te(),ut(),y(),u(),x(),ee(),h(),le(),_(),ae(),Ge(),oe(),se(),Me(),p(),a(),R=null,z=null,B=o(),At=B.subscribe,V=0,H=null,U=[],W=[],G=[],K=null,q=null,J=0,Y=null,X=null,Z=null,Q=15,jt=5e3}));function Mt(e=new Set){let t=e.size>0;ke.cache.clear?.(),Oe.cache.clear?.(),ze.cache.clear?.(),Xe.cache.clear?.(),dt(),qe(),t||he(),Pe(null),s(null),Ee(),de(),xe(`session_start`),ye(),Fe(),t||Ke(),process.env.USER_TYPE===`ant`&&import(`./TungstenTool-C5IqKVr0.js`).then(({clearSessionsWithTungstenUsage:e,resetInitializationState:t})=>{e(),t()}),import(`./attributionHooks-PygdohOh.js`).then(({clearAttributionCaches:e})=>e()),Qe(),Ce(),t||Ve(),l(e),ne(),De(),be(),et(),Se(),import(`./utils-CwhszpkT.js`).then(({clearWebFetchCache:e})=>e()),import(`./SearchExtraToolsTool-D70C-cmA.js`).then(({clearSearchExtraToolsDescriptionCache:e})=>e()),import(`./loadAgentsDir-vB1QEZ7H.js`).then(({clearAgentDefinitionsCache:e})=>e()),import(`./prompt-CQC-mh6u.js`).then(({clearPromptCache:e})=>e())}var Nt=e((()=>{c(),we(),Ye(),Ie(),$(),me(),fe(),_e(),Le(),Ae(),Ue(),$e(),He(),je(),ve(),We(),Ze(),te(),ue(),pe()}));export{Dt as a,L as c,wt as i,Nt as n,$ as o,Ot as r,At as s,Mt as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./caches-BUBkfP2Q.js";e();export{t as clearSessionCaches};
@@ -0,0 +1 @@
1
+ function e(e){let t=new AbortController;function n(){t.abort(),t=new AbortController}function r(){let n=new AbortController,r=()=>n.abort();if(e.aborted||t.signal.aborted)return n.abort(),{signal:n.signal,cleanup:()=>{}};e.addEventListener(`abort`,r,{once:!0});let i=t.signal;return i.addEventListener(`abort`,r,{once:!0}),{signal:n.signal,cleanup:()=>{e.removeEventListener(`abort`,r),i.removeEventListener(`abort`,r)}}}return{signal:r,wake:n}}export{e as t};