@unieai/code 0.0.14 → 0.0.15

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 (447) hide show
  1. package/README.md +18 -0
  2. package/dist/chunks/App-6wcwb5pc.js +2 -0
  3. package/dist/chunks/ApproveApiKey-d97zej3m.js +2 -0
  4. package/dist/chunks/{assistant-bmwndz7j.js → AssistantSessionChooser-vygv3jdr.js} +1 -1
  5. package/dist/chunks/BypassPermissionsModeDialog-p7yq2zap.js +2 -0
  6. package/dist/chunks/{ClaudeInChromeOnboarding-ckjppjhr.js → ClaudeInChromeOnboarding-n11q2368.js} +1 -1
  7. package/dist/chunks/ClaudeMdExternalIncludesDialog-6afdc75a.js +2 -0
  8. package/dist/chunks/ConsoleOAuthFlow-7na5hhyn.js +2 -0
  9. package/dist/chunks/{DiffDialog-ptnc4sgx.js → DiffDialog-0gfe5ew5.js} +1 -1
  10. package/dist/chunks/Doctor-q03grp6g.js +2 -0
  11. package/dist/chunks/Grove-2hdgsj42.js +2 -0
  12. package/dist/chunks/{ITermBackend-wgbbpgpy.js → ITermBackend-d4maa39x.js} +1 -1
  13. package/dist/chunks/{InProcessTransport-vgh7qgjn.js → InProcessTransport-7sr7467h.js} +1 -1
  14. package/dist/chunks/InvalidConfigDialog-qe8rkhkj.js +2 -0
  15. package/dist/chunks/InvalidSettingsDialog-tmhmy5tf.js +2 -0
  16. package/dist/chunks/Onboarding-hp8hb5kc.js +2 -0
  17. package/dist/chunks/REPL-5ppdjgag.js +2 -0
  18. package/dist/chunks/{ResumeConversation-ymc529y6.js → ResumeConversation-sr90x948.js} +1 -1
  19. package/dist/chunks/{SnapshotUpdateDialog-aya2c2f9.js → SnapshotUpdateDialog-wt6b6ee8.js} +1 -1
  20. package/dist/chunks/{TeleportProgress-kn3qgvd9.js → TeleportProgress-yv82g5fx.js} +1 -1
  21. package/dist/chunks/{TeleportRepoMismatchDialog-01v6e2qz.js → TeleportRepoMismatchDialog-hdzhp1cy.js} +1 -1
  22. package/dist/chunks/{TeleportResumeWrapper-48dsm503.js → TeleportResumeWrapper-m93f8nva.js} +1 -1
  23. package/dist/chunks/{TmuxBackend-s0bt8zqj.js → TmuxBackend-5ajj7r7b.js} +1 -1
  24. package/dist/chunks/ToolSearchTool-e8x4b1xy.js +2 -0
  25. package/dist/chunks/{TrustDialog-xtn3kq0n.js → TrustDialog-m74p2tm4.js} +1 -1
  26. package/dist/chunks/TungstenTool-3f5rj0vm.js +2 -0
  27. package/dist/chunks/{add-dir-z0kz5nf7.js → add-dir-fswbbep3.js} +1 -1
  28. package/dist/chunks/{agents-ex4cdx64.js → agents-ftrmk7h2.js} +1 -1
  29. package/dist/chunks/agents-wg0hfr30.js +4 -0
  30. package/dist/chunks/ant-claude-for-chrome-mcp-p12dy6z6.js +2 -0
  31. package/dist/chunks/api-94eda39h.js +2 -0
  32. package/dist/chunks/asciicast-ktxrxtw6.js +2 -0
  33. package/dist/chunks/{AssistantSessionChooser-wxmyvgcf.js → assistant-kae6ttkn.js} +1 -1
  34. package/dist/chunks/{auth-g2p039wk.js → auth-2kpz51np.js} +1 -1
  35. package/dist/chunks/auth-xw8gbsgb.js +2 -0
  36. package/dist/chunks/backgroundHousekeeping-zxf9qg70.js +2 -0
  37. package/dist/chunks/{branch-rdvbhvts.js → branch-takyqck5.js} +1 -1
  38. package/dist/chunks/{bridgePointer-9rqn5tp6.js → bridgePointer-73w5dbak.js} +1 -1
  39. package/dist/chunks/{btw-xts6twbq.js → btw-jdp39tx4.js} +1 -1
  40. package/dist/chunks/{buddy-yc09g048.js → buddy-m4zdx3bb.js} +1 -1
  41. package/dist/chunks/{cachedMicrocompact-fa2mdnyh.js → cachedMicrocompact-6agq4j15.js} +1 -1
  42. package/dist/chunks/caches-zfq2xyng.js +2 -0
  43. package/dist/chunks/{chrome-gb6g0d5p.js → chrome-6nn58sx4.js} +1 -1
  44. package/dist/chunks/{chromeNativeHost-jsntnc29.js → chromeNativeHost-zww6nc8m.js} +1 -1
  45. package/dist/chunks/{claudeDesktop-me56qerx.js → claudeDesktop-mbfy989f.js} +1 -1
  46. package/dist/chunks/{cleanup-hxj6tm50.js → cleanup-b1j2gz00.js} +1 -1
  47. package/dist/chunks/clear-gcgpc454.js +2 -0
  48. package/dist/chunks/{cli-63wps6p0.js → cli-01hdyy20.js} +1 -1
  49. package/dist/chunks/{cli-fnt125we.js → cli-024t0qj5.js} +2 -2
  50. package/dist/chunks/{cli-xqqnx8gk.js → cli-05d7kjwb.js} +1 -1
  51. package/dist/chunks/{cli-z02gsrtd.js → cli-0gt2xz4m.js} +2 -2
  52. package/dist/chunks/{cli-hp5gs22f.js → cli-0hyd6spd.js} +1 -1
  53. package/dist/chunks/{cli-3619x17q.js → cli-0p0bgg1c.js} +1 -1
  54. package/dist/chunks/{cli-j4r75xsd.js → cli-0qjhtnek.js} +1 -1
  55. package/dist/chunks/{cli-7ed2q42n.js → cli-0th9dbz0.js} +2 -2
  56. package/dist/chunks/{cli-8j0b3b55.js → cli-0vb8t8wq.js} +1 -1
  57. package/dist/chunks/{cli-7jw2qe69.js → cli-0ybyvcx6.js} +2 -2
  58. package/dist/chunks/{cli-8xyb31dy.js → cli-10j9svm7.js} +2 -2
  59. package/dist/chunks/{cli-2sbq6ggm.js → cli-16j5x50q.js} +2 -2
  60. package/dist/chunks/{cli-3tkd82y4.js → cli-19s45qns.js} +1 -1
  61. package/dist/chunks/{cli-zwn9x1p2.js → cli-1pwyw30a.js} +1 -1
  62. package/dist/chunks/{cli-h2t2hyz7.js → cli-1px0m0pt.js} +2 -2
  63. package/dist/chunks/{cli-e9t5kfxm.js → cli-2540qh2b.js} +1 -1
  64. package/dist/chunks/{cli-ps5qshk4.js → cli-259ff8gy.js} +1 -1
  65. package/dist/chunks/{cli-rc3w6tqd.js → cli-26y0jfks.js} +2 -2
  66. package/dist/chunks/{cli-qwx84m9c.js → cli-2afdzhna.js} +1 -1
  67. package/dist/chunks/{cli-e5yek4vx.js → cli-2dkq8dre.js} +2 -2
  68. package/dist/chunks/{cli-1eejy071.js → cli-2q9p0rr5.js} +1 -1
  69. package/dist/chunks/{cli-awe5yg6m.js → cli-39xs60x2.js} +2 -2
  70. package/dist/chunks/{cli-mx33m3gs.js → cli-3he638yr.js} +1 -1
  71. package/dist/chunks/{cli-an97yxg9.js → cli-3q4bcd9y.js} +2 -2
  72. package/dist/chunks/{cli-swrtc7tv.js → cli-40cqn5s4.js} +1 -1
  73. package/dist/chunks/cli-461ebjmk.js +3 -0
  74. package/dist/chunks/{cli-n5wt59z1.js → cli-4c9nnszs.js} +2 -2
  75. package/dist/chunks/{cli-64x5ghm5.js → cli-4dj4x3mr.js} +1 -1
  76. package/dist/chunks/{cli-zxe1a0ey.js → cli-4r0qxxn2.js} +2 -2
  77. package/dist/chunks/{cli-jz50hv3m.js → cli-4v73qw68.js} +1 -1
  78. package/dist/chunks/{cli-bfm3f0yw.js → cli-5pn327m7.js} +1 -1
  79. package/dist/chunks/{cli-jrwh6rs0.js → cli-5rxvwnb0.js} +1 -1
  80. package/dist/chunks/{cli-93sm9n17.js → cli-5t8cqq40.js} +1 -1
  81. package/dist/chunks/{cli-b3k8arn1.js → cli-63389c5w.js} +589 -589
  82. package/dist/chunks/{cli-609dp2ck.js → cli-6376p7cj.js} +1 -1
  83. package/dist/chunks/{cli-8h10q2x8.js → cli-6fmt7dye.js} +1 -1
  84. package/dist/chunks/{cli-9e8f55fp.js → cli-6xn8gqp2.js} +1 -1
  85. package/dist/chunks/{cli-a2d962bq.js → cli-7dm5ex18.js} +3 -3
  86. package/dist/chunks/{cli-9hqmq5g6.js → cli-7q6tcs56.js} +1 -1
  87. package/dist/chunks/{cli-6cqemsm9.js → cli-7xgc2882.js} +1 -1
  88. package/dist/chunks/{cli-wznsj6nb.js → cli-884gn8px.js} +1 -1
  89. package/dist/chunks/cli-8ayzxqxm.js +3 -0
  90. package/dist/chunks/{cli-33tchr20.js → cli-8hpg8nq4.js} +2 -2
  91. package/dist/chunks/{cli-5c6e6txh.js → cli-9m758wb1.js} +48 -48
  92. package/dist/chunks/{cli-192xnkcx.js → cli-9sjvqgf1.js} +39 -39
  93. package/dist/chunks/{cli-bj0csmzs.js → cli-a1ejrtbd.js} +2 -2
  94. package/dist/chunks/{cli-fdjfk8yq.js → cli-a2f4j8s5.js} +2 -2
  95. package/dist/chunks/cli-aevjtty8.js +3 -0
  96. package/dist/chunks/{cli-601zv0wv.js → cli-ajnshm3j.js} +2 -2
  97. package/dist/chunks/{cli-q2g5mjv6.js → cli-aw71bpta.js} +1 -1
  98. package/dist/chunks/{cli-brr3bnrj.js → cli-b2fkrk49.js} +2 -2
  99. package/dist/chunks/{cli-7k17xstr.js → cli-bavw7hk5.js} +1 -1
  100. package/dist/chunks/{cli-5ajcy93q.js → cli-bbt5chja.js} +2 -2
  101. package/dist/chunks/{cli-awb77t95.js → cli-bqs5smsv.js} +2 -2
  102. package/dist/chunks/{cli-yt4ezhhk.js → cli-btsq7ax8.js} +1 -1
  103. package/dist/chunks/{cli-yktdhy9p.js → cli-cmfxv0fb.js} +2 -2
  104. package/dist/chunks/{cli-nqvfpxp6.js → cli-d287m3xt.js} +1 -1
  105. package/dist/chunks/{cli-0nz8v3dj.js → cli-d5tdpnv2.js} +1 -1
  106. package/dist/chunks/{cli-jmq1x925.js → cli-d8qkvmdn.js} +2 -2
  107. package/dist/chunks/{cli-9xtyh8c7.js → cli-dc6wqdxq.js} +2 -2
  108. package/dist/chunks/{cli-rjy86nps.js → cli-djvr12vv.js} +1 -1
  109. package/dist/chunks/{cli-e4a4fjx9.js → cli-dp2jt8fs.js} +2 -2
  110. package/dist/chunks/{cli-e3q6b1cv.js → cli-e1e1m0pp.js} +1 -1
  111. package/dist/chunks/{cli-szxfz15b.js → cli-e1gmbexn.js} +1 -1
  112. package/dist/chunks/{cli-2428yw99.js → cli-e5vc9y1s.js} +2 -2
  113. package/dist/chunks/{cli-8kpqq0ea.js → cli-eehgc06t.js} +2 -2
  114. package/dist/chunks/{cli-a1cx6p3g.js → cli-ehchpnvs.js} +1 -1
  115. package/dist/chunks/{cli-6qt2xm18.js → cli-epetmtbs.js} +2 -2
  116. package/dist/chunks/{cli-m6amgxq3.js → cli-ex1phpwq.js} +1 -1
  117. package/dist/chunks/{cli-8ykv66e4.js → cli-ey3ajcbm.js} +2 -2
  118. package/dist/chunks/{cli-wvctks7e.js → cli-eys4epws.js} +2 -2
  119. package/dist/chunks/{cli-2fqrjjs9.js → cli-ezm83s1g.js} +1 -1
  120. package/dist/chunks/{cli-dx0pk7k2.js → cli-f2vabz18.js} +1 -1
  121. package/dist/chunks/{cli-7wxv39ry.js → cli-fg3rb4dg.js} +2 -2
  122. package/dist/chunks/{cli-t7sx6zqn.js → cli-fn58ekhc.js} +1 -1
  123. package/dist/chunks/{cli-6ee37m6j.js → cli-ft5hkwbj.js} +1 -1
  124. package/dist/chunks/{cli-eh1wx76n.js → cli-ftpdmdw5.js} +1 -1
  125. package/dist/chunks/{cli-df5r5xrp.js → cli-fvr47wt6.js} +1 -1
  126. package/dist/chunks/{cli-a1dqnvy2.js → cli-g85dpwpq.js} +1 -1
  127. package/dist/chunks/{cli-d1w21hsm.js → cli-gd0f1rtp.js} +1 -1
  128. package/dist/chunks/{cli-bpj9na88.js → cli-gh3w0z1t.js} +1 -1
  129. package/dist/chunks/{cli-ktzyyx91.js → cli-gpsc6dvd.js} +1 -1
  130. package/dist/chunks/{cli-zqrzc3qx.js → cli-gv71wq8a.js} +1 -1
  131. package/dist/chunks/{cli-67azkkwm.js → cli-h2e1scnk.js} +1 -1
  132. package/dist/chunks/{cli-bdgrtpsy.js → cli-h3vttdhj.js} +2 -2
  133. package/dist/chunks/{cli-sbm8tsyq.js → cli-h5hm4rsb.js} +1 -1
  134. package/dist/chunks/cli-h7tdk5fx.js +3 -0
  135. package/dist/chunks/{cli-yaxs01at.js → cli-h9xmkhdq.js} +2 -2
  136. package/dist/chunks/{cli-b8j8bm5m.js → cli-hs95nqb0.js} +1 -1
  137. package/dist/chunks/{cli-rz03bav0.js → cli-hsnk77dk.js} +1 -1
  138. package/dist/chunks/{cli-q8zmmp6z.js → cli-hy0se8fa.js} +2 -2
  139. package/dist/chunks/{cli-3tmtx9ka.js → cli-jr0hzh2w.js} +1 -1
  140. package/dist/chunks/{cli-hpxspent.js → cli-jy20hqk9.js} +2 -2
  141. package/dist/chunks/{cli-ez2xsd4m.js → cli-k3b5ctgk.js} +2 -2
  142. package/dist/chunks/{cli-yxsn8ang.js → cli-kc4b0z3x.js} +1 -1
  143. package/dist/chunks/{cli-d2pn0xfj.js → cli-krmacmt6.js} +1 -1
  144. package/dist/chunks/{cli-tafg3e9w.js → cli-ktzb7cwm.js} +2 -2
  145. package/dist/chunks/{cli-sr25begm.js → cli-m09f7s7e.js} +1 -1
  146. package/dist/chunks/{cli-kx3r72jp.js → cli-mae5am6a.js} +1 -1
  147. package/dist/chunks/{cli-z2ewnqgr.js → cli-mhza34xq.js} +2 -2
  148. package/dist/chunks/{cli-qpjkqhg2.js → cli-mky8bjey.js} +1 -1
  149. package/dist/chunks/{cli-fz053waw.js → cli-mqkqq3ye.js} +2 -2
  150. package/dist/chunks/{cli-vtsy70mz.js → cli-ms2tdrrf.js} +1 -1
  151. package/dist/chunks/{cli-hrmzaf5d.js → cli-n0xnhnx9.js} +2 -2
  152. package/dist/chunks/{cli-cfbfexxj.js → cli-ncbagd2h.js} +1 -1
  153. package/dist/chunks/{cli-vfh77r55.js → cli-ndp9j4vm.js} +1 -1
  154. package/dist/chunks/{cli-4pwyex04.js → cli-ndrvqgnc.js} +2 -2
  155. package/dist/chunks/{cli-jz8jcrhh.js → cli-nhks97kf.js} +1 -1
  156. package/dist/chunks/{cli-ry9g546q.js → cli-p2ngs1jm.js} +1 -1
  157. package/dist/chunks/{cli-qrmc38f8.js → cli-p853vxnx.js} +2 -2
  158. package/dist/chunks/{cli-gfweqbpz.js → cli-pmfc2886.js} +1 -1
  159. package/dist/chunks/{cli-1p7nc6zb.js → cli-q33bj7n5.js} +2 -2
  160. package/dist/chunks/{cli-t4see9hh.js → cli-q5arj6fm.js} +2 -2
  161. package/dist/chunks/{cli-vb6aa4jk.js → cli-q6atnwff.js} +2 -2
  162. package/dist/chunks/{cli-cmh6qwg8.js → cli-q93jv7x6.js} +2 -2
  163. package/dist/chunks/{cli-dy9qrrps.js → cli-qa0qmmg4.js} +2 -2
  164. package/dist/chunks/{cli-222ywgt0.js → cli-qhefvb54.js} +2 -2
  165. package/dist/chunks/{cli-sxe9wke0.js → cli-qxtxfn2z.js} +1 -1
  166. package/dist/chunks/{cli-bnr79ddy.js → cli-r29k5h5x.js} +2 -2
  167. package/dist/chunks/{cli-a826q5zk.js → cli-rm2gppbh.js} +1 -1
  168. package/dist/chunks/{cli-a25jeqs8.js → cli-rv4z0bsv.js} +2 -2
  169. package/dist/chunks/{cli-g2s3391y.js → cli-s5ee96g6.js} +1 -1
  170. package/dist/chunks/{cli-5kehgkgh.js → cli-sqtf9njc.js} +1 -1
  171. package/dist/chunks/{cli-3hrmwgsv.js → cli-stjsr4fx.js} +2 -2
  172. package/dist/chunks/{cli-tpjr1pz9.js → cli-svyc36nr.js} +1 -1
  173. package/dist/chunks/{cli-j403r21v.js → cli-sw84zjvc.js} +1 -1
  174. package/dist/chunks/{cli-vm7dr5aa.js → cli-tbp8513t.js} +2 -2
  175. package/dist/chunks/{cli-7n4d5yzr.js → cli-tez2hmqw.js} +1 -1
  176. package/dist/chunks/{cli-hs2k9997.js → cli-tfs3as1v.js} +1 -1
  177. package/dist/chunks/{cli-2j6cv2kz.js → cli-tj8fyjds.js} +2 -2
  178. package/dist/chunks/{cli-phwbqkv7.js → cli-tnbyhfne.js} +2 -2
  179. package/dist/chunks/{cli-97vx3m99.js → cli-ttxhmsvc.js} +1 -1
  180. package/dist/chunks/{cli-yb5m6jwq.js → cli-v86f53k0.js} +3 -3
  181. package/dist/chunks/{cli-07f2hk9d.js → cli-v8wqc6y3.js} +1 -1
  182. package/dist/chunks/{cli-m3r80gy0.js → cli-v9wwx1rc.js} +1 -1
  183. package/dist/chunks/{cli-8jym9hp6.js → cli-vbn35zp3.js} +2 -2
  184. package/dist/chunks/{cli-ca1jmr8f.js → cli-vj1rywde.js} +2 -2
  185. package/dist/chunks/cli-vq0ktbx3.js +3 -0
  186. package/dist/chunks/{cli-pgjnzqk4.js → cli-vrs8hpz4.js} +1 -1
  187. package/dist/chunks/{cli-r43jhzwm.js → cli-vzcpa5mx.js} +2 -2
  188. package/dist/chunks/{cli-q0vret0x.js → cli-w0jxph8x.js} +1 -1
  189. package/dist/chunks/{cli-x9s7jxq5.js → cli-w1y2zvbw.js} +2 -2
  190. package/dist/chunks/{cli-vy3e90k9.js → cli-w4zkh280.js} +1 -1
  191. package/dist/chunks/{cli-chvks6bg.js → cli-w8jvw417.js} +1 -1
  192. package/dist/chunks/{cli-ax0ckqpv.js → cli-w8pfefka.js} +1 -1
  193. package/dist/chunks/{cli-rd5ax7sn.js → cli-x0jht735.js} +1 -1
  194. package/dist/chunks/{cli-gypyp608.js → cli-x4rgkedw.js} +1 -1
  195. package/dist/chunks/{cli-asc9xmsr.js → cli-xabdpk7s.js} +1 -1
  196. package/dist/chunks/{cli-1q1b8rgs.js → cli-xq9g16gt.js} +1 -1
  197. package/dist/chunks/{cli-vqne1z50.js → cli-xw96dapq.js} +1 -1
  198. package/dist/chunks/{cli-b29enbbc.js → cli-xza1mmh1.js} +1 -1
  199. package/dist/chunks/{cli-b5z57an7.js → cli-y2g1asak.js} +1 -1
  200. package/dist/chunks/{cli-mcbntv3p.js → cli-yaw2d4zq.js} +1 -1
  201. package/dist/chunks/{cli-yfb8bk69.js → cli-ymqdnbx2.js} +2 -2
  202. package/dist/chunks/{cli-shsgq494.js → cli-yps4pn87.js} +1 -1
  203. package/dist/chunks/{cli-bzrat9yd.js → cli-z1f33m31.js} +2 -2
  204. package/dist/chunks/cli-z6eshqx6.js +3 -0
  205. package/dist/chunks/{cli-9tbmrp89.js → cli-zjznn7cc.js} +1 -1
  206. package/dist/chunks/{cli-ceas97gw.js → cli-zqj1my2v.js} +2 -2
  207. package/dist/chunks/{cli-psqvdh1r.js → cli-zrth7vt6.js} +1 -1
  208. package/dist/chunks/{cli-8z8d5bgb.js → cli-zxrt2zch.js} +2 -2
  209. package/dist/chunks/cli-zxz1xm2y.js +3 -0
  210. package/dist/chunks/client-syew3mvc.js +2 -0
  211. package/dist/chunks/color-qatz507k.js +2 -0
  212. package/dist/chunks/commitAttribution-shckr1cq.js +2 -0
  213. package/dist/chunks/common-jh4pavb6.js +2 -0
  214. package/dist/chunks/{compact-kysg5kxd.js → compact-sxghgg9n.js} +1 -1
  215. package/dist/chunks/config-25r8er6j.js +2 -0
  216. package/dist/chunks/config-ahnc48yv.js +2 -0
  217. package/dist/chunks/{context-aat04hqp.js → context-8vmnhkcn.js} +1 -1
  218. package/dist/chunks/context-noninteractive-r3easde9.js +2 -0
  219. package/dist/chunks/conversation-5j4eggm2.js +2 -0
  220. package/dist/chunks/{copy-zpvnnk85.js → copy-kkwp50xa.js} +1 -1
  221. package/dist/chunks/cost-jpq9rbzx.js +5 -0
  222. package/dist/chunks/createSession-q0a53mn0.js +2 -0
  223. package/dist/chunks/desktop-k6291p1x.js +2 -0
  224. package/dist/chunks/detectRepository-h3gr8gdb.js +2 -0
  225. package/dist/chunks/detection-b0zsvwnb.js +2 -0
  226. package/dist/chunks/{devtools-7jd4m7th.js → devtools-8zc2m716.js} +1 -1
  227. package/dist/chunks/{diff-xaw6ebj0.js → diff-vm40nyxd.js} +1 -1
  228. package/dist/chunks/doctor-y45fmac9.js +2 -0
  229. package/dist/chunks/earlyInput-pegekfhn.js +2 -0
  230. package/dist/chunks/{effort-bj5x7fcg.js → effort-9xnbtb27.js} +1 -1
  231. package/dist/chunks/executor-kx69dfy3.js +2 -0
  232. package/dist/chunks/exit-8r8kx8hm.js +2 -0
  233. package/dist/chunks/{export-tjrkechp.js → export-0wr0abd0.js} +1 -1
  234. package/dist/chunks/extra-usage-nbgas106.js +2 -0
  235. package/dist/chunks/extra-usage-noninteractive-66zmwx05.js +2 -0
  236. package/dist/chunks/fast-8ymdvfm8.js +2 -0
  237. package/dist/chunks/feedback-n8vwr3z9.js +2 -0
  238. package/dist/chunks/{files-n3b22fs2.js → files-mhx9cc10.js} +1 -1
  239. package/dist/chunks/firstPartyEventLogger-paerdr2m.js +2 -0
  240. package/dist/chunks/gates-wngyk842.js +2 -0
  241. package/dist/chunks/git-r7sca128.js +2 -0
  242. package/dist/chunks/goal-zqeb4rnv.js +2 -0
  243. package/dist/chunks/growthbook-z0km1xj1.js +2 -0
  244. package/dist/chunks/{heapdump-2y7wcy1r.js → heapdump-rcge2q0e.js} +1 -1
  245. package/dist/chunks/{help-a7mc9946.js → help-zba127jm.js} +1 -1
  246. package/dist/chunks/{hooks-22nm9hn0.js → hooks-kwyxgfnh.js} +1 -1
  247. package/dist/chunks/hooks-sd4knstw.js +2 -0
  248. package/dist/chunks/{ide-9x5zsk63.js → ide-ph9revqg.js} +1 -1
  249. package/dist/chunks/index-y2qvpmjn.js +2 -0
  250. package/dist/chunks/{initReplBridge-xjc6eaan.js → initReplBridge-0fb0sdd0.js} +1 -1
  251. package/dist/chunks/ink-qfs553mf.js +2 -0
  252. package/dist/chunks/{insights-n7k1ty4n.js → insights-mc3fr5tq.js} +1 -1
  253. package/dist/chunks/{install-github-app-zdsmjft8.js → install-github-app-8bpx4gak.js} +1 -1
  254. package/dist/chunks/{install-rhzcmymh.js → install-jnwzbh9n.js} +1 -1
  255. package/dist/chunks/install-slack-app-mq18xdh4.js +2 -0
  256. package/dist/chunks/instrumentation-r6m6cpwq.js +13 -0
  257. package/dist/chunks/keybindings-5xfde34t.js +3 -0
  258. package/dist/chunks/loadAgentsDir-858gc42y.js +2 -0
  259. package/dist/chunks/loadPluginHooks-nye2wnjd.js +2 -0
  260. package/dist/chunks/login-d806meeh.js +2 -0
  261. package/dist/chunks/logout-7eab6ep8.js +2 -0
  262. package/dist/chunks/{main-6h6y0rzf.js → main-r6t52mjc.js} +14 -14
  263. package/dist/chunks/{mcp-yqhzespv.js → mcp-0vwtqwa6.js} +1 -1
  264. package/dist/chunks/mcp-r18hhy02.js +3 -0
  265. package/dist/chunks/{mcp-yrt7dbxp.js → mcp-y8q5yb60.js} +3 -3
  266. package/dist/chunks/{mcpServer-f90a93nt.js → mcpServer-17f7qjpf.js} +1 -1
  267. package/dist/chunks/{mcpServer-v1dy489g.js → mcpServer-za0c5qxf.js} +1 -1
  268. package/dist/chunks/{memory-mdwb22wh.js → memory-cygg4exk.js} +1 -1
  269. package/dist/chunks/{mobile-j4jwvavn.js → mobile-3b85d257.js} +1 -1
  270. package/dist/chunks/{model-tf1ne2j9.js → model-159q4y9p.js} +1 -1
  271. package/dist/chunks/model-m251ahzh.js +2 -0
  272. package/dist/chunks/{oauth-1b0qpxz4.js → oauth-0bwqgx9q.js} +1 -1
  273. package/dist/chunks/{output-style-t39s3jqx.js → output-style-93keyt16.js} +1 -1
  274. package/dist/chunks/parser-hwq42bt6.js +2 -0
  275. package/dist/chunks/{passes-s3fqswrg.js → passes-q304cea1.js} +1 -1
  276. package/dist/chunks/{permissions-a050zfqv.js → permissions-tyasy9cv.js} +1 -1
  277. package/dist/chunks/plan-24nj1sc9.js +2 -0
  278. package/dist/chunks/plugin-6vddyvyh.js +2 -0
  279. package/dist/chunks/pluginStartupCheck-0vse6r56.js +2 -0
  280. package/dist/chunks/{plugins-4py04yzf.js → plugins-0c98naeb.js} +2 -2
  281. package/dist/chunks/{preauthorizedConfig-hmxcgb8e.js → preauthorizedConfig-et34h6tr.js} +1 -1
  282. package/dist/chunks/{print-pmzxgktf.js → print-z6k6yas1.js} +4 -4
  283. package/dist/chunks/privacy-settings-8j5mffff.js +2 -0
  284. package/dist/chunks/process-22t1nv1h.js +2 -0
  285. package/dist/chunks/{processBashCommand-zkztsgn4.js → processBashCommand-z4dv10xe.js} +1 -1
  286. package/dist/chunks/{processSlashCommand-mfh1h592.js → processSlashCommand-3d7jy9zn.js} +1 -1
  287. package/dist/chunks/prompt-2vc9x4tz.js +2 -0
  288. package/dist/chunks/prompt-n672rb6v.js +2 -0
  289. package/dist/chunks/provider-prompt-cyzsv35w.js +2 -0
  290. package/dist/chunks/{rate-limit-options-kd432dap.js → rate-limit-options-sj78r287.js} +1 -1
  291. package/dist/chunks/registry-eh3nbvrw.js +2 -0
  292. package/dist/chunks/release-notes-242sqhds.js +6 -0
  293. package/dist/chunks/reload-plugins-bnwgt3b2.js +3 -0
  294. package/dist/chunks/{remote-env-rg4k5em5.js → remote-env-gpwv8c1y.js} +1 -1
  295. package/dist/chunks/{remoteBridgeCore-t980tt3v.js → remoteBridgeCore-5f92ewk3.js} +1 -1
  296. package/dist/chunks/rename-q0t9qmps.js +2 -0
  297. package/dist/chunks/{resume-3tc40yn9.js → resume-707rbm95.js} +1 -1
  298. package/dist/chunks/{rewind-b6vg7dxs.js → rewind-2ghm1ys8.js} +1 -1
  299. package/dist/chunks/sandbox-adapter-z2sedaea.js +2 -0
  300. package/dist/chunks/{sandbox-toggle-eke03mr8.js → sandbox-toggle-r0nsvjfe.js} +1 -1
  301. package/dist/chunks/{session-53f3eza5.js → session-7jy47tfh.js} +1 -1
  302. package/dist/chunks/sessionFileAccessHooks-0h2dzr6d.js +2 -0
  303. package/dist/chunks/sessionStorage-na71kng7.js +2 -0
  304. package/dist/chunks/settings-jnqec2t4.js +2 -0
  305. package/dist/chunks/{setup-z05dsr8q.js → setup-exrj5apq.js} +2 -2
  306. package/dist/chunks/{setup-gravfzvg.js → setup-hhnqt5m4.js} +1 -1
  307. package/dist/chunks/setup-sv1h7c9x.js +2 -0
  308. package/dist/chunks/sinks-h5jqp76t.js +2 -0
  309. package/dist/chunks/{skills-41mfq71n.js → skills-7cx810ev.js} +1 -1
  310. package/dist/chunks/startupProfiler-qkkwmx3e.js +2 -0
  311. package/dist/chunks/state-9t5rddcc.js +2 -0
  312. package/dist/chunks/{stats-7qg84dw1.js → stats-4trmdgr9.js} +1 -1
  313. package/dist/chunks/status-qvn7jn0p.js +2 -0
  314. package/dist/chunks/stickers-p4yrfr32.js +2 -0
  315. package/dist/chunks/subprocessEnv-x1xd9x7k.js +2 -0
  316. package/dist/chunks/{systemPromptSections-jxxyhnxe.js → systemPromptSections-pcrphkzc.js} +1 -1
  317. package/dist/chunks/{tag-58ndeaa9.js → tag-bexktcx4.js} +1 -1
  318. package/dist/chunks/tasks-a0mx2drp.js +2 -0
  319. package/dist/chunks/teamHelpers-bfbx13m0.js +2 -0
  320. package/dist/chunks/teammateModeSnapshot-x1dc2d00.js +2 -0
  321. package/dist/chunks/teleport-y1mmes2t.js +2 -0
  322. package/dist/chunks/terminalSetup-a0a8wgbj.js +2 -0
  323. package/dist/chunks/theme-1wm2bpaf.js +2 -0
  324. package/dist/chunks/thinkback-3sz6bf5t.js +2 -0
  325. package/dist/chunks/thinkback-play-swd1vjqn.js +2 -0
  326. package/dist/chunks/toolSearch-8mgqzknz.js +2 -0
  327. package/dist/chunks/trustedDevice-9yp8mttk.js +2 -0
  328. package/dist/chunks/{ultrareviewCommand-qwnsjdez.js → ultrareviewCommand-dj716ryk.js} +1 -1
  329. package/dist/chunks/update-r3pdnfg1.js +82 -0
  330. package/dist/chunks/upgrade-adym17ka.js +2 -0
  331. package/dist/chunks/{upstreamproxy-34wva0r5.js → upstreamproxy-39e2hgq3.js} +1 -1
  332. package/dist/chunks/usage-gehxyrfj.js +2 -0
  333. package/dist/chunks/util-qk39hg9x.js +2 -0
  334. package/dist/chunks/utils-5nwk1214.js +2 -0
  335. package/dist/chunks/vim-zqzf0xh8.js +2 -0
  336. package/dist/chunks/worktree-17wb4yc5.js +2 -0
  337. package/dist/chunks/worktreeModeEnabled-pjb4srr0.js +2 -0
  338. package/dist/cli.js +1 -1
  339. package/package.json +2 -1
  340. package/dist/chunks/App-ncpmz34p.js +0 -2
  341. package/dist/chunks/ApproveApiKey-fqzjf1j3.js +0 -2
  342. package/dist/chunks/BypassPermissionsModeDialog-3ksmd8pp.js +0 -2
  343. package/dist/chunks/ClaudeMdExternalIncludesDialog-rrsfavte.js +0 -2
  344. package/dist/chunks/ConsoleOAuthFlow-04xt4sby.js +0 -2
  345. package/dist/chunks/Doctor-kg5m2zma.js +0 -2
  346. package/dist/chunks/Grove-rf9xhe2e.js +0 -2
  347. package/dist/chunks/InvalidConfigDialog-6spqsgmr.js +0 -2
  348. package/dist/chunks/InvalidSettingsDialog-m6y6esgz.js +0 -2
  349. package/dist/chunks/Onboarding-j1m69bqm.js +0 -2
  350. package/dist/chunks/REPL-bpg86z4h.js +0 -2
  351. package/dist/chunks/ToolSearchTool-4rm3kr13.js +0 -2
  352. package/dist/chunks/TungstenTool-3wjjz6cf.js +0 -2
  353. package/dist/chunks/agents-w6zde2j9.js +0 -4
  354. package/dist/chunks/ant-claude-for-chrome-mcp-gr0b0jr4.js +0 -2
  355. package/dist/chunks/api-07pqphw5.js +0 -2
  356. package/dist/chunks/asciicast-2k1ztt6v.js +0 -2
  357. package/dist/chunks/auth-g509w5pr.js +0 -2
  358. package/dist/chunks/backgroundHousekeeping-hw0chw1d.js +0 -2
  359. package/dist/chunks/caches-3qzm958c.js +0 -2
  360. package/dist/chunks/clear-ssfbry3k.js +0 -2
  361. package/dist/chunks/cli-16k24hzp.js +0 -3
  362. package/dist/chunks/cli-8xz7dd7z.js +0 -3
  363. package/dist/chunks/cli-geka8fb7.js +0 -3
  364. package/dist/chunks/cli-rwh0a2m1.js +0 -3
  365. package/dist/chunks/cli-t5ddsvmv.js +0 -3
  366. package/dist/chunks/cli-t5yqvdb3.js +0 -3
  367. package/dist/chunks/cli-t8ydjjs7.js +0 -3
  368. package/dist/chunks/client-qxx2ja27.js +0 -2
  369. package/dist/chunks/color-k1ew8kzn.js +0 -2
  370. package/dist/chunks/commitAttribution-nsa26sdx.js +0 -2
  371. package/dist/chunks/common-7t28qq0q.js +0 -2
  372. package/dist/chunks/config-d4kj5q8e.js +0 -2
  373. package/dist/chunks/config-txzzncm9.js +0 -2
  374. package/dist/chunks/context-noninteractive-w54t6xnc.js +0 -2
  375. package/dist/chunks/conversation-brecqh0t.js +0 -2
  376. package/dist/chunks/cost-5fbyws6x.js +0 -5
  377. package/dist/chunks/createSession-hsp3x7vw.js +0 -2
  378. package/dist/chunks/desktop-7kdmxet0.js +0 -2
  379. package/dist/chunks/detectRepository-9xqead5f.js +0 -2
  380. package/dist/chunks/detection-z3cdks0s.js +0 -2
  381. package/dist/chunks/doctor-nbm4z0tx.js +0 -2
  382. package/dist/chunks/earlyInput-e8zh4d2d.js +0 -2
  383. package/dist/chunks/executor-e1744nra.js +0 -2
  384. package/dist/chunks/exit-894g29w2.js +0 -2
  385. package/dist/chunks/extra-usage-noninteractive-577ac873.js +0 -2
  386. package/dist/chunks/extra-usage-tfwmdc7z.js +0 -2
  387. package/dist/chunks/fast-1krm57mn.js +0 -2
  388. package/dist/chunks/feedback-2421cbpm.js +0 -2
  389. package/dist/chunks/firstPartyEventLogger-1kwwcqdn.js +0 -2
  390. package/dist/chunks/gates-sd1cp8f2.js +0 -2
  391. package/dist/chunks/git-t6e9xdt2.js +0 -2
  392. package/dist/chunks/goal-0sxyk3va.js +0 -2
  393. package/dist/chunks/growthbook-4hx0kbpq.js +0 -2
  394. package/dist/chunks/hooks-tf9v5b0x.js +0 -2
  395. package/dist/chunks/index-p1k4dhfc.js +0 -2
  396. package/dist/chunks/ink-9n8bszp5.js +0 -2
  397. package/dist/chunks/install-slack-app-vhfe2dsf.js +0 -2
  398. package/dist/chunks/instrumentation-5jjvsvke.js +0 -13
  399. package/dist/chunks/keybindings-tqnmw7ng.js +0 -3
  400. package/dist/chunks/loadAgentsDir-j7pntb5v.js +0 -2
  401. package/dist/chunks/loadPluginHooks-sta7ra57.js +0 -2
  402. package/dist/chunks/login-j7x2fjw8.js +0 -2
  403. package/dist/chunks/logout-53bvwba1.js +0 -2
  404. package/dist/chunks/mcp-3mjagnnt.js +0 -3
  405. package/dist/chunks/model-hz3nn362.js +0 -2
  406. package/dist/chunks/parser-8venanpw.js +0 -2
  407. package/dist/chunks/plan-gjaybyvb.js +0 -2
  408. package/dist/chunks/plugin-trf2388p.js +0 -2
  409. package/dist/chunks/pluginStartupCheck-wxmc7h98.js +0 -2
  410. package/dist/chunks/privacy-settings-b2rz35r5.js +0 -2
  411. package/dist/chunks/process-n5355p53.js +0 -2
  412. package/dist/chunks/prompt-2jyjhkwg.js +0 -2
  413. package/dist/chunks/prompt-b34a0h5z.js +0 -2
  414. package/dist/chunks/provider-prompt-qe4s2yzh.js +0 -2
  415. package/dist/chunks/registry-d7cd5dqg.js +0 -2
  416. package/dist/chunks/release-notes-rwgbn4pp.js +0 -6
  417. package/dist/chunks/reload-plugins-9axdwaaj.js +0 -3
  418. package/dist/chunks/rename-xap3rpbv.js +0 -2
  419. package/dist/chunks/sandbox-adapter-1z8xktva.js +0 -2
  420. package/dist/chunks/sessionFileAccessHooks-xscvsvqt.js +0 -2
  421. package/dist/chunks/sessionStorage-rb63e8bn.js +0 -2
  422. package/dist/chunks/settings-hp0ksjn9.js +0 -2
  423. package/dist/chunks/setup-ssq8b1e6.js +0 -2
  424. package/dist/chunks/sinks-agafqaxj.js +0 -2
  425. package/dist/chunks/startupProfiler-wmf8nvfd.js +0 -2
  426. package/dist/chunks/state-rhxyy4qm.js +0 -2
  427. package/dist/chunks/status-sran2y9h.js +0 -2
  428. package/dist/chunks/stickers-hythmrsd.js +0 -2
  429. package/dist/chunks/subprocessEnv-b12dkzky.js +0 -2
  430. package/dist/chunks/tasks-52g28x72.js +0 -2
  431. package/dist/chunks/teamHelpers-rxt9rvmd.js +0 -2
  432. package/dist/chunks/teammateModeSnapshot-2782d4w9.js +0 -2
  433. package/dist/chunks/teleport-8gjys6yn.js +0 -2
  434. package/dist/chunks/terminalSetup-bbftxeqk.js +0 -2
  435. package/dist/chunks/theme-b38te5rz.js +0 -2
  436. package/dist/chunks/thinkback-05a9q24j.js +0 -2
  437. package/dist/chunks/thinkback-play-1nbagfm5.js +0 -2
  438. package/dist/chunks/toolSearch-7rnke366.js +0 -2
  439. package/dist/chunks/trustedDevice-2dn4981h.js +0 -2
  440. package/dist/chunks/update-ney1krzn.js +0 -82
  441. package/dist/chunks/upgrade-zxxxfq8c.js +0 -2
  442. package/dist/chunks/usage-82ghrfb3.js +0 -2
  443. package/dist/chunks/util-xm9cs164.js +0 -2
  444. package/dist/chunks/utils-zs0ft181.js +0 -2
  445. package/dist/chunks/vim-6gxdrp1k.js +0 -2
  446. package/dist/chunks/worktree-xjxz4ndt.js +0 -2
  447. package/dist/chunks/worktreeModeEnabled-8ndm5yfs.js +0 -2
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{CE as Mq,CI as Gq,EI as Nq,HK as Lq,Hk as Xq,Ik as Vq,JK as QQ,OI as qQ,VE as pq,WE as Oq,YE as lq,fE as Hq,gH as zq,iH as Jq,mG as _q,nG as cq}from"./cli-b3k8arn1.js";import{SL as g,TL as fq,UL as j,VL as uq,WL as V,XL as Dq,YL as wq,ZL as Eq}from"./cli-4pwyex04.js";import{EO as Kq,FO as jq,SO as Yq,UO as xq}from"./cli-8jym9hp6.js";import{DQ as _,FQ as $,WQ as $q,fR as gq}from"./cli-a2d962bq.js";import{C2 as Zq,F1 as Sq,G2 as bq,L1 as Qq,O1 as Wq,Q1 as Iq,f1 as qq}from"./cli-192xnkcx.js";import{B5 as e,C5 as yq}from"./cli-an97yxg9.js";import{C7 as Tq,g7 as t,x7 as r}from"./cli-yb5m6jwq.js";import{C8 as mq,G8 as S,H8 as s,L8 as Fq,z8 as o}from"./cli-8kpqq0ea.js";import{$8 as hq,_8 as d}from"./cli-e5yek4vx.js";import{s9 as A,u9 as kq}from"./cli-5ajcy93q.js";import{A_ as vq,f_ as f,j_ as Pq,x_ as n}from"./cli-awb77t95.js";import{dda as Bq,yba as a}from"./cli-tafg3e9w.js";import{hda as Cq}from"./cli-qwx84m9c.js";import b from"axios";import{readFile as iq,stat as aq}from"fs/promises";import{useCallback as p,useEffect as dq,useState as U}from"react";import{jsxDEV as Q}from"react/jsx-dev-runtime";function C(W){let q=W;return q=q.replace(/"(sk-ant[^\s"']{24,})"/g,'"[REDACTED_API_KEY]"'),q=q.replace(/(?<![A-Za-z0-9"'])(sk-ant-?[A-Za-z0-9_-]{10,})(?![A-Za-z0-9"'])/g,"[REDACTED_API_KEY]"),q=q.replace(/AWS key: "(AWS[A-Z0-9]{20,})"/g,'AWS key: "[REDACTED_AWS_KEY]"'),q=q.replace(/(AKIA[A-Z0-9]{16})/g,"[REDACTED_AWS_KEY]"),q=q.replace(/(?<![A-Za-z0-9])(AIza[A-Za-z0-9_-]{35})(?![A-Za-z0-9])/g,"[REDACTED_GCP_KEY]"),q=q.replace(/(?<![A-Za-z0-9])([a-z0-9-]+@[a-z0-9-]+\.iam\.gserviceaccount\.com)(?![A-Za-z0-9])/g,"[REDACTED_GCP_SERVICE_ACCOUNT]"),q=q.replace(/(["']?x-api-key["']?\s*[:=]\s*["']?)[^"',\s)}\]]+/gi,"$1[REDACTED_API_KEY]"),q=q.replace(/(["']?authorization["']?\s*[:=]\s*["']?(bearer\s+)?)[^"',\s)}\]]+/gi,"$1[REDACTED_TOKEN]"),q=q.replace(/(AWS[_-][A-Za-z0-9_]+\s*[=:]\s*)["']?[^"',\s)}\]]+["']?/gi,"$1[REDACTED_AWS_VALUE]"),q=q.replace(/(GOOGLE[_-][A-Za-z0-9_]+\s*[=:]\s*)["']?[^"',\s)}\]]+["']?/gi,"$1[REDACTED_GCP_VALUE]"),q=q.replace(/((API[-_]?KEY|TOKEN|SECRET|PASSWORD)\s*[=:]\s*)["']?[^"',\s)}\]]+["']?/gi,"$1[REDACTED]"),q}function c(){return s().map((W)=>{let q={...W};if(q&&typeof q.error==="string")q.error=C(q.error);return q})}async function oq(){try{let W=zq(),{size:q}=await aq(W);if(q>Jq)return n(`Skipping raw transcript read: file too large (${q} bytes)`,{level:"warn"}),null;return await iq(W,"utf-8")}catch{return null}}function yQ({abortSignal:W,messages:q,initialDescription:Z,onDone:K,backgroundTasks:G={}}){let[X,N]=U("userInput"),[x,P]=U(0),[M,u]=U(Z??""),[L,B]=U(null),[w,z]=U(null),[H,v]=U({isGit:!1,gitState:null}),[m,R]=U(null),F=Kq().columns-4;dq(()=>{async function O(){let J=await t(),Y=null;if(J)Y=await r();v({isGit:J,gitState:Y})}O()},[]);let T=p(async()=>{N("submitting"),z(null),B(null);let O=c(),Y=Hq(q)?.requestId??null,[k,D]=await Promise.all([Nq(),oq()]),Rq=Gq(G),E={...k,...Rq},Uq={latestAssistantMessageId:Y,message_count:q.length,datetime:new Date().toISOString(),description:M,platform:A.platform,gitRepo:H.isGit,terminal:A.terminal,version:MACRO.VERSION,transcript:Mq(q),errors:O,lastApiRequest:a(),...Object.keys(E).length>0&&{subagentTranscripts:E},...D&&{rawTranscriptJsonl:D}},[h,Aq]=await Promise.all([rq(Uq,W),tq(M,W)]);if(R(Aq),h.success){if(h.feedbackId)B(h.feedbackId),d("tengu_bug_report_submitted",{feedback_id:h.feedbackId,last_assistant_message_id:Y}),Zq("tengu_bug_report_description",{feedback_id:h.feedbackId,description:C(M)});N("done")}else{if(h.isZdrOrg)z("Feedback collection is not available for organizations with custom data retention policies.");else z("Could not submit feedback. Please try again later.");N("userInput")}},[M,H.isGit,q]),I=p(()=>{if(X==="done"){if(w)K("Error submitting feedback / bug report",{display:"system"});else K("Feedback / bug report submitted",{display:"system"});return}K("Feedback / bug report cancelled",{display:"system"})},[X,w,K]);return Yq("confirm:no",I,{context:"Settings",isActive:X==="userInput"}),$q((O,J)=>{if(X==="done"){if(J.return&&m){let Y=sq(L??"",m,M,c());e(Y)}if(w)K("Error submitting feedback / bug report",{display:"system"});else K("Feedback / bug report submitted",{display:"system"});return}if(w&&X!=="userInput"){K("Error submitting feedback / bug report",{display:"system"});return}if(X==="consent"&&(J.return||O===" "))T()}),Q(wq,{title:"Submit Feedback / Bug Report",onCancel:I,isCancelActive:X!=="userInput",inputGuide:(O)=>O.pending?Q($,{children:["Press ",O.keyName," again to exit"]},void 0,!0,void 0,this):X==="userInput"?Q(V,{children:[Q(g,{shortcut:"Enter",action:"continue"},void 0,!1,void 0,this),Q(j,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):X==="consent"?Q(V,{children:[Q(g,{shortcut:"Enter",action:"submit"},void 0,!1,void 0,this),Q(j,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,children:[X==="userInput"&&Q(_,{flexDirection:"column",gap:1,children:[Q($,{children:"Describe the issue below:"},void 0,!1,void 0,this),Q(_q,{value:M,onChange:(O)=>{if(u(O),w)z(null)},columns:F,onSubmit:()=>N("consent"),onExitMessage:()=>K("Feedback cancelled",{display:"system"}),cursorOffset:x,onChangeCursorOffset:P,showCursor:!0},void 0,!1,void 0,this),w&&Q(_,{flexDirection:"column",gap:1,children:[Q($,{color:"error",children:w},void 0,!1,void 0,this),Q($,{dimColor:!0,children:"Edit and press Enter to retry, or Esc to cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="consent"&&Q(_,{flexDirection:"column",children:[Q($,{children:"This report will include:"},void 0,!1,void 0,this),Q(_,{marginLeft:2,flexDirection:"column",children:[Q($,{children:["- Your feedback / bug description:"," ",Q($,{dimColor:!0,children:M},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q($,{children:["- Environment info:"," ",Q($,{dimColor:!0,children:[A.platform,", ",A.terminal,", v",MACRO.VERSION]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.gitState&&Q($,{children:["- Git repo metadata:"," ",Q($,{dimColor:!0,children:[H.gitState.branchName,H.gitState.commitHash?`, ${H.gitState.commitHash.slice(0,7)}`:"",H.gitState.remoteUrl?` @ ${H.gitState.remoteUrl}`:"",!H.gitState.isHeadOnRemote&&", not synced",!H.gitState.isClean&&", has local changes"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Q($,{children:"- Current session transcript"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q(_,{marginTop:1,children:Q($,{wrap:"wrap",dimColor:!0,children:["We will use your feedback to debug related issues or to improve"," ","UnieAI Code's functionality (eg. to reduce the risk of bugs occurring in the future)."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Q(_,{marginTop:1,children:Q($,{children:["Press ",Q($,{bold:!0,children:"Enter"},void 0,!1,void 0,this)," to confirm and submit."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="submitting"&&Q(_,{flexDirection:"row",gap:1,children:Q($,{children:"Submitting report\u2026"},void 0,!1,void 0,this)},void 0,!1,void 0,this),X==="done"&&Q(_,{flexDirection:"column",children:[w?Q($,{color:"error",children:w},void 0,!1,void 0,this):Q($,{color:"success",children:"Thank you for your report!"},void 0,!1,void 0,this),L&&Q($,{dimColor:!0,children:["Feedback ID: ",L]},void 0,!0,void 0,this),Q(_,{marginTop:1,children:[Q($,{children:"Press "},void 0,!1,void 0,this),Q($,{bold:!0,children:"Enter "},void 0,!1,void 0,this),Q($,{children:"to open your browser and draft a GitHub issue, or any other key to close."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function sq(W,q,Z,K){let G=C(q),N=`**Bug Description**
2
+ import{EE as Mq,EI as Gq,GI as Nq,Hk as Xq,Ik as Vq,JK as Lq,LK as QQ,QI as qQ,XE as pq,YE as Oq,_E as lq,hE as Hq,iH as zq,kH as Jq,oG as _q,pG as cq}from"./cli-63389c5w.js";import{$L as Eq,UL as g,VL as fq,WL as j,XL as uq,YL as V,ZL as Dq,_L as wq}from"./cli-ndrvqgnc.js";import{GO as Kq,HO as jq,UO as Yq,WO as xq}from"./cli-vbn35zp3.js";import{FQ as _,HQ as $,YQ as $q,hR as gq}from"./cli-7dm5ex18.js";import{E2 as Zq,I2 as bq,K1 as Sq,Q1 as Qq,T1 as Wq,V1 as Iq,k1 as qq}from"./cli-9sjvqgf1.js";import{D5 as e,E5 as yq}from"./cli-3q4bcd9y.js";import{E7 as Tq,i7 as t,z7 as r}from"./cli-v86f53k0.js";import{B8 as o,E8 as mq,I8 as S,J8 as s,N8 as Fq}from"./cli-eehgc06t.js";import{a9 as d,b9 as hq}from"./cli-2dkq8dre.js";import{u9 as A,w9 as kq}from"./cli-bbt5chja.js";import{C_ as vq,h_ as f,l_ as Pq,z_ as n}from"./cli-bqs5smsv.js";import{Aba as a,fda as Bq}from"./cli-ktzb7cwm.js";import{jda as Cq}from"./cli-2afdzhna.js";import b from"axios";import{readFile as iq,stat as aq}from"fs/promises";import{useCallback as p,useEffect as dq,useState as U}from"react";import{jsxDEV as Q}from"react/jsx-dev-runtime";function C(W){let q=W;return q=q.replace(/"(sk-ant[^\s"']{24,})"/g,'"[REDACTED_API_KEY]"'),q=q.replace(/(?<![A-Za-z0-9"'])(sk-ant-?[A-Za-z0-9_-]{10,})(?![A-Za-z0-9"'])/g,"[REDACTED_API_KEY]"),q=q.replace(/AWS key: "(AWS[A-Z0-9]{20,})"/g,'AWS key: "[REDACTED_AWS_KEY]"'),q=q.replace(/(AKIA[A-Z0-9]{16})/g,"[REDACTED_AWS_KEY]"),q=q.replace(/(?<![A-Za-z0-9])(AIza[A-Za-z0-9_-]{35})(?![A-Za-z0-9])/g,"[REDACTED_GCP_KEY]"),q=q.replace(/(?<![A-Za-z0-9])([a-z0-9-]+@[a-z0-9-]+\.iam\.gserviceaccount\.com)(?![A-Za-z0-9])/g,"[REDACTED_GCP_SERVICE_ACCOUNT]"),q=q.replace(/(["']?x-api-key["']?\s*[:=]\s*["']?)[^"',\s)}\]]+/gi,"$1[REDACTED_API_KEY]"),q=q.replace(/(["']?authorization["']?\s*[:=]\s*["']?(bearer\s+)?)[^"',\s)}\]]+/gi,"$1[REDACTED_TOKEN]"),q=q.replace(/(AWS[_-][A-Za-z0-9_]+\s*[=:]\s*)["']?[^"',\s)}\]]+["']?/gi,"$1[REDACTED_AWS_VALUE]"),q=q.replace(/(GOOGLE[_-][A-Za-z0-9_]+\s*[=:]\s*)["']?[^"',\s)}\]]+["']?/gi,"$1[REDACTED_GCP_VALUE]"),q=q.replace(/((API[-_]?KEY|TOKEN|SECRET|PASSWORD)\s*[=:]\s*)["']?[^"',\s)}\]]+["']?/gi,"$1[REDACTED]"),q}function c(){return s().map((W)=>{let q={...W};if(q&&typeof q.error==="string")q.error=C(q.error);return q})}async function oq(){try{let W=zq(),{size:q}=await aq(W);if(q>Jq)return n(`Skipping raw transcript read: file too large (${q} bytes)`,{level:"warn"}),null;return await iq(W,"utf-8")}catch{return null}}function yQ({abortSignal:W,messages:q,initialDescription:Z,onDone:K,backgroundTasks:G={}}){let[X,N]=U("userInput"),[x,P]=U(0),[M,u]=U(Z??""),[L,B]=U(null),[w,z]=U(null),[H,v]=U({isGit:!1,gitState:null}),[m,R]=U(null),F=Kq().columns-4;dq(()=>{async function O(){let J=await t(),Y=null;if(J)Y=await r();v({isGit:J,gitState:Y})}O()},[]);let T=p(async()=>{N("submitting"),z(null),B(null);let O=c(),Y=Hq(q)?.requestId??null,[k,D]=await Promise.all([Nq(),oq()]),Rq=Gq(G),E={...k,...Rq},Uq={latestAssistantMessageId:Y,message_count:q.length,datetime:new Date().toISOString(),description:M,platform:A.platform,gitRepo:H.isGit,terminal:A.terminal,version:MACRO.VERSION,transcript:Mq(q),errors:O,lastApiRequest:a(),...Object.keys(E).length>0&&{subagentTranscripts:E},...D&&{rawTranscriptJsonl:D}},[h,Aq]=await Promise.all([rq(Uq,W),tq(M,W)]);if(R(Aq),h.success){if(h.feedbackId)B(h.feedbackId),d("tengu_bug_report_submitted",{feedback_id:h.feedbackId,last_assistant_message_id:Y}),Zq("tengu_bug_report_description",{feedback_id:h.feedbackId,description:C(M)});N("done")}else{if(h.isZdrOrg)z("Feedback collection is not available for organizations with custom data retention policies.");else z("Could not submit feedback. Please try again later.");N("userInput")}},[M,H.isGit,q]),I=p(()=>{if(X==="done"){if(w)K("Error submitting feedback / bug report",{display:"system"});else K("Feedback / bug report submitted",{display:"system"});return}K("Feedback / bug report cancelled",{display:"system"})},[X,w,K]);return Yq("confirm:no",I,{context:"Settings",isActive:X==="userInput"}),$q((O,J)=>{if(X==="done"){if(J.return&&m){let Y=sq(L??"",m,M,c());e(Y)}if(w)K("Error submitting feedback / bug report",{display:"system"});else K("Feedback / bug report submitted",{display:"system"});return}if(w&&X!=="userInput"){K("Error submitting feedback / bug report",{display:"system"});return}if(X==="consent"&&(J.return||O===" "))T()}),Q(wq,{title:"Submit Feedback / Bug Report",onCancel:I,isCancelActive:X!=="userInput",inputGuide:(O)=>O.pending?Q($,{children:["Press ",O.keyName," again to exit"]},void 0,!0,void 0,this):X==="userInput"?Q(V,{children:[Q(g,{shortcut:"Enter",action:"continue"},void 0,!1,void 0,this),Q(j,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):X==="consent"?Q(V,{children:[Q(g,{shortcut:"Enter",action:"submit"},void 0,!1,void 0,this),Q(j,{action:"confirm:no",context:"Confirmation",fallback:"Esc",description:"cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this):null,children:[X==="userInput"&&Q(_,{flexDirection:"column",gap:1,children:[Q($,{children:"Describe the issue below:"},void 0,!1,void 0,this),Q(_q,{value:M,onChange:(O)=>{if(u(O),w)z(null)},columns:F,onSubmit:()=>N("consent"),onExitMessage:()=>K("Feedback cancelled",{display:"system"}),cursorOffset:x,onChangeCursorOffset:P,showCursor:!0},void 0,!1,void 0,this),w&&Q(_,{flexDirection:"column",gap:1,children:[Q($,{color:"error",children:w},void 0,!1,void 0,this),Q($,{dimColor:!0,children:"Edit and press Enter to retry, or Esc to cancel"},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),X==="consent"&&Q(_,{flexDirection:"column",children:[Q($,{children:"This report will include:"},void 0,!1,void 0,this),Q(_,{marginLeft:2,flexDirection:"column",children:[Q($,{children:["- Your feedback / bug description:"," ",Q($,{dimColor:!0,children:M},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q($,{children:["- Environment info:"," ",Q($,{dimColor:!0,children:[A.platform,", ",A.terminal,", v",MACRO.VERSION]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),H.gitState&&Q($,{children:["- Git repo metadata:"," ",Q($,{dimColor:!0,children:[H.gitState.branchName,H.gitState.commitHash?`, ${H.gitState.commitHash.slice(0,7)}`:"",H.gitState.remoteUrl?` @ ${H.gitState.remoteUrl}`:"",!H.gitState.isHeadOnRemote&&", not synced",!H.gitState.isClean&&", has local changes"]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),Q($,{children:"- Current session transcript"},void 0,!1,void 0,this)]},void 0,!0,void 0,this),Q(_,{marginTop:1,children:Q($,{wrap:"wrap",dimColor:!0,children:["We will use your feedback to debug related issues or to improve"," ","UnieAI Code's functionality (eg. to reduce the risk of bugs occurring in the future)."]},void 0,!0,void 0,this)},void 0,!1,void 0,this),Q(_,{marginTop:1,children:Q($,{children:["Press ",Q($,{bold:!0,children:"Enter"},void 0,!1,void 0,this)," to confirm and submit."]},void 0,!0,void 0,this)},void 0,!1,void 0,this)]},void 0,!0,void 0,this),X==="submitting"&&Q(_,{flexDirection:"row",gap:1,children:Q($,{children:"Submitting report\u2026"},void 0,!1,void 0,this)},void 0,!1,void 0,this),X==="done"&&Q(_,{flexDirection:"column",children:[w?Q($,{color:"error",children:w},void 0,!1,void 0,this):Q($,{color:"success",children:"Thank you for your report!"},void 0,!1,void 0,this),L&&Q($,{dimColor:!0,children:["Feedback ID: ",L]},void 0,!0,void 0,this),Q(_,{marginTop:1,children:[Q($,{children:"Press "},void 0,!1,void 0,this),Q($,{bold:!0,children:"Enter "},void 0,!1,void 0,this),Q($,{children:"to open your browser and draft a GitHub issue, or any other key to close."},void 0,!1,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)]},void 0,!0,void 0,this)}function sq(W,q,Z,K){let G=C(q),N=`**Bug Description**
3
3
  ${C(Z)}
4
4
 
5
5
  **Environment Info**
@@ -1,10 +1,10 @@
1
1
  // @bun
2
- import{E7 as m,F7 as oJ}from"./cli-yfb8bk69.js";import{I7 as X,K7 as rJ}from"./cli-7wxv39ry.js";import{N7 as k,O7 as e}from"./cli-fnt125we.js";import{G8 as EJ,L8 as nJ}from"./cli-8kpqq0ea.js";import{G9 as jJ,H9 as iJ}from"./cli-2sbq6ggm.js";import{A_ as aJ,M9 as t,O9 as DJ,f_ as l,j_ as GJ,n_ as R,r_ as s,x_ as O}from"./cli-awb77t95.js";import{dda as pJ,oaa as i}from"./cli-tafg3e9w.js";import{hda as v,ida as sJ}from"./cli-qwx84m9c.js";function h(J){let $=J.slice(J.lastIndexOf(".")).toLowerCase();return kJ.has($)}function g(J){let $=Math.min(J.length,IJ),q=0;for(let K=0;K<$;K++){let Q=J[K];if(Q===0)return!0;if(Q<32&&Q!==9&&Q!==10&&Q!==13)q++}return q/$>0.1}var kJ,IJ=8192;var c=v(()=>{kJ=new Set([".png",".jpg",".jpeg",".gif",".bmp",".ico",".webp",".tiff",".tif",".mp4",".mov",".avi",".mkv",".webm",".wmv",".flv",".m4v",".mpeg",".mpg",".mp3",".wav",".ogg",".flac",".aac",".m4a",".wma",".aiff",".opus",".zip",".tar",".gz",".bz2",".7z",".rar",".xz",".z",".tgz",".iso",".exe",".dll",".so",".dylib",".bin",".o",".a",".obj",".lib",".app",".msi",".deb",".rpm",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odt",".ods",".odp",".ttf",".otf",".woff",".woff2",".eot",".pyc",".pyo",".class",".jar",".war",".ear",".node",".wasm",".rlib",".sqlite",".sqlite3",".db",".mdb",".idx",".psd",".ai",".eps",".sketch",".fig",".xd",".blend",".3ds",".max",".swf",".fla",".lockb",".dat",".data"])});import{dirname as bJ}from"path";function U(J,$,q){let K=yJ();if(!K)return;let Q={timestamp:new Date().toISOString(),level:J,event:$,data:q??{}},Y=R(),Z=l(Q)+`
2
+ import{G7 as m,H7 as oJ}from"./cli-ymqdnbx2.js";import{K7 as X,M7 as rJ}from"./cli-fg3rb4dg.js";import{P7 as k,Q7 as e}from"./cli-024t0qj5.js";import{I8 as EJ,N8 as nJ}from"./cli-eehgc06t.js";import{I9 as jJ,J9 as iJ}from"./cli-16j5x50q.js";import{C_ as aJ,O9 as t,Q9 as DJ,h_ as l,l_ as GJ,p_ as R,t_ as s,z_ as O}from"./cli-bqs5smsv.js";import{fda as pJ,qaa as i}from"./cli-ktzb7cwm.js";import{jda as v,kda as sJ}from"./cli-2afdzhna.js";function h(J){let $=J.slice(J.lastIndexOf(".")).toLowerCase();return kJ.has($)}function g(J){let $=Math.min(J.length,IJ),q=0;for(let K=0;K<$;K++){let Q=J[K];if(Q===0)return!0;if(Q<32&&Q!==9&&Q!==10&&Q!==13)q++}return q/$>0.1}var kJ,IJ=8192;var c=v(()=>{kJ=new Set([".png",".jpg",".jpeg",".gif",".bmp",".ico",".webp",".tiff",".tif",".mp4",".mov",".avi",".mkv",".webm",".wmv",".flv",".m4v",".mpeg",".mpg",".mp3",".wav",".ogg",".flac",".aac",".m4a",".wma",".aiff",".opus",".zip",".tar",".gz",".bz2",".7z",".rar",".xz",".z",".tgz",".iso",".exe",".dll",".so",".dylib",".bin",".o",".a",".obj",".lib",".app",".msi",".deb",".rpm",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".odt",".ods",".odp",".ttf",".otf",".woff",".woff2",".eot",".pyc",".pyo",".class",".jar",".war",".ear",".node",".wasm",".rlib",".sqlite",".sqlite3",".db",".mdb",".idx",".psd",".ai",".eps",".sketch",".fig",".xd",".blend",".3ds",".max",".swf",".fla",".lockb",".dat",".data"])});import{dirname as bJ}from"path";function U(J,$,q){let K=yJ();if(!K)return;let Q={timestamp:new Date().toISOString(),level:J,event:$,data:q??{}},Y=R(),Z=l(Q)+`
3
3
  `;try{Y.appendFileSync(K,Z)}catch{try{Y.mkdirSync(bJ(K)),Y.appendFileSync(K,Z)}catch{}}}function yJ(){return process.env.CLAUDE_CODE_DIAGNOSTICS_FILE}async function T2(J,$,q){let K=Date.now();U("info",`${J}_started`);try{let Q=await $(),Y=q?q(Q):{};return U("info",`${J}_completed`,{duration_ms:Date.now()-K,...Y}),Q}catch(Q){throw U("error",`${J}_failed`,{duration_ms:Date.now()-K}),Q}}var a=v(()=>{s();GJ()});import{readFile as vJ}from"fs/promises";import{join as CJ}from"path";async function C(J,$,q,K){try{let Q=await vJ(CJ(J,"config"),"utf-8");return SJ(Q,$,q,K)}catch{return null}}function SJ(J,$,q,K){let Q=J.split(`
4
4
  `),Y=$.toLowerCase(),Z=K.toLowerCase(),A=!1;for(let W of Q){let H=W.trim();if(H.length===0||H[0]==="#"||H[0]===";")continue;if(H[0]==="["){A=wJ(H,Y,q);continue}if(!A)continue;let _=RJ(H);if(_&&_.key.toLowerCase()===Z)return _.value}return null}function RJ(J){let $=0;while($<J.length&&FJ(J[$]))$++;if($===0)return null;let q=J.slice(0,$);while($<J.length&&(J[$]===" "||J[$]==="\t"))$++;if($>=J.length||J[$]!=="=")return null;$++;while($<J.length&&(J[$]===" "||J[$]==="\t"))$++;let K=PJ(J,$);return{key:q,value:K}}function PJ(J,$){let q="",K=!1,Q=$;while(Q<J.length){let Y=J[Q];if(!K&&(Y==="#"||Y===";"))break;if(Y==='"'){K=!K,Q++;continue}if(Y==="\\"&&Q+1<J.length){let Z=J[Q+1];if(K){switch(Z){case"n":q+=`
5
5
  `;break;case"t":q+="\t";break;case"b":q+="\b";break;case'"':q+='"';break;case"\\":q+="\\";break;default:q+=Z;break}Q+=2;continue}if(Z==="\\"){q+="\\",Q+=2;continue}}q+=Y,Q++}if(!K)q=xJ(q);return q}function xJ(J){let $=J.length;while($>0&&(J[$-1]===" "||J[$-1]==="\t"))$--;return J.slice(0,$)}function wJ(J,$,q){let K=1;while(K<J.length&&J[K]!=="]"&&J[K]!==" "&&J[K]!=="\t"&&J[K]!=='"')K++;if(J.slice(1,K).toLowerCase()!==$)return!1;if(q===null)return K<J.length&&J[K]==="]";while(K<J.length&&(J[K]===" "||J[K]==="\t"))K++;if(K>=J.length||J[K]!=='"')return!1;K++;let Y="";while(K<J.length&&J[K]!=='"'){if(J[K]==="\\"&&K+1<J.length){let Z=J[K+1];if(Z==="\\"||Z==='"'){Y+=Z,K+=2;continue}Y+=Z,K+=2;continue}Y+=J[K],K++}if(K>=J.length||J[K]!=='"')return!1;if(K++,K>=J.length||J[K]!=="]")return!1;return Y===q}function FJ(J){return J>="a"&&J<="z"||J>="A"&&J<="Z"||J>="0"&&J<="9"||J==="-"}var n=()=>{};import{unwatchFile as o,watchFile as fJ}from"fs";import{readdir as uJ,readFile as j,stat as JJ}from"fs/promises";import{join as L,resolve as P}from"path";function w2(){N.clear()}async function z(J){let $=P(J??k()),q=N.get($);if(q!==void 0)return q;let K=G($);if(!K)return N.set($,null),null;let Q=L(K,".git");try{if((await JJ(Q)).isFile()){let Z=(await j(Q,"utf-8")).trim();if(Z.startsWith("gitdir:")){let A=Z.slice(7).trim(),W=P(K,A);return N.set($,W),W}}return N.set($,Q),Q}catch{return N.set($,null),null}}function x(J){if(!J||J.startsWith("-")||J.startsWith("/"))return!1;if(J.includes(".."))return!1;if(J.split("/").some(($)=>$==="."||$===""))return!1;if(!/^[a-zA-Z0-9/._+@-]+$/.test(J))return!1;return!0}function D(J){return/^[0-9a-f]{40}$/.test(J)||/^[0-9a-f]{64}$/.test(J)}async function S(J){try{let $=(await j(L(J,"HEAD"),"utf-8")).trim();if($.startsWith("ref:")){let q=$.slice(4).trim();if(q.startsWith("refs/heads/")){let Q=q.slice(11);if(!x(Q))return null;return{type:"branch",name:Q}}if(!x(q))return null;let K=await I(J,q);return K?{type:"detached",sha:K}:{type:"detached",sha:""}}if(!D($))return null;return{type:"detached",sha:$}}catch{return null}}async function I(J,$){let q=await r(J,$);if(q)return q;let K=await T(J);if(K&&K!==J)return r(K,$);return null}async function r(J,$){try{let q=(await j(L(J,$),"utf-8")).trim();if(q.startsWith("ref:")){let K=q.slice(4).trim();if(!x(K))return null;return I(J,K)}if(!D(q))return null;return q}catch{}try{let q=await j(L(J,"packed-refs"),"utf-8");for(let K of q.split(`
6
- `)){if(K.startsWith("#")||K.startsWith("^"))continue;let Q=K.indexOf(" ");if(Q===-1)continue;if(K.slice(Q+1)===$){let Y=K.slice(0,Q);return D(Y)?Y:null}}}catch{}return null}async function T(J){try{let $=(await j(L(J,"commondir"),"utf-8")).trim();return P(J,$)}catch{return null}}async function mJ(J,$,q){try{let K=(await j(L(J,$),"utf-8")).trim();if(K.startsWith("ref:")){let Q=K.slice(4).trim();if(Q.startsWith(q)){let Y=Q.slice(q.length);if(!x(Y))return null;return Y}}}catch{}return null}class $J{gitDir=null;commonDir=null;initialized=!1;initPromise=null;watchedPaths=[];branchRefPath=null;cache=new Map;async ensureStarted(){if(this.initialized)return;if(this.initPromise)return this.initPromise;return this.initPromise=this.start(),this.initPromise}async start(){if(this.gitDir=await z(),this.initialized=!0,!this.gitDir)return;this.commonDir=await T(this.gitDir),this.watchPath(L(this.gitDir,"HEAD"),()=>{this.onHeadChanged()}),this.watchPath(L(this.commonDir??this.gitDir,"config"),()=>{this.invalidate()}),await this.watchCurrentBranchRef(),t(async()=>{this.stopWatching()})}watchPath(J,$){this.watchedPaths.push(J),fJ(J,{interval:dJ},$)}async watchCurrentBranchRef(){if(!this.gitDir)return;let J=await S(this.gitDir),$=this.commonDir??this.gitDir,q=J?.type==="branch"?L($,"refs","heads",J.name):null;if(q===this.branchRefPath)return;if(this.branchRefPath)o(this.branchRefPath),this.watchedPaths=this.watchedPaths.filter((K)=>K!==this.branchRefPath);if(this.branchRefPath=q,!q)return;this.watchPath(q,()=>{this.invalidate()})}async onHeadChanged(){this.invalidate(),await i(),await this.watchCurrentBranchRef()}invalidate(){for(let J of this.cache.values())J.dirty=!0}stopWatching(){for(let J of this.watchedPaths)o(J);this.watchedPaths=[],this.branchRefPath=null}async get(J,$){await this.ensureStarted();let q=this.cache.get(J);if(q&&!q.dirty)return q.value;if(q)q.dirty=!1;let K=await $(),Q=this.cache.get(J);if(Q&&!Q.dirty)Q.value=K;if(!Q)this.cache.set(J,{value:K,dirty:!1,compute:$});return K}reset(){this.stopWatching(),this.cache.clear(),this.initialized=!1,this.initPromise=null,this.gitDir=null,this.commonDir=null}}async function hJ(){let J=await z();if(!J)return"HEAD";let $=await S(J);if(!$)return"HEAD";return $.type==="branch"?$.name:"HEAD"}async function gJ(){let J=await z();if(!J)return"";let $=await S(J);if(!$)return"";if($.type==="branch")return await I(J,`refs/heads/${$.name}`)??"";return $.sha}async function cJ(){let J=await z();if(!J)return null;let $=await C(J,"remote","origin","url");if($)return $;let q=await T(J);if(q&&q!==J)return C(q,"remote","origin","url");return null}async function lJ(){let J=await z();if(!J)return"main";let $=await T(J)??J,q=await mJ($,"refs/remotes/origin/HEAD","refs/remotes/origin/");if(q)return q;for(let K of["main","master"])if(await I($,`refs/remotes/origin/${K}`))return K;return"main"}function qJ(){return w.get("branch",hJ)}function KJ(){return w.get("head",gJ)}function QJ(){return w.get("remoteUrl",cJ)}function YJ(){return w.get("defaultBranch",lJ)}async function F2(J){let $=await z(J);if(!$)return null;let q=await S($);if(!q)return null;if(q.type==="branch")return I($,`refs/heads/${q.name}`);return q.sha}async function p2(J){let $;try{let K=(await j(L(J,".git"),"utf-8")).trim();if(!K.startsWith("gitdir:"))return null;$=P(J,K.slice(7).trim())}catch{return null}let q=await S($);if(!q)return null;if(q.type==="branch")return I($,`refs/heads/${q.name}`);return q.sha}async function D2(J){let $=await z(J);if(!$)return null;let q=await C($,"remote","origin","url");if(q)return q;let K=await T($);if(K&&K!==$)return C(K,"remote","origin","url");return null}async function ZJ(){let J=await z();if(!J)return!1;let $=await T(J)??J;try{return await JJ(L($,"shallow")),!0}catch{return!1}}async function XJ(){try{let J=await z();if(!J)return 0;let $=await T(J)??J;return(await uJ(L($,"worktrees"))).length+1}catch{return 1}}var N,dJ=1000,w;var VJ=v(()=>{pJ();DJ();e();AJ();n();N=new Map;w=new $J});import{createHash as tJ}from"crypto";import{readFileSync as f,realpathSync as WJ,statSync as HJ}from"fs";import{open as eJ,readFile as J2,realpath as LJ,stat as $2}from"fs/promises";import TJ from"lodash-es/memoize.js";import{basename as q2,dirname as u,join as M,resolve as p,sep as MJ}from"path";function K2(){function J($){let q=zJ($);return q===NJ?null:q}return J.cache=zJ.cache,J}function Q2(){function J($){let q=G($);if(!q)return null;return OJ(q)}return J.cache=OJ.cache,J}function $3(J){return z(J)}async function q3(){let J=k(),$=G(J);if(!$)return!1;try{let[q,K]=await Promise.all([LJ(J),LJ($)]);return q===K}catch{return J===$}}function V2(J){let $=J.trim();if(!$)return null;let q=$.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(q&&q[1]&&q[2])return`${q[1]}/${q[2]}`.toLowerCase();let K=$.match(/^(?:https?|ssh):\/\/(?:[^@]+@)?([^/]+)\/(.+?)(?:\.git)?$/);if(K&&K[1]&&K[2]){let Q=K[1],Y=K[2];if(U2(Q)&&Y.startsWith("git/")){let Z=Y.slice(4),A=Z.split("/");if(A.length>=3&&A[0].includes("."))return Z.toLowerCase();return`github.com/${Z}`.toLowerCase()}return`${Q}/${Y}`.toLowerCase()}return null}async function Y3(){let J=await d();if(!J)return null;let $=V2(J);if(!$)return null;return tJ("sha256").update($).digest("hex").substring(0,16)}async function A3(){try{let[J,$,q,K,Q,Y]=await Promise.all([Z2(),X2(),d(),A2(),W2(),L2()]);return{commitHash:J,branchName:$,remoteUrl:q,isHeadOnRemote:K,isClean:Q,worktreeCount:Y}}catch(J){return null}}async function W3(){let{parseGitRemote:J}=await import("./detectRepository-9xqead5f.js"),$=await d();if(!$)return O("Local GitHub repo: unknown"),null;let q=J($);if(q&&q.host==="github.com"){let K=`${q.owner}/${q.name}`;return O(`Local GitHub repo: ${K}`),K}return O("Local GitHub repo: unknown"),null}async function z2(){let{stdout:J,code:$}=await X(V(),["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"],{preserveOutputOnError:!1});if($===0&&J.trim())return J.trim();let{stdout:q,code:K}=await X(V(),["remote","show","origin","--","HEAD"],{preserveOutputOnError:!1});if(K===0){let Y=q.match(/HEAD branch: (\S+)/);if(Y&&Y[1])return`origin/${Y[1]}`}let Q=["origin/main","origin/staging","origin/master"];for(let Y of Q){let{code:Z}=await X(V(),["rev-parse","--verify",Y],{preserveOutputOnError:!1});if(Z===0)return Y}return null}function O2(){return ZJ()}async function F(){let{stdout:J,code:$}=await X(V(),["ls-files","--others","--exclude-standard"],{preserveOutputOnError:!1}),q=J.trim();if($!==0||!q)return[];let K=q.split(`
6
+ `)){if(K.startsWith("#")||K.startsWith("^"))continue;let Q=K.indexOf(" ");if(Q===-1)continue;if(K.slice(Q+1)===$){let Y=K.slice(0,Q);return D(Y)?Y:null}}}catch{}return null}async function T(J){try{let $=(await j(L(J,"commondir"),"utf-8")).trim();return P(J,$)}catch{return null}}async function mJ(J,$,q){try{let K=(await j(L(J,$),"utf-8")).trim();if(K.startsWith("ref:")){let Q=K.slice(4).trim();if(Q.startsWith(q)){let Y=Q.slice(q.length);if(!x(Y))return null;return Y}}}catch{}return null}class $J{gitDir=null;commonDir=null;initialized=!1;initPromise=null;watchedPaths=[];branchRefPath=null;cache=new Map;async ensureStarted(){if(this.initialized)return;if(this.initPromise)return this.initPromise;return this.initPromise=this.start(),this.initPromise}async start(){if(this.gitDir=await z(),this.initialized=!0,!this.gitDir)return;this.commonDir=await T(this.gitDir),this.watchPath(L(this.gitDir,"HEAD"),()=>{this.onHeadChanged()}),this.watchPath(L(this.commonDir??this.gitDir,"config"),()=>{this.invalidate()}),await this.watchCurrentBranchRef(),t(async()=>{this.stopWatching()})}watchPath(J,$){this.watchedPaths.push(J),fJ(J,{interval:dJ},$)}async watchCurrentBranchRef(){if(!this.gitDir)return;let J=await S(this.gitDir),$=this.commonDir??this.gitDir,q=J?.type==="branch"?L($,"refs","heads",J.name):null;if(q===this.branchRefPath)return;if(this.branchRefPath)o(this.branchRefPath),this.watchedPaths=this.watchedPaths.filter((K)=>K!==this.branchRefPath);if(this.branchRefPath=q,!q)return;this.watchPath(q,()=>{this.invalidate()})}async onHeadChanged(){this.invalidate(),await i(),await this.watchCurrentBranchRef()}invalidate(){for(let J of this.cache.values())J.dirty=!0}stopWatching(){for(let J of this.watchedPaths)o(J);this.watchedPaths=[],this.branchRefPath=null}async get(J,$){await this.ensureStarted();let q=this.cache.get(J);if(q&&!q.dirty)return q.value;if(q)q.dirty=!1;let K=await $(),Q=this.cache.get(J);if(Q&&!Q.dirty)Q.value=K;if(!Q)this.cache.set(J,{value:K,dirty:!1,compute:$});return K}reset(){this.stopWatching(),this.cache.clear(),this.initialized=!1,this.initPromise=null,this.gitDir=null,this.commonDir=null}}async function hJ(){let J=await z();if(!J)return"HEAD";let $=await S(J);if(!$)return"HEAD";return $.type==="branch"?$.name:"HEAD"}async function gJ(){let J=await z();if(!J)return"";let $=await S(J);if(!$)return"";if($.type==="branch")return await I(J,`refs/heads/${$.name}`)??"";return $.sha}async function cJ(){let J=await z();if(!J)return null;let $=await C(J,"remote","origin","url");if($)return $;let q=await T(J);if(q&&q!==J)return C(q,"remote","origin","url");return null}async function lJ(){let J=await z();if(!J)return"main";let $=await T(J)??J,q=await mJ($,"refs/remotes/origin/HEAD","refs/remotes/origin/");if(q)return q;for(let K of["main","master"])if(await I($,`refs/remotes/origin/${K}`))return K;return"main"}function qJ(){return w.get("branch",hJ)}function KJ(){return w.get("head",gJ)}function QJ(){return w.get("remoteUrl",cJ)}function YJ(){return w.get("defaultBranch",lJ)}async function F2(J){let $=await z(J);if(!$)return null;let q=await S($);if(!q)return null;if(q.type==="branch")return I($,`refs/heads/${q.name}`);return q.sha}async function p2(J){let $;try{let K=(await j(L(J,".git"),"utf-8")).trim();if(!K.startsWith("gitdir:"))return null;$=P(J,K.slice(7).trim())}catch{return null}let q=await S($);if(!q)return null;if(q.type==="branch")return I($,`refs/heads/${q.name}`);return q.sha}async function D2(J){let $=await z(J);if(!$)return null;let q=await C($,"remote","origin","url");if(q)return q;let K=await T($);if(K&&K!==$)return C(K,"remote","origin","url");return null}async function ZJ(){let J=await z();if(!J)return!1;let $=await T(J)??J;try{return await JJ(L($,"shallow")),!0}catch{return!1}}async function XJ(){try{let J=await z();if(!J)return 0;let $=await T(J)??J;return(await uJ(L($,"worktrees"))).length+1}catch{return 1}}var N,dJ=1000,w;var VJ=v(()=>{pJ();DJ();e();AJ();n();N=new Map;w=new $J});import{createHash as tJ}from"crypto";import{readFileSync as f,realpathSync as WJ,statSync as HJ}from"fs";import{open as eJ,readFile as J2,realpath as LJ,stat as $2}from"fs/promises";import TJ from"lodash-es/memoize.js";import{basename as q2,dirname as u,join as M,resolve as p,sep as MJ}from"path";function K2(){function J($){let q=zJ($);return q===NJ?null:q}return J.cache=zJ.cache,J}function Q2(){function J($){let q=G($);if(!q)return null;return OJ(q)}return J.cache=OJ.cache,J}function $3(J){return z(J)}async function q3(){let J=k(),$=G(J);if(!$)return!1;try{let[q,K]=await Promise.all([LJ(J),LJ($)]);return q===K}catch{return J===$}}function V2(J){let $=J.trim();if(!$)return null;let q=$.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(q&&q[1]&&q[2])return`${q[1]}/${q[2]}`.toLowerCase();let K=$.match(/^(?:https?|ssh):\/\/(?:[^@]+@)?([^/]+)\/(.+?)(?:\.git)?$/);if(K&&K[1]&&K[2]){let Q=K[1],Y=K[2];if(U2(Q)&&Y.startsWith("git/")){let Z=Y.slice(4),A=Z.split("/");if(A.length>=3&&A[0].includes("."))return Z.toLowerCase();return`github.com/${Z}`.toLowerCase()}return`${Q}/${Y}`.toLowerCase()}return null}async function Y3(){let J=await d();if(!J)return null;let $=V2(J);if(!$)return null;return tJ("sha256").update($).digest("hex").substring(0,16)}async function A3(){try{let[J,$,q,K,Q,Y]=await Promise.all([Z2(),X2(),d(),A2(),W2(),L2()]);return{commitHash:J,branchName:$,remoteUrl:q,isHeadOnRemote:K,isClean:Q,worktreeCount:Y}}catch(J){return null}}async function W3(){let{parseGitRemote:J}=await import("./detectRepository-h3gr8gdb.js"),$=await d();if(!$)return O("Local GitHub repo: unknown"),null;let q=J($);if(q&&q.host==="github.com"){let K=`${q.owner}/${q.name}`;return O(`Local GitHub repo: ${K}`),K}return O("Local GitHub repo: unknown"),null}async function z2(){let{stdout:J,code:$}=await X(V(),["rev-parse","--abbrev-ref","--symbolic-full-name","@{u}"],{preserveOutputOnError:!1});if($===0&&J.trim())return J.trim();let{stdout:q,code:K}=await X(V(),["remote","show","origin","--","HEAD"],{preserveOutputOnError:!1});if(K===0){let Y=q.match(/HEAD branch: (\S+)/);if(Y&&Y[1])return`origin/${Y[1]}`}let Q=["origin/main","origin/staging","origin/master"];for(let Y of Q){let{code:Z}=await X(V(),["rev-parse","--verify",Y],{preserveOutputOnError:!1});if(Z===0)return Y}return null}function O2(){return ZJ()}async function F(){let{stdout:J,code:$}=await X(V(),["ls-files","--others","--exclude-standard"],{preserveOutputOnError:!1}),q=J.trim();if($!==0||!q)return[];let K=q.split(`
7
7
  `).filter(Boolean),Q=[],Y=0;for(let Z of K){if(Q.length>=_J){O(`Untracked file capture: reached max file count (${_J})`);break}if(h(Z))continue;try{let W=(await $2(Z)).size;if(W>UJ){O(`Untracked file capture: skipping ${Z} (exceeds ${UJ} bytes)`);continue}if(Y+W>BJ){O(`Untracked file capture: reached total size limit (${BJ} bytes)`);break}if(W===0){Q.push({path:Z,content:""});continue}let H=Math.min(M2,W),_=await eJ(Z,"r");try{let b=Buffer.alloc(H),{bytesRead:y}=await _.read(b,0,H,0),E=b.subarray(0,y);if(g(E))continue;let B;if(W<=H)B=E.toString("utf-8");else B=await J2(Z,"utf-8");Q.push({path:Z,content:B}),Y+=W}finally{await _.close()}}catch(A){O(`Failed to read untracked file ${Z}: ${A}`)}}return Q}async function H3(){try{if(!await Y2())return null;if(await O2()){O("Shallow clone detected, using HEAD-only mode for issue");let[{stdout:E},B]=await Promise.all([X(V(),["diff","HEAD"]),F()]);return{remote_base_sha:null,remote_base:null,patch:E||"",untracked_files:B,format_patch:null,head_sha:null,branch_name:null}}let $=await z2();if(!$){O("No remote found, using HEAD-only mode for issue");let[{stdout:E},B]=await Promise.all([X(V(),["diff","HEAD"]),F()]);return{remote_base_sha:null,remote_base:null,patch:E||"",untracked_files:B,format_patch:null,head_sha:null,branch_name:null}}let{stdout:q,code:K}=await X(V(),["merge-base","HEAD",$],{preserveOutputOnError:!1});if(K!==0||!q.trim()){O("Merge-base failed, using HEAD-only mode for issue");let[{stdout:E},B]=await Promise.all([X(V(),["diff","HEAD"]),F()]);return{remote_base_sha:null,remote_base:null,patch:E||"",untracked_files:B,format_patch:null,head_sha:null,branch_name:null}}let Q=q.trim(),[{stdout:Y},Z,{stdout:A,code:W},{stdout:H},{stdout:_}]=await Promise.all([X(V(),["diff",Q]),F(),X(V(),["format-patch",`${Q}..HEAD`,"--stdout"]),X(V(),["rev-parse","HEAD"]),X(V(),["rev-parse","--abbrev-ref","HEAD"])]),b=null;if(W===0&&A&&A.trim())b=A;let y=_?.trim();return{remote_base_sha:Q,remote_base:$,patch:Y||"",untracked_files:Z,format_patch:b,head_sha:H?.trim()||null,branch_name:y&&y!=="HEAD"?y:null}}catch(J){return EJ(J),null}}function U2(J){let $=J.split(":")[0]??"";return $==="localhost"||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test($)}function L3(){let J=R(),$=k(),q=M($,".git");try{let K=J.statSync(q);if(K.isFile())return!1;if(K.isDirectory()){let Q=M(q,"HEAD");try{if(J.statSync(Q).isFile())return!1}catch{}}}catch{}try{if(J.statSync(M($,"HEAD")).isFile())return!0}catch{}try{if(J.statSync(M($,"objects")).isDirectory())return!0}catch{}try{if(J.statSync(M($,"refs")).isDirectory())return!0}catch{}return!1}var NJ,zJ,G,OJ,J3,V,Y2,K3=async(J)=>{return G(J)!==null},Z2=async()=>{return KJ()},X2=async()=>{return qJ()},Q3=async()=>{return YJ()},d=async()=>{return QJ()},A2=async()=>{let{code:J}=await X(V(),["rev-parse","@{u}"],{preserveOutputOnError:!1});return J===0},Z3=async()=>{let{stdout:J,code:$}=await X(V(),["rev-list","--count","@{u}..HEAD"],{preserveOutputOnError:!1});return $===0&&parseInt(J.trim(),10)>0},W2=async(J)=>{let $=["--no-optional-locks","status","--porcelain"];if(J?.ignoreUntracked)$.push("-uno");let{stdout:q}=await X(V(),$,{preserveOutputOnError:!1});return q.trim().length===0},X3=async()=>{let{stdout:J}=await X(V(),["--no-optional-locks","status","--porcelain"],{preserveOutputOnError:!1});return J.trim().split(`
8
8
  `).map(($)=>$.trim().split(" ",2)[1]?.trim()).filter(($)=>typeof $==="string")},H2=async()=>{let{stdout:J}=await X(V(),["--no-optional-locks","status","--porcelain"],{preserveOutputOnError:!1}),$=[],q=[];return J.trim().split(`
9
9
  `).filter((K)=>K.length>0).forEach((K)=>{let Q=K.substring(0,2),Y=K.substring(2).trim();if(Q==="??")q.push(Y);else if(Y)$.push(Y)}),{tracked:$,untracked:q}},L2=async()=>{return XJ()},V3=async(J)=>{try{let $=J||`Claude Code auto-stash - ${new Date().toISOString()}`,{untracked:q}=await H2();if(q.length>0){let{code:Q}=await X(V(),["add",...q],{preserveOutputOnError:!1});if(Q!==0)return!1}let{code:K}=await X(V(),["stash","push","--message",$],{preserveOutputOnError:!1});return K===0}catch($){return!1}},UJ=524288000,BJ=5368709120,_J=20000,M2=65536;var AJ=v(()=>{c();e();aJ();a();rJ();s();VJ();nJ();oJ();iJ();NJ=Symbol("git-root-not-found"),zJ=m((J)=>{let $=Date.now();U("info","find_git_root_started");let q=p(J),K=q.substring(0,q.indexOf(MJ)+1)||MJ,Q=0;while(q!==K){try{let Z=M(q,".git");Q++;let A=HJ(Z);if(A.isDirectory()||A.isFile())return U("info","find_git_root_completed",{duration_ms:Date.now()-$,stat_count:Q,found:!0}),q.normalize("NFC")}catch{}let Y=u(q);if(Y===q)break;q=Y}try{let Y=M(K,".git");Q++;let Z=HJ(Y);if(Z.isDirectory()||Z.isFile())return U("info","find_git_root_completed",{duration_ms:Date.now()-$,stat_count:Q,found:!0}),K.normalize("NFC")}catch{}return U("info","find_git_root_completed",{duration_ms:Date.now()-$,stat_count:Q,found:!1}),NJ},(J)=>J,50),G=K2();OJ=m((J)=>{try{let $=f(M(J,".git"),"utf-8").trim();if(!$.startsWith("gitdir:"))return J;let q=p(J,$.slice(7).trim()),K=p(q,f(M(q,"commondir"),"utf-8").trim());if(p(u(q))!==M(K,"worktrees"))return J;if(WJ(f(M(q,"gitdir"),"utf-8").trim())!==M(WJ(J),".git"))return J;if(q2(K)!==".git")return K.normalize("NFC");return u(K).normalize("NFC")}catch{return J}},(J)=>J,50),J3=Q2();V=TJ(()=>{return jJ("git")||"git"}),Y2=TJ(async()=>{let J=Date.now();U("info","is_git_check_started");let $=G(k())!==null;return U("info","is_git_check_completed",{duration_ms:Date.now()-J,is_git:$}),$})});
10
- export{U as Q6,T2 as R6,a as S6,h as T6,c as U6,C as V6,n as W6,w2 as X6,z as Y6,I as Z6,T as _6,F2 as $6,p2 as a7,D2 as b7,VJ as c7,G as d7,J3 as e7,V as f7,Y2 as g7,$3 as h7,q3 as i7,K3 as j7,Z2 as k7,X2 as l7,Q3 as m7,d as n7,V2 as o7,Y3 as p7,A2 as q7,Z3 as r7,W2 as s7,X3 as t7,H2 as u7,L2 as v7,V3 as w7,A3 as x7,W3 as y7,z2 as z7,H3 as A7,L3 as B7,AJ as C7};
10
+ export{U as S6,T2 as T6,a as U6,h as V6,c as W6,C as X6,n as Y6,w2 as Z6,z as _6,I as $6,T as a7,F2 as b7,p2 as c7,D2 as d7,VJ as e7,G as f7,J3 as g7,V as h7,Y2 as i7,$3 as j7,q3 as k7,K3 as l7,Z2 as m7,X2 as n7,Q3 as o7,d as p7,V2 as q7,Y3 as r7,A2 as s7,Z3 as t7,W2 as u7,X3 as v7,H2 as w7,L2 as x7,V3 as y7,A3 as z7,W3 as A7,z2 as B7,H3 as C7,L3 as D7,AJ as E7};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Tm as $,bo as w,jo as g}from"./cli-b3k8arn1.js";import{hda as Z}from"./cli-qwx84m9c.js";import U from"lodash-es/partition.js";import V from"lodash-es/uniqBy.js";function v(z,G,X){let[H,J]=U(V([...z,...G],"name"),w),k=(K,Q)=>K.name.localeCompare(Q.name);return[...J.sort(k),...H.sort(k)]}var W=Z(()=>{$();g()});
2
+ import{Tm as $,bo as w,jo as g}from"./cli-63389c5w.js";import{jda as Z}from"./cli-2afdzhna.js";import U from"lodash-es/partition.js";import V from"lodash-es/uniqBy.js";function v(z,G,X){let[H,J]=U(V([...z,...G],"name"),w),k=(K,Q)=>K.name.localeCompare(Q.name);return[...J.sort(k),...H.sort(k)]}var W=Z(()=>{$();g()});
3
3
  export{v as rb,W as sb};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{EX as z,F1 as V,G1 as G,H1 as W,JX as Q,O1 as J,Q1 as X,b1 as B,g1 as D,h1 as F}from"./cli-192xnkcx.js";import{D9 as y,E9 as N}from"./cli-zxe1a0ey.js";import{hda as M}from"./cli-qwx84m9c.js";import Y from"axios";async function b(){if(!D()||!F())return{};let w=B();if(w&&z(w.expiresAt))return null;let q=J();if(q.error)throw Error(`Auth error: ${q.error}`);let K={"Content-Type":"application/json","User-Agent":G(),...q.headers},L=`${y().BASE_API_URL}/api/oauth/usage`;return(await Y.get(L,{headers:K,timeout:5000})).data}var Z=M(()=>{N();V();X();W();Q()});
2
+ import{JX as z,K1 as V,L1 as G,M1 as W,OX as Q,T1 as J,V1 as X,g1 as B,l1 as D,m1 as F}from"./cli-9sjvqgf1.js";import{F9 as y,G9 as N}from"./cli-4r0qxxn2.js";import{jda as M}from"./cli-2afdzhna.js";import Y from"axios";async function b(){if(!D()||!F())return{};let w=B();if(w&&z(w.expiresAt))return null;let q=J();if(q.error)throw Error(`Auth error: ${q.error}`);let K={"Content-Type":"application/json","User-Agent":G(),...q.headers},L=`${y().BASE_API_URL}/api/oauth/usage`;return(await Y.get(L,{headers:K,timeout:5000})).data}var Z=M(()=>{N();V();X();W();Q()});
3
3
  export{b as rg,Z as sg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{DQ as W,FQ as N,LQ as q_,WQ as E,fR as L,nQ as n,oQ as P_}from"./cli-a2d962bq.js";import{$5 as __,a6 as J_}from"./cli-bdgrtpsy.js";import{hda as J}from"./cli-qwx84m9c.js";import{useContext as K_}from"react";function e(){let f=K_(n);if(!f)throw Error("useTerminalSize must be used within an Ink App component");return f}var Z=J(()=>{P_()});function d(f,_){if(_.escape)return"escape";if(_.return)return"enter";if(_.tab)return"tab";if(_.backspace)return"backspace";if(_.delete)return"delete";if(_.upArrow)return"up";if(_.downArrow)return"down";if(_.leftArrow)return"left";if(_.rightArrow)return"right";if(_.pageUp)return"pageup";if(_.pageDown)return"pagedown";if(_.wheelUp)return"wheelup";if(_.wheelDown)return"wheeldown";if(_.home)return"home";if(_.end)return"end";if(f.length===1)return f.toLowerCase();return null}var G=()=>{};function c(f){let _=f.split("+"),q={key:"",ctrl:!1,alt:!1,shift:!1,meta:!1,super:!1};for(let P of _){let $=P.toLowerCase();switch($){case"ctrl":case"control":q.ctrl=!0;break;case"alt":case"opt":case"option":q.alt=!0;break;case"shift":q.shift=!0;break;case"meta":q.meta=!0;break;case"cmd":case"command":case"super":case"win":q.super=!0;break;case"esc":q.key="escape";break;case"return":q.key="enter";break;case"space":q.key=" ";break;case"\u2191":q.key="up";break;case"\u2193":q.key="down";break;case"\u2190":q.key="left";break;case"\u2192":q.key="right";break;default:q.key=$;break}}return q}function w_(f){if(f===" ")return[c("space")];return f.trim().split(/\s+/).map(c)}function j_(f){let _=[];if(f.ctrl)_.push("ctrl");if(f.alt)_.push("alt");if(f.shift)_.push("shift");if(f.meta)_.push("meta");if(f.super)_.push("cmd");let q=M_(f.key);return _.push(q),_.join("+")}function M_(f){switch(f){case"escape":return"Esc";case" ":return"Space";case"tab":return"tab";case"enter":return"Enter";case"backspace":return"Backspace";case"delete":return"Delete";case"up":return"\u2191";case"down":return"\u2193";case"left":return"\u2190";case"right":return"\u2192";case"pageup":return"PageUp";case"pagedown":return"PageDown";case"home":return"Home";case"end":return"End";default:return f}}function a(f){return f.map(j_).join(" ")}function y_(f){let _=[];for(let q of f)for(let[P,$]of Object.entries(q.bindings))_.push({chord:w_(P),action:$,context:q.context});return _}var x=()=>{};function b(f,_,q){let P=q.findLast(($)=>$.action===f&&$.context===_);return P?a(P.chord):void 0}function z_(f,_){let q=d(f,_);if(!q)return null;let P=_.escape?!1:_.meta;return{key:q,ctrl:_.ctrl,alt:P,shift:_.shift,meta:P,super:_.super}}function g(f,_){return f.key===_.key&&f.ctrl===_.ctrl&&f.shift===_.shift&&(f.alt||f.meta)===(_.alt||_.meta)&&f.super===_.super}function O_(f,_){if(f.length>=_.chord.length)return!1;for(let q=0;q<f.length;q++){let P=f[q],$=_.chord[q];if(!P||!$)return!1;if(!g(P,$))return!1}return!0}function v_(f,_){if(f.length!==_.chord.length)return!1;for(let q=0;q<f.length;q++){let P=f[q],$=_.chord[q];if(!P||!$)return!1;if(!g(P,$))return!1}return!0}function t(f,_,q,P,$){if(_.escape&&$!==null)return{type:"chord_cancelled"};let K=z_(f,_);if(!K){if($!==null)return{type:"chord_cancelled"};return{type:"none"}}let w=$?[...$,K]:[K],M=new Set(q),r=P.filter((j)=>M.has(j.context)),Y=new Map;for(let j of r)if(j.chord.length>w.length&&O_(w,j))Y.set(a(j.chord),j.action);let T=!1;for(let j of Y.values())if(j!==null){T=!0;break}if(T)return{type:"chord_started",pending:w};let z;for(let j of r)if(v_(w,j))z=j;if(z){if(z.action===null)return{type:"unbound"};return{type:"match",action:z.action}}if($!==null)return{type:"chord_cancelled"};return{type:"none"}}var l=J(()=>{G();x()});import{c as I}from"react/compiler-runtime";import{createContext as Y_,useContext as r_,useLayoutEffect as T_}from"react";import{jsxDEV as H_}from"react/jsx-dev-runtime";function d_(f){let _=I(24),{bindings:q,pendingChordRef:P,pendingChord:$,setPendingChord:K,activeContexts:w,registerActiveContext:M,unregisterActiveContext:r,handlerRegistryRef:Y,children:T}=f,z;if(_[0]!==q)z=(O,v)=>b(O,v,q),_[0]=q,_[1]=z;else z=_[1];let j=z,D;if(_[2]!==Y)D=(O)=>{let v=Y.current;if(!v)return A_;if(!v.has(O.action))v.set(O.action,new Set);return v.get(O.action).add(O),()=>{let p=v.get(O.action);if(p){if(p.delete(O),p.size===0)v.delete(O.action)}}},_[2]=Y,_[3]=D;else D=_[3];let k=D,m;if(_[4]!==w||_[5]!==Y)m=(O)=>{let v=Y.current;if(!v)return!1;let p=v.get(O);if(!p||p.size===0)return!1;for(let C of p)if(w.has(C.context))return C.handler(),!0;return!1},_[4]=w,_[5]=Y,_[6]=m;else m=_[6];let o=m,H;if(_[7]!==q||_[8]!==P)H=(O,v,p)=>t(O,v,p,q,P.current),_[7]=q,_[8]=P,_[9]=H;else H=_[9];let u;if(_[10]!==w||_[11]!==q||_[12]!==j||_[13]!==o||_[14]!==$||_[15]!==M||_[16]!==k||_[17]!==K||_[18]!==H||_[19]!==r)u={resolve:H,setPendingChord:K,getDisplayText:j,bindings:q,pendingChord:$,activeContexts:w,registerActiveContext:M,unregisterActiveContext:r,registerHandler:k,invokeAction:o},_[10]=w,_[11]=q,_[12]=j,_[13]=o,_[14]=$,_[15]=M,_[16]=k,_[17]=K,_[18]=H,_[19]=r,_[20]=u;else u=_[20];let h=u,A;if(_[21]!==T||_[22]!==h)A=H_(s.Provider,{value:h,children:T},void 0,!1,void 0,this),_[21]=T,_[22]=h,_[23]=A;else A=_[23];return A}function A_(){}function X(){return r_(s)}function G_(f,_){let q=I(5),P=_===void 0?!0:_,$=X(),K,w;if(q[0]!==f||q[1]!==P||q[2]!==$)K=()=>{if(!$||!P)return;return $.registerActiveContext(f),()=>{$.unregisterActiveContext(f)}},w=[f,$,P],q[0]=f,q[1]=P,q[2]=$,q[3]=K,q[4]=w;else K=q[3],w=q[4];T_(K,w)}var s;var i=J(()=>{l();s=Y_(null)});import{useCallback as F,useEffect as U}from"react";function l_(f,_,q={}){let{context:P="Global",isActive:$=!0}=q,K=X();U(()=>{if(!K||!$)return;return K.registerHandler({action:f,context:P,handler:_})},[f,P,_,K,$]);let w=F((M,r,Y)=>{if(!K)return;let T=[...K.activeContexts,P,"Global"],z=[...new Set(T)],j=K.resolve(M,r,z);switch(j.type){case"match":if(K.setPendingChord(null),j.action===f){if(_()!==!1)Y.stopImmediatePropagation()}break;case"chord_started":K.setPendingChord(j.pending),Y.stopImmediatePropagation();break;case"chord_cancelled":K.setPendingChord(null);break;case"unbound":K.setPendingChord(null),Y.stopImmediatePropagation();break;case"none":break}},[f,P,_,K]);E(w,{isActive:$})}function I_(f,_={}){let{context:q="Global",isActive:P=!0}=_,$=X();U(()=>{if(!$||!P)return;let w=[];for(let[M,r]of Object.entries(f))w.push($.registerHandler({action:M,context:q,handler:r}));return()=>{for(let M of w)M()}},[q,f,$,P]);let K=F((w,M,r)=>{if(!$)return;let Y=[...$.activeContexts,q,"Global"],T=[...new Set(Y)],z=$.resolve(w,M,T);switch(z.type){case"match":if($.setPendingChord(null),z.action in f){let j=f[z.action];if(j&&j()!==!1)r.stopImmediatePropagation()}break;case"chord_started":$.setPendingChord(z.pending),r.stopImmediatePropagation();break;case"chord_cancelled":$.setPendingChord(null);break;case"unbound":$.setPendingChord(null),r.stopImmediatePropagation();break;case"none":break}},[q,f,$]);E(K,{isActive:P})}var h_=J(()=>{L();i()});import{c as D_}from"react/compiler-runtime";import{createContext as p_,useContext as R}from"react";function B(){return R(V)!==null}function U_(f){let _=D_(3),q=R(V),P;if(_[0]!==q||_[1]!==f)P=q?{rows:q.rows,columns:q.columns}:f,_[0]=q,_[1]=f,_[2]=P;else P=_[2];return P}function B_(){return R(V)?.scrollRef??null}var V;var Q=J(()=>{V=p_(null)});import{c as o_}from"react/compiler-runtime";import{jsxDEV as S}from"react/jsx-dev-runtime";function f_(f){let _=o_(21),{width:q,color:P,char:$,padding:K,title:w}=f,M=$===void 0?"\u2500":$,r=K===void 0?0:K,{columns:Y}=e(),T=Math.max(0,(q??Y)-r);if(w){let k=__(w)+2,m=Math.max(0,T-k),o=Math.floor(m/2),H=m-o,u=!P,h;if(_[0]!==M||_[1]!==o)h=M.repeat(o),_[0]=M,_[1]=o,_[2]=h;else h=_[2];let A;if(_[3]!==w)A=S(N,{dimColor:!0,children:S(q_,{children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),_[3]=w,_[4]=A;else A=_[4];let O;if(_[5]!==M||_[6]!==H)O=M.repeat(H),_[5]=M,_[6]=H,_[7]=O;else O=_[7];let v;if(_[8]!==P||_[9]!==u||_[10]!==h||_[11]!==A||_[12]!==O)v=S(N,{color:P,dimColor:u,children:[h," ",A," ",O]},void 0,!0,void 0,this),_[8]=P,_[9]=u,_[10]=h,_[11]=A,_[12]=O,_[13]=v;else v=_[13];return v}let z=!P,j;if(_[14]!==M||_[15]!==T)j=M.repeat(T),_[14]=M,_[15]=T,_[16]=j;else j=_[16];let D;if(_[17]!==P||_[18]!==z||_[19]!==j)D=S(N,{color:P,dimColor:z,children:j},void 0,!1,void 0,this),_[17]=P,_[18]=z,_[19]=j,_[20]=D;else D=_[20];return D}var $_=J(()=>{Z();J_();L()});import{c as u_}from"react/compiler-runtime";import{jsxDEV as y}from"react/jsx-dev-runtime";function O6(f){let _=u_(9),{children:q,color:P}=f;if(B()){let M;if(_[0]!==q)M=y(W,{flexDirection:"column",paddingX:1,flexShrink:0,children:q},void 0,!1,void 0,this),_[0]=q,_[1]=M;else M=_[1];return M}let $;if(_[2]!==P)$=y(f_,{color:P},void 0,!1,void 0,this),_[2]=P,_[3]=$;else $=_[3];let K;if(_[4]!==q)K=y(W,{flexDirection:"column",paddingX:2,children:q},void 0,!1,void 0,this),_[4]=q,_[5]=K;else K=_[5];let w;if(_[6]!==$||_[7]!==K)w=y(W,{flexDirection:"column",paddingTop:1,children:[$,K]},void 0,!0,void 0,this),_[6]=$,_[7]=K,_[8]=w;else w=_[8];return w}var m_=J(()=>{Q();L();$_()});
3
- export{e as EO,Z as FO,c as GO,w_ as HO,a as IO,y_ as JO,x as KO,b as LO,t as MO,l as NO,d_ as OO,X as PO,G_ as QO,i as RO,l_ as SO,I_ as TO,h_ as UO,V as VO,B as WO,U_ as XO,B_ as YO,Q as ZO,f_ as _O,$_ as $O,O6 as aP,m_ as bP};
2
+ import{FQ as W,HQ as N,NQ as q_,YQ as E,hR as L,pQ as n,qQ as P_}from"./cli-7dm5ex18.js";import{b6 as __,c6 as J_}from"./cli-h3vttdhj.js";import{jda as J}from"./cli-2afdzhna.js";import{useContext as K_}from"react";function e(){let f=K_(n);if(!f)throw Error("useTerminalSize must be used within an Ink App component");return f}var Z=J(()=>{P_()});function d(f,_){if(_.escape)return"escape";if(_.return)return"enter";if(_.tab)return"tab";if(_.backspace)return"backspace";if(_.delete)return"delete";if(_.upArrow)return"up";if(_.downArrow)return"down";if(_.leftArrow)return"left";if(_.rightArrow)return"right";if(_.pageUp)return"pageup";if(_.pageDown)return"pagedown";if(_.wheelUp)return"wheelup";if(_.wheelDown)return"wheeldown";if(_.home)return"home";if(_.end)return"end";if(f.length===1)return f.toLowerCase();return null}var G=()=>{};function c(f){let _=f.split("+"),q={key:"",ctrl:!1,alt:!1,shift:!1,meta:!1,super:!1};for(let P of _){let $=P.toLowerCase();switch($){case"ctrl":case"control":q.ctrl=!0;break;case"alt":case"opt":case"option":q.alt=!0;break;case"shift":q.shift=!0;break;case"meta":q.meta=!0;break;case"cmd":case"command":case"super":case"win":q.super=!0;break;case"esc":q.key="escape";break;case"return":q.key="enter";break;case"space":q.key=" ";break;case"\u2191":q.key="up";break;case"\u2193":q.key="down";break;case"\u2190":q.key="left";break;case"\u2192":q.key="right";break;default:q.key=$;break}}return q}function w_(f){if(f===" ")return[c("space")];return f.trim().split(/\s+/).map(c)}function j_(f){let _=[];if(f.ctrl)_.push("ctrl");if(f.alt)_.push("alt");if(f.shift)_.push("shift");if(f.meta)_.push("meta");if(f.super)_.push("cmd");let q=M_(f.key);return _.push(q),_.join("+")}function M_(f){switch(f){case"escape":return"Esc";case" ":return"Space";case"tab":return"tab";case"enter":return"Enter";case"backspace":return"Backspace";case"delete":return"Delete";case"up":return"\u2191";case"down":return"\u2193";case"left":return"\u2190";case"right":return"\u2192";case"pageup":return"PageUp";case"pagedown":return"PageDown";case"home":return"Home";case"end":return"End";default:return f}}function a(f){return f.map(j_).join(" ")}function y_(f){let _=[];for(let q of f)for(let[P,$]of Object.entries(q.bindings))_.push({chord:w_(P),action:$,context:q.context});return _}var x=()=>{};function b(f,_,q){let P=q.findLast(($)=>$.action===f&&$.context===_);return P?a(P.chord):void 0}function z_(f,_){let q=d(f,_);if(!q)return null;let P=_.escape?!1:_.meta;return{key:q,ctrl:_.ctrl,alt:P,shift:_.shift,meta:P,super:_.super}}function g(f,_){return f.key===_.key&&f.ctrl===_.ctrl&&f.shift===_.shift&&(f.alt||f.meta)===(_.alt||_.meta)&&f.super===_.super}function O_(f,_){if(f.length>=_.chord.length)return!1;for(let q=0;q<f.length;q++){let P=f[q],$=_.chord[q];if(!P||!$)return!1;if(!g(P,$))return!1}return!0}function v_(f,_){if(f.length!==_.chord.length)return!1;for(let q=0;q<f.length;q++){let P=f[q],$=_.chord[q];if(!P||!$)return!1;if(!g(P,$))return!1}return!0}function t(f,_,q,P,$){if(_.escape&&$!==null)return{type:"chord_cancelled"};let K=z_(f,_);if(!K){if($!==null)return{type:"chord_cancelled"};return{type:"none"}}let w=$?[...$,K]:[K],M=new Set(q),r=P.filter((j)=>M.has(j.context)),Y=new Map;for(let j of r)if(j.chord.length>w.length&&O_(w,j))Y.set(a(j.chord),j.action);let T=!1;for(let j of Y.values())if(j!==null){T=!0;break}if(T)return{type:"chord_started",pending:w};let z;for(let j of r)if(v_(w,j))z=j;if(z){if(z.action===null)return{type:"unbound"};return{type:"match",action:z.action}}if($!==null)return{type:"chord_cancelled"};return{type:"none"}}var l=J(()=>{G();x()});import{c as I}from"react/compiler-runtime";import{createContext as Y_,useContext as r_,useLayoutEffect as T_}from"react";import{jsxDEV as H_}from"react/jsx-dev-runtime";function d_(f){let _=I(24),{bindings:q,pendingChordRef:P,pendingChord:$,setPendingChord:K,activeContexts:w,registerActiveContext:M,unregisterActiveContext:r,handlerRegistryRef:Y,children:T}=f,z;if(_[0]!==q)z=(O,v)=>b(O,v,q),_[0]=q,_[1]=z;else z=_[1];let j=z,D;if(_[2]!==Y)D=(O)=>{let v=Y.current;if(!v)return A_;if(!v.has(O.action))v.set(O.action,new Set);return v.get(O.action).add(O),()=>{let p=v.get(O.action);if(p){if(p.delete(O),p.size===0)v.delete(O.action)}}},_[2]=Y,_[3]=D;else D=_[3];let k=D,m;if(_[4]!==w||_[5]!==Y)m=(O)=>{let v=Y.current;if(!v)return!1;let p=v.get(O);if(!p||p.size===0)return!1;for(let C of p)if(w.has(C.context))return C.handler(),!0;return!1},_[4]=w,_[5]=Y,_[6]=m;else m=_[6];let o=m,H;if(_[7]!==q||_[8]!==P)H=(O,v,p)=>t(O,v,p,q,P.current),_[7]=q,_[8]=P,_[9]=H;else H=_[9];let u;if(_[10]!==w||_[11]!==q||_[12]!==j||_[13]!==o||_[14]!==$||_[15]!==M||_[16]!==k||_[17]!==K||_[18]!==H||_[19]!==r)u={resolve:H,setPendingChord:K,getDisplayText:j,bindings:q,pendingChord:$,activeContexts:w,registerActiveContext:M,unregisterActiveContext:r,registerHandler:k,invokeAction:o},_[10]=w,_[11]=q,_[12]=j,_[13]=o,_[14]=$,_[15]=M,_[16]=k,_[17]=K,_[18]=H,_[19]=r,_[20]=u;else u=_[20];let h=u,A;if(_[21]!==T||_[22]!==h)A=H_(s.Provider,{value:h,children:T},void 0,!1,void 0,this),_[21]=T,_[22]=h,_[23]=A;else A=_[23];return A}function A_(){}function X(){return r_(s)}function G_(f,_){let q=I(5),P=_===void 0?!0:_,$=X(),K,w;if(q[0]!==f||q[1]!==P||q[2]!==$)K=()=>{if(!$||!P)return;return $.registerActiveContext(f),()=>{$.unregisterActiveContext(f)}},w=[f,$,P],q[0]=f,q[1]=P,q[2]=$,q[3]=K,q[4]=w;else K=q[3],w=q[4];T_(K,w)}var s;var i=J(()=>{l();s=Y_(null)});import{useCallback as F,useEffect as U}from"react";function l_(f,_,q={}){let{context:P="Global",isActive:$=!0}=q,K=X();U(()=>{if(!K||!$)return;return K.registerHandler({action:f,context:P,handler:_})},[f,P,_,K,$]);let w=F((M,r,Y)=>{if(!K)return;let T=[...K.activeContexts,P,"Global"],z=[...new Set(T)],j=K.resolve(M,r,z);switch(j.type){case"match":if(K.setPendingChord(null),j.action===f){if(_()!==!1)Y.stopImmediatePropagation()}break;case"chord_started":K.setPendingChord(j.pending),Y.stopImmediatePropagation();break;case"chord_cancelled":K.setPendingChord(null);break;case"unbound":K.setPendingChord(null),Y.stopImmediatePropagation();break;case"none":break}},[f,P,_,K]);E(w,{isActive:$})}function I_(f,_={}){let{context:q="Global",isActive:P=!0}=_,$=X();U(()=>{if(!$||!P)return;let w=[];for(let[M,r]of Object.entries(f))w.push($.registerHandler({action:M,context:q,handler:r}));return()=>{for(let M of w)M()}},[q,f,$,P]);let K=F((w,M,r)=>{if(!$)return;let Y=[...$.activeContexts,q,"Global"],T=[...new Set(Y)],z=$.resolve(w,M,T);switch(z.type){case"match":if($.setPendingChord(null),z.action in f){let j=f[z.action];if(j&&j()!==!1)r.stopImmediatePropagation()}break;case"chord_started":$.setPendingChord(z.pending),r.stopImmediatePropagation();break;case"chord_cancelled":$.setPendingChord(null);break;case"unbound":$.setPendingChord(null),r.stopImmediatePropagation();break;case"none":break}},[q,f,$]);E(K,{isActive:P})}var h_=J(()=>{L();i()});import{c as D_}from"react/compiler-runtime";import{createContext as p_,useContext as R}from"react";function B(){return R(V)!==null}function U_(f){let _=D_(3),q=R(V),P;if(_[0]!==q||_[1]!==f)P=q?{rows:q.rows,columns:q.columns}:f,_[0]=q,_[1]=f,_[2]=P;else P=_[2];return P}function B_(){return R(V)?.scrollRef??null}var V;var Q=J(()=>{V=p_(null)});import{c as o_}from"react/compiler-runtime";import{jsxDEV as S}from"react/jsx-dev-runtime";function f_(f){let _=o_(21),{width:q,color:P,char:$,padding:K,title:w}=f,M=$===void 0?"\u2500":$,r=K===void 0?0:K,{columns:Y}=e(),T=Math.max(0,(q??Y)-r);if(w){let k=__(w)+2,m=Math.max(0,T-k),o=Math.floor(m/2),H=m-o,u=!P,h;if(_[0]!==M||_[1]!==o)h=M.repeat(o),_[0]=M,_[1]=o,_[2]=h;else h=_[2];let A;if(_[3]!==w)A=S(N,{dimColor:!0,children:S(q_,{children:w},void 0,!1,void 0,this)},void 0,!1,void 0,this),_[3]=w,_[4]=A;else A=_[4];let O;if(_[5]!==M||_[6]!==H)O=M.repeat(H),_[5]=M,_[6]=H,_[7]=O;else O=_[7];let v;if(_[8]!==P||_[9]!==u||_[10]!==h||_[11]!==A||_[12]!==O)v=S(N,{color:P,dimColor:u,children:[h," ",A," ",O]},void 0,!0,void 0,this),_[8]=P,_[9]=u,_[10]=h,_[11]=A,_[12]=O,_[13]=v;else v=_[13];return v}let z=!P,j;if(_[14]!==M||_[15]!==T)j=M.repeat(T),_[14]=M,_[15]=T,_[16]=j;else j=_[16];let D;if(_[17]!==P||_[18]!==z||_[19]!==j)D=S(N,{color:P,dimColor:z,children:j},void 0,!1,void 0,this),_[17]=P,_[18]=z,_[19]=j,_[20]=D;else D=_[20];return D}var $_=J(()=>{Z();J_();L()});import{c as u_}from"react/compiler-runtime";import{jsxDEV as y}from"react/jsx-dev-runtime";function O6(f){let _=u_(9),{children:q,color:P}=f;if(B()){let M;if(_[0]!==q)M=y(W,{flexDirection:"column",paddingX:1,flexShrink:0,children:q},void 0,!1,void 0,this),_[0]=q,_[1]=M;else M=_[1];return M}let $;if(_[2]!==P)$=y(f_,{color:P},void 0,!1,void 0,this),_[2]=P,_[3]=$;else $=_[3];let K;if(_[4]!==q)K=y(W,{flexDirection:"column",paddingX:2,children:q},void 0,!1,void 0,this),_[4]=q,_[5]=K;else K=_[5];let w;if(_[6]!==$||_[7]!==K)w=y(W,{flexDirection:"column",paddingTop:1,children:[$,K]},void 0,!0,void 0,this),_[6]=$,_[7]=K,_[8]=w;else w=_[8];return w}var m_=J(()=>{Q();L();$_()});
3
+ export{e as GO,Z as HO,c as IO,w_ as JO,a as KO,y_ as LO,x as MO,b as NO,t as OO,l as PO,d_ as QO,X as RO,G_ as SO,i as TO,l_ as UO,I_ as VO,h_ as WO,V as XO,B as YO,U_ as ZO,B_ as _O,Q as $O,f_ as aP,$_ as bP,O6 as cP,m_ as dP};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{$4 as V,a5 as S}from"./cli-t5ddsvmv.js";import{E7 as y,F7 as I}from"./cli-yfb8bk69.js";import{G8 as z,L8 as _}from"./cli-8kpqq0ea.js";import{f_ as T,j_ as m}from"./cli-awb77t95.js";import{hda as v,jda as x,kda as M}from"./cli-qwx84m9c.js";function H(U){return U.startsWith("\uFEFF")?U.slice(1):U}var X=()=>{};import{open as J,readFile as R,stat as c}from"fs/promises";import{applyEdits as L,modify as b,parse as w}from"jsonc-parser/lib/esm/main.js";function A(U,W){try{return{ok:!0,value:JSON.parse(H(U))}}catch(q){if(W)z(q);return{ok:!1}}}function $F(U){if(!U)return null;try{return w(H(U))}catch(W){return z(W),null}}function E(U){let W=C,q=U.length,k=W(U);if(!k.error||k.done||k.read>=q)return k.values;let{values:G,read:Q}=k;while(Q<q){let $=typeof U==="string"?U.indexOf(`
2
+ import{b5 as V,c5 as S}from"./cli-461ebjmk.js";import{G7 as y,H7 as I}from"./cli-ymqdnbx2.js";import{I8 as z,N8 as _}from"./cli-eehgc06t.js";import{h_ as T,l_ as m}from"./cli-bqs5smsv.js";import{jda as v,lda as x,mda as M}from"./cli-2afdzhna.js";function H(U){return U.startsWith("\uFEFF")?U.slice(1):U}var X=()=>{};import{open as J,readFile as R,stat as c}from"fs/promises";import{applyEdits as L,modify as b,parse as w}from"jsonc-parser/lib/esm/main.js";function A(U,W){try{return{ok:!0,value:JSON.parse(H(U))}}catch(q){if(W)z(q);return{ok:!1}}}function $F(U){if(!U)return null;try{return w(H(U))}catch(W){return z(W),null}}function E(U){let W=C,q=U.length,k=W(U);if(!k.error||k.done||k.read>=q)return k.values;let{values:G,read:Q}=k;while(Q<q){let $=typeof U==="string"?U.indexOf(`
3
3
  `,Q):U.indexOf(10,Q);if($===-1)break;Q=$+1;let Z=W(U,Q);if(Z.values.length>0)G=G.concat(Z.values);if(!Z.error||Z.done||Z.read>=q)break;Q=Z.read}return G}function i(U){let W=U.length,q=0;if(U[0]===239&&U[1]===187&&U[2]===191)q=3;let k=[];while(q<W){let G=U.indexOf(10,q);if(G===-1)G=W;let Q=U.toString("utf8",q,G).trim();if(q=G+1,!Q)continue;try{k.push(JSON.parse(Q))}catch{}}return k}function p(U){let W=H(U),q=W.length,k=0,G=[];while(k<q){let Q=W.indexOf(`
4
4
  `,k);if(Q===-1)Q=q;let $=W.substring(k,Q).trim();if(k=Q+1,!$)continue;try{G.push(JSON.parse($))}catch{}}return G}function D(U){if(C)return E(U);if(typeof U==="string")return p(U);return i(U)}async function HF(U){let Z=[];try{let{size:W}=await c(U);if(W<=K)return D(await R(U));const q=x(Z,await J(U,"r"),1);let k=Buffer.allocUnsafe(K);let G=0;let Q=W-K;while(G<K){let{bytesRead:P}=await q.read(k,G,K-G,Q+G);if(P===0)break;G+=P}let $=k.indexOf(10);if($!==-1&&$<G-1)return D(k.subarray($+1,G));return D(k.subarray(0,G))}catch(B){var h=B,g=1}finally{var N=M(Z,h,g);N&&await N}}function KF(U,W){try{if(!U||U.trim()==="")return T([W],null,4);let q=H(U),k=w(q);if(Array.isArray(k)){let G=k.length,Z=b(q,G===0?[0]:[G],W,{formattingOptions:{insertSpaces:!0,tabSize:4},isArrayInsertion:!0});if(!Z||Z.length===0){let B=[...k,W];return T(B,null,4)}return L(q,Z)}else return T([W],null,4)}catch(q){return z(q),T([W],null,4)}}var j=8192,Y,ZF,C,K=104857600;var u=v(()=>{X();_();I();m();Y=y(A,(U)=>U,50),ZF=Object.assign(function(W,q=!0){if(!W)return null;let k=W.length>j?A(W,q):Y(W,q);return k.ok?k.value:null},{cache:Y.cache});C=(()=>{if(typeof Bun>"u")return!1;let W=Bun.JSONL;if(!W?.parseChunk)return!1;return W.parseChunk})()});import{z as F}from"zod/v4";var DF,PF,f,l,O,d,o,s,r,t,n,a,e,XF;var FF=v(()=>{S();DF=V(()=>F.enum(["local","user","project","dynamic","enterprise","claudeai","managed"])),PF=V(()=>F.enum(["stdio","sse","sse-ide","http","ws","sdk"])),f=V(()=>F.object({type:F.literal("stdio").optional(),command:F.string().min(1,"Command cannot be empty"),args:F.array(F.string()).default([]),env:F.record(F.string(),F.string()).optional()})),l=V(()=>F.boolean()),O=V(()=>F.object({clientId:F.string().optional(),callbackPort:F.number().int().positive().optional(),authServerMetadataUrl:F.string().url().startsWith("https://",{message:"authServerMetadataUrl must use https://"}).optional(),xaa:l().optional()})),d=V(()=>F.object({type:F.literal("sse"),url:F.string(),headers:F.record(F.string(),F.string()).optional(),headersHelper:F.string().optional(),oauth:O().optional()})),o=V(()=>F.object({type:F.literal("sse-ide"),url:F.string(),ideName:F.string(),ideRunningInWindows:F.boolean().optional()})),s=V(()=>F.object({type:F.literal("ws-ide"),url:F.string(),ideName:F.string(),authToken:F.string().optional(),ideRunningInWindows:F.boolean().optional()})),r=V(()=>F.object({type:F.literal("http"),url:F.string(),headers:F.record(F.string(),F.string()).optional(),headersHelper:F.string().optional(),oauth:O().optional()})),t=V(()=>F.object({type:F.literal("ws"),url:F.string(),headers:F.record(F.string(),F.string()).optional(),headersHelper:F.string().optional()})),n=V(()=>F.object({type:F.literal("sdk"),name:F.string()})),a=V(()=>F.object({type:F.literal("claudeai-proxy"),url:F.string(),id:F.string()})),e=V(()=>F.union([f(),d(),o(),s(),r(),t(),n(),a()])),XF=V(()=>F.object({mcpServers:F.record(F.string(),e())}))});
5
- export{H as R3,X as S3,ZF as T3,$F as U3,D as V3,HF as W3,KF as X3,u as Y3,DF as Z3,f as _3,e as $3,XF as a4,FF as b4};
5
+ export{H as T3,X as U3,ZF as V3,$F as W3,D as X3,HF as Y3,KF as Z3,u as _3,DF as $3,f as a4,e as b4,XF as c4,FF as d4};
@@ -0,0 +1,3 @@
1
+ // @bun
2
+ import{Bf as f,Gf as c}from"./cli-nhks97kf.js";import{Hf as F,Jf as l}from"./cli-zrth7vt6.js";import{AC as i,Fj as Z,Gj as A,IB as x,Ix as b,JB as n,Jx as S,Qj as _,Rv as M,Sv as g,VG as W,Vj as P,Wi as Y,Wj as $,Xi as v,Xj as B,Yj as N,Zj as V,_j as D,aF as U,bu as L,cF as o,dH as s,dx as R,ex as C,ey as j,fy as h,gu as d,jl as z,kl as p,vp as E,xC as G,xp as m}from"./cli-63389c5w.js";import{L6 as X,R6 as I}from"./cli-a2f4j8s5.js";import{Z6 as Q,e7 as u}from"./cli-v86f53k0.js";import{Lca as O,fda as k,zca as K}from"./cli-ktzb7cwm.js";import{jda as T,kda as w}from"./cli-2afdzhna.js";function Mq(J=new Set){let H=J.size>0;if(V.cache.clear?.(),N.cache.clear?.(),B.cache.clear?.(),Y.cache.clear?.(),f(),W(),!H)Z();if($(null),O(null),x(),G(),_("session_start"),E(),M(),!H)L();if(process.env.USER_TYPE==="ant")import("./TungstenTool-3f5rj0vm.js").then(({clearSessionsWithTungstenUsage:q,resetInitializationState:y})=>{q(),y()});if(X(),U(),!H)z();K(J),Q(),j(),R(),F(),b(),import("./utils-5nwk1214.js").then(({clearWebFetchCache:q})=>q()),import("./ToolSearchTool-e8x4b1xy.js").then(({clearToolSearchDescriptionCache:q})=>q()),import("./loadAgentsDir-858gc42y.js").then(({clearAgentDefinitionsCache:q})=>q()),import("./prompt-2vc9x4tz.js").then(({clearPromptCache:q})=>q())}var r=T(()=>{k();s();v();D();c();d();p();A();g();n();C();l();h();i();o();P();I();u();m();S()});
3
+ export{Mq as yf,r as zf};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{MK as a,NK as E,PK as r,QK as o,RK as s,WK as KQ}from"./cli-7jw2qe69.js";import{G1 as N,H1 as t}from"./cli-192xnkcx.js";import{s5 as n,z5 as JQ}from"./cli-2428yw99.js";import{D5 as U,E5 as I}from"./cli-hpxspent.js";import{Q6 as Y,S6 as h}from"./cli-yb5m6jwq.js";import{$8 as WQ,_8 as u}from"./cli-e5yek4vx.js";import{A_ as b,Z9 as H,_9 as i,d_ as F,f_ as k,g_ as R,j_ as y,x_ as K}from"./cli-awb77t95.js";WQ();b();h();F();y();function D(Q){if(Q<60000)return`${Math.round(Q/1000)}s`;let W=Math.floor(Q/60000),Z=Math.round(Q%60000/1000);return Z>0?`${W}m ${Z}s`:`${W}m`}function ZQ(Q){let Z=(Q.startsWith("sk-ant-si-")?Q.slice(10):Q).split(".");if(Z.length!==3||!Z[1])return null;try{return R(Buffer.from(Z[1],"base64url").toString("utf8"))}catch{return null}}function f(Q){let W=ZQ(Q);if(W!==null&&typeof W==="object"&&"exp"in W&&typeof W.exp==="number")return W.exp;return null}var $Q=300000,p=1800000,m=3,zQ=60000;function DQ({getAccessToken:Q,onRefresh:W,label:Z,refreshBufferMs:z=$Q}){let $=new Map,J=new Map,G=new Map;function X(V){let w=(G.get(V)??0)+1;return G.set(V,w),w}function q(V,w){let j=f(w);if(!j){K(`[${Z}:token] Could not decode JWT expiry for sessionId=${V}, token prefix=${w.slice(0,15)}\u2026, keeping existing timer`);return}let C=$.get(V);if(C)clearTimeout(C);let B=X(V),P=new Date(j*1000).toISOString(),v=j*1000-Date.now()-z;if(v<=0){K(`[${Z}:token] Token for sessionId=${V} expires=${P} (past or within buffer), refreshing immediately`),O(V,B);return}K(`[${Z}:token] Scheduled token refresh for sessionId=${V} in ${D(v)} (expires=${P}, buffer=${z/1000}s)`);let QQ=setTimeout(O,v,V,B);$.set(V,QQ)}function L(V,w){let j=$.get(V);if(j)clearTimeout(j);let C=X(V),B=Math.max(w*1000-z,30000);K(`[${Z}:token] Scheduled token refresh for sessionId=${V} in ${D(B)} (expires_in=${w}s, buffer=${z/1000}s)`);let P=setTimeout(O,B,V,C);$.set(V,P)}async function O(V,w){let j;try{j=await Q()}catch(B){K(`[${Z}:token] getAccessToken threw for sessionId=${V}: ${H(B)}`,{level:"error"})}if(G.get(V)!==w){K(`[${Z}:token] doRefresh for sessionId=${V} stale (gen ${w} vs ${G.get(V)}), skipping`);return}if(!j){let B=(J.get(V)??0)+1;if(J.set(V,B),K(`[${Z}:token] No OAuth token available for refresh, sessionId=${V} (failure ${B}/${m})`,{level:"error"}),Y("error","bridge_token_refresh_no_oauth"),B<m){let P=setTimeout(O,zQ,V,w);$.set(V,P)}return}J.delete(V),K(`[${Z}:token] Refreshing token for sessionId=${V}: new token prefix=${j.slice(0,15)}\u2026`),u("tengu_bridge_token_refreshed",{}),W(V,j);let C=setTimeout(O,p,V,w);$.set(V,C),K(`[${Z}:token] Scheduled follow-up refresh for sessionId=${V} in ${D(p)}`)}function _(V){X(V);let w=$.get(V);if(w)clearTimeout(w),$.delete(V);J.delete(V)}function e(){for(let V of G.keys())X(V);for(let V of $.values())clearTimeout(V);$.clear(),J.clear()}return{schedule:q,scheduleFromExpiresIn:L,cancel:_,cancelAll:e}}import{randomUUID as g}from"crypto";b();h();F();JQ();KQ();r();I();t();y();class T extends Error{retryAfterMs;constructor(Q,W){super(Q);this.retryAfterMs=W}}class x{pending=[];pendingAtClose=0;draining=!1;closed=!1;backpressureResolvers=[];sleepResolve=null;flushResolvers=[];droppedBatches=0;config;constructor(Q){this.config=Q}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(Q){if(this.closed)return;let W=Array.isArray(Q)?Q:[Q];if(W.length===0)return;while(this.pending.length+W.length>this.config.maxQueueSize&&!this.closed)await new Promise((Z)=>{this.backpressureResolvers.push(Z)});if(this.closed)return;this.pending.push(...W),this.drain()}flush(){if(this.pending.length===0&&!this.draining)return Promise.resolve();return this.drain(),new Promise((Q)=>{this.flushResolvers.push(Q)})}close(){if(this.closed)return;this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let Q of this.backpressureResolvers)Q();this.backpressureResolvers=[];for(let Q of this.flushResolvers)Q();this.flushResolvers=[]}async drain(){if(this.draining||this.closed)return;this.draining=!0;let Q=0;try{while(this.pending.length>0&&!this.closed){let W=this.takeBatch();if(W.length===0)continue;try{await this.config.send(W),Q=0}catch(Z){if(Q++,this.config.maxConsecutiveFailures!==void 0&&Q>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(W.length,Q),Q=0,this.releaseBackpressure();continue}this.pending=W.concat(this.pending);let z=Z instanceof T?Z.retryAfterMs:void 0;await this.sleep(this.retryDelay(Q,z));continue}this.releaseBackpressure()}}finally{if(this.draining=!1,this.pending.length===0){for(let W of this.flushResolvers)W();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:Q,maxBatchBytes:W}=this.config;if(W===void 0)return this.pending.splice(0,Q);let Z=0,z=0;while(z<this.pending.length&&z<Q){let $;try{$=Buffer.byteLength(k(this.pending[z]))}catch{this.pending.splice(z,1);continue}if(z>0&&Z+$>W)break;Z+=$,z++}return this.pending.splice(0,z)}retryDelay(Q,W){let Z=Math.random()*this.config.jitterMs;if(W!==void 0)return Math.max(this.config.baseDelayMs,Math.min(W,this.config.maxDelayMs))+Z;return Math.min(this.config.baseDelayMs*2**(Q-1),this.config.maxDelayMs)+Z}releaseBackpressure(){let Q=this.backpressureResolvers;this.backpressureResolvers=[];for(let W of Q)W()}sleep(Q){return new Promise((W)=>{this.sleepResolve=W,setTimeout((Z,z)=>{Z.sleepResolve=null,z()},Q,this,W)})}}I();class c{inflight=null;pending=null;closed=!1;config;constructor(Q){this.config=Q}enqueue(Q){if(this.closed)return;this.pending=this.pending?d(this.pending,Q):Q,this.drain()}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed)return;if(!this.pending)return;let Q=this.pending;this.pending=null,this.inflight=this.sendWithRetry(Q).then(()=>{if(this.inflight=null,this.pending&&!this.closed)this.drain()})}async sendWithRetry(Q){let W=Q,Z=0;while(!this.closed){if(await this.config.send(W))return;if(Z++,await U(this.retryDelay(Z)),this.pending&&!this.closed)W=d(W,this.pending),this.pending=null}}retryDelay(Q){let W=Math.min(this.config.baseDelayMs*2**(Q-1),this.config.maxDelayMs),Z=Math.random()*this.config.jitterMs;return W+Z}}function d(Q,W){let Z={...Q};for(let[z,$]of Object.entries(W))if((z==="external_metadata"||z==="internal_metadata")&&Z[z]&&typeof Z[z]==="object"&&typeof $==="object"&&$!==null)Z[z]={...Z[z],...$};else Z[z]=$;return Z}var GQ=20000,VQ=100;function l(){return!0}class M extends Error{reason;constructor(Q){super(`CCRClient init failed: ${Q}`);this.reason=Q}}var YQ=10;function XQ(){return{byMessage:new Map,scopeToMessage:new Map}}function S(Q){return`${Q.session_id}:${Q.parent_tool_use_id??""}`}function qQ(Q,W){let Z=[],z=new Map;for(let $ of Q)switch($.event.type){case"message_start":{let J=$.event.message.id,G=W.scopeToMessage.get(S($));if(G)W.byMessage.delete(G);W.scopeToMessage.set(S($),J),W.byMessage.set(J,[]),Z.push($);break}case"content_block_delta":{if($.event.delta.type!=="text_delta"){Z.push($);break}let J=W.scopeToMessage.get(S($)),G=J?W.byMessage.get(J):void 0;if(!G){Z.push($);break}let X=G[$.event.index]??=[];X.push($.event.delta.text);let q=z.get(X);if(q){q.event.delta.text=X.join("");break}let L={type:"stream_event",uuid:$.uuid,session_id:$.session_id,parent_tool_use_id:$.parent_tool_use_id,event:{type:"content_block_delta",index:$.event.index,delta:{type:"text_delta",text:X.join("")}}};z.set(X,L),Z.push(L);break}default:Z.push($)}return Z}function wQ(Q,W){Q.byMessage.delete(W.message.id);let Z=S(W);if(Q.scopeToMessage.get(Z)===W.message.id)Q.scopeToMessage.delete(Z)}class LQ{workerEpoch=0;heartbeatIntervalMs;heartbeatJitterFraction;heartbeatTimer=null;heartbeatInFlight=!1;closed=!1;consecutiveAuthFailures=0;currentState=null;sessionBaseUrl;sessionId;http=n({keepAlive:!0});streamEventBuffer=[];streamEventTimer=null;streamTextAccumulator=XQ();workerState;eventUploader;internalEventUploader;deliveryUploader;onEpochMismatch;getAuthHeaders;constructor(Q,W,Z){if(this.onEpochMismatch=Z?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=Z?.heartbeatIntervalMs??GQ,this.heartbeatJitterFraction=Z?.heartbeatJitterFraction??0,this.getAuthHeaders=Z?.getAuthHeaders??E,W.protocol!=="http:"&&W.protocol!=="https:")throw Error(`CCRClient: Expected http(s) URL, got ${W.protocol}`);let z=W.pathname.replace(/\/$/,"");this.sessionBaseUrl=`${W.protocol}//${W.host}${z}`,this.sessionId=z.split("/").pop()||"",this.workerState=new c({send:($)=>this.request("put","/worker",{worker_epoch:this.workerEpoch,...$},"PUT worker").then((J)=>J.ok),baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),this.eventUploader=new x({maxBatchSize:100,maxBatchBytes:10485760,maxQueueSize:1e5,send:async($)=>{let J=await this.request("post","/worker/events",{worker_epoch:this.workerEpoch,events:$},"client events");if(!J.ok)throw new T("client event POST failed",J.retryAfterMs)},baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),this.internalEventUploader=new x({maxBatchSize:100,maxBatchBytes:10485760,maxQueueSize:200,send:async($)=>{let J=await this.request("post","/worker/internal-events",{worker_epoch:this.workerEpoch,events:$},"internal events");if(!J.ok)throw new T("internal event POST failed",J.retryAfterMs)},baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),this.deliveryUploader=new x({maxBatchSize:64,maxQueueSize:64,send:async($)=>{let J=await this.request("post","/worker/events/delivery",{worker_epoch:this.workerEpoch,updates:$.map((G)=>({event_id:G.eventId,status:G.status}))},"delivery batch");if(!J.ok)throw new T("delivery POST failed",J.retryAfterMs)},baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),Q.setOnEvent(($)=>{this.reportDelivery($.event_id,"received")})}async initialize(Q){let W=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M("no_auth_headers");if(Q===void 0){let G=process.env.CLAUDE_CODE_WORKER_EPOCH;Q=G?parseInt(G,10):NaN}if(isNaN(Q))throw new M("missing_epoch");this.workerEpoch=Q;let Z=this.getWorkerState();if(!(await this.request("put","/worker",{worker_status:"idle",worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null}},"PUT worker (init)")).ok)throw new M("worker_register_failed");this.currentState="idle",this.startHeartbeat(),o(()=>{this.writeEvent({type:"keep_alive"})}),K(`CCRClient: initialized, epoch=${this.workerEpoch}`),Y("info","cli_worker_lifecycle_initialized",{epoch:this.workerEpoch,duration_ms:Date.now()-W});let{metadata:$,durationMs:J}=await Z;if(!this.closed)Y("info","cli_worker_state_restored",{duration_ms:J,had_state:$!==null});return $}async getWorkerState(){let Q=Date.now(),W=this.getAuthHeaders();if(Object.keys(W).length===0)return{metadata:null,durationMs:0};return{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,W,"worker_state"))?.worker?.external_metadata??null,durationMs:Date.now()-Q}}async request(Q,W,Z,z,{timeout:$=1e4}={}){let J=this.getAuthHeaders();if(Object.keys(J).length===0)return{ok:!1};try{let G=await this.http[Q](`${this.sessionBaseUrl}${W}`,Z,{headers:{...J,"Content-Type":"application/json","anthropic-version":"2023-06-01","User-Agent":N()},validateStatus:l,timeout:$});if(G.status>=200&&G.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(G.status===409)this.handleEpochMismatch();if(G.status===401||G.status===403){let X=a(),q=X?f(X):null;if(q!==null&&q*1000<Date.now())K(`CCRClient: session_token expired (exp=${new Date(q*1000).toISOString()}) \u2014 no refresh was delivered, exiting`,{level:"error"}),Y("error","cli_worker_token_expired_no_refresh"),this.onEpochMismatch();if(this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=YQ)K(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token \u2014 server-side auth unrecoverable, exiting`,{level:"error"}),Y("error","cli_worker_auth_failures_exhausted"),this.onEpochMismatch()}if(K(`CCRClient: ${z} returned ${G.status}`,{level:"warn"}),Y("warn","cli_worker_request_failed",{method:Q,path:W,status:G.status}),G.status===429){let X=G.headers?.["retry-after"],q=typeof X==="string"?parseInt(X,10):NaN;if(!isNaN(q)&&q>=0)return{ok:!1,retryAfterMs:q*1000}}return{ok:!1}}catch(G){return K(`CCRClient: ${z} failed: ${H(G)}`,{level:"warn"}),Y("warn","cli_worker_request_error",{method:Q,path:W,error_code:i(G)}),{ok:!1}}}reportState(Q,W){if(Q===this.currentState&&!W)return;this.currentState=Q,this.workerState.enqueue({worker_status:Q,requires_action_details:W?{tool_name:W.tool_name,action_description:W.action_description,request_id:W.request_id}:null})}reportMetadata(Q){this.workerState.enqueue({external_metadata:Q})}handleEpochMismatch(){K("CCRClient: Epoch mismatch (409), shutting down",{level:"error"}),Y("error","cli_worker_epoch_mismatch"),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let Q=()=>{let Z=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(W,this.heartbeatIntervalMs+Z)},W=()=>{if(this.sendHeartbeat(),this.heartbeatTimer===null)return;Q()};Q()}stopHeartbeat(){if(this.heartbeatTimer)clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null}async sendHeartbeat(){if(this.heartbeatInFlight)return;this.heartbeatInFlight=!0;try{if((await this.request("post","/worker/heartbeat",{session_id:this.sessionId,worker_epoch:this.workerEpoch},"Heartbeat",{timeout:5000})).ok)K("CCRClient: Heartbeat sent")}finally{this.heartbeatInFlight=!1}}async writeEvent(Q){if(Q.type==="stream_event"){if(this.streamEventBuffer.push(Q),!this.streamEventTimer)this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),VQ);return}if(await this.flushStreamEventBuffer(),Q.type==="assistant")wQ(this.streamTextAccumulator,Q);await this.eventUploader.enqueue(this.toClientEvent(Q))}toClientEvent(Q){let W=Q;return{payload:{...W,uuid:typeof W.uuid==="string"?W.uuid:g()}}}async flushStreamEventBuffer(){if(this.streamEventTimer)clearTimeout(this.streamEventTimer),this.streamEventTimer=null;if(this.streamEventBuffer.length===0)return;let Q=this.streamEventBuffer;this.streamEventBuffer=[];let W=qQ(Q,this.streamTextAccumulator);await this.eventUploader.enqueue(W.map((Z)=>({payload:Z,ephemeral:!0})))}async writeInternalEvent(Q,W,{isCompaction:Z=!1,agentId:z}={}){let $={payload:{type:Q,...W,uuid:typeof W.uuid==="string"?W.uuid:g()},...Z&&{is_compaction:!0},...z&&{agent_id:z}};await this.internalEventUploader.enqueue($)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet("/worker/internal-events",{},"internal_events")}async readSubagentInternalEvents(){return this.paginatedGet("/worker/internal-events",{subagents:"true"},"subagent_events")}async paginatedGet(Q,W,Z){let z=this.getAuthHeaders();if(Object.keys(z).length===0)return null;let $=[],J;do{let G=new URL(`${this.sessionBaseUrl}${Q}`);for(let[q,L]of Object.entries(W))G.searchParams.set(q,L);if(J)G.searchParams.set("cursor",J);let X=await this.getWithRetry(G.toString(),z,Z);if(!X)return null;$.push(...X.data??[]),J=X.next_cursor}while(J);return K(`CCRClient: Read ${$.length} internal events from ${Q}${W.subagents?" (subagents)":""}`),$}async getWithRetry(Q,W,Z){for(let z=1;z<=10;z++){let $;try{$=await this.http.get(Q,{headers:{...W,"anthropic-version":"2023-06-01","User-Agent":N()},validateStatus:l,timeout:30000})}catch(J){if(K(`CCRClient: GET ${Q} failed (attempt ${z}/10): ${H(J)}`,{level:"warn"}),z<10){let G=Math.min(500*2**(z-1),30000)+Math.random()*500;await U(G)}continue}if($.status>=200&&$.status<300)return $.data;if($.status===409)this.handleEpochMismatch();if(K(`CCRClient: GET ${Q} returned ${$.status} (attempt ${z}/10)`,{level:"warn"}),z<10){let J=Math.min(500*2**(z-1),30000)+Math.random()*500;await U(J)}}return K("CCRClient: GET retries exhausted",{level:"error"}),Y("error","cli_worker_get_retries_exhausted",{context:Z}),null}reportDelivery(Q,W){this.deliveryUploader.enqueue({eventId:Q,status:W})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){if(this.closed=!0,this.stopHeartbeat(),s(),this.streamEventTimer)clearTimeout(this.streamEventTimer),this.streamEventTimer=null;this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}}b();h();F();r();I();y();t();import OQ from"axios";var jQ=1000,BQ=30000,HQ=600000,UQ=45000,CQ=new Set([401,403,404]),A=10,PQ=500,TQ=8000,NQ={stream:!0};function kQ(){return!0}function xQ(Q){let W=[],Z=0,z;while((z=Q.indexOf(`
2
+ import{OK as a,PK as E,RK as r,SK as o,TK as s,YK as KQ}from"./cli-0ybyvcx6.js";import{L1 as N,M1 as t}from"./cli-9sjvqgf1.js";import{B5 as JQ,u5 as n}from"./cli-e5vc9y1s.js";import{F5 as U,G5 as I}from"./cli-jy20hqk9.js";import{S6 as Y,U6 as h}from"./cli-v86f53k0.js";import{a9 as u,b9 as WQ}from"./cli-2dkq8dre.js";import{$9 as H,C_ as b,a_ as i,f_ as F,h_ as k,i_ as R,l_ as y,z_ as K}from"./cli-bqs5smsv.js";WQ();b();h();F();y();function D(Q){if(Q<60000)return`${Math.round(Q/1000)}s`;let W=Math.floor(Q/60000),Z=Math.round(Q%60000/1000);return Z>0?`${W}m ${Z}s`:`${W}m`}function ZQ(Q){let Z=(Q.startsWith("sk-ant-si-")?Q.slice(10):Q).split(".");if(Z.length!==3||!Z[1])return null;try{return R(Buffer.from(Z[1],"base64url").toString("utf8"))}catch{return null}}function f(Q){let W=ZQ(Q);if(W!==null&&typeof W==="object"&&"exp"in W&&typeof W.exp==="number")return W.exp;return null}var $Q=300000,p=1800000,m=3,zQ=60000;function DQ({getAccessToken:Q,onRefresh:W,label:Z,refreshBufferMs:z=$Q}){let $=new Map,J=new Map,G=new Map;function X(V){let w=(G.get(V)??0)+1;return G.set(V,w),w}function q(V,w){let j=f(w);if(!j){K(`[${Z}:token] Could not decode JWT expiry for sessionId=${V}, token prefix=${w.slice(0,15)}\u2026, keeping existing timer`);return}let C=$.get(V);if(C)clearTimeout(C);let B=X(V),P=new Date(j*1000).toISOString(),v=j*1000-Date.now()-z;if(v<=0){K(`[${Z}:token] Token for sessionId=${V} expires=${P} (past or within buffer), refreshing immediately`),O(V,B);return}K(`[${Z}:token] Scheduled token refresh for sessionId=${V} in ${D(v)} (expires=${P}, buffer=${z/1000}s)`);let QQ=setTimeout(O,v,V,B);$.set(V,QQ)}function L(V,w){let j=$.get(V);if(j)clearTimeout(j);let C=X(V),B=Math.max(w*1000-z,30000);K(`[${Z}:token] Scheduled token refresh for sessionId=${V} in ${D(B)} (expires_in=${w}s, buffer=${z/1000}s)`);let P=setTimeout(O,B,V,C);$.set(V,P)}async function O(V,w){let j;try{j=await Q()}catch(B){K(`[${Z}:token] getAccessToken threw for sessionId=${V}: ${H(B)}`,{level:"error"})}if(G.get(V)!==w){K(`[${Z}:token] doRefresh for sessionId=${V} stale (gen ${w} vs ${G.get(V)}), skipping`);return}if(!j){let B=(J.get(V)??0)+1;if(J.set(V,B),K(`[${Z}:token] No OAuth token available for refresh, sessionId=${V} (failure ${B}/${m})`,{level:"error"}),Y("error","bridge_token_refresh_no_oauth"),B<m){let P=setTimeout(O,zQ,V,w);$.set(V,P)}return}J.delete(V),K(`[${Z}:token] Refreshing token for sessionId=${V}: new token prefix=${j.slice(0,15)}\u2026`),u("tengu_bridge_token_refreshed",{}),W(V,j);let C=setTimeout(O,p,V,w);$.set(V,C),K(`[${Z}:token] Scheduled follow-up refresh for sessionId=${V} in ${D(p)}`)}function _(V){X(V);let w=$.get(V);if(w)clearTimeout(w),$.delete(V);J.delete(V)}function e(){for(let V of G.keys())X(V);for(let V of $.values())clearTimeout(V);$.clear(),J.clear()}return{schedule:q,scheduleFromExpiresIn:L,cancel:_,cancelAll:e}}import{randomUUID as g}from"crypto";b();h();F();JQ();KQ();r();I();t();y();class T extends Error{retryAfterMs;constructor(Q,W){super(Q);this.retryAfterMs=W}}class x{pending=[];pendingAtClose=0;draining=!1;closed=!1;backpressureResolvers=[];sleepResolve=null;flushResolvers=[];droppedBatches=0;config;constructor(Q){this.config=Q}get droppedBatchCount(){return this.droppedBatches}get pendingCount(){return this.closed?this.pendingAtClose:this.pending.length}async enqueue(Q){if(this.closed)return;let W=Array.isArray(Q)?Q:[Q];if(W.length===0)return;while(this.pending.length+W.length>this.config.maxQueueSize&&!this.closed)await new Promise((Z)=>{this.backpressureResolvers.push(Z)});if(this.closed)return;this.pending.push(...W),this.drain()}flush(){if(this.pending.length===0&&!this.draining)return Promise.resolve();return this.drain(),new Promise((Q)=>{this.flushResolvers.push(Q)})}close(){if(this.closed)return;this.closed=!0,this.pendingAtClose=this.pending.length,this.pending=[],this.sleepResolve?.(),this.sleepResolve=null;for(let Q of this.backpressureResolvers)Q();this.backpressureResolvers=[];for(let Q of this.flushResolvers)Q();this.flushResolvers=[]}async drain(){if(this.draining||this.closed)return;this.draining=!0;let Q=0;try{while(this.pending.length>0&&!this.closed){let W=this.takeBatch();if(W.length===0)continue;try{await this.config.send(W),Q=0}catch(Z){if(Q++,this.config.maxConsecutiveFailures!==void 0&&Q>=this.config.maxConsecutiveFailures){this.droppedBatches++,this.config.onBatchDropped?.(W.length,Q),Q=0,this.releaseBackpressure();continue}this.pending=W.concat(this.pending);let z=Z instanceof T?Z.retryAfterMs:void 0;await this.sleep(this.retryDelay(Q,z));continue}this.releaseBackpressure()}}finally{if(this.draining=!1,this.pending.length===0){for(let W of this.flushResolvers)W();this.flushResolvers=[]}}}takeBatch(){let{maxBatchSize:Q,maxBatchBytes:W}=this.config;if(W===void 0)return this.pending.splice(0,Q);let Z=0,z=0;while(z<this.pending.length&&z<Q){let $;try{$=Buffer.byteLength(k(this.pending[z]))}catch{this.pending.splice(z,1);continue}if(z>0&&Z+$>W)break;Z+=$,z++}return this.pending.splice(0,z)}retryDelay(Q,W){let Z=Math.random()*this.config.jitterMs;if(W!==void 0)return Math.max(this.config.baseDelayMs,Math.min(W,this.config.maxDelayMs))+Z;return Math.min(this.config.baseDelayMs*2**(Q-1),this.config.maxDelayMs)+Z}releaseBackpressure(){let Q=this.backpressureResolvers;this.backpressureResolvers=[];for(let W of Q)W()}sleep(Q){return new Promise((W)=>{this.sleepResolve=W,setTimeout((Z,z)=>{Z.sleepResolve=null,z()},Q,this,W)})}}I();class c{inflight=null;pending=null;closed=!1;config;constructor(Q){this.config=Q}enqueue(Q){if(this.closed)return;this.pending=this.pending?d(this.pending,Q):Q,this.drain()}close(){this.closed=!0,this.pending=null}async drain(){if(this.inflight||this.closed)return;if(!this.pending)return;let Q=this.pending;this.pending=null,this.inflight=this.sendWithRetry(Q).then(()=>{if(this.inflight=null,this.pending&&!this.closed)this.drain()})}async sendWithRetry(Q){let W=Q,Z=0;while(!this.closed){if(await this.config.send(W))return;if(Z++,await U(this.retryDelay(Z)),this.pending&&!this.closed)W=d(W,this.pending),this.pending=null}}retryDelay(Q){let W=Math.min(this.config.baseDelayMs*2**(Q-1),this.config.maxDelayMs),Z=Math.random()*this.config.jitterMs;return W+Z}}function d(Q,W){let Z={...Q};for(let[z,$]of Object.entries(W))if((z==="external_metadata"||z==="internal_metadata")&&Z[z]&&typeof Z[z]==="object"&&typeof $==="object"&&$!==null)Z[z]={...Z[z],...$};else Z[z]=$;return Z}var GQ=20000,VQ=100;function l(){return!0}class M extends Error{reason;constructor(Q){super(`CCRClient init failed: ${Q}`);this.reason=Q}}var YQ=10;function XQ(){return{byMessage:new Map,scopeToMessage:new Map}}function S(Q){return`${Q.session_id}:${Q.parent_tool_use_id??""}`}function qQ(Q,W){let Z=[],z=new Map;for(let $ of Q)switch($.event.type){case"message_start":{let J=$.event.message.id,G=W.scopeToMessage.get(S($));if(G)W.byMessage.delete(G);W.scopeToMessage.set(S($),J),W.byMessage.set(J,[]),Z.push($);break}case"content_block_delta":{if($.event.delta.type!=="text_delta"){Z.push($);break}let J=W.scopeToMessage.get(S($)),G=J?W.byMessage.get(J):void 0;if(!G){Z.push($);break}let X=G[$.event.index]??=[];X.push($.event.delta.text);let q=z.get(X);if(q){q.event.delta.text=X.join("");break}let L={type:"stream_event",uuid:$.uuid,session_id:$.session_id,parent_tool_use_id:$.parent_tool_use_id,event:{type:"content_block_delta",index:$.event.index,delta:{type:"text_delta",text:X.join("")}}};z.set(X,L),Z.push(L);break}default:Z.push($)}return Z}function wQ(Q,W){Q.byMessage.delete(W.message.id);let Z=S(W);if(Q.scopeToMessage.get(Z)===W.message.id)Q.scopeToMessage.delete(Z)}class LQ{workerEpoch=0;heartbeatIntervalMs;heartbeatJitterFraction;heartbeatTimer=null;heartbeatInFlight=!1;closed=!1;consecutiveAuthFailures=0;currentState=null;sessionBaseUrl;sessionId;http=n({keepAlive:!0});streamEventBuffer=[];streamEventTimer=null;streamTextAccumulator=XQ();workerState;eventUploader;internalEventUploader;deliveryUploader;onEpochMismatch;getAuthHeaders;constructor(Q,W,Z){if(this.onEpochMismatch=Z?.onEpochMismatch??(()=>{process.exit(1)}),this.heartbeatIntervalMs=Z?.heartbeatIntervalMs??GQ,this.heartbeatJitterFraction=Z?.heartbeatJitterFraction??0,this.getAuthHeaders=Z?.getAuthHeaders??E,W.protocol!=="http:"&&W.protocol!=="https:")throw Error(`CCRClient: Expected http(s) URL, got ${W.protocol}`);let z=W.pathname.replace(/\/$/,"");this.sessionBaseUrl=`${W.protocol}//${W.host}${z}`,this.sessionId=z.split("/").pop()||"",this.workerState=new c({send:($)=>this.request("put","/worker",{worker_epoch:this.workerEpoch,...$},"PUT worker").then((J)=>J.ok),baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),this.eventUploader=new x({maxBatchSize:100,maxBatchBytes:10485760,maxQueueSize:1e5,send:async($)=>{let J=await this.request("post","/worker/events",{worker_epoch:this.workerEpoch,events:$},"client events");if(!J.ok)throw new T("client event POST failed",J.retryAfterMs)},baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),this.internalEventUploader=new x({maxBatchSize:100,maxBatchBytes:10485760,maxQueueSize:200,send:async($)=>{let J=await this.request("post","/worker/internal-events",{worker_epoch:this.workerEpoch,events:$},"internal events");if(!J.ok)throw new T("internal event POST failed",J.retryAfterMs)},baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),this.deliveryUploader=new x({maxBatchSize:64,maxQueueSize:64,send:async($)=>{let J=await this.request("post","/worker/events/delivery",{worker_epoch:this.workerEpoch,updates:$.map((G)=>({event_id:G.eventId,status:G.status}))},"delivery batch");if(!J.ok)throw new T("delivery POST failed",J.retryAfterMs)},baseDelayMs:500,maxDelayMs:30000,jitterMs:500}),Q.setOnEvent(($)=>{this.reportDelivery($.event_id,"received")})}async initialize(Q){let W=Date.now();if(Object.keys(this.getAuthHeaders()).length===0)throw new M("no_auth_headers");if(Q===void 0){let G=process.env.CLAUDE_CODE_WORKER_EPOCH;Q=G?parseInt(G,10):NaN}if(isNaN(Q))throw new M("missing_epoch");this.workerEpoch=Q;let Z=this.getWorkerState();if(!(await this.request("put","/worker",{worker_status:"idle",worker_epoch:this.workerEpoch,external_metadata:{pending_action:null,task_summary:null}},"PUT worker (init)")).ok)throw new M("worker_register_failed");this.currentState="idle",this.startHeartbeat(),o(()=>{this.writeEvent({type:"keep_alive"})}),K(`CCRClient: initialized, epoch=${this.workerEpoch}`),Y("info","cli_worker_lifecycle_initialized",{epoch:this.workerEpoch,duration_ms:Date.now()-W});let{metadata:$,durationMs:J}=await Z;if(!this.closed)Y("info","cli_worker_state_restored",{duration_ms:J,had_state:$!==null});return $}async getWorkerState(){let Q=Date.now(),W=this.getAuthHeaders();if(Object.keys(W).length===0)return{metadata:null,durationMs:0};return{metadata:(await this.getWithRetry(`${this.sessionBaseUrl}/worker`,W,"worker_state"))?.worker?.external_metadata??null,durationMs:Date.now()-Q}}async request(Q,W,Z,z,{timeout:$=1e4}={}){let J=this.getAuthHeaders();if(Object.keys(J).length===0)return{ok:!1};try{let G=await this.http[Q](`${this.sessionBaseUrl}${W}`,Z,{headers:{...J,"Content-Type":"application/json","anthropic-version":"2023-06-01","User-Agent":N()},validateStatus:l,timeout:$});if(G.status>=200&&G.status<300)return this.consecutiveAuthFailures=0,{ok:!0};if(G.status===409)this.handleEpochMismatch();if(G.status===401||G.status===403){let X=a(),q=X?f(X):null;if(q!==null&&q*1000<Date.now())K(`CCRClient: session_token expired (exp=${new Date(q*1000).toISOString()}) \u2014 no refresh was delivered, exiting`,{level:"error"}),Y("error","cli_worker_token_expired_no_refresh"),this.onEpochMismatch();if(this.consecutiveAuthFailures++,this.consecutiveAuthFailures>=YQ)K(`CCRClient: ${this.consecutiveAuthFailures} consecutive auth failures with a valid-looking token \u2014 server-side auth unrecoverable, exiting`,{level:"error"}),Y("error","cli_worker_auth_failures_exhausted"),this.onEpochMismatch()}if(K(`CCRClient: ${z} returned ${G.status}`,{level:"warn"}),Y("warn","cli_worker_request_failed",{method:Q,path:W,status:G.status}),G.status===429){let X=G.headers?.["retry-after"],q=typeof X==="string"?parseInt(X,10):NaN;if(!isNaN(q)&&q>=0)return{ok:!1,retryAfterMs:q*1000}}return{ok:!1}}catch(G){return K(`CCRClient: ${z} failed: ${H(G)}`,{level:"warn"}),Y("warn","cli_worker_request_error",{method:Q,path:W,error_code:i(G)}),{ok:!1}}}reportState(Q,W){if(Q===this.currentState&&!W)return;this.currentState=Q,this.workerState.enqueue({worker_status:Q,requires_action_details:W?{tool_name:W.tool_name,action_description:W.action_description,request_id:W.request_id}:null})}reportMetadata(Q){this.workerState.enqueue({external_metadata:Q})}handleEpochMismatch(){K("CCRClient: Epoch mismatch (409), shutting down",{level:"error"}),Y("error","cli_worker_epoch_mismatch"),this.onEpochMismatch()}startHeartbeat(){this.stopHeartbeat();let Q=()=>{let Z=this.heartbeatIntervalMs*this.heartbeatJitterFraction*(2*Math.random()-1);this.heartbeatTimer=setTimeout(W,this.heartbeatIntervalMs+Z)},W=()=>{if(this.sendHeartbeat(),this.heartbeatTimer===null)return;Q()};Q()}stopHeartbeat(){if(this.heartbeatTimer)clearTimeout(this.heartbeatTimer),this.heartbeatTimer=null}async sendHeartbeat(){if(this.heartbeatInFlight)return;this.heartbeatInFlight=!0;try{if((await this.request("post","/worker/heartbeat",{session_id:this.sessionId,worker_epoch:this.workerEpoch},"Heartbeat",{timeout:5000})).ok)K("CCRClient: Heartbeat sent")}finally{this.heartbeatInFlight=!1}}async writeEvent(Q){if(Q.type==="stream_event"){if(this.streamEventBuffer.push(Q),!this.streamEventTimer)this.streamEventTimer=setTimeout(()=>void this.flushStreamEventBuffer(),VQ);return}if(await this.flushStreamEventBuffer(),Q.type==="assistant")wQ(this.streamTextAccumulator,Q);await this.eventUploader.enqueue(this.toClientEvent(Q))}toClientEvent(Q){let W=Q;return{payload:{...W,uuid:typeof W.uuid==="string"?W.uuid:g()}}}async flushStreamEventBuffer(){if(this.streamEventTimer)clearTimeout(this.streamEventTimer),this.streamEventTimer=null;if(this.streamEventBuffer.length===0)return;let Q=this.streamEventBuffer;this.streamEventBuffer=[];let W=qQ(Q,this.streamTextAccumulator);await this.eventUploader.enqueue(W.map((Z)=>({payload:Z,ephemeral:!0})))}async writeInternalEvent(Q,W,{isCompaction:Z=!1,agentId:z}={}){let $={payload:{type:Q,...W,uuid:typeof W.uuid==="string"?W.uuid:g()},...Z&&{is_compaction:!0},...z&&{agent_id:z}};await this.internalEventUploader.enqueue($)}flushInternalEvents(){return this.internalEventUploader.flush()}async flush(){return await this.flushStreamEventBuffer(),this.eventUploader.flush()}async readInternalEvents(){return this.paginatedGet("/worker/internal-events",{},"internal_events")}async readSubagentInternalEvents(){return this.paginatedGet("/worker/internal-events",{subagents:"true"},"subagent_events")}async paginatedGet(Q,W,Z){let z=this.getAuthHeaders();if(Object.keys(z).length===0)return null;let $=[],J;do{let G=new URL(`${this.sessionBaseUrl}${Q}`);for(let[q,L]of Object.entries(W))G.searchParams.set(q,L);if(J)G.searchParams.set("cursor",J);let X=await this.getWithRetry(G.toString(),z,Z);if(!X)return null;$.push(...X.data??[]),J=X.next_cursor}while(J);return K(`CCRClient: Read ${$.length} internal events from ${Q}${W.subagents?" (subagents)":""}`),$}async getWithRetry(Q,W,Z){for(let z=1;z<=10;z++){let $;try{$=await this.http.get(Q,{headers:{...W,"anthropic-version":"2023-06-01","User-Agent":N()},validateStatus:l,timeout:30000})}catch(J){if(K(`CCRClient: GET ${Q} failed (attempt ${z}/10): ${H(J)}`,{level:"warn"}),z<10){let G=Math.min(500*2**(z-1),30000)+Math.random()*500;await U(G)}continue}if($.status>=200&&$.status<300)return $.data;if($.status===409)this.handleEpochMismatch();if(K(`CCRClient: GET ${Q} returned ${$.status} (attempt ${z}/10)`,{level:"warn"}),z<10){let J=Math.min(500*2**(z-1),30000)+Math.random()*500;await U(J)}}return K("CCRClient: GET retries exhausted",{level:"error"}),Y("error","cli_worker_get_retries_exhausted",{context:Z}),null}reportDelivery(Q,W){this.deliveryUploader.enqueue({eventId:Q,status:W})}getWorkerEpoch(){return this.workerEpoch}get internalEventsPending(){return this.internalEventUploader.pendingCount}close(){if(this.closed=!0,this.stopHeartbeat(),s(),this.streamEventTimer)clearTimeout(this.streamEventTimer),this.streamEventTimer=null;this.streamEventBuffer=[],this.streamTextAccumulator.byMessage.clear(),this.streamTextAccumulator.scopeToMessage.clear(),this.workerState.close(),this.eventUploader.close(),this.internalEventUploader.close(),this.deliveryUploader.close()}}b();h();F();r();I();y();t();import OQ from"axios";var jQ=1000,BQ=30000,HQ=600000,UQ=45000,CQ=new Set([401,403,404]),A=10,PQ=500,TQ=8000,NQ={stream:!0};function kQ(){return!0}function xQ(Q){let W=[],Z=0,z;while((z=Q.indexOf(`
3
3
 
4
4
  `,Z))!==-1){let $=Q.slice(Z,z);if(Z=z+2,!$.trim())continue;let J={},G=!1;for(let X of $.split(`
5
5
  `)){if(X.startsWith(":")){G=!0;continue}let q=X.indexOf(":");if(q===-1)continue;let L=X.slice(0,q),O=X[q+1]===" "?X.slice(q+2):X.slice(q+1);switch(L){case"event":J.event=O;break;case"id":J.id=O;break;case"data":J.data=J.data?J.data+`
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{K_ as q,U_ as L}from"./cli-q8zmmp6z.js";import{gda as _,hda as J,ida as U}from"./cli-qwx84m9c.js";function x(u,M){return u.flatMap((z,D)=>D?[M(D),z]:[z])}function C(u,M){let z=0;for(let D of u)z+=+!!M(D);return z}function c(u){return[...new Set(u)]}var F=()=>{};function K(){if(!O)O=U("proper-lockfile");return O}function i(u,M){return K().lock(u,M)}function s(u,M){return K().lockSync(u,M)}function o(u,M){return K().unlock(u,M)}function n(u,M){return K().check(u,M)}var O;var j=()=>{};import{AsyncLocalStorage as A}from"async_hooks";function B(){return Q.getStore()}function Y(u,M){return Q.run(u,M)}function Z(){return Q.getStore()!==void 0}function $(u){return{...u,isInProcess:!0}}var Q;var R=J(()=>{Q=new A});var l={};_(l,{waitForTeammatesToBecomeIdle:()=>p,setDynamicTeamContext:()=>w,runWithTeammateContext:()=>Y,isTeammate:()=>f,isTeamLead:()=>g,isPlanModeRequired:()=>T,isInProcessTeammate:()=>Z,hasWorkingInProcessTeammates:()=>k,hasActiveInProcessTeammates:()=>d,getTeammateContext:()=>B,getTeammateColor:()=>y,getTeamName:()=>I,getParentSessionId:()=>v,getDynamicTeamContext:()=>S,getAgentName:()=>P,getAgentId:()=>E,createTeammateContext:()=>$,clearDynamicTeamContext:()=>h});function v(){let u=B();if(u)return u.parentSessionId;return b?.parentSessionId}function w(u){b=u}function h(){b=null}function S(){return b}function E(){let u=B();if(u)return u.agentId;return b?.agentId}function P(){let u=B();if(u)return u.agentName;return b?.agentName}function I(u){let M=B();if(M)return M.teamName;if(b?.teamName)return b.teamName;return u?.teamName}function f(){if(B())return!0;return!!(b?.agentId&&b?.teamName)}function y(){let u=B();if(u)return u.color;return b?.color}function T(){let u=B();if(u)return u.planModeRequired;if(b!==null)return b.planModeRequired;return q(process.env.CLAUDE_CODE_PLAN_MODE_REQUIRED)}function g(u){if(!u?.leadAgentId)return!1;let M=E(),z=u.leadAgentId;if(M===z)return!0;if(!M)return!0;return!1}function d(u){for(let M of Object.values(u.tasks))if(M.type==="in_process_teammate"&&M.status==="running")return!0;return!1}function k(u){for(let M of Object.values(u.tasks))if(M.type==="in_process_teammate"&&M.status==="running"&&!M.isIdle)return!0;return!1}function p(u,M){let z=[];for(let[D,G]of Object.entries(M.tasks))if(G.type==="in_process_teammate"&&G.status==="running"&&!G.isIdle)z.push(D);if(z.length===0)return Promise.resolve();return new Promise((D)=>{let G=z.length,V=()=>{if(G--,G===0)D()};u((W)=>{let N={...W.tasks};for(let X of z){let H=N[X];if(H&&H.type==="in_process_teammate")if(H.isIdle)V();else N[X]={...H,onIdleCallbacks:[...H.onIdleCallbacks??[],V]}}return{...W,tasks:N}})})}var b=null;var r=J(()=>{R();L();R()});
3
- export{x as c4,C as d4,c as e4,F as f4,i as g4,s as h4,o as i4,n as j4,j as k4,B as l4,Y as m4,Z as n4,$ as o4,R as p4,v as q4,S as r4,E as s4,P as t4,I as u4,f as v4,y as w4,T as x4,g as y4,d as z4,k as A4,p as B4,l as C4,r as D4};
2
+ import{M_ as q,W_ as L}from"./cli-hy0se8fa.js";import{ida as _,jda as J,kda as U}from"./cli-2afdzhna.js";function x(u,M){return u.flatMap((z,D)=>D?[M(D),z]:[z])}function C(u,M){let z=0;for(let D of u)z+=+!!M(D);return z}function c(u){return[...new Set(u)]}var F=()=>{};function K(){if(!O)O=U("proper-lockfile");return O}function i(u,M){return K().lock(u,M)}function s(u,M){return K().lockSync(u,M)}function o(u,M){return K().unlock(u,M)}function n(u,M){return K().check(u,M)}var O;var j=()=>{};import{AsyncLocalStorage as A}from"async_hooks";function B(){return Q.getStore()}function Y(u,M){return Q.run(u,M)}function Z(){return Q.getStore()!==void 0}function $(u){return{...u,isInProcess:!0}}var Q;var R=J(()=>{Q=new A});var l={};_(l,{waitForTeammatesToBecomeIdle:()=>p,setDynamicTeamContext:()=>w,runWithTeammateContext:()=>Y,isTeammate:()=>f,isTeamLead:()=>g,isPlanModeRequired:()=>T,isInProcessTeammate:()=>Z,hasWorkingInProcessTeammates:()=>k,hasActiveInProcessTeammates:()=>d,getTeammateContext:()=>B,getTeammateColor:()=>y,getTeamName:()=>I,getParentSessionId:()=>v,getDynamicTeamContext:()=>S,getAgentName:()=>P,getAgentId:()=>E,createTeammateContext:()=>$,clearDynamicTeamContext:()=>h});function v(){let u=B();if(u)return u.parentSessionId;return b?.parentSessionId}function w(u){b=u}function h(){b=null}function S(){return b}function E(){let u=B();if(u)return u.agentId;return b?.agentId}function P(){let u=B();if(u)return u.agentName;return b?.agentName}function I(u){let M=B();if(M)return M.teamName;if(b?.teamName)return b.teamName;return u?.teamName}function f(){if(B())return!0;return!!(b?.agentId&&b?.teamName)}function y(){let u=B();if(u)return u.color;return b?.color}function T(){let u=B();if(u)return u.planModeRequired;if(b!==null)return b.planModeRequired;return q(process.env.CLAUDE_CODE_PLAN_MODE_REQUIRED)}function g(u){if(!u?.leadAgentId)return!1;let M=E(),z=u.leadAgentId;if(M===z)return!0;if(!M)return!0;return!1}function d(u){for(let M of Object.values(u.tasks))if(M.type==="in_process_teammate"&&M.status==="running")return!0;return!1}function k(u){for(let M of Object.values(u.tasks))if(M.type==="in_process_teammate"&&M.status==="running"&&!M.isIdle)return!0;return!1}function p(u,M){let z=[];for(let[D,G]of Object.entries(M.tasks))if(G.type==="in_process_teammate"&&G.status==="running"&&!G.isIdle)z.push(D);if(z.length===0)return Promise.resolve();return new Promise((D)=>{let G=z.length,V=()=>{if(G--,G===0)D()};u((W)=>{let N={...W.tasks};for(let X of z){let H=N[X];if(H&&H.type==="in_process_teammate")if(H.isIdle)V();else N[X]={...H,onIdleCallbacks:[...H.onIdleCallbacks??[],V]}}return{...W,tasks:N}})})}var b=null;var r=J(()=>{R();L();R()});
3
+ export{x as e4,C as f4,c as g4,F as h4,i as i4,s as j4,o as k4,n as l4,j as m4,B as n4,Y as o4,Z as p4,$ as q4,R as r4,v as s4,S as t4,E as u4,P as v4,I as w4,f as x4,y as y4,T as z4,g as A4,d as B4,k as C4,p as D4,l as E4,r as F4};
@@ -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-b3k8arn1.js";import{gV as c,iV as d,lV as u,mV as g,rV as Wq}from"./cli-192xnkcx.js";import{G8 as D,L8 as r}from"./cli-8kpqq0ea.js";import{$9 as C,A_ as t,Z9 as W,_9 as O,d_ as _,f_ as P,g_ as v,j_ as f,n_ as M,r_ as y,x_ as V}from"./cli-awb77t95.js";import{hda as N}from"./cli-qwx84m9c.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-63389c5w.js";import{lV as c,nV as d,qV as u,rV as g,wV as Wq}from"./cli-9sjvqgf1.js";import{I8 as D,N8 as r}from"./cli-eehgc06t.js";import{$9 as W,C_ as t,a_ as O,b_ as C,f_ as _,h_ as P,i_ as v,l_ as f,p_ as M,t_ as y,z_ as V}from"./cli-bqs5smsv.js";import{jda as N}from"./cli-2afdzhna.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{A_ as H,M9 as $,O9 as O,_9 as K,d_ as m,f_ as M,g_ as b,j_ as E,x_ as V}from"./cli-awb77t95.js";import{H_ as Z,U_ as f}from"./cli-q8zmmp6z.js";import{dda as N,g$ as Q}from"./cli-tafg3e9w.js";import{hda as _}from"./cli-qwx84m9c.js";import{mkdir as U,readFile as w,unlink as J,writeFile as D}from"fs/promises";import{join as S}from"path";function h(G){if(typeof G!=="object"||G===null)return!1;return"sessionId"in G&&typeof G.sessionId==="string"&&"pid"in G&&typeof G.pid==="number"}function q(){return S(Z(),p)}async function z(){try{let G=await w(q(),"utf8"),T=b(G);return h(T)?T:void 0}catch{return}}function A(G){try{return process.kill(G,0),!0}catch{return!1}}async function X(G){try{return await D(q(),M(G),{flag:"wx"}),!0}catch(T){if(K(T)==="EEXIST")return!1;throw T}}function Y(){B?.(),B=$(async()=>{await P()})}async function o(){let G=await z();if(!G)return{kind:"free"};if(G.sessionId===Q())return{kind:"held_by_self"};if(A(G.pid))return{kind:"blocked",by:G.sessionId};return V(`Recovering stale computer-use lock from session ${G.sessionId} (PID ${G.pid})`),await J(q()).catch(()=>{}),{kind:"free"}}function a(){return B!==void 0}async function r(){let G=Q(),T={sessionId:G,pid:process.pid,acquiredAt:Date.now()};if(await U(Z(),{recursive:!0}),await X(T))return Y(),W;let y=await z();if(!y){if(await J(q()).catch(()=>{}),await X(T))return Y(),W;return{kind:"blocked",by:(await z())?.sessionId??"unknown"}}if(y.sessionId===G)return I;if(A(y.pid))return{kind:"blocked",by:y.sessionId};if(V(`Recovering stale computer-use lock from session ${y.sessionId} (PID ${y.pid})`),await J(q()).catch(()=>{}),await X(T))return Y(),W;return{kind:"blocked",by:(await z())?.sessionId??"unknown"}}async function P(){B?.(),B=void 0;let G=await z();if(!G||G.sessionId!==Q())return!1;try{return await J(q()),V("Released computer-use lock"),!0}catch{return!1}}var p="computer-use.lock",B,W,I;var j=_(()=>{N();O();H();f();E();m();W={kind:"acquired",fresh:!0},I={kind:"acquired",fresh:!1}});function n(G){return!1}function u(){}var v=()=>{};
3
- export{o as wR,a as xR,r as yR,P as zR,j as AR,n as BR,u as CR,v as DR};
2
+ import{C_ as H,O9 as $,Q9 as O,a_ as K,f_ as m,h_ as M,i_ as b,l_ as E,z_ as V}from"./cli-bqs5smsv.js";import{J_ as Z,W_ as f}from"./cli-hy0se8fa.js";import{fda as N,i$ as Q}from"./cli-ktzb7cwm.js";import{jda as _}from"./cli-2afdzhna.js";import{mkdir as U,readFile as w,unlink as J,writeFile as D}from"fs/promises";import{join as S}from"path";function h(G){if(typeof G!=="object"||G===null)return!1;return"sessionId"in G&&typeof G.sessionId==="string"&&"pid"in G&&typeof G.pid==="number"}function q(){return S(Z(),p)}async function z(){try{let G=await w(q(),"utf8"),T=b(G);return h(T)?T:void 0}catch{return}}function A(G){try{return process.kill(G,0),!0}catch{return!1}}async function X(G){try{return await D(q(),M(G),{flag:"wx"}),!0}catch(T){if(K(T)==="EEXIST")return!1;throw T}}function Y(){B?.(),B=$(async()=>{await P()})}async function o(){let G=await z();if(!G)return{kind:"free"};if(G.sessionId===Q())return{kind:"held_by_self"};if(A(G.pid))return{kind:"blocked",by:G.sessionId};return V(`Recovering stale computer-use lock from session ${G.sessionId} (PID ${G.pid})`),await J(q()).catch(()=>{}),{kind:"free"}}function a(){return B!==void 0}async function r(){let G=Q(),T={sessionId:G,pid:process.pid,acquiredAt:Date.now()};if(await U(Z(),{recursive:!0}),await X(T))return Y(),W;let y=await z();if(!y){if(await J(q()).catch(()=>{}),await X(T))return Y(),W;return{kind:"blocked",by:(await z())?.sessionId??"unknown"}}if(y.sessionId===G)return I;if(A(y.pid))return{kind:"blocked",by:y.sessionId};if(V(`Recovering stale computer-use lock from session ${y.sessionId} (PID ${y.pid})`),await J(q()).catch(()=>{}),await X(T))return Y(),W;return{kind:"blocked",by:(await z())?.sessionId??"unknown"}}async function P(){B?.(),B=void 0;let G=await z();if(!G||G.sessionId!==Q())return!1;try{return await J(q()),V("Released computer-use lock"),!0}catch{return!1}}var p="computer-use.lock",B,W,I;var j=_(()=>{N();O();H();f();E();m();W={kind:"acquired",fresh:!0},I={kind:"acquired",fresh:!1}});function n(G){return!1}function u(){}var v=()=>{};
3
+ export{o as yR,a as zR,r as AR,P as BR,j as CR,n as DR,u as ER,v as FR};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{J4 as D,O4 as H}from"./cli-601zv0wv.js";import{N7 as U,O7 as f}from"./cli-fnt125we.js";import{G8 as Z,L8 as S}from"./cli-8kpqq0ea.js";import{n_ as V,r_ as A}from"./cli-awb77t95.js";import{hda as x}from"./cli-qwx84m9c.js";import{LRUCache as I}from"lru-cache";import{basename as E,dirname as m,join as j,sep as O}from"path";function k(q){return b.has(q.toLowerCase())}function R(q,B){if(!q)return{directory:B||U(),prefix:""};let G=D(q,B);if(q.endsWith("/")||q.endsWith(O))return{directory:G,prefix:""};let W=m(G),J=E(q);return{directory:W,prefix:J}}async function u(q){let B=M.get(q);if(B)return B;try{let J=(await V().readdir(q)).filter((Q)=>Q.isDirectory()&&!k(Q.name)).map((Q)=>({name:Q.name,path:j(q,Q.name),type:"directory"})).slice(0,100);return M.set(q,J),J}catch(G){return Z(G),[]}}async function o(q,B={}){let{basePath:G=U(),maxResults:W=10}=B,{directory:J,prefix:Q}=R(q,G),$=await u(J),z=Q.toLowerCase();return $.filter((v)=>v.name.toLowerCase().startsWith(z)).slice(0,W).map((v)=>({id:v.path,displayText:v.name+"/",description:"directory",metadata:{type:"directory"}}))}function h(q){return q.startsWith("~/")||q.startsWith("/")||q.startsWith("./")||q.startsWith("../")||q==="~"||q==="."||q===".."}async function C(q,B=!1){let G=`${q}:${B}`,W=F.get(G);if(W)return W;try{let $=(await V().readdir(q)).filter((z)=>B||!z.name.startsWith(".")).map((z)=>({name:z.name,path:j(q,z.name),type:z.isDirectory()?"directory":"file"})).sort((z,Y)=>{if(z.type==="directory"&&Y.type!=="directory")return-1;if(z.type!=="directory"&&Y.type==="directory")return 1;return z.name.localeCompare(Y.name)}).slice(0,100);return F.set(G,$),$}catch(J){return Z(J),[]}}async function n(q,B={}){let{basePath:G=U(),maxResults:W=10,includeFiles:J=!0,includeHidden:Q=!1}=B,{directory:$,prefix:z}=R(q,G),Y=await C($,Q),v=z.toLowerCase(),T=Y.filter((X)=>{if(!J&&X.type==="file")return!1;return X.name.toLowerCase().startsWith(v)}).slice(0,W),_=q.includes("/")||q.includes(O),K="";if(_){let X=q.lastIndexOf("/"),N=q.lastIndexOf(O),g=Math.max(X,N);K=q.substring(0,g+1)}if(K.startsWith("./")||K.startsWith("."+O))K=K.slice(2);return T.map((X)=>{let N=K+X.name;return{id:N,displayText:X.type==="directory"?N+"/":N,metadata:{type:X.type}}})}var w=500,L=300000,b,M,F;var y=x(()=>{f();A();S();H();b=new Set([".git",".svn",".hg",".bzr",".jj",".sl"]),M=new I({max:w,ttl:L}),F=new I({max:w,ttl:L})});
2
+ import{L4 as D,Q4 as H}from"./cli-ajnshm3j.js";import{P7 as U,Q7 as f}from"./cli-024t0qj5.js";import{I8 as Z,N8 as S}from"./cli-eehgc06t.js";import{p_ as V,t_ as A}from"./cli-bqs5smsv.js";import{jda as x}from"./cli-2afdzhna.js";import{LRUCache as I}from"lru-cache";import{basename as E,dirname as m,join as j,sep as O}from"path";function k(q){return b.has(q.toLowerCase())}function R(q,B){if(!q)return{directory:B||U(),prefix:""};let G=D(q,B);if(q.endsWith("/")||q.endsWith(O))return{directory:G,prefix:""};let W=m(G),J=E(q);return{directory:W,prefix:J}}async function u(q){let B=M.get(q);if(B)return B;try{let J=(await V().readdir(q)).filter((Q)=>Q.isDirectory()&&!k(Q.name)).map((Q)=>({name:Q.name,path:j(q,Q.name),type:"directory"})).slice(0,100);return M.set(q,J),J}catch(G){return Z(G),[]}}async function o(q,B={}){let{basePath:G=U(),maxResults:W=10}=B,{directory:J,prefix:Q}=R(q,G),$=await u(J),z=Q.toLowerCase();return $.filter((v)=>v.name.toLowerCase().startsWith(z)).slice(0,W).map((v)=>({id:v.path,displayText:v.name+"/",description:"directory",metadata:{type:"directory"}}))}function h(q){return q.startsWith("~/")||q.startsWith("/")||q.startsWith("./")||q.startsWith("../")||q==="~"||q==="."||q===".."}async function C(q,B=!1){let G=`${q}:${B}`,W=F.get(G);if(W)return W;try{let $=(await V().readdir(q)).filter((z)=>B||!z.name.startsWith(".")).map((z)=>({name:z.name,path:j(q,z.name),type:z.isDirectory()?"directory":"file"})).sort((z,Y)=>{if(z.type==="directory"&&Y.type!=="directory")return-1;if(z.type!=="directory"&&Y.type==="directory")return 1;return z.name.localeCompare(Y.name)}).slice(0,100);return F.set(G,$),$}catch(J){return Z(J),[]}}async function n(q,B={}){let{basePath:G=U(),maxResults:W=10,includeFiles:J=!0,includeHidden:Q=!1}=B,{directory:$,prefix:z}=R(q,G),Y=await C($,Q),v=z.toLowerCase(),T=Y.filter((X)=>{if(!J&&X.type==="file")return!1;return X.name.toLowerCase().startsWith(v)}).slice(0,W),_=q.includes("/")||q.includes(O),K="";if(_){let X=q.lastIndexOf("/"),N=q.lastIndexOf(O),g=Math.max(X,N);K=q.substring(0,g+1)}if(K.startsWith("./")||K.startsWith("."+O))K=K.slice(2);return T.map((X)=>{let N=K+X.name;return{id:N,displayText:X.type==="directory"?N+"/":N,metadata:{type:X.type}}})}var w=500,L=300000,b,M,F;var y=x(()=>{f();A();S();H();b=new Set([".git",".svn",".hg",".bzr",".jj",".sl"]),M=new I({max:w,ttl:L}),F=new I({max:w,ttl:L})});
3
3
  export{o as Mf,h as Nf,n as Of,y as Pf};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{hda as o}from"./cli-qwx84m9c.js";function s(r){return{async connect(e){}}}var t;var n=o(()=>{t=[]});
2
+ import{jda as o}from"./cli-2afdzhna.js";function s(r){return{async connect(e){}}}var t;var n=o(()=>{t=[]});
3
3
  export{t as vg,s as wg,n as xg};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{Ep as H,dr as G}from"./cli-b3k8arn1.js";import{YL as M,ZL as u}from"./cli-4pwyex04.js";import{FQ as $,fR as e}from"./cli-a2d962bq.js";import{Q3 as T,u3 as Y}from"./cli-192xnkcx.js";e();T();G();u();import{c as X}from"react/compiler-runtime";import{jsxDEV as f}from"react/jsx-dev-runtime";function R(m){let q=X(17),{customApiKeyTruncated:_,onDone:O}=m,r;if(q[0]!==_||q[1]!==O)r=function(W){q:switch(W){case"yes":{Y((P)=>({...P,customApiKeyResponses:{...P.customApiKeyResponses,approved:[...P.customApiKeyResponses?.approved??[],_]}})),O(!0);break q}case"no":Y((P)=>({...P,customApiKeyResponses:{...P.customApiKeyResponses,rejected:[...P.customApiKeyResponses?.rejected??[],_]}})),O(!1)}},q[0]=_,q[1]=O,q[2]=r;else r=q[2];let K=r,w;if(q[3]!==K)w=()=>K("no"),q[3]=K,q[4]=w;else w=q[4];let j;if(q[5]===Symbol.for("react.memo_cache_sentinel"))j=f($,{bold:!0,children:"ANTHROPIC_API_KEY"},void 0,!1,void 0,this),q[5]=j;else j=q[5];let p;if(q[6]!==_)p=f($,{children:[j,f($,{children:[": sk-ant-...",_]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q[6]=_,q[7]=p;else p=q[7];let h;if(q[8]===Symbol.for("react.memo_cache_sentinel"))h=f($,{children:"Do you want to use this API key?"},void 0,!1,void 0,this),q[8]=h;else h=q[8];let v;if(q[9]===Symbol.for("react.memo_cache_sentinel"))v={label:"Yes",value:"yes"},q[9]=v;else v=q[9];let o;if(q[10]===Symbol.for("react.memo_cache_sentinel"))o=[v,{label:f($,{children:["No (",f($,{bold:!0,children:"recommended"},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),value:"no"}],q[10]=o;else o=q[10];let z;if(q[11]!==K)z=f(H,{defaultValue:"no",defaultFocusValue:"no",options:o,onChange:(k)=>K(k),onCancel:()=>K("no")},void 0,!1,void 0,this),q[11]=K,q[12]=z;else z=q[12];let a;if(q[13]!==w||q[14]!==p||q[15]!==z)a=f(M,{title:"Detected a custom API key in your environment",color:"warning",onCancel:w,children:[p,h,z]},void 0,!0,void 0,this),q[13]=w,q[14]=p,q[15]=z,q[16]=a;else a=q[16];return a}
2
+ import{Ep as H,dr as G}from"./cli-63389c5w.js";import{$L as u,_L as M}from"./cli-ndrvqgnc.js";import{HQ as $,hR as e}from"./cli-7dm5ex18.js";import{S3 as T,w3 as Y}from"./cli-9sjvqgf1.js";e();T();G();u();import{c as X}from"react/compiler-runtime";import{jsxDEV as f}from"react/jsx-dev-runtime";function R(m){let q=X(17),{customApiKeyTruncated:_,onDone:O}=m,r;if(q[0]!==_||q[1]!==O)r=function(W){q:switch(W){case"yes":{Y((P)=>({...P,customApiKeyResponses:{...P.customApiKeyResponses,approved:[...P.customApiKeyResponses?.approved??[],_]}})),O(!0);break q}case"no":Y((P)=>({...P,customApiKeyResponses:{...P.customApiKeyResponses,rejected:[...P.customApiKeyResponses?.rejected??[],_]}})),O(!1)}},q[0]=_,q[1]=O,q[2]=r;else r=q[2];let K=r,w;if(q[3]!==K)w=()=>K("no"),q[3]=K,q[4]=w;else w=q[4];let j;if(q[5]===Symbol.for("react.memo_cache_sentinel"))j=f($,{bold:!0,children:"ANTHROPIC_API_KEY"},void 0,!1,void 0,this),q[5]=j;else j=q[5];let p;if(q[6]!==_)p=f($,{children:[j,f($,{children:[": sk-ant-...",_]},void 0,!0,void 0,this)]},void 0,!0,void 0,this),q[6]=_,q[7]=p;else p=q[7];let h;if(q[8]===Symbol.for("react.memo_cache_sentinel"))h=f($,{children:"Do you want to use this API key?"},void 0,!1,void 0,this),q[8]=h;else h=q[8];let v;if(q[9]===Symbol.for("react.memo_cache_sentinel"))v={label:"Yes",value:"yes"},q[9]=v;else v=q[9];let o;if(q[10]===Symbol.for("react.memo_cache_sentinel"))o=[v,{label:f($,{children:["No (",f($,{bold:!0,children:"recommended"},void 0,!1,void 0,this),")"]},void 0,!0,void 0,this),value:"no"}],q[10]=o;else o=q[10];let z;if(q[11]!==K)z=f(H,{defaultValue:"no",defaultFocusValue:"no",options:o,onChange:(k)=>K(k),onCancel:()=>K("no")},void 0,!1,void 0,this),q[11]=K,q[12]=z;else z=q[12];let a;if(q[13]!==w||q[14]!==p||q[15]!==z)a=f(M,{title:"Detected a custom API key in your environment",color:"warning",onCancel:w,children:[p,h,z]},void 0,!0,void 0,this),q[13]=w,q[14]=p,q[15]=z,q[16]=a;else a=q[16];return a}
3
3
  export{R as H};
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{eq as H,hq as L}from"./cli-b3k8arn1.js";import{hU as G,oU as K}from"./cli-192xnkcx.js";import{hda as J}from"./cli-qwx84m9c.js";function T(q,w){let z=new Map;for(let h of w)z.set(h.agentType,h);let C=new Set,E=[];for(let h of q){let F=`${h.agentType}:${h.source}`;if(C.has(F))continue;C.add(F);let x=z.get(h.agentType),I=x&&x.source!==h.source?x.source:void 0;E.push({...h,overriddenBy:I})}return E}function U(q){let w=q.model||H();if(!w)return;return w==="inherit"?"inherit":w}function V(q){return G(q).toLowerCase()}function W(q,w){return q.agentType.localeCompare(w.agentType,void 0,{sensitivity:"base"})}var R;var O=J(()=>{L();K();R=[{label:"User agents",source:"userSettings"},{label:"Project agents",source:"projectSettings"},{label:"Local agents",source:"localSettings"},{label:"Managed agents",source:"policySettings"},{label:"Plugin agents",source:"plugin"},{label:"CLI arg agents",source:"flagSettings"},{label:"Built-in agents",source:"built-in"}]});
2
+ import{eq as H,hq as L}from"./cli-63389c5w.js";import{mU as G,tU as K}from"./cli-9sjvqgf1.js";import{jda as J}from"./cli-2afdzhna.js";function T(q,w){let z=new Map;for(let h of w)z.set(h.agentType,h);let C=new Set,E=[];for(let h of q){let F=`${h.agentType}:${h.source}`;if(C.has(F))continue;C.add(F);let x=z.get(h.agentType),I=x&&x.source!==h.source?x.source:void 0;E.push({...h,overriddenBy:I})}return E}function U(q){let w=q.model||H();if(!w)return;return w==="inherit"?"inherit":w}function V(q){return G(q).toLowerCase()}function W(q,w){return q.agentType.localeCompare(w.agentType,void 0,{sensitivity:"base"})}var R;var O=J(()=>{L();K();R=[{label:"User agents",source:"userSettings"},{label:"Project agents",source:"projectSettings"},{label:"Local agents",source:"localSettings"},{label:"Managed agents",source:"policySettings"},{label:"Plugin agents",source:"plugin"},{label:"CLI arg agents",source:"flagSettings"},{label:"Built-in agents",source:"built-in"}]});
3
3
  export{R as jb,T as kb,U as lb,V as mb,W as nb,O as ob};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{O4 as f}from"./cli-601zv0wv.js";import{W4 as v}from"./cli-h2t2hyz7.js";import{A_ as S,K9 as I,L9 as D,M9 as z,O9 as b,f_ as _,j_ as P,n_ as $,r_ as w,x_ as x}from"./cli-awb77t95.js";import{H_ as U,K_ as F,U_ as C}from"./cli-q8zmmp6z.js";import{dda as O,g$ as B,m$ as E}from"./cli-tafg3e9w.js";O();D();b();S();C();w();f();P();import{appendFile as m,rename as u}from"fs/promises";import{basename as R,dirname as p,join as M}from"path";var A={filePath:null,timestamp:0};function j(){if(A.filePath!==null)return A.filePath;if(process.env.USER_TYPE!=="ant")return null;if(!F(process.env.CLAUDE_CODE_TERMINAL_RECORDING))return null;let q=M(U(),"projects"),K=M(q,v(E()));return A.timestamp=Date.now(),A.filePath=M(K,`${B()}-${A.timestamp}.cast`),A.filePath}function t(){A.filePath=null,A.timestamp=0}function r(){let q=B(),K=M(U(),"projects"),X=M(K,v(E()));try{let G=$().readdirSync(X);return(typeof G[0]==="string"?G:G.map((J)=>J.name)).filter((J)=>J.startsWith(q)&&J.endsWith(".cast")).sort().map((J)=>M(X,J))}catch{return[]}}async function e(){let q=A.filePath;if(!q||A.timestamp===0)return;let K=M(U(),"projects"),X=M(K,v(E())),G=M(X,`${B()}-${A.timestamp}.cast`);if(q===G)return;await Z?.flush();let Y=R(q),Q=R(G);try{await u(q,G),A.filePath=G,x(`[asciicast] Renamed recording: ${Y} \u2192 ${Q}`)}catch{x(`[asciicast] Failed to rename recording from ${Y} to ${Q}`)}}var Z=null;function T(){let q=process.stdout.columns||80,K=process.stdout.rows||24;return{cols:q,rows:K}}async function qq(){await Z?.flush()}function Aq(){let q=j();if(!q)return;let{cols:K,rows:X}=T(),G=performance.now(),Y=_({version:2,width:K,height:X,timestamp:Math.floor(Date.now()/1000),env:{SHELL:process.env.SHELL||"",TERM:process.env.TERM||""}});try{$().mkdirSync(p(q))}catch{}$().appendFileSync(q,Y+`
2
+ import{Q4 as f}from"./cli-ajnshm3j.js";import{Y4 as v}from"./cli-1px0m0pt.js";import{C_ as S,M9 as I,N9 as D,O9 as z,Q9 as b,h_ as _,l_ as P,p_ as $,t_ as w,z_ as x}from"./cli-bqs5smsv.js";import{J_ as U,M_ as F,W_ as C}from"./cli-hy0se8fa.js";import{fda as O,i$ as B,o$ as E}from"./cli-ktzb7cwm.js";O();D();b();S();C();w();f();P();import{appendFile as m,rename as u}from"fs/promises";import{basename as R,dirname as p,join as M}from"path";var A={filePath:null,timestamp:0};function j(){if(A.filePath!==null)return A.filePath;if(process.env.USER_TYPE!=="ant")return null;if(!F(process.env.CLAUDE_CODE_TERMINAL_RECORDING))return null;let q=M(U(),"projects"),K=M(q,v(E()));return A.timestamp=Date.now(),A.filePath=M(K,`${B()}-${A.timestamp}.cast`),A.filePath}function t(){A.filePath=null,A.timestamp=0}function r(){let q=B(),K=M(U(),"projects"),X=M(K,v(E()));try{let G=$().readdirSync(X);return(typeof G[0]==="string"?G:G.map((J)=>J.name)).filter((J)=>J.startsWith(q)&&J.endsWith(".cast")).sort().map((J)=>M(X,J))}catch{return[]}}async function e(){let q=A.filePath;if(!q||A.timestamp===0)return;let K=M(U(),"projects"),X=M(K,v(E())),G=M(X,`${B()}-${A.timestamp}.cast`);if(q===G)return;await Z?.flush();let Y=R(q),Q=R(G);try{await u(q,G),A.filePath=G,x(`[asciicast] Renamed recording: ${Y} \u2192 ${Q}`)}catch{x(`[asciicast] Failed to rename recording from ${Y} to ${Q}`)}}var Z=null;function T(){let q=process.stdout.columns||80,K=process.stdout.rows||24;return{cols:q,rows:K}}async function qq(){await Z?.flush()}function Aq(){let q=j();if(!q)return;let{cols:K,rows:X}=T(),G=performance.now(),Y=_({version:2,width:K,height:X,timestamp:Math.floor(Date.now()/1000),env:{SHELL:process.env.SHELL||"",TERM:process.env.TERM||""}});try{$().mkdirSync(p(q))}catch{}$().appendFileSync(q,Y+`
3
3
  `,{mode:384});let Q=Promise.resolve(),J=I({writeFn(L){let V=A.filePath;if(!V)return;Q=Q.then(()=>m(V,L)).catch(()=>{})},flushIntervalMs:500,maxBufferSize:50,maxBufferBytes:10485760}),H=process.stdout.write.bind(process.stdout);process.stdout.write=function(L,V,N){let W=(performance.now()-G)/1000,k=typeof L==="string"?L:Buffer.from(L).toString("utf-8");if(J.write(_([W,"o",k])+`
4
4
  `),typeof V==="function")return H(L,V);return H(L,V,N)};function y(){let L=(performance.now()-G)/1000,{cols:V,rows:N}=T();J.write(_([L,"r",`${V}x${N}`])+`
5
5
  `)}process.stdout.on("resize",y),Z={async flush(){J.flush(),await Q},async dispose(){J.dispose(),await Q,process.stdout.removeListener("resize",y),process.stdout.write=H}},z(async()=>{await Z?.dispose(),Z=null}),x(`[asciicast] Recording to ${q}`)}
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{qm as I,tm as W}from"./cli-b3k8arn1.js";import{K_ as H,U_ as V}from"./cli-q8zmmp6z.js";V();W();var J=null,z=null,N=null;function Z(f){J=f}function $(f){z=f}function q(f){N=f}var G=!1,O="idle";function F(){return O}function K(f,B){if(O=f,J?.(f,B),f==="requires_action"&&B)G=!0,z?.({pending_action:B});else if(G)G=!1,z?.({pending_action:null});if(f==="idle")z?.({task_summary:null});if(H(process.env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS))I({type:"system",subtype:"session_state_changed",state:f})}function Q(f){z?.(f)}function R(f){N?.(f)}
2
+ import{qm as I,tm as W}from"./cli-63389c5w.js";import{M_ as H,W_ as V}from"./cli-hy0se8fa.js";V();W();var J=null,z=null,N=null;function Z(f){J=f}function $(f){z=f}function q(f){N=f}var G=!1,O="idle";function F(){return O}function K(f,B){if(O=f,J?.(f,B),f==="requires_action"&&B)G=!0,z?.({pending_action:B});else if(G)G=!1,z?.({pending_action:null});if(f==="idle")z?.({task_summary:null});if(H(process.env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS))I({type:"system",subtype:"session_state_changed",state:f})}function Q(f){z?.(f)}function R(f){N?.(f)}
3
3
  export{Z as Ja,$ as Ka,q as La,F as Ma,K as Na,Q as Oa,R as Pa};
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- import{Ak as L,Bk as Z,IE as X,VE as v,iE as V,uB as O,vB as $}from"./cli-b3k8arn1.js";import{hda as Y}from"./cli-qwx84m9c.js";function W(G){let D=[],H=G.matchAll(y);for(let z of H)if(z.index!==void 0)D.push({word:z[0],start:z.index,end:z.index+z[0].length});return D}async function b({question:G,cacheSafeParams:D}){let H=`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
2
+ import{Ak as L,Bk as Z,KE as X,XE as v,kE as V,wB as O,xB as $}from"./cli-63389c5w.js";import{jda as Y}from"./cli-2afdzhna.js";function W(G){let D=[],H=G.matchAll(y);for(let z of H)if(z.index!==void 0)D.push({word:z[0],start:z.index,end:z.index+z[0].length});return D}async function b({question:G,cacheSafeParams:D}){let H=`<system-reminder>This is a side question from the user. You must answer this question directly in a single response.
3
3
 
4
4
  IMPORTANT CONTEXT:
5
5
  - You are a separate, lightweight agent spawned to answer this one question
@@ -1,3 +1,3 @@
1
1
  // @bun
2
- import{EO as g,FO as Q}from"./cli-8jym9hp6.js";import{DQ as d,FQ as y,fR as B}from"./cli-a2d962bq.js";import{$5 as H,a6 as U,b6 as L,c6 as S,r6 as F}from"./cli-bdgrtpsy.js";import{hda as s}from"./cli-qwx84m9c.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)});
2
+ import{GO as g,HO as Q}from"./cli-vbn35zp3.js";import{FQ as d,HQ as y,hR as B}from"./cli-7dm5ex18.js";import{b6 as H,c6 as U,d6 as L,e6 as S,t6 as F}from"./cli-h3vttdhj.js";import{jda as s}from"./cli-2afdzhna.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
3
  export{rq as Qf,oq as Rf,jq as Sf};