@unieai/code 0.0.9 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (486) hide show
  1. package/README.en.md +67 -160
  2. package/README.md +53 -146
  3. package/dist/chunks/App-s5ex5j86.js +2 -0
  4. package/dist/chunks/ApproveApiKey-b4z6h2gn.js +2 -0
  5. package/dist/chunks/{assistant-yvtpv5sv.js → AssistantSessionChooser-g1vsya6h.js} +1 -1
  6. package/dist/chunks/BypassPermissionsModeDialog-jbg97eja.js +2 -0
  7. package/dist/chunks/ClaudeInChromeOnboarding-qa0pvwfw.js +2 -0
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog-gqmed78y.js +2 -0
  9. package/dist/chunks/ConsoleOAuthFlow-yh72vs8j.js +2 -0
  10. package/dist/chunks/{DiffDialog-v8smgzpd.js → DiffDialog-t6vvtbb2.js} +1 -1
  11. package/dist/chunks/Doctor-k08ggw2j.js +2 -0
  12. package/dist/chunks/Grove-tkkskg8n.js +2 -0
  13. package/dist/chunks/ITermBackend-73waaahf.js +2 -0
  14. package/dist/chunks/{InProcessTransport-57c2w5v4.js → InProcessTransport-qwjgb17j.js} +1 -1
  15. package/dist/chunks/InvalidConfigDialog-zmqw3fj1.js +2 -0
  16. package/dist/chunks/InvalidSettingsDialog-tnd5hymg.js +2 -0
  17. package/dist/chunks/Onboarding-p0tq6pgz.js +2 -0
  18. package/dist/chunks/REPL-hjjz80kq.js +2 -0
  19. package/dist/chunks/ResumeConversation-krn9hqb1.js +2 -0
  20. package/dist/chunks/{SnapshotUpdateDialog-5yvfnp0q.js → SnapshotUpdateDialog-raq029pd.js} +1 -1
  21. package/dist/chunks/TeleportProgress-vyy2k3bv.js +2 -0
  22. package/dist/chunks/TeleportRepoMismatchDialog-ff0h2cnq.js +2 -0
  23. package/dist/chunks/TeleportResumeWrapper-esjykret.js +2 -0
  24. package/dist/chunks/{TmuxBackend-j665sv6f.js → TmuxBackend-14kmnkcb.js} +1 -1
  25. package/dist/chunks/ToolSearchTool-w4t61c7d.js +2 -0
  26. package/dist/chunks/TrustDialog-7fvaze2x.js +2 -0
  27. package/dist/chunks/TungstenTool-rv96z549.js +2 -0
  28. package/dist/chunks/add-dir-kqw72mky.js +2 -0
  29. package/dist/chunks/agents-3exybgtb.js +4 -0
  30. package/dist/chunks/{agents-e7x38q37.js → agents-z66twpqr.js} +1 -1
  31. package/dist/chunks/ant-claude-for-chrome-mcp-712xg07f.js +2 -0
  32. package/dist/chunks/api-z8svc3xt.js +2 -0
  33. package/dist/chunks/asciicast-vzd7qjbb.js +2 -0
  34. package/dist/chunks/{AssistantSessionChooser-0r5zamt1.js → assistant-ftzr3mjp.js} +1 -1
  35. package/dist/chunks/auth-gbyfq0g2.js +2 -0
  36. package/dist/chunks/auth-wk077awh.js +2 -0
  37. package/dist/chunks/backgroundHousekeeping-m8gthtkh.js +2 -0
  38. package/dist/chunks/branch-1d0b8590.js +5 -0
  39. package/dist/chunks/{bridgePointer-9q6wh2ct.js → bridgePointer-vhd47np6.js} +1 -1
  40. package/dist/chunks/btw-s3r5jhyd.js +2 -0
  41. package/dist/chunks/buddy-xzm5npk8.js +2 -0
  42. package/dist/chunks/{cachedMicrocompact-thnhx1zt.js → cachedMicrocompact-6j3zxr4g.js} +1 -1
  43. package/dist/chunks/caches-fbggdeq7.js +2 -0
  44. package/dist/chunks/chrome-mdyx0s5j.js +2 -0
  45. package/dist/chunks/{chromeNativeHost-nnjkj164.js → chromeNativeHost-8wc6wcr6.js} +1 -1
  46. package/dist/chunks/{claudeDesktop-nsangyk5.js → claudeDesktop-p5bfxmvz.js} +1 -1
  47. package/dist/chunks/{cleanup-mv462dsh.js → cleanup-q46nbce1.js} +1 -1
  48. package/dist/chunks/clear-fwad6zxy.js +2 -0
  49. package/dist/chunks/{cli-sbp2221d.js → cli-0dc8sd37.js} +2 -2
  50. package/dist/chunks/{cli-3xhqacdd.js → cli-0qt9btbe.js} +2 -2
  51. package/dist/chunks/{cli-4j5yyvek.js → cli-0w4wc1z0.js} +2 -2
  52. package/dist/chunks/{cli-r6hm1q63.js → cli-15sqp3mq.js} +2 -2
  53. package/dist/chunks/{cli-45ftgn85.js → cli-15w3eaed.js} +1 -1
  54. package/dist/chunks/{cli-b7wx1479.js → cli-19ncan36.js} +1 -1
  55. package/dist/chunks/{cli-hx28w3cq.js → cli-1jp3rm7n.js} +1 -1
  56. package/dist/chunks/{cli-90b87f45.js → cli-1n8he7s8.js} +2 -2
  57. package/dist/chunks/{cli-bthzmdgv.js → cli-1ny2386w.js} +2 -2
  58. package/dist/chunks/{cli-vq899n8p.js → cli-27mzrnr8.js} +1 -1
  59. package/dist/chunks/{cli-gnjff7md.js → cli-2rw44zfx.js} +2 -2
  60. package/dist/chunks/{cli-7gpep1x5.js → cli-2rwjx3w0.js} +1 -1
  61. package/dist/chunks/{cli-jqppy97b.js → cli-2wd8eaac.js} +2 -2
  62. package/dist/chunks/{cli-3hwpymrd.js → cli-350pymj4.js} +2 -2
  63. package/dist/chunks/{cli-w754xmyv.js → cli-3ac555qw.js} +2 -2
  64. package/dist/chunks/{cli-8kyjh67j.js → cli-3gwqrmcd.js} +1 -1
  65. package/dist/chunks/{cli-msr9n6da.js → cli-3m8n808e.js} +2 -2
  66. package/dist/chunks/{cli-ptv3h2tx.js → cli-42kma5r3.js} +1 -1
  67. package/dist/chunks/{cli-r9p0g894.js → cli-49m97nbg.js} +2 -2
  68. package/dist/chunks/{cli-bkxwwj81.js → cli-4a4bb1kf.js} +1 -1
  69. package/dist/chunks/{cli-3bxtq5dc.js → cli-4ewb3q42.js} +2 -2
  70. package/dist/chunks/{cli-v3mf1g0z.js → cli-4mvvtchx.js} +2 -2
  71. package/dist/chunks/{cli-r2p5bkx5.js → cli-4nejhkd0.js} +2 -2
  72. package/dist/chunks/{cli-dx46fn1w.js → cli-51720d82.js} +2 -2
  73. package/dist/chunks/cli-55jdp9ky.js +3 -0
  74. package/dist/chunks/{cli-6vwdnz9p.js → cli-55ntywtj.js} +1 -1
  75. package/dist/chunks/{cli-pz8vxqw0.js → cli-57yrpnaq.js} +2 -2
  76. package/dist/chunks/{cli-59ysj9y4.js → cli-5dt9yjha.js} +2 -2
  77. package/dist/chunks/{cli-e37w9dxm.js → cli-5f0w3fy6.js} +1 -1
  78. package/dist/chunks/{cli-z9jm4xjn.js → cli-5vsnhp97.js} +2 -2
  79. package/dist/chunks/{cli-x758qvv7.js → cli-61x73ksv.js} +1 -1
  80. package/dist/chunks/{cli-ye3qk73s.js → cli-66jj9zj3.js} +1 -1
  81. package/dist/chunks/{cli-zac1afnb.js → cli-6bxfdgv1.js} +1 -1
  82. package/dist/chunks/{cli-md1h6sbv.js → cli-6pdpyz1a.js} +1 -1
  83. package/dist/chunks/{cli-mejr8b5m.js → cli-6yprtw88.js} +2 -2
  84. package/dist/chunks/{cli-qs0v3mf6.js → cli-73jf8hyz.js} +2 -2
  85. package/dist/chunks/{cli-948we41z.js → cli-749tdaqc.js} +2 -2
  86. package/dist/chunks/{cli-vxxkrd5y.js → cli-764c4bsm.js} +2 -2
  87. package/dist/chunks/cli-78apjp3t.js +3 -0
  88. package/dist/chunks/{cli-k0jpcxwa.js → cli-7c99j0pt.js} +2 -2
  89. package/dist/chunks/{cli-by5b2216.js → cli-89x414pj.js} +2 -2
  90. package/dist/chunks/{cli-fqb71hy3.js → cli-8dmy2s42.js} +1 -1
  91. package/dist/chunks/cli-8hxz2qs6.js +3 -0
  92. package/dist/chunks/cli-8mk2zg4a.js +4 -0
  93. package/dist/chunks/{cli-29gcax34.js → cli-8qd16mt4.js} +2 -2
  94. package/dist/chunks/cli-95wg48h9.js +3 -0
  95. package/dist/chunks/{cli-wz9r5s81.js → cli-99mqr54v.js} +2 -2
  96. package/dist/chunks/{cli-8qk46mt3.js → cli-9aq7vxaq.js} +1 -1
  97. package/dist/chunks/{cli-zcpjf07m.js → cli-9z9r2set.js} +2 -2
  98. package/dist/chunks/{cli-2wvsym16.js → cli-a52ra30v.js} +1 -1
  99. package/dist/chunks/{cli-s6qk3rbv.js → cli-akcxtvv9.js} +2 -2
  100. package/dist/chunks/{cli-h3kcprht.js → cli-bmk0rb5v.js} +2 -2
  101. package/dist/chunks/{cli-pmzht94n.js → cli-br6zjh6x.js} +2 -2
  102. package/dist/chunks/{cli-z8hqtyjg.js → cli-c22wpdk4.js} +1 -1
  103. package/dist/chunks/{cli-zbt28krs.js → cli-c60c9qvm.js} +1 -1
  104. package/dist/chunks/{cli-3357rxva.js → cli-cqkne34j.js} +2 -2
  105. package/dist/chunks/{cli-0s65jzgr.js → cli-cwbxhdt1.js} +1 -1
  106. package/dist/chunks/{cli-xsap3gxj.js → cli-d0hzw78c.js} +1 -1
  107. package/dist/chunks/{cli-0b4dmvvw.js → cli-d53fhs6v.js} +2 -2
  108. package/dist/chunks/{cli-extf4h54.js → cli-dbdqrqmt.js} +1 -1
  109. package/dist/chunks/{cli-yf3sh3aw.js → cli-de1hwp88.js} +1 -1
  110. package/dist/chunks/cli-edkqs0ge.js +3 -0
  111. package/dist/chunks/{cli-dsnjsvqs.js → cli-er7z496e.js} +2 -2
  112. package/dist/chunks/{cli-atpfeg28.js → cli-eyw3czmn.js} +2 -2
  113. package/dist/chunks/{cli-tyxvdf66.js → cli-ezs5sney.js} +2 -2
  114. package/dist/chunks/{cli-tn47e131.js → cli-f63fdj4w.js} +2 -2
  115. package/dist/chunks/cli-fakdskp6.js +3 -0
  116. package/dist/chunks/{cli-nj726gac.js → cli-fdya77ch.js} +3 -3
  117. package/dist/chunks/{cli-b1dptek2.js → cli-fghyxar5.js} +2 -2
  118. package/dist/chunks/{cli-g1spmn9n.js → cli-fm14mg07.js} +1 -1
  119. package/dist/chunks/{cli-cr1hvkmz.js → cli-fs7yttfp.js} +2 -2
  120. package/dist/chunks/{cli-rcvta3zk.js → cli-fwrj8ybs.js} +2 -2
  121. package/dist/chunks/{cli-v77avvvk.js → cli-g4n9das2.js} +1 -1
  122. package/dist/chunks/{cli-cbdrqqf2.js → cli-g5wq5ptg.js} +2 -2
  123. package/dist/chunks/{cli-yrk194b9.js → cli-gq5fve62.js} +1 -1
  124. package/dist/chunks/{cli-nykt265k.js → cli-grxvgq2n.js} +1 -1
  125. package/dist/chunks/{cli-ffjjv4j8.js → cli-gtm212j6.js} +2 -2
  126. package/dist/chunks/{cli-skq9ktf8.js → cli-gxgdnjfn.js} +1 -1
  127. package/dist/chunks/{cli-x5z5m6y7.js → cli-h120wpk2.js} +1 -1
  128. package/dist/chunks/{cli-58t6a5n6.js → cli-h4a90xbh.js} +1 -1
  129. package/dist/chunks/cli-h4dspaac.js +3 -0
  130. package/dist/chunks/{cli-a98b285v.js → cli-hke6r0q8.js} +2 -2
  131. package/dist/chunks/{cli-jxwm52wg.js → cli-hzr2zraz.js} +1 -1
  132. package/dist/chunks/{cli-x4a9geyz.js → cli-j08dmxw5.js} +1 -1
  133. package/dist/chunks/{cli-jvs98a70.js → cli-ja540nr7.js} +1 -1
  134. package/dist/chunks/{cli-dr1ph0pp.js → cli-jegyadmb.js} +2 -2
  135. package/dist/chunks/{cli-xjx11p6m.js → cli-jgn9jprh.js} +2 -2
  136. package/dist/chunks/{cli-n3m134cf.js → cli-jj93qmmc.js} +2 -2
  137. package/dist/chunks/{cli-kje3t5yg.js → cli-jkj867t1.js} +3 -3
  138. package/dist/chunks/{cli-6he3kpeb.js → cli-k2nh5cby.js} +2 -2
  139. package/dist/chunks/{cli-3je4vtx7.js → cli-k4v08k8t.js} +2 -2
  140. package/dist/chunks/{cli-c2pn6csk.js → cli-khs3sj9k.js} +1 -1
  141. package/dist/chunks/{cli-shz2e0q5.js → cli-kq16afrr.js} +2 -2
  142. package/dist/chunks/{cli-2zh6c5xz.js → cli-kqv5b8zh.js} +1 -1
  143. package/dist/chunks/{cli-k8fd74g6.js → cli-m0z3rmf0.js} +2 -2
  144. package/dist/chunks/{cli-a72n4ej7.js → cli-m12smc5e.js} +1 -1
  145. package/dist/chunks/{cli-15zbq52w.js → cli-m8fq163z.js} +1 -1
  146. package/dist/chunks/{cli-1215h20m.js → cli-mb1qrqw1.js} +2 -2
  147. package/dist/chunks/{cli-50wh7ttg.js → cli-mbp8f3f3.js} +2 -2
  148. package/dist/chunks/{cli-5pb6kdxn.js → cli-me4e2p3e.js} +595 -595
  149. package/dist/chunks/{cli-vz1j9n38.js → cli-mj03488e.js} +2 -2
  150. package/dist/chunks/{cli-6dcra6rs.js → cli-ms5j6fff.js} +2 -2
  151. package/dist/chunks/{cli-0v6qg4zv.js → cli-msgx4pnp.js} +2 -2
  152. package/dist/chunks/cli-msmzt4c3.js +130 -0
  153. package/dist/chunks/{cli-h5yfk29j.js → cli-msw0vv86.js} +2 -2
  154. package/dist/chunks/{cli-ewts4g0p.js → cli-mzcsnm06.js} +2 -2
  155. package/dist/chunks/{cli-wr4k6ngg.js → cli-n5s5fnyj.js} +2 -2
  156. package/dist/chunks/{cli-ygq3fy9g.js → cli-ns0aaggm.js} +1 -1
  157. package/dist/chunks/{cli-1a2nss2m.js → cli-nvnj7r73.js} +1 -1
  158. package/dist/chunks/{cli-hpzy0mat.js → cli-p0vh69b9.js} +2 -2
  159. package/dist/chunks/{cli-zf7yzkn6.js → cli-p2cqnrnp.js} +2 -2
  160. package/dist/chunks/{cli-px7jhzgq.js → cli-pbc8sk2d.js} +2 -2
  161. package/dist/chunks/{cli-29078yxj.js → cli-pgg33dhw.js} +2 -2
  162. package/dist/chunks/cli-przq3zk6.js +3 -0
  163. package/dist/chunks/{cli-q9fn82b1.js → cli-q0156x0d.js} +2 -2
  164. package/dist/chunks/{cli-zdy5bccv.js → cli-q46epwyh.js} +1 -1
  165. package/dist/chunks/{cli-v8w48y51.js → cli-qaxvg7gv.js} +1 -1
  166. package/dist/chunks/{cli-ytj910yt.js → cli-qm684n63.js} +1 -1
  167. package/dist/chunks/{cli-2qec7gn4.js → cli-r3etpht1.js} +1 -1
  168. package/dist/chunks/{cli-amy2yafd.js → cli-r83ttew2.js} +2 -2
  169. package/dist/chunks/{cli-22zbzzap.js → cli-r9db9mqv.js} +1 -1
  170. package/dist/chunks/{cli-3q7meftn.js → cli-rjerv816.js} +2 -2
  171. package/dist/chunks/{cli-mx6xk0dw.js → cli-rvad3yhg.js} +2 -2
  172. package/dist/chunks/{cli-wfqsfwa2.js → cli-rxb5q8zw.js} +2 -2
  173. package/dist/chunks/{cli-7cn4gwqc.js → cli-s160fqyz.js} +2 -2
  174. package/dist/chunks/{cli-v2hg35qk.js → cli-s6vr7213.js} +2 -2
  175. package/dist/chunks/{cli-49dqgzsg.js → cli-s9fhtgmz.js} +2 -2
  176. package/dist/chunks/{cli-tezq577c.js → cli-scaqq0v9.js} +2 -2
  177. package/dist/chunks/{cli-15tr7ade.js → cli-sh9w2tbd.js} +1 -1
  178. package/dist/chunks/{cli-zd2e6bq1.js → cli-sycqd3xe.js} +4 -4
  179. package/dist/chunks/{cli-d06qr5p3.js → cli-t4j047cx.js} +2 -2
  180. package/dist/chunks/{cli-s5epnnj5.js → cli-t9jht3kb.js} +2 -2
  181. package/dist/chunks/{cli-bd1ryrzd.js → cli-tckzkegq.js} +1 -1
  182. package/dist/chunks/{cli-p2gt60aj.js → cli-tfv2qcgf.js} +1 -1
  183. package/dist/chunks/{cli-1qszxdan.js → cli-tq5z9qv3.js} +2 -2
  184. package/dist/chunks/{cli-wthnf2t5.js → cli-tt9a4124.js} +1 -1
  185. package/dist/chunks/{cli-8v5ajztt.js → cli-tyqh91zq.js} +1 -1
  186. package/dist/chunks/cli-v943fd6a.js +3 -0
  187. package/dist/chunks/{cli-wn4ywgbv.js → cli-v9f860t5.js} +2 -2
  188. package/dist/chunks/{cli-qc7zfabw.js → cli-vkvmhjha.js} +2 -2
  189. package/dist/chunks/{cli-6b6e5zj9.js → cli-vkzp66cm.js} +2 -2
  190. package/dist/chunks/{cli-6qhwqfwp.js → cli-vwg0v35a.js} +2 -2
  191. package/dist/chunks/{cli-x514vyva.js → cli-w1d8n9g3.js} +1 -1
  192. package/dist/chunks/cli-w52yvzkn.js +3 -0
  193. package/dist/chunks/{cli-et2cj5dc.js → cli-wbe1p8n2.js} +2 -2
  194. package/dist/chunks/{cli-5mdbbvnv.js → cli-wm8qb6j3.js} +1 -1
  195. package/dist/chunks/{cli-1tq57kq0.js → cli-wn2srq2e.js} +1 -1
  196. package/dist/chunks/{cli-088ac95n.js → cli-wt2bfbn0.js} +2 -2
  197. package/dist/chunks/{cli-jmypsed1.js → cli-x70v8rsj.js} +2 -2
  198. package/dist/chunks/{cli-5wh173wa.js → cli-x8xgga1a.js} +3 -3
  199. package/dist/chunks/{cli-2vc9kv40.js → cli-xfsqvp8r.js} +2 -2
  200. package/dist/chunks/{cli-6xmbrh42.js → cli-xmgm2573.js} +2 -2
  201. package/dist/chunks/{cli-d58ptbve.js → cli-xpa1neza.js} +2 -2
  202. package/dist/chunks/{cli-6bxmycm6.js → cli-yqbvprz7.js} +1 -1
  203. package/dist/chunks/{cli-bz32070f.js → cli-yrwenjxs.js} +1 -1
  204. package/dist/chunks/{cli-3p0mfsqg.js → cli-z5e72gsd.js} +1 -1
  205. package/dist/chunks/{cli-z2jpyr57.js → cli-zev50xap.js} +1 -1
  206. package/dist/chunks/{cli-mjz85907.js → cli-zjbzak9n.js} +1 -1
  207. package/dist/chunks/{cli-h2dynmt7.js → cli-zjfya500.js} +1 -1
  208. package/dist/chunks/{cli-60mdvk6q.js → cli-zp8s7q5w.js} +1 -1
  209. package/dist/chunks/{cli-znz72ctn.js → cli-zpcncwrv.js} +1 -1
  210. package/dist/chunks/{cli-ew59cmn3.js → cli-zxdnz6vp.js} +1 -1
  211. package/dist/chunks/client-dkpgx025.js +2 -0
  212. package/dist/chunks/color-zrm6r755.js +2 -0
  213. package/dist/chunks/commitAttribution-3y6pessz.js +2 -0
  214. package/dist/chunks/common-0bee37at.js +2 -0
  215. package/dist/chunks/compact-zmvj1pk0.js +4 -0
  216. package/dist/chunks/config-gj0gbg5g.js +2 -0
  217. package/dist/chunks/config-hbq35b68.js +2 -0
  218. package/dist/chunks/context-h1qc69rg.js +2 -0
  219. package/dist/chunks/context-noninteractive-7wbe6qvd.js +2 -0
  220. package/dist/chunks/conversation-fwnfp0p5.js +2 -0
  221. package/dist/chunks/{copy-bpypgpy8.js → copy-76r9v46d.js} +1 -1
  222. package/dist/chunks/cost-56r5xxqy.js +5 -0
  223. package/dist/chunks/createSession-m5y8fjy4.js +2 -0
  224. package/dist/chunks/desktop-z3jqgnw7.js +2 -0
  225. package/dist/chunks/detectRepository-w6wawmmg.js +2 -0
  226. package/dist/chunks/detection-1yb2c7hh.js +2 -0
  227. package/dist/chunks/{devtools-mt3vnaw3.js → devtools-10ba48t9.js} +1 -1
  228. package/dist/chunks/{diff-bcdc10jv.js → diff-05xxjeqc.js} +1 -1
  229. package/dist/chunks/doctor-hgwjdraj.js +2 -0
  230. package/dist/chunks/earlyInput-navj6cdn.js +2 -0
  231. package/dist/chunks/effort-a190c878.js +9 -0
  232. package/dist/chunks/executor-s42mdmqs.js +2 -0
  233. package/dist/chunks/exit-kyrjy6hb.js +2 -0
  234. package/dist/chunks/export-ct4sty4d.js +3 -0
  235. package/dist/chunks/extra-usage-noninteractive-byts9mme.js +2 -0
  236. package/dist/chunks/extra-usage-xh1mkrca.js +2 -0
  237. package/dist/chunks/fast-g4aa49jf.js +2 -0
  238. package/dist/chunks/feedback-m5r66qd5.js +2 -0
  239. package/dist/chunks/{files-fx3xz1bj.js → files-qrrrkjke.js} +1 -1
  240. package/dist/chunks/firstPartyEventLogger-mthxtmgc.js +2 -0
  241. package/dist/chunks/gates-yhakv4vb.js +2 -0
  242. package/dist/chunks/git-c39vd9dm.js +2 -0
  243. package/dist/chunks/goal-24dr7fwz.js +2 -0
  244. package/dist/chunks/growthbook-f7ag30hy.js +2 -0
  245. package/dist/chunks/heapdump-16gnh3zm.js +7 -0
  246. package/dist/chunks/help-rgcakcxe.js +2 -0
  247. package/dist/chunks/hooks-8dh43zmv.js +2 -0
  248. package/dist/chunks/{hooks-7kspbr6v.js → hooks-c7fqwas5.js} +1 -1
  249. package/dist/chunks/{ide-5bsqkr23.js → ide-q83qr9cn.js} +1 -1
  250. package/dist/chunks/index-v875zpde.js +2 -0
  251. package/dist/chunks/initReplBridge-zfwxgpsm.js +2 -0
  252. package/dist/chunks/ink-vkxsn90v.js +2 -0
  253. package/dist/chunks/{insights-z9edzgf1.js → insights-4fwap4e5.js} +1 -1
  254. package/dist/chunks/install-7nxzmgp5.js +2 -0
  255. package/dist/chunks/{install-github-app-918fh4r2.js → install-github-app-djzea7r4.js} +1 -1
  256. package/dist/chunks/install-slack-app-3rde0k08.js +2 -0
  257. package/dist/chunks/{instrumentation-b8ysw74t.js → instrumentation-223qqr23.js} +1 -1
  258. package/dist/chunks/keybindings-6t5f69wx.js +3 -0
  259. package/dist/chunks/loadAgentsDir-f8shfnw3.js +2 -0
  260. package/dist/chunks/loadPluginHooks-mdwjrjtp.js +2 -0
  261. package/dist/chunks/login-34j3xdr9.js +2 -0
  262. package/dist/chunks/logout-yew8mymc.js +2 -0
  263. package/dist/chunks/{main-sqrzjvg9.js → main-0b8hyp8h.js} +79 -79
  264. package/dist/chunks/mcp-9enw5a8j.js +2 -0
  265. package/dist/chunks/mcp-fn4yrf5y.js +3 -0
  266. package/dist/chunks/{mcp-dqh1vtvf.js → mcp-yymqpmv6.js} +3 -3
  267. package/dist/chunks/mcpServer-60jg9v58.js +2 -0
  268. package/dist/chunks/mcpServer-85gt8ypc.js +2 -0
  269. package/dist/chunks/memory-kam5z1cw.js +4 -0
  270. package/dist/chunks/{mobile-9m41g9bp.js → mobile-7zsgawnb.js} +1 -1
  271. package/dist/chunks/model-03987182.js +2 -0
  272. package/dist/chunks/model-wbxx5kcd.js +3 -0
  273. package/dist/chunks/{oauth-98khjrd8.js → oauth-y0p2y1w5.js} +1 -1
  274. package/dist/chunks/{output-style-1h6b2zf8.js → output-style-x148mzhn.js} +1 -1
  275. package/dist/chunks/parser-4y4b0e6b.js +2 -0
  276. package/dist/chunks/passes-jrmjk5zk.js +2 -0
  277. package/dist/chunks/permissions-karmgb0m.js +4 -0
  278. package/dist/chunks/plan-w0beh9bh.js +2 -0
  279. package/dist/chunks/plugin-6nwptn3s.js +2 -0
  280. package/dist/chunks/pluginStartupCheck-0nzv1ae9.js +2 -0
  281. package/dist/chunks/{plugins-pe89pa7p.js → plugins-vvf897b4.js} +2 -2
  282. package/dist/chunks/{preauthorizedConfig-g0aq6f03.js → preauthorizedConfig-p02f23jb.js} +1 -1
  283. package/dist/chunks/{print-cjjnhg9d.js → print-krwpbp2j.js} +4 -4
  284. package/dist/chunks/privacy-settings-m0mfykh0.js +2 -0
  285. package/dist/chunks/process-26nny2p0.js +2 -0
  286. package/dist/chunks/processBashCommand-8fqgv2ec.js +2 -0
  287. package/dist/chunks/{processSlashCommand-6d8rnm8v.js → processSlashCommand-q32wy80b.js} +1 -1
  288. package/dist/chunks/prompt-gw1e1gef.js +2 -0
  289. package/dist/chunks/prompt-xgw2hxrc.js +2 -0
  290. package/dist/chunks/provider-prompt-s26vatcw.js +2 -0
  291. package/dist/chunks/rate-limit-options-rd4rjfv5.js +2 -0
  292. package/dist/chunks/registry-fp7x9ekd.js +2 -0
  293. package/dist/chunks/release-notes-76y1r2s1.js +6 -0
  294. package/dist/chunks/reload-plugins-z0fepkva.js +3 -0
  295. package/dist/chunks/remote-env-nn9ngr99.js +2 -0
  296. package/dist/chunks/remoteBridgeCore-cg7qd8m4.js +2 -0
  297. package/dist/chunks/rename-fdjzyjar.js +2 -0
  298. package/dist/chunks/resume-4rvj8jbz.js +3 -0
  299. package/dist/chunks/{rewind-cpv2pwfx.js → rewind-r4g5njsg.js} +1 -1
  300. package/dist/chunks/sandbox-adapter-craea9vm.js +2 -0
  301. package/dist/chunks/sandbox-toggle-620bkz9q.js +2 -0
  302. package/dist/chunks/session-5vm1vwv1.js +3 -0
  303. package/dist/chunks/sessionFileAccessHooks-5jbvwabj.js +2 -0
  304. package/dist/chunks/sessionStorage-ffkhmn5q.js +2 -0
  305. package/dist/chunks/settings-s2bcajs6.js +2 -0
  306. package/dist/chunks/setup-fwcttwbm.js +2 -0
  307. package/dist/chunks/setup-pf09nfsj.js +7 -0
  308. package/dist/chunks/{setup-mecsw2ye.js → setup-vegs56f5.js} +1 -1
  309. package/dist/chunks/sinks-wd4ccgbf.js +2 -0
  310. package/dist/chunks/skills-evga8f7n.js +2 -0
  311. package/dist/chunks/startupProfiler-x5zbs2j7.js +2 -0
  312. package/dist/chunks/state-qpmfrvsv.js +2 -0
  313. package/dist/chunks/{stats-3v0r4e1v.js → stats-mgqf6r7c.js} +1 -1
  314. package/dist/chunks/status-78yks3jw.js +2 -0
  315. package/dist/chunks/stickers-bdp8w2gr.js +2 -0
  316. package/dist/chunks/subprocessEnv-s797f06r.js +2 -0
  317. package/dist/chunks/{systemPromptSections-htbs443y.js → systemPromptSections-07y2z2wn.js} +1 -1
  318. package/dist/chunks/tag-gd73kstd.js +12 -0
  319. package/dist/chunks/tasks-63qaca0z.js +2 -0
  320. package/dist/chunks/{teamHelpers-dddedf19.js → teamHelpers-8ykc4bxa.js} +1 -1
  321. package/dist/chunks/teammateModeSnapshot-ae9r29dy.js +2 -0
  322. package/dist/chunks/teleport-es58k4xz.js +2 -0
  323. package/dist/chunks/terminalSetup-gyh5z5e2.js +2 -0
  324. package/dist/chunks/theme-qrhbaht6.js +2 -0
  325. package/dist/chunks/thinkback-5bs7ezv5.js +2 -0
  326. package/dist/chunks/thinkback-play-1dy160y5.js +2 -0
  327. package/dist/chunks/toolSearch-6cv284b7.js +2 -0
  328. package/dist/chunks/trustedDevice-77ketbgg.js +2 -0
  329. package/dist/chunks/{ultrareviewCommand-jtmh2xb1.js → ultrareviewCommand-j23bjbf8.js} +1 -1
  330. package/dist/chunks/{update-mkzzbt54.js → update-w8wdxh3m.js} +1 -1
  331. package/dist/chunks/upgrade-nft7c1yk.js +2 -0
  332. package/dist/chunks/{upstreamproxy-hbbvxzb5.js → upstreamproxy-x405ef9p.js} +1 -1
  333. package/dist/chunks/usage-s5qgc615.js +2 -0
  334. package/dist/chunks/util-1geb93kp.js +2 -0
  335. package/dist/chunks/utils-6sb44pg8.js +2 -0
  336. package/dist/chunks/vim-kq91w44a.js +2 -0
  337. package/dist/chunks/worktree-0af6b1mt.js +2 -0
  338. package/dist/chunks/worktreeModeEnabled-ea6wb7aj.js +2 -0
  339. package/dist/cli.js +1 -1
  340. package/package.json +4 -1
  341. package/preload.ts +1 -1
  342. package/dist/chunks/App-skattzvx.js +0 -2
  343. package/dist/chunks/ApproveApiKey-1zk1g80v.js +0 -2
  344. package/dist/chunks/BypassPermissionsModeDialog-4bd5a65d.js +0 -2
  345. package/dist/chunks/ClaudeInChromeOnboarding-jrj410t2.js +0 -2
  346. package/dist/chunks/ClaudeMdExternalIncludesDialog-2bn5pwwr.js +0 -2
  347. package/dist/chunks/ConsoleOAuthFlow-8hn6958t.js +0 -2
  348. package/dist/chunks/Doctor-w0eqwfzb.js +0 -2
  349. package/dist/chunks/Grove-ygg0z9mr.js +0 -2
  350. package/dist/chunks/ITermBackend-ht0ds6se.js +0 -2
  351. package/dist/chunks/InvalidConfigDialog-h2jkde64.js +0 -2
  352. package/dist/chunks/InvalidSettingsDialog-3p7ehs0t.js +0 -2
  353. package/dist/chunks/Onboarding-np5yfyy1.js +0 -2
  354. package/dist/chunks/REPL-8811fta4.js +0 -2
  355. package/dist/chunks/ResumeConversation-d03pbgnw.js +0 -2
  356. package/dist/chunks/TeleportProgress-ghjbbh9h.js +0 -2
  357. package/dist/chunks/TeleportRepoMismatchDialog-hhcyekar.js +0 -2
  358. package/dist/chunks/TeleportResumeWrapper-66e7dnk5.js +0 -2
  359. package/dist/chunks/ToolSearchTool-dgwhh0gd.js +0 -2
  360. package/dist/chunks/TrustDialog-w9tj4t8r.js +0 -2
  361. package/dist/chunks/TungstenTool-7k2gt6pa.js +0 -2
  362. package/dist/chunks/add-dir-pg1rb88e.js +0 -2
  363. package/dist/chunks/agents-mcbqv3h3.js +0 -4
  364. package/dist/chunks/ant-claude-for-chrome-mcp-c765s2bt.js +0 -2
  365. package/dist/chunks/api-qvdz0vdp.js +0 -2
  366. package/dist/chunks/asciicast-ygqjzj6w.js +0 -2
  367. package/dist/chunks/auth-gkfrn4ga.js +0 -2
  368. package/dist/chunks/auth-y1hqesm6.js +0 -2
  369. package/dist/chunks/backgroundHousekeeping-wk8ne1wg.js +0 -2
  370. package/dist/chunks/branch-yre4hh7s.js +0 -5
  371. package/dist/chunks/btw-091q02sh.js +0 -2
  372. package/dist/chunks/buddy-5xd2vjhm.js +0 -2
  373. package/dist/chunks/caches-g4cc992y.js +0 -2
  374. package/dist/chunks/chrome-rd8crze6.js +0 -2
  375. package/dist/chunks/clear-25jzke5j.js +0 -2
  376. package/dist/chunks/cli-6hvqmebc.js +0 -3
  377. package/dist/chunks/cli-9hskw92e.js +0 -130
  378. package/dist/chunks/cli-avcnnw0n.js +0 -3
  379. package/dist/chunks/cli-e9pafjv1.js +0 -4
  380. package/dist/chunks/cli-gyp5wyzg.js +0 -3
  381. package/dist/chunks/cli-jbbxj53h.js +0 -3
  382. package/dist/chunks/cli-pbp5hza0.js +0 -3
  383. package/dist/chunks/cli-tzaj50bd.js +0 -3
  384. package/dist/chunks/cli-xzsc9n84.js +0 -3
  385. package/dist/chunks/cli-yv1znypb.js +0 -3
  386. package/dist/chunks/client-037bm52v.js +0 -2
  387. package/dist/chunks/color-ceqfke15.js +0 -2
  388. package/dist/chunks/commitAttribution-3ewwca68.js +0 -2
  389. package/dist/chunks/common-jn8w5r1w.js +0 -2
  390. package/dist/chunks/compact-631qpkbp.js +0 -4
  391. package/dist/chunks/config-6em7qq45.js +0 -2
  392. package/dist/chunks/config-h2e5ra49.js +0 -2
  393. package/dist/chunks/context-31c3znwn.js +0 -2
  394. package/dist/chunks/context-noninteractive-q418vz0p.js +0 -2
  395. package/dist/chunks/conversation-yz22h1cb.js +0 -2
  396. package/dist/chunks/cost-8rr9expn.js +0 -5
  397. package/dist/chunks/createSession-jratqxvc.js +0 -2
  398. package/dist/chunks/desktop-zq22ksq3.js +0 -2
  399. package/dist/chunks/detectRepository-djxyq37h.js +0 -2
  400. package/dist/chunks/detection-b18r43da.js +0 -2
  401. package/dist/chunks/doctor-cs43t62h.js +0 -2
  402. package/dist/chunks/earlyInput-361tx72y.js +0 -2
  403. package/dist/chunks/effort-qw83nert.js +0 -9
  404. package/dist/chunks/executor-rvxyyheh.js +0 -2
  405. package/dist/chunks/exit-kynz824m.js +0 -2
  406. package/dist/chunks/export-95j3srp6.js +0 -3
  407. package/dist/chunks/extra-usage-hxyp53v5.js +0 -2
  408. package/dist/chunks/extra-usage-noninteractive-53w28t1j.js +0 -2
  409. package/dist/chunks/fast-ec1hxnv7.js +0 -2
  410. package/dist/chunks/feedback-qtsk3t9f.js +0 -2
  411. package/dist/chunks/firstPartyEventLogger-4yfx731e.js +0 -2
  412. package/dist/chunks/gates-85t459a0.js +0 -2
  413. package/dist/chunks/git-e0mvprv8.js +0 -2
  414. package/dist/chunks/goal-ywc7exvv.js +0 -2
  415. package/dist/chunks/growthbook-ykj8089v.js +0 -2
  416. package/dist/chunks/heapdump-w6a13cfe.js +0 -7
  417. package/dist/chunks/help-enq1htxe.js +0 -2
  418. package/dist/chunks/hooks-wxm384wn.js +0 -2
  419. package/dist/chunks/initReplBridge-acrf7hyb.js +0 -2
  420. package/dist/chunks/ink-9vrw9yhe.js +0 -2
  421. package/dist/chunks/install-c8gv4wfg.js +0 -2
  422. package/dist/chunks/install-slack-app-1aqgxsb6.js +0 -2
  423. package/dist/chunks/keybindings-v92d2xht.js +0 -3
  424. package/dist/chunks/loadAgentsDir-k53rdwbr.js +0 -2
  425. package/dist/chunks/loadPluginHooks-rmzgs29p.js +0 -2
  426. package/dist/chunks/login-j9bz1g34.js +0 -2
  427. package/dist/chunks/logout-58wm6hsc.js +0 -2
  428. package/dist/chunks/mcp-z3j236hk.js +0 -3
  429. package/dist/chunks/mcp-zryxxcaz.js +0 -2
  430. package/dist/chunks/mcpServer-b2m7ewct.js +0 -2
  431. package/dist/chunks/mcpServer-xpq096r4.js +0 -2
  432. package/dist/chunks/memory-5tvqvktk.js +0 -4
  433. package/dist/chunks/model-cta1svwb.js +0 -3
  434. package/dist/chunks/model-d96jkka7.js +0 -2
  435. package/dist/chunks/parser-jpf6bfmz.js +0 -2
  436. package/dist/chunks/passes-reh6ja9j.js +0 -2
  437. package/dist/chunks/permissions-xgydmrq2.js +0 -4
  438. package/dist/chunks/plan-z4k8zj56.js +0 -2
  439. package/dist/chunks/plugin-0tztmcsg.js +0 -2
  440. package/dist/chunks/pluginStartupCheck-vxmkvt40.js +0 -2
  441. package/dist/chunks/privacy-settings-zbrc40a1.js +0 -2
  442. package/dist/chunks/process-msr26xa0.js +0 -2
  443. package/dist/chunks/processBashCommand-hnhy8brr.js +0 -2
  444. package/dist/chunks/prompt-cfaneybz.js +0 -2
  445. package/dist/chunks/prompt-wg6hfj0k.js +0 -2
  446. package/dist/chunks/provider-prompt-c8wew66t.js +0 -2
  447. package/dist/chunks/rate-limit-options-fyjqpxp3.js +0 -2
  448. package/dist/chunks/registry-ht9aazng.js +0 -2
  449. package/dist/chunks/release-notes-5v16zb9c.js +0 -6
  450. package/dist/chunks/reload-plugins-apyma8vs.js +0 -3
  451. package/dist/chunks/remote-env-p6ym55w6.js +0 -2
  452. package/dist/chunks/remoteBridgeCore-0v9x8112.js +0 -2
  453. package/dist/chunks/rename-j9rc9dwj.js +0 -2
  454. package/dist/chunks/resume-tbr3mkch.js +0 -3
  455. package/dist/chunks/sandbox-adapter-qh943bs4.js +0 -2
  456. package/dist/chunks/sandbox-toggle-1f70ejwk.js +0 -2
  457. package/dist/chunks/session-42zhjgd2.js +0 -3
  458. package/dist/chunks/sessionFileAccessHooks-1nh915er.js +0 -2
  459. package/dist/chunks/sessionStorage-j5m0nf55.js +0 -2
  460. package/dist/chunks/settings-c709knqg.js +0 -2
  461. package/dist/chunks/setup-0n2p20yw.js +0 -7
  462. package/dist/chunks/setup-2hqyyxff.js +0 -2
  463. package/dist/chunks/sinks-q6etaenz.js +0 -2
  464. package/dist/chunks/skills-xads3027.js +0 -2
  465. package/dist/chunks/startupProfiler-4wmjq0yd.js +0 -2
  466. package/dist/chunks/state-edaz98bj.js +0 -2
  467. package/dist/chunks/status-9rtty0ee.js +0 -2
  468. package/dist/chunks/stickers-m73qwecp.js +0 -2
  469. package/dist/chunks/subprocessEnv-rass28aq.js +0 -2
  470. package/dist/chunks/tag-vj93fgp6.js +0 -12
  471. package/dist/chunks/tasks-avbqta2s.js +0 -2
  472. package/dist/chunks/teammateModeSnapshot-32yfa4hf.js +0 -2
  473. package/dist/chunks/teleport-jw6w0rn4.js +0 -2
  474. package/dist/chunks/terminalSetup-ppt6v9xf.js +0 -2
  475. package/dist/chunks/theme-2csrfbca.js +0 -2
  476. package/dist/chunks/thinkback-2ahfejyt.js +0 -2
  477. package/dist/chunks/thinkback-play-kffa7rdp.js +0 -2
  478. package/dist/chunks/toolSearch-ptrcr8ec.js +0 -2
  479. package/dist/chunks/trustedDevice-xvtp79f1.js +0 -2
  480. package/dist/chunks/upgrade-c4argpvv.js +0 -2
  481. package/dist/chunks/usage-w30yajzy.js +0 -2
  482. package/dist/chunks/util-zkawe0w0.js +0 -2
  483. package/dist/chunks/utils-v86tf27x.js +0 -2
  484. package/dist/chunks/vim-3stm1kbg.js +0 -2
  485. package/dist/chunks/worktree-pbeayfjp.js +0 -2
  486. package/dist/chunks/worktreeModeEnabled-ysks760x.js +0 -2
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Nh as E,Oh as p,Ph as e,ci as S,gh as h,hh as Oq,hi as qq,ih as n,kh as Uq}from"./cli-5pb6kdxn.js";import{dV as c,fV as d,iV as u,jV as g,oV as Wq}from"./cli-9hskw92e.js";import{B8 as r,w8 as D}from"./cli-3bxtq5dc.js";import{$9 as P,T9 as W,U9 as O,V9 as C,Z9 as _,a_ as v,d_ as f,h_ as M,l_ as y,r_ as V,u_ as t}from"./cli-a98b285v.js";import{bda as N}from"./cli-x514vyva.js";import{homedir as o}from"os";import{resolve as s}from"path";async function kq(Z){let q=Z.trim(),$=M(),Q=q.match(/^([a-zA-Z0-9._-]+@[^:]+:.+?(?:\.git)?)(#(.+))?$/);if(Q?.[1]){let z=Q[1],G=Q[3];return G?{source:"git",url:z,ref:G}:{source:"git",url:z}}if(q.startsWith("http://")||q.startsWith("https://")){let z=q.match(/^([^#]+)(#(.+))?$/),G=z?.[1]||q,X=z?.[3];if(G.endsWith(".git")||G.includes("/_git/"))return X?{source:"git",url:G,ref:X}:{source:"git",url:G};let Y;try{Y=new URL(G)}catch(J){return{source:"url",url:G}}if(Y.hostname==="github.com"||Y.hostname==="www.github.com"){if(Y.pathname.match(/^\/([^/]+\/[^/]+?)(\/|\.git|$)/)?.[1]){let K=G.endsWith(".git")?G:`${G}.git`;return X?{source:"git",url:K,ref:X}:{source:"git",url:K}}}return{source:"url",url:G}}let x=process.platform==="win32"&&(q.startsWith(".\\")||q.startsWith("..\\")||/^[a-zA-Z]:[/\\]/.test(q));if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")||q.startsWith("~")||x){let z=s(q.startsWith("~")?q.replace(/^~/,o()):q),G;try{G=await $.stat(z)}catch(X){let Y=O(X);return{error:Y==="ENOENT"?`Path does not exist: ${z}`:`Cannot access path: ${z} (${Y??X})`}}if(G.isFile())if(z.endsWith(".json"))return{source:"file",path:z};else return{error:`File path must point to a .json file (marketplace.json), but got: ${z}`};else if(G.isDirectory())return{source:"directory",path:z};else return{error:`Path is neither a file nor a directory: ${z}`}}if(q.includes("/")&&!q.startsWith("@")){if(q.includes(":"))return null;let z=q.match(/^([^#@]+)(?:[#@](.+))?$/),G=z?.[1]||q,X=z?.[2];return X?{source:"github",repo:G,ref:X}:{source:"github",repo:G}}return null}var a=N(()=>{_();y()});import Qq from"axios";import{randomBytes as Xq}from"crypto";import{readFile as Zq,rename as $q,unlink as Bq,writeFile as Gq}from"fs/promises";import{join as Yq}from"path";function m(){return Yq(S(),Jq)}async function xq(){let Z=m();try{let q=await Zq(Z,{encoding:"utf-8"}),$=v(q);if(typeof $!=="object"||$===null||!("version"in $)||!("fetchedAt"in $)||!("counts"in $))return V("Install counts cache has invalid structure"),null;let Q=$;if(Q.version!==L)return V(`Install counts cache version mismatch (got ${Q.version}, expected ${L})`),null;if(typeof Q.fetchedAt!=="string"||!Array.isArray(Q.counts))return V("Install counts cache has invalid structure"),null;let B=new Date(Q.fetchedAt).getTime();if(Number.isNaN(B))return V("Install counts cache has invalid fetchedAt timestamp"),null;if(!Q.counts.every((G)=>typeof G==="object"&&G!==null&&typeof G.plugin==="string"&&typeof G.unique_installs==="number"))return V("Install counts cache has malformed entries"),null;if(Date.now()-B>Kq)return V("Install counts cache is stale (>24h old)"),null;return{version:Q.version,fetchedAt:Q.fetchedAt,counts:Q.counts}}catch(q){if(O(q)!=="ENOENT")V(`Failed to load install counts cache: ${W(q)}`);return null}}async function zq(Z){let q=m(),$=`${q}.${Xq(8).toString("hex")}.tmp`;try{let Q=S();await M().mkdir(Q);let B=P(Z,null,2);await Gq($,B,{encoding:"utf-8",mode:384}),await $q($,q),V("Install counts cache saved successfully")}catch(Q){D(Q);try{await Bq($)}catch{}}}async function Hq(){V(`Fetching install counts from ${I}`);let Z=performance.now();try{let q=await Qq.get(I,{timeout:1e4});if(!q.data?.plugins||!Array.isArray(q.data.plugins))throw Error("Invalid response format from install counts API");return E("install_counts",I,"success",performance.now()-Z),q.data.plugins}catch(q){throw E("install_counts",I,"failure",performance.now()-Z,p(q)),q}}async function gq(){let Z=await xq();if(Z){V("Using cached install counts"),E("install_counts",I,"cache_hit",0);let q=new Map;for(let $ of Z.counts)q.set($.plugin,$.unique_installs);return q}try{let q=await Hq(),$={version:L,fetchedAt:new Date().toISOString(),counts:q};await zq($);let Q=new Map;for(let B of q)Q.set(B.plugin,B.unique_installs);return Q}catch(q){return D(q),V(`Failed to fetch install counts: ${W(q)}`),null}}function hq(Z){if(Z<1000)return String(Z);if(Z<1e6){let B=(Z/1000).toFixed(1);return B.endsWith(".0")?`${B.slice(0,-2)}K`:`${B}K`}let $=(Z/1e6).toFixed(1);return $.endsWith(".0")?`${$.slice(0,-2)}M`:`${$}M`}var L=1,Jq="install-counts-cache.json",I="https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json",Kq=86400000;var Vq=N(()=>{t();_();y();r();f();e();qq()});import{readdir as vq,readFile as A,stat as Rq}from"fs/promises";import*as H from"path";import{z as Aq}from"zod/v4";function wq(Z){let q=H.basename(Z),$=H.basename(H.dirname(Z));if(q==="plugin.json")return"plugin";if(q==="marketplace.json")return"marketplace";if($===".claude-plugin")return"plugin";return"unknown"}function F(Z){return Z.issues.map((q)=>({path:q.path.join(".")||"root",message:q.message,code:q.code}))}function w(Z,q,$,Q){if(Z.includes(".."))$.push({path:q,message:Q?`Path contains "..": ${Z}. ${Q}`:`Path contains ".." which could be a path traversal attempt: ${Z}`})}function Mq(Z){let q=Z.replace(/^(\.\.\/)+/,"");return`Plugin source paths are resolved relative to the marketplace root (the directory containing .claude-plugin/), not relative to marketplace.json. Use "${q!==Z?`./${q}`:"./plugins/my-plugin"}" instead of "${Z}".`}async function j(Z){let q=[],$=[],Q=H.resolve(Z),B;try{B=await A(Q,{encoding:"utf-8"})}catch(X){let Y=O(X),J;if(Y==="ENOENT")J=`File not found: ${Q}`;else if(Y==="EISDIR")J=`Path is not a file: ${Q}`;else J=`Failed to read file: ${W(X)}`;return{success:!1,errors:[{path:"file",message:J,code:Y}],warnings:[],filePath:Q,fileType:"plugin"}}let x;try{x=v(B)}catch(X){return{success:!1,errors:[{path:"json",message:`Invalid JSON syntax: ${W(X)}`}],warnings:[],filePath:Q,fileType:"plugin"}}if(x&&typeof x==="object"){let X=x;if(X.commands)(Array.isArray(X.commands)?X.commands:[X.commands]).forEach((J,K)=>{if(typeof J==="string")w(J,`commands[${K}]`,q)});if(X.agents)(Array.isArray(X.agents)?X.agents:[X.agents]).forEach((J,K)=>{if(typeof J==="string")w(J,`agents[${K}]`,q)});if(X.skills)(Array.isArray(X.skills)?X.skills:[X.skills]).forEach((J,K)=>{if(typeof J==="string")w(J,`skills[${K}]`,q)})}let z=x;if(typeof x==="object"&&x!==null){let X=x,Y=Object.keys(X).filter((J)=>Iq.has(J));if(Y.length>0){let J={...X};for(let K of Y)delete J[K],$.push({path:K,message:`Field '${K}' belongs in the marketplace entry (marketplace.json), `+"not plugin.json. It's harmless here but unused \u2014 Claude Code "+"ignores it at load time."});z=J}}let G=d().strict().safeParse(z);if(!G.success)q.push(...F(G.error));if(G.success){let X=G.data;if(!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(X.name))$.push({path:"name",message:`Plugin name "${X.name}" is not kebab-case. Claude Code accepts it, but the Claude.ai marketplace sync requires kebab-case (lowercase letters, digits, and hyphens only, e.g., "my-plugin").`});if(!X.version)$.push({path:"version",message:'No version specified. Consider adding a version following semver (e.g., "1.0.0")'});if(!X.description)$.push({path:"description",message:"No description provided. Adding a description helps users understand what your plugin does"});if(!X.author)$.push({path:"author",message:"No author information provided. Consider adding author details for plugin attribution"})}return{success:q.length===0,errors:q,warnings:$,filePath:Q,fileType:"plugin"}}async function k(Z){let q=[],$=[],Q=H.resolve(Z),B;try{B=await A(Q,{encoding:"utf-8"})}catch(X){let Y=O(X),J;if(Y==="ENOENT")J=`File not found: ${Q}`;else if(Y==="EISDIR")J=`Path is not a file: ${Q}`;else J=`Failed to read file: ${W(X)}`;return{success:!1,errors:[{path:"file",message:J,code:Y}],warnings:[],filePath:Q,fileType:"marketplace"}}let x;try{x=v(B)}catch(X){return{success:!1,errors:[{path:"json",message:`Invalid JSON syntax: ${W(X)}`}],warnings:[],filePath:Q,fileType:"marketplace"}}if(x&&typeof x==="object"){let X=x;if(Array.isArray(X.plugins))X.plugins.forEach((Y,J)=>{if(Y&&typeof Y==="object"&&"source"in Y){let K=Y.source;if(typeof K==="string")w(K,`plugins[${J}].source`,q,Mq(K));if(K&&typeof K==="object"&&"path"in K&&typeof K.path==="string")w(K.path,`plugins[${J}].source.path`,q)}})}let G=g().extend({plugins:Aq.array(u().strict())}).strict().safeParse(x);if(!G.success)q.push(...F(G.error));if(G.success){let X=G.data;if(!X.plugins||X.plugins.length===0)$.push({path:"plugins",message:"Marketplace has no plugins defined"});if(X.plugins){X.plugins.forEach((K,U)=>{if(X.plugins.filter((R)=>R.name===K.name).length>1)q.push({path:`plugins[${U}].name`,message:`Duplicate plugin name "${K.name}" found in marketplace`})});let Y=H.dirname(Q),J=H.basename(Y)===".claude-plugin"?H.dirname(Y):Y;for(let[K,U]of X.plugins.entries()){if(!U.version||typeof U.source!=="string"||!U.source.startsWith("./"))continue;let T=H.join(J,U.source,".claude-plugin","plugin.json"),R;try{let i=await A(T,{encoding:"utf-8"}),b=v(i);if(typeof b.version==="string")R=b.version}catch{continue}if(R&&R!==U.version)$.push({path:`plugins[${K}].version`,message:`Entry declares version "${U.version}" but ${U.source}/.claude-plugin/plugin.json says "${R}". `+"At install time, plugin.json wins (calculatePluginVersion precedence) \u2014 the entry version is silently ignored. "+`Update this entry to "${R}" to match.`})}}if(!X.metadata?.description)$.push({path:"metadata.description",message:"No marketplace description provided. Adding a description helps users understand what this marketplace offers"})}return{success:q.length===0,errors:q,warnings:$,filePath:Q,fileType:"marketplace"}}function Eq(Z,q,$){let Q=[],B=[],x=q.match(n);if(!x)return B.push({path:"frontmatter",message:"No frontmatter block found. Add YAML frontmatter between --- delimiters at the top of the file to set description and other metadata."}),{success:!0,errors:Q,warnings:B,filePath:Z,fileType:$};let z=x[1]||"",G;try{G=h(z)}catch(K){return Q.push({path:"frontmatter",message:`YAML frontmatter failed to parse: ${W(K)}. At runtime this ${$} loads with empty metadata (all frontmatter fields silently dropped).`}),{success:!1,errors:Q,warnings:B,filePath:Z,fileType:$}}if(G===null||typeof G!=="object"||Array.isArray(G))return Q.push({path:"frontmatter",message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(G)?"an array":G===null?"null":typeof G}.`}),{success:!1,errors:Q,warnings:B,filePath:Z,fileType:$};let X=G;if(X.description!==void 0){let K=X.description;if(typeof K!=="string"&&typeof K!=="number"&&typeof K!=="boolean"&&K!==null)Q.push({path:"description",message:`description must be a string, got ${Array.isArray(K)?"array":typeof K}. At runtime this value is dropped.`})}else B.push({path:"description",message:`No description in frontmatter. A description helps users and Claude understand when to use this ${$}.`});if(X.name!==void 0&&X.name!==null&&typeof X.name!=="string")Q.push({path:"name",message:`name must be a string, got ${typeof X.name}.`});let Y=X["allowed-tools"];if(Y!==void 0&&Y!==null){if(typeof Y!=="string"&&!Array.isArray(Y))Q.push({path:"allowed-tools",message:`allowed-tools must be a string or array of strings, got ${typeof Y}.`});else if(Array.isArray(Y)&&Y.some((K)=>typeof K!=="string"))Q.push({path:"allowed-tools",message:"allowed-tools array must contain only strings."})}let J=X.shell;if(J!==void 0&&J!==null)if(typeof J!=="string")Q.push({path:"shell",message:`shell must be a string, got ${typeof J}.`});else{let K=J.trim().toLowerCase();if(K!=="bash"&&K!=="powershell")Q.push({path:"shell",message:`shell must be 'bash' or 'powershell', got '${J}'.`})}return{success:Q.length===0,errors:Q,warnings:B,filePath:Z,fileType:$}}async function Nq(Z){let q;try{q=await A(Z,{encoding:"utf-8"})}catch(B){if(O(B)==="ENOENT")return{success:!0,errors:[],warnings:[],filePath:Z,fileType:"hooks"};return{success:!1,errors:[{path:"file",message:`Failed to read file: ${W(B)}`}],warnings:[],filePath:Z,fileType:"hooks"}}let $;try{$=v(q)}catch(B){return{success:!1,errors:[{path:"json",message:`Invalid JSON syntax: ${W(B)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:Z,fileType:"hooks"}}let Q=c().safeParse($);if(!Q.success)return{success:!1,errors:F(Q.error),warnings:[],filePath:Z,fileType:"hooks"};return{success:!0,errors:[],warnings:[],filePath:Z,fileType:"hooks"}}async function l(Z,q){let $;try{$=await vq(Z,{withFileTypes:!0})}catch(B){let x=O(B);if(x==="ENOENT"||x==="ENOTDIR")return[];throw B}if(q)return $.filter((B)=>B.isDirectory()).map((B)=>H.join(Z,B.name,"SKILL.md"));let Q=[];for(let B of $){let x=H.join(Z,B.name);if(B.isDirectory())Q.push(...await l(x,!1));else if(B.isFile()&&B.name.toLowerCase().endsWith(".md"))Q.push(x)}return Q}async function eq(Z){let q=[],$=[["skill",H.join(Z,"skills")],["agent",H.join(Z,"agents")],["command",H.join(Z,"commands")]];for(let[B,x]of $){let z=await l(x,B==="skill");for(let G of z){let X;try{X=await A(G,{encoding:"utf-8"})}catch(J){if(C(J))continue;q.push({success:!1,errors:[{path:"file",message:`Failed to read: ${W(J)}`}],warnings:[],filePath:G,fileType:B});continue}let Y=Eq(G,X,B);if(Y.errors.length>0||Y.warnings.length>0)q.push(Y)}}let Q=await Nq(H.join(Z,"hooks","hooks.json"));if(Q.errors.length>0||Q.warnings.length>0)q.push(Q);return q}async function qQ(Z){let q=H.resolve(Z),$=null;try{$=await Rq(q)}catch(B){if(!C(B))throw B}if($?.isDirectory()){let B=H.join(q,".claude-plugin","marketplace.json"),x=await k(B);if(x.errors[0]?.code!=="ENOENT")return x;let z=H.join(q,".claude-plugin","plugin.json"),G=await j(z);if(G.errors[0]?.code!=="ENOENT")return G;return{success:!1,errors:[{path:"directory",message:"No manifest found in directory. Expected .claude-plugin/marketplace.json or .claude-plugin/plugin.json"}],warnings:[],filePath:q,fileType:"plugin"}}switch(wq(Z)){case"plugin":return j(Z);case"marketplace":return k(Z);case"unknown":{try{let B=await A(q,{encoding:"utf-8"}),x=v(B);if(Array.isArray(x.plugins))return k(Z)}catch(B){if(O(B)==="ENOENT")return{success:!1,errors:[{path:"file",message:`File not found: ${q}`}],warnings:[],filePath:q,fileType:"plugin"}}return j(Z)}}}var Iq;var _q=N(()=>{_();Uq();f();Oq();Wq();Iq=new Set(["category","source","tags","strict","id"])});
2
+ import{Nh as E,Oh as p,Ph as e,ci as S,gh as h,hh as Oq,hi as qq,ih as n,kh as Uq}from"./cli-me4e2p3e.js";import{gV as c,iV as d,lV as u,mV as g,rV as Wq}from"./cli-msmzt4c3.js";import{E8 as D,J8 as r}from"./cli-4ewb3q42.js";import{X9 as W,Y9 as O,Z9 as C,b_ as _,d_ as P,e_ as v,h_ as f,l_ as M,p_ as y,v_ as V,y_ as t}from"./cli-hke6r0q8.js";import{fda as N}from"./cli-w1d8n9g3.js";import{homedir as o}from"os";import{resolve as s}from"path";async function kq(Z){let q=Z.trim(),$=M(),Q=q.match(/^([a-zA-Z0-9._-]+@[^:]+:.+?(?:\.git)?)(#(.+))?$/);if(Q?.[1]){let z=Q[1],G=Q[3];return G?{source:"git",url:z,ref:G}:{source:"git",url:z}}if(q.startsWith("http://")||q.startsWith("https://")){let z=q.match(/^([^#]+)(#(.+))?$/),G=z?.[1]||q,X=z?.[3];if(G.endsWith(".git")||G.includes("/_git/"))return X?{source:"git",url:G,ref:X}:{source:"git",url:G};let Y;try{Y=new URL(G)}catch(J){return{source:"url",url:G}}if(Y.hostname==="github.com"||Y.hostname==="www.github.com"){if(Y.pathname.match(/^\/([^/]+\/[^/]+?)(\/|\.git|$)/)?.[1]){let K=G.endsWith(".git")?G:`${G}.git`;return X?{source:"git",url:K,ref:X}:{source:"git",url:K}}}return{source:"url",url:G}}let x=process.platform==="win32"&&(q.startsWith(".\\")||q.startsWith("..\\")||/^[a-zA-Z]:[/\\]/.test(q));if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")||q.startsWith("~")||x){let z=s(q.startsWith("~")?q.replace(/^~/,o()):q),G;try{G=await $.stat(z)}catch(X){let Y=O(X);return{error:Y==="ENOENT"?`Path does not exist: ${z}`:`Cannot access path: ${z} (${Y??X})`}}if(G.isFile())if(z.endsWith(".json"))return{source:"file",path:z};else return{error:`File path must point to a .json file (marketplace.json), but got: ${z}`};else if(G.isDirectory())return{source:"directory",path:z};else return{error:`Path is neither a file nor a directory: ${z}`}}if(q.includes("/")&&!q.startsWith("@")){if(q.includes(":"))return null;let z=q.match(/^([^#@]+)(?:[#@](.+))?$/),G=z?.[1]||q,X=z?.[2];return X?{source:"github",repo:G,ref:X}:{source:"github",repo:G}}return null}var a=N(()=>{_();y()});import Qq from"axios";import{randomBytes as Xq}from"crypto";import{readFile as Zq,rename as $q,unlink as Bq,writeFile as Gq}from"fs/promises";import{join as Yq}from"path";function m(){return Yq(S(),Jq)}async function xq(){let Z=m();try{let q=await Zq(Z,{encoding:"utf-8"}),$=v(q);if(typeof $!=="object"||$===null||!("version"in $)||!("fetchedAt"in $)||!("counts"in $))return V("Install counts cache has invalid structure"),null;let Q=$;if(Q.version!==L)return V(`Install counts cache version mismatch (got ${Q.version}, expected ${L})`),null;if(typeof Q.fetchedAt!=="string"||!Array.isArray(Q.counts))return V("Install counts cache has invalid structure"),null;let B=new Date(Q.fetchedAt).getTime();if(Number.isNaN(B))return V("Install counts cache has invalid fetchedAt timestamp"),null;if(!Q.counts.every((G)=>typeof G==="object"&&G!==null&&typeof G.plugin==="string"&&typeof G.unique_installs==="number"))return V("Install counts cache has malformed entries"),null;if(Date.now()-B>Kq)return V("Install counts cache is stale (>24h old)"),null;return{version:Q.version,fetchedAt:Q.fetchedAt,counts:Q.counts}}catch(q){if(O(q)!=="ENOENT")V(`Failed to load install counts cache: ${W(q)}`);return null}}async function zq(Z){let q=m(),$=`${q}.${Xq(8).toString("hex")}.tmp`;try{let Q=S();await M().mkdir(Q);let B=P(Z,null,2);await Gq($,B,{encoding:"utf-8",mode:384}),await $q($,q),V("Install counts cache saved successfully")}catch(Q){D(Q);try{await Bq($)}catch{}}}async function Hq(){V(`Fetching install counts from ${I}`);let Z=performance.now();try{let q=await Qq.get(I,{timeout:1e4});if(!q.data?.plugins||!Array.isArray(q.data.plugins))throw Error("Invalid response format from install counts API");return E("install_counts",I,"success",performance.now()-Z),q.data.plugins}catch(q){throw E("install_counts",I,"failure",performance.now()-Z,p(q)),q}}async function gq(){let Z=await xq();if(Z){V("Using cached install counts"),E("install_counts",I,"cache_hit",0);let q=new Map;for(let $ of Z.counts)q.set($.plugin,$.unique_installs);return q}try{let q=await Hq(),$={version:L,fetchedAt:new Date().toISOString(),counts:q};await zq($);let Q=new Map;for(let B of q)Q.set(B.plugin,B.unique_installs);return Q}catch(q){return D(q),V(`Failed to fetch install counts: ${W(q)}`),null}}function hq(Z){if(Z<1000)return String(Z);if(Z<1e6){let B=(Z/1000).toFixed(1);return B.endsWith(".0")?`${B.slice(0,-2)}K`:`${B}K`}let $=(Z/1e6).toFixed(1);return $.endsWith(".0")?`${$.slice(0,-2)}M`:`${$}M`}var L=1,Jq="install-counts-cache.json",I="https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json",Kq=86400000;var Vq=N(()=>{t();_();y();r();f();e();qq()});import{readdir as vq,readFile as A,stat as Rq}from"fs/promises";import*as H from"path";import{z as Aq}from"zod/v4";function wq(Z){let q=H.basename(Z),$=H.basename(H.dirname(Z));if(q==="plugin.json")return"plugin";if(q==="marketplace.json")return"marketplace";if($===".claude-plugin")return"plugin";return"unknown"}function F(Z){return Z.issues.map((q)=>({path:q.path.join(".")||"root",message:q.message,code:q.code}))}function w(Z,q,$,Q){if(Z.includes(".."))$.push({path:q,message:Q?`Path contains "..": ${Z}. ${Q}`:`Path contains ".." which could be a path traversal attempt: ${Z}`})}function Mq(Z){let q=Z.replace(/^(\.\.\/)+/,"");return`Plugin source paths are resolved relative to the marketplace root (the directory containing .claude-plugin/), not relative to marketplace.json. Use "${q!==Z?`./${q}`:"./plugins/my-plugin"}" instead of "${Z}".`}async function j(Z){let q=[],$=[],Q=H.resolve(Z),B;try{B=await A(Q,{encoding:"utf-8"})}catch(X){let Y=O(X),J;if(Y==="ENOENT")J=`File not found: ${Q}`;else if(Y==="EISDIR")J=`Path is not a file: ${Q}`;else J=`Failed to read file: ${W(X)}`;return{success:!1,errors:[{path:"file",message:J,code:Y}],warnings:[],filePath:Q,fileType:"plugin"}}let x;try{x=v(B)}catch(X){return{success:!1,errors:[{path:"json",message:`Invalid JSON syntax: ${W(X)}`}],warnings:[],filePath:Q,fileType:"plugin"}}if(x&&typeof x==="object"){let X=x;if(X.commands)(Array.isArray(X.commands)?X.commands:[X.commands]).forEach((J,K)=>{if(typeof J==="string")w(J,`commands[${K}]`,q)});if(X.agents)(Array.isArray(X.agents)?X.agents:[X.agents]).forEach((J,K)=>{if(typeof J==="string")w(J,`agents[${K}]`,q)});if(X.skills)(Array.isArray(X.skills)?X.skills:[X.skills]).forEach((J,K)=>{if(typeof J==="string")w(J,`skills[${K}]`,q)})}let z=x;if(typeof x==="object"&&x!==null){let X=x,Y=Object.keys(X).filter((J)=>Iq.has(J));if(Y.length>0){let J={...X};for(let K of Y)delete J[K],$.push({path:K,message:`Field '${K}' belongs in the marketplace entry (marketplace.json), `+"not plugin.json. It's harmless here but unused \u2014 Claude Code "+"ignores it at load time."});z=J}}let G=d().strict().safeParse(z);if(!G.success)q.push(...F(G.error));if(G.success){let X=G.data;if(!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(X.name))$.push({path:"name",message:`Plugin name "${X.name}" is not kebab-case. Claude Code accepts it, but the Claude.ai marketplace sync requires kebab-case (lowercase letters, digits, and hyphens only, e.g., "my-plugin").`});if(!X.version)$.push({path:"version",message:'No version specified. Consider adding a version following semver (e.g., "1.0.0")'});if(!X.description)$.push({path:"description",message:"No description provided. Adding a description helps users understand what your plugin does"});if(!X.author)$.push({path:"author",message:"No author information provided. Consider adding author details for plugin attribution"})}return{success:q.length===0,errors:q,warnings:$,filePath:Q,fileType:"plugin"}}async function k(Z){let q=[],$=[],Q=H.resolve(Z),B;try{B=await A(Q,{encoding:"utf-8"})}catch(X){let Y=O(X),J;if(Y==="ENOENT")J=`File not found: ${Q}`;else if(Y==="EISDIR")J=`Path is not a file: ${Q}`;else J=`Failed to read file: ${W(X)}`;return{success:!1,errors:[{path:"file",message:J,code:Y}],warnings:[],filePath:Q,fileType:"marketplace"}}let x;try{x=v(B)}catch(X){return{success:!1,errors:[{path:"json",message:`Invalid JSON syntax: ${W(X)}`}],warnings:[],filePath:Q,fileType:"marketplace"}}if(x&&typeof x==="object"){let X=x;if(Array.isArray(X.plugins))X.plugins.forEach((Y,J)=>{if(Y&&typeof Y==="object"&&"source"in Y){let K=Y.source;if(typeof K==="string")w(K,`plugins[${J}].source`,q,Mq(K));if(K&&typeof K==="object"&&"path"in K&&typeof K.path==="string")w(K.path,`plugins[${J}].source.path`,q)}})}let G=g().extend({plugins:Aq.array(u().strict())}).strict().safeParse(x);if(!G.success)q.push(...F(G.error));if(G.success){let X=G.data;if(!X.plugins||X.plugins.length===0)$.push({path:"plugins",message:"Marketplace has no plugins defined"});if(X.plugins){X.plugins.forEach((K,U)=>{if(X.plugins.filter((R)=>R.name===K.name).length>1)q.push({path:`plugins[${U}].name`,message:`Duplicate plugin name "${K.name}" found in marketplace`})});let Y=H.dirname(Q),J=H.basename(Y)===".claude-plugin"?H.dirname(Y):Y;for(let[K,U]of X.plugins.entries()){if(!U.version||typeof U.source!=="string"||!U.source.startsWith("./"))continue;let T=H.join(J,U.source,".claude-plugin","plugin.json"),R;try{let i=await A(T,{encoding:"utf-8"}),b=v(i);if(typeof b.version==="string")R=b.version}catch{continue}if(R&&R!==U.version)$.push({path:`plugins[${K}].version`,message:`Entry declares version "${U.version}" but ${U.source}/.claude-plugin/plugin.json says "${R}". `+"At install time, plugin.json wins (calculatePluginVersion precedence) \u2014 the entry version is silently ignored. "+`Update this entry to "${R}" to match.`})}}if(!X.metadata?.description)$.push({path:"metadata.description",message:"No marketplace description provided. Adding a description helps users understand what this marketplace offers"})}return{success:q.length===0,errors:q,warnings:$,filePath:Q,fileType:"marketplace"}}function Eq(Z,q,$){let Q=[],B=[],x=q.match(n);if(!x)return B.push({path:"frontmatter",message:"No frontmatter block found. Add YAML frontmatter between --- delimiters at the top of the file to set description and other metadata."}),{success:!0,errors:Q,warnings:B,filePath:Z,fileType:$};let z=x[1]||"",G;try{G=h(z)}catch(K){return Q.push({path:"frontmatter",message:`YAML frontmatter failed to parse: ${W(K)}. At runtime this ${$} loads with empty metadata (all frontmatter fields silently dropped).`}),{success:!1,errors:Q,warnings:B,filePath:Z,fileType:$}}if(G===null||typeof G!=="object"||Array.isArray(G))return Q.push({path:"frontmatter",message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(G)?"an array":G===null?"null":typeof G}.`}),{success:!1,errors:Q,warnings:B,filePath:Z,fileType:$};let X=G;if(X.description!==void 0){let K=X.description;if(typeof K!=="string"&&typeof K!=="number"&&typeof K!=="boolean"&&K!==null)Q.push({path:"description",message:`description must be a string, got ${Array.isArray(K)?"array":typeof K}. At runtime this value is dropped.`})}else B.push({path:"description",message:`No description in frontmatter. A description helps users and Claude understand when to use this ${$}.`});if(X.name!==void 0&&X.name!==null&&typeof X.name!=="string")Q.push({path:"name",message:`name must be a string, got ${typeof X.name}.`});let Y=X["allowed-tools"];if(Y!==void 0&&Y!==null){if(typeof Y!=="string"&&!Array.isArray(Y))Q.push({path:"allowed-tools",message:`allowed-tools must be a string or array of strings, got ${typeof Y}.`});else if(Array.isArray(Y)&&Y.some((K)=>typeof K!=="string"))Q.push({path:"allowed-tools",message:"allowed-tools array must contain only strings."})}let J=X.shell;if(J!==void 0&&J!==null)if(typeof J!=="string")Q.push({path:"shell",message:`shell must be a string, got ${typeof J}.`});else{let K=J.trim().toLowerCase();if(K!=="bash"&&K!=="powershell")Q.push({path:"shell",message:`shell must be 'bash' or 'powershell', got '${J}'.`})}return{success:Q.length===0,errors:Q,warnings:B,filePath:Z,fileType:$}}async function Nq(Z){let q;try{q=await A(Z,{encoding:"utf-8"})}catch(B){if(O(B)==="ENOENT")return{success:!0,errors:[],warnings:[],filePath:Z,fileType:"hooks"};return{success:!1,errors:[{path:"file",message:`Failed to read file: ${W(B)}`}],warnings:[],filePath:Z,fileType:"hooks"}}let $;try{$=v(q)}catch(B){return{success:!1,errors:[{path:"json",message:`Invalid JSON syntax: ${W(B)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:Z,fileType:"hooks"}}let Q=c().safeParse($);if(!Q.success)return{success:!1,errors:F(Q.error),warnings:[],filePath:Z,fileType:"hooks"};return{success:!0,errors:[],warnings:[],filePath:Z,fileType:"hooks"}}async function l(Z,q){let $;try{$=await vq(Z,{withFileTypes:!0})}catch(B){let x=O(B);if(x==="ENOENT"||x==="ENOTDIR")return[];throw B}if(q)return $.filter((B)=>B.isDirectory()).map((B)=>H.join(Z,B.name,"SKILL.md"));let Q=[];for(let B of $){let x=H.join(Z,B.name);if(B.isDirectory())Q.push(...await l(x,!1));else if(B.isFile()&&B.name.toLowerCase().endsWith(".md"))Q.push(x)}return Q}async function eq(Z){let q=[],$=[["skill",H.join(Z,"skills")],["agent",H.join(Z,"agents")],["command",H.join(Z,"commands")]];for(let[B,x]of $){let z=await l(x,B==="skill");for(let G of z){let X;try{X=await A(G,{encoding:"utf-8"})}catch(J){if(C(J))continue;q.push({success:!1,errors:[{path:"file",message:`Failed to read: ${W(J)}`}],warnings:[],filePath:G,fileType:B});continue}let Y=Eq(G,X,B);if(Y.errors.length>0||Y.warnings.length>0)q.push(Y)}}let Q=await Nq(H.join(Z,"hooks","hooks.json"));if(Q.errors.length>0||Q.warnings.length>0)q.push(Q);return q}async function qQ(Z){let q=H.resolve(Z),$=null;try{$=await Rq(q)}catch(B){if(!C(B))throw B}if($?.isDirectory()){let B=H.join(q,".claude-plugin","marketplace.json"),x=await k(B);if(x.errors[0]?.code!=="ENOENT")return x;let z=H.join(q,".claude-plugin","plugin.json"),G=await j(z);if(G.errors[0]?.code!=="ENOENT")return G;return{success:!1,errors:[{path:"directory",message:"No manifest found in directory. Expected .claude-plugin/marketplace.json or .claude-plugin/plugin.json"}],warnings:[],filePath:q,fileType:"plugin"}}switch(wq(Z)){case"plugin":return j(Z);case"marketplace":return k(Z);case"unknown":{try{let B=await A(q,{encoding:"utf-8"}),x=v(B);if(Array.isArray(x.plugins))return k(Z)}catch(B){if(O(B)==="ENOENT")return{success:!1,errors:[{path:"file",message:`File not found: ${q}`}],warnings:[],filePath:q,fileType:"plugin"}}return j(Z)}}}var Iq;var _q=N(()=>{_();Uq();f();Oq();Wq();Iq=new Set(["category","source","tags","strict","id"])});
3
3
  export{kq as Xc,a as Yc,gq as Zc,hq as _c,Vq as $c,eq as ad,qQ as bd,_q as cd};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Fg as M,Gg as W,gF as O,hF as P,iF as Q,jF as U,mF as X}from"./cli-5pb6kdxn.js";import{bda as V}from"./cli-x514vyva.js";function Y(f){return f==="projectSettings"||f==="policySettings"||f==="command"}function J(f){return O(f)}function L(f,G,q){let v=J(G.source),z=J(q.source),j=G.ruleValue.toolName;if(f==="deny")return`Remove the "${j}" deny rule from ${v}, or remove the specific allow rule from ${z}`;return`Remove the "${j}" ask rule from ${v}, or remove the specific allow rule from ${z}`}function Z(f,G,q){let{toolName:v,ruleContent:z}=f.ruleValue;if(z===void 0)return{shadowed:!1};let j=G.find((E)=>E.ruleValue.toolName===v&&E.ruleValue.ruleContent===void 0);if(!j)return{shadowed:!1};if(v===M&&q.sandboxAutoAllowEnabled){if(!Y(j.source))return{shadowed:!1}}return{shadowed:!0,shadowedBy:j,shadowType:"ask"}}function _(f,G){let{toolName:q,ruleContent:v}=f.ruleValue;if(v===void 0)return{shadowed:!1};let z=G.find((j)=>j.ruleValue.toolName===q&&j.ruleValue.ruleContent===void 0);if(!z)return{shadowed:!1};return{shadowed:!0,shadowedBy:z,shadowType:"deny"}}function F(f,G){let q=[],v=P(f),z=U(f),j=Q(f);for(let E of v){let H=_(E,j);if(H.shadowed){let K=J(H.shadowedBy.source);q.push({rule:E,reason:`Blocked by "${H.shadowedBy.ruleValue.toolName}" deny rule (from ${K})`,shadowedBy:H.shadowedBy,shadowType:"deny",fix:L("deny",H.shadowedBy,E)});continue}let I=Z(E,z,G);if(I.shadowed){let K=J(I.shadowedBy.source);q.push({rule:E,reason:`Shadowed by "${I.shadowedBy.ruleValue.toolName}" ask rule (from ${K})`,shadowedBy:I.shadowedBy,shadowType:"ask",fix:L("ask",I.shadowedBy,E)})}}return q}var $=V(()=>{W();X()});
2
+ import{Fg as M,Gg as W,dF as O,eF as P,fF as Q,gF as U,jF as X}from"./cli-me4e2p3e.js";import{fda as V}from"./cli-w1d8n9g3.js";function Y(f){return f==="projectSettings"||f==="policySettings"||f==="command"}function J(f){return O(f)}function L(f,G,q){let v=J(G.source),z=J(q.source),j=G.ruleValue.toolName;if(f==="deny")return`Remove the "${j}" deny rule from ${v}, or remove the specific allow rule from ${z}`;return`Remove the "${j}" ask rule from ${v}, or remove the specific allow rule from ${z}`}function Z(f,G,q){let{toolName:v,ruleContent:z}=f.ruleValue;if(z===void 0)return{shadowed:!1};let j=G.find((E)=>E.ruleValue.toolName===v&&E.ruleValue.ruleContent===void 0);if(!j)return{shadowed:!1};if(v===M&&q.sandboxAutoAllowEnabled){if(!Y(j.source))return{shadowed:!1}}return{shadowed:!0,shadowedBy:j,shadowType:"ask"}}function _(f,G){let{toolName:q,ruleContent:v}=f.ruleValue;if(v===void 0)return{shadowed:!1};let z=G.find((j)=>j.ruleValue.toolName===q&&j.ruleValue.ruleContent===void 0);if(!z)return{shadowed:!1};return{shadowed:!0,shadowedBy:z,shadowType:"deny"}}function F(f,G){let q=[],v=P(f),z=U(f),j=Q(f);for(let E of v){let H=_(E,j);if(H.shadowed){let K=J(H.shadowedBy.source);q.push({rule:E,reason:`Blocked by "${H.shadowedBy.ruleValue.toolName}" deny rule (from ${K})`,shadowedBy:H.shadowedBy,shadowType:"deny",fix:L("deny",H.shadowedBy,E)});continue}let I=Z(E,z,G);if(I.shadowed){let K=J(I.shadowedBy.source);q.push({rule:E,reason:`Shadowed by "${I.shadowedBy.ruleValue.toolName}" ask rule (from ${K})`,shadowedBy:I.shadowedBy,shadowType:"ask",fix:L("ask",I.shadowedBy,E)})}}return q}var $=V(()=>{W();X()});
3
3
  export{F as ie,$ as je};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{$F as X,aG as n,bG as l,cG as A,dG as o,eG as V,fG as c,jG as u,kG as t}from"./cli-5pb6kdxn.js";import{HO as y,IO as I}from"./cli-s6qk3rbv.js";import{GQ as L,IQ as m,ZQ as S,iR as D,sQ as a,tQ as x}from"./cli-5wh173wa.js";import{bda as N}from"./cli-x514vyva.js";import{useCallback as C,useState as T}from"react";function e(Y){if(Y.ctrl&&(Y.key==="k"||Y.key==="u"||Y.key==="w"))return!0;if(Y.meta&&Y.key==="backspace")return!0;return!1}function s(Y){return(Y.ctrl||Y.meta)&&Y.key==="y"}function P_({isActive:Y,onExit:K,onCancel:j,onExitUp:J,columns:O,passthroughCtrlKeys:w=[],initialQuery:W="",backspaceExitsOnEmpty:k=!0}){let{columns:Z}=y(),R=O??Z,[M,v]=T(W),[f,$]=T(W.length),b=C((_)=>{v(_),$(_.length)},[]),p=(_)=>{if(!Y)return;let z=u.fromText(M,R,f);if(_.ctrl&&w.includes(_.key.toLowerCase()))return;if(!e(_))l();if(!s(_))c();if(_.key==="return"||_.key==="down"){_.preventDefault(),K();return}if(_.key==="up"){if(_.preventDefault(),J)J();return}if(_.key==="escape"){if(_.preventDefault(),j)j();else if(M.length>0)v(""),$(0);else K();return}if(_.key==="backspace"){if(_.preventDefault(),_.meta){let{cursor:P,killed:h}=z.deleteWordBefore();X(h,"prepend"),v(P.text),$(P.offset);return}if(M.length===0){if(k)(j??K)();return}let q=z.backspace();v(q.text),$(q.offset);return}if(_.key==="delete"){_.preventDefault();let q=z.del();v(q.text),$(q.offset);return}if(_.key==="left"&&(_.ctrl||_.meta||_.fn)){_.preventDefault();let q=z.prevWord();$(q.offset);return}if(_.key==="right"&&(_.ctrl||_.meta||_.fn)){_.preventDefault();let q=z.nextWord();$(q.offset);return}if(_.key==="left"){_.preventDefault();let q=z.left();$(q.offset);return}if(_.key==="right"){_.preventDefault();let q=z.right();$(q.offset);return}if(_.key==="home"){_.preventDefault(),$(0);return}if(_.key==="end"){_.preventDefault(),$(M.length);return}if(_.ctrl){switch(_.preventDefault(),_.key.toLowerCase()){case"a":$(0);return;case"e":$(M.length);return;case"b":$(z.left().offset);return;case"f":$(z.right().offset);return;case"d":{if(M.length===0){(j??K)();return}let q=z.del();v(q.text),$(q.offset);return}case"h":{if(M.length===0){if(k)(j??K)();return}let q=z.backspace();v(q.text),$(q.offset);return}case"k":{let{cursor:q,killed:P}=z.deleteToLineEnd();X(P,"append"),v(q.text),$(q.offset);return}case"u":{let{cursor:q,killed:P}=z.deleteToLineStart();X(P,"prepend"),v(q.text),$(q.offset);return}case"w":{let{cursor:q,killed:P}=z.deleteWordBefore();X(P,"prepend"),v(q.text),$(q.offset);return}case"y":{let q=n();if(q.length>0){let P=z.offset,h=z.insert(q);A(P,q.length),v(h.text),$(h.offset)}return}case"g":case"c":if(j){j();return}}return}if(_.meta){switch(_.preventDefault(),_.key.toLowerCase()){case"b":$(z.prevWord().offset);return;case"f":$(z.nextWord().offset);return;case"d":{let q=z.deleteWordAfter();v(q.text),$(q.offset);return}case"y":{let q=o();if(q){let{text:P,start:h,length:G}=q,i=M.slice(0,h),g=M.slice(h+G),r=i+P+g,E=h+P.length;V(P.length),v(r),$(E)}return}}return}if(_.key==="tab")return;if(_.key.length>=1&&!B.has(_.key)){_.preventDefault();let q=z.insert(_.key);v(q.text),$(q.offset)}};return S((_,z,q)=>{p(new a(q.keypress))},{isActive:Y}),{query:M,setQuery:b,cursorOffset:f,handleKeyDown:p}}var B;var F=N(()=>{x();D();t();I();B=new Set(["pageup","pagedown","insert","wheelup","wheeldown","mouse","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12"])});import{c as U}from"react/compiler-runtime";import{jsxDEV as H,Fragment as d}from"react/jsx-dev-runtime";function Y_(Y){let K=U(17),{query:j,placeholder:J,isFocused:O,isTerminalFocused:w,prefix:W,width:k,cursorOffset:Z,borderless:R}=Y,M=J===void 0?"Search\u2026":J,v=W===void 0?"\u2315":W,f=R===void 0?!1:R,$=Z??j.length,b=f?void 0:"round",p=O?"suggestion":void 0,_=!O,z=f?0:1,q=!O,P;if(K[0]!==O||K[1]!==w||K[2]!==$||K[3]!==M||K[4]!==j)P=O?H(d,{children:j?w?H(d,{children:[H(m,{children:j.slice(0,$)},void 0,!1,void 0,this),H(m,{inverse:!0,children:$<j.length?j[$]:" "},void 0,!1,void 0,this),$<j.length&&H(m,{children:j.slice($+1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H(m,{children:j},void 0,!1,void 0,this):w?H(d,{children:[H(m,{inverse:!0,children:M.charAt(0)},void 0,!1,void 0,this),H(m,{dimColor:!0,children:M.slice(1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H(m,{dimColor:!0,children:M},void 0,!1,void 0,this)},void 0,!1,void 0,this):j?H(m,{children:j},void 0,!1,void 0,this):H(m,{children:M},void 0,!1,void 0,this),K[0]=O,K[1]=w,K[2]=$,K[3]=M,K[4]=j,K[5]=P;else P=K[5];let h;if(K[6]!==v||K[7]!==q||K[8]!==P)h=H(m,{dimColor:q,children:[v," ",P]},void 0,!0,void 0,this),K[6]=v,K[7]=q,K[8]=P,K[9]=h;else h=K[9];let G;if(K[10]!==h||K[11]!==b||K[12]!==p||K[13]!==_||K[14]!==z||K[15]!==k)G=H(L,{flexShrink:0,borderStyle:b,borderColor:p,borderDimColor:_,paddingX:z,width:k,children:h},void 0,!1,void 0,this),K[10]=h,K[11]=b,K[12]=p,K[13]=_,K[14]=z,K[15]=k,K[16]=G;else G=K[16];return G}var Q=N(()=>{D()});
2
+ import{$F as A,YF as X,ZF as n,_F as l,aG as o,bG as V,cG as c,gG as u,hG as t}from"./cli-me4e2p3e.js";import{EO as y,FO as I}from"./cli-akcxtvv9.js";import{DQ as L,FQ as m,WQ as S,fR as D,pQ as a,qQ as x}from"./cli-x8xgga1a.js";import{fda as N}from"./cli-w1d8n9g3.js";import{useCallback as C,useState as T}from"react";function e(Y){if(Y.ctrl&&(Y.key==="k"||Y.key==="u"||Y.key==="w"))return!0;if(Y.meta&&Y.key==="backspace")return!0;return!1}function s(Y){return(Y.ctrl||Y.meta)&&Y.key==="y"}function P_({isActive:Y,onExit:K,onCancel:j,onExitUp:J,columns:O,passthroughCtrlKeys:w=[],initialQuery:W="",backspaceExitsOnEmpty:k=!0}){let{columns:Z}=y(),R=O??Z,[M,v]=T(W),[f,$]=T(W.length),b=C((_)=>{v(_),$(_.length)},[]),p=(_)=>{if(!Y)return;let z=u.fromText(M,R,f);if(_.ctrl&&w.includes(_.key.toLowerCase()))return;if(!e(_))l();if(!s(_))c();if(_.key==="return"||_.key==="down"){_.preventDefault(),K();return}if(_.key==="up"){if(_.preventDefault(),J)J();return}if(_.key==="escape"){if(_.preventDefault(),j)j();else if(M.length>0)v(""),$(0);else K();return}if(_.key==="backspace"){if(_.preventDefault(),_.meta){let{cursor:P,killed:h}=z.deleteWordBefore();X(h,"prepend"),v(P.text),$(P.offset);return}if(M.length===0){if(k)(j??K)();return}let q=z.backspace();v(q.text),$(q.offset);return}if(_.key==="delete"){_.preventDefault();let q=z.del();v(q.text),$(q.offset);return}if(_.key==="left"&&(_.ctrl||_.meta||_.fn)){_.preventDefault();let q=z.prevWord();$(q.offset);return}if(_.key==="right"&&(_.ctrl||_.meta||_.fn)){_.preventDefault();let q=z.nextWord();$(q.offset);return}if(_.key==="left"){_.preventDefault();let q=z.left();$(q.offset);return}if(_.key==="right"){_.preventDefault();let q=z.right();$(q.offset);return}if(_.key==="home"){_.preventDefault(),$(0);return}if(_.key==="end"){_.preventDefault(),$(M.length);return}if(_.ctrl){switch(_.preventDefault(),_.key.toLowerCase()){case"a":$(0);return;case"e":$(M.length);return;case"b":$(z.left().offset);return;case"f":$(z.right().offset);return;case"d":{if(M.length===0){(j??K)();return}let q=z.del();v(q.text),$(q.offset);return}case"h":{if(M.length===0){if(k)(j??K)();return}let q=z.backspace();v(q.text),$(q.offset);return}case"k":{let{cursor:q,killed:P}=z.deleteToLineEnd();X(P,"append"),v(q.text),$(q.offset);return}case"u":{let{cursor:q,killed:P}=z.deleteToLineStart();X(P,"prepend"),v(q.text),$(q.offset);return}case"w":{let{cursor:q,killed:P}=z.deleteWordBefore();X(P,"prepend"),v(q.text),$(q.offset);return}case"y":{let q=n();if(q.length>0){let P=z.offset,h=z.insert(q);A(P,q.length),v(h.text),$(h.offset)}return}case"g":case"c":if(j){j();return}}return}if(_.meta){switch(_.preventDefault(),_.key.toLowerCase()){case"b":$(z.prevWord().offset);return;case"f":$(z.nextWord().offset);return;case"d":{let q=z.deleteWordAfter();v(q.text),$(q.offset);return}case"y":{let q=o();if(q){let{text:P,start:h,length:G}=q,i=M.slice(0,h),g=M.slice(h+G),r=i+P+g,E=h+P.length;V(P.length),v(r),$(E)}return}}return}if(_.key==="tab")return;if(_.key.length>=1&&!B.has(_.key)){_.preventDefault();let q=z.insert(_.key);v(q.text),$(q.offset)}};return S((_,z,q)=>{p(new a(q.keypress))},{isActive:Y}),{query:M,setQuery:b,cursorOffset:f,handleKeyDown:p}}var B;var F=N(()=>{x();D();t();I();B=new Set(["pageup","pagedown","insert","wheelup","wheeldown","mouse","f1","f2","f3","f4","f5","f6","f7","f8","f9","f10","f11","f12"])});import{c as U}from"react/compiler-runtime";import{jsxDEV as H,Fragment as d}from"react/jsx-dev-runtime";function Y_(Y){let K=U(17),{query:j,placeholder:J,isFocused:O,isTerminalFocused:w,prefix:W,width:k,cursorOffset:Z,borderless:R}=Y,M=J===void 0?"Search\u2026":J,v=W===void 0?"\u2315":W,f=R===void 0?!1:R,$=Z??j.length,b=f?void 0:"round",p=O?"suggestion":void 0,_=!O,z=f?0:1,q=!O,P;if(K[0]!==O||K[1]!==w||K[2]!==$||K[3]!==M||K[4]!==j)P=O?H(d,{children:j?w?H(d,{children:[H(m,{children:j.slice(0,$)},void 0,!1,void 0,this),H(m,{inverse:!0,children:$<j.length?j[$]:" "},void 0,!1,void 0,this),$<j.length&&H(m,{children:j.slice($+1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H(m,{children:j},void 0,!1,void 0,this):w?H(d,{children:[H(m,{inverse:!0,children:M.charAt(0)},void 0,!1,void 0,this),H(m,{dimColor:!0,children:M.slice(1)},void 0,!1,void 0,this)]},void 0,!0,void 0,this):H(m,{dimColor:!0,children:M},void 0,!1,void 0,this)},void 0,!1,void 0,this):j?H(m,{children:j},void 0,!1,void 0,this):H(m,{children:M},void 0,!1,void 0,this),K[0]=O,K[1]=w,K[2]=$,K[3]=M,K[4]=j,K[5]=P;else P=K[5];let h;if(K[6]!==v||K[7]!==q||K[8]!==P)h=H(m,{dimColor:q,children:[v," ",P]},void 0,!0,void 0,this),K[6]=v,K[7]=q,K[8]=P,K[9]=h;else h=K[9];let G;if(K[10]!==h||K[11]!==b||K[12]!==p||K[13]!==_||K[14]!==z||K[15]!==k)G=H(L,{flexShrink:0,borderStyle:b,borderColor:p,borderDimColor:_,paddingX:z,width:k,children:h},void 0,!1,void 0,this),K[10]=h,K[11]=b,K[12]=p,K[13]=_,K[14]=z,K[15]=k,K[16]=G;else G=K[16];return G}var Q=N(()=>{D()});
3
3
  export{Y_ as cf,Q as df,P_ as ef,F as ff};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Ck as _,Vj as f}from"./cli-me4e2p3e.js";import{F1 as x,H1 as K,NW as T,Q3 as A,_W as W,a3 as k,rU as L}from"./cli-msmzt4c3.js";import{$4 as q,a5 as Q}from"./cli-fakdskp6.js";import{E5 as v}from"./cli-pgg33dhw.js";import{A7 as H,Q6 as w}from"./cli-fdya77ch.js";import{Z8 as B}from"./cli-t9jht3kb.js";import{C9 as U}from"./cli-kq16afrr.js";import{b_ as O}from"./cli-hke6r0q8.js";import{b$ as $,bda as X}from"./cli-3ac555qw.js";import{fda as G}from"./cli-w1d8n9g3.js";import{z as b}from"zod/v4";var V,Z;var J=G(()=>{Q();V=q(()=>b.object({entries:b.record(b.string(),b.string())})),Z=q(()=>b.object({userId:b.string(),version:b.number(),lastModified:b.string(),checksum:b.string(),content:V()}))});import r from"axios";import o from"lodash-es/pickBy.js";var Y=G(()=>{X();U();x();f();A();w();O();H();W();L();T();$();v();K();k();B();_();J()});
3
+ export{Y as tb};
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- import{A_ as FJ,x_ as a}from"./cli-jmypsed1.js";import{B_ as i,E_ as F,O_ as RJ}from"./cli-1qszxdan.js";import{Zca as o,a$ as n}from"./cli-w754xmyv.js";import{bda as B,dda as V,eda as H}from"./cli-x514vyva.js";function y({writeFn:J,flushIntervalMs:K=1000,maxBufferSize:Q=100,maxBufferBytes:X=1/0,immediateMode:Z=!1}){let Y=[],$=0,G=null,U=null;function j(){if(G)clearTimeout(G),G=null}function I(){if(U)J(U.join("")),U=null;if(Y.length===0)return;J(Y.join("")),Y=[],$=0,j()}function N(){if(!G)G=setTimeout(I,K)}function C(){if(U){U.push(...Y),Y=[],$=0,j();return}let W=Y;Y=[],$=0,j(),U=W,setImmediate(()=>{let w=U;if(U=null,w)J(w.join(""))})}return{write(W){if(Z){J(W);return}if(Y.push(W),$+=W.length,N(),Y.length>=Q||$>=X)C()},flush:I,dispose(){I()}}}var v=()=>{};function b(J){return D.add(J),()=>D.delete(J)}async function nJ(){await Promise.all(Array.from(D).map((J)=>J()))}var D;var P=B(()=>{D=new Set});import{APIUserAbortError as qJ}from"@anthropic-ai/sdk";function rJ(J){return J instanceof c||J instanceof qJ||J instanceof Error&&J.name==="AbortError"}function aJ(J,K){return J instanceof Error&&J.message===K}function sJ(J){return J instanceof Error?J:Error(String(J))}function jJ(J){return J instanceof Error?J.message:String(J)}function z(J){if(J&&typeof J==="object"&&"code"in J&&typeof J.code==="string")return J.code;return}function tJ(J){return z(J)==="ENOENT"}function eJ(J){if(J&&typeof J==="object"&&"path"in J&&typeof J.path==="string")return J.path;return}function JK(J){let K=z(J);return K==="ENOENT"||K==="EACCES"||K==="EPERM"||K==="ENOTDIR"||K==="ELOOP"}function KK(J){let K=jJ(J);if(!J||typeof J!=="object"||!("isAxiosError"in J)||!J.isAxiosError)return{kind:"other",message:K};let Q=J,X=Q.response?.status;if(X===401||X===403)return{kind:"auth",status:X,message:K};if(Q.code==="ECONNABORTED")return{kind:"timeout",status:X,message:K};if(Q.code==="ECONNREFUSED"||Q.code==="ENOTFOUND")return{kind:"network",status:X,message:K};return{kind:"http",status:X,message:K}}var GJ,UJ,c,VJ,HJ,_J,NJ;var m=B(()=>{GJ=class GJ extends Error{constructor(J){super(J);this.name=this.constructor.name}};UJ=class UJ extends Error{};c=class c extends Error{constructor(J){super(J);this.name="AbortError"}};VJ=class VJ extends Error{filePath;defaultConfig;constructor(J,K,Q){super(J);this.name="ConfigParseError",this.filePath=K,this.defaultConfig=Q}};HJ=class HJ extends Error{stdout;stderr;code;interrupted;constructor(J,K,Q,X){super("Shell command failed");this.stdout=J;this.stderr=K;this.code=Q;this.interrupted=X;this.name="ShellError"}};_J=class _J extends Error{formattedMessage;constructor(J,K){super(J);this.formattedMessage=K;this.name="TeleportOperationError"}};NJ=class NJ extends Error{telemetryMessage;constructor(J,K){super(J);this.name="TelemetrySafeError",this.telemetryMessage=K??J}}});import IJ from"lodash-es/memoize.js";function AJ(J){let K=[],Q=J.match(/^MCP server ["']([^"']+)["']/);if(Q&&Q[1])K.push("mcp"),K.push(Q[1].toLowerCase());else{let Y=J.match(/^([^:[]+):/);if(Y&&Y[1])K.push(Y[1].trim().toLowerCase())}let X=J.match(/^\[([^\]]+)]/);if(X&&X[1])K.push(X[1].trim().toLowerCase());if(J.toLowerCase().includes("1p event:"))K.push("1p");let Z=J.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(Z&&Z[1]){let Y=Z[1].trim().toLowerCase();if(Y.length<30&&!Y.includes(" "))K.push(Y)}return Array.from(new Set(K))}function WJ(J,K){if(!K)return!0;if(J.length===0)return!1;if(K.isExclusive)return!J.some((Q)=>K.exclude.includes(Q));else return J.some((Q)=>K.include.includes(Q))}function p(J,K){if(!K)return!0;let Q=AJ(J);return WJ(Q,K)}var u;var h=B(()=>{u=IJ((J)=>{if(!J||J.trim()==="")return null;let K=J.split(",").map((Y)=>Y.trim()).filter(Boolean);if(K.length===0)return null;let Q=K.some((Y)=>Y.startsWith("!")),X=K.some((Y)=>!Y.startsWith("!"));if(Q&&X)return null;let Z=K.map((Y)=>Y.replace(/^!/,"").toLowerCase());return{include:Q?[]:Z,exclude:Q?Z:[],isExclusive:Q}})});import*as q from"fs";import{mkdir as CJ,open as M,readdir as BJ,readFile as d,rename as zJ,rmdir as TJ,rm as kJ,stat as MJ,unlink as OJ}from"fs/promises";import{homedir as f}from"os";import*as A from"path";function l(J,K){if(K.startsWith("//")||K.startsWith("\\\\"))return{resolvedPath:K,isSymlink:!1,isCanonical:!1};try{let Q=J.lstatSync(K);if(Q.isFIFO()||Q.isSocket()||Q.isCharacterDevice()||Q.isBlockDevice())return{resolvedPath:K,isSymlink:!1,isCanonical:!1};let X=J.realpathSync(K);return{resolvedPath:X,isSymlink:X!==K,isCanonical:!0}}catch(Q){return{resolvedPath:K,isSymlink:!1,isCanonical:!1}}}function UK(J,K,Q){let{resolvedPath:X}=l(J,K);if(Q.has(X))return!0;return Q.add(X),!1}function xJ(J,K){let Q=K,X=[];while(Q!==A.dirname(Q)){let Z;try{Z=J.lstatSync(Q)}catch{X.unshift(A.basename(Q)),Q=A.dirname(Q);continue}if(Z.isSymbolicLink())try{let Y=J.realpathSync(Q);return X.length===0?Y:A.join(Y,...X)}catch{let Y=J.readlinkSync(Q),$=A.isAbsolute(Y)?Y:A.resolve(A.dirname(Q),Y);return X.length===0?$:A.join($,...X)}try{let Y=J.realpathSync(Q);if(Y!==Q)return X.length===0?Y:A.join(Y,...X)}catch{}return}return}function VK(J){let K=J;if(K==="~")K=f().normalize("NFC");else if(K.startsWith("~/"))K=A.join(f().normalize("NFC"),K.slice(2));let Q=new Set,X=O();if(Q.add(K),K.startsWith("//")||K.startsWith("\\\\"))return Array.from(Q);try{let $=K,G=new Set,U=40;for(let j=0;j<U;j++){if(G.has($))break;if(G.add($),!X.existsSync($)){if($===K){let W=xJ(X,K);if(W!==void 0)Q.add(W)}break}let I=X.lstatSync($);if(I.isFIFO()||I.isSocket()||I.isCharacterDevice()||I.isBlockDevice())break;if(!I.isSymbolicLink())break;let N=X.readlinkSync($),C=A.isAbsolute(N)?N:A.resolve(A.dirname($),N);Q.add(C),$=C}}catch{}let{resolvedPath:Z,isSymlink:Y}=l(X,K);if(Y&&Z!==K)Q.add(Z);return Array.from(Q)}function O(){return EJ}async function HK(J,K,Q){let U=[];try{const X=V(U,await M(J,"r"),1);let Z=(await X.stat()).size;if(Z<=K)return null;let Y=Math.min(Z-K,Q);let $=Buffer.allocUnsafe(Y);let G=0;while(G<Y){let{bytesRead:W}=await X.read($,G,Y-G,K+G);if(W===0)break;G+=W}return{content:$.toString("utf8",0,G),bytesRead:G,bytesTotal:Z}}catch(j){var I=j,N=1}finally{var C=H(U,I,N);C&&await C}}async function _K(J,K){let U=[];try{const Q=V(U,await M(J,"r"),1);let X=(await Q.stat()).size;if(X===0)return{content:"",bytesRead:0,bytesTotal:0};let Z=Math.max(0,X-K);let Y=X-Z;let $=Buffer.allocUnsafe(Y);let G=0;while(G<Y){let{bytesRead:W}=await Q.read($,G,Y-G,Z+G);if(W===0)break;G+=W}return{content:$.toString("utf8",0,G),bytesRead:G,bytesTotal:X}}catch(j){var I=j,N=1}finally{var C=H(U,I,N);C&&await C}}async function*NK(J){let Q=await M(J,"r");try{let Z=(await Q.stat()).size,Y=Buffer.alloc(0),$=Buffer.alloc(4096);while(Z>0){let G=Math.min(4096,Z);Z-=G,await Q.read($,0,G,Z);let U=Buffer.concat([$.subarray(0,G),Y]),j=U.indexOf(10);if(j===-1){Y=U;continue}Y=Buffer.from(U.subarray(0,j));let I=U.toString("utf8",j+1).split(`
2
+ import{B_ as a,E_ as FJ}from"./cli-x70v8rsj.js";import{F_ as i,I_ as F,S_ as RJ}from"./cli-tq5z9qv3.js";import{bda as o,e$ as n}from"./cli-3ac555qw.js";import{fda as B,hda as V,ida as H}from"./cli-w1d8n9g3.js";function y({writeFn:J,flushIntervalMs:K=1000,maxBufferSize:Q=100,maxBufferBytes:X=1/0,immediateMode:Z=!1}){let Y=[],$=0,G=null,U=null;function j(){if(G)clearTimeout(G),G=null}function I(){if(U)J(U.join("")),U=null;if(Y.length===0)return;J(Y.join("")),Y=[],$=0,j()}function N(){if(!G)G=setTimeout(I,K)}function C(){if(U){U.push(...Y),Y=[],$=0,j();return}let W=Y;Y=[],$=0,j(),U=W,setImmediate(()=>{let w=U;if(U=null,w)J(w.join(""))})}return{write(W){if(Z){J(W);return}if(Y.push(W),$+=W.length,N(),Y.length>=Q||$>=X)C()},flush:I,dispose(){I()}}}var v=()=>{};function b(J){return D.add(J),()=>D.delete(J)}async function nJ(){await Promise.all(Array.from(D).map((J)=>J()))}var D;var P=B(()=>{D=new Set});import{APIUserAbortError as qJ}from"@anthropic-ai/sdk";function rJ(J){return J instanceof c||J instanceof qJ||J instanceof Error&&J.name==="AbortError"}function aJ(J,K){return J instanceof Error&&J.message===K}function sJ(J){return J instanceof Error?J:Error(String(J))}function jJ(J){return J instanceof Error?J.message:String(J)}function z(J){if(J&&typeof J==="object"&&"code"in J&&typeof J.code==="string")return J.code;return}function tJ(J){return z(J)==="ENOENT"}function eJ(J){if(J&&typeof J==="object"&&"path"in J&&typeof J.path==="string")return J.path;return}function JK(J){let K=z(J);return K==="ENOENT"||K==="EACCES"||K==="EPERM"||K==="ENOTDIR"||K==="ELOOP"}function KK(J){let K=jJ(J);if(!J||typeof J!=="object"||!("isAxiosError"in J)||!J.isAxiosError)return{kind:"other",message:K};let Q=J,X=Q.response?.status;if(X===401||X===403)return{kind:"auth",status:X,message:K};if(Q.code==="ECONNABORTED")return{kind:"timeout",status:X,message:K};if(Q.code==="ECONNREFUSED"||Q.code==="ENOTFOUND")return{kind:"network",status:X,message:K};return{kind:"http",status:X,message:K}}var GJ,UJ,c,VJ,HJ,_J,NJ;var m=B(()=>{GJ=class GJ extends Error{constructor(J){super(J);this.name=this.constructor.name}};UJ=class UJ extends Error{};c=class c extends Error{constructor(J){super(J);this.name="AbortError"}};VJ=class VJ extends Error{filePath;defaultConfig;constructor(J,K,Q){super(J);this.name="ConfigParseError",this.filePath=K,this.defaultConfig=Q}};HJ=class HJ extends Error{stdout;stderr;code;interrupted;constructor(J,K,Q,X){super("Shell command failed");this.stdout=J;this.stderr=K;this.code=Q;this.interrupted=X;this.name="ShellError"}};_J=class _J extends Error{formattedMessage;constructor(J,K){super(J);this.formattedMessage=K;this.name="TeleportOperationError"}};NJ=class NJ extends Error{telemetryMessage;constructor(J,K){super(J);this.name="TelemetrySafeError",this.telemetryMessage=K??J}}});import IJ from"lodash-es/memoize.js";function AJ(J){let K=[],Q=J.match(/^MCP server ["']([^"']+)["']/);if(Q&&Q[1])K.push("mcp"),K.push(Q[1].toLowerCase());else{let Y=J.match(/^([^:[]+):/);if(Y&&Y[1])K.push(Y[1].trim().toLowerCase())}let X=J.match(/^\[([^\]]+)]/);if(X&&X[1])K.push(X[1].trim().toLowerCase());if(J.toLowerCase().includes("1p event:"))K.push("1p");let Z=J.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(Z&&Z[1]){let Y=Z[1].trim().toLowerCase();if(Y.length<30&&!Y.includes(" "))K.push(Y)}return Array.from(new Set(K))}function WJ(J,K){if(!K)return!0;if(J.length===0)return!1;if(K.isExclusive)return!J.some((Q)=>K.exclude.includes(Q));else return J.some((Q)=>K.include.includes(Q))}function p(J,K){if(!K)return!0;let Q=AJ(J);return WJ(Q,K)}var u;var h=B(()=>{u=IJ((J)=>{if(!J||J.trim()==="")return null;let K=J.split(",").map((Y)=>Y.trim()).filter(Boolean);if(K.length===0)return null;let Q=K.some((Y)=>Y.startsWith("!")),X=K.some((Y)=>!Y.startsWith("!"));if(Q&&X)return null;let Z=K.map((Y)=>Y.replace(/^!/,"").toLowerCase());return{include:Q?[]:Z,exclude:Q?Z:[],isExclusive:Q}})});import*as q from"fs";import{mkdir as CJ,open as M,readdir as BJ,readFile as d,rename as zJ,rmdir as TJ,rm as kJ,stat as MJ,unlink as OJ}from"fs/promises";import{homedir as f}from"os";import*as A from"path";function l(J,K){if(K.startsWith("//")||K.startsWith("\\\\"))return{resolvedPath:K,isSymlink:!1,isCanonical:!1};try{let Q=J.lstatSync(K);if(Q.isFIFO()||Q.isSocket()||Q.isCharacterDevice()||Q.isBlockDevice())return{resolvedPath:K,isSymlink:!1,isCanonical:!1};let X=J.realpathSync(K);return{resolvedPath:X,isSymlink:X!==K,isCanonical:!0}}catch(Q){return{resolvedPath:K,isSymlink:!1,isCanonical:!1}}}function UK(J,K,Q){let{resolvedPath:X}=l(J,K);if(Q.has(X))return!0;return Q.add(X),!1}function xJ(J,K){let Q=K,X=[];while(Q!==A.dirname(Q)){let Z;try{Z=J.lstatSync(Q)}catch{X.unshift(A.basename(Q)),Q=A.dirname(Q);continue}if(Z.isSymbolicLink())try{let Y=J.realpathSync(Q);return X.length===0?Y:A.join(Y,...X)}catch{let Y=J.readlinkSync(Q),$=A.isAbsolute(Y)?Y:A.resolve(A.dirname(Q),Y);return X.length===0?$:A.join($,...X)}try{let Y=J.realpathSync(Q);if(Y!==Q)return X.length===0?Y:A.join(Y,...X)}catch{}return}return}function VK(J){let K=J;if(K==="~")K=f().normalize("NFC");else if(K.startsWith("~/"))K=A.join(f().normalize("NFC"),K.slice(2));let Q=new Set,X=O();if(Q.add(K),K.startsWith("//")||K.startsWith("\\\\"))return Array.from(Q);try{let $=K,G=new Set,U=40;for(let j=0;j<U;j++){if(G.has($))break;if(G.add($),!X.existsSync($)){if($===K){let W=xJ(X,K);if(W!==void 0)Q.add(W)}break}let I=X.lstatSync($);if(I.isFIFO()||I.isSocket()||I.isCharacterDevice()||I.isBlockDevice())break;if(!I.isSymbolicLink())break;let N=X.readlinkSync($),C=A.isAbsolute(N)?N:A.resolve(A.dirname($),N);Q.add(C),$=C}}catch{}let{resolvedPath:Z,isSymlink:Y}=l(X,K);if(Y&&Z!==K)Q.add(Z);return Array.from(Q)}function O(){return EJ}async function HK(J,K,Q){let U=[];try{const X=V(U,await M(J,"r"),1);let Z=(await X.stat()).size;if(Z<=K)return null;let Y=Math.min(Z-K,Q);let $=Buffer.allocUnsafe(Y);let G=0;while(G<Y){let{bytesRead:W}=await X.read($,G,Y-G,K+G);if(W===0)break;G+=W}return{content:$.toString("utf8",0,G),bytesRead:G,bytesTotal:Z}}catch(j){var I=j,N=1}finally{var C=H(U,I,N);C&&await C}}async function _K(J,K){let U=[];try{const Q=V(U,await M(J,"r"),1);let X=(await Q.stat()).size;if(X===0)return{content:"",bytesRead:0,bytesTotal:0};let Z=Math.max(0,X-K);let Y=X-Z;let $=Buffer.allocUnsafe(Y);let G=0;while(G<Y){let{bytesRead:W}=await Q.read($,G,Y-G,Z+G);if(W===0)break;G+=W}return{content:$.toString("utf8",0,G),bytesRead:G,bytesTotal:X}}catch(j){var I=j,N=1}finally{var C=H(U,I,N);C&&await C}}async function*NK(J){let Q=await M(J,"r");try{let Z=(await Q.stat()).size,Y=Buffer.alloc(0),$=Buffer.alloc(4096);while(Z>0){let G=Math.min(4096,Z);Z-=G,await Q.read($,0,G,Z);let U=Buffer.concat([$.subarray(0,G),Y]),j=U.indexOf(10);if(j===-1){Y=U;continue}Y=Buffer.from(U.subarray(0,j));let I=U.toString("utf8",j+1).split(`
3
3
  `);for(let N=I.length-1;N>=0;N--){let C=I[N];if(C)yield C}}if(Y.length>0)yield Y.toString("utf8")}finally{await Q.close()}}var DJ,EJ;var g=B(()=>{m();E();DJ={cwd(){return process.cwd()},existsSync(J){let Q=[];try{const K=V(Q,_`fs.existsSync(${J})`,0);return q.existsSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},async stat(J){return MJ(J)},async readdir(J){return BJ(J,{withFileTypes:!0})},async unlink(J){return OJ(J)},async rmdir(J){return TJ(J)},async rm(J,K){return kJ(J,K)},async mkdir(J,K){try{await CJ(J,{recursive:!0,...K})}catch(Q){if(z(Q)!=="EEXIST")throw Q}},async readFile(J,K){return d(J,{encoding:K.encoding})},async rename(J,K){return zJ(J,K)},statSync(J){let Q=[];try{const K=V(Q,_`fs.statSync(${J})`,0);return q.statSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},lstatSync(J){let Q=[];try{const K=V(Q,_`fs.lstatSync(${J})`,0);return q.lstatSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},readFileSync(J,K){let X=[];try{const Q=V(X,_`fs.readFileSync(${J})`,0);return q.readFileSync(J,{encoding:K.encoding})}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}},readFileBytesSync(J){let Q=[];try{const K=V(Q,_`fs.readFileBytesSync(${J})`,0);return q.readFileSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},readSync(J,K){let Z=[];try{const Q=V(Z,_`fs.readSync(${J}, ${K.length} bytes)`,0);let X=void 0;try{X=q.openSync(J,"r");let U=Buffer.alloc(K.length),j=q.readSync(X,U,0,K.length,0);return{buffer:U,bytesRead:j}}finally{if(X)q.closeSync(X)}}catch(Y){var $=Y,G=1}finally{H(Z,$,G)}},appendFileSync(J,K,Q){let Z=[];try{const X=V(Z,_`fs.appendFileSync(${J}, ${K.length} chars)`,0);if(Q?.mode!==void 0)try{let U=q.openSync(J,"ax",Q.mode);try{q.appendFileSync(U,K)}finally{q.closeSync(U)}return}catch(U){if(z(U)!=="EEXIST")throw U}q.appendFileSync(J,K)}catch(Y){var $=Y,G=1}finally{H(Z,$,G)}},copyFileSync(J,K){let X=[];try{const Q=V(X,_`fs.copyFileSync(${J} \u2192 ${K})`,0);q.copyFileSync(J,K)}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}},unlinkSync(J){let Q=[];try{const K=V(Q,_`fs.unlinkSync(${J})`,0);q.unlinkSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},renameSync(J,K){let X=[];try{const Q=V(X,_`fs.renameSync(${J} \u2192 ${K})`,0);q.renameSync(J,K)}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}},linkSync(J,K){let X=[];try{const Q=V(X,_`fs.linkSync(${J} \u2192 ${K})`,0);q.linkSync(J,K)}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}},symlinkSync(J,K,Q){let Z=[];try{const X=V(Z,_`fs.symlinkSync(${J} \u2192 ${K})`,0);q.symlinkSync(J,K,Q)}catch(Y){var $=Y,G=1}finally{H(Z,$,G)}},readlinkSync(J){let Q=[];try{const K=V(Q,_`fs.readlinkSync(${J})`,0);return q.readlinkSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},realpathSync(J){let Q=[];try{const K=V(Q,_`fs.realpathSync(${J})`,0);return q.realpathSync(J).normalize("NFC")}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},mkdirSync(J,K){let Z=[];try{const Q=V(Z,_`fs.mkdirSync(${J})`,0);let X={recursive:!0};if(K?.mode!==void 0)X.mode=K.mode;try{q.mkdirSync(J,X)}catch(U){if(z(U)!=="EEXIST")throw U}}catch(Y){var $=Y,G=1}finally{H(Z,$,G)}},readdirSync(J){let Q=[];try{const K=V(Q,_`fs.readdirSync(${J})`,0);return q.readdirSync(J,{withFileTypes:!0})}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},readdirStringSync(J){let Q=[];try{const K=V(Q,_`fs.readdirStringSync(${J})`,0);return q.readdirSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},isDirEmptySync(J){let X=[];try{const K=V(X,_`fs.isDirEmptySync(${J})`,0);let Q=this.readdirSync(J);return Q.length===0}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}},rmdirSync(J){let Q=[];try{const K=V(Q,_`fs.rmdirSync(${J})`,0);q.rmdirSync(J)}catch(X){var Z=X,Y=1}finally{H(Q,Z,Y)}},rmSync(J,K){let X=[];try{const Q=V(X,_`fs.rmSync(${J})`,0);q.rmSync(J,K)}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}},createWriteStream(J){return q.createWriteStream(J)},async readFileBytes(J,K){if(K===void 0)return d(J);let Q=await M(J,"r");try{let{size:X}=await Q.stat(),Z=Math.min(X,K),Y=Buffer.allocUnsafe(Z),$=0;while($<Z){let{bytesRead:G}=await Q.read(Y,$,Z-$,$);if(G===0)break;$+=G}return $<Z?Y.subarray(0,$):Y}finally{await Q.close()}}},EJ=DJ});import{appendFile as SJ,mkdir as LJ,symlink as wJ,unlink as yJ}from"fs/promises";import T from"lodash-es/memoize.js";import{dirname as s,join as t}from"path";function EK(){let J=k()||process.env.USER_TYPE==="ant";return e=!0,k.cache.clear?.(),J}function PJ(J){if(process.env.USER_TYPE!=="ant"&&!k())return!1;if(typeof process>"u"||typeof process.versions>"u"||typeof process.versions.node>"u")return!1;let K=bJ();return p(J,K)}function RK(J){L=J}function FK(){return L}async function cJ(J,K,Q,X){if(J)await LJ(K,{recursive:!0}).catch(()=>{});await SJ(Q,X),YJ()}function mJ(){}function uJ(){if(!x){let J=null;x=y({writeFn:(K)=>{let Q=XJ(),X=s(Q),Z=J!==X;if(J=X,k()){if(Z)try{O().mkdirSync(X)}catch{}O().appendFileSync(Q,K),YJ();return}R=R.then(cJ.bind(null,Z,X,Q,K)).catch(mJ)},flushIntervalMs:1000,maxBufferSize:100,immediateMode:k()}),b(async()=>{x?.dispose(),await R})}return x}function QJ(J,{level:K}={level:"debug"}){if(S[K]<S[vJ()])return;if(!PJ(J))return;if(L&&J.includes(`
4
4
  `))J=r(J);let X=`${new Date().toISOString()} [${K.toUpperCase()}] ${J.trim()}
5
5
  `;if(JJ()){a(X);return}uJ().write(X)}function XJ(){return KJ()??process.env.CLAUDE_CODE_DEBUG_LOGS_DIR??t(i(),"debug",`${n()}.txt`)}function SK(J,K){if(process.env.USER_TYPE!=="ant")return;if(K instanceof Error&&K.stack)QJ(`[ANT-ONLY] ${J} stack trace:
6
6
  ${K.stack}`,{level:"error"})}var S,vJ,e=!1,k,bJ,JJ,KJ,L=!1,x=null,R,YJ;var ZJ=B(()=>{o();v();P();h();RJ();g();FJ();E();S={verbose:0,debug:1,info:2,warn:3,error:4},vJ=T(()=>{let J=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();if(J&&Object.hasOwn(S,J))return J;return"debug"}),k=T(()=>{return e||F(process.env.DEBUG)||F(process.env.DEBUG_SDK)||process.argv.includes("--debug")||process.argv.includes("-d")||JJ()||process.argv.some((J)=>J.startsWith("--debug="))||KJ()!==null});bJ=T(()=>{let J=process.argv.find((Q)=>Q.startsWith("--debug="));if(!J)return null;let K=J.substring(8);return u(K)}),JJ=T(()=>{return process.argv.includes("--debug-to-stderr")||process.argv.includes("-d2e")}),KJ=T(()=>{for(let J=0;J<process.argv.length;J++){let K=process.argv[J];if(K.startsWith("--debug-file="))return K.substring(13);if(K==="--debug-file"&&J+1<process.argv.length)return process.argv[J+1]}return null});R=Promise.resolve();YJ=T(async()=>{try{let J=XJ(),K=s(J),Q=t(K,"latest");await yJ(Q).catch(()=>{}),await wJ(J,Q)}catch{}})});import{closeSync as pJ,writeFileSync as $J,fsyncSync as hJ,openSync as dJ}from"fs";import PK from"lodash-es/cloneDeep.js";function lJ(){return fJ}function r(J,K,Q){let Z=[];try{const X=V(Z,_`JSON.stringify(${J})`,0);return JSON.stringify(J,K,Q)}catch(Y){var $=Y,G=1}finally{H(Z,$,G)}}function hK(J,K){let X=[];try{const Q=V(X,_`structuredClone(${J})`,0);return structuredClone(J,K)}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}}function dK(J,K,Q){let Y=[];try{const X=V(Y,_`fs.writeFileSync(${J}, ${K})`,0);let Z=Q!==null&&typeof Q==="object"&&"flush"in Q&&Q.flush===!0;if(Z){let j=typeof Q==="object"&&"encoding"in Q?Q.encoding:void 0,I=typeof Q==="object"&&"mode"in Q?Q.mode:void 0,N;try{N=dJ(J,"w",I),$J(N,K,{encoding:j??void 0}),hJ(N)}finally{if(N!==void 0)pJ(N)}}else $J(J,K,Q)}catch($){var G=$,U=1}finally{H(Y,G,U)}}var uK,fJ,_,pK=(J,K)=>{let X=[];try{const Q=V(X,_`JSON.parse(${J})`,0);return typeof K>"u"?JSON.parse(J):JSON.parse(J,K)}catch(Z){var Y=Z,$=1}finally{H(X,Y,$)}};var E=B(()=>{o();ZJ();uK=(()=>{let J=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(J!==void 0){let K=Number(J);if(!Number.isNaN(K)&&K>=0)return K}return 20})(),fJ={[Symbol.dispose](){}};_=lJ});
7
- export{y as E9,v as F9,b as G9,nJ as H9,P as I9,GJ as J9,UJ as K9,c as L9,rJ as M9,VJ as N9,HJ as O9,_J as P9,NJ as Q9,aJ as R9,sJ as S9,jJ as T9,z as U9,tJ as V9,eJ as W9,JK as X9,KK as Y9,m as Z9,_ as _9,r as $9,pK as a_,hK as b_,dK as c_,E as d_,l as e_,UK as f_,VK as g_,O as h_,HK as i_,_K as j_,NK as k_,g as l_,k as m_,EK as n_,JJ as o_,RK as p_,FK as q_,QJ as r_,XJ as s_,SK as t_,ZJ as u_};
7
+ export{y as I9,v as J9,b as K9,nJ as L9,P as M9,GJ as N9,UJ as O9,c as P9,rJ as Q9,VJ as R9,HJ as S9,_J as T9,NJ as U9,aJ as V9,sJ as W9,jJ as X9,z as Y9,tJ as Z9,eJ as _9,JK as $9,KK as a_,m as b_,_ as c_,r as d_,pK as e_,hK as f_,dK as g_,E as h_,l as i_,UK as j_,VK as k_,O as l_,HK as m_,_K as n_,NK as o_,g as p_,k as q_,EK as r_,JJ as s_,RK as t_,FK as u_,QJ as v_,XJ as w_,SK as x_,ZJ as y_};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Dd as w,Ed as _,Fd as D,Gd as L,Hd as A,Id as h,Jd as O}from"./cli-zdy5bccv.js";import{Ch as Q,Cv as R,DD as W,ED as I,Fh as S,Fv as j,Hv as C,Mq as V,Nq as b}from"./cli-5pb6kdxn.js";import{B8 as N,w8 as U}from"./cli-3bxtq5dc.js";import{U8 as K,V8 as v}from"./cli-s5epnnj5.js";import{T9 as B,Z9 as F}from"./cli-a98b285v.js";import{A_ as M,w_ as x}from"./cli-jmypsed1.js";F();b();N();I();S();M();C();v();O();import X from"figures";function Z(z,J,q){U(z);let G=q?`${J} plugin "${q}"`:J==="disable-all"?"disable all plugins":`${J} plugins`;console.error(`${X.cross} Failed to ${G}: ${B(z)}`);let H=q?(()=>{let{name:Y,marketplace:$}=Q(q);return{_PROTO_plugin_name:Y,...$&&{_PROTO_marketplace_name:$},...R(Y,$,W())}})():{};K("tengu_plugin_command_failed",{command:J,error_category:j(z),...H}),process.exit(1)}async function p(z,J="user"){try{console.log(`Installing plugin "${z}"...`);let q=await w(z,J);if(!q.success)throw Error(q.message);console.log(`${X.tick} ${q.message}`);let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_installed_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},scope:q.scope||J,install_source:"cli-explicit",...R(G,H,W())}),process.exit(0)}catch(q){Z(q,"install",z)}}async function g(z,J="user",q=!1){try{let G=await _(z,J,!q);if(!G.success)throw Error(G.message);console.log(`${X.tick} ${G.message}`);let{name:H,marketplace:Y}=Q(G.pluginId||z);K("tengu_plugin_uninstalled_cli",{_PROTO_plugin_name:H,...Y&&{_PROTO_marketplace_name:Y},scope:G.scope||J,...R(H,Y,W())}),process.exit(0)}catch(G){Z(G,"uninstall",z)}}async function a(z,J){try{let q=await D(z,J);if(!q.success)throw Error(q.message);console.log(`${X.tick} ${q.message}`);let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_enabled_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},scope:q.scope,...R(G,H,W())}),process.exit(0)}catch(q){Z(q,"enable",z)}}async function i(z,J){try{let q=await L(z,J);if(!q.success)throw Error(q.message);console.log(`${X.tick} ${q.message}`);let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_disabled_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},scope:q.scope,...R(G,H,W())}),process.exit(0)}catch(q){Z(q,"disable",z)}}async function u(){try{let z=await A();if(!z.success)throw Error(z.message);console.log(`${X.tick} ${z.message}`),K("tengu_plugin_disabled_all_cli",{}),process.exit(0)}catch(z){Z(z,"disable-all")}}async function n(z,J){try{x(`Checking for updates for plugin "${z}" at ${J} scope\u2026
2
+ import{Dd as w,Ed as _,Fd as D,Gd as L,Hd as A,Id as h,Jd as O}from"./cli-q46epwyh.js";import{AD as W,BD as I,Ch as Q,Cv as j,Ev as C,Fh as S,Mq as V,Nq as b,zv as R}from"./cli-me4e2p3e.js";import{E8 as U,J8 as N}from"./cli-4ewb3q42.js";import{Y8 as K,Z8 as v}from"./cli-t9jht3kb.js";import{X9 as B,b_ as F}from"./cli-hke6r0q8.js";import{A_ as x,E_ as M}from"./cli-x70v8rsj.js";F();b();N();I();S();M();C();v();O();import X from"figures";function Z(z,J,q){U(z);let G=q?`${J} plugin "${q}"`:J==="disable-all"?"disable all plugins":`${J} plugins`;console.error(`${X.cross} Failed to ${G}: ${B(z)}`);let H=q?(()=>{let{name:Y,marketplace:$}=Q(q);return{_PROTO_plugin_name:Y,...$&&{_PROTO_marketplace_name:$},...R(Y,$,W())}})():{};K("tengu_plugin_command_failed",{command:J,error_category:j(z),...H}),process.exit(1)}async function p(z,J="user"){try{console.log(`Installing plugin "${z}"...`);let q=await w(z,J);if(!q.success)throw Error(q.message);console.log(`${X.tick} ${q.message}`);let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_installed_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},scope:q.scope||J,install_source:"cli-explicit",...R(G,H,W())}),process.exit(0)}catch(q){Z(q,"install",z)}}async function g(z,J="user",q=!1){try{let G=await _(z,J,!q);if(!G.success)throw Error(G.message);console.log(`${X.tick} ${G.message}`);let{name:H,marketplace:Y}=Q(G.pluginId||z);K("tengu_plugin_uninstalled_cli",{_PROTO_plugin_name:H,...Y&&{_PROTO_marketplace_name:Y},scope:G.scope||J,...R(H,Y,W())}),process.exit(0)}catch(G){Z(G,"uninstall",z)}}async function a(z,J){try{let q=await D(z,J);if(!q.success)throw Error(q.message);console.log(`${X.tick} ${q.message}`);let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_enabled_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},scope:q.scope,...R(G,H,W())}),process.exit(0)}catch(q){Z(q,"enable",z)}}async function i(z,J){try{let q=await L(z,J);if(!q.success)throw Error(q.message);console.log(`${X.tick} ${q.message}`);let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_disabled_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},scope:q.scope,...R(G,H,W())}),process.exit(0)}catch(q){Z(q,"disable",z)}}async function u(){try{let z=await A();if(!z.success)throw Error(z.message);console.log(`${X.tick} ${z.message}`),K("tengu_plugin_disabled_all_cli",{}),process.exit(0)}catch(z){Z(z,"disable-all")}}async function n(z,J){try{x(`Checking for updates for plugin "${z}" at ${J} scope\u2026
3
3
  `);let q=await h(z,J);if(!q.success)throw Error(q.message);if(x(`${X.tick} ${q.message}
4
4
  `),!q.alreadyUpToDate){let{name:G,marketplace:H}=Q(q.pluginId||z);K("tengu_plugin_updated_cli",{_PROTO_plugin_name:G,...H&&{_PROTO_marketplace_name:H},old_version:q.oldVersion||"unknown",new_version:q.newVersion||"unknown",...R(G,H,W())})}await V(0)}catch(q){Z(q,"update",z)}}
5
5
  export{p as a,g as b,a as c,i as d,u as e,n as f};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{IQ as e,iR as o}from"./cli-5wh173wa.js";import{bda as M}from"./cli-x514vyva.js";import{c as A}from"react/compiler-runtime";import q from"figures";import{jsxDEV as n}from"react/jsx-dev-runtime";function H(k){let _=A(5),{status:v,withSpace:P}=k,w=P===void 0?!1:P,$=h[v],K=!$.color,f=w&&" ",r;if(_[0]!==$.color||_[1]!==$.icon||_[2]!==K||_[3]!==f)r=n(e,{color:$.color,dimColor:K,children:[$.icon,f]},void 0,!0,void 0,this),_[0]=$.color,_[1]=$.icon,_[2]=K,_[3]=f,_[4]=r;else r=_[4];return r}var h;var p=M(()=>{o();h={success:{icon:q.tick,color:"success"},error:{icon:q.cross,color:"error"},warning:{icon:q.warning,color:"warning"},info:{icon:q.info,color:"suggestion"},pending:{icon:q.circle,color:void 0},loading:{icon:"\u2026",color:void 0}}});
2
+ import{FQ as e,fR as o}from"./cli-x8xgga1a.js";import{fda as M}from"./cli-w1d8n9g3.js";import{c as A}from"react/compiler-runtime";import q from"figures";import{jsxDEV as n}from"react/jsx-dev-runtime";function H(k){let _=A(5),{status:v,withSpace:P}=k,w=P===void 0?!1:P,$=h[v],K=!$.color,f=w&&" ",r;if(_[0]!==$.color||_[1]!==$.icon||_[2]!==K||_[3]!==f)r=n(e,{color:$.color,dimColor:K,children:[$.icon,f]},void 0,!0,void 0,this),_[0]=$.color,_[1]=$.icon,_[2]=K,_[3]=f,_[4]=r;else r=_[4];return r}var h;var p=M(()=>{o();h={success:{icon:q.tick,color:"success"},error:{icon:q.cross,color:"error"},warning:{icon:q.warning,color:"warning"},info:{icon:q.info,color:"suggestion"},pending:{icon:q.circle,color:void 0},loading:{icon:"\u2026",color:void 0}}});
3
3
  export{H as lf,p as mf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{qS as Z,rS as P}from"./cli-rcvta3zk.js";import{M2 as U,N2 as H,P2 as V,S2 as X,W2 as L,g3 as x,q3 as O}from"./cli-9hskw92e.js";import{S8 as J,T8 as Q,V8 as B}from"./cli-s5epnnj5.js";import{bda as y}from"./cli-x514vyva.js";function W(){if(U("datadog"))return!1;if(w!==void 0)return w;try{return x($)}catch{return!1}}function K(f,j){let q=V(f);if(q===0)return;let z=q!==null?{...j,sample_rate:q}:j;if(W())Z(f,J(z));X(f,z)}function Y(f,j){return K(f,j),Promise.resolve()}function k(){w=x($)}function r(){Q({logEvent:K,logEventAsync:Y})}var $="tengu_log_datadog_events",w=void 0;var b=y(()=>{P();L();O();B();H()});
2
+ import{xS as Z,yS as P}from"./cli-fwrj8ybs.js";import{C2 as X,G2 as L,S2 as x,a3 as O,w2 as U,x2 as H,z2 as V}from"./cli-msmzt4c3.js";import{W8 as J,X8 as Q,Z8 as B}from"./cli-t9jht3kb.js";import{fda as y}from"./cli-w1d8n9g3.js";function W(){if(U("datadog"))return!1;if(w!==void 0)return w;try{return x($)}catch{return!1}}function K(f,j){let q=V(f);if(q===0)return;let z=q!==null?{...j,sample_rate:q}:j;if(W())Z(f,J(z));X(f,z)}function Y(f,j){return K(f,j),Promise.resolve()}function k(){w=x($)}function r(){Q({logEvent:K,logEventAsync:Y})}var $="tengu_log_datadog_events",w=void 0;var b=y(()=>{P();L();O();B();H()});
3
3
  export{k as yg,r as zg,b as Ag};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{C2 as CK,L2 as qQ,V1 as aK,Y3 as XK,e3 as xK,e4 as tK,q3 as bK,r2 as n,s2 as eK,z1 as zK}from"./cli-9hskw92e.js";import{G4 as UK,I4 as OK,J4 as DK,T4 as YQ}from"./cli-v2hg35qk.js";import{C8 as LK,F8 as JQ}from"./cli-6xmbrh42.js";import{$9 as x,I9 as GQ,Z9 as ZQ,a_ as TK,d_ as WK,r_ as p,u_ as HK}from"./cli-a98b285v.js";import{E_ as k,O_ as I}from"./cli-1qszxdan.js";import{Jaa as qK,Paa as AK,Xca as VK,Zca as g,a$ as S}from"./cli-w754xmyv.js";import{bda as C}from"./cli-x514vyva.js";function sK(Q){let K=BigInt(58),$=Array(22).fill("1"),G=21,Z=Q;while(Z>0n){let J=Number(Z%K);$[G]="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"[J],Z=Z/K,G--}return $.join("")}function nK(Q){let K=Q.replace(/-/g,"");if(K.length!==32)throw Error(`Invalid UUID hex length: ${K.length}`);return BigInt("0x"+K)}function JK(Q,K){let $=nK(K);return`${Q}_01${sK($)}`}var YK=()=>{};function s(Q){let K=KQ[Q],$=process.env[Q];if($===void 0)return K;return k($)}function i(){let Q=XK(),K=S(),$={"user.id":Q};if(s("OTEL_METRICS_INCLUDE_SESSION_ID"))$["session.id"]=K;if(s("OTEL_METRICS_INCLUDE_VERSION"))$["app.version"]=MACRO.VERSION;let G=zK();if(G){let{organizationUuid:Z,emailAddress:J,accountUuid:Y}=G;if(Z)$["organization.id"]=Z;if(J)$["user.email"]=J;if(Y&&s("OTEL_METRICS_INCLUDE_ACCOUNT_UUID"))$["user.account_uuid"]=Y,$["user.account_id"]=process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID||JK("user",Y)}if(n.terminal)$["terminal.type"]=n.terminal;return $}var KQ;var a=C(()=>{g();aK();tK();eK();I();YK();KQ={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}});function $Q(){return k(process.env.OTEL_LOG_USER_PROMPTS)}function TQ(Q){return $Q()?Q:"<REDACTED>"}async function e(Q,K={}){let $=qK();if(!$){if(!BK)BK=!0,p(`[3P telemetry] Event dropped (no event logger initialized): ${Q}`,{level:"warn"});return}let G={...i(),"event.name":Q,"event.timestamp":new Date().toISOString(),"event.sequence":QQ++},Z=VK();if(Z)G["prompt.id"]=Z;let J=process.env.CLAUDE_CODE_WORKSPACE_HOST_PATHS;if(J)G["workspace.host_paths"]=J.split("|");for(let[Y,z]of Object.entries(K))if(z!==void 0)G[Y]=z;$.emit({body:`claude_code.${Q}`,attributes:G})}var QQ=0,BK=!1;var _K=C(()=>{g();HK();I();a()});function RK(Q){return Math.abs(LK(Q))||1}function jK(Q){let K=QK.get(Q);if(K!==void 0)return K;return KK++,QK.set(Q,KK),KK}function r(){let Q=OK()??S(),K=DK()??"main",$=UK(),G=d.get(Q);if(G)return G;let Z={agentId:Q,agentName:K,parentAgentId:$,processId:Q===S()?1:jK(Q),threadId:RK(K)};return d.set(Q,Z),FK++,Z}function f(){return(Date.now()-zQ)*1000}function o(){return`span_${++XQ}`}function sQ(){let Q=process.env.CLAUDE_CODE_PERFETTO_TRACE;p(`[Perfetto] initializePerfettoTracing called, env value: ${Q}`)}function BQ(Q){if(!j)return;if(t.push({name:"process_name",cat:"__metadata",ph:"M",ts:0,pid:Q.processId,tid:0,args:{name:Q.agentName}}),t.push({name:"thread_name",cat:"__metadata",ph:"M",ts:0,pid:Q.processId,tid:Q.threadId,args:{name:Q.agentName}}),Q.parentAgentId)t.push({name:"parent_agent",cat:"__metadata",ph:"M",ts:0,pid:Q.processId,tid:0,args:{parent_agent_id:Q.parentAgentId}})}function c(){return j}function nQ(Q,K,$){if(!j)return;let G={agentId:Q,agentName:K,parentAgentId:$,processId:jK(Q),threadId:RK(K)};d.set(Q,G),FK++,BQ(G)}function aQ(Q){if(!j)return;d.delete(Q),QK.delete(Q)}function wK(Q){if(!j)return"";let K=o(),$=r();return _.set(K,{name:"API Call",category:"api",startTime:f(),agentInfo:$,args:{model:Q.model,prompt_tokens:Q.promptTokens,message_id:Q.messageId,is_speculative:Q.isSpeculative??!1,query_source:Q.querySource}}),L.push({name:"API Call",cat:"api",ph:"B",ts:_.get(K).startTime,pid:$.processId,tid:$.threadId,args:_.get(K).args}),K}function NK(Q,K){if(!j||!Q)return;let $=_.get(Q);if(!$)return;let G=f(),Z=G-$.startTime,J=K.promptTokens??$.args.prompt_tokens,Y=K.ttftMs,z=K.ttltMs,X=K.outputTokens,q=K.cacheReadTokens,V=Y!==void 0&&J!==void 0&&Y>0?Math.round(J/(Y/1000)*100)/100:void 0,W=z!==void 0&&Y!==void 0?z-Y:void 0,F=W!==void 0&&X!==void 0&&W>0?Math.round(X/(W/1000)*100)/100:void 0,E=q!==void 0&&J!==void 0&&J>0?Math.round(q/J*1e4)/100:void 0,h=K.requestSetupMs,A=K.attemptStartTimes,dK={...$.args,ttft_ms:Y,ttlt_ms:z,prompt_tokens:J,output_tokens:X,cache_read_tokens:q,cache_creation_tokens:K.cacheCreationTokens,message_id:K.messageId??$.args.message_id,success:K.success??!0,error:K.error,duration_ms:Z/1000,request_setup_ms:h,itps:V,otps:F,cache_hit_rate_pct:E},u=h!==void 0&&h>0?h*1000:0;if(u>0){let m=$.startTime+u;if(L.push({name:"Request Setup",cat:"api,setup",ph:"B",ts:$.startTime,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{request_setup_ms:h,attempt_count:A?.length??1}}),A&&A.length>1){let T=A[0];for(let R=0;R<A.length-1;R++){let rK=$.startTime+(A[R]-T)*1000,oK=$.startTime+(A[R+1]-T)*1000;L.push({name:`Attempt ${R+1} (retry)`,cat:"api,retry",ph:"B",ts:rK,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{attempt:R+1}}),L.push({name:`Attempt ${R+1} (retry)`,cat:"api,retry",ph:"E",ts:oK,pid:$.agentInfo.processId,tid:$.agentInfo.threadId})}}L.push({name:"Request Setup",cat:"api,setup",ph:"E",ts:m,pid:$.agentInfo.processId,tid:$.agentInfo.threadId})}if(Y!==void 0){let m=$.startTime+u,T=m+Y*1000;L.push({name:"First Token",cat:"api,ttft",ph:"B",ts:m,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{ttft_ms:Y,prompt_tokens:J,itps:V,cache_hit_rate_pct:E}}),L.push({name:"First Token",cat:"api,ttft",ph:"E",ts:T,pid:$.agentInfo.processId,tid:$.agentInfo.threadId});let R=z!==void 0?z-Y-u/1000:void 0;if(R!==void 0&&R>0)L.push({name:"Sampling",cat:"api,sampling",ph:"B",ts:T,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{sampling_ms:R,output_tokens:X,otps:F}}),L.push({name:"Sampling",cat:"api,sampling",ph:"E",ts:T+R*1000,pid:$.agentInfo.processId,tid:$.agentInfo.threadId})}L.push({name:$.name,cat:$.category,ph:"E",ts:G,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:dK}),_.delete(Q)}function MK(Q,K){if(!j)return"";let $=o(),G=r();return _.set($,{name:`Tool: ${Q}`,category:"tool",startTime:f(),agentInfo:G,args:{tool_name:Q,...K}}),L.push({name:`Tool: ${Q}`,cat:"tool",ph:"B",ts:_.get($).startTime,pid:G.processId,tid:G.threadId,args:_.get($).args}),$}function kK(Q,K){if(!j||!Q)return;let $=_.get(Q);if(!$)return;let G=f(),Z=G-$.startTime,J={...$.args,success:K?.success??!0,error:K?.error,result_tokens:K?.resultTokens,duration_ms:Z/1000};L.push({name:$.name,cat:$.category,ph:"E",ts:G,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:J}),_.delete(Q)}function yK(Q){if(!j)return"";let K=o(),$=r();return _.set(K,{name:"Waiting for User Input",category:"user_input",startTime:f(),agentInfo:$,args:{context:Q}}),L.push({name:"Waiting for User Input",cat:"user_input",ph:"B",ts:_.get(K).startTime,pid:$.processId,tid:$.threadId,args:_.get(K).args}),K}function PK(Q,K){if(!j||!Q)return;let $=_.get(Q);if(!$)return;let G=f(),Z=G-$.startTime,J={...$.args,decision:K?.decision,source:K?.source,duration_ms:Z/1000};L.push({name:$.name,cat:$.category,ph:"E",ts:G,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:J}),_.delete(Q)}function EK(Q){if(!j)return"";let K=o(),$=r();return _.set(K,{name:"Interaction",category:"interaction",startTime:f(),agentInfo:$,args:{user_prompt_length:Q?.length}}),L.push({name:"Interaction",cat:"interaction",ph:"B",ts:_.get(K).startTime,pid:$.processId,tid:$.threadId,args:_.get(K).args}),K}function hK(Q){if(!j||!Q)return;let K=_.get(Q);if(!K)return;let $=f(),G=$-K.startTime;L.push({name:K.name,cat:K.category,ph:"E",ts:$,pid:K.agentInfo.processId,tid:K.agentInfo.threadId,args:{...K.args,duration_ms:G/1000}}),_.delete(Q)}var j=!1,t,L,_,d,FK=0,zQ=0,XQ=0,KK=1,QK;var fK=C(()=>{g();GQ();HK();I();ZQ();JQ();WK();YQ();t=[],L=[],_=new Map,d=new Map,QK=new Map});import{createHash as VQ}from"crypto";function Y4(){l.clear(),GK.clear()}function y(){if(!(k(process.env.ENABLE_BETA_TRACING_DETAILED)&&Boolean(process.env.BETA_TRACING_ENDPOINT)))return!1;if(process.env.USER_TYPE!=="ant")return AK()||xK("tengu_trace_lantern",!1);return!0}function w(Q,K=HQ){if(Q.length<=K)return{content:Q,truncated:!1};return{content:Q.slice(0,K)+`
2
+ import{F1 as aK,I3 as XK,Q2 as xK,Q3 as tK,a3 as bK,b2 as n,c2 as eK,j1 as zK,m2 as CK,v2 as qQ}from"./cli-msmzt4c3.js";import{D4 as YQ,q4 as UK,s4 as OK,t4 as DK}from"./cli-s6vr7213.js";import{K8 as LK,N8 as JQ}from"./cli-xmgm2573.js";import{M9 as GQ,b_ as ZQ,d_ as x,e_ as TK,h_ as WK,v_ as p,y_ as HK}from"./cli-hke6r0q8.js";import{I_ as k,S_ as I}from"./cli-tq5z9qv3.js";import{$ca as VK,Naa as qK,Taa as AK,bda as g,e$ as S}from"./cli-3ac555qw.js";import{fda as C}from"./cli-w1d8n9g3.js";function sK(Q){let K=BigInt(58),$=Array(22).fill("1"),G=21,Z=Q;while(Z>0n){let J=Number(Z%K);$[G]="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"[J],Z=Z/K,G--}return $.join("")}function nK(Q){let K=Q.replace(/-/g,"");if(K.length!==32)throw Error(`Invalid UUID hex length: ${K.length}`);return BigInt("0x"+K)}function JK(Q,K){let $=nK(K);return`${Q}_01${sK($)}`}var YK=()=>{};function s(Q){let K=KQ[Q],$=process.env[Q];if($===void 0)return K;return k($)}function i(){let Q=XK(),K=S(),$={"user.id":Q};if(s("OTEL_METRICS_INCLUDE_SESSION_ID"))$["session.id"]=K;if(s("OTEL_METRICS_INCLUDE_VERSION"))$["app.version"]=MACRO.VERSION;let G=zK();if(G){let{organizationUuid:Z,emailAddress:J,accountUuid:Y}=G;if(Z)$["organization.id"]=Z;if(J)$["user.email"]=J;if(Y&&s("OTEL_METRICS_INCLUDE_ACCOUNT_UUID"))$["user.account_uuid"]=Y,$["user.account_id"]=process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID||JK("user",Y)}if(n.terminal)$["terminal.type"]=n.terminal;return $}var KQ;var a=C(()=>{g();aK();tK();eK();I();YK();KQ={OTEL_METRICS_INCLUDE_SESSION_ID:!0,OTEL_METRICS_INCLUDE_VERSION:!1,OTEL_METRICS_INCLUDE_ACCOUNT_UUID:!0}});function $Q(){return k(process.env.OTEL_LOG_USER_PROMPTS)}function TQ(Q){return $Q()?Q:"<REDACTED>"}async function e(Q,K={}){let $=qK();if(!$){if(!BK)BK=!0,p(`[3P telemetry] Event dropped (no event logger initialized): ${Q}`,{level:"warn"});return}let G={...i(),"event.name":Q,"event.timestamp":new Date().toISOString(),"event.sequence":QQ++},Z=VK();if(Z)G["prompt.id"]=Z;let J=process.env.CLAUDE_CODE_WORKSPACE_HOST_PATHS;if(J)G["workspace.host_paths"]=J.split("|");for(let[Y,z]of Object.entries(K))if(z!==void 0)G[Y]=z;$.emit({body:`claude_code.${Q}`,attributes:G})}var QQ=0,BK=!1;var _K=C(()=>{g();HK();I();a()});function RK(Q){return Math.abs(LK(Q))||1}function jK(Q){let K=QK.get(Q);if(K!==void 0)return K;return KK++,QK.set(Q,KK),KK}function r(){let Q=OK()??S(),K=DK()??"main",$=UK(),G=d.get(Q);if(G)return G;let Z={agentId:Q,agentName:K,parentAgentId:$,processId:Q===S()?1:jK(Q),threadId:RK(K)};return d.set(Q,Z),FK++,Z}function f(){return(Date.now()-zQ)*1000}function o(){return`span_${++XQ}`}function sQ(){let Q=process.env.CLAUDE_CODE_PERFETTO_TRACE;p(`[Perfetto] initializePerfettoTracing called, env value: ${Q}`)}function BQ(Q){if(!j)return;if(t.push({name:"process_name",cat:"__metadata",ph:"M",ts:0,pid:Q.processId,tid:0,args:{name:Q.agentName}}),t.push({name:"thread_name",cat:"__metadata",ph:"M",ts:0,pid:Q.processId,tid:Q.threadId,args:{name:Q.agentName}}),Q.parentAgentId)t.push({name:"parent_agent",cat:"__metadata",ph:"M",ts:0,pid:Q.processId,tid:0,args:{parent_agent_id:Q.parentAgentId}})}function c(){return j}function nQ(Q,K,$){if(!j)return;let G={agentId:Q,agentName:K,parentAgentId:$,processId:jK(Q),threadId:RK(K)};d.set(Q,G),FK++,BQ(G)}function aQ(Q){if(!j)return;d.delete(Q),QK.delete(Q)}function wK(Q){if(!j)return"";let K=o(),$=r();return _.set(K,{name:"API Call",category:"api",startTime:f(),agentInfo:$,args:{model:Q.model,prompt_tokens:Q.promptTokens,message_id:Q.messageId,is_speculative:Q.isSpeculative??!1,query_source:Q.querySource}}),L.push({name:"API Call",cat:"api",ph:"B",ts:_.get(K).startTime,pid:$.processId,tid:$.threadId,args:_.get(K).args}),K}function NK(Q,K){if(!j||!Q)return;let $=_.get(Q);if(!$)return;let G=f(),Z=G-$.startTime,J=K.promptTokens??$.args.prompt_tokens,Y=K.ttftMs,z=K.ttltMs,X=K.outputTokens,q=K.cacheReadTokens,V=Y!==void 0&&J!==void 0&&Y>0?Math.round(J/(Y/1000)*100)/100:void 0,W=z!==void 0&&Y!==void 0?z-Y:void 0,F=W!==void 0&&X!==void 0&&W>0?Math.round(X/(W/1000)*100)/100:void 0,E=q!==void 0&&J!==void 0&&J>0?Math.round(q/J*1e4)/100:void 0,h=K.requestSetupMs,A=K.attemptStartTimes,dK={...$.args,ttft_ms:Y,ttlt_ms:z,prompt_tokens:J,output_tokens:X,cache_read_tokens:q,cache_creation_tokens:K.cacheCreationTokens,message_id:K.messageId??$.args.message_id,success:K.success??!0,error:K.error,duration_ms:Z/1000,request_setup_ms:h,itps:V,otps:F,cache_hit_rate_pct:E},u=h!==void 0&&h>0?h*1000:0;if(u>0){let m=$.startTime+u;if(L.push({name:"Request Setup",cat:"api,setup",ph:"B",ts:$.startTime,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{request_setup_ms:h,attempt_count:A?.length??1}}),A&&A.length>1){let T=A[0];for(let R=0;R<A.length-1;R++){let rK=$.startTime+(A[R]-T)*1000,oK=$.startTime+(A[R+1]-T)*1000;L.push({name:`Attempt ${R+1} (retry)`,cat:"api,retry",ph:"B",ts:rK,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{attempt:R+1}}),L.push({name:`Attempt ${R+1} (retry)`,cat:"api,retry",ph:"E",ts:oK,pid:$.agentInfo.processId,tid:$.agentInfo.threadId})}}L.push({name:"Request Setup",cat:"api,setup",ph:"E",ts:m,pid:$.agentInfo.processId,tid:$.agentInfo.threadId})}if(Y!==void 0){let m=$.startTime+u,T=m+Y*1000;L.push({name:"First Token",cat:"api,ttft",ph:"B",ts:m,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{ttft_ms:Y,prompt_tokens:J,itps:V,cache_hit_rate_pct:E}}),L.push({name:"First Token",cat:"api,ttft",ph:"E",ts:T,pid:$.agentInfo.processId,tid:$.agentInfo.threadId});let R=z!==void 0?z-Y-u/1000:void 0;if(R!==void 0&&R>0)L.push({name:"Sampling",cat:"api,sampling",ph:"B",ts:T,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:{sampling_ms:R,output_tokens:X,otps:F}}),L.push({name:"Sampling",cat:"api,sampling",ph:"E",ts:T+R*1000,pid:$.agentInfo.processId,tid:$.agentInfo.threadId})}L.push({name:$.name,cat:$.category,ph:"E",ts:G,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:dK}),_.delete(Q)}function MK(Q,K){if(!j)return"";let $=o(),G=r();return _.set($,{name:`Tool: ${Q}`,category:"tool",startTime:f(),agentInfo:G,args:{tool_name:Q,...K}}),L.push({name:`Tool: ${Q}`,cat:"tool",ph:"B",ts:_.get($).startTime,pid:G.processId,tid:G.threadId,args:_.get($).args}),$}function kK(Q,K){if(!j||!Q)return;let $=_.get(Q);if(!$)return;let G=f(),Z=G-$.startTime,J={...$.args,success:K?.success??!0,error:K?.error,result_tokens:K?.resultTokens,duration_ms:Z/1000};L.push({name:$.name,cat:$.category,ph:"E",ts:G,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:J}),_.delete(Q)}function yK(Q){if(!j)return"";let K=o(),$=r();return _.set(K,{name:"Waiting for User Input",category:"user_input",startTime:f(),agentInfo:$,args:{context:Q}}),L.push({name:"Waiting for User Input",cat:"user_input",ph:"B",ts:_.get(K).startTime,pid:$.processId,tid:$.threadId,args:_.get(K).args}),K}function PK(Q,K){if(!j||!Q)return;let $=_.get(Q);if(!$)return;let G=f(),Z=G-$.startTime,J={...$.args,decision:K?.decision,source:K?.source,duration_ms:Z/1000};L.push({name:$.name,cat:$.category,ph:"E",ts:G,pid:$.agentInfo.processId,tid:$.agentInfo.threadId,args:J}),_.delete(Q)}function EK(Q){if(!j)return"";let K=o(),$=r();return _.set(K,{name:"Interaction",category:"interaction",startTime:f(),agentInfo:$,args:{user_prompt_length:Q?.length}}),L.push({name:"Interaction",cat:"interaction",ph:"B",ts:_.get(K).startTime,pid:$.processId,tid:$.threadId,args:_.get(K).args}),K}function hK(Q){if(!j||!Q)return;let K=_.get(Q);if(!K)return;let $=f(),G=$-K.startTime;L.push({name:K.name,cat:K.category,ph:"E",ts:$,pid:K.agentInfo.processId,tid:K.agentInfo.threadId,args:{...K.args,duration_ms:G/1000}}),_.delete(Q)}var j=!1,t,L,_,d,FK=0,zQ=0,XQ=0,KK=1,QK;var fK=C(()=>{g();GQ();HK();I();ZQ();JQ();WK();YQ();t=[],L=[],_=new Map,d=new Map,QK=new Map});import{createHash as VQ}from"crypto";function Y4(){l.clear(),GK.clear()}function y(){if(!(k(process.env.ENABLE_BETA_TRACING_DETAILED)&&Boolean(process.env.BETA_TRACING_ENDPOINT)))return!1;if(process.env.USER_TYPE!=="ant")return AK()||xK("tengu_trace_lantern",!1);return!0}function w(Q,K=HQ){if(Q.length<=K)return{content:Q,truncated:!1};return{content:Q.slice(0,K)+`
3
3
 
4
4
  [TRUNCATED - Content exceeds 60KB limit]`,truncated:!0}}function ZK(Q){return VQ("sha256").update(Q).digest("hex").slice(0,12)}function _Q(Q){return`sp_${ZK(Q)}`}function vK(Q){let K=x(Q.message.content);return`msg_${ZK(K)}`}function $K(Q){let K=Q.trim().match(WQ);return K&&K[1]?K[1].trim():null}function LQ(Q){let K=[],$=[];for(let G of Q){let Z=G.message.content;if(typeof Z==="string"){let J=$K(Z);if(J)$.push(J);else K.push(`[USER]
5
5
  ${Z}`)}else if(Array.isArray(Z)){for(let J of Z)if(J.type==="text"){let Y=$K(J.text);if(Y)$.push(Y);else K.push(`[USER]
@@ -16,4 +16,4 @@ ${K}`);Q.setAttributes({new_context:$,...G&&{new_context_truncated:!0,new_contex
16
16
  `),{content:W,truncated:F}=w(V);Q.setAttributes({system_reminders:W,system_reminders_count:X.length,...F&&{system_reminders_truncated:!0,system_reminders_original_length:V.length}})}let q=$[$.length-1];if(q)GK.set(G,vK(q))}}}function cK(Q,K){if(!y()||!K)return;if(K.modelOutput!==void 0){let{content:$,truncated:G}=w(K.modelOutput);if(Q["response.model_output"]=$,G)Q["response.model_output_truncated"]=!0,Q["response.model_output_original_length"]=K.modelOutput.length}if(process.env.USER_TYPE==="ant"&&K.thinkingOutput!==void 0){let{content:$,truncated:G}=w(K.thinkingOutput);if(Q["response.thinking_output"]=$,G)Q["response.thinking_output_truncated"]=!0,Q["response.thinking_output_original_length"]=K.thinkingOutput.length}}function lK(Q,K,$){if(!y())return;let{content:G,truncated:Z}=w(`[TOOL INPUT: ${K}]
17
17
  ${$}`);Q.setAttributes({tool_input:G,...Z&&{tool_input_truncated:!0,tool_input_original_length:$.length}})}function uK(Q,K,$){if(!y())return;let{content:G,truncated:Z}=w(`[TOOL RESULT: ${K}]
18
18
  ${$}`);if(Q.new_context=G,Z)Q.new_context_truncated=!0,Q.new_context_original_length=$.length}var l,GK,HQ=61440,WQ;var mK=C(()=>{g();bK();qQ();I();WK();_K();l=new Set,GK=new Map;WQ=/^<system-reminder>\n?([\s\S]*?)\n?<\/system-reminder>$/});import{context as M,trace as U}from"@opentelemetry/api";import{AsyncLocalStorage as pK}from"async_hooks";function H(Q){return Q.spanContext().spanId||""}function OQ(){if(iK)return;iK=!0;let Q=setInterval(()=>{let K=Date.now()-UQ;for(let[$,G]of B){let Z=G.deref();if(Z===void 0)B.delete($),D.delete($);else if(Z.startTime<K){if(!Z.ended)Z.span.end();B.delete($),D.delete($)}}},60000);if(typeof Q.unref==="function")Q.unref()}function DQ(){return!1}function N(){return DQ()||y()}function O(){return U.getTracer("com.anthropic.claude_code.tracing","1.0.0")}function b(Q,K={}){return{...i(),"span.type":Q,...K}}function D4(Q){OQ();let K=c()?EK(Q):void 0;if(!N()){if(K){let q=U.getActiveSpan()||O().startSpan("dummy"),V=H(q),W={span:q,startTime:Date.now(),attributes:{},perfettoSpanId:K};return B.set(V,new WeakRef(W)),v.enterWith(W),q}return U.getActiveSpan()||O().startSpan("dummy")}let $=O(),Z=k(process.env.OTEL_LOG_USER_PROMPTS)?Q:"<REDACTED>";gK++;let J=b("interaction",{user_prompt:Z,user_prompt_length:Q.length,"interaction.sequence":gK}),Y=$.startSpan("claude_code.interaction",{attributes:J});SK(Y,Q);let z=H(Y),X={span:Y,startTime:Date.now(),attributes:J,perfettoSpanId:K};return B.set(z,new WeakRef(X)),v.enterWith(X),Y}function F4(){let Q=v.getStore();if(!Q)return;if(Q.ended)return;if(Q.perfettoSpanId)hK(Q.perfettoSpanId);if(!N()){Q.ended=!0,B.delete(H(Q.span)),v.enterWith(void 0);return}let K=Date.now()-Q.startTime;Q.span.setAttributes({"interaction.duration_ms":K}),Q.span.end(),Q.ended=!0,B.delete(H(Q.span)),v.enterWith(void 0)}function R4(Q,K,$,G){let Z=c()?wK({model:Q,querySource:K?.querySource,messageId:void 0}):void 0;if(!N()){if(Z){let F=U.getActiveSpan()||O().startSpan("dummy"),E=H(F),h={span:F,startTime:Date.now(),attributes:{model:Q},perfettoSpanId:Z};return B.set(E,new WeakRef(h)),D.set(E,h),F}return U.getActiveSpan()||O().startSpan("dummy")}let J=O(),Y=v.getStore(),z=b("llm_request",{model:Q,"llm_request.context":Y?"interaction":"standalone",speed:G?"fast":"normal"}),X=Y?U.setSpan(M.active(),Y.span):M.active(),q=J.startSpan("claude_code.llm_request",{attributes:z},X);if(K?.querySource)q.setAttribute("query_source",K.querySource);IK(q,K,$);let V=H(q),W={span:q,startTime:Date.now(),attributes:z,perfettoSpanId:Z};return B.set(V,new WeakRef(W)),D.set(V,W),q}function j4(Q,K){let $;if(Q){let Y=H(Q);$=B.get(Y)?.deref()}else $=Array.from(B.values()).findLast((Y)=>{let z=Y.deref();return z?.attributes["span.type"]==="llm_request"||z?.attributes.model})?.deref();if(!$)return;let G=Date.now()-$.startTime;if($.perfettoSpanId)NK($.perfettoSpanId,{ttftMs:K?.ttftMs,ttltMs:G,promptTokens:K?.inputTokens,outputTokens:K?.outputTokens,cacheReadTokens:K?.cacheReadTokens,cacheCreationTokens:K?.cacheCreationTokens,success:K?.success,error:K?.error,requestSetupMs:K?.requestSetupMs,attemptStartTimes:K?.attemptStartTimes});if(!N()){let Y=H($.span);B.delete(Y),D.delete(Y);return}let Z={duration_ms:G};if(K){if(K.inputTokens!==void 0)Z.input_tokens=K.inputTokens;if(K.outputTokens!==void 0)Z.output_tokens=K.outputTokens;if(K.cacheReadTokens!==void 0)Z.cache_read_tokens=K.cacheReadTokens;if(K.cacheCreationTokens!==void 0)Z.cache_creation_tokens=K.cacheCreationTokens;if(K.success!==void 0)Z.success=K.success;if(K.statusCode!==void 0)Z.status_code=K.statusCode;if(K.error!==void 0)Z.error=K.error;if(K.attempt!==void 0)Z.attempt=K.attempt;if(K.hasToolCall!==void 0)Z["response.has_tool_call"]=K.hasToolCall;if(K.ttftMs!==void 0)Z.ttft_ms=K.ttftMs;cK(Z,K)}$.span.setAttributes(Z),$.span.end();let J=H($.span);B.delete(J),D.delete(J)}function w4(Q,K,$){let G=c()?MK(Q,K):void 0;if(!N()){if(G){let W=U.getActiveSpan()||O().startSpan("dummy"),F=H(W),E={span:W,startTime:Date.now(),attributes:{"span.type":"tool",tool_name:Q},perfettoSpanId:G};return B.set(F,new WeakRef(E)),P.enterWith(E),W}return U.getActiveSpan()||O().startSpan("dummy")}let Z=O(),J=v.getStore(),Y=b("tool",{tool_name:Q,...K}),z=J?U.setSpan(M.active(),J.span):M.active(),X=Z.startSpan("claude_code.tool",{attributes:Y},z);if($)lK(X,Q,$);let q=H(X),V={span:X,startTime:Date.now(),attributes:Y,perfettoSpanId:G};return B.set(q,new WeakRef(V)),P.enterWith(V),X}function N4(){let Q=c()?yK("tool_permission"):void 0;if(!N()){if(Q){let X=U.getActiveSpan()||O().startSpan("dummy"),q=H(X),V={span:X,startTime:Date.now(),attributes:{"span.type":"tool.blocked_on_user"},perfettoSpanId:Q};return B.set(q,new WeakRef(V)),D.set(q,V),X}return U.getActiveSpan()||O().startSpan("dummy")}let K=O(),$=P.getStore(),G=b("tool.blocked_on_user"),Z=$?U.setSpan(M.active(),$.span):M.active(),J=K.startSpan("claude_code.tool.blocked_on_user",{attributes:G},Z),Y=H(J),z={span:J,startTime:Date.now(),attributes:G,perfettoSpanId:Q};return B.set(Y,new WeakRef(z)),D.set(Y,z),J}function M4(Q,K){let $=Array.from(B.values()).findLast((Y)=>Y.deref()?.attributes["span.type"]==="tool.blocked_on_user")?.deref();if(!$)return;if($.perfettoSpanId)PK($.perfettoSpanId,{decision:Q,source:K});if(!N()){let Y=H($.span);B.delete(Y),D.delete(Y);return}let Z={duration_ms:Date.now()-$.startTime};if(Q)Z.decision=Q;if(K)Z.source=K;$.span.setAttributes(Z),$.span.end();let J=H($.span);B.delete(J),D.delete(J)}function k4(){if(!N())return U.getActiveSpan()||O().startSpan("dummy");let Q=O(),K=P.getStore(),$=b("tool.execution"),G=K?U.setSpan(M.active(),K.span):M.active(),Z=Q.startSpan("claude_code.tool.execution",{attributes:$},G),J=H(Z),Y={span:Z,startTime:Date.now(),attributes:$};return B.set(J,new WeakRef(Y)),D.set(J,Y),Z}function y4(Q){if(!N())return;let K=Array.from(B.values()).findLast((J)=>J.deref()?.attributes["span.type"]==="tool.execution")?.deref();if(!K)return;let G={duration_ms:Date.now()-K.startTime};if(Q){if(Q.success!==void 0)G.success=Q.success;if(Q.error!==void 0)G.error=Q.error}K.span.setAttributes(G),K.span.end();let Z=H(K.span);B.delete(Z),D.delete(Z)}function P4(Q,K){let $=P.getStore();if(!$)return;if($.perfettoSpanId)kK($.perfettoSpanId,{success:!0,resultTokens:K});if(!N()){let Y=H($.span);B.delete(Y),P.enterWith(void 0);return}let Z={duration_ms:Date.now()-$.startTime};if(Q){let Y=$.attributes.tool_name||"unknown";uK(Z,Y,Q)}if(K!==void 0)Z.result_tokens=K;$.span.setAttributes(Z),$.span.end();let J=H($.span);B.delete(J),P.enterWith(void 0)}function FQ(){return k(process.env.OTEL_LOG_TOOL_CONTENT)}function E4(Q,K){if(!N()||!FQ())return;let $=P.getStore();if(!$)return;let G={};for(let[Z,J]of Object.entries(K))if(typeof J==="string"){let{content:Y,truncated:z}=w(J);if(G[Z]=Y,z)G[`${Z}_truncated`]=!0,G[`${Z}_original_length`]=J.length}else G[Z]=J;$.span.addEvent(Q,G)}function h4(Q,K,$,G){if(!y())return U.getActiveSpan()||O().startSpan("dummy");let Z=O(),J=P.getStore()??v.getStore(),Y=b("hook",{hook_event:Q,hook_name:K,num_hooks:$,hook_definitions:G}),z=J?U.setSpan(M.active(),J.span):M.active(),X=Z.startSpan("claude_code.hook",{attributes:Y},z),q=H(X),V={span:X,startTime:Date.now(),attributes:Y};return B.set(q,new WeakRef(V)),D.set(q,V),X}function f4(Q,K){if(!y())return;let $=H(Q),G=B.get($)?.deref();if(!G)return;let J={duration_ms:Date.now()-G.startTime};if(K){if(K.numSuccess!==void 0)J.num_success=K.numSuccess;if(K.numBlocking!==void 0)J.num_blocking=K.numBlocking;if(K.numNonBlockingError!==void 0)J.num_non_blocking_error=K.numNonBlockingError;if(K.numCancelled!==void 0)J.num_cancelled=K.numCancelled}G.span.setAttributes(J),G.span.end(),B.delete($),D.delete($)}var v,P,B,D,gK=0,iK=!1,UQ=1800000;var RQ=C(()=>{bK();I();a();mK();fK();v=new pK,P=new pK,B=new Map,D=new Map});
19
- export{i as TS,a as US,TQ as VS,e as WS,_K as XS,sQ as YS,c as ZS,nQ as _S,aQ as $S,fK as aT,Y4 as bT,y as cT,mK as dT,DQ as eT,D4 as fT,F4 as gT,R4 as hT,j4 as iT,w4 as jT,N4 as kT,M4 as lT,k4 as mT,y4 as nT,P4 as oT,E4 as pT,h4 as qT,f4 as rT,RQ as sT};
19
+ export{i as WS,a as XS,TQ as YS,e as ZS,_K as _S,sQ as $S,c as aT,nQ as bT,aQ as cT,fK as dT,Y4 as eT,y as fT,mK as gT,DQ as hT,D4 as iT,F4 as jT,R4 as kT,j4 as lT,w4 as mT,N4 as nT,M4 as oT,k4 as pT,y4 as qT,P4 as rT,E4 as sT,h4 as tT,f4 as uT,RQ as vT};
@@ -1,6 +1,6 @@
1
1
  // @bun
2
- import{w as T}from"./cli-znz72ctn.js";import{Cx as F,Dx as m}from"./cli-5pb6kdxn.js";import{PK as S,SK as o,TK as k,UK as z,ZK as c}from"./cli-49dqgzsg.js";import{f3 as N,q3 as b}from"./cli-9hskw92e.js";import{B5 as y,C5 as U,H5 as p,t5 as W,w5 as w}from"./cli-tn47e131.js";import{I5 as E,J5 as f}from"./cli-avcnnw0n.js";import{K6 as Z,M6 as R}from"./cli-nj726gac.js";import{U8 as q,V8 as C}from"./cli-s5epnnj5.js";import{$9 as O,d_ as h,r_ as Y,u_ as _}from"./cli-a98b285v.js";import{E_ as H,O_ as u}from"./cli-1qszxdan.js";import{cda as v}from"./cli-x514vyva.js";b();f();import{z as V}from"zod/v4";var j={poll_interval_ms_not_at_capacity:2000,poll_interval_ms_at_capacity:600000,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:2000,multisession_poll_interval_ms_partial_capacity:2000,multisession_poll_interval_ms_at_capacity:600000,reclaim_older_than_ms:5000,session_keepalive_interval_v2_ms:120000};var x={message:"must be 0 (disabled) or \u2265100ms"},I=E(()=>V.object({poll_interval_ms_not_at_capacity:V.number().int().min(100),poll_interval_ms_at_capacity:V.number().int().refine((J)=>J===0||J>=100,x),non_exclusive_heartbeat_interval_ms:V.number().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:V.number().int().min(100).default(j.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:V.number().int().min(100).default(j.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:V.number().int().refine((J)=>J===0||J>=100,x).default(j.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:V.number().int().min(1).default(5000),session_keepalive_interval_v2_ms:V.number().int().min(0).default(120000)}).refine((J)=>J.non_exclusive_heartbeat_interval_ms>0||J.poll_interval_ms_at_capacity>0,{message:"at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0"}).refine((J)=>J.non_exclusive_heartbeat_interval_ms>0||J.multisession_poll_interval_ms_at_capacity>0,{message:"at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0"}));function VJ(){let J=N("tengu_bridge_poll_interval_config",j,300000),K=I().safeParse(J);return K.success?K.data:j}_();R();o();import a from"axios";C();m();_();R();u();w();p();c();h();var i=`{"type":"keep_alive"}
2
+ import{w as T}from"./cli-zpcncwrv.js";import{Ax as m,zx as F}from"./cli-me4e2p3e.js";import{MK as S,PK as o,QK as k,RK as z,WK as c}from"./cli-s9fhtgmz.js";import{R2 as N,a3 as b}from"./cli-msmzt4c3.js";import{$4 as E,a5 as f}from"./cli-fakdskp6.js";import{l5 as W,o5 as w,t5 as y,u5 as U,z5 as p}from"./cli-f63fdj4w.js";import{O6 as Z,Q6 as R}from"./cli-fdya77ch.js";import{Y8 as q,Z8 as C}from"./cli-t9jht3kb.js";import{d_ as O,h_ as h,v_ as Y,y_ as _}from"./cli-hke6r0q8.js";import{I_ as H,S_ as u}from"./cli-tq5z9qv3.js";import{gda as v}from"./cli-w1d8n9g3.js";b();f();import{z as V}from"zod/v4";var j={poll_interval_ms_not_at_capacity:2000,poll_interval_ms_at_capacity:600000,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:2000,multisession_poll_interval_ms_partial_capacity:2000,multisession_poll_interval_ms_at_capacity:600000,reclaim_older_than_ms:5000,session_keepalive_interval_v2_ms:120000};var x={message:"must be 0 (disabled) or \u2265100ms"},I=E(()=>V.object({poll_interval_ms_not_at_capacity:V.number().int().min(100),poll_interval_ms_at_capacity:V.number().int().refine((J)=>J===0||J>=100,x),non_exclusive_heartbeat_interval_ms:V.number().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:V.number().int().min(100).default(j.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:V.number().int().min(100).default(j.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:V.number().int().refine((J)=>J===0||J>=100,x).default(j.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:V.number().int().min(1).default(5000),session_keepalive_interval_v2_ms:V.number().int().min(0).default(120000)}).refine((J)=>J.non_exclusive_heartbeat_interval_ms>0||J.poll_interval_ms_at_capacity>0,{message:"at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0"}).refine((J)=>J.non_exclusive_heartbeat_interval_ms>0||J.multisession_poll_interval_ms_at_capacity>0,{message:"at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0"}));function VJ(){let J=N("tengu_bridge_poll_interval_config",j,300000),K=I().safeParse(J);return K.success?K.data:j}_();R();o();import a from"axios";C();m();_();R();u();w();p();c();h();var i=`{"type":"keep_alive"}
3
3
  `,d=1000,g=1000,D=30000,t=600000,l=1e4,n=300000,A=D*2,r=new Set([1002,4001,4003]);class L{ws=null;lastSentId=null;url;state="idle";onData;onCloseCallback;onConnectCallback;headers;sessionId;autoReconnect;isBridge;reconnectAttempts=0;reconnectStartTime=null;reconnectTimer=null;lastReconnectAttemptTime=null;lastActivityTime=0;pingInterval=null;pongReceived=!0;keepAliveInterval=null;messageBuffer;isBunWs=!1;connectStartTime=0;refreshHeaders;constructor(J,K={},Q,X,$){this.url=J,this.headers=K,this.sessionId=Q,this.refreshHeaders=X,this.autoReconnect=$?.autoReconnect??!0,this.isBridge=$?.isBridge??!1,this.messageBuffer=new F(d)}async connect(){if(this.state!=="idle"&&this.state!=="reconnecting"){Y(`WebSocketTransport: Cannot connect, current state is ${this.state}`,{level:"error"}),Z("error","cli_websocket_connect_failed");return}this.state="reconnecting",this.connectStartTime=Date.now(),Y(`WebSocketTransport: Opening ${this.url.href}`),Z("info","cli_websocket_connect_opening");let J={...this.headers};if(this.lastSentId)J["X-Last-Request-Id"]=this.lastSentId,Y(`WebSocketTransport: Adding X-Last-Request-Id header: ${this.lastSentId}`);if(typeof Bun<"u"){let K=new globalThis.WebSocket(this.url.href,{headers:J,proxy:U(this.url.href),tls:W()||void 0});this.ws=K,this.isBunWs=!0,K.addEventListener("open",this.onBunOpen),K.addEventListener("message",this.onBunMessage),K.addEventListener("error",this.onBunError),K.addEventListener("close",this.onBunClose),K.addEventListener("pong",this.onPong)}else{let{default:K}=await import("ws"),Q=new K(this.url.href,{headers:J,agent:y(this.url.href),...W()});this.ws=Q,this.isBunWs=!1,Q.on("open",this.onNodeOpen),Q.on("message",this.onNodeMessage),Q.on("error",this.onNodeError),Q.on("close",this.onNodeClose),Q.on("pong",this.onPong)}}onBunOpen=()=>{if(this.handleOpenEvent(),this.lastSentId)this.replayBufferedMessages("")};onBunMessage=(J)=>{let K=typeof J.data==="string"?J.data:String(J.data);if(this.lastActivityTime=Date.now(),Z("info","cli_websocket_message_received",{length:K.length}),this.onData)this.onData(K)};onBunError=()=>{Y("WebSocketTransport: Error",{level:"error"}),Z("error","cli_websocket_connect_error")};onBunClose=(J)=>{let K=J.code===1000||J.code===1001;Y(`WebSocketTransport: Closed: ${J.code}`,K?void 0:{level:"error"}),Z("error","cli_websocket_connect_closed"),this.handleConnectionError(J.code)};onNodeOpen=()=>{let J=this.ws;if(this.handleOpenEvent(),!J)return;let Q=J.upgradeReq;if(Q?.headers?.["x-last-request-id"]){let X=Q.headers["x-last-request-id"];this.replayBufferedMessages(X)}};onNodeMessage=(J)=>{let K=J.toString();if(this.lastActivityTime=Date.now(),Z("info","cli_websocket_message_received",{length:K.length}),this.onData)this.onData(K)};onNodeError=(J)=>{Y(`WebSocketTransport: Error: ${J.message}`,{level:"error"}),Z("error","cli_websocket_connect_error")};onNodeClose=(J,K)=>{let Q=J===1000||J===1001;Y(`WebSocketTransport: Closed: ${J}`,Q?void 0:{level:"error"}),Z("error","cli_websocket_connect_closed"),this.handleConnectionError(J)};onPong=()=>{this.pongReceived=!0};handleOpenEvent(){let J=Date.now()-this.connectStartTime;if(Y("WebSocketTransport: Connected"),Z("info","cli_websocket_connect_connected",{duration_ms:J}),this.isBridge&&this.reconnectStartTime!==null)q("tengu_ws_transport_reconnected",{attempts:this.reconnectAttempts,downtimeMs:Date.now()-this.reconnectStartTime});this.reconnectAttempts=0,this.reconnectStartTime=null,this.lastReconnectAttemptTime=null,this.lastActivityTime=Date.now(),this.state="connected",this.onConnectCallback?.(),this.startPingInterval(),this.startKeepaliveInterval(),k(()=>{this.write({type:"keep_alive"})})}sendLine(J){if(!this.ws||this.state!=="connected")return Y("WebSocketTransport: Not connected"),Z("info","cli_websocket_send_not_connected"),!1;try{return this.ws.send(J),this.lastActivityTime=Date.now(),!0}catch(K){return Y(`WebSocketTransport: Failed to send: ${K}`,{level:"error"}),Z("error","cli_websocket_send_error"),this.handleConnectionError(),!1}}removeWsListeners(J){if(this.isBunWs){let K=J;K.removeEventListener("open",this.onBunOpen),K.removeEventListener("message",this.onBunMessage),K.removeEventListener("error",this.onBunError),K.removeEventListener("close",this.onBunClose),K.removeEventListener("pong",this.onPong)}else{let K=J;K.off("open",this.onNodeOpen),K.off("message",this.onNodeMessage),K.off("error",this.onNodeError),K.off("close",this.onNodeClose),K.off("pong",this.onPong)}}doDisconnect(){if(this.stopPingInterval(),this.stopKeepaliveInterval(),z(),this.ws)this.removeWsListeners(this.ws),this.ws.close(),this.ws=null}handleConnectionError(J){if(Y(`WebSocketTransport: Disconnected from ${this.url.href}`+(J!=null?` (code ${J})`:"")),Z("info","cli_websocket_disconnected"),this.isBridge)q("tengu_ws_transport_closed",{closeCode:J,msSinceLastActivity:this.lastActivityTime>0?Date.now()-this.lastActivityTime:-1,wasConnected:this.state==="connected",reconnectAttempts:this.reconnectAttempts});if(this.doDisconnect(),this.state==="closing"||this.state==="closed")return;let K=!1;if(J===4003&&this.refreshHeaders){let $=this.refreshHeaders();if($.Authorization!==this.headers.Authorization)Object.assign(this.headers,$),K=!0,Y("WebSocketTransport: 4003 received but headers refreshed, scheduling reconnect"),Z("info","cli_websocket_4003_token_refreshed")}if(J!=null&&r.has(J)&&!K){Y(`WebSocketTransport: Permanent close code ${J}, not reconnecting`,{level:"error"}),Z("error","cli_websocket_permanent_close",{closeCode:J}),this.state="closed",this.onCloseCallback?.(J);return}if(!this.autoReconnect){this.state="closed",this.onCloseCallback?.(J);return}let Q=Date.now();if(!this.reconnectStartTime)this.reconnectStartTime=Q;if(this.lastReconnectAttemptTime!==null&&Q-this.lastReconnectAttemptTime>A)Y(`WebSocketTransport: Detected system sleep (${Math.round((Q-this.lastReconnectAttemptTime)/1000)}s gap), resetting reconnection budget`),Z("info","cli_websocket_sleep_detected",{gapMs:Q-this.lastReconnectAttemptTime}),this.reconnectStartTime=Q,this.reconnectAttempts=0;this.lastReconnectAttemptTime=Q;let X=Q-this.reconnectStartTime;if(X<t){if(this.reconnectTimer)clearTimeout(this.reconnectTimer),this.reconnectTimer=null;if(!K&&this.refreshHeaders){let B=this.refreshHeaders();Object.assign(this.headers,B),Y("WebSocketTransport: Refreshed headers for reconnect")}this.state="reconnecting",this.reconnectAttempts++;let $=Math.min(g*Math.pow(2,this.reconnectAttempts-1),D),G=Math.max(0,$+$*0.25*(2*Math.random()-1));if(Y(`WebSocketTransport: Reconnecting in ${Math.round(G)}ms (attempt ${this.reconnectAttempts}, ${Math.round(X/1000)}s elapsed)`),Z("error","cli_websocket_reconnect_attempt",{reconnectAttempts:this.reconnectAttempts}),this.isBridge)q("tengu_ws_transport_reconnecting",{attempt:this.reconnectAttempts,elapsedMs:X,delayMs:Math.round(G)});this.reconnectTimer=setTimeout(()=>{this.reconnectTimer=null,this.connect()},G)}else if(Y(`WebSocketTransport: Reconnection time budget exhausted after ${Math.round(X/1000)}s for ${this.url.href}`,{level:"error"}),Z("error","cli_websocket_reconnect_exhausted",{reconnectAttempts:this.reconnectAttempts,elapsedMs:X}),this.state="closed",this.onCloseCallback)this.onCloseCallback(J)}close(){if(this.reconnectTimer)clearTimeout(this.reconnectTimer),this.reconnectTimer=null;this.stopPingInterval(),this.stopKeepaliveInterval(),z(),this.state="closing",this.doDisconnect()}replayBufferedMessages(J){let K=this.messageBuffer.toArray();if(K.length===0)return;let Q=0;if(J){let $=K.findIndex((G)=>("uuid"in G)&&G.uuid===J);if($>=0){Q=$+1;let G=K.slice(Q);if(this.messageBuffer.clear(),this.messageBuffer.addAll(G),G.length===0)this.lastSentId=null;Y(`WebSocketTransport: Evicted ${Q} confirmed messages, ${G.length} remaining`),Z("info","cli_websocket_evicted_confirmed_messages",{evicted:Q,remaining:G.length})}}let X=K.slice(Q);if(X.length===0){Y("WebSocketTransport: No new messages to replay"),Z("info","cli_websocket_no_messages_to_replay");return}Y(`WebSocketTransport: Replaying ${X.length} buffered messages`),Z("info","cli_websocket_messages_to_replay",{count:X.length});for(let $ of X){let G=O($)+`
4
4
  `;if(!this.sendLine(G)){this.handleConnectionError();break}}}isConnectedStatus(){return this.state==="connected"}isClosedStatus(){return this.state==="closed"}setOnData(J){this.onData=J}setOnConnect(J){this.onConnectCallback=J}setOnClose(J){this.onCloseCallback=J}getStateLabel(){return this.state}async write(J){if("uuid"in J&&typeof J.uuid==="string")this.messageBuffer.add(J),this.lastSentId=J.uuid;let K=O(J)+`
5
5
  `;if(this.state!=="connected")return;let Q=this.sessionId?` session=${this.sessionId}`:"",X=this.getControlMessageDetailLabel(J);Y(`WebSocketTransport: Sending message type=${J.type}${Q}${X}`),this.sendLine(K)}getControlMessageDetailLabel(J){if(J.type==="control_request"){let{request_id:K,request:Q}=J,X=Q.subtype==="can_use_tool"?Q.tool_name:"";return` subtype=${Q.subtype} request_id=${K}${X?` tool=${X}`:""}`}if(J.type==="control_response"){let{subtype:K,request_id:Q}=J.response;return` subtype=${K} request_id=${Q}`}return""}startPingInterval(){this.stopPingInterval(),this.pongReceived=!0;let J=Date.now();this.pingInterval=setInterval(()=>{if(this.state==="connected"&&this.ws){let K=Date.now(),Q=K-J;if(J=K,Q>A){Y(`WebSocketTransport: ${Math.round(Q/1000)}s tick gap detected \u2014 process was suspended, forcing reconnect`),Z("info","cli_websocket_sleep_detected_on_ping",{gapMs:Q}),this.handleConnectionError();return}if(!this.pongReceived){Y("WebSocketTransport: No pong received, connection appears dead",{level:"error"}),Z("error","cli_websocket_pong_timeout"),this.handleConnectionError();return}this.pongReceived=!1;try{this.ws.ping?.()}catch(X){Y(`WebSocketTransport: Ping failed: ${X}`,{level:"error"}),Z("error","cli_websocket_ping_failed")}}},l)}stopPingInterval(){if(this.pingInterval)clearInterval(this.pingInterval),this.pingInterval=null}startKeepaliveInterval(){if(this.stopKeepaliveInterval(),H(process.env.CLAUDE_CODE_REMOTE))return;this.keepAliveInterval=setInterval(()=>{if(this.state==="connected"&&this.ws)try{this.ws.send(i),this.lastActivityTime=Date.now(),Y("WebSocketTransport: Sent periodic keep_alive data frame")}catch(J){Y(`WebSocketTransport: Periodic keep_alive failed: ${J}`,{level:"error"}),Z("error","cli_websocket_keepalive_failed")}},n)}stopKeepaliveInterval(){if(this.keepAliveInterval)clearInterval(this.keepAliveInterval),this.keepAliveInterval=null}}var s=100,e=15000,JJ=3000;class KJ extends L{postUrl;uploader;streamEventBuffer=[];streamEventTimer=null;constructor(J,K={},Q,X,$){super(J,K,Q,X,$);let{maxConsecutiveFailures:G,onBatchDropped:B}=$??{};this.postUrl=QJ(J),this.uploader=new T({maxBatchSize:500,maxQueueSize:1e5,baseDelayMs:500,maxDelayMs:8000,jitterMs:1000,maxConsecutiveFailures:G,onBatchDropped:(M,P)=>{Z("error","cli_hybrid_batch_dropped_max_failures",{batchSize:M,failures:P}),B?.(M,P)},send:(M)=>this.postOnce(M)}),Y(`HybridTransport: POST URL = ${this.postUrl}`),Z("info","cli_hybrid_transport_initialized")}async write(J){if(J.type==="stream_event"){if(this.streamEventBuffer.push(J),!this.streamEventTimer)this.streamEventTimer=setTimeout(()=>this.flushStreamEvents(),s);return}return await this.uploader.enqueue([...this.takeStreamEvents(),J]),this.uploader.flush()}async writeBatch(J){return await this.uploader.enqueue([...this.takeStreamEvents(),...J]),this.uploader.flush()}get droppedBatchCount(){return this.uploader.droppedBatchCount}flush(){return this.uploader.enqueue(this.takeStreamEvents()),this.uploader.flush()}takeStreamEvents(){if(this.streamEventTimer)clearTimeout(this.streamEventTimer),this.streamEventTimer=null;let J=this.streamEventBuffer;return this.streamEventBuffer=[],J}flushStreamEvents(){this.streamEventTimer=null,this.uploader.enqueue(this.takeStreamEvents())}close(){if(this.streamEventTimer)clearTimeout(this.streamEventTimer),this.streamEventTimer=null;this.streamEventBuffer=[];let J=this.uploader,K;Promise.race([J.flush(),new Promise((Q)=>{K=setTimeout(Q,JJ)})]).finally(()=>{clearTimeout(K),J.close()}),super.close()}async postOnce(J){let K=S();if(!K){Y("HybridTransport: No session token available for POST"),Z("warn","cli_hybrid_post_no_token");return}let Q={Authorization:`Bearer ${K}`,"Content-Type":"application/json"},X;try{X=await a.post(this.postUrl,{events:J},{headers:Q,validateStatus:()=>!0,timeout:e})}catch($){throw Y(`HybridTransport: POST error: ${$.message}`),Z("warn","cli_hybrid_post_network_error"),$}if(X.status>=200&&X.status<300){Y(`HybridTransport: POST success count=${J.length}`);return}if(X.status>=400&&X.status<500&&X.status!==429){Y(`HybridTransport: POST returned ${X.status} (permanent), dropping`),Z("warn","cli_hybrid_post_client_error",{status:X.status});return}throw Y(`HybridTransport: POST returned ${X.status} (retryable)`),Z("warn","cli_hybrid_post_retryable_error",{status:X.status}),Error(`POST failed with ${X.status}`)}}function QJ(J){let K=J.protocol==="wss:"?"https:":"http:",Q=J.pathname;if(Q=Q.replace("/ws/","/session/"),!Q.endsWith("/events"))Q=Q.endsWith("/")?Q+"events":Q+"/events";return`${K}//${J.host}${Q}${J.search}`}
6
- export{j as r,VJ as s,L as t,KJ as u};
6
+ export{j as i,VJ as j,L as k,KJ as l};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{p9 as P,y9 as F}from"./cli-shz2e0q5.js";import{A9 as U,B9 as B,z9 as k}from"./cli-d58ptbve.js";import{h_ as Y,l_ as R}from"./cli-a98b285v.js";import{B_ as K,E_ as G,O_ as M}from"./cli-1qszxdan.js";import{bda as $,cda as D}from"./cli-x514vyva.js";function L(){return process.versions.bun!==void 0}function b(){return typeof Bun<"u"&&Array.isArray(Bun.embeddedFiles)&&Bun.embeddedFiles.length>0}var N=()=>{};function W(q,Q){return{cmd:U(q)??q,args:Q}}var _=$(()=>{B()});import V from"lodash-es/memoize.js";import{homedir as z}from"os";import{join as J}from"path";async function X(q){try{return!!await k(q)}catch{return!1}}function y(){return process.env.__CFBundleIdentifier==="com.conductor.app"}function x(){if(process.env.CURSOR_TRACE_ID)return"cursor";if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes("cursor"))return"cursor";if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes("windsurf"))return"windsurf";if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes("antigravity"))return"antigravity";let q=process.env.__CFBundleIdentifier?.toLowerCase();if(q?.includes("vscodium"))return"codium";if(q?.includes("windsurf"))return"windsurf";if(q?.includes("com.google.android.studio"))return"androidstudio";if(q){for(let Q of I)if(q.includes(Q))return Q}if(process.env.VisualStudioVersion)return"visualstudio";if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"){if(process.platform==="darwin")return"pycharm";return"pycharm"}if(process.env.TERM==="xterm-ghostty")return"ghostty";if(process.env.TERM?.includes("kitty"))return"kitty";if(process.env.TERM_PROGRAM)return process.env.TERM_PROGRAM;if(process.env.TMUX)return"tmux";if(process.env.STY)return"screen";if(process.env.KONSOLE_VERSION)return"konsole";if(process.env.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(process.env.XTERM_VERSION)return"xterm";if(process.env.VTE_VERSION)return"vte-based";if(process.env.TERMINATOR_UUID)return"terminator";if(process.env.KITTY_WINDOW_ID)return"kitty";if(process.env.ALACRITTY_LOG)return"alacritty";if(process.env.TILIX_ID)return"tilix";if(process.env.WT_SESSION)return"windows-terminal";if(process.env.SESSIONNAME&&process.env.TERM==="cygwin")return"cygwin";if(process.env.MSYSTEM)return process.env.MSYSTEM.toLowerCase();if(process.env.ConEmuANSI||process.env.ConEmuPID||process.env.ConEmuTask)return"conemu";if(process.env.WSL_DISTRO_NAME)return`wsl-${process.env.WSL_DISTRO_NAME}`;if(O())return"ssh-session";if(process.env.TERM){let Q=process.env.TERM;if(Q.includes("alacritty"))return"alacritty";if(Q.includes("rxvt"))return"rxvt";if(Q.includes("termite"))return"termite";return process.env.TERM}if(!process.stdout.isTTY)return"non-interactive";return null}function O(){return!!(process.env.SSH_CONNECTION||process.env.SSH_CLIENT||process.env.SSH_TTY)}function s(){let q=process.env.CLAUDE_CODE_HOST_PLATFORM;if(q==="win32"||q==="darwin"||q==="linux")return q;return Z.platform}var a,w,j,S,H,A,I,C,Z;var T=$(()=>{F();N();M();_();R();B();a=V(()=>{if(Y().existsSync(J(K(),".config.json")))return J(K(),".config.json");let q=`.claude${P()}.json`;return J(process.env.CLAUDE_CONFIG_DIR||z(),q)}),w=V(async()=>{try{let{default:q}=await import("axios");return await q.head("http://1.1.1.1",{signal:AbortSignal.timeout(1000)}),!0}catch{return!1}});j=V(async()=>{let q=[];if(await X("npm"))q.push("npm");if(await X("yarn"))q.push("yarn");if(await X("pnpm"))q.push("pnpm");return q}),S=V(async()=>{let q=[];if(await X("bun"))q.push("bun");if(await X("deno"))q.push("deno");if(await X("node"))q.push("node");return q}),H=V(()=>{try{return Y().existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")}catch(q){return!1}}),A=V(()=>{try{if(!H())return!1;let{cmd:q}=W("npm",[]);return q.startsWith("/mnt/c/")}catch(q){return!1}});I=["pycharm","intellij","webstorm","phpstorm","rubymine","clion","goland","rider","datagrip","appcode","dataspell","aqua","gateway","fleet","jetbrains","androidstudio"];C=V(()=>{if(G(process.env.CODESPACES))return"codespaces";if(process.env.GITPOD_WORKSPACE_ID)return"gitpod";if(process.env.REPL_ID||process.env.REPL_SLUG)return"replit";if(process.env.PROJECT_DOMAIN)return"glitch";if(G(process.env.VERCEL))return"vercel";if(process.env.RAILWAY_ENVIRONMENT_NAME||process.env.RAILWAY_SERVICE_NAME)return"railway";if(G(process.env.RENDER))return"render";if(G(process.env.NETLIFY))return"netlify";if(process.env.DYNO)return"heroku";if(process.env.FLY_APP_NAME||process.env.FLY_MACHINE_ID)return"fly.io";if(G(process.env.CF_PAGES))return"cloudflare-pages";if(process.env.DENO_DEPLOYMENT_ID)return"deno-deploy";if(process.env.AWS_LAMBDA_FUNCTION_NAME)return"aws-lambda";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_FARGATE")return"aws-fargate";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_EC2")return"aws-ecs";try{if(Y().readFileSync("/sys/hypervisor/uuid",{encoding:"utf8"}).trim().toLowerCase().startsWith("ec2"))return"aws-ec2"}catch{}if(process.env.K_SERVICE)return"gcp-cloud-run";if(process.env.GOOGLE_CLOUD_PROJECT)return"gcp";if(process.env.WEBSITE_SITE_NAME||process.env.WEBSITE_SKU)return"azure-app-service";if(process.env.AZURE_FUNCTIONS_ENVIRONMENT)return"azure-functions";if(process.env.APP_URL?.includes("ondigitalocean.app"))return"digitalocean-app-platform";if(process.env.SPACE_CREATOR_USER_ID)return"huggingface-spaces";if(G(process.env.GITHUB_ACTIONS))return"github-actions";if(G(process.env.GITLAB_CI))return"gitlab-ci";if(process.env.CIRCLECI)return"circleci";if(process.env.BUILDKITE)return"buildkite";if(G(process.env.CI))return"ci";if(process.env.KUBERNETES_SERVICE_HOST)return"kubernetes";try{if(Y().existsSync("/.dockerenv"))return"docker"}catch{}if(Z.platform==="darwin")return"unknown-darwin";if(Z.platform==="linux")return"unknown-linux";if(Z.platform==="win32")return"unknown-win32";return"unknown"});Z={hasInternetAccess:w,isCI:G(process.env.CI),platform:["win32","darwin"].includes(process.platform)?process.platform:"linux",arch:process.arch,nodeVersion:process.version,terminal:x(),isSSH:O,getPackageManagers:j,getRuntimes:S,isRunningWithBun:V(L),isWslEnvironment:H,isNpmFromWindowsPath:A,isConductor:y,detectDeploymentEnvironment:C}});
3
- export{L as f9,b as g9,N as h9,W as i9,_ as j9,a as k9,I as l9,Z as m9,s as n9,T as o9};
2
+ import{C9 as F,t9 as P}from"./cli-kq16afrr.js";import{D9 as k,E9 as U,F9 as B}from"./cli-xpa1neza.js";import{l_ as Y,p_ as R}from"./cli-hke6r0q8.js";import{F_ as K,I_ as G,S_ as M}from"./cli-tq5z9qv3.js";import{fda as $,gda as D}from"./cli-w1d8n9g3.js";function L(){return process.versions.bun!==void 0}function b(){return typeof Bun<"u"&&Array.isArray(Bun.embeddedFiles)&&Bun.embeddedFiles.length>0}var N=()=>{};function W(q,Q){return{cmd:U(q)??q,args:Q}}var _=$(()=>{B()});import V from"lodash-es/memoize.js";import{homedir as z}from"os";import{join as J}from"path";async function X(q){try{return!!await k(q)}catch{return!1}}function y(){return process.env.__CFBundleIdentifier==="com.conductor.app"}function x(){if(process.env.CURSOR_TRACE_ID)return"cursor";if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes("cursor"))return"cursor";if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes("windsurf"))return"windsurf";if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes("antigravity"))return"antigravity";let q=process.env.__CFBundleIdentifier?.toLowerCase();if(q?.includes("vscodium"))return"codium";if(q?.includes("windsurf"))return"windsurf";if(q?.includes("com.google.android.studio"))return"androidstudio";if(q){for(let Q of I)if(q.includes(Q))return Q}if(process.env.VisualStudioVersion)return"visualstudio";if(process.env.TERMINAL_EMULATOR==="JetBrains-JediTerm"){if(process.platform==="darwin")return"pycharm";return"pycharm"}if(process.env.TERM==="xterm-ghostty")return"ghostty";if(process.env.TERM?.includes("kitty"))return"kitty";if(process.env.TERM_PROGRAM)return process.env.TERM_PROGRAM;if(process.env.TMUX)return"tmux";if(process.env.STY)return"screen";if(process.env.KONSOLE_VERSION)return"konsole";if(process.env.GNOME_TERMINAL_SERVICE)return"gnome-terminal";if(process.env.XTERM_VERSION)return"xterm";if(process.env.VTE_VERSION)return"vte-based";if(process.env.TERMINATOR_UUID)return"terminator";if(process.env.KITTY_WINDOW_ID)return"kitty";if(process.env.ALACRITTY_LOG)return"alacritty";if(process.env.TILIX_ID)return"tilix";if(process.env.WT_SESSION)return"windows-terminal";if(process.env.SESSIONNAME&&process.env.TERM==="cygwin")return"cygwin";if(process.env.MSYSTEM)return process.env.MSYSTEM.toLowerCase();if(process.env.ConEmuANSI||process.env.ConEmuPID||process.env.ConEmuTask)return"conemu";if(process.env.WSL_DISTRO_NAME)return`wsl-${process.env.WSL_DISTRO_NAME}`;if(O())return"ssh-session";if(process.env.TERM){let Q=process.env.TERM;if(Q.includes("alacritty"))return"alacritty";if(Q.includes("rxvt"))return"rxvt";if(Q.includes("termite"))return"termite";return process.env.TERM}if(!process.stdout.isTTY)return"non-interactive";return null}function O(){return!!(process.env.SSH_CONNECTION||process.env.SSH_CLIENT||process.env.SSH_TTY)}function s(){let q=process.env.CLAUDE_CODE_HOST_PLATFORM;if(q==="win32"||q==="darwin"||q==="linux")return q;return Z.platform}var a,w,j,S,H,A,I,C,Z;var T=$(()=>{F();N();M();_();R();B();a=V(()=>{if(Y().existsSync(J(K(),".config.json")))return J(K(),".config.json");let q=`.claude${P()}.json`;return J(process.env.CLAUDE_CONFIG_DIR||z(),q)}),w=V(async()=>{try{let{default:q}=await import("axios");return await q.head("http://1.1.1.1",{signal:AbortSignal.timeout(1000)}),!0}catch{return!1}});j=V(async()=>{let q=[];if(await X("npm"))q.push("npm");if(await X("yarn"))q.push("yarn");if(await X("pnpm"))q.push("pnpm");return q}),S=V(async()=>{let q=[];if(await X("bun"))q.push("bun");if(await X("deno"))q.push("deno");if(await X("node"))q.push("node");return q}),H=V(()=>{try{return Y().existsSync("/proc/sys/fs/binfmt_misc/WSLInterop")}catch(q){return!1}}),A=V(()=>{try{if(!H())return!1;let{cmd:q}=W("npm",[]);return q.startsWith("/mnt/c/")}catch(q){return!1}});I=["pycharm","intellij","webstorm","phpstorm","rubymine","clion","goland","rider","datagrip","appcode","dataspell","aqua","gateway","fleet","jetbrains","androidstudio"];C=V(()=>{if(G(process.env.CODESPACES))return"codespaces";if(process.env.GITPOD_WORKSPACE_ID)return"gitpod";if(process.env.REPL_ID||process.env.REPL_SLUG)return"replit";if(process.env.PROJECT_DOMAIN)return"glitch";if(G(process.env.VERCEL))return"vercel";if(process.env.RAILWAY_ENVIRONMENT_NAME||process.env.RAILWAY_SERVICE_NAME)return"railway";if(G(process.env.RENDER))return"render";if(G(process.env.NETLIFY))return"netlify";if(process.env.DYNO)return"heroku";if(process.env.FLY_APP_NAME||process.env.FLY_MACHINE_ID)return"fly.io";if(G(process.env.CF_PAGES))return"cloudflare-pages";if(process.env.DENO_DEPLOYMENT_ID)return"deno-deploy";if(process.env.AWS_LAMBDA_FUNCTION_NAME)return"aws-lambda";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_FARGATE")return"aws-fargate";if(process.env.AWS_EXECUTION_ENV==="AWS_ECS_EC2")return"aws-ecs";try{if(Y().readFileSync("/sys/hypervisor/uuid",{encoding:"utf8"}).trim().toLowerCase().startsWith("ec2"))return"aws-ec2"}catch{}if(process.env.K_SERVICE)return"gcp-cloud-run";if(process.env.GOOGLE_CLOUD_PROJECT)return"gcp";if(process.env.WEBSITE_SITE_NAME||process.env.WEBSITE_SKU)return"azure-app-service";if(process.env.AZURE_FUNCTIONS_ENVIRONMENT)return"azure-functions";if(process.env.APP_URL?.includes("ondigitalocean.app"))return"digitalocean-app-platform";if(process.env.SPACE_CREATOR_USER_ID)return"huggingface-spaces";if(G(process.env.GITHUB_ACTIONS))return"github-actions";if(G(process.env.GITLAB_CI))return"gitlab-ci";if(process.env.CIRCLECI)return"circleci";if(process.env.BUILDKITE)return"buildkite";if(G(process.env.CI))return"ci";if(process.env.KUBERNETES_SERVICE_HOST)return"kubernetes";try{if(Y().existsSync("/.dockerenv"))return"docker"}catch{}if(Z.platform==="darwin")return"unknown-darwin";if(Z.platform==="linux")return"unknown-linux";if(Z.platform==="win32")return"unknown-win32";return"unknown"});Z={hasInternetAccess:w,isCI:G(process.env.CI),platform:["win32","darwin"].includes(process.platform)?process.platform:"linux",arch:process.arch,nodeVersion:process.version,terminal:x(),isSSH:O,getPackageManagers:j,getRuntimes:S,isRunningWithBun:V(L),isWslEnvironment:H,isNpmFromWindowsPath:A,isConductor:y,detectDeploymentEnvironment:C}});
3
+ export{L as j9,b as k9,N as l9,W as m9,_ as n9,a as o9,I as p9,Z as q9,s as r9,T as s9};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ga as oY}from"./cli-mq300hkq.js";import{Na as aY}from"./cli-a72n4ej7.js";import{tg as q0,ug as b9}from"./cli-bz32070f.js";import{$k as dY,AC as y0,AJ as E0,BC as M9,DF as NY,Dk as RZ,Ek as uZ,Ep as JY,Fk as LZ,Fp as XW,GE as LY,GF as GW,Gk as pZ,Hl as JZ,Kl as KZ,Ll as _Y,ME as P0,MJ as T0,OE as U0,RG as D0,Ru as KY,SE as j0,St as vY,Su as JW,TJ as rY,Tt as VW,Uv as GY,VA as mY,WA as X9,WD as J0,Xv as HY,YE as QZ,Yv as VZ,ZD as q9,_A as x,_G as $0,aB as E9,aH as b0,al as Q9,aw as KW,eD as k0,eH as C9,eK as nY,em as v0,gD as S0,gm as D9,hE as FZ,it as qY,jt as jZ,kD as f0,kF as lY,kt as OY,lE as m,lJ as iY,lt as FY,mF as J9,mJ as K9,mt as yY,nt as PY,oC as O0,ot as DZ,pC as T9,pt as $Z,qt as UY,rD as h9,rE as ZZ,rt as jY,st as DY,tt as $Y,up as V0,ut as bY,vE as yZ,vt as EY,wt as TY,xp as $9,xt as MY,yt as CY,zC as F0,zt as FW}from"./cli-5pb6kdxn.js";import{YN as QY,ZN as WW}from"./cli-mejr8b5m.js";import{HO as ZY,IO as ZW,VO as YY,WO as WY,XO as YW,bP as XY,cP as QW}from"./cli-s6qk3rbv.js";import{GQ as M,IQ as U,iR as e0}from"./cli-5wh173wa.js";import{VS as N0,WS as B0,XS as P9,fT as A0,sT as U9}from"./cli-dr1ph0pp.js";import{$T as k9,CV as Z0,CW as W0,CY as v9,DV as Y0,FT as C0,GV as z9,KW as _9,T0 as X0,V1 as V9,hV as R0,oV as f9,yY as Q0}from"./cli-9hskw92e.js";import{t4 as vZ,v4 as t0}from"./cli-v2hg35qk.js";import{I5 as w,J5 as zY}from"./cli-avcnnw0n.js";import{$5 as dZ,h6 as mZ,l6 as a0}from"./cli-dx46fn1w.js";import{K6 as gY,M6 as W9,_6 as I0,w7 as S9}from"./cli-nj726gac.js";import{B8 as eZ,G7 as _Z,J7 as lZ,K7 as iZ,L7 as rZ,M7 as nZ,P7 as aZ,Q7 as oZ,a8 as sZ,g8 as o0,l8 as tZ,o8 as s0,w8 as l}from"./cli-3bxtq5dc.js";import{I8 as eY,J8 as w9}from"./cli-mx6xk0dw.js";import{U8 as g,V8 as OZ}from"./cli-s5epnnj5.js";import{$9 as HZ,L9 as xY,T9 as M0,Z9 as uY,a_ as pY,d_ as EZ,r_ as d,u_ as PZ}from"./cli-a98b285v.js";import{A_ as Y9,w_ as cY}from"./cli-jmypsed1.js";import{Yca as L0,Zca as MZ,a$ as sY,g$ as kZ,paa as tY}from"./cli-w754xmyv.js";import{ada as r0,bda as n0,cda as z0}from"./cli-x514vyva.js";var _W={};r0(_W,{selectableUserMessagesFilter:()=>wY,messagesAfterAreOnlySynthetic:()=>zW,MessageSelector:()=>LW});import{c as XZ}from"react/compiler-runtime";import{randomUUID as HW}from"crypto";import AZ from"figures";import{useCallback as o,useEffect as wZ,useMemo as cZ,useState as c}from"react";import*as s from"path";import{jsxDEV as N,Fragment as h}from"react/jsx-dev-runtime";function BY(W){return W.type==="text"}function qZ(W){return W==="summarize"||W==="summarize_up_to"}function LW({messages:W,onPreRestore:Y,onRestoreMessage:Q,onRestoreCode:X,onSummarize:J,onClose:H,preselectedMessage:G}){let L=NY((v)=>v.fileHistory),[B,z]=c(void 0),K=GY(),A=cZ(HW,[]),q=cZ(()=>[...W.filter(wY),{...m({content:""}),uuid:A}],[W,A]),[O,V]=c(q.length-1),j=Math.max(0,Math.min(O-Math.floor(zZ/2),q.length-zZ)),k=q.length>1,[_,b]=c(G),[P,S]=c(void 0);wZ(()=>{if(!G||!K)return;let v=!1;return VZ(L,G.uuid).then(($)=>{if(!v)S($)}),()=>{v=!0}},[G,K,L]);let[F,D]=c(!1),[u,i]=c(null),[t,e]=c("both"),[NZ,n]=c(""),[y,C]=c("");function E(v){let $=v?[{value:"both",label:"Restore code and conversation"},{value:"conversation",label:"Restore conversation"},{value:"code",label:"Restore code"}]:[{value:"conversation",label:"Restore conversation"}],I={type:"input",placeholder:"add context (optional)",initialValue:"",allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:": "};return $.push({value:"summarize",label:"Summarize from here",...I,onChange:n}),$.push({value:"nevermind",label:"Never mind"}),$}wZ(()=>{g("tengu_message_selector_opened",{})},[]);async function f(v){Y(),D(!0);try{await Q(v),D(!1),H()}catch($){l($),D(!1),z(`Failed to restore the conversation:
2
+ import{Ga as oY}from"./cli-mq300hkq.js";import{Na as aY}from"./cli-m12smc5e.js";import{tg as q0,ug as b9}from"./cli-yrwenjxs.js";import{$k as dY,AF as NY,DE as LY,DF as GW,Dk as RZ,Ek as uZ,Ep as JY,Fk as LZ,Fp as XW,Gk as pZ,Hl as JZ,JE as P0,JJ as T0,Kl as KZ,LE as U0,Ll as _Y,OG as D0,Ou as KY,PE as j0,Pt as vY,Pu as JW,QJ as rY,Qt as VW,Rv as GY,SA as mY,TA as X9,TD as J0,Uv as HY,VE as QZ,Vv as VZ,WD as q9,XA as x,XG as $0,ZA as E9,ZG as b0,Zv as KW,al as Q9,bD as k0,bH as C9,bK as nY,dD as S0,eE as FZ,em as v0,ft as qY,gm as D9,gt as jZ,hD as f0,hF as lY,ht as OY,iE as m,iJ as iY,it as FY,jF as J9,jJ as K9,jt as yY,kt as PY,lC as O0,lt as DZ,mC as T9,mt as $Z,nt as UY,oD as h9,oE as ZZ,ot as jY,pt as DY,qt as $Y,rt as bY,sE as yZ,st as EY,tt as TY,up as V0,ut as MY,vt as CY,wC as F0,wt as FW,xC as y0,xJ as E0,xp as $9,yC as M9}from"./cli-me4e2p3e.js";import{aO as QY,bO as WW}from"./cli-6yprtw88.js";import{$O as QW,EO as ZY,FO as ZW,SO as YY,TO as WY,UO as YW,_O as XY}from"./cli-akcxtvv9.js";import{DQ as M,FQ as U,fR as e0}from"./cli-x8xgga1a.js";import{YS as N0,ZS as B0,_S as P9,iT as A0,vT as U9}from"./cli-jegyadmb.js";import{BY as Q0,D0 as X0,F1 as V9,FV as Z0,FW as W0,FY as v9,GV as Y0,IT as C0,JV as z9,NW as _9,cU as k9,kV as R0,rV as f9}from"./cli-msmzt4c3.js";import{d4 as vZ,f4 as t0}from"./cli-s6vr7213.js";import{$4 as w,a5 as zY}from"./cli-fakdskp6.js";import{d6 as dZ,l6 as mZ,p6 as a0}from"./cli-51720d82.js";import{A7 as S9,O6 as gY,Q6 as W9,c7 as I0}from"./cli-fdya77ch.js";import{L7 as eY,M7 as w9}from"./cli-rvad3yhg.js";import{E8 as l,J8 as eZ,O7 as _Z,R7 as lZ,S7 as iZ,T7 as rZ,U7 as nZ,X7 as aZ,Y7 as oZ,i8 as sZ,o8 as o0,t8 as tZ,w8 as s0}from"./cli-4ewb3q42.js";import{Y8 as g,Z8 as OZ}from"./cli-t9jht3kb.js";import{P9 as xY,X9 as M0,b_ as uY,d_ as HZ,e_ as pY,h_ as EZ,v_ as d,y_ as PZ}from"./cli-hke6r0q8.js";import{A_ as cY,E_ as Y9}from"./cli-x70v8rsj.js";import{ada as L0,bda as MZ,e$ as sY,k$ as kZ,taa as tY}from"./cli-3ac555qw.js";import{eda as r0,fda as n0,gda as z0}from"./cli-w1d8n9g3.js";var _W={};r0(_W,{selectableUserMessagesFilter:()=>wY,messagesAfterAreOnlySynthetic:()=>zW,MessageSelector:()=>LW});import{c as XZ}from"react/compiler-runtime";import{randomUUID as HW}from"crypto";import AZ from"figures";import{useCallback as o,useEffect as wZ,useMemo as cZ,useState as c}from"react";import*as s from"path";import{jsxDEV as N,Fragment as h}from"react/jsx-dev-runtime";function BY(W){return W.type==="text"}function qZ(W){return W==="summarize"||W==="summarize_up_to"}function LW({messages:W,onPreRestore:Y,onRestoreMessage:Q,onRestoreCode:X,onSummarize:J,onClose:H,preselectedMessage:G}){let L=NY((v)=>v.fileHistory),[B,z]=c(void 0),K=GY(),A=cZ(HW,[]),q=cZ(()=>[...W.filter(wY),{...m({content:""}),uuid:A}],[W,A]),[O,V]=c(q.length-1),j=Math.max(0,Math.min(O-Math.floor(zZ/2),q.length-zZ)),k=q.length>1,[_,b]=c(G),[P,S]=c(void 0);wZ(()=>{if(!G||!K)return;let v=!1;return VZ(L,G.uuid).then(($)=>{if(!v)S($)}),()=>{v=!0}},[G,K,L]);let[F,D]=c(!1),[u,i]=c(null),[t,e]=c("both"),[NZ,n]=c(""),[y,C]=c("");function E(v){let $=v?[{value:"both",label:"Restore code and conversation"},{value:"conversation",label:"Restore conversation"},{value:"code",label:"Restore code"}]:[{value:"conversation",label:"Restore conversation"}],I={type:"input",placeholder:"add context (optional)",initialValue:"",allowEmptySubmitToCancel:!0,showLabelWithValue:!0,labelValueSeparator:": "};return $.push({value:"summarize",label:"Summarize from here",...I,onChange:n}),$.push({value:"nevermind",label:"Never mind"}),$}wZ(()=>{g("tengu_message_selector_opened",{})},[]);async function f(v){Y(),D(!0);try{await Q(v),D(!1),H()}catch($){l($),D(!1),z(`Failed to restore the conversation:
3
3
  ${$}`)}}async function r(v){let $=W.indexOf(v),I=W.length-1-$;if(g("tengu_message_selector_selected",{index_from_end:I,message_type:v.type,is_current_prompt:!1}),!W.includes(v)){H();return}if(!K){await f(v);return}let R=await VZ(L,v.uuid);b(v),S(R)}async function x0(v){if(g("tengu_message_selector_restore_option_selected",{option:v}),!_){z("Message not found.");return}if(v==="nevermind"){if(G)H();else b(void 0);return}if(qZ(v)){Y(),D(!0),i(v),z(void 0);try{let R=v==="summarize_up_to"?"up_to":"from",a=(R==="up_to"?y:NZ).trim()||void 0;await J(_,a,R),D(!1),i(null),b(void 0),H()}catch(R){l(R),D(!1),i(null),b(void 0),z(`Failed to summarize:
4
4
  ${R}`)}return}Y(),D(!0),z(void 0);let $=null,I=null;if(v==="code"||v==="both")try{await X(_)}catch(R){$=R,l($)}if(v==="conversation"||v==="both")try{await Q(_)}catch(R){I=R,l(I)}if(D(!1),b(void 0),I&&$)z(`Failed to restore the conversation and code:
5
5
  ${I}
@@ -12,5 +12,5 @@ ${$}`);else H()}let SZ=QY(),u0=o(()=>{if(_&&!G){b(void 0);return}g("tengu_messag
12
12
  `);if(Q===-1)break;let X=W.slice(0,Q);W=W.slice(Q+1);let J=await this.processLine(X);if(J)gY("info","cli_stdin_message_parsed",{type:J.type}),yield J}}.bind(this);yield*Y();for await(let Q of this.input)W+=Q,yield*Y();if(W){let Q=await this.processLine(W);if(Q)yield Q}this.inputClosed=!0;for(let Q of this.pendingRequests.values())Q.reject(Error("Tool permission stream closed before response received"))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map((W)=>W.request).filter((W)=>W.request.subtype==="can_use_tool")}setUnexpectedResponseCallback(W){this.unexpectedResponseCallback=W}injectControlResponse(W){let Y=W.response?.request_id;if(!Y)return;let Q=this.pendingRequests.get(Y);if(!Q)return;if(this.trackResolvedToolUseId(Q.request),this.pendingRequests.delete(Y),this.write({type:"control_cancel_request",request_id:Y}),W.response.subtype==="error")Q.reject(Error(W.response.error));else{let X=W.response.response;if(Q.schema)try{Q.resolve(Q.schema.parse(X))}catch(J){Q.reject(J)}else Q.resolve({})}}setOnControlRequestSent(W){this.onControlRequestSent=W}setOnControlRequestResolved(W){this.onControlRequestResolved=W}async processLine(W){if(!W)return;try{let Y=oY(pY(W));if(Y.type==="keep_alive")return;if(Y.type==="update_environment_variables"){let Q=Object.keys(Y.variables);for(let[X,J]of Object.entries(Y.variables))process.env[X]=J;d(`[structuredIO] applied update_environment_variables: ${Q.join(", ")}`);return}if(Y.type==="control_response"){let Q="uuid"in Y&&typeof Y.uuid==="string"?Y.uuid:void 0;if(Q)dY(Q,"completed");let X=this.pendingRequests.get(Y.response.request_id);if(!X){let G=(Y.response.subtype==="success"?Y.response.response:void 0)?.toolUseID;if(typeof G==="string"&&this.resolvedToolUseIds.has(G)){d(`Ignoring duplicate control_response for already-resolved toolUseID=${G} request_id=${Y.response.request_id}`);return}if(this.unexpectedResponseCallback)await this.unexpectedResponseCallback(Y);return}if(this.trackResolvedToolUseId(X.request),this.pendingRequests.delete(Y.response.request_id),X.request.request.subtype==="can_use_tool"&&this.onControlRequestResolved)this.onControlRequestResolved(Y.response.request_id);if(Y.response.subtype==="error"){X.reject(Error(Y.response.error));return}let J=Y.response.response;if(X.schema)try{X.resolve(X.schema.parse(J))}catch(H){X.reject(H)}else X.resolve({});if(this.replayUserMessages)return Y;return}if(Y.type!=="user"&&Y.type!=="control_request"&&Y.type!=="assistant"&&Y.type!=="system"){d(`Ignoring unknown message type: ${Y.type}`,{level:"warn"});return}if(Y.type==="control_request"){if(!Y.request)hY("Error: Missing request on control_request");return Y}if(Y.type==="assistant"||Y.type==="system")return Y;if(Y.message.role!=="user")hY(`Error: Expected message role 'user', got '${Y.message.role}'`);return Y}catch(Y){console.error(`Error parsing streaming input line: ${W}: ${Y}`),process.exit(1)}}async write(W){cY(SY(W)+`
13
13
  `)}async sendRequest(W,Y,Q,X=TZ()){let J={type:"control_request",request_id:X,request:W};if(this.inputClosed)throw Error("Stream closed");if(Q?.aborted)throw Error("Request aborted");if(this.outbound.enqueue(J),W.subtype==="can_use_tool"&&this.onControlRequestSent)this.onControlRequestSent(J);let H=()=>{this.outbound.enqueue({type:"control_cancel_request",request_id:X});let G=this.pendingRequests.get(X);if(G)this.trackResolvedToolUseId(G.request),G.reject(new xY)};if(Q)Q.addEventListener("abort",H,{once:!0});try{return await new Promise((G,L)=>{this.pendingRequests.set(X,{request:{type:"control_request",request_id:X,request:W},resolve:(B)=>{G(B)},reject:L,schema:Y})})}finally{if(Q)Q.removeEventListener("abort",H);this.pendingRequests.delete(X)}}createCanUseTool(W){return async(Y,Q,X,J,H,G)=>{let L=G??await lY(Y,Q,X,J,H);if(L.behavior==="allow"||L.behavior==="deny")return L;let B=new AbortController,z=X.abortController.signal,K=()=>B.abort();z.addEventListener("abort",K,{once:!0});try{let A=A9(Y.name,H,Q,X,L.suggestions).then((j)=>({source:"hook",decision:j})),q=TZ();W?.(L9(Y,Q,H,q));let O=this.sendRequest({subtype:"can_use_tool",tool_name:Y.name,input:Q,permission_suggestions:L.suggestions,blocked_path:L.blockedPath,decision_reason:H9(L.decisionReason),tool_use_id:H,agent_id:X.agentId},UZ(),B.signal,q).then((j)=>({source:"sdk",result:j})),V=await Promise.race([A,O]);if(V.source==="hook"){if(V.decision)return O.catch(()=>{}),B.abort(),V.decision;let j=await O;return GZ(j.result,Y,Q,X)}return GZ(V.result,Y,Q,X)}catch(A){return GZ({behavior:"deny",message:`Tool permission request failed: ${A}`,toolUseID:H},Y,Q,X)}finally{if(this.getPendingPermissionRequests().length===0)aY("running");z.removeEventListener("abort",K)}}}createHookCallback(W,Y){return{type:"callback",timeout:Y,callback:async(Q,X,J)=>{try{return await this.sendRequest({subtype:"hook_callback",callback_id:W,input:Q,tool_use_id:X||void 0},iY(),J)}catch(H){return console.error(`Error in hook callback ${W}:`,H),{}}}}}async handleElicitation(W,Y,Q,X,J,H,G){try{return await this.sendRequest({subtype:"elicitation",mcp_server_name:W,message:Y,mode:J,url:H,elicitation_id:G,requested_schema:Q},IY(),X)}catch{return{action:"cancel"}}}createSandboxAskCallback(){return async(W)=>{try{return(await this.sendRequest({subtype:"can_use_tool",tool_name:G9,input:{host:W.host},tool_use_id:TZ(),description:`Allow network connection to ${W.host}?`},UZ())).behavior==="allow"}catch{return!1}}}async sendMcpMessage(W,Y){return(await this.sendRequest({subtype:"mcp_message",server_name:W,message:Y},fY.object({mcp_response:fY.any()}))).mcp_response}}function hY(W){console.error(W),process.exit(1)}async function A9(W,Y,Q,X,J){let G=X.getAppState().toolPermissionContext.mode,L=rY(W,Y,Q,X,G,J,X.abortController.signal);for await(let B of L)if(B.permissionRequestResult&&(B.permissionRequestResult.behavior==="allow"||B.permissionRequestResult.behavior==="deny")){let z=B.permissionRequestResult;if(z.behavior==="allow"){let K=z.updatedInput||Q,A=z.updatedPermissions??[];if(A.length>0){KZ(A);let q=X.getAppState(),O=JZ(q.toolPermissionContext,A);X.setAppState((V)=>{if(V.toolPermissionContext===O)return V;return{...V,toolPermissionContext:O}})}return{behavior:"allow",updatedInput:K,userModified:!1,decisionReason:{type:"hook",hookName:"PermissionRequest"}}}else return{behavior:"deny",message:z.message||"Permission denied by PermissionRequest hook",decisionReason:{type:"hook",hookName:"PermissionRequest"}}}return}MZ();q9();z9();V9();w9();v9();_9();import{randomUUID as O9}from"crypto";function F9(W){return W===Z0?Y0:W}function B6(W){let Q=W0()?.outputStyle??J0,X={type:"system",subtype:"init",cwd:eY(),session_id:sY(),tools:W.tools.map((J)=>F9(J.name)),mcp_servers:W.mcpClients.map((J)=>({name:J.name,status:J.type})),model:W.model,permissionMode:W.permissionMode,slash_commands:W.commands.filter((J)=>J.userInvocable!==!1).map((J)=>J.name),apiKeySource:X0().source,betas:tY(),claude_code_version:MACRO.VERSION,output_style:Q,agents:W.agents.map((J)=>J.agentType),skills:W.skills.filter((J)=>J.userInvocable!==!1).map((J)=>J.name),plugins:W.plugins.map((J)=>({name:J.name,path:J.path,source:J.source})),uuid:O9()};return X.fast_mode_state=Q0(W.model,W.fastMode),X}var K0={"`":"`",'"':'"',"<":">","{":"}","[":"]","(":")","'":"'"};function y9(W,Y){if(!new RegExp(Y,"i").test(W))return[];if(W.startsWith("/"))return[];let X=[],J=null,H=0,G=(K)=>!!K&&/[\p{L}\p{N}_]/u.test(K);for(let K=0;K<W.length;K++){let A=W[K];if(J){if(J==="["&&A==="["){H=K;continue}if(A!==K0[J])continue;if(J==="'"&&G(W[K+1]))continue;X.push({start:H,end:K+1}),J=null}else if(A==="<"&&K+1<W.length&&/[a-zA-Z/]/.test(W[K+1])||A==="'"&&!G(W[K-1])||A!=="<"&&A!=="'"&&A in K0)J=A,H=K}let L=[],B=new RegExp(`\\b${Y}\\b`,"gi"),z=W.matchAll(B);for(let K of z){if(K.index===void 0)continue;let A=K.index,q=A+K[0].length;if(X.some((j)=>A>=j.start&&A<j.end))continue;let O=W[A-1],V=W[q];if(O==="/"||O==="\\"||O==="-")continue;if(V==="/"||V==="\\"||V==="-"||V==="?")continue;if(V==="."&&G(W[q+1]))continue;L.push({word:K[0],start:A,end:q})}return L}function w6(W){return y9(W,"ultrareview")}OZ();QZ();C9();T9();M9();D9();nY();pZ();$9();QZ();E9();b9();import{randomUUID as I9}from"crypto";MZ();OZ();QZ();P9();U9();import{randomUUID as j9}from"crypto";function G0(W){let Y=W.toLowerCase();return/\b(wtf|wth|ffs|omfg|shit(ty|tiest)?|dumbass|horrible|awful|piss(ed|ing)? off|piece of (shit|crap|junk)|what the (fuck|hell)|fucking? (broken|useless|terrible|awful|horrible)|fuck you|screw (this|you)|so frustrating|this sucks|damn it)\b/.test(Y)}function H0(W){let Y=W.toLowerCase().trim();if(Y==="continue")return!0;return/\b(keep going|go on)\b/.test(Y)}function w0(W,Y,Q,X,J,H,G){let L=j9();L0(L);let B=typeof W==="string"?W:W.find((O)=>O.type==="text")?.text||"";A0(B);let z=typeof W==="string"?W:W.findLast((O)=>O.type==="text")?.text||"";if(z)B0("user_prompt",{prompt_length:String(z.length),prompt:N0(z),"prompt.id":L});let K=G0(B),A=H0(B);if(g("tengu_input_prompt",{is_negative:K,is_keep_going:A}),Y.length>0){let O=typeof W==="string"?W.trim()?[{type:"text",text:W}]:[]:W;return{messages:[m({content:[...O,...Y],uuid:J,imagePasteIds:Q.length>0?Q:void 0,permissionMode:H,isMeta:G||void 0}),...X],shouldQuery:!0}}return{messages:[m({content:W,uuid:J,permissionMode:H,isMeta:G||void 0}),...X],shouldQuery:!0}}async function g6({input:W,preExpansionInput:Y,mode:Q,setToolJSX:X,context:J,pastedContents:H,ideSelection:G,messages:L,setUserInputOnProcessing:B,uuid:z,isAlreadyProcessing:K,querySource:A,canUseTool:q,skipSlashCommands:O,bridgeOrigin:V,isMeta:j,skipAttachments:k}){let _=typeof W==="string"?W:null;if(Q==="prompt"&&_!==null&&!j)B?.(_);x("query_process_user_input_base_start");let b=J.getAppState(),P=await R9(W,Q,X,J,H,G,L,z,K,A,q,b.toolPermissionContext.mode,O,V,j,k,Y);if(x("query_process_user_input_base_end"),!P.shouldQuery)return P;x("query_hooks_start");let S=P0(W)||"";for await(let F of T0(S,b.toolPermissionContext.mode,J,J.requestPrompt)){if(F.message?.type==="progress")continue;if(F.blockingError){let D=E0(F.blockingError);return{messages:[U0(`${D}
14
14
 
15
- Original prompt: ${W}`,"warning")],shouldQuery:!1,allowedTools:P.allowedTools}}if(F.preventContinuation){let D=F.stopReason?`Operation stopped by hook: ${F.stopReason}`:"Operation stopped by hook";return P.messages.push(m({content:D})),P.shouldQuery=!1,P}if(F.additionalContexts&&F.additionalContexts.length>0)P.messages.push(y0({type:"hook_additional_context",content:F.additionalContexts.map(_0),hookName:"UserPromptSubmit",toolUseID:`hook-${I9()}`,hookEvent:"UserPromptSubmit"}));if(F.message)switch(F.message.attachment.type){case"hook_success":if(!F.message.attachment.content)break;P.messages.push({...F.message,attachment:{...F.message.attachment,content:_0(F.message.attachment.content)}});break;default:P.messages.push(F.message);break}}return x("query_hooks_end"),P}var CZ=1e4;function _0(W){if(W.length>CZ)return`${W.substring(0,CZ)}\u2026 [output truncated - exceeded ${CZ} characters]`;return W}async function R9(W,Y,Q,X,J,H,G,L,B,z,K,A,q,O,V,j,k){let _=null,b=[],P=[],S=W;if(typeof W==="string")_=W;else if(W.length>0){x("query_image_processing_start");let y=[];for(let E of W)if(E.type==="image"){let f=await RZ(E);if(f.dimensions){let r=LZ(f.dimensions);if(r)P.push(r)}y.push(f.block)}else y.push(E);S=y,x("query_image_processing_end");let C=y[y.length-1];if(C?.type==="text")_=C.text,b=y.slice(0,-1);else b=y}if(_===null&&Y!=="prompt")throw Error(`Mode: ${Y} requires a string input.`);let F=J?Object.values(J).filter(O0):[],D=F.map((y)=>y.id),u=J?await V0(J):new Map;x("query_pasted_image_processing_start");let i=await Promise.all(F.map(async(y)=>{let C={type:"image",source:{type:"base64",media_type:y.mediaType||"image/png",data:y.content}};return g("tengu_pasted_image_resize_attempt",{original_size_bytes:y.content.length}),{resized:await RZ(C),originalDimensions:y.dimensions,sourcePath:y.sourcePath??u.get(y.id)}})),t=[];for(let{resized:y,originalDimensions:C,sourcePath:E}of i){if(y.dimensions){let f=LZ(y.dimensions,E);if(f)P.push(f)}else if(C){let f=LZ(C,E);if(f)P.push(f)}else if(E)P.push(`[Image source: ${E}]`);t.push(y.block)}x("query_pasted_image_processing_end");let e=q;if(O&&_!==null&&_.startsWith("/")){let y=q0(_),C=y?b0(y.commandName,X.options.commands):void 0;if(C)if($0(C))e=!1;else{let E=`/${D0(C)} isn't available over Remote Control.`;return{messages:[m({content:_,uuid:L}),j0(`<local-command-stdout>${E}</local-command-stdout>`)],shouldQuery:!1,resultText:E}}}let NZ=!j&&_!==null&&(Y!=="prompt"||e||!_.startsWith("/"));x("query_attachment_loading_start");let n=NZ?await v0(F0(_,X,H??null,[],G,z)):[];if(x("query_attachment_loading_end"),_!==null&&Y==="bash"){let{processBashCommand:y}=await import("./processBashCommand-hnhy8brr.js");return IZ(await y(_,b,n,X,Q),P)}if(_!==null&&!e&&_.startsWith("/")){let{processSlashCommand:y}=await import("./processSlashCommand-6d8rnm8v.js"),C=await y(_,b,t,n,X,Q,L,B,K);return IZ(C,P)}if(_!==null&&Y==="prompt"){let y=_.trim(),C=n.find((E)=>E.attachment.type==="agent_mention");if(C){let E=`@agent-${C.attachment.agentType}`,f=y===E,r=y.startsWith(E)&&!f;g("tengu_subagent_at_mention",{is_subagent_only:f,is_prefix:r})}}return IZ(w0(S,t,D,n,L,A,V),P)}function IZ(W,Y){if(Y.length>0)W.messages.push(m({content:Y.map((Q)=>({type:"text",text:Q})),isMeta:!0}));return W}MZ();PZ();uY();k9();S9();eZ();h9();f9();import x9 from"lodash-es/isEqual.js";import{isAbsolute as u9,resolve as p9}from"path";function c9(W,Y,Q){let X=[],J=[],H=[];for(let[G,L]of Object.entries(W)){let B=Y[G],z=h0(L.source,Q?.projectRoot);if(!B)X.push(G);else if(L.sourceIsFallback)H.push(G);else if(!x9(z,B.source))J.push({name:G,declaredSource:z,materializedSource:B.source});else H.push(G)}return{missing:X,sourceChanged:J,upToDate:H}}async function ZX(W){let Y=k0();if(Object.keys(Y).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let Q;try{Q=await S0()}catch(K){l(K),Q={}}let X=c9(Y,Q,{projectRoot:kZ()}),J=[...X.missing.map((K)=>({name:K,source:h0(Y[K].source),action:"install"})),...X.sourceChanged.map(({name:K,declaredSource:A})=>({name:K,source:A,action:"update"}))],H=[],G=[];for(let K of J){if(W?.skip?.(K.name,K.source)){H.push(K.name);continue}if(K.action==="update"&&R0(K.source)&&!await C0(K.source.path)){d(`[reconcile] '${K.name}' declared path does not exist; keeping materialized entry`),H.push(K.name);continue}G.push(K)}if(G.length===0)return{installed:[],updated:[],failed:[],upToDate:X.upToDate,skipped:H};d(`[reconcile] ${G.length} marketplace(s): ${G.map((K)=>`${K.name}(${K.action})`).join(", ")}`);let L=[],B=[],z=[];for(let K=0;K<G.length;K++){let{name:A,source:q,action:O}=G[K];W?.onProgress?.({type:"installing",name:A,action:O,index:K+1,total:G.length});try{let V=await f0(q);if(O==="install")L.push(A);else B.push(A);W?.onProgress?.({type:"installed",name:A,alreadyMaterialized:V.alreadyMaterialized})}catch(V){let j=M0(V);z.push({name:A,error:j}),W?.onProgress?.({type:"failed",name:A,error:j}),l(V)}}return{installed:L,updated:B,failed:z,upToDate:X.upToDate,skipped:H}}function h0(W,Y){if((W.source==="directory"||W.source==="file")&&!u9(W.path)){let Q=Y??kZ(),X=I0(Q);return{...W,path:p9(X??Q,W.path)}}return W}
16
- export{d9 as ia,F9 as ja,B6 as ka,LW as la,wY as ma,zW as na,_W as oa,vW as pa,w6 as qa,g6 as ra,UZ as sa,GZ as ta,SY as ua,B9 as va,c9 as wa,ZX as xa};
15
+ Original prompt: ${W}`,"warning")],shouldQuery:!1,allowedTools:P.allowedTools}}if(F.preventContinuation){let D=F.stopReason?`Operation stopped by hook: ${F.stopReason}`:"Operation stopped by hook";return P.messages.push(m({content:D})),P.shouldQuery=!1,P}if(F.additionalContexts&&F.additionalContexts.length>0)P.messages.push(y0({type:"hook_additional_context",content:F.additionalContexts.map(_0),hookName:"UserPromptSubmit",toolUseID:`hook-${I9()}`,hookEvent:"UserPromptSubmit"}));if(F.message)switch(F.message.attachment.type){case"hook_success":if(!F.message.attachment.content)break;P.messages.push({...F.message,attachment:{...F.message.attachment,content:_0(F.message.attachment.content)}});break;default:P.messages.push(F.message);break}}return x("query_hooks_end"),P}var CZ=1e4;function _0(W){if(W.length>CZ)return`${W.substring(0,CZ)}\u2026 [output truncated - exceeded ${CZ} characters]`;return W}async function R9(W,Y,Q,X,J,H,G,L,B,z,K,A,q,O,V,j,k){let _=null,b=[],P=[],S=W;if(typeof W==="string")_=W;else if(W.length>0){x("query_image_processing_start");let y=[];for(let E of W)if(E.type==="image"){let f=await RZ(E);if(f.dimensions){let r=LZ(f.dimensions);if(r)P.push(r)}y.push(f.block)}else y.push(E);S=y,x("query_image_processing_end");let C=y[y.length-1];if(C?.type==="text")_=C.text,b=y.slice(0,-1);else b=y}if(_===null&&Y!=="prompt")throw Error(`Mode: ${Y} requires a string input.`);let F=J?Object.values(J).filter(O0):[],D=F.map((y)=>y.id),u=J?await V0(J):new Map;x("query_pasted_image_processing_start");let i=await Promise.all(F.map(async(y)=>{let C={type:"image",source:{type:"base64",media_type:y.mediaType||"image/png",data:y.content}};return g("tengu_pasted_image_resize_attempt",{original_size_bytes:y.content.length}),{resized:await RZ(C),originalDimensions:y.dimensions,sourcePath:y.sourcePath??u.get(y.id)}})),t=[];for(let{resized:y,originalDimensions:C,sourcePath:E}of i){if(y.dimensions){let f=LZ(y.dimensions,E);if(f)P.push(f)}else if(C){let f=LZ(C,E);if(f)P.push(f)}else if(E)P.push(`[Image source: ${E}]`);t.push(y.block)}x("query_pasted_image_processing_end");let e=q;if(O&&_!==null&&_.startsWith("/")){let y=q0(_),C=y?b0(y.commandName,X.options.commands):void 0;if(C)if($0(C))e=!1;else{let E=`/${D0(C)} isn't available over Remote Control.`;return{messages:[m({content:_,uuid:L}),j0(`<local-command-stdout>${E}</local-command-stdout>`)],shouldQuery:!1,resultText:E}}}let NZ=!j&&_!==null&&(Y!=="prompt"||e||!_.startsWith("/"));x("query_attachment_loading_start");let n=NZ?await v0(F0(_,X,H??null,[],G,z)):[];if(x("query_attachment_loading_end"),_!==null&&Y==="bash"){let{processBashCommand:y}=await import("./processBashCommand-8fqgv2ec.js");return IZ(await y(_,b,n,X,Q),P)}if(_!==null&&!e&&_.startsWith("/")){let{processSlashCommand:y}=await import("./processSlashCommand-q32wy80b.js"),C=await y(_,b,t,n,X,Q,L,B,K);return IZ(C,P)}if(_!==null&&Y==="prompt"){let y=_.trim(),C=n.find((E)=>E.attachment.type==="agent_mention");if(C){let E=`@agent-${C.attachment.agentType}`,f=y===E,r=y.startsWith(E)&&!f;g("tengu_subagent_at_mention",{is_subagent_only:f,is_prefix:r})}}return IZ(w0(S,t,D,n,L,A,V),P)}function IZ(W,Y){if(Y.length>0)W.messages.push(m({content:Y.map((Q)=>({type:"text",text:Q})),isMeta:!0}));return W}MZ();PZ();uY();k9();S9();eZ();h9();f9();import x9 from"lodash-es/isEqual.js";import{isAbsolute as u9,resolve as p9}from"path";function c9(W,Y,Q){let X=[],J=[],H=[];for(let[G,L]of Object.entries(W)){let B=Y[G],z=h0(L.source,Q?.projectRoot);if(!B)X.push(G);else if(L.sourceIsFallback)H.push(G);else if(!x9(z,B.source))J.push({name:G,declaredSource:z,materializedSource:B.source});else H.push(G)}return{missing:X,sourceChanged:J,upToDate:H}}async function ZX(W){let Y=k0();if(Object.keys(Y).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let Q;try{Q=await S0()}catch(K){l(K),Q={}}let X=c9(Y,Q,{projectRoot:kZ()}),J=[...X.missing.map((K)=>({name:K,source:h0(Y[K].source),action:"install"})),...X.sourceChanged.map(({name:K,declaredSource:A})=>({name:K,source:A,action:"update"}))],H=[],G=[];for(let K of J){if(W?.skip?.(K.name,K.source)){H.push(K.name);continue}if(K.action==="update"&&R0(K.source)&&!await C0(K.source.path)){d(`[reconcile] '${K.name}' declared path does not exist; keeping materialized entry`),H.push(K.name);continue}G.push(K)}if(G.length===0)return{installed:[],updated:[],failed:[],upToDate:X.upToDate,skipped:H};d(`[reconcile] ${G.length} marketplace(s): ${G.map((K)=>`${K.name}(${K.action})`).join(", ")}`);let L=[],B=[],z=[];for(let K=0;K<G.length;K++){let{name:A,source:q,action:O}=G[K];W?.onProgress?.({type:"installing",name:A,action:O,index:K+1,total:G.length});try{let V=await f0(q);if(O==="install")L.push(A);else B.push(A);W?.onProgress?.({type:"installed",name:A,alreadyMaterialized:V.alreadyMaterialized})}catch(V){let j=M0(V);z.push({name:A,error:j}),W?.onProgress?.({type:"failed",name:A,error:j}),l(V)}}return{installed:L,updated:B,failed:z,upToDate:X.upToDate,skipped:H}}function h0(W,Y){if((W.source==="directory"||W.source==="file")&&!u9(W.path)){let Q=Y??kZ(),X=I0(Q);return{...W,path:p9(X??Q,W.path)}}return W}
16
+ export{d9 as aa,F9 as ba,B6 as ca,LW as da,wY as ea,zW as fa,_W as ga,vW as ha,w6 as ia,g6 as ja,UZ as ka,GZ as la,SY as ma,B9 as na,c9 as oa,ZX as pa};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{HO as g,IO as Q}from"./cli-s6qk3rbv.js";import{GQ as d,IQ as y,iR as B}from"./cli-5wh173wa.js";import{V5 as H,W5 as U,X5 as L,Y5 as S,l6 as F}from"./cli-dx46fn1w.js";import{bda as s}from"./cli-x514vyva.js";import{c as V}from"react/compiler-runtime";import{memo as l}from"react";import{jsxDEV as A}from"react/jsx-dev-runtime";function _q(P){if(P.startsWith("file-"))return"+";if(P.startsWith("mcp-resource-"))return"\u25C7";if(P.startsWith("agent-"))return"*";return"+"}function fq(P){return P.startsWith("file-")||P.startsWith("mcp-resource-")||P.startsWith("agent-")}function rq(P){let _=V(22),{suggestions:q,selectedSuggestion:f,maxColumnWidth:D,overlay:$}=P,{rows:n}=g(),W=$?qq:Math.min(6,Math.max(1,n-3));if(q.length===0)return null;let J;if(_[0]!==D||_[1]!==q)J=D??Math.max(...q.map(Pq))+5,_[0]=D,_[1]=q,_[2]=J;else J=_[2];let w=J,v=Math.max(0,Math.min(f-Math.floor(W/2),q.length-W)),p=Math.min(v+W,q.length),K,O,j,M;if(_[3]!==p||_[4]!==w||_[5]!==$||_[6]!==f||_[7]!==v||_[8]!==q){let T=q.slice(v,p);K=d,O="column",j=$?void 0:"flex-end";let k;if(_[13]!==w||_[14]!==f||_[15]!==q)k=(z)=>A(Kq,{item:z,maxColumnWidth:w,isSelected:z.id===q[f]?.id},z.id,!1,void 0,this),_[13]=w,_[14]=f,_[15]=q,_[16]=k;else k=_[16];M=T.map(k),_[3]=p,_[4]=w,_[5]=$,_[6]=f,_[7]=v,_[8]=q,_[9]=K,_[10]=O,_[11]=j,_[12]=M}else K=_[9],O=_[10],j=_[11],M=_[12];let o;if(_[17]!==K||_[18]!==O||_[19]!==j||_[20]!==M)o=A(K,{flexDirection:O,justifyContent:j,children:M},void 0,!1,void 0,this),_[17]=K,_[18]=O,_[19]=j,_[20]=M,_[21]=o;else o=_[21];return o}function Pq(P){return H(P.displayText)}var qq=5,Kq,oq;var jq=s(()=>{Q();U();B();F();Kq=l(function(_){let q=V(36),{item:f,maxColumnWidth:D,isSelected:$}=_,n=g().columns;if(fq(f.id)){let Y;if(q[0]!==f.id)Y=_q(f.id),q[0]=f.id,q[1]=Y;else Y=q[1];let h=Y,G=$?"suggestion":void 0,t=!$,E=f.id.startsWith("file-"),I=f.id.startsWith("mcp-resource-"),R=f.description?3:0,e;if(E){let r;if(q[2]!==f.description)r=f.description?Math.min(20,H(f.description)):0,q[2]=f.description,q[3]=r;else r=q[3];let m=r,c=n-2-4-R-m,N;if(q[4]!==f.displayText||q[5]!==c)N=L(f.displayText,c),q[4]=f.displayText,q[5]=c,q[6]=N;else N=q[6];e=N}else if(I){let r;if(q[7]!==f.displayText)r=S(f.displayText,30),q[7]=f.displayText,q[8]=r;else r=q[8];e=r}else e=f.displayText;let x=n-2-H(e)-R-4,X;if(f.description){let r=Math.max(0,x),m;if(q[9]!==f.description||q[10]!==r)m=S(f.description.replace(/\s+/g," "),r),q[9]=f.description,q[10]=r,q[11]=m;else m=q[11];X=`${h} ${e} \u2013 ${m}`}else X=`${h} ${e}`;let b;if(q[12]!==t||q[13]!==X||q[14]!==G)b=A(y,{color:G,dimColor:t,wrap:"truncate",children:X},void 0,!1,void 0,this),q[12]=t,q[13]=X,q[14]=G,q[15]=b;else b=q[15];return b}let J=Math.floor(n*0.4),w=Math.min(D??H(f.displayText)+5,J),v=f.color||($?"suggestion":void 0),p=!$,K=f.displayText;if(H(K)>w-2){let Y=w-2,h;if(q[16]!==K||q[17]!==Y)h=S(K,Y),q[16]=K,q[17]=Y,q[18]=h;else h=q[18];K=h}let O=K+" ".repeat(Math.max(0,w-H(K))),j=f.tag?`[${f.tag}] `:"",M=H(j),o=Math.max(0,n-w-M-4),T;if(q[19]!==o||q[20]!==f.description)T=f.description?S(f.description.replace(/\s+/g," "),o):"",q[19]=o,q[20]=f.description,q[21]=T;else T=q[21];let k=T,z;if(q[22]!==O||q[23]!==p||q[24]!==v)z=A(y,{color:v,dimColor:p,children:O},void 0,!1,void 0,this),q[22]=O,q[23]=p,q[24]=v,q[25]=z;else z=q[25];let u;if(q[26]!==j)u=j?A(y,{dimColor:!0,children:j},void 0,!1,void 0,this):null,q[26]=j,q[27]=u;else u=q[27];let i=$?"suggestion":void 0,C=!$,a;if(q[28]!==i||q[29]!==C||q[30]!==k)a=A(y,{color:i,dimColor:C,children:k},void 0,!1,void 0,this),q[28]=i,q[29]=C,q[30]=k,q[31]=a;else a=q[31];let Z;if(q[32]!==z||q[33]!==u||q[34]!==a)Z=A(y,{wrap:"truncate",children:[z,u,a]},void 0,!0,void 0,this),q[32]=z,q[33]=u,q[34]=a,q[35]=Z;else Z=q[35];return Z});oq=l(rq)});
3
- export{rq as Nf,oq as Of,jq as Pf};
2
+ import{EO as g,FO as Q}from"./cli-akcxtvv9.js";import{DQ as d,FQ as y,fR as B}from"./cli-x8xgga1a.js";import{$5 as L,Z5 as H,_5 as U,a6 as S,p6 as F}from"./cli-51720d82.js";import{fda as s}from"./cli-w1d8n9g3.js";import{c as V}from"react/compiler-runtime";import{memo as l}from"react";import{jsxDEV as A}from"react/jsx-dev-runtime";function _q(P){if(P.startsWith("file-"))return"+";if(P.startsWith("mcp-resource-"))return"\u25C7";if(P.startsWith("agent-"))return"*";return"+"}function fq(P){return P.startsWith("file-")||P.startsWith("mcp-resource-")||P.startsWith("agent-")}function rq(P){let _=V(22),{suggestions:q,selectedSuggestion:f,maxColumnWidth:D,overlay:$}=P,{rows:n}=g(),W=$?qq:Math.min(6,Math.max(1,n-3));if(q.length===0)return null;let J;if(_[0]!==D||_[1]!==q)J=D??Math.max(...q.map(Pq))+5,_[0]=D,_[1]=q,_[2]=J;else J=_[2];let w=J,v=Math.max(0,Math.min(f-Math.floor(W/2),q.length-W)),p=Math.min(v+W,q.length),K,O,j,M;if(_[3]!==p||_[4]!==w||_[5]!==$||_[6]!==f||_[7]!==v||_[8]!==q){let T=q.slice(v,p);K=d,O="column",j=$?void 0:"flex-end";let k;if(_[13]!==w||_[14]!==f||_[15]!==q)k=(z)=>A(Kq,{item:z,maxColumnWidth:w,isSelected:z.id===q[f]?.id},z.id,!1,void 0,this),_[13]=w,_[14]=f,_[15]=q,_[16]=k;else k=_[16];M=T.map(k),_[3]=p,_[4]=w,_[5]=$,_[6]=f,_[7]=v,_[8]=q,_[9]=K,_[10]=O,_[11]=j,_[12]=M}else K=_[9],O=_[10],j=_[11],M=_[12];let o;if(_[17]!==K||_[18]!==O||_[19]!==j||_[20]!==M)o=A(K,{flexDirection:O,justifyContent:j,children:M},void 0,!1,void 0,this),_[17]=K,_[18]=O,_[19]=j,_[20]=M,_[21]=o;else o=_[21];return o}function Pq(P){return H(P.displayText)}var qq=5,Kq,oq;var jq=s(()=>{Q();U();B();F();Kq=l(function(_){let q=V(36),{item:f,maxColumnWidth:D,isSelected:$}=_,n=g().columns;if(fq(f.id)){let Y;if(q[0]!==f.id)Y=_q(f.id),q[0]=f.id,q[1]=Y;else Y=q[1];let h=Y,G=$?"suggestion":void 0,t=!$,E=f.id.startsWith("file-"),I=f.id.startsWith("mcp-resource-"),R=f.description?3:0,e;if(E){let r;if(q[2]!==f.description)r=f.description?Math.min(20,H(f.description)):0,q[2]=f.description,q[3]=r;else r=q[3];let m=r,c=n-2-4-R-m,N;if(q[4]!==f.displayText||q[5]!==c)N=L(f.displayText,c),q[4]=f.displayText,q[5]=c,q[6]=N;else N=q[6];e=N}else if(I){let r;if(q[7]!==f.displayText)r=S(f.displayText,30),q[7]=f.displayText,q[8]=r;else r=q[8];e=r}else e=f.displayText;let x=n-2-H(e)-R-4,X;if(f.description){let r=Math.max(0,x),m;if(q[9]!==f.description||q[10]!==r)m=S(f.description.replace(/\s+/g," "),r),q[9]=f.description,q[10]=r,q[11]=m;else m=q[11];X=`${h} ${e} \u2013 ${m}`}else X=`${h} ${e}`;let b;if(q[12]!==t||q[13]!==X||q[14]!==G)b=A(y,{color:G,dimColor:t,wrap:"truncate",children:X},void 0,!1,void 0,this),q[12]=t,q[13]=X,q[14]=G,q[15]=b;else b=q[15];return b}let J=Math.floor(n*0.4),w=Math.min(D??H(f.displayText)+5,J),v=f.color||($?"suggestion":void 0),p=!$,K=f.displayText;if(H(K)>w-2){let Y=w-2,h;if(q[16]!==K||q[17]!==Y)h=S(K,Y),q[16]=K,q[17]=Y,q[18]=h;else h=q[18];K=h}let O=K+" ".repeat(Math.max(0,w-H(K))),j=f.tag?`[${f.tag}] `:"",M=H(j),o=Math.max(0,n-w-M-4),T;if(q[19]!==o||q[20]!==f.description)T=f.description?S(f.description.replace(/\s+/g," "),o):"",q[19]=o,q[20]=f.description,q[21]=T;else T=q[21];let k=T,z;if(q[22]!==O||q[23]!==p||q[24]!==v)z=A(y,{color:v,dimColor:p,children:O},void 0,!1,void 0,this),q[22]=O,q[23]=p,q[24]=v,q[25]=z;else z=q[25];let u;if(q[26]!==j)u=j?A(y,{dimColor:!0,children:j},void 0,!1,void 0,this):null,q[26]=j,q[27]=u;else u=q[27];let i=$?"suggestion":void 0,C=!$,a;if(q[28]!==i||q[29]!==C||q[30]!==k)a=A(y,{color:i,dimColor:C,children:k},void 0,!1,void 0,this),q[28]=i,q[29]=C,q[30]=k,q[31]=a;else a=q[31];let Z;if(q[32]!==z||q[33]!==u||q[34]!==a)Z=A(y,{wrap:"truncate",children:[z,u,a]},void 0,!0,void 0,this),q[32]=z,q[33]=u,q[34]=a,q[35]=Z;else Z=q[35];return Z});oq=l(rq)});
3
+ export{rq as Qf,oq as Rf,jq as Sf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{C7 as z,E7 as G}from"./cli-hpzy0mat.js";import{bda as D}from"./cli-x514vyva.js";function H(k){let g;try{g=new URL(k)}catch(A){throw Error(`Invalid URL format: ${k}`)}if(g.protocol!=="http:"&&g.protocol!=="https:")throw Error(`Invalid URL protocol: must use http:// or https://, got ${g.protocol}`)}async function K(k){try{let g=process.platform;if(g==="win32"){let{code:C}=await z("explorer",[k]);return C===0}let A=g==="darwin"?"open":"xdg-open",{code:B}=await z(A,[k]);return B===0}catch(g){return!1}}async function L(k){try{H(k);let g=process.env.BROWSER,A=process.platform;if(A==="win32"){if(g){let{code:C}=await z(g,[`"${k}"`]);return C===0}let{code:B}=await z("rundll32",["url,OpenURL",k],{});return B===0}else{let B=g||(A==="darwin"?"open":"xdg-open"),{code:C}=await z(B,[k]);return C===0}}catch(g){return!1}}var I=D(()=>{G()});
3
- export{K as Q5,L as R5,I as S5};
2
+ import{G7 as z,I7 as G}from"./cli-p0vh69b9.js";import{fda as D}from"./cli-w1d8n9g3.js";function H(k){let g;try{g=new URL(k)}catch(A){throw Error(`Invalid URL format: ${k}`)}if(g.protocol!=="http:"&&g.protocol!=="https:")throw Error(`Invalid URL protocol: must use http:// or https://, got ${g.protocol}`)}async function K(k){try{let g=process.platform;if(g==="win32"){let{code:C}=await z("explorer",[k]);return C===0}let A=g==="darwin"?"open":"xdg-open",{code:B}=await z(A,[k]);return B===0}catch(g){return!1}}async function L(k){try{H(k);let g=process.env.BROWSER,A=process.platform;if(A==="win32"){if(g){let{code:C}=await z(g,[`"${k}"`]);return C===0}let{code:B}=await z("rundll32",["url,OpenURL",k],{});return B===0}else{let B=g||(A==="darwin"?"open":"xdg-open"),{code:C}=await z(B,[k]);return C===0}}catch(g){return!1}}var I=D(()=>{G()});
3
+ export{K as A5,L as B5,I as C5};