@claudiolabs/claudio 0.1.9

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 (415) hide show
  1. package/LICENSE +29 -0
  2. package/README.md +311 -0
  3. package/bin/claudio +96 -0
  4. package/dist/chunks/AgentTool-0.1.9-e26h2f7z.mjs +1 -0
  5. package/dist/chunks/App-0.1.9-7ttp2eny.mjs +1 -0
  6. package/dist/chunks/ApproveApiKey-0.1.9-pz0jzna9.mjs +1 -0
  7. package/dist/chunks/AssistantSessionChooser-0.1.9-r5wg1yfv.mjs +1 -0
  8. package/dist/chunks/AutoModeOptInDialog-0.1.9-nbnjg2tp.mjs +1 -0
  9. package/dist/chunks/BypassPermissionsModeDialog-0.1.9-wjg6qps3.mjs +1 -0
  10. package/dist/chunks/ClaudeInChromeOnboarding-0.1.9-h46b49p8.mjs +1 -0
  11. package/dist/chunks/ClaudeMdExternalIncludesDialog-0.1.9-b8em430v.mjs +1 -0
  12. package/dist/chunks/ConsoleOAuthFlow-0.1.9-zb1h6dvy.mjs +1 -0
  13. package/dist/chunks/DiffDialog-0.1.9-09s28v8e.mjs +3 -0
  14. package/dist/chunks/Doctor-0.1.9-9ak6wqtr.mjs +1 -0
  15. package/dist/chunks/Grove-0.1.9-rbrf13rd.mjs +1 -0
  16. package/dist/chunks/ITermBackend-0.1.9-8dgw249h.mjs +1 -0
  17. package/dist/chunks/InProcessTransport-0.1.9-5cp1e7x7.mjs +1 -0
  18. package/dist/chunks/InvalidConfigDialog-0.1.9-6mv9wgt8.mjs +1 -0
  19. package/dist/chunks/InvalidSettingsDialog-0.1.9-d5kkd4yd.mjs +1 -0
  20. package/dist/chunks/MigrationDialog-0.1.9-56807wps.mjs +1 -0
  21. package/dist/chunks/Onboarding-0.1.9-g5nqdh1r.mjs +1 -0
  22. package/dist/chunks/ProviderManager-0.1.9-kj6t8003.mjs +1 -0
  23. package/dist/chunks/REPL-0.1.9-3h2fc9z7.mjs +1 -0
  24. package/dist/chunks/ResumeConversation-0.1.9-k4gv6dx4.mjs +1 -0
  25. package/dist/chunks/SnapshotUpdateDialog-0.1.9-v3h7drc0.mjs +1 -0
  26. package/dist/chunks/StartupScreen-0.1.9-jgk08xvj.mjs +1 -0
  27. package/dist/chunks/TeleportProgress-0.1.9-pnqkmgap.mjs +1 -0
  28. package/dist/chunks/TeleportRepoMismatchDialog-0.1.9-ddtmy43v.mjs +1 -0
  29. package/dist/chunks/TeleportResumeWrapper-0.1.9-vhnyx04e.mjs +1 -0
  30. package/dist/chunks/TmuxBackend-0.1.9-nb2ks1np.mjs +9 -0
  31. package/dist/chunks/ToolSearchTool-0.1.9-n40whaty.mjs +1 -0
  32. package/dist/chunks/TrustDialog-0.1.9-dm2wppgy.mjs +1 -0
  33. package/dist/chunks/activeProvider-0.1.9-kbwwatt3.mjs +1 -0
  34. package/dist/chunks/add-dir-0.1.9-ed53zp9j.mjs +1 -0
  35. package/dist/chunks/agents-0.1.9-4gwb1qtc.mjs +111 -0
  36. package/dist/chunks/agents-0.1.9-yr85gwa8.mjs +3 -0
  37. package/dist/chunks/api-0.1.9-kqwfw6wj.mjs +1 -0
  38. package/dist/chunks/asciicast-0.1.9-ekvsjx76.mjs +1 -0
  39. package/dist/chunks/assistant-0.1.9-h4rgf0xq.mjs +1 -0
  40. package/dist/chunks/auth-0.1.9-1c12xrxs.mjs +1 -0
  41. package/dist/chunks/auth-0.1.9-rqfx3vqa.mjs +1 -0
  42. package/dist/chunks/autoMode-0.1.9-s92asycq.mjs +48 -0
  43. package/dist/chunks/backgroundHousekeeping-0.1.9-jjbqckpm.mjs +1 -0
  44. package/dist/chunks/branch-0.1.9-m7j2aerq.mjs +4 -0
  45. package/dist/chunks/bridgePointer-0.1.9-rv3aq23v.mjs +1 -0
  46. package/dist/chunks/btw-0.1.9-g55x31zp.mjs +1 -0
  47. package/dist/chunks/buddy-0.1.9-fqmk7e4y.mjs +3 -0
  48. package/dist/chunks/cacache-0.1.9-dr1vt8s1.mjs +1 -0
  49. package/dist/chunks/cache-probe-0.1.9-ydmjrch4.mjs +21 -0
  50. package/dist/chunks/cacheStats-0.1.9-pkarrnw9.mjs +4 -0
  51. package/dist/chunks/caches-0.1.9-d6cndrra.mjs +1 -0
  52. package/dist/chunks/chrome-0.1.9-bvwzw157.mjs +1 -0
  53. package/dist/chunks/chromeNativeHost-0.1.9-8a20nscz.mjs +2 -0
  54. package/dist/chunks/claude-for-chrome-mcp-0.1.9-ndknjd3g.mjs +1 -0
  55. package/dist/chunks/claudeDesktop-0.1.9-7xprztbk.mjs +1 -0
  56. package/dist/chunks/claudemd-0.1.9-dqyhgy2v.mjs +1 -0
  57. package/dist/chunks/clear-0.1.9-tb8x7676.mjs +1 -0
  58. package/dist/chunks/cli-0.1.9-001s9kxw.mjs +24 -0
  59. package/dist/chunks/cli-0.1.9-03e1d9dw.mjs +39 -0
  60. package/dist/chunks/cli-0.1.9-04ez73f7.mjs +5084 -0
  61. package/dist/chunks/cli-0.1.9-0dtdhejj.mjs +31 -0
  62. package/dist/chunks/cli-0.1.9-0e6nsh68.mjs +3 -0
  63. package/dist/chunks/cli-0.1.9-0j8n671q.mjs +2 -0
  64. package/dist/chunks/cli-0.1.9-15y0qt1z.mjs +2 -0
  65. package/dist/chunks/cli-0.1.9-1c3qpbdh.mjs +2 -0
  66. package/dist/chunks/cli-0.1.9-1f5gmndb.mjs +2 -0
  67. package/dist/chunks/cli-0.1.9-1ghbcafn.mjs +2 -0
  68. package/dist/chunks/cli-0.1.9-1kaj4v6k.mjs +2 -0
  69. package/dist/chunks/cli-0.1.9-1xmdqqzd.mjs +3 -0
  70. package/dist/chunks/cli-0.1.9-263y2rkc.mjs +3 -0
  71. package/dist/chunks/cli-0.1.9-2dd7h0hn.mjs +15 -0
  72. package/dist/chunks/cli-0.1.9-2prq7peb.mjs +2 -0
  73. package/dist/chunks/cli-0.1.9-2tc83tsz.mjs +2 -0
  74. package/dist/chunks/cli-0.1.9-2thp2z73.mjs +2 -0
  75. package/dist/chunks/cli-0.1.9-2v0y90vz.mjs +2 -0
  76. package/dist/chunks/cli-0.1.9-2v4s8yf9.mjs +7 -0
  77. package/dist/chunks/cli-0.1.9-2x18rhq6.mjs +6 -0
  78. package/dist/chunks/cli-0.1.9-38zb09vp.mjs +2 -0
  79. package/dist/chunks/cli-0.1.9-3g3er8j1.mjs +15 -0
  80. package/dist/chunks/cli-0.1.9-3h4serkj.mjs +58 -0
  81. package/dist/chunks/cli-0.1.9-3rhe87kw.mjs +2 -0
  82. package/dist/chunks/cli-0.1.9-3vfq7jja.mjs +34 -0
  83. package/dist/chunks/cli-0.1.9-3wmbdmrp.mjs +2 -0
  84. package/dist/chunks/cli-0.1.9-3y36913h.mjs +10 -0
  85. package/dist/chunks/cli-0.1.9-3yscrq86.mjs +833 -0
  86. package/dist/chunks/cli-0.1.9-45ggwszg.mjs +2 -0
  87. package/dist/chunks/cli-0.1.9-4a9qwf11.mjs +2 -0
  88. package/dist/chunks/cli-0.1.9-4bg6jxs8.mjs +2 -0
  89. package/dist/chunks/cli-0.1.9-4kk9fmg2.mjs +2 -0
  90. package/dist/chunks/cli-0.1.9-4n4dqg6k.mjs +2 -0
  91. package/dist/chunks/cli-0.1.9-4sqfjw8t.mjs +16 -0
  92. package/dist/chunks/cli-0.1.9-4vmbyj20.mjs +2 -0
  93. package/dist/chunks/cli-0.1.9-4vt296k0.mjs +18 -0
  94. package/dist/chunks/cli-0.1.9-5ryrgdzg.mjs +2 -0
  95. package/dist/chunks/cli-0.1.9-5vgk7wf7.mjs +2 -0
  96. package/dist/chunks/cli-0.1.9-5ygmjsje.mjs +2 -0
  97. package/dist/chunks/cli-0.1.9-5ypg3t0t.mjs +2 -0
  98. package/dist/chunks/cli-0.1.9-5zhhyq4q.mjs +2 -0
  99. package/dist/chunks/cli-0.1.9-61ywjha3.mjs +2 -0
  100. package/dist/chunks/cli-0.1.9-68vwvmkw.mjs +2 -0
  101. package/dist/chunks/cli-0.1.9-6c7qrr4p.mjs +16 -0
  102. package/dist/chunks/cli-0.1.9-6gk46nr9.mjs +2 -0
  103. package/dist/chunks/cli-0.1.9-6j5gxw5r.mjs +5 -0
  104. package/dist/chunks/cli-0.1.9-6ne451jc.mjs +2 -0
  105. package/dist/chunks/cli-0.1.9-6p67vwxh.mjs +2 -0
  106. package/dist/chunks/cli-0.1.9-6pcahrj9.mjs +2 -0
  107. package/dist/chunks/cli-0.1.9-7047sjwh.mjs +2 -0
  108. package/dist/chunks/cli-0.1.9-7bakxr5q.mjs +3 -0
  109. package/dist/chunks/cli-0.1.9-7bthhhpf.mjs +2 -0
  110. package/dist/chunks/cli-0.1.9-7fp0smtp.mjs +2 -0
  111. package/dist/chunks/cli-0.1.9-7ftnjyps.mjs +2 -0
  112. package/dist/chunks/cli-0.1.9-7h5my4fb.mjs +2 -0
  113. package/dist/chunks/cli-0.1.9-7kcaaxvq.mjs +12 -0
  114. package/dist/chunks/cli-0.1.9-7q9461ka.mjs +2 -0
  115. package/dist/chunks/cli-0.1.9-7qhatm3v.mjs +2 -0
  116. package/dist/chunks/cli-0.1.9-86kws2c7.mjs +192 -0
  117. package/dist/chunks/cli-0.1.9-8egwvs85.mjs +2 -0
  118. package/dist/chunks/cli-0.1.9-90h21nv5.mjs +2 -0
  119. package/dist/chunks/cli-0.1.9-9d4sp76k.mjs +2 -0
  120. package/dist/chunks/cli-0.1.9-9hc8gyb7.mjs +2 -0
  121. package/dist/chunks/cli-0.1.9-9nhh15bp.mjs +2 -0
  122. package/dist/chunks/cli-0.1.9-9vab0er5.mjs +2 -0
  123. package/dist/chunks/cli-0.1.9-9vn4ys3c.mjs +22 -0
  124. package/dist/chunks/cli-0.1.9-a1gtww1d.mjs +2 -0
  125. package/dist/chunks/cli-0.1.9-a7zy4vqn.mjs +134 -0
  126. package/dist/chunks/cli-0.1.9-a95nqhbd.mjs +4 -0
  127. package/dist/chunks/cli-0.1.9-ag6a8kqj.mjs +2 -0
  128. package/dist/chunks/cli-0.1.9-ak0b9xfs.mjs +100 -0
  129. package/dist/chunks/cli-0.1.9-aqd7czgr.mjs +3 -0
  130. package/dist/chunks/cli-0.1.9-axg1kbe4.mjs +2 -0
  131. package/dist/chunks/cli-0.1.9-aype6q4y.mjs +2 -0
  132. package/dist/chunks/cli-0.1.9-b3031hmy.mjs +2 -0
  133. package/dist/chunks/cli-0.1.9-b6zp931m.mjs +11 -0
  134. package/dist/chunks/cli-0.1.9-b73n8vzm.mjs +2 -0
  135. package/dist/chunks/cli-0.1.9-b9kbpf6n.mjs +2 -0
  136. package/dist/chunks/cli-0.1.9-bg9xvmav.mjs +2 -0
  137. package/dist/chunks/cli-0.1.9-bn43vpc0.mjs +2 -0
  138. package/dist/chunks/cli-0.1.9-br9jzagb.mjs +2 -0
  139. package/dist/chunks/cli-0.1.9-c2fjeq7k.mjs +2 -0
  140. package/dist/chunks/cli-0.1.9-c38eyh49.mjs +2 -0
  141. package/dist/chunks/cli-0.1.9-cfzmq9k6.mjs +2 -0
  142. package/dist/chunks/cli-0.1.9-cvnkghgh.mjs +3 -0
  143. package/dist/chunks/cli-0.1.9-dmcbsmj4.mjs +2 -0
  144. package/dist/chunks/cli-0.1.9-dsx18zt1.mjs +2 -0
  145. package/dist/chunks/cli-0.1.9-dt31fs16.mjs +2 -0
  146. package/dist/chunks/cli-0.1.9-dzz1me99.mjs +2 -0
  147. package/dist/chunks/cli-0.1.9-e7ewtpew.mjs +2 -0
  148. package/dist/chunks/cli-0.1.9-e96x59hw.mjs +2 -0
  149. package/dist/chunks/cli-0.1.9-ehhkqhbv.mjs +2 -0
  150. package/dist/chunks/cli-0.1.9-eqxc9zxm.mjs +12 -0
  151. package/dist/chunks/cli-0.1.9-ewq9k9mr.mjs +2 -0
  152. package/dist/chunks/cli-0.1.9-ewwxqbvt.mjs +2 -0
  153. package/dist/chunks/cli-0.1.9-f4v4pahc.mjs +4 -0
  154. package/dist/chunks/cli-0.1.9-f643fvt4.mjs +2 -0
  155. package/dist/chunks/cli-0.1.9-f8ga1n8r.mjs +6 -0
  156. package/dist/chunks/cli-0.1.9-fcf313e7.mjs +2 -0
  157. package/dist/chunks/cli-0.1.9-fh5enjw8.mjs +5 -0
  158. package/dist/chunks/cli-0.1.9-fm2yycpj.mjs +2 -0
  159. package/dist/chunks/cli-0.1.9-fwqwgjwb.mjs +2 -0
  160. package/dist/chunks/cli-0.1.9-gandxpzf.mjs +2 -0
  161. package/dist/chunks/cli-0.1.9-gasw7sr9.mjs +2 -0
  162. package/dist/chunks/cli-0.1.9-gdymcvby.mjs +2 -0
  163. package/dist/chunks/cli-0.1.9-gpd1bhnf.mjs +2 -0
  164. package/dist/chunks/cli-0.1.9-gsc0t4gy.mjs +2 -0
  165. package/dist/chunks/cli-0.1.9-gvrtqwe3.mjs +2 -0
  166. package/dist/chunks/cli-0.1.9-h8xne7z8.mjs +2 -0
  167. package/dist/chunks/cli-0.1.9-hjcv9wr7.mjs +50 -0
  168. package/dist/chunks/cli-0.1.9-hva25eg3.mjs +4 -0
  169. package/dist/chunks/cli-0.1.9-hy4peemf.mjs +3 -0
  170. package/dist/chunks/cli-0.1.9-hy9s1fnj.mjs +14 -0
  171. package/dist/chunks/cli-0.1.9-hz8rssz0.mjs +2 -0
  172. package/dist/chunks/cli-0.1.9-j5zz6gbq.mjs +4 -0
  173. package/dist/chunks/cli-0.1.9-jb6af8n8.mjs +2 -0
  174. package/dist/chunks/cli-0.1.9-jchn9hyn.mjs +2 -0
  175. package/dist/chunks/cli-0.1.9-jdpz959j.mjs +2 -0
  176. package/dist/chunks/cli-0.1.9-jv2z42gk.mjs +2 -0
  177. package/dist/chunks/cli-0.1.9-kbrf27z8.mjs +2 -0
  178. package/dist/chunks/cli-0.1.9-krv35v3v.mjs +2 -0
  179. package/dist/chunks/cli-0.1.9-ksv4ntar.mjs +2 -0
  180. package/dist/chunks/cli-0.1.9-kt9xw7bn.mjs +2 -0
  181. package/dist/chunks/cli-0.1.9-m7shtst2.mjs +2 -0
  182. package/dist/chunks/cli-0.1.9-mfyd9h50.mjs +2 -0
  183. package/dist/chunks/cli-0.1.9-mj88t3jf.mjs +2 -0
  184. package/dist/chunks/cli-0.1.9-mjkhzp2c.mjs +3 -0
  185. package/dist/chunks/cli-0.1.9-mkfnnvz7.mjs +4 -0
  186. package/dist/chunks/cli-0.1.9-mme2x7fq.mjs +2 -0
  187. package/dist/chunks/cli-0.1.9-mnegaqr7.mjs +2 -0
  188. package/dist/chunks/cli-0.1.9-mx4ekht0.mjs +2 -0
  189. package/dist/chunks/cli-0.1.9-mz3mbxwb.mjs +12 -0
  190. package/dist/chunks/cli-0.1.9-n445yk6z.mjs +2 -0
  191. package/dist/chunks/cli-0.1.9-n54k4qt3.mjs +2 -0
  192. package/dist/chunks/cli-0.1.9-n8tc0gpm.mjs +2 -0
  193. package/dist/chunks/cli-0.1.9-nsgdz4rd.mjs +2 -0
  194. package/dist/chunks/cli-0.1.9-nw3rpxdd.mjs +252 -0
  195. package/dist/chunks/cli-0.1.9-nz8phj17.mjs +2 -0
  196. package/dist/chunks/cli-0.1.9-p1kdk178.mjs +2 -0
  197. package/dist/chunks/cli-0.1.9-p58rgwkr.mjs +4 -0
  198. package/dist/chunks/cli-0.1.9-p5scdysw.mjs +2 -0
  199. package/dist/chunks/cli-0.1.9-pdbfg3vh.mjs +2 -0
  200. package/dist/chunks/cli-0.1.9-pgwsmwz1.mjs +2 -0
  201. package/dist/chunks/cli-0.1.9-ph3w8t78.mjs +2 -0
  202. package/dist/chunks/cli-0.1.9-psx0e36a.mjs +2 -0
  203. package/dist/chunks/cli-0.1.9-q3e2h88a.mjs +2 -0
  204. package/dist/chunks/cli-0.1.9-q7hve442.mjs +2 -0
  205. package/dist/chunks/cli-0.1.9-qqjp7mpj.mjs +2 -0
  206. package/dist/chunks/cli-0.1.9-qydwhycw.mjs +2 -0
  207. package/dist/chunks/cli-0.1.9-r3ha1332.mjs +7 -0
  208. package/dist/chunks/cli-0.1.9-r7rcv2wm.mjs +8 -0
  209. package/dist/chunks/cli-0.1.9-rd0jctgk.mjs +21 -0
  210. package/dist/chunks/cli-0.1.9-rerthk1j.mjs +2 -0
  211. package/dist/chunks/cli-0.1.9-rft22htm.mjs +2 -0
  212. package/dist/chunks/cli-0.1.9-rp31nc37.mjs +2 -0
  213. package/dist/chunks/cli-0.1.9-rw09xkh7.mjs +2 -0
  214. package/dist/chunks/cli-0.1.9-s0w3y07w.mjs +2 -0
  215. package/dist/chunks/cli-0.1.9-s45y2ndk.mjs +2 -0
  216. package/dist/chunks/cli-0.1.9-s6bk4fbn.mjs +2 -0
  217. package/dist/chunks/cli-0.1.9-scpj6tps.mjs +3 -0
  218. package/dist/chunks/cli-0.1.9-sqja68fn.mjs +2 -0
  219. package/dist/chunks/cli-0.1.9-sv3awdsv.mjs +2 -0
  220. package/dist/chunks/cli-0.1.9-t24n24mw.mjs +2 -0
  221. package/dist/chunks/cli-0.1.9-teaymnrz.mjs +2 -0
  222. package/dist/chunks/cli-0.1.9-tq9z3reg.mjs +2 -0
  223. package/dist/chunks/cli-0.1.9-v32f99vc.mjs +11 -0
  224. package/dist/chunks/cli-0.1.9-v6x9pr1t.mjs +2 -0
  225. package/dist/chunks/cli-0.1.9-v7ajk1nz.mjs +2 -0
  226. package/dist/chunks/cli-0.1.9-vdw09f8y.mjs +44 -0
  227. package/dist/chunks/cli-0.1.9-vm7cggd9.mjs +45 -0
  228. package/dist/chunks/cli-0.1.9-vp3dtntc.mjs +2 -0
  229. package/dist/chunks/cli-0.1.9-vwv31syx.mjs +2 -0
  230. package/dist/chunks/cli-0.1.9-w692zn5c.mjs +2 -0
  231. package/dist/chunks/cli-0.1.9-wn39cz20.mjs +2 -0
  232. package/dist/chunks/cli-0.1.9-wpvrabrk.mjs +2 -0
  233. package/dist/chunks/cli-0.1.9-x0xxr5dh.mjs +13 -0
  234. package/dist/chunks/cli-0.1.9-x13p19zq.mjs +2 -0
  235. package/dist/chunks/cli-0.1.9-x257hapj.mjs +9 -0
  236. package/dist/chunks/cli-0.1.9-x7qrvj9f.mjs +2 -0
  237. package/dist/chunks/cli-0.1.9-xvn37fkk.mjs +2 -0
  238. package/dist/chunks/cli-0.1.9-xvvq2rcd.mjs +4 -0
  239. package/dist/chunks/cli-0.1.9-xws3mhz4.mjs +2 -0
  240. package/dist/chunks/cli-0.1.9-y8n4w5nn.mjs +5 -0
  241. package/dist/chunks/cli-0.1.9-ycvkz1gf.mjs +4 -0
  242. package/dist/chunks/cli-0.1.9-yddanjg2.mjs +132 -0
  243. package/dist/chunks/cli-0.1.9-ymsq31jx.mjs +2 -0
  244. package/dist/chunks/cli-0.1.9-ywf6743k.mjs +2 -0
  245. package/dist/chunks/cli-0.1.9-z5mm21jw.mjs +24 -0
  246. package/dist/chunks/cli-0.1.9-zae1me3j.mjs +2 -0
  247. package/dist/chunks/cli-0.1.9-zck4s4sh.mjs +2 -0
  248. package/dist/chunks/cli-0.1.9-zehsa1kq.mjs +2 -0
  249. package/dist/chunks/cli-0.1.9-zqyxbf50.mjs +2 -0
  250. package/dist/chunks/cli-0.1.9-zrdz7st3.mjs +3 -0
  251. package/dist/chunks/cli-0.1.9-zstpbdrf.mjs +2 -0
  252. package/dist/chunks/cli-0.1.9-zzp8m503.mjs +3 -0
  253. package/dist/chunks/cliArgs-0.1.9-kckasx4h.mjs +1 -0
  254. package/dist/chunks/client-0.1.9-ys52xz2v.mjs +1 -0
  255. package/dist/chunks/color-0.1.9-nmnytefc.mjs +1 -0
  256. package/dist/chunks/compact-0.1.9-qw915ckh.mjs +3 -0
  257. package/dist/chunks/config-0.1.9-1m69edch.mjs +1 -0
  258. package/dist/chunks/config-0.1.9-6knxc8a2.mjs +1 -0
  259. package/dist/chunks/context-0.1.9-47a3xmqq.mjs +1 -0
  260. package/dist/chunks/context-noninteractive-0.1.9-6s9bm74v.mjs +1 -0
  261. package/dist/chunks/conversation-0.1.9-vebter8y.mjs +1 -0
  262. package/dist/chunks/copy-0.1.9-ae06p3e2.mjs +9 -0
  263. package/dist/chunks/cost-0.1.9-x5zee0z9.mjs +1 -0
  264. package/dist/chunks/createSession-0.1.9-djn7xdsv.mjs +1 -0
  265. package/dist/chunks/desktop-0.1.9-xaecrssd.mjs +1 -0
  266. package/dist/chunks/detectRepository-0.1.9-qqzcce45.mjs +1 -0
  267. package/dist/chunks/detection-0.1.9-ry1q2ym2.mjs +1 -0
  268. package/dist/chunks/devtools-0.1.9-kzs9wq2w.mjs +1 -0
  269. package/dist/chunks/diff-0.1.9-af5n5bzh.mjs +1 -0
  270. package/dist/chunks/doctor-0.1.9-9f6fz2h0.mjs +1 -0
  271. package/dist/chunks/earlyInput-0.1.9-h7yskwvf.mjs +1 -0
  272. package/dist/chunks/effort-0.1.9-spz96zzr.mjs +8 -0
  273. package/dist/chunks/environmentSelection-0.1.9-0va5g53h.mjs +1 -0
  274. package/dist/chunks/environments-0.1.9-2hka6k26.mjs +1 -0
  275. package/dist/chunks/exit-0.1.9-rvk04qa2.mjs +1 -0
  276. package/dist/chunks/export-0.1.9-c3pqjktx.mjs +2 -0
  277. package/dist/chunks/extra-usage-0.1.9-92jjke47.mjs +1 -0
  278. package/dist/chunks/extra-usage-noninteractive-0.1.9-27zjp5q7.mjs +1 -0
  279. package/dist/chunks/fast-0.1.9-60sqqvgd.mjs +1 -0
  280. package/dist/chunks/feedback-0.1.9-anraj53n.mjs +14 -0
  281. package/dist/chunks/firstPartyEventLogger-0.1.9-y55fqx1x.mjs +1 -0
  282. package/dist/chunks/fullscreen-0.1.9-xy9bnpe3.mjs +1 -0
  283. package/dist/chunks/git-0.1.9-09pdaxwd.mjs +1 -0
  284. package/dist/chunks/githubModelsCredentials-0.1.9-bzx6c3bd.mjs +1 -0
  285. package/dist/chunks/growthbook-0.1.9-rqhcy76z.mjs +1 -0
  286. package/dist/chunks/heapdump-0.1.9-qrfce4dp.mjs +6 -0
  287. package/dist/chunks/help-0.1.9-sfn2ed9n.mjs +1 -0
  288. package/dist/chunks/hookChains-0.1.9-5t2mrtyc.mjs +3 -0
  289. package/dist/chunks/hooks-0.1.9-4cebdztn.mjs +1 -0
  290. package/dist/chunks/hooks-0.1.9-y0vtx23k.mjs +79 -0
  291. package/dist/chunks/ide-0.1.9-yxzacgd5.mjs +3 -0
  292. package/dist/chunks/image-processor-napi-0.1.9-fwc1ge47.mjs +1 -0
  293. package/dist/chunks/index-0.1.9-2gv7a7tq.mjs +2 -0
  294. package/dist/chunks/index-0.1.9-31vnb803.mjs +1 -0
  295. package/dist/chunks/index-0.1.9-68aa3hmw.mjs +1 -0
  296. package/dist/chunks/index-0.1.9-7ktx5gez.mjs +1 -0
  297. package/dist/chunks/index-0.1.9-8feamw1f.mjs +1 -0
  298. package/dist/chunks/index-0.1.9-8hzceckr.mjs +5 -0
  299. package/dist/chunks/index-0.1.9-96thm65j.mjs +1 -0
  300. package/dist/chunks/index-0.1.9-c7sexk3f.mjs +2 -0
  301. package/dist/chunks/index-0.1.9-fvtq6thw.mjs +1 -0
  302. package/dist/chunks/index-0.1.9-g2ngvhaf.mjs +1 -0
  303. package/dist/chunks/index-0.1.9-gtn0qcv2.mjs +7 -0
  304. package/dist/chunks/index-0.1.9-h548q4km.mjs +1 -0
  305. package/dist/chunks/index-0.1.9-j6ac60hq.mjs +1 -0
  306. package/dist/chunks/index-0.1.9-jxdymwv4.mjs +1 -0
  307. package/dist/chunks/index-0.1.9-kgdkzpmr.mjs +1 -0
  308. package/dist/chunks/index-0.1.9-mt2y3wyw.mjs +9 -0
  309. package/dist/chunks/index-0.1.9-smem7egb.mjs +30 -0
  310. package/dist/chunks/index-0.1.9-snmdvw2f.mjs +1 -0
  311. package/dist/chunks/index-0.1.9-vwevfx80.mjs +1 -0
  312. package/dist/chunks/index-0.1.9-w21jc8bp.mjs +1 -0
  313. package/dist/chunks/index-0.1.9-wpqaqk4y.mjs +1 -0
  314. package/dist/chunks/index-0.1.9-yjp28h60.mjs +9 -0
  315. package/dist/chunks/initReplBridge-0.1.9-dag95hyf.mjs +1 -0
  316. package/dist/chunks/ink-0.1.9-4n2nvw5p.mjs +1 -0
  317. package/dist/chunks/insights-0.1.9-9hr8tshw.mjs +870 -0
  318. package/dist/chunks/install-0.1.9-km91vvgf.mjs +1 -0
  319. package/dist/chunks/install-github-app-0.1.9-874a2dgj.mjs +149 -0
  320. package/dist/chunks/install-slack-app-0.1.9-q5yyb8vs.mjs +1 -0
  321. package/dist/chunks/instrumentation-0.1.9-raz129aj.mjs +12 -0
  322. package/dist/chunks/interactiveHelpers-0.1.9-21a8r4rv.mjs +1 -0
  323. package/dist/chunks/keybindings-0.1.9-nm8s4x8m.mjs +2 -0
  324. package/dist/chunks/knowledge-0.1.9-zhr6zq80.mjs +2 -0
  325. package/dist/chunks/loadAgentsDir-0.1.9-3m0mzw84.mjs +1 -0
  326. package/dist/chunks/loadPluginHooks-0.1.9-y46g5zj0.mjs +1 -0
  327. package/dist/chunks/logout-0.1.9-hb89bxj8.mjs +1 -0
  328. package/dist/chunks/lsp-0.1.9-2j3y8eqc.mjs +1 -0
  329. package/dist/chunks/main-0.1.9-7cnyr288.mjs +1 -0
  330. package/dist/chunks/managedEnv-0.1.9-y8wax2wz.mjs +1 -0
  331. package/dist/chunks/mcp-0.1.9-14beee71.mjs +17 -0
  332. package/dist/chunks/mcp-0.1.9-qw1n3pzx.mjs +4 -0
  333. package/dist/chunks/mcp-0.1.9-zd92e41j.mjs +1 -0
  334. package/dist/chunks/mcpServer-0.1.9-5p48a2y0.mjs +1 -0
  335. package/dist/chunks/mcpb-0.1.9-t8x1bjwv.mjs +1 -0
  336. package/dist/chunks/memory-0.1.9-mxz6vgsy.mjs +3 -0
  337. package/dist/chunks/mobile-0.1.9-144nwr03.mjs +2 -0
  338. package/dist/chunks/model-0.1.9-ghswdzx2.mjs +1 -0
  339. package/dist/chunks/model-0.1.9-j4vhm4vm.mjs +2 -0
  340. package/dist/chunks/oauth-0.1.9-a7p9ezjx.mjs +1 -0
  341. package/dist/chunks/openaiShim-0.1.9-5bn57rv6.mjs +14 -0
  342. package/dist/chunks/output-style-0.1.9-y8t5c5v3.mjs +1 -0
  343. package/dist/chunks/package-HMBVQOZ4-0.1.9-mbvqe0av.mjs +1 -0
  344. package/dist/chunks/parser-0.1.9-d7vc9q1w.mjs +1 -0
  345. package/dist/chunks/passes-0.1.9-84vsp058.mjs +1 -0
  346. package/dist/chunks/permissions-0.1.9-h0a2312z.mjs +3 -0
  347. package/dist/chunks/plan-0.1.9-k9dx9nwc.mjs +1 -0
  348. package/dist/chunks/plist-0.1.9-f3c6hvca.mjs +1 -0
  349. package/dist/chunks/plugin-0.1.9-z3nwra38.mjs +29 -0
  350. package/dist/chunks/pluginStartupCheck-0.1.9-p68xwmv4.mjs +1 -0
  351. package/dist/chunks/plugins-0.1.9-grc1bgmj.mjs +9 -0
  352. package/dist/chunks/print-0.1.9-z151tvas.mjs +57 -0
  353. package/dist/chunks/privacy-settings-0.1.9-m7xpxtd8.mjs +1 -0
  354. package/dist/chunks/process-0.1.9-anx0dq1a.mjs +1 -0
  355. package/dist/chunks/processBashCommand-0.1.9-bchtybqh.mjs +1 -0
  356. package/dist/chunks/processSlashCommand-0.1.9-ebvc859m.mjs +9 -0
  357. package/dist/chunks/prompt-0.1.9-08fnpwfx.mjs +1 -0
  358. package/dist/chunks/prompt-0.1.9-whqkx3td.mjs +1 -0
  359. package/dist/chunks/prompts-0.1.9-psek69yr.mjs +1 -0
  360. package/dist/chunks/provider-0.1.9-xwmdqr38.mjs +2 -0
  361. package/dist/chunks/providerProfiles-0.1.9-myc8zcfy.mjs +1 -0
  362. package/dist/chunks/rate-limit-options-0.1.9-06twart5.mjs +1 -0
  363. package/dist/chunks/registry-0.1.9-xxrsbce3.mjs +1 -0
  364. package/dist/chunks/release-notes-0.1.9-4r396x7z.mjs +5 -0
  365. package/dist/chunks/reload-plugins-0.1.9-hm09ekrf.mjs +2 -0
  366. package/dist/chunks/remote-env-0.1.9-0peng4np.mjs +1 -0
  367. package/dist/chunks/remoteBridgeCore-0.1.9-4eg0bkck.mjs +1 -0
  368. package/dist/chunks/remoteSession-0.1.9-7jagnaes.mjs +1 -0
  369. package/dist/chunks/rename-0.1.9-3r8bqa1y.mjs +1 -0
  370. package/dist/chunks/replBridgeHandle-0.1.9-1y32h5jq.mjs +1 -0
  371. package/dist/chunks/resume-0.1.9-gayv56qp.mjs +2 -0
  372. package/dist/chunks/rewind-0.1.9-krxjbzeg.mjs +1 -0
  373. package/dist/chunks/sandbox-adapter-0.1.9-b4ze2ex2.mjs +1 -0
  374. package/dist/chunks/sandbox-toggle-0.1.9-6vctxbed.mjs +1 -0
  375. package/dist/chunks/session-0.1.9-jtrr3jje.mjs +2 -0
  376. package/dist/chunks/sessionFileAccessHooks-0.1.9-wpgdva8t.mjs +1 -0
  377. package/dist/chunks/sessionStorage-0.1.9-1v6wyqzw.mjs +1 -0
  378. package/dist/chunks/setup-0.1.9-jc5w6v5s.mjs +5 -0
  379. package/dist/chunks/sinks-0.1.9-49ereb4y.mjs +1 -0
  380. package/dist/chunks/skills-0.1.9-d63w5m27.mjs +1 -0
  381. package/dist/chunks/startupProfiler-0.1.9-gmke65dk.mjs +1 -0
  382. package/dist/chunks/state-0.1.9-m8x0v07d.mjs +1 -0
  383. package/dist/chunks/stats-0.1.9-yvya6xg6.mjs +6 -0
  384. package/dist/chunks/status-0.1.9-sapnwz4b.mjs +1 -0
  385. package/dist/chunks/stickers-0.1.9-ewdagtd4.mjs +1 -0
  386. package/dist/chunks/subprocessEnv-0.1.9-2dqzh55d.mjs +1 -0
  387. package/dist/chunks/tasks-0.1.9-qgqwhse9.mjs +1 -0
  388. package/dist/chunks/teamHelpers-0.1.9-r474ar76.mjs +1 -0
  389. package/dist/chunks/teammateModeSnapshot-0.1.9-nwc11b9m.mjs +1 -0
  390. package/dist/chunks/teleport-0.1.9-xaj204my.mjs +1 -0
  391. package/dist/chunks/terminalSetup-0.1.9-xd5rhh32.mjs +1 -0
  392. package/dist/chunks/theme-0.1.9-f6jzdysz.mjs +1 -0
  393. package/dist/chunks/thinkback-0.1.9-8j25tex7.mjs +1 -0
  394. package/dist/chunks/thinkback-play-0.1.9-tzs2w3mj.mjs +1 -0
  395. package/dist/chunks/toolPool-0.1.9-6b4938vh.mjs +1 -0
  396. package/dist/chunks/toolSearch-0.1.9-7ych6nv7.mjs +1 -0
  397. package/dist/chunks/trustedDevice-0.1.9-xqxt3kmz.mjs +1 -0
  398. package/dist/chunks/turndown.cjs-0.1.9-m1wesrr4.mjs +69 -0
  399. package/dist/chunks/ultrareviewCommand-0.1.9-x09n5pvc.mjs +4 -0
  400. package/dist/chunks/update-0.1.9-8dntd8kh.mjs +94 -0
  401. package/dist/chunks/upgrade-0.1.9-eja31dgt.mjs +1 -0
  402. package/dist/chunks/upstreamproxy-0.1.9-pv2yqh11.mjs +14 -0
  403. package/dist/chunks/usage-0.1.9-neje6dea.mjs +1 -0
  404. package/dist/chunks/util-0.1.9-kdhggd68.mjs +1 -0
  405. package/dist/chunks/utils-0.1.9-bqw30f8b.mjs +1 -0
  406. package/dist/chunks/vim-0.1.9-w4d1qz6f.mjs +1 -0
  407. package/dist/chunks/watcher-0.1.9-ty2r0yxd.mjs +1 -0
  408. package/dist/chunks/wiki-0.1.9-ah646x2k.mjs +132 -0
  409. package/dist/chunks/worktree-0.1.9-d3fbxjwd.mjs +1 -0
  410. package/dist/chunks/worktreeModeEnabled-0.1.9-qbn6b5fs.mjs +1 -0
  411. package/dist/chunks/wrapper-0.1.9-eh46qafm.mjs +7 -0
  412. package/dist/claudio-vscode.vsix +0 -0
  413. package/dist/cli.mjs +7 -0
  414. package/package.json +153 -0
  415. package/scripts/v8cache-gc.mjs +84 -0
@@ -0,0 +1,2 @@
1
+ import{lna as b}from"./cli-0.1.9-kbrf27z8.mjs";var g="Agent",j="Task",m;var d=b(()=>{m=new Set(["Explore","Plan"])});
2
+ export{g as kea,j as lea,m as mea,d as nea};
@@ -0,0 +1,2 @@
1
+ import{Bi as l,Ci as Rq,Di as i,Ei as Aq,Fk as S,Kk as Zq,ok as E,pk as m,qk as Xq}from"./cli-0.1.9-04ez73f7.mjs";import{M5 as p,b6 as Qq}from"./cli-0.1.9-b6zp931m.mjs";import{O_ as u,Q_ as g,T_ as h,U_ as n,Z_ as vq,a7 as D,f7 as qq}from"./cli-0.1.9-86kws2c7.mjs";import{pda as d,rda as Uq}from"./cli-0.1.9-0dtdhejj.mjs";import{$fa as C,Aga as e,Zfa as W,_fa as O,dga as _,fga as P,gga as v,jga as f,nga as M,rga as y,xga as V}from"./cli-0.1.9-vdw09f8y.mjs";import{lna as N}from"./cli-0.1.9-kbrf27z8.mjs";import{homedir as a}from"os";import{resolve as t}from"path";async function Fq(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=t(q.startsWith("~")?q.replace(/^~/,a()):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 r=N(()=>{_();y()});import{randomBytes as $q}from"crypto";import{readFile as Bq,rename as Gq,unlink as Yq,writeFile as Jq}from"fs/promises";import{join as Kq}from"path";function c(){return Kq(S(),xq)}async function Hq(){let Z=c();try{let q=await Bq(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>zq)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 Vq(Z){let q=c(),$=`${q}.${$q(8).toString("hex")}.tmp`;try{let Q=S();await M().mkdir(Q);let B=P(Z,null,2);await Jq($,B,{encoding:"utf-8",mode:384}),await Gq($,q),V("Install counts cache saved successfully")}catch(Q){D(Q);try{await Yq($)}catch{}}}async function Wq(){V(`Fetching install counts from ${I}`);let Z=performance.now();try{let q=await p.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,m(q)),q}}async function nq(){let Z=await Hq();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 Wq(),$={version:L,fetchedAt:new Date().toISOString(),counts:q};await Vq($);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 lq(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,xq="install-counts-cache.json",I="https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json",zq=86400000;var Oq=N(()=>{Qq();e();_();y();qq();f();Xq();Zq()});import{readdir as Iq,readFile as A,stat as wq}from"fs/promises";import*as H from"path";function Eq(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 Nq(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)=>Mq.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 — Claude Code "+"ignores it at load time."});z=J}}let G=g().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,Nq(K));if(K&&typeof K==="object"&&"path"in K&&typeof K.path==="string")w(K.path,`plugins[${J}].source.path`,q)}})}let G=n().extend({plugins:d.array(h().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 s=await A(T,{encoding:"utf-8"}),b=v(s);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) — 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 _q(Z,q,$){let Q=[],B=[],x=q.match(i);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=l(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 Lq(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=u().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 o(Z,q){let $;try{$=await Iq(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 o(x,!1));else if(B.isFile()&&B.name.toLowerCase().endsWith(".md"))Q.push(x)}return Q}async function QQ(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 o(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=_q(G,X,B);if(Y.errors.length>0||Y.warnings.length>0)q.push(Y)}}let Q=await Lq(H.join(Z,"hooks","hooks.json"));if(Q.errors.length>0||Q.warnings.length>0)q.push(Q);return q}async function XQ(Z){let q=H.resolve(Z),$=null;try{$=await wq(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(Eq(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 Mq;var Dq=N(()=>{Uq();_();Aq();f();Rq();vq();Mq=new Set(["category","source","tags","strict","id"])});
2
+ export{Fq as oc,r as pc,nq as qc,lq as rc,Oq as sc,QQ as tc,XQ as uc,Dq as vc};
@@ -0,0 +1,2 @@
1
+ import{E4 as v,F4 as C}from"./cli-0.1.9-4sqfjw8t.mjs";import{M5 as Z,b6 as V}from"./cli-0.1.9-b6zp931m.mjs";import{Rba as x,Sba as Y,X6 as W,Y6 as O}from"./cli-0.1.9-86kws2c7.mjs";import{iea as X,jea as U}from"./cli-0.1.9-7ftnjyps.mjs";import{Bea as Q,Jea as H,xea as P}from"./cli-0.1.9-wpvrabrk.mjs";import{Aga as M,Zfa as w,dga as I,fga as R,jga as L,xga as f}from"./cli-0.1.9-vdw09f8y.mjs";import{Oma as N,Pma as F}from"./cli-0.1.9-1ghbcafn.mjs";import{ina as h,lna as B}from"./cli-0.1.9-kbrf27z8.mjs";import{hostname as E}from"os";function $(){return P(G,!1)}function u(){if(!$())return;return y()}function n(){y.cache?.clear?.()}function o(){if(!$())return;let i=x();try{let q=i.read();if(q?.trustedDeviceToken)delete q.trustedDeviceToken,i.update(q)}catch{}y.cache?.clear?.()}async function t(){try{if(!await Q(G)){f(`[trusted-device] Gate ${G} is off, skipping enrollment`);return}if(process.env.CLAUDE_TRUSTED_DEVICE_TOKEN){f("[trusted-device] CLAUDE_TRUSTED_DEVICE_TOKEN env var is set, skipping enrollment (env var takes precedence)");return}let{getClaudeAIOAuthTokens:i}=(C(),h(v)),q=i()?.accessToken;if(!q){f("[trusted-device] No OAuth token, skipping enrollment");return}let J=x();if(W()){f("[trusted-device] Essential traffic only, skipping enrollment");return}let b=X().BASE_API_URL,m;try{m=await Z.post(`${b}/api/auth/trusted_devices`,{display_name:`Claude Code on ${E()} · ${process.platform}`},{headers:{Authorization:`Bearer ${q}`,"Content-Type":"application/json"},timeout:1e4,validateStatus:(j)=>j<500})}catch(j){f(`[trusted-device] Enrollment request failed: ${w(j)}`);return}if(m.status!==200&&m.status!==201){f(`[trusted-device] Enrollment failed ${m.status}: ${R(m.data).slice(0,200)}`);return}let z=m.data?.device_token;if(!z||typeof z!=="string"){f("[trusted-device] Enrollment response missing device_token field");return}try{let j=J.read();if(!j){f("[trusted-device] Cannot read storage, skipping token persist");return}j.trustedDeviceToken=z;let K=J.update(j);if(!K.success){f(`[trusted-device] Failed to persist token: ${K.warning??"unknown"}`);return}y.cache?.clear?.(),f(`[trusted-device] Enrolled device_id=${m.data.device_id??"unknown"}`)}catch(j){f(`[trusted-device] Storage write failed: ${w(j)}`)}}catch(i){f(`[trusted-device] Enrollment error: ${w(i)}`)}}var G="tengu_sessions_elevated_auth_enforcement",y;var d=B(()=>{V();F();U();H();M();I();O();Y();L();y=N(()=>{let i=process.env.CLAUDE_TRUSTED_DEVICE_TOKEN;if(i)return i;return x().read()?.trustedDeviceToken})});
2
+ export{u as bP,n as cP,o as dP,t as eP,d as fP};
@@ -0,0 +1,2 @@
1
+ import{DW as y,EW as A,FW as D}from"./cli-0.1.9-hva25eg3.mjs";import{lna as C}from"./cli-0.1.9-kbrf27z8.mjs";import x from"node:process";class E{constructor(b=x.stdin,w=x.stdout){this._stdin=b,this._stdout=w,this._readBuffer=new y,this._started=!1,this._ondata=(q)=>{this._readBuffer.append(q),this.processReadBuffer()},this._onerror=(q)=>{this.onerror?.(q)}}async start(){if(this._started)throw Error("StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.");this._started=!0,this._stdin.on("data",this._ondata),this._stdin.on("error",this._onerror)}processReadBuffer(){while(!0)try{let b=this._readBuffer.readMessage();if(b===null)break;this.onmessage?.(b)}catch(b){this.onerror?.(b)}}async close(){if(this._stdin.off("data",this._ondata),this._stdin.off("error",this._onerror),this._stdin.listenerCount("data")===0)this._stdin.pause();this._readBuffer.clear(),this.onclose?.()}send(b){return new Promise((w)=>{let q=A(b);if(this._stdout.write(q))w();else this._stdout.once("drain",w)})}}var F=C(()=>{D()});
2
+ export{E as Dg,F as Eg};
@@ -0,0 +1,2 @@
1
+ import{yg as Uq,zg as Hq}from"./cli-0.1.9-ehhkqhbv.mjs";import{AS as pq,fS as Lq,gS as Wq,uS as o,vS as mq,xS as Pq,zS as Qq}from"./cli-0.1.9-gpd1bhnf.mjs";import{FS as _q,UU as Sq,nU as y,pU as F}from"./cli-0.1.9-nw3rpxdd.mjs";import{zX as Jq}from"./cli-0.1.9-2v4s8yf9.mjs";import{AX as Dq}from"./cli-0.1.9-hy9s1fnj.mjs";import{Rea as s,Sea as jq}from"./cli-0.1.9-mkfnnvz7.mjs";import{hna as g,lna as Eq}from"./cli-0.1.9-kbrf27z8.mjs";function iq(A){let q=C.c(25),{title:J,color:Y,defaultTab:Q,children:L,hidden:G,useFullWidth:R,selectedTab:M,onTabChange:z,banner:T,disableNavigation:a,initialHeaderFocused:n,contentHeight:V,navFromContent:d}=A,Xq=n===void 0?!0:n,Yq=d===void 0?!1:d,{columns:t}=Lq(),Z=L.map(Cq),e=Q?Z.findIndex((X)=>Q===X[0]):0,x=M!==void 0,[Zq,kq]=P.useState(e!==-1?e:0),qq=x?Z.findIndex((X)=>X[0]===M):-1,N=x?qq!==-1?qq:0:Zq,v=Qq(),[k,B]=P.useState(Xq),w;if(q[0]===Symbol.for("react.memo_cache_sentinel"))w=()=>B(!0),q[0]=w;else w=q[0];let zq=w,E;if(q[1]===Symbol.for("react.memo_cache_sentinel"))E=()=>B(!1),q[1]=E;else E=q[1];let Nq=E,[Mq,Aq]=P.useState(0),j;if(q[2]===Symbol.for("react.memo_cache_sentinel"))j=()=>{return Aq(gq),()=>Aq(Fq)},q[2]=j;else j=q[2];let vq=j,D=Mq>0,_=(X)=>{let H=(N+Z.length+X)%Z.length,f=Z[H]?.[0];if(x&&z&&f)z(f);else kq(H);B(!0)},b=!G&&!a&&k,S;if(q[3]!==b)S={context:"Tabs",isActive:b},q[3]=b,q[4]=S;else S=q[4];o({"tabs:next":()=>_(1),"tabs:previous":()=>_(-1)},S);let W;if(q[5]!==k||q[6]!==G||q[7]!==D)W=(X)=>{if(!k||!D||G)return;if(X.key==="down")X.preventDefault(),B(!1)},q[5]=k,q[6]=G,q[7]=D,q[8]=W;else W=q[8];let u=W,$=Yq&&!k&&D&&!G&&!a,m;if(q[9]!==$)m={context:"Tabs",isActive:$},q[9]=$,q[10]=m;else m=q[10];o({"tabs:next":()=>{_(1),B(!0)},"tabs:previous":()=>{_(-1),B(!0)}},m);let Bq=J?s(J)+1:0,Kq=Z.reduce(fq,0),yq=Bq+Kq,Gq=R?Math.max(0,t-yq):0,O=R?t:void 0,h=y,Oq="column",Rq=0,Vq=!0,c=v?0:void 0,r=!G&&U.jsxDEV(y,{flexDirection:"row",gap:1,flexShrink:v?0:void 0,children:[J!==void 0&&U.jsxDEV(F,{bold:!0,color:Y,children:J},void 0,!1,void 0,this),Z.map((X,H)=>{let[f,wq]=X,i=N===H,l=Y&&i&&k;return U.jsxDEV(F,{backgroundColor:l?Y:void 0,color:l?"inverseText":void 0,inverse:i&&!l,bold:i,children:[" ",wq," "]},f,!0,void 0,this)}),Gq>0&&U.jsxDEV(F,{children:" ".repeat(Gq)},void 0,!1,void 0,this)]},`${N}-${k?"focused":"blurred"}`,!0,void 0,this),K;if(q[11]!==L||q[12]!==V||q[13]!==O||q[14]!==G||q[15]!==v||q[16]!==N)K=v?U.jsxDEV(y,{width:O,marginTop:G?0:1,flexShrink:0,children:U.jsxDEV(Uq,{ref:v,flexDirection:"column",flexShrink:0,children:L},N,!1,void 0,this)},void 0,!1,void 0,this):U.jsxDEV(y,{width:O,marginTop:G?0:1,height:V,overflowY:V!==void 0?"hidden":void 0,children:L},void 0,!1,void 0,this),q[11]=L,q[12]=V,q[13]=O,q[14]=G,q[15]=v,q[16]=N,q[17]=K;else K=q[17];let p;if(q[18]!==h||q[19]!==T||q[20]!==u||q[21]!==c||q[22]!==r||q[23]!==K)p=U.jsxDEV(h,{flexDirection:Oq,tabIndex:Rq,autoFocus:Vq,onKeyDown:u,flexShrink:c,children:[r,T,K]},void 0,!0,void 0,this),q[18]=h,q[19]=T,q[20]=u,q[21]=c,q[22]=r,q[23]=K,q[24]=p;else p=q[24];return U.jsxDEV(I.Provider,{value:{selectedTab:Z[N][0],width:O,headerFocused:k,focusHeader:zq,blurHeader:Nq,registerOptIn:vq},children:p},void 0,!1,void 0,this)}function fq(A,q){let[,J]=q;return A+(J?s(J):0)+2+1}function Fq(A){return A-1}function gq(A){return A+1}function Cq(A){return[A.props.id??A.props.title,A.props.title]}function lq(A){let q=C.c(4),{title:J,id:Y,children:Q}=A,{selectedTab:L,width:G}=P.useContext(I),R=Pq();if(L!==(Y??J))return null;let M=R?0:void 0,z;if(q[0]!==Q||q[1]!==M||q[2]!==G)z=U.jsxDEV(y,{width:G,flexShrink:M,children:Q},void 0,!1,void 0,this),q[0]=Q,q[1]=M,q[2]=G,q[3]=z;else z=q[3];return z}function oq(){let{width:A}=P.useContext(I);return A}function sq(){let A=C.c(6),{headerFocused:q,focusHeader:J,blurHeader:Y,registerOptIn:Q}=P.useContext(I),L;if(A[0]!==Q)L=[Q],A[0]=Q,A[1]=L;else L=A[1];P.useEffect(Q,L);let G;if(A[2]!==Y||A[3]!==J||A[4]!==q)G={headerFocused:q,focusHeader:J,blurHeader:Y},A[2]=Y,A[3]=J,A[4]=q,A[5]=G;else G=A[5];return G}var C,P,U,I;var Iq=Eq(()=>{pq();Wq();Hq();jq();Sq();mq();C=g(_q(),1),P=g(Dq(),1),U=g(Jq(),1),I=P.createContext({selectedTab:void 0,width:void 0,headerFocused:!1,focusHeader:()=>{},blurHeader:()=>{},registerOptIn:()=>()=>{}})});
2
+ export{iq as cg,lq as dg,oq as eg,sq as fg,Iq as gg};
@@ -0,0 +1,16 @@
1
+ import{X4 as B2,Z4 as v4}from"./cli-0.1.9-x257hapj.mjs";import{$4 as A,a5 as c8}from"./cli-0.1.9-f8ga1n8r.mjs";import{M5 as v,b6 as _2}from"./cli-0.1.9-b6zp931m.mjs";import{$$ as $2,B$ as B8,C7 as Q5,E7 as g8,Jba as s1,Kba as i,Lba as Y2,Mba as F0,Nba as r1,Oba as v2,P9 as X1,Q9 as c4,Rba as G2,Saa as d,Sba as m8,Waa as M,X6 as Q1,Y6 as m4,Z$ as b,Zaa as w,a7 as K,b_ as _1,baa as e,caa as T,f7 as m0,k7 as G0,l7 as f5,laa as V0,m7 as J5,n_ as j8,p7 as u8,qba as q0,s$ as P1,sba as k1,tba as H8,uaa as z4,waa as p8,wca as P,zca as U0}from"./cli-0.1.9-86kws2c7.mjs";import{bea as B5,cea as W4,dea as W0,fea as k4,gea as E4,iea as D,jea as O0}from"./cli-0.1.9-7ftnjyps.mjs";import{Jea as J1,xea as E0,zea as d1}from"./cli-0.1.9-wpvrabrk.mjs";import{Afa as Z2,zfa as G}from"./cli-0.1.9-5ryrgdzg.mjs";import{$fa as S5,Aga as _0,Zfa as p,dga as M5,gga as $5,jga as f8,nga as k2,rga as h4,xga as z,zga as A0}from"./cli-0.1.9-vdw09f8y.mjs";import{Bga as Z5,Ega as L,Gga as u,Iga as j2,Lga as q4,Oga as g}from"./cli-0.1.9-v7ajk1nz.mjs";import{Hja as O1,Hka as y5,Ika as I5,Jka as C5,Kka as T5,Lja as c1,Qja as N0,Rja as n0,Wka as e0,jka as f,pma as o,qka as $1,tja as H1,uia as $0,via as d5}from"./cli-0.1.9-7fp0smtp.mjs";import{Oma as I,Pma as p0}from"./cli-0.1.9-1ghbcafn.mjs";import{kna as A8,lna as B,mna as s}from"./cli-0.1.9-kbrf27z8.mjs";function H5(Z){let $=[],J=!1;async function Q(){if(J)return;if($.length===0)return;J=!0;while($.length>0){let{args:X,resolve:Y,reject:V,context:W}=$.shift();try{let x=await Z.apply(W,X);Y(x)}catch(x){V(x)}}if(J=!1,$.length>0)Q()}return function(...X){return new Promise((Y,V)=>{$.push({args:X,resolve:Y,reject:V,context:this}),Q()})}}var R5=()=>{};function F5(Z,$){return Z.find((J)=>J.includes($))??null}async function L5(){let{BedrockClient:Z}=await import("@aws-sdk/client-bedrock"),$=j2(),J=L(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),Q={region:$,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await B2(),...J&&{requestHandler:new(await import("./index-0.1.9-vwevfx80.mjs")).NodeHttpHandler,httpAuthSchemes:[{schemeId:"smithy.api#noAuth",identityProvider:()=>async()=>({}),signer:new(await import("./index-0.1.9-jxdymwv4.mjs")).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:"smithy.api#noAuth"}]}};if(!J&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let X=await X0();if(X)Q.credentials={accessKeyId:X.accessKeyId,secretAccessKey:X.secretAccessKey,sessionToken:X.sessionToken}}return new Z(Q)}async function AZ(){let{BedrockRuntimeClient:Z}=await import("@aws-sdk/client-bedrock-runtime"),$=j2(),J=L(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH),Q={region:$,...process.env.ANTHROPIC_BEDROCK_BASE_URL&&{endpoint:process.env.ANTHROPIC_BEDROCK_BASE_URL},...await B2(),...J&&{requestHandler:new(await import("./index-0.1.9-vwevfx80.mjs")).NodeHttpHandler,httpAuthSchemes:[{schemeId:"smithy.api#noAuth",identityProvider:()=>async()=>({}),signer:new(await import("./index-0.1.9-jxdymwv4.mjs")).NoAuthSigner}],httpAuthSchemeProvider:()=>[{schemeId:"smithy.api#noAuth"}]}};if(!J&&!process.env.AWS_BEARER_TOKEN_BEDROCK){let X=await X0();if(X)Q.credentials={accessKeyId:X.accessKeyId,secretAccessKey:X.secretAccessKey,sessionToken:X.sessionToken}}return new Z(Q)}function y4(Z){return Z.startsWith("anthropic.")}function C4(Z){if(!Z.startsWith("arn:"))return Z;let $=Z.lastIndexOf("/");if($===-1)return Z;return Z.substring($+1)}function T4(Z){let $=C4(Z);for(let J of I4)if($.startsWith(`${J}.anthropic.`))return J;return}function uZ(Z,$){let J=T4(Z);if(J)return Z.replace(`${J}.`,`${$}.`);if(y4(Z))return`${$}.${Z}`;return Z}var w5,fZ,I4;var K5=B(()=>{p0();n();g();m0();v4();w5=I(async function(){let[Z,{ListInferenceProfilesCommand:$}]=await Promise.all([L5(),import("@aws-sdk/client-bedrock")]),J=[],Q;try{do{let X=new $({...Q&&{nextToken:Q},typeEquals:"SYSTEM_DEFINED"}),Y=await Z.send(X);if(Y.inferenceProfileSummaries)J.push(...Y.inferenceProfileSummaries);Q=Y.nextToken}while(Q);return J.filter((X)=>X.inferenceProfileId?.includes("anthropic")).map((X)=>X.inferenceProfileId).filter(Boolean)}catch(X){throw K(X),X}});fZ=I(async function(Z){try{let[$,{GetInferenceProfileCommand:J}]=await Promise.all([L5(),import("@aws-sdk/client-bedrock")]),Q=new J({inferenceProfileIdentifier:Z}),X=await $.send(Q);if(!X.models||X.models.length===0)return null;let Y=X.models[0];if(!Y?.modelArn)return null;let V=Y.modelArn.lastIndexOf("/");return V>=0?Y.modelArn.substring(V+1):Y.modelArn}catch($){return K($),null}});I4=["us","eu","apac","global"]});var H2,R2,w2,F2,L2,K2,D2,U2,N2,c0,d0,b2,Y0,pZ,D5;var O2=B(()=>{H2={firstParty:"claude-3-7-sonnet-20250219",bedrock:"us.anthropic.claude-3-7-sonnet-20250219-v1:0",vertex:"claude-3-7-sonnet@20250219",foundry:"claude-3-7-sonnet",openai:"gpt-4o-mini",gemini:"gemini-2.0-flash",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},R2={firstParty:"claude-3-5-sonnet-20241022",bedrock:"anthropic.claude-3-5-sonnet-20241022-v2:0",vertex:"claude-3-5-sonnet-v2@20241022",foundry:"claude-3-5-sonnet",openai:"gpt-4o-mini",gemini:"gemini-2.0-flash",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},w2={firstParty:"claude-3-5-haiku-20241022",bedrock:"us.anthropic.claude-3-5-haiku-20241022-v1:0",vertex:"claude-3-5-haiku@20241022",foundry:"claude-3-5-haiku",openai:"gpt-4o-mini",gemini:"gemini-2.0-flash-lite",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},F2={firstParty:"claude-haiku-4-5-20251001",bedrock:"us.anthropic.claude-haiku-4-5-20251001-v1:0",vertex:"claude-haiku-4-5@20251001",foundry:"claude-haiku-4-5",openai:"gpt-4o-mini",gemini:"gemini-2.0-flash-lite",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},L2={firstParty:"claude-sonnet-4-20250514",bedrock:"us.anthropic.claude-sonnet-4-20250514-v1:0",vertex:"claude-sonnet-4@20250514",foundry:"claude-sonnet-4",openai:"gpt-4o-mini",gemini:"gemini-2.0-flash",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},K2={firstParty:"claude-sonnet-4-5-20250929",bedrock:"us.anthropic.claude-sonnet-4-5-20250929-v1:0",vertex:"claude-sonnet-4-5@20250929",foundry:"claude-sonnet-4-5",openai:"gpt-4o",gemini:"gemini-2.0-flash",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},D2={firstParty:"claude-opus-4-20250514",bedrock:"us.anthropic.claude-opus-4-20250514-v1:0",vertex:"claude-opus-4@20250514",foundry:"claude-opus-4",openai:"gpt-4o",gemini:"gemini-2.5-pro",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},U2={firstParty:"claude-opus-4-1-20250805",bedrock:"us.anthropic.claude-opus-4-1-20250805-v1:0",vertex:"claude-opus-4-1@20250805",foundry:"claude-opus-4-1",openai:"gpt-4o",gemini:"gemini-2.5-pro",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},N2={firstParty:"claude-opus-4-5-20251101",bedrock:"us.anthropic.claude-opus-4-5-20251101-v1:0",vertex:"claude-opus-4-5@20251101",foundry:"claude-opus-4-5",openai:"gpt-4o",gemini:"gemini-2.5-pro",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},c0={firstParty:"claude-opus-4-6",bedrock:"us.anthropic.claude-opus-4-6-v1",vertex:"claude-opus-4-6",foundry:"claude-opus-4-6",openai:"gpt-4o",gemini:"gemini-2.5-pro",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},d0={firstParty:"claude-opus-4-7",bedrock:"us.anthropic.claude-opus-4-7-v1",vertex:"claude-opus-4-7",foundry:"claude-opus-4-7",openai:"gpt-4o",gemini:"gemini-2.5-pro",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},b2={firstParty:"claude-sonnet-4-6",bedrock:"us.anthropic.claude-sonnet-4-6",vertex:"claude-sonnet-4-6",foundry:"claude-sonnet-4-6",openai:"gpt-4o",gemini:"gemini-2.0-flash",github:"github:copilot",codex:"gpt-5.5","nvidia-nim":"nvidia/llama-3.1-nemotron-70b-instruct",minimax:"MiniMax-M2.5"},Y0={haiku35:w2,haiku45:F2,sonnet35:R2,sonnet37:H2,sonnet40:L2,sonnet45:K2,sonnet46:b2,opus40:D2,opus41:U2,opus45:N2,opus46:c0,opus47:d0},pZ=Object.values(Y0).map((Z)=>Z.firstParty),D5=Object.fromEntries(Object.entries(Y0).map(([Z,$])=>[$.firstParty,Z]))});function q(){let Z=P();if(!Z)return"firstParty";switch(Z.transport){case"anthropic":return"firstParty";case"gemini":return"gemini";case"mistral":return"mistral";case"github_copilot":return"github";case"codex_responses":return"codex";case"bedrock":return"bedrock";case"vertex":return"vertex";case"foundry":return"foundry";case"openai_compat":{let $=Z.baseUrl?.toLowerCase()??"";if($.includes("nvidia"))return"nvidia-nim";if($.includes("minimax"))return"minimax";return"openai"}default:return"firstParty"}}function dZ(){return q()==="firstParty"}function nZ(Z){let $=P();if($?.transport!=="github_copilot")return!1;return(Z?.trim()||$.model?.trim()||"").toLowerCase().includes("claude-")}function iZ(){return q()}function tZ(){let Z=P();if(!Z)return!0;if(Z.transport!=="anthropic")return!1;let $=Z.baseUrl;if(!$)return!0;try{let J=new URL($).host;return["api.anthropic.com"].includes(J)}catch{return!1}}var r=B(()=>{U0()});function i0(Z){let $=Z==="codex"||Z==="github"?"openai":Z,J={};for(let Q of N5)J[Q]=Y0[Q][$];return J}async function S4(){let Z=i0("bedrock"),$;try{$=await w5()}catch(Q){return K(Q),Z}if(!$?.length)return Z;let J={};for(let Q of N5){let X=Y0[Q].firstParty;J[Q]=F5($,X)||Z[Q]}return J}function U5(Z){let $=e().modelOverrides;if(!$)return Z;let J={...Z};for(let[Q,X]of Object.entries($)){let Y=D5[Q];if(Y&&X)J[Y]=X}return J}function t0(Z){let $;try{$=e().modelOverrides}catch{return Z}if(!$)return Z;for(let[J,Q]of Object.entries($))if(Q===Z)return J;return Z}function M4(){if(N0()!==null)return;if(q()!=="bedrock"){n0(i0(q()));return}b5()}function j(){let Z=N0();if(Z===null)return M4(),U5(i0(q()));return U5(Z)}async function J3(){if(N0()!==null)return;if(q()!=="bedrock"){n0(i0(q()));return}await b5()}var N5,b5;var l0=B(()=>{o();m0();R5();V0();K5();O2();r();N5=Object.keys(Y0);b5=H5(async()=>{if(N0()!==null)return;try{let Z=await S4();n0(Z)}catch(Z){K(Z)}})});function q3(){if(L(process.env.DISABLE_COST_WARNINGS))return!1;if(U())return!1;let $=b0(),J=Z0()!==null;if(!$.hasToken&&!J)return!1;let Q=w(),X=Q.oauthAccount?.organizationRole,Y=Q.oauthAccount?.workspaceRole;if(!X||!Y)return!1;return["admin","billing"].includes(X)||["workspace_admin","workspace_billing"].includes(Y)}function W3(){if(O5!==null)return O5;if(!U())return!1;let Z=E();if(Z==="max"||Z==="pro")return!0;let J=w().oauthAccount?.organizationRole;return!!J&&["admin","billing","owner","primary_owner"].includes(J)}var O5=null;var _5=B(()=>{n();q0();g()});function j3(Z){return Z}function B3(){return!1}function P5(){return null}function k5(){return!1}var E5=B(()=>{_5()});async function D3(){let $=w().oauthAccount?.accountUuid,J=Z0();if(!$||!J)return;let Q=`${D().BASE_API_URL}/api/claude_cli_profile`;try{return(await v.get(Q,{headers:{"x-api-key":J,"anthropic-beta":W0},params:{account_uuid:$},timeout:1e4})).data}catch(X){K(X)}}async function z0(Z){let $=`${D().BASE_API_URL}/api/oauth/profile`;try{return(await v.get($,{headers:{Authorization:`Bearer ${Z}`,"Content-Type":"application/json"},timeout:1e4})).data}catch(J){K(J)}}var P2=B(()=>{_2();O0();n();q0();m0()});import{mkdirSync as A4,writeFileSync as f4}from"fs";function p4(Z,$,J){if(!L(process.env.CLAUDE_CODE_REMOTE))return;try{A4(a0,{recursive:!0,mode:448}),f4(Z,$,{encoding:"utf8",mode:384}),z(`Persisted ${J} to ${Z} for subprocess access`)}catch(Q){z(`Failed to persist ${J} to disk (non-fatal): ${p(Q)}`,{level:"error"})}}function v5(Z,$){try{let Q=k2().readFileSync(Z,{encoding:"utf8"}).trim();if(!Q)return null;return z(`Read ${$} from well-known file ${Z}`),Q}catch(J){if(!S5(J))z(`Failed to read ${$} from ${Z}: ${p(J)}`,{level:"debug"});return null}}function h5({envVar:Z,wellKnownPath:$,label:J,getCached:Q,setCached:X}){let Y=Q();if(Y!==void 0)return Y;let V=process.env[Z];if(!V){let x=v5($,J);return X(x),x}let W=parseInt(V,10);if(Number.isNaN(W))return z(`${Z} must be a valid file descriptor number, got: ${V}`,{level:"error"}),X(null),null;try{let x=k2(),R=process.platform==="darwin"||process.platform==="freebsd"?`/dev/fd/${W}`:`/proc/self/fd/${W}`,F=x.readFileSync(R,{encoding:"utf8"}).trim();if(!F)return z(`File descriptor contained empty ${J}`,{level:"error"}),X(null),null;return z(`Successfully read ${J} from file descriptor ${W}`),X(F),p4($,F,J),F}catch(x){z(`Failed to read ${J} from file descriptor ${W}: ${p(x)}`,{level:"error"});let R=v5($,J);return X(R),R}}function s0(){return h5({envVar:"CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",wellKnownPath:u4,label:"OAuth token",getCached:y5,setCached:I5})}function E2(){return h5({envVar:"CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR",wellKnownPath:g4,label:"API key",getCached:C5,setCached:T5})}var a0="/home/claude/.claude/remote",u4,g4,E3;var A5=B(()=>{o();_0();g();M5();h4();u4=`${a0}/.oauth_token`,g4=`${a0}/.api_key`,E3=`${a0}/.session_ingress_token`});async function u5(){if(process.platform==="darwin"){let Z=i();if((await G0(`security delete-generic-password -a $USER -s "${Z}"`,{shell:!0,reject:!1})).exitCode!==0)throw Error("Failed to delete keychain entry")}}function r0(Z){return Z.slice(-20)}var g5=B(()=>{f5();v2()});function S3(Z){return Z?.name==="CredentialsProviderError"}function p5(Z){if(!Z||typeof Z!=="object")return!1;let $=Z;if(!$.Credentials||typeof $.Credentials!=="object")return!1;let J=$.Credentials;return typeof J.AccessKeyId==="string"&&typeof J.SecretAccessKey==="string"&&typeof J.SessionToken==="string"&&J.AccessKeyId.length>0&&J.SecretAccessKey.length>0&&J.SessionToken.length>0}async function y2(){let{STSClient:Z,GetCallerIdentityCommand:$}=await import("@aws-sdk/client-sts");await new Z().send(new $({}))}async function m5(){try{z("Clearing AWS credential provider cache");let{fromIni:Z}=await import("@aws-sdk/credential-providers");await Z({ignoreCache:!0})(),z("AWS credential provider cache refreshed")}catch(Z){z("Failed to clear AWS credential cache (this is expected if no credentials are configured)")}}var c5=B(()=>{_0()});class S{static instance=null;status={isAuthenticating:!1,output:[]};changed=$0();static getInstance(){if(!S.instance)S.instance=new S;return S.instance}getStatus(){return{...this.status,output:[...this.status.output]}}startAuthentication(){this.status={isAuthenticating:!0,output:[]},this.changed.emit(this.getStatus())}addOutput(Z){this.status.output.push(Z),this.changed.emit(this.getStatus())}setError(Z){this.status.error=Z,this.changed.emit(this.getStatus())}endAuthentication(Z){if(Z)this.status={isAuthenticating:!1,output:[]};else this.status.isAuthenticating=!1;this.changed.emit(this.getStatus())}subscribe=this.changed.subscribe;static reset(){if(S.instance)S.instance.changed.clear(),S.instance=null}}var n5=B(()=>{d5()});var o0="claude-code-20250219",i5="interleaved-thinking-2025-05-14",P0="context-1m-2025-08-07",t5="context-management-2025-06-27",l5="structured-outputs-2025-12-15",I2="web-search-2025-03-05",a5="advanced-tool-use-2025-11-20",s5="tool-search-tool-2025-10-19",f3="effort-2025-11-24",u3="task-budgets-2026-03-13",r5="prompt-caching-scope-2026-01-05",g3="fast-mode-2026-02-01",o5="redact-thinking-2026-02-12",e5="token-efficient-tools-2026-03-28",p3="afk-mode-2026-01-31",m3="advisor-tool-2026-03-01",C2,c3;var T2=B(()=>{C2=new Set(["interleaved-thinking-2025-05-14","context-1m-2025-08-07","tool-search-tool-2025-10-19"]),c3=new Set(["claude-code-20250219","interleaved-thinking-2025-05-14","context-management-2025-06-27"])});function h(){if(q()!=="firstParty")return!1;return!L(process.env.CLAUDE_CODE_DISABLE_FAST_MODE)}function Y1(){if(!h())return!1;return n4()===null}function d4(Z,$){switch(Z){case"free":return $==="oauth"?"Fast mode requires a paid subscription":"Fast mode unavailable during evaluation. Please purchase credits.";case"preference":return"Fast mode has been disabled by your organization";case"extra_usage_disabled":return"Fast mode requires extra usage billing · /extra-usage to enable";case"network_error":return"Fast mode unavailable due to network connectivity issues";case"unknown":return"Fast mode is currently unavailable"}}function n4(){if(q()!=="firstParty")return"Fast mode is not available on third-party providers";if(!h())return"Fast mode is not available";let Z=E0("tengu_penguins_off",null);if(Z!==null)return z(`Fast mode unavailable: ${Z}`),Z;if(!X1()&&E0("tengu_marble_sandcastle",!1))return"Fast mode requires the native binary · Install from: https://claude.com/product/claude-code";if(f()&&e0()&&!$1()){if(!b("flagSettings")?.fastMode)return z("Fast mode unavailable: Fast mode is not available in the Agent SDK"),"Fast mode is not available in the Agent SDK"}if(k.status==="disabled"){if(k.reason==="network_error"||k.reason==="unknown"){if(L(process.env.CLAUDE_CODE_SKIP_FAST_MODE_NETWORK_ERRORS))return null}let $=H()!==null?"oauth":"api-key",J=d4(k.reason,$);return z(`Fast mode unavailable: ${J}`),J}return null}function q9(){return"opus"+(y0()?"[1m]":"")}function W9(Z){if(!h())return!1;if(!Y1())return!1;if(!V1(Z))return!1;let $=e();if($.fastModePerSessionOptIn)return!1;return $.fastMode===!0}function V1(Z){if(!h())return!1;let $=Z??v0(),J=C($).toLowerCase();return J.includes("opus-4-7")||J.includes("opus-4-6")}function i4(){if(x0.status==="cooldown"&&Date.now()>=x0.resetAt){if(h()&&!S2)z("Fast mode cooldown expired, re-enabling fast mode"),S2=!0,W1.emit();x0={status:"active"}}return x0}function x9(Z,$){if(!h())return;x0={status:"cooldown",resetAt:Z,reason:$},S2=!1;let J=Z-Date.now();z(`Fast mode cooldown triggered (${$}), duration ${Math.round(J/1000)}s`),G("tengu_fast_mode_fallback_triggered",{cooldown_duration_ms:J,cooldown_reason:$}),q1.emit(Z,$)}function j9(){x0={status:"active"}}function B9(){if(k.status==="disabled")return;k={status:"disabled",reason:"preference"},$2("userSettings",{fastMode:void 0}),M((Z)=>({...Z,penguinModeOrgEnabled:!1})),M2.emit(!1)}function t4(Z){switch(Z){case"out_of_credits":return"Fast mode disabled · extra usage credits exhausted";case"org_level_disabled":case"org_service_level_disabled":return"Fast mode disabled · extra usage disabled by your organization";case"org_level_disabled_until":return"Fast mode disabled · extra usage spending cap reached";case"member_level_disabled":return"Fast mode disabled · extra usage disabled for your account";case"seat_tier_level_disabled":case"seat_tier_zero_credit_limit":case"member_zero_credit_limit":return"Fast mode disabled · extra usage not available for your plan";case"overage_not_provisioned":case"no_limits_configured":return"Fast mode requires extra usage billing · /extra-usage to enable";default:return"Fast mode disabled · extra usage not available"}}function l4(Z){return Z==="org_level_disabled_until"||Z==="out_of_credits"}function R9(Z){let $=t4(Z);if(z(`Fast mode overage rejection: ${Z??"unknown"} — ${$}`),G("tengu_fast_mode_overage_rejected",{overage_disabled_reason:Z??"unknown"}),!l4(Z))$2("userSettings",{fastMode:void 0}),M((J)=>({...J,penguinModeOrgEnabled:!1}));z1.emit($)}function a4(){return i4().status==="cooldown"}function w9(Z,$){let J=h()&&Y1()&&!!$&&V1(Z);if(J&&a4())return"cooldown";if(J)return"on";return"off"}async function s4(Z){let $=`${D().BASE_API_URL}/api/claude_code_penguin_mode`,J="accessToken"in Z?{Authorization:`Bearer ${Z.accessToken}`,"anthropic-beta":W0}:{"x-api-key":Z.apiKey};return(await v.get($,{headers:J})).data}function L9(){if(!h())return;if(k.status!=="pending")return;k=w().penguinModeOrgEnabled===!0?{status:"enabled"}:{status:"disabled",reason:"unknown"}}async function K9(){if(Q1())return;if(!h())return;if(k0)return z("Fast mode prefetch in progress, returning in-flight promise"),k0;let Z=Z0();if(!(H()?.accessToken&&J0())&&!Z){k=w().penguinModeOrgEnabled===!0?{status:"enabled"}:{status:"disabled",reason:"preference"};return}let J=Date.now();if(J-Z1<r4){z("Skipping fast mode prefetch, fetched recently");return}Z1=J;let Q=async()=>{let Y=H(),V=Y?.accessToken&&J0()?{accessToken:Y.accessToken}:Z?{apiKey:Z}:null;if(!V)throw Error("No auth available");return s4(V)};async function X(){try{let Y;try{Y=await Q()}catch(W){if(v.isAxiosError(W)&&(W.response?.status===401||W.response?.status===403&&typeof W.response?.data==="string"&&W.response.data.includes("OAuth token has been revoked"))){let R=H()?.accessToken;if(R)await h2(R),Y=await Q();else throw W}else throw W}let V=k.status!=="pending"?k.status==="enabled":w().penguinModeOrgEnabled;if(k=Y.enabled?{status:"enabled"}:{status:"disabled",reason:Y.disabled_reason??"preference"},V!==Y.enabled){if(!Y.enabled)$2("userSettings",{fastMode:void 0});M((W)=>({...W,penguinModeOrgEnabled:Y.enabled})),M2.emit(Y.enabled)}z(`Org fast mode: ${Y.enabled?"enabled":`disabled (${Y.disabled_reason??"preference"})`}`)}catch(Y){k=w().penguinModeOrgEnabled===!0?{status:"enabled"}:{status:"disabled",reason:"network_error"},z(`Failed to fetch org fast mode status, defaulting to ${k.status==="enabled"?"enabled (cached)":"disabled (network_error)"}: ${Y}`,{level:"error"}),G("tengu_org_penguin_mode_fetch_failed",{})}finally{k0=null}}return k0=X(),k0}var V9="Opus 4.7",x0,S2=!1,q1,W1,z9,G9,z1,H9,k,M2,F9,r4=30000,Z1=0,k0=null;var G1=B(()=>{_2();O0();J1();o();Z2();n();c4();q0();_0();g();j0();r();m4();V0();d5();x0={status:"active"},q1=$0(),W1=$0(),z9=q1.subscribe,G9=W1.subscribe;z1=$0(),H9=z1.subscribe;k={status:"pending"},M2=$0(),F9=M2.subscribe});function Q8(Z){for(let $ of J8)if($.pattern.test(Z))return $.cost;return}function A2(Z){if(h()&&Z)return o4;return C0}function X8(Z,$){return $.input_tokens/1e6*Z.inputTokens+$.output_tokens/1e6*Z.outputTokens+($.cache_read_input_tokens??0)/1e6*Z.promptCacheReadTokens+($.cache_creation_input_tokens??0)/1e6*Z.promptCacheWriteTokens+($.server_tool_use?.web_search_requests??0)*Z.webSearchRequests}function Y8(Z,$){let J=O(Z);if(J===N(c0.firstParty)||J===N(d0.firstParty)){let X=$.speed==="fast";return A2(X)}let Q=j1[J];if(!Q){let X=Q8(Z);if(X)return X;return V8(Z,J),j1[O(v0())]??$8}return Q}function V8(Z,$){G("tengu_unknown_model_cost",{model:Z,shortName:$}),H1()}function q8(Z,$){let J=Y8(Z,$);return X8(J,$)}function P9(Z,$){let J={input_tokens:$.inputTokens,output_tokens:$.outputTokens,cache_read_input_tokens:$.cacheReadInputTokens,cache_creation_input_tokens:$.cacheCreationInputTokens};return q8(Z,J)}function B1(Z){if(Number.isInteger(Z))return`$${Z}`;return`$${Z.toFixed(2)}`}function R1(Z){return`${B1(Z.inputTokens)}/${B1(Z.outputTokens)} per Mtok`}var I0,x1,C0,o4,e4,Z8,$8,J8,j1;var w1=B(()=>{Z2();o();G1();O2();j0();I0={inputTokens:3,outputTokens:15,promptCacheWriteTokens:3.75,promptCacheReadTokens:0.3,webSearchRequests:0.01},x1={inputTokens:15,outputTokens:75,promptCacheWriteTokens:18.75,promptCacheReadTokens:1.5,webSearchRequests:0.01},C0={inputTokens:5,outputTokens:25,promptCacheWriteTokens:6.25,promptCacheReadTokens:0.5,webSearchRequests:0.01},o4={inputTokens:30,outputTokens:150,promptCacheWriteTokens:37.5,promptCacheReadTokens:3,webSearchRequests:0.01},e4={inputTokens:0.8,outputTokens:4,promptCacheWriteTokens:1,promptCacheReadTokens:0.08,webSearchRequests:0.01},Z8={inputTokens:1,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:0.1,webSearchRequests:0.01},$8=C0,J8=[{pattern:/gpt-5-nano/i,label:"gpt-5-nano",cost:{inputTokens:0.05,outputTokens:0.4,promptCacheWriteTokens:0.05,promptCacheReadTokens:0.005,webSearchRequests:0}},{pattern:/gpt-5-mini/i,label:"gpt-5-mini",cost:{inputTokens:0.25,outputTokens:2,promptCacheWriteTokens:0.25,promptCacheReadTokens:0.025,webSearchRequests:0}},{pattern:/gpt-5/i,label:"gpt-5",cost:{inputTokens:1.25,outputTokens:10,promptCacheWriteTokens:1.25,promptCacheReadTokens:0.125,webSearchRequests:0}},{pattern:/gpt-4o-mini/i,label:"gpt-4o-mini",cost:{inputTokens:0.15,outputTokens:0.6,promptCacheWriteTokens:0.15,promptCacheReadTokens:0.075,webSearchRequests:0}},{pattern:/gpt-4o/i,label:"gpt-4o",cost:{inputTokens:2.5,outputTokens:10,promptCacheWriteTokens:2.5,promptCacheReadTokens:1.25,webSearchRequests:0}},{pattern:/gpt-4\.1/i,label:"gpt-4.1",cost:{inputTokens:2,outputTokens:8,promptCacheWriteTokens:2,promptCacheReadTokens:0.5,webSearchRequests:0}},{pattern:/o4-mini/i,label:"o4-mini",cost:{inputTokens:0.55,outputTokens:2.2,promptCacheWriteTokens:0.55,promptCacheReadTokens:0.275,webSearchRequests:0}},{pattern:/\bo3\b/i,label:"o3",cost:{inputTokens:15,outputTokens:60,promptCacheWriteTokens:15,promptCacheReadTokens:7.5,webSearchRequests:0}},{pattern:/\bo1\b/i,label:"o1",cost:{inputTokens:15,outputTokens:60,promptCacheWriteTokens:15,promptCacheReadTokens:7.5,webSearchRequests:0}},{pattern:/gemini.*2\.5.*pro/i,label:"gemini-2.5-pro",cost:{inputTokens:1.25,outputTokens:10,promptCacheWriteTokens:1.25,promptCacheReadTokens:0.125,webSearchRequests:0}},{pattern:/gemini.*2\.5.*flash/i,label:"gemini-2.5-flash",cost:{inputTokens:0.3,outputTokens:2.5,promptCacheWriteTokens:0.3,promptCacheReadTokens:0.03,webSearchRequests:0}},{pattern:/gemini.*flash/i,label:"gemini-flash",cost:{inputTokens:0.1,outputTokens:0.4,promptCacheWriteTokens:0.1,promptCacheReadTokens:0.025,webSearchRequests:0}},{pattern:/gemini.*pro/i,label:"gemini-pro",cost:{inputTokens:1.25,outputTokens:5,promptCacheWriteTokens:1.25,promptCacheReadTokens:0.125,webSearchRequests:0}},{pattern:/gemini/i,label:"gemini",cost:{inputTokens:0.3,outputTokens:2.5,promptCacheWriteTokens:0.3,promptCacheReadTokens:0.03,webSearchRequests:0}},{pattern:/deepseek/i,label:"deepseek",cost:{inputTokens:0.14,outputTokens:0.28,promptCacheWriteTokens:0.14,promptCacheReadTokens:0.0028,webSearchRequests:0}},{pattern:/kimi-for-coding/i,label:"kimi-for-coding",cost:{inputTokens:1,outputTokens:2,promptCacheWriteTokens:1,promptCacheReadTokens:0.1,webSearchRequests:0}},{pattern:/kimi/i,label:"kimi",cost:{inputTokens:0.6,outputTokens:2.5,promptCacheWriteTokens:0.6,promptCacheReadTokens:0.06,webSearchRequests:0}},{pattern:/moonshot/i,label:"moonshot",cost:{inputTokens:0.6,outputTokens:2.5,promptCacheWriteTokens:0.6,promptCacheReadTokens:0.06,webSearchRequests:0}},{pattern:/devstral/i,label:"devstral",cost:{inputTokens:0.1,outputTokens:0.3,promptCacheWriteTokens:0.1,promptCacheReadTokens:0.1,webSearchRequests:0}},{pattern:/mistral.*large.*3/i,label:"mistral-large-3",cost:{inputTokens:0.5,outputTokens:1.5,promptCacheWriteTokens:0.5,promptCacheReadTokens:0.5,webSearchRequests:0}},{pattern:/mistral.*large/i,label:"mistral-large",cost:{inputTokens:2,outputTokens:6,promptCacheWriteTokens:2,promptCacheReadTokens:2,webSearchRequests:0}},{pattern:/mistral.*medium/i,label:"mistral-medium",cost:{inputTokens:0.4,outputTokens:2,promptCacheWriteTokens:0.4,promptCacheReadTokens:0.4,webSearchRequests:0}},{pattern:/mistral.*small/i,label:"mistral-small",cost:{inputTokens:0.1,outputTokens:0.3,promptCacheWriteTokens:0.1,promptCacheReadTokens:0.1,webSearchRequests:0}},{pattern:/ministral.*8b/i,label:"ministral-8b",cost:{inputTokens:0.1,outputTokens:0.1,promptCacheWriteTokens:0.1,promptCacheReadTokens:0.1,webSearchRequests:0}},{pattern:/ministral.*3b/i,label:"ministral-3b",cost:{inputTokens:0.04,outputTokens:0.04,promptCacheWriteTokens:0.04,promptCacheReadTokens:0.04,webSearchRequests:0}},{pattern:/llama.*405/i,label:"llama-405b",cost:{inputTokens:3.5,outputTokens:3.5,promptCacheWriteTokens:3.5,promptCacheReadTokens:3.5,webSearchRequests:0}},{pattern:/llama.*70/i,label:"llama-70b",cost:{inputTokens:0.59,outputTokens:0.79,promptCacheWriteTokens:0.59,promptCacheReadTokens:0.59,webSearchRequests:0}},{pattern:/llama.*8b/i,label:"llama-8b",cost:{inputTokens:0.1,outputTokens:0.1,promptCacheWriteTokens:0.1,promptCacheReadTokens:0.1,webSearchRequests:0}},{pattern:/qwen/i,label:"qwen",cost:{inputTokens:0.5,outputTokens:1.5,promptCacheWriteTokens:0.5,promptCacheReadTokens:0.5,webSearchRequests:0}},{pattern:/minimax/i,label:"minimax",cost:{inputTokens:0.2,outputTokens:1.1,promptCacheWriteTokens:0.2,promptCacheReadTokens:0.2,webSearchRequests:0}},{pattern:/\bglm/i,label:"glm",cost:{inputTokens:0.5,outputTokens:1.5,promptCacheWriteTokens:0.5,promptCacheReadTokens:0.5,webSearchRequests:0}},{pattern:/grok.*4.*fast/i,label:"grok-4-fast",cost:{inputTokens:0.2,outputTokens:0.5,promptCacheWriteTokens:0.2,promptCacheReadTokens:0.05,webSearchRequests:0}},{pattern:/grok.*4\.20/i,label:"grok-4.20",cost:{inputTokens:2,outputTokens:6,promptCacheWriteTokens:2,promptCacheReadTokens:0.5,webSearchRequests:0}},{pattern:/grok.*4/i,label:"grok-4",cost:{inputTokens:3,outputTokens:15,promptCacheWriteTokens:3,promptCacheReadTokens:0.75,webSearchRequests:0}},{pattern:/grok/i,label:"grok",cost:{inputTokens:2,outputTokens:6,promptCacheWriteTokens:2,promptCacheReadTokens:0.5,webSearchRequests:0}},{pattern:/command-?r-?plus|command-r\+/i,label:"command-r-plus",cost:{inputTokens:2.5,outputTokens:10,promptCacheWriteTokens:2.5,promptCacheReadTokens:2.5,webSearchRequests:0}},{pattern:/command-?a\b/i,label:"command-a",cost:{inputTokens:2.5,outputTokens:10,promptCacheWriteTokens:2.5,promptCacheReadTokens:2.5,webSearchRequests:0}},{pattern:/command-?r7b/i,label:"command-r7b",cost:{inputTokens:0.0375,outputTokens:0.15,promptCacheWriteTokens:0.0375,promptCacheReadTokens:0.0375,webSearchRequests:0}},{pattern:/command-?r/i,label:"command-r",cost:{inputTokens:0.15,outputTokens:0.6,promptCacheWriteTokens:0.15,promptCacheReadTokens:0.15,webSearchRequests:0}},{pattern:/gemma.*27b/i,label:"gemma-27b",cost:{inputTokens:0.08,outputTokens:0.16,promptCacheWriteTokens:0.08,promptCacheReadTokens:0.08,webSearchRequests:0}},{pattern:/gemma.*12b/i,label:"gemma-12b",cost:{inputTokens:0.04,outputTokens:0.13,promptCacheWriteTokens:0.04,promptCacheReadTokens:0.04,webSearchRequests:0}},{pattern:/gemma/i,label:"gemma",cost:{inputTokens:0.04,outputTokens:0.08,promptCacheWriteTokens:0.04,promptCacheReadTokens:0.04,webSearchRequests:0}},{pattern:/phi-?4-?mini/i,label:"phi-4-mini",cost:{inputTokens:0.075,outputTokens:0.3,promptCacheWriteTokens:0.075,promptCacheReadTokens:0.075,webSearchRequests:0}},{pattern:/phi-?4/i,label:"phi-4",cost:{inputTokens:0.13,outputTokens:0.5,promptCacheWriteTokens:0.13,promptCacheReadTokens:0.13,webSearchRequests:0}},{pattern:/\bphi\b/i,label:"phi",cost:{inputTokens:0.13,outputTokens:0.5,promptCacheWriteTokens:0.13,promptCacheReadTokens:0.13,webSearchRequests:0}}];j1={[N(w2.firstParty)]:e4,[N(F2.firstParty)]:Z8,[N(R2.firstParty)]:I0,[N(H2.firstParty)]:I0,[N(L2.firstParty)]:I0,[N(K2.firstParty)]:I0,[N(b2.firstParty)]:I0,[N(D2.firstParty)]:x1,[N(U2.firstParty)]:x1,[N(N2.firstParty)]:C0,[N(c0.firstParty)]:C0,[N(d0.firstParty)]:C0}});function m(Z){return W8.includes(Z)}function B0(Z){return z8.includes(Z)}var W8,z8;var f2=B(()=>{W8=["sonnet","opus","haiku","best","sonnet[1m]","opus[1m]","opusplan"];z8=["sonnet","opus","haiku"]});function G8(Z,$){if(Z.includes($))return!0;if(m(Z))return C(Z).toLowerCase().includes($);return!1}function F1(Z,$){if(!Z.startsWith($))return!1;return Z.length===$.length||Z[$.length]==="-"}function x8(Z,$){let J=m(Z)?C(Z).toLowerCase():Z;if(F1(J,$))return!0;if(!$.startsWith("claude-")&&F1(J,`claude-${$}`))return!0;return!1}function L1(Z,$){for(let J of $){if(B0(J))continue;let Q=J.indexOf(Z);if(Q===-1)continue;let X=Q+Z.length;if(X===J.length||J[X]==="-")return!0}return!1}function K1(Z){let $=T()||{},{availableModels:J}=$;if(!J)return!0;if(J.length===0)return!1;let X=t0(Z).trim().toLowerCase(),Y=J.map((V)=>V.trim().toLowerCase());if(Y.includes(X)){if(!B0(X)||!L1(X,Y))return!0}for(let V of Y)if(B0(V)&&!L1(V,Y)&&G8(X,V))return!0;if(m(X)){let V=C(X).toLowerCase();if(Y.includes(V))return!0}for(let V of Y)if(!B0(V)&&m(V)){if(C(V).toLowerCase()===X)return!0}for(let V of Y)if(!B0(V)&&!m(V)){if(x8(X,V))return!0}return!1}var D1=B(()=>{V0();f2();j0();l0()});function S9(){return Object.values(U1)}var U1,u2;var N1=B(()=>{U1={"gpt-5.5":{id:"gpt-5.5",name:"GPT-5.5",family:"gpt",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:400000,output:128000}},"gpt-5.4":{id:"gpt-5.4",name:"GPT-5.4",family:"gpt",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:400000,output:128000}},"gpt-5.2-codex":{id:"gpt-5.2-codex",name:"GPT-5.2-Codex",family:"gpt-codex",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:400000,output:128000}},"gpt-5-mini":{id:"gpt-5-mini",name:"GPT-5 mini",family:"gpt-mini",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:264000,output:64000}},"gpt-4o":{id:"gpt-4o",name:"GPT-4o",family:"gpt",attachment:!0,reasoning:!1,tool_call:!0,temperature:!0,knowledge:"2023-10",release_date:"2024-05-01",last_updated:"2024-08-06",modalities:{input:["text","image"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:128000,output:16384}},"gpt-4.1":{id:"gpt-4.1",name:"GPT-4.1",family:"gpt",attachment:!1,reasoning:!1,tool_call:!0,temperature:!0,knowledge:"2024-06",release_date:"2024-06-01",last_updated:"2024-06-01",modalities:{input:["text"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:128000,output:16384}},"claude-opus-4.7":{id:"claude-opus-4.7",name:"Claude Opus 4.7",family:"claude-opus",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2026-01",release_date:"2026-04-01",last_updated:"2026-04-01",modalities:{input:["text","image"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:200000,output:32000}},"claude-sonnet-4.6":{id:"claude-sonnet-4.6",name:"Claude Sonnet 4.6",family:"claude-sonnet",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text","image"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:200000,output:32000}},"claude-haiku-4.5":{id:"claude-haiku-4.5",name:"Claude Haiku 4.5",family:"claude-haiku",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text","image"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:144000,output:32768}},"gemini-3.1-pro-preview":{id:"gemini-3.1-pro-preview",name:"Gemini 3.1 Pro Preview",family:"gemini-pro",attachment:!0,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text","image","audio"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:200000,output:64000}},"grok-code-fast-1":{id:"grok-code-fast-1",name:"Grok Code Fast 1",family:"grok",attachment:!1,reasoning:!0,tool_call:!0,temperature:!0,knowledge:"2025-05",release_date:"2025-05-01",last_updated:"2025-05-01",modalities:{input:["text"],output:["text"]},open_weights:!1,cost:{input:0,output:0},limit:{context:256000,output:64000}}},u2=Object.fromEntries(Object.values(U1).map((Z)=>[Z.id,Z.name]))});function p2(Z){if(typeof Z!=="string")return;let $=Z.trim();return $.length>0?$:void 0}function R0(){let Z=P();if(!Z?.model)return;return k1(Z.model)}function r9(){if(process.env.ANTHROPIC_SMALL_FAST_MODEL)return process.env.ANTHROPIC_SMALL_FAST_MODEL;let Z=R0();if(q()==="gemini")return Z||"gemini-2.0-flash-lite";if(q()==="mistral")return Z||"ministral-3b-latest";if(q()==="openai")return Z||"gpt-4o-mini";if(q()==="codex")return Z||"codexspark";if(q()==="github")return Z||"github:copilot";if(q()==="nvidia-nim")return Z||"meta/llama-3.1-8b-instruct";if(q()==="minimax")return Z||"MiniMax-M2.5-highspeed";return E1()}function o9(Z){return Z===j().opus40||Z===j().opus41||Z===j().opus45||Z===j().opus46||Z===j().opus47}function g2(){let Z,$=O1();if($!==void 0)Z=$;else{let J=T()||{},Q=p2(J.model);Z=R0()||Q||void 0}if(Z&&!K1(Z))return;return Z}function e9(){let Z=g2();if(Z!==void 0&&Z!==null)return C(Z);return v1()}function R8(){return H0()}function H0(){if(process.env.ANTHROPIC_DEFAULT_OPUS_MODEL)return process.env.ANTHROPIC_DEFAULT_OPUS_MODEL;let Z=R0();if(q()==="gemini")return Z||"gemini-2.5-pro";if(q()==="mistral")return Z||"devstral-latest";if(q()==="openai")return Z||"gpt-4o";if(q()==="codex")return Z||"gpt-5.5";if(q()==="github")return Z||"github:copilot";if(q()==="nvidia-nim")return Z||"nvidia/llama-3.1-nemotron-70b-instruct";if(q()==="minimax")return Z||"MiniMax-M2.7";if(q()!=="firstParty")return j().opus46;return j().opus47}function T0(){if(process.env.ANTHROPIC_DEFAULT_SONNET_MODEL)return process.env.ANTHROPIC_DEFAULT_SONNET_MODEL;let Z=R0();if(q()==="gemini")return Z||"gemini-2.0-flash";if(q()==="mistral")return Z||"mistral-medium-latest";if(q()==="openai")return Z||"gpt-4o";if(q()==="codex")return Z||"gpt-5.5";if(q()==="github")return Z||"github:copilot";if(q()==="nvidia-nim")return Z||"nvidia/llama-3.1-nemotron-70b-instruct";if(q()==="minimax")return Z||"MiniMax-M2.5";if(q()!=="firstParty")return j().sonnet45;return j().sonnet46}function E1(){if(process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL)return process.env.ANTHROPIC_DEFAULT_HAIKU_MODEL;let Z=R0();if(q()==="mistral")return Z||"ministral-3b-latest";if(q()==="openai")return Z||"gpt-4o-mini";if(q()==="codex")return Z||"gpt-5.5";if(q()==="github")return Z||"github:copilot";if(q()==="gemini")return Z||"gemini-2.0-flash-lite";if(q()==="nvidia-nim")return Z||"meta/llama-3.1-8b-instruct";if(q()==="minimax")return Z||"MiniMax-M2.5-highspeed";return j().haiku45}function Z$(Z){let{permissionMode:$,mainLoopModel:J,exceeds200kTokens:Q=!1}=Z;if(g2()==="opusplan"&&$==="plan"&&!Q)return H0();if(g2()==="haiku"&&$==="plan")return T0();return J}function v0(){let Z=R0();if(q()==="github"){let $=T()||{};return p2($.model)||Z||"github:copilot"}if(q()==="gemini")return Z||"gemini-2.0-flash";if(q()==="mistral")return Z||"devstral-latest";if(q()==="openai")return Z||"gpt-4o";if(q()==="codex")return Z||"gpt-5.5";if(J2())return H0()+(y0()?"[1m]":"");if(Q2())return H0()+(y0()?"[1m]":"");return T0()}function v1(){return C(v0())}function N(Z){if(Z=Z.toLowerCase(),Z.includes("claude-opus-4-7"))return"claude-opus-4-7";if(Z.includes("claude-opus-4-6"))return"claude-opus-4-6";if(Z.includes("claude-opus-4-5"))return"claude-opus-4-5";if(Z.includes("claude-opus-4-1"))return"claude-opus-4-1";if(Z.includes("claude-opus-4"))return"claude-opus-4";if(Z.includes("claude-sonnet-4-6"))return"claude-sonnet-4-6";if(Z.includes("claude-sonnet-4-5"))return"claude-sonnet-4-5";if(Z.includes("claude-sonnet-4"))return"claude-sonnet-4";if(Z.includes("claude-haiku-4-5"))return"claude-haiku-4-5";if(Z.includes("claude-3-7-sonnet"))return"claude-3-7-sonnet";if(Z.includes("claude-3-5-sonnet"))return"claude-3-5-sonnet";if(Z.includes("claude-3-5-haiku"))return"claude-3-5-haiku";if(Z.includes("claude-3-opus"))return"claude-3-opus";if(Z.includes("claude-3-sonnet"))return"claude-3-sonnet";if(Z.includes("claude-3-haiku"))return"claude-3-haiku";let $=Z.match(/(claude-(\d+-\d+-)?\w+)/);if($&&$[1])return $[1];return Z}function O(Z){return N(t0(Z))}function w8(Z=!1){if(J2()||Q2()){if(y0())return`Opus 4.7 with 1M context · Most capable for complex work${Z?b1(!0):""}`;return`Opus 4.7 · Most capable for complex work${Z?b1(!0):""}`}return"Sonnet 4.6 · Best for everyday tasks"}function $$(Z){if(Z==="opusplan")return"Opus 4.7 in plan mode, else Sonnet 4.6";return I1(C(Z))}function b1(Z){if(q()!=="firstParty")return"";let $=R1(A2(Z));return` ·${Z?` (${_1})`:""} ${$}`}function y0(){if(w0()||d2()||q()!=="firstParty")return!1;if(U()&&E()===null)return!1;return!0}function J$(Z){if(Z==="opusplan")return"Opus Plan";if(Z==="codexplan")return"codexplan (gpt-5.5)";if(Z==="codexspark")return"codexspark (gpt-5.3-codex-spark)";if(m(Z))return P1(Z);return I1(Z)}function y1(Z){if(q()==="openai"||q()==="gemini"||q()==="codex"||q()==="github"){if(u2[Z])return u2[Z];return null}switch(Z){case"gpt-5.5":return"GPT-5.5";case"gpt-5.4":return"GPT-5.4";case"gpt-5.3-codex-spark":return"GPT-5.3 Codex Spark";case j().opus47:return"Opus 4.7";case j().opus47+"[1m]":return"Opus 4.7 (1M context)";case j().opus46:return"Opus 4.6";case j().opus46+"[1m]":return"Opus 4.6 (1M context)";case j().opus45:return"Opus 4.5";case j().opus41:return"Opus 4.1";case j().opus40:return"Opus 4";case j().sonnet46+"[1m]":return"Sonnet 4.6 (1M context)";case j().sonnet46:return"Sonnet 4.6";case j().sonnet45+"[1m]":return"Sonnet 4.5 (1M context)";case j().sonnet45:return"Sonnet 4.5";case j().sonnet40:return"Sonnet 4";case j().sonnet40+"[1m]":return"Sonnet 4 (1M context)";case j().sonnet37:return"Sonnet 3.7";case j().sonnet35:return"Sonnet 3.5";case j().haiku45:return"Haiku 4.5";case j().haiku35:return"Haiku 3.5";default:return null}}function I1(Z){let $=y1(Z);if($)return $;if(Z==="github:copilot")return"GPT-4o";return Z}function Q$(Z){let $=y1(Z);if($)return`Claude ${$}`;return`Claude (${Z})`}function C(Z){let $=p2(Z);if(!$)return T0();let J=$.toLowerCase(),Q=t(J),X=Q?J.replace(/\[1m]$/i,"").trim():J;if(m(X))switch(X){case"opusplan":return T0()+(Q?"[1m]":"");case"sonnet":return T0()+(Q?"[1m]":"");case"haiku":return E1()+(Q?"[1m]":"");case"opus":return H0()+(Q?"[1m]":"");case"best":return R8();default:}if(X==="codexplan")return"gpt-5.5";if(X==="codexspark")return"gpt-5.3-codex-spark";if(q()==="firstParty"&&L8(X)&&K8())return H0()+(Q?"[1m]":"");if(Q)return $.replace(/\[1m\]$/i,"").trim()+"[1m]";return $}function X$(Z,$){if(t(Z)||!t($))return Z;if(m2(C(Z)))return Z+"[1m]";return Z}function L8(Z){return F8.includes(Z)}function K8(){return!L(process.env.CLAUDE_CODE_DISABLE_LEGACY_MODEL_REMAP)}function Y$(Z){if(Z===null){if(U())return`Default (${w8()})`;return`Default (${v1()})`}let $=C(Z);return Z===$?$:`${Z} (${$})`}function V$(Z){if(q()==="foundry")return;let $=Z.toLowerCase().includes("[1m]"),J=O(Z);if(J.includes("claude-opus-4-7"))return $?"Opus 4.7 (with 1M context)":"Opus 4.7";if(J.includes("claude-opus-4-6"))return $?"Opus 4.6 (with 1M context)":"Opus 4.6";if(J.includes("claude-opus-4-5"))return"Opus 4.5";if(J.includes("claude-opus-4-1"))return"Opus 4.1";if(J.includes("claude-opus-4"))return"Opus 4";if(J.includes("claude-sonnet-4-6"))return $?"Sonnet 4.6 (with 1M context)":"Sonnet 4.6";if(J.includes("claude-sonnet-4-5"))return $?"Sonnet 4.5 (with 1M context)":"Sonnet 4.5";if(J.includes("claude-sonnet-4"))return $?"Sonnet 4 (with 1M context)":"Sonnet 4";if(J.includes("claude-3-7-sonnet"))return"Claude 3.7 Sonnet";if(J.includes("claude-3-5-sonnet"))return"Claude 3.5 Sonnet";if(J.includes("claude-haiku-4-5"))return"Haiku 4.5";if(J.includes("claude-3-5-haiku"))return"Claude 3.5 Haiku";return}function q$(Z){return Z.replace(/\[(1|2)m\]/gi,"")}var F8;var j0=B(()=>{o();U0();n();c2();g();H8();l0();w1();V0();r();j8();D1();f2();B8();N1();F8=["claude-opus-4-20250514","claude-opus-4-1-20250805","claude-opus-4-0","claude-opus-4-1"]});function n2(Z){return}async function z$(){}var C1=()=>{};function S1(Z,$,J){let Q=P()?.model?.trim();if(Q&&Q!==J){let Y=`${Q}:${J}`;if($[Y]!==void 0)return $[Y];if(Z[Y]!==void 0)return Z[Y]}let X=T1($,J);if(X!==void 0)return X;return T1(Z,J)}function T1(Z,$){if(Z[$]!==void 0)return Z[$];let J=Object.keys(Z).sort((Q,X)=>X.length-Q.length);for(let Q of J)if($.startsWith(Q))return Z[Q];return}function M1(Z){return S1(D8,N8,Z)}function h1(Z){return S1(U8,b8,Z)}var D8,U8,N8,b8;var A1=B(()=>{U0();D8={"github:copilot":128000,"github:copilot:claude-haiku-4.5":144000,"github:copilot:claude-sonnet-4.6":200000,"github:copilot:claude-opus-4.7":200000,"github:copilot:gpt-4.1":128000,"github:copilot:gpt-4o":128000,"github:copilot:gpt-5-mini":264000,"github:copilot:gpt-5.2-codex":400000,"github:copilot:gpt-5.4":400000,"github:copilot:gpt-5.5":400000,"github:copilot:gemini-3.1-pro-preview":200000,"github:copilot:grok-code-fast-1":256000,"github_copilot/claude-haiku-4.5":144000,"github_copilot/claude-sonnet-4.6":200000,"github_copilot/claude-opus-4.7":200000,"github_copilot/gpt-4.1":128000,"github_copilot/gpt-4o":128000,"github_copilot/gpt-5-mini":264000,"github_copilot/gpt-5.2-codex":400000,"github_copilot/gpt-5.4":400000,"github_copilot/gpt-5.5":400000,"github_copilot/gemini-3.1-pro-preview":200000,"github_copilot/grok-code-fast-1":256000,"gpt-5.5":1050000,"gpt-5.5-mini":400000,"gpt-5.5-nano":400000,"gpt-5.4":1050000,"gpt-5.4-mini":400000,"gpt-5.4-nano":400000,"gpt-4o":128000,"gpt-4o-mini":128000,"gpt-4.1":1047576,"gpt-4.1-mini":1047576,"gpt-4.1-nano":1047576,"gpt-4-turbo":128000,"gpt-4":8192,o1:200000,"o1-mini":128000,"o1-preview":128000,"o1-pro":200000,o3:200000,"o3-mini":200000,"o4-mini":200000,"deepseek-v4-flash":1048576,"deepseek-v4-pro":1048576,"deepseek-chat":128000,"deepseek-reasoner":128000,"llama-3.3-70b-versatile":128000,"llama-3.1-8b-instant":128000,"mixtral-8x7b-32768":32768,"mistral-large-latest":256000,"mistral-small-latest":256000,"devstral-latest":256000,"ministral-3b-latest":256000,"nvidia/llama-3.1-nemotron-70b-instruct":128000,"nvidia/llama-3.1-nemotron-ultra-253b-v1":128000,"nvidia/nemotron-mini-4b-instruct":32768,"meta/llama-3.1-405b-instruct":128000,"meta/llama-3.1-70b-instruct":128000,"meta/llama-3.1-8b-instruct":128000,"meta/llama-3.2-90b-instruct":128000,"meta/llama-3.2-1b-instruct":128000,"meta/llama-3.2-3b-instruct":128000,"meta/llama-3.3-70b-instruct":128000,"google/gemma-2-27b-it":8192,"google/gemma-2-9b-it":8192,"google/gemma-3-27b-it":131072,"google/gemma-3-12b-it":131072,"google/gemma-3-4b-it":131072,"deepseek-ai/deepseek-r1":128000,"deepseek-ai/deepseek-v3":128000,"deepseek-ai/deepseek-v3.2":128000,"qwen/qwen3-32b":128000,"qwen/qwen3-8b":128000,"qwen/qwen2.5-7b-instruct":32768,"mistralai/mistral-large-3-675b-instruct-2512":256000,"mistralai/mistral-large-2-instruct":256000,"mistralai/mistral-small-3.1-24b-instruct-2503":32768,"mistralai/mixtral-8x7b-instruct-v0.1":32768,"microsoft/phi-4-mini-instruct":16384,"microsoft/phi-3.5-mini-instruct":16384,"microsoft/phi-3-mini-128k-instruct":128000,"ibm/granite-3.3-8b-instruct":8192,"ibm/granite-8b-code-instruct":8192,"z-ai/glm5":200000,"z-ai/glm4.7":128000,"moonshotai/kimi-k2.5":200000,"moonshotai/kimi-k2-instruct":128000,"databricks/dbrx-instruct":131072,"ai21labs/jamba-1.5-large-instruct":256000,"ai21labs/jamba-1.5-mini-instruct":256000,"01-ai/yi-large":32768,"MiniMax-M2.7":204800,"MiniMax-M2.7-highspeed":204800,"MiniMax-M2.5":204800,"MiniMax-M2.5-highspeed":204800,"MiniMax-M2.1":204800,"MiniMax-M2.1-highspeed":204800,"minimax-m2.7":204800,"minimax-m2.7-highspeed":204800,"minimax-m2.5":204800,"minimax-m2.5-highspeed":204800,"minimax-m2.1":204800,"minimax-m2.1-highspeed":204800,"MiniMax-Text-01":524288,"MiniMax-Text-01-Preview":262144,"MiniMax-Vision-01":32768,"MiniMax-Vision-01-Fast":16384,"MiniMax-M2":204800,"google/gemini-2.0-flash":1048576,"google/gemini-2.5-pro":1048576,"gemini-2.0-flash":1048576,"gemini-2.5-pro":1048576,"gemini-2.5-flash":1048576,"gemini-3.1-pro":1048576,"gemini-3.1-flash-lite-preview":1048576,"llama3.3:70b":128000,"llama3.1:8b":128000,"llama3.2:3b":128000,"qwen2.5-coder:32b":32768,"qwen2.5-coder:7b":32768,"deepseek-coder-v2:16b":163840,"deepseek-r1:14b":65536,"mistral:7b":32768,"phi4:14b":16384,"gemma2:27b":8192,"codellama:13b":16384,"llama3.2:1b":128000,"qwen3:8b":128000,codestral:32768,"qwen3.6-plus":1e6,"qwen3.5-plus":1e6,"qwen3-coder-plus":1e6,"qwen3-coder-next":262144,"qwen3-max":262144,"qwen3-max-2026-01-23":262144,"kimi-k2.5":262144,"glm-5":202752,"glm-4.7":202752,"kimi-for-coding":262144,"kimi-k2.6":262144,"kimi-k2":131072,"kimi-k2-instruct":131072,"kimi-k2-thinking":262144,"moonshot-v1-8k":8192,"moonshot-v1-32k":32768,"moonshot-v1-128k":131072},U8={"github:copilot":16384,"github:copilot:claude-haiku-4.5":32768,"github:copilot:claude-sonnet-4.6":32000,"github:copilot:claude-opus-4.7":32000,"github:copilot:gpt-4.1":16384,"github:copilot:gpt-4o":16384,"github:copilot:gpt-5-mini":64000,"github:copilot:gpt-5.2-codex":128000,"github:copilot:gpt-5.4":128000,"github:copilot:gpt-5.5":128000,"github:copilot:gemini-3.1-pro-preview":64000,"github:copilot:grok-code-fast-1":64000,"github_copilot/claude-haiku-4.5":32768,"github_copilot/claude-sonnet-4.6":32000,"github_copilot/claude-opus-4.7":32000,"github_copilot/gpt-4.1":16384,"github_copilot/gpt-4o":16384,"github_copilot/gpt-5-mini":64000,"github_copilot/gpt-5.2-codex":128000,"github_copilot/gpt-5.4":128000,"github_copilot/gpt-5.5":128000,"github_copilot/gemini-3.1-pro-preview":64000,"github_copilot/grok-code-fast-1":64000,"gpt-5.5":128000,"gpt-5.5-mini":128000,"gpt-5.5-nano":128000,"gpt-5.4":128000,"gpt-5.4-mini":128000,"gpt-5.4-nano":128000,"gpt-4o":16384,"gpt-4o-mini":16384,"gpt-4.1":32768,"gpt-4.1-mini":32768,"gpt-4.1-nano":32768,"gpt-4-turbo":4096,"gpt-4":4096,o1:1e5,"o1-mini":65536,"o1-preview":32768,"o1-pro":1e5,o3:1e5,"o3-mini":1e5,"o4-mini":1e5,"deepseek-v4-flash":262144,"deepseek-v4-pro":262144,"deepseek-chat":8192,"deepseek-reasoner":65536,"llama-3.3-70b-versatile":32768,"llama-3.1-8b-instant":8192,"mixtral-8x7b-32768":32768,"mistral-large-latest":32768,"mistral-small-latest":32768,"MiniMax-M2.7":131072,"MiniMax-M2.7-highspeed":131072,"MiniMax-M2.5":131072,"MiniMax-M2.5-highspeed":131072,"MiniMax-M2.1":131072,"MiniMax-M2.1-highspeed":131072,"minimax-m2.7":131072,"minimax-m2.7-highspeed":131072,"minimax-m2.5":131072,"minimax-m2.5-highspeed":131072,"minimax-m2.1":131072,"minimax-m2.1-highspeed":131072,"MiniMax-M2":131072,"MiniMax-Text-01":65536,"MiniMax-Text-01-Preview":65536,"MiniMax-Vision-01":16384,"MiniMax-Vision-01-Fast":16384,"google/gemini-2.0-flash":8192,"google/gemini-2.5-pro":65536,"gemini-2.0-flash":8192,"gemini-2.5-pro":65536,"gemini-2.5-flash":65536,"gemini-3.1-pro":65536,"gemini-3.1-flash-lite-preview":65536,"llama3.3:70b":4096,"llama3.1:8b":4096,"llama3.2:3b":4096,"qwen2.5-coder:32b":8192,"qwen2.5-coder:7b":8192,"deepseek-coder-v2:16b":8192,"deepseek-r1:14b":8192,"mistral:7b":4096,"phi4:14b":4096,"gemma2:27b":4096,"codellama:13b":4096,"llama3.2:1b":4096,"qwen3:8b":8192,codestral:8192,"nvidia/llama-3.1-nemotron-70b-instruct":32768,"nvidia/nemotron-mini-4b-instruct":8192,"meta/llama-3.1-405b-instruct":32768,"meta/llama-3.1-70b-instruct":32768,"meta/llama-3.2-90b-instruct":32768,"meta/llama-3.3-70b-instruct":32768,"google/gemma-2-27b-it":4096,"google/gemma-3-27b-it":16384,"google/gemma-3-12b-it":16384,"deepseek-ai/deepseek-r1":32768,"deepseek-ai/deepseek-v3":32768,"deepseek-ai/deepseek-v3.2":32768,"qwen/qwen3-32b":32768,"qwen/qwen2.5-7b-instruct":8192,"mistralai/mistral-large-3-675b-instruct-2512":32768,"mistralai/mixtral-8x7b-instruct-v0.1":8192,"microsoft/phi-4-mini-instruct":4096,"microsoft/phi-3.5-mini-instruct":4096,"ibm/granite-3.3-8b-instruct":4096,"z-ai/glm5":32768,"moonshotai/kimi-k2.5":32768,"databricks/dbrx-instruct":32768,"ai21labs/jamba-1.5-large-instruct":32768,"01-ai/yi-large":8192,"qwen3.6-plus":65536,"qwen3.5-plus":65536,"qwen3-coder-plus":65536,"qwen3-coder-next":65536,"qwen3-max":32768,"qwen3-max-2026-01-23":32768,"kimi-k2.5":32768,"glm-5":16384,"glm-4.7":16384,"kimi-for-coding":32768,"kimi-k2.6":32768,"kimi-k2":32768,"kimi-k2-instruct":32768,"kimi-k2-thinking":32768,"moonshot-v1-8k":4096,"moonshot-v1-32k":16384,"moonshot-v1-128k":32768},N8=(()=>{try{let Z=process.env.CLAUDE_CODE_OPENAI_CONTEXT_WINDOWS;if(Z){let $=JSON.parse(Z);if(typeof $==="object"&&$!==null)return $}}catch{}return{}})(),b8=(()=>{try{let Z=process.env.CLAUDE_CODE_OPENAI_MAX_OUTPUT_TOKENS;if(Z){let $=JSON.parse(Z);if(typeof $==="object"&&$!==null)return $}}catch{}return{}})()});function f1(){let Z=P()?.transport;return Z==="openai_compat"||Z==="gemini"||Z==="mistral"||Z==="github_copilot"||Z==="codex_responses"}function w0(){return L(process.env.CLAUDE_CODE_DISABLE_1M_CONTEXT)}function t(Z){if(w0())return!1;return/\[1m\]/i.test(Z)}function m2(Z){if(w0())return!1;let $=O(Z);return $.includes("claude-sonnet-4")||$.includes("opus-4-6")||$.includes("opus-4-7")}function b$(Z,$){if(t(Z))return 1e6;if(f1()){let Q=M1(Z);if(Q!==void 0)return Q;return console.error(`[context] Warning: model "${Z}" not in context window table — using conservative 128k default. `+"Add it to src/utils/model/openaiContextWindows.ts for accurate compaction."),O8}let J=n2(Z);if(J?.max_input_tokens&&J.max_input_tokens>=1e5){if(J.max_input_tokens>i2&&w0())return i2;return J.max_input_tokens}if($?.includes(P0)&&m2(Z))return 1e6;if(k8(Z))return 1e6;return i2}function k8(Z){if(w0())return!1;if(t(Z))return!1;if(!O(Z).includes("sonnet-4-6"))return!1;return w().clientDataCache?.coral_reef_sonnet==="true"}function O$(Z,$){if(!Z)return{used:null,remaining:null};let J=Z.input_tokens+Z.cache_creation_input_tokens+Z.cache_read_input_tokens,Q=Math.round(J/$*100),X=Math.min(100,Math.max(0,Q));return{used:X,remaining:100-X}}function E8(Z){let $,J;if(f1()){let Y=h1(Z);if(Y!==void 0)return{default:Y,upperLimit:Y}}let Q=O(Z);if(Q.includes("opus-4-7")||Q.includes("opus-4-6"))$=64000,J=128000;else if(Q.includes("sonnet-4-6"))$=32000,J=128000;else if(Q.includes("opus-4-5")||Q.includes("sonnet-4")||Q.includes("haiku-4"))$=32000,J=64000;else if(Q.includes("opus-4-1")||Q.includes("opus-4"))$=32000,J=32000;else if(Q.includes("claude-3-opus"))$=4096,J=4096;else if(Q.includes("claude-3-sonnet"))$=8192,J=8192;else if(Q.includes("claude-3-haiku"))$=4096,J=4096;else if(Q.includes("3-5-sonnet")||Q.includes("3-5-haiku"))$=8192,J=8192;else if(Q.includes("3-7-sonnet"))$=32000,J=64000;else $=_8,J=P8;let X=n2(Z);if(X?.max_tokens&&X.max_tokens>=4096)J=X.max_tokens,$=Math.min($,J);return{default:$,upperLimit:J}}function _$(Z){return E8(Z).upperLimit-1}var i2=200000,O8,D$=20000,_8=32000,P8=64000,U$=8000,N$=64000;var c2=B(()=>{T2();U0();q0();g();j0();C1();A1();O8=(()=>{let Z=parseInt(process.env.CLAUDE_CODE_OPENAI_FALLBACK_CONTEXT_WINDOW??"",10);return!isNaN(Z)&&Z>0?Z:128000})()});var v8,u1;var g1=B(()=>{p0();r();v8=[{modelEnvVar:"ANTHROPIC_DEFAULT_OPUS_MODEL",capabilitiesEnvVar:"ANTHROPIC_DEFAULT_OPUS_MODEL_SUPPORTED_CAPABILITIES"},{modelEnvVar:"ANTHROPIC_DEFAULT_SONNET_MODEL",capabilitiesEnvVar:"ANTHROPIC_DEFAULT_SONNET_MODEL_SUPPORTED_CAPABILITIES"},{modelEnvVar:"ANTHROPIC_DEFAULT_HAIKU_MODEL",capabilitiesEnvVar:"ANTHROPIC_DEFAULT_HAIKU_MODEL_SUPPORTED_CAPABILITIES"}],u1=I((Z,$)=>{if(q()==="firstParty")return;let J=Z.toLowerCase();for(let Q of v8){let X=process.env[Q.modelEnvVar],Y=process.env[Q.capabilitiesEnvVar];if(!X||Y===void 0)continue;if(J!==X.toLowerCase())continue;return Y.toLowerCase().split(",").map((V)=>V.trim()).includes($)}return},(Z,$)=>`${Z.toLowerCase()}:${$}`)});function y8(Z){let $=[],J=[];for(let Q of Z)if(n1.includes(Q))$.push(Q);else J.push(Q);return{allowed:$,disallowed:J}}function c$(Z){if(!Z||Z.length===0)return;if(U()){console.warn("Warning: Custom betas are only available for API key users. Ignoring provided betas.");return}let{allowed:$,disallowed:J}=y8(Z);for(let Q of J)console.warn(`Warning: Beta header '${Q}' is not allowed. Only the following betas are supported: ${n1.join(", ")}`);return $.length>0?$:void 0}function p1(Z){let $=u1(Z,"interleaved_thinking");if($!==void 0)return $;let J=O(Z),Q=q();if(Q==="foundry")return!0;if(Q==="firstParty")return!J.includes("claude-3-");return J.includes("claude-opus-4")||J.includes("claude-sonnet-4")}function I8(Z){let $=O(Z);return $.includes("claude-opus-4")||$.includes("claude-sonnet-4")||$.includes("claude-haiku-4")}function C8(Z){let $=O(Z),J=q();if(J==="foundry")return!0;if(J==="firstParty")return!$.includes("claude-3-");return $.includes("claude-opus-4")||$.includes("claude-sonnet-4")||$.includes("claude-haiku-4")}function T8(Z){let $=O(Z),J=q();if(J!=="firstParty"&&J!=="foundry")return!1;return $.includes("claude-sonnet-4-6")||$.includes("claude-sonnet-4-5")||$.includes("claude-opus-4-1")||$.includes("claude-opus-4-5")||$.includes("claude-opus-4-6")||$.includes("claude-opus-4-7")||$.includes("claude-haiku-4-5")}function d$(Z){let $=O(Z);if(!$.startsWith("claude-"))return!1;if($.includes("claude-3-"))return!1;if(/claude-(opus|sonnet|haiku)-4(?!-[6-9])/.test($))return!1;return!0}function n$(){let Z=q();if(Z==="vertex"||Z==="bedrock")return s5;return a5}function m1(){return(q()==="firstParty"||q()==="foundry")&&!L(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function i$(){return q()==="firstParty"&&!L(process.env.CLAUDE_CODE_DISABLE_EXPERIMENTAL_BETAS)}function t$(Z,$){let J=[...i1(Z)];if($?.isAgenticQuery){if(!J.includes(o0))J.push(o0)}let Q=c1();if(!Q||Q.length===0)return J;return[...J,...Q.filter((X)=>!J.includes(X))]}function t1(){t2.cache?.clear?.(),i1.cache?.clear?.(),S8.cache?.clear?.()}var n1,t2,i1,S8;var l1=B(()=>{p0();J1();o();T2();O0();n();c2();g();j0();g1();r();V0();n1=[P0];t2=I((Z)=>{let $=[],J=O(Z).includes("haiku"),Q=q(),X=m1();if(!J)$.push(o0);if(U())$.push(W0);if(t(Z))$.push(P0);if(!L(process.env.DISABLE_INTERLEAVED_THINKING)&&p1(Z))$.push(i5);if(X&&p1(Z)&&!f()&&e().showThinkingSummaries!==!0)$.push(o5);let Y=C8(Z);if(m1()&&Y)$.push(t5);let V=d1("tengu_tool_pear"),W=!V&&(L(process.env.CLAUDE_CODE_JSON_TOOL_USE)||E0("tengu_amber_json_tools",!1));if(X&&T8(Z)&&V)$.push(l5);if(X&&W)$.push(e5);if(Q==="vertex"&&I8(Z))$.push(I2);if(Q==="foundry")$.push(I2);if(X)$.push(r5);if(process.env.ANTHROPIC_BETAS)$.push(...process.env.ANTHROPIC_BETAS.split(",").map((x)=>x.trim()).filter(Boolean));return $}),i1=I((Z)=>{let $=t2(Z);if(q()==="bedrock")return $.filter((J)=>!C2.has(J));return $}),S8=I((Z)=>{return t2(Z).filter((J)=>C2.has(J))})});import{execFile as M8}from"child_process";function a1(Z){return new Promise(($)=>{M8("security",["find-generic-password","-a",Y2(),"-w","-s",Z],{encoding:"utf-8",timeout:h8},(J,Q)=>{$({stdout:J?null:Q?.trim()||null,timedOut:Boolean(J&&"killed"in J&&J.killed)})})})}function o$(){if(process.platform!=="darwin"||X2||u())return;let Z=a1(i(s1)),$=a1(i());X2=Promise.all([Z,$]).then(([J,Q])=>{if(!J.timedOut)r1(J.stdout);if(!Q.timedOut)l2={stdout:Q.stdout}})}async function e$(){if(X2)await X2}function o1(){return l2}function a2(){l2=null}var h8=1e4,l2=null,X2=null;var e1=B(()=>{g();v2()});function s2(Z,$,J){return new Promise((Q,X)=>{if($?.aborted){if(J?.throwOnAbort||J?.abortError)X(J.abortError?.()??Error("aborted"));else Q();return}let Y=setTimeout((W,x,R)=>{W?.removeEventListener("abort",x),R()},Z,$,V,Q);function V(){if(clearTimeout(Y),J?.throwOnAbort||J?.abortError)X(J.abortError?.()??Error("aborted"));else Q()}if($?.addEventListener("abort",V,{once:!0}),J?.unref)Y.unref()})}var Z4=()=>{};function JJ(){return $4}function J4(){$4.clear()}var $4;var Q4=B(()=>{$4=new Map});var kZ={};A8(kZ,{validateForceLoginOrg:()=>PZ,saveOAuthTokensIfNeeded:()=>D4,saveApiKey:()=>x5,removeApiKey:()=>BZ,refreshGcpCredentialsIfNeeded:()=>G5,refreshGcpAuth:()=>L4,refreshAwsAuth:()=>w4,refreshAndGetAwsCredentials:()=>X0,prefetchGcpCredentialsIfSafe:()=>zZ,prefetchAwsCredentialsAndBedRockInfoIfSafe:()=>GZ,prefetchApiKeyFromApiKeyHelperIfSafe:()=>o8,isUsing3PServices:()=>z2,isTeamSubscriber:()=>KZ,isTeamPremiumSubscriber:()=>Q2,isProSubscriber:()=>d2,isOverageProvisioningAllowed:()=>FZ,isOtelHeadersHelperFromProjectOrLocalSettings:()=>O4,isMaxSubscriber:()=>J2,isGcpAuthRefreshFromProjectSettings:()=>z5,isEnterpriseSubscriber:()=>DZ,isCustomApiKeyApproved:()=>jZ,isConsumerSubscriber:()=>OZ,isClaudeAISubscriber:()=>U,isAwsCredentialExportFromProjectSettings:()=>q5,isAwsAuthRefreshFromProjectSettings:()=>Y5,isAnthropicAuthEnabled:()=>D0,is1PApiCustomer:()=>wZ,hasProfileScope:()=>J0,hasOpusAccess:()=>LZ,hasAnthropicApiKeyAuth:()=>l8,handleOAuth401Error:()=>h2,getSubscriptionType:()=>E,getSubscriptionName:()=>N4,getRateLimitTier:()=>U4,getOtelHeadersFromHelper:()=>NZ,getOauthAccountInfo:()=>W2,getConfiguredApiKeyHelper:()=>l,getClaudeAIOAuthTokensAsync:()=>h0,getClaudeAIOAuthTokens:()=>H,getAuthTokenSource:()=>b0,getApiKeyHelperElapsedMs:()=>a8,getApiKeyFromConfigOrMacOSKeychain:()=>x2,getApiKeyFromApiKeyHelperCached:()=>o2,getApiKeyFromApiKeyHelper:()=>R4,getAnthropicApiKeyWithSource:()=>f0,getAnthropicApiKey:()=>Z0,getAccountInformation:()=>_Z,clearOAuthTokenCache:()=>j5,clearGcpCredentialsCache:()=>WZ,clearAwsCredentialsCache:()=>QZ,clearApiKeyHelperCache:()=>r8,checkGcpCredentialsValid:()=>F4,checkAndRefreshOAuthTokenIfNeeded:()=>u0,calculateApiKeyHelperTTL:()=>H4});import{exec as j4}from"child_process";import{mkdir as d8,stat as n8}from"fs/promises";import{join as i8}from"path";function q2(){return L(process.env.CLAUDE_CODE_REMOTE)||process.env.CLAUDE_CODE_ENTRYPOINT==="claude-desktop"}function D0(){if(u())return!1;if(process.env.ANTHROPIC_UNIX_SOCKET)return!!process.env.CLAUDE_CODE_OAUTH_TOKEN;let Z=z2(),J=(T()||{}).apiKeyHelper,Q=process.env.ANTHROPIC_AUTH_TOKEN||J||process.env.CLAUDE_CODE_API_KEY_FILE_DESCRIPTOR,X;try{({source:X}=f0({skipRetrievingKeyFromApiKeyHelper:!0}))}catch{X="none"}let Y=X==="ANTHROPIC_API_KEY"||X==="apiKeyHelper";return!(Z||Q&&!q2()||Y&&!q2())}function b0(){if(u()){if(l())return{source:"apiKeyHelper",hasToken:!0};return{source:"none",hasToken:!1}}if(process.env.ANTHROPIC_AUTH_TOKEN&&!q2())return{source:"ANTHROPIC_AUTH_TOKEN",hasToken:!0};if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{source:"CLAUDE_CODE_OAUTH_TOKEN",hasToken:!0};if(s0()){if(process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)return{source:"CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",hasToken:!0};return{source:"CCR_OAUTH_TOKEN_FILE",hasToken:!0}}if(l()&&!q2())return{source:"apiKeyHelper",hasToken:!0};let J=H();if(K0(J?.scopes)&&J?.accessToken)return{source:"claude.ai",hasToken:!0};return{source:"none",hasToken:!1}}function Z0(){let{key:Z}=f0();return Z}function l8(){try{let{key:Z,source:$}=f0({skipRetrievingKeyFromApiKeyHelper:!0});return Z!==null&&$!=="none"}catch{return!1}}function f0(Z={}){let $=(()=>{let V=P();if(V?.transport!=="anthropic")return;let W=V.apiKey?.trim();return W&&W.length>0?W:void 0})();if(u()){if($)return{key:$,source:"ANTHROPIC_API_KEY"};if(l())return{key:Z.skipRetrievingKeyFromApiKeyHelper?null:o2(),source:"apiKeyHelper"};return{key:null,source:"none"}}let J=q4()?void 0:$;if(e0()&&J)return{key:J,source:"ANTHROPIC_API_KEY"};if(L(process.env.CI)){let V=E2();if(V)return{key:V,source:"ANTHROPIC_API_KEY"};if(!z2()&&!J&&!process.env.CLAUDE_CODE_OAUTH_TOKEN&&!process.env.CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR)throw Error("Configure an Anthropic profile via /provider or set CLAUDE_CODE_OAUTH_TOKEN");if(J&&!z2())return{key:J,source:"ANTHROPIC_API_KEY"};return{key:null,source:"none"}}if(J&&w().customApiKeyResponses?.approved?.includes(r0(J)))return{key:J,source:"ANTHROPIC_API_KEY"};let Q=E2();if(Q)return{key:Q,source:"ANTHROPIC_API_KEY"};if(l()){if(Z.skipRetrievingKeyFromApiKeyHelper)return{key:null,source:"apiKeyHelper"};return{key:o2(),source:"apiKeyHelper"}}let Y=x2();if(Y)return Y;return{key:null,source:"none"}}function l(){if(u())return b("flagSettings")?.apiKeyHelper;return(T()||{}).apiKeyHelper}function B4(){let Z=l();if(!Z)return!1;let $=b("projectSettings"),J=b("localSettings");return $?.apiKeyHelper===Z||J?.apiKeyHelper===Z}function X5(){return(T()||{}).awsAuthRefresh}function Y5(){let Z=X5();if(!Z)return!1;let $=b("projectSettings"),J=b("localSettings");return $?.awsAuthRefresh===Z||J?.awsAuthRefresh===Z}function V5(){return(T()||{}).awsCredentialExport}function q5(){let Z=V5();if(!Z)return!1;let $=b("projectSettings"),J=b("localSettings");return $?.awsCredentialExport===Z||J?.awsCredentialExport===Z}function H4(){let Z=process.env.CLAUDE_CODE_API_KEY_HELPER_TTL_MS;if(Z){let $=parseInt(Z,10);if(!Number.isNaN($)&&$>=0)return $;z(`Found CLAUDE_CODE_API_KEY_HELPER_TTL_MS env var, but it was not a valid number. Got ${Z}`,{level:"error"})}return t8}function a8(){let Z=c?.startedAt;return Z?Date.now()-Z:0}async function R4(Z){if(!l())return null;let $=H4();if(y){if(Date.now()-y.timestamp<$)return y.value;if(!c)c={promise:X4(Z,!1,L0),startedAt:null};return y.value}if(c)return c.promise;return c={promise:X4(Z,!0,L0),startedAt:Date.now()},c.promise}async function X4(Z,$,J){try{let Q=await s8(Z);if(J!==L0)return Q;if(Q!==null)y={value:Q,timestamp:Date.now()};return Q}catch(Q){if(J!==L0)return" ";let X=Q instanceof Error?Q.message:String(Q);if(console.error(A.red(`apiKeyHelper failed: ${X}`)),z(`Error getting API key from apiKeyHelper: ${X}`,{level:"error"}),!$&&y&&y.value!==" ")return y={...y,timestamp:Date.now()},y.value;return y={value:" ",timestamp:Date.now()}," "}finally{if(J===L0)c=null}}async function s8(Z){let $=l();if(!$)return null;if(B4()){if(!d()&&!Z){let Y=Error(`Security: apiKeyHelper executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return A0("apiKeyHelper invoked before trust check",Y),G("tengu_apiKeyHelper_missing_trust11",{}),null}}let J=await G0($,{shell:!0,timeout:600000,reject:!1});if(J.failed){let X=J.timedOut?"timed out":`exited ${J.exitCode}`,Y=J.stderr?.trim();throw Error(Y?`${X}: ${Y}`:X)}let Q=J.stdout?.trim();if(!Q)throw Error("did not return a value");return Q}function o2(){return y?.value??null}function r8(){L0++,y=null,c=null}function o8(Z){if(B4()&&!d())return;R4(Z)}async function ZZ(){let Z=X5();if(!Z)return!1;if(Y5()){if(!d()&&!f()){let J=Error(`Security: awsAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return A0("awsAuthRefresh invoked before trust check",J),G("tengu_awsAuthRefresh_missing_trust",{}),!1}}try{return z("Fetching AWS caller identity for AWS auth refresh command"),await y2(),z("Fetched AWS caller identity, skipping AWS auth refresh command"),!1}catch{return w4(Z)}}function w4(Z){z("Running AWS auth refresh command");let $=S.getInstance();return $.startAuthentication(),new Promise((J)=>{let Q=j4(Z,{timeout:$Z});Q.stdout.on("data",(X)=>{let Y=X.toString().trim();if(Y)$.addOutput(Y),z(Y,{level:"debug"})}),Q.stderr.on("data",(X)=>{let Y=X.toString().trim();if(Y)$.setError(Y),z(Y,{level:"error"})}),Q.on("close",(X,Y)=>{if(X===0)z("AWS auth refresh completed successfully"),$.endAuthentication(!0),J(!0);else{let W=Y==="SIGTERM"?A.red("AWS auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal."):A.red("Error running awsAuthRefresh (in settings or ~/.claudio/config.json):");console.error(W),$.endAuthentication(!1),J(!1)}})})}async function JZ(){let Z=V5();if(!Z)return null;if(q5()){if(!d()&&!f()){let J=Error(`Security: awsCredentialExport executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return A0("awsCredentialExport invoked before trust check",J),G("tengu_awsCredentialExport_missing_trust",{}),null}}try{return z("Fetching AWS caller identity for credential export command"),await y2(),z("Fetched AWS caller identity, skipping AWS credential export command"),null}catch{try{z("Running AWS credential export command");let $=await G0(Z,{shell:!0,reject:!1});if($.exitCode!==0||!$.stdout)throw Error("awsCredentialExport did not return a valid value");let J=$5($.stdout.trim());if(!p5(J))throw Error("awsCredentialExport did not return valid AWS STS output structure");return z("AWS credentials retrieved from awsCredentialExport"),{accessKeyId:J.Credentials.AccessKeyId,secretAccessKey:J.Credentials.SecretAccessKey,sessionToken:J.Credentials.SessionToken}}catch($){let J=A.red("Error getting AWS credentials from awsCredentialExport (in settings or ~/.claudio/config.json):");if($ instanceof Error)console.error(J,$.message);else console.error(J,$);return null}}}function QZ(){X0.cache.clear()}function W5(){return(T()||{}).gcpAuthRefresh}function z5(){let Z=W5();if(!Z)return!1;let $=b("projectSettings"),J=b("localSettings");return $?.gcpAuthRefresh===Z||J?.gcpAuthRefresh===Z}async function F4(){try{let{GoogleAuth:Z}=await import("google-auth-library"),$=new Z({scopes:["https://www.googleapis.com/auth/cloud-platform"]}),J=(async()=>{await(await $.getClient()).getAccessToken()})(),Q=s2(XZ).then(()=>{throw new _4("GCP credentials check timed out")});return await Promise.race([J,Q]),!0}catch{return!1}}async function VZ(){let Z=W5();if(!Z)return!1;if(z5()){if(!d()&&!f()){let J=Error(`Security: gcpAuthRefresh executed before workspace trust is confirmed. If you see this message, post in ${MACRO.FEEDBACK_CHANNEL}.`);return A0("gcpAuthRefresh invoked before trust check",J),G("tengu_gcpAuthRefresh_missing_trust",{}),!1}}try{if(z("Checking GCP credentials validity for auth refresh"),await F4())return z("GCP credentials are valid, skipping auth refresh command"),!1}catch{}return L4(Z)}function L4(Z){z("Running GCP auth refresh command");let $=S.getInstance();return $.startAuthentication(),new Promise((J)=>{let Q=j4(Z,{timeout:qZ});Q.stdout.on("data",(X)=>{let Y=X.toString().trim();if(Y)$.addOutput(Y),z(Y,{level:"debug"})}),Q.stderr.on("data",(X)=>{let Y=X.toString().trim();if(Y)$.setError(Y),z(Y,{level:"error"})}),Q.on("close",(X,Y)=>{if(X===0)z("GCP auth refresh completed successfully"),$.endAuthentication(!0),J(!0);else{let W=Y==="SIGTERM"?A.red("GCP auth refresh timed out after 3 minutes. Run your auth command manually in a separate terminal."):A.red("Error running gcpAuthRefresh (in settings or ~/.claudio/config.json):");console.error(W),$.endAuthentication(!1),J(!1)}})})}function WZ(){G5.cache.clear()}function zZ(){if(!W5())return;if(z5()){if(!d()&&!f())return}G5()}function GZ(){let Z=X5(),$=V5();if(!Z&&!$)return;if(Y5()||q5()){if(!d()&&!f())return}X0(),j()}function xZ(Z){return/^[a-zA-Z0-9-_]+$/.test(Z)}async function x5(Z){if(!xZ(Z))throw Error("Invalid API key format. API key must contain only alphanumeric characters, dashes, and underscores.");await K4();let $=!1;if(process.platform==="darwin")try{let Q=i(),X=Y2(),Y=Buffer.from(Z,"utf-8").toString("hex"),V=`add-generic-password -U -a "${X}" -s "${Q}" -X "${Y}"
2
+ `;await G0("security",["-i"],{input:V,reject:!1}),G("tengu_api_key_saved_to_keychain",{}),$=!0}catch(Q){K(Q),G("tengu_api_key_keychain_error",{error:p(Q)}),G("tengu_api_key_saved_to_config",{})}else G("tengu_api_key_saved_to_config",{});let J=r0(Z);M((Q)=>{let X=Q.customApiKeyResponses?.approved??[];return{...Q,primaryApiKey:$?Q.primaryApiKey:Z,customApiKeyResponses:{...Q.customApiKeyResponses,approved:X.includes(J)?X:[...X,J],rejected:Q.customApiKeyResponses?.rejected??[]}}}),x2.cache.clear?.(),a2()}function jZ(Z){let $=w(),J=r0(Z);return $.customApiKeyResponses?.approved?.includes(J)??!1}async function BZ(){await K4(),M((Z)=>({...Z,primaryApiKey:void 0})),x2.cache.clear?.(),a2()}async function K4(){try{await u5()}catch(Z){K(Z)}}function D4(Z){if(!K0(Z.scopes))return G("tengu_oauth_tokens_not_claude_ai",{}),{success:!0};if(!Z.refreshToken||!Z.expiresAt)return G("tengu_oauth_tokens_inference_only",{}),{success:!0};let $=G2(),J=$.name;try{let Q=$.read()||{},X=Q.claudeAiOauth;Q.claudeAiOauth={accessToken:Z.accessToken,refreshToken:Z.refreshToken,expiresAt:Z.expiresAt,scopes:Z.scopes,subscriptionType:Z.subscriptionType??X?.subscriptionType??null,rateLimitTier:Z.rateLimitTier??X?.rateLimitTier??null};let Y=$.update(Q);if(Y.success)G("tengu_oauth_tokens_saved",{storageBackend:J});else G("tengu_oauth_tokens_save_failed",{storageBackend:J});return H.cache?.clear?.(),t1(),J4(),Y}catch(Q){return K(Q),G("tengu_oauth_tokens_save_exception",{storageBackend:J,error:p(Q)}),{success:!1,warning:"Failed to save OAuth tokens"}}}function j5(){H.cache?.clear?.(),F0()}async function HZ(){try{let{mtimeMs:Z}=await n8(i8(Z5(),".credentials.json"));if(Z!==Y4)Y4=Z,j5()}catch{H.cache?.clear?.()}}function h2(Z){let $=r2.get(Z);if($)return $;let J=RZ(Z).finally(()=>{r2.delete(Z)});return r2.set(Z,J),J}async function RZ(Z){j5();let $=await h0();if(!$?.refreshToken)return!1;if($.accessToken!==Z)return G("tengu_oauth_401_recovered_from_keychain",{}),!0;return u0(0,!0)}async function h0(){if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN||s0())return H();try{let J=(await G2().readAsync())?.claudeAiOauth;if(!J?.accessToken)return null;return J}catch(Z){return K(Z),null}}function u0(Z=0,$=!1){if(Z===0&&!$){if(S0)return S0;return S0=e2(Z,$).finally(()=>{S0=null}),S0}return e2(Z,$)}async function e2(Z,$){await HZ();let Q=H();if(!$){if(!Q?.refreshToken||!M0(Q.expiresAt))return!1}if(!Q?.refreshToken)return!1;if(!K0(Q.scopes))return!1;H.cache?.clear?.(),F0();let X=await h0();if(!X?.refreshToken||!M0(X.expiresAt))return!1;let Y=Z5();await d8(Y,{recursive:!0});let V;try{G("tengu_oauth_token_refresh_lock_acquiring",{}),V=await z4(Y),G("tengu_oauth_token_refresh_lock_acquired",{})}catch(W){if(W.code==="ELOCKED"){if(Z<5)return G("tengu_oauth_token_refresh_lock_retry",{retryCount:Z+1}),await s2(1000+Math.random()*1000),e2(Z+1,$);return G("tengu_oauth_token_refresh_lock_retry_limit_reached",{maxRetries:5}),!1}return K(W),G("tengu_oauth_token_refresh_lock_error",{error:p(W)}),!1}try{H.cache?.clear?.(),F0();let W=await h0();if(!W?.refreshToken||!M0(W.expiresAt))return G("tengu_oauth_token_refresh_race_resolved",{}),!1;G("tengu_oauth_token_refresh_starting",{});let x=await G4(W.refreshToken,{scopes:K0(W.scopes)?void 0:W.scopes});return D4(x),H.cache?.clear?.(),F0(),!0}catch(W){K(W),H.cache?.clear?.(),F0();let x=await h0();if(x&&!M0(x.expiresAt))return G("tengu_oauth_token_refresh_race_recovered",{}),!0;return!1}finally{G("tengu_oauth_token_refresh_lock_releasing",{}),await V(),G("tengu_oauth_token_refresh_lock_released",{})}}function U(){if(!D0())return!1;return K0(H()?.scopes)}function J0(){return H()?.scopes?.includes(W4)??!1}function wZ(){{let Z=P()?.transport;if(Z==="bedrock"||Z==="vertex"||Z==="foundry")return!1}if(U())return!1;return!0}function W2(){return D0()?w().oauthAccount:void 0}function FZ(){let $=W2()?.billingType;if(!U()||!$)return!1;if($!=="stripe_subscription"&&$!=="stripe_subscription_contracted"&&$!=="apple_subscription"&&$!=="google_play_subscription")return!1;return!0}function LZ(){let Z=E();return Z==="max"||Z==="enterprise"||Z==="team"||Z==="pro"||Z===null}function E(){if(k5())return P5();if(!D0())return null;let Z=H();if(!Z)return null;return Z.subscriptionType??null}function J2(){return E()==="max"}function KZ(){return E()==="team"}function Q2(){return E()==="team"&&U4()==="default_claude_max_5x"}function DZ(){return E()==="enterprise"}function d2(){return E()==="pro"}function U4(){if(!D0())return null;let Z=H();if(!Z)return null;return Z.rateLimitTier??null}function N4(){switch(E()){case"enterprise":return"Claude Enterprise";case"team":return"Claude Team";case"max":return"Claude Max";case"pro":return"Claude Pro";default:return"Claude API"}}function z2(){let Z=P()?.transport;if(!Z)return!1;return Z!=="anthropic"}function b4(){return(T()||{}).otelHeadersHelper}function O4(){let Z=b4();if(!Z)return!1;let $=b("projectSettings"),J=b("localSettings");return $?.otelHeadersHelper===Z||J?.otelHeadersHelper===Z}function NZ(){let Z=b4();if(!Z)return{};let $=parseInt(process.env.CLAUDE_CODE_OTEL_HEADERS_HELPER_DEBOUNCE_MS||UZ.toString());if(V2&&Date.now()-V4<$)return V2;if(O4()){if(!d())return{}}try{let J=J5(Z,{timeout:30000})?.toString().trim();if(!J)throw Error("otelHeadersHelper did not return a valid value");let Q=$5(J);if(typeof Q!=="object"||Q===null||Array.isArray(Q))throw Error("otelHeadersHelper must return a JSON object with string key-value pairs");for(let[X,Y]of Object.entries(Q))if(typeof Y!=="string")throw Error(`otelHeadersHelper returned non-string value for key "${X}": ${typeof Y}`);return V2=Q,V4=Date.now(),V2}catch(J){throw K(Error(`Error getting OpenTelemetry headers from otelHeadersHelper (in settings): ${p(J)}`)),J}}function bZ(Z){return Z==="max"||Z==="pro"}function OZ(){let Z=E();return U()&&Z!==null&&bZ(Z)}function _Z(){if(q()!=="firstParty")return;let{source:$}=b0(),J={};if($==="CLAUDE_CODE_OAUTH_TOKEN"||$==="CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR")J.tokenSource=$;else if(U())J.subscription=N4();else J.tokenSource=$;let{key:Q,source:X}=f0();if(Q)J.apiKeySource=X;if($==="claude.ai"||X==="/login managed key"){let V=W2()?.organizationName;if(V)J.organization=V}let Y=W2()?.emailAddress;if(($==="claude.ai"||X==="/login managed key")&&Y)J.email=Y;return J}async function PZ(){if(process.env.ANTHROPIC_UNIX_SOCKET)return{valid:!0};if(!D0())return{valid:!0};let Z=b("policySettings")?.forceLoginOrgUUID;if(!Z)return{valid:!0};await u0();let $=H();if(!$)return{valid:!0};let{source:J}=b0(),Q=J==="CLAUDE_CODE_OAUTH_TOKEN"||J==="CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR",X=await z0($.accessToken);if(!X)return{valid:!1,message:`Unable to verify organization for the current authentication token.
3
+ This machine requires organization ${Z} but the profile could not be fetched.
4
+ This may be a network error, or the token may lack the user:profile scope required for
5
+ verification (tokens from 'claude setup-token' do not include this scope).
6
+ Try again, or obtain a full-scope token via 'claude auth login'.`};let Y=X.organization.uuid;if(Y===Z)return{valid:!0};if(Q)return{valid:!1,message:`The ${J==="CLAUDE_CODE_OAUTH_TOKEN"?"CLAUDE_CODE_OAUTH_TOKEN":"CLAUDE_CODE_OAUTH_TOKEN_FILE_DESCRIPTOR"} environment variable provides a token for a
7
+ different organization than required by this machine's managed settings.
8
+
9
+ Required organization: ${Z}
10
+ Token organization: ${Y}
11
+
12
+ Remove the environment variable or obtain a token for the correct organization.`};return{valid:!1,message:`Your authentication token belongs to organization ${Y},
13
+ but this machine requires organization ${Z}.
14
+
15
+ Please log in with the correct organization: claude auth login`}}var t8=300000,y=null,c=null,L0=0,e8=3600000,$Z=180000,X0,XZ=5000,YZ=3600000,qZ=180000,G5,x2,H,Y4=0,r2,S0=null,V2=null,V4=0,UZ=1740000,_4;var n=B(()=>{c8();f5();p0();O0();Z2();l0();r();o();U0();E5();x4();P2();A5();g5();c5();n5();l1();q0();_0();g();M5();u8();p8();m0();g8();m8();e1();v2();V0();Z4();f8();Q4();X0=Q5(async()=>{let Z=await ZZ(),$=await JZ();if(Z||$)await m5();return $},e8);G5=Q5(async()=>{return await VZ()},YZ);x2=I(()=>{if(u())return null;if(process.platform==="darwin"){let $=o1();if($){if($.stdout)return{key:$.stdout,source:"/login managed key"}}else{let J=i();try{let Q=J5(`security find-generic-password -a $USER -w -s "${J}"`);if(Q)return{key:Q,source:"/login managed key"}}catch(Q){K(Q)}}}let Z=w();if(!Z.primaryApiKey)return null;return{key:Z.primaryApiKey,source:"/login managed key"}});H=I(()=>{if(u())return null;if(process.env.CLAUDE_CODE_OAUTH_TOKEN)return{accessToken:process.env.CLAUDE_CODE_OAUTH_TOKEN,refreshToken:null,expiresAt:null,scopes:["user:inference"],subscriptionType:null,rateLimitTier:null};let Z=s0();if(Z)return{accessToken:Z,refreshToken:null,expiresAt:null,scopes:["user:inference"],subscriptionType:null,rateLimitTier:null};try{let Q=G2().read()?.claudeAiOauth;if(!Q?.accessToken)return null;return Q}catch($){return K($),null}});r2=new Map;_4=class _4 extends Error{}});function K0(Z){return Boolean(Z?.includes(B5))}function EZ(Z){return Z?.split(" ").filter(Boolean)??[]}function iJ({codeChallenge:Z,state:$,port:J,isManual:Q,loginWithClaudeAi:X,inferenceOnly:Y,orgUUID:V,loginHint:W,loginMethod:x}){let R=X?D().CLAUDE_AI_AUTHORIZE_URL:D().CONSOLE_AUTHORIZE_URL,F=new URL(R);F.searchParams.append("code","true"),F.searchParams.append("client_id",D().CLIENT_ID),F.searchParams.append("response_type","code"),F.searchParams.append("redirect_uri",Q?D().MANUAL_REDIRECT_URL:`http://localhost:${J}/callback`);let Q0=Y?[B5]:E4;if(F.searchParams.append("scope",Q0.join(" ")),F.searchParams.append("code_challenge",Z),F.searchParams.append("code_challenge_method","S256"),F.searchParams.append("state",$),V)F.searchParams.append("orgUUID",V);if(W)F.searchParams.append("login_hint",W);if(x)F.searchParams.append("login_method",x);return F.toString()}async function tJ(Z,$,J,Q,X=!1,Y){let V={grant_type:"authorization_code",code:Z,redirect_uri:X?D().MANUAL_REDIRECT_URL:`http://localhost:${Q}/callback`,client_id:D().CLIENT_ID,code_verifier:J,state:$};if(Y!==void 0)V.expires_in=Y;let W=await v.post(D().TOKEN_URL,V,{headers:{"Content-Type":"application/json"},timeout:15000});if(W.status!==200)throw Error(W.status===401?"Authentication failed: Invalid authorization code":`Token exchange failed (${W.status}): ${W.statusText}`);return G("tengu_oauth_token_exchange_success",{}),W.data}async function G4(Z,{scopes:$}={}){let J={grant_type:"refresh_token",refresh_token:Z,client_id:D().CLIENT_ID,scope:(($?.length)?$:k4).join(" ")};try{let Q=await v.post(D().TOKEN_URL,J,{headers:{"Content-Type":"application/json"},timeout:15000});if(Q.status!==200)throw Error(`Token refresh failed: ${Q.statusText}`);let X=Q.data,{access_token:Y,refresh_token:V=Z,expires_in:W}=X,x=Date.now()+W*1000,R=EZ(X.scope);G("tengu_oauth_token_refresh_success",{});let F=w(),Q0=H(),_=F.oauthAccount?.billingType!==void 0&&F.oauthAccount?.accountCreatedAt!==void 0&&F.oauthAccount?.subscriptionCreatedAt!==void 0&&Q0?.subscriptionType!=null&&Q0?.rateLimitTier!=null?null:await vZ(Y);if(_&&F.oauthAccount){let a={};if(_.displayName!==void 0)a.displayName=_.displayName;if(typeof _.hasExtraUsageEnabled==="boolean")a.hasExtraUsageEnabled=_.hasExtraUsageEnabled;if(_.billingType!==null)a.billingType=_.billingType;if(_.accountCreatedAt!==void 0)a.accountCreatedAt=_.accountCreatedAt;if(_.subscriptionCreatedAt!==void 0)a.subscriptionCreatedAt=_.subscriptionCreatedAt;if(Object.keys(a).length>0)M((g0)=>({...g0,oauthAccount:g0.oauthAccount?{...g0.oauthAccount,...a}:g0.oauthAccount}))}return{accessToken:Y,refreshToken:V,expiresAt:x,scopes:R,subscriptionType:_?.subscriptionType??Q0?.subscriptionType??null,rateLimitTier:_?.rateLimitTier??Q0?.rateLimitTier??null,profile:_?.rawProfile,tokenAccount:X.account?{uuid:X.account.uuid,emailAddress:X.account.email_address,organizationUuid:X.organization?.uuid}:void 0}}catch(Q){let X=v.isAxiosError(Q)&&Q.response?.data?JSON.stringify(Q.response.data):void 0;throw G("tengu_oauth_token_refresh_failure",{error:Q.message,...X&&{responseBody:X}}),Q}}async function lJ(Z){let $=await v.get(D().ROLES_URL,{headers:{Authorization:`Bearer ${Z}`}});if($.status!==200)throw Error(`Failed to fetch user roles: ${$.statusText}`);let J=$.data;if(!w().oauthAccount)throw Error("OAuth account information not found in config");M((X)=>({...X,oauthAccount:X.oauthAccount?{...X.oauthAccount,organizationRole:J.organization_role,workspaceRole:J.workspace_role,organizationName:J.organization_name}:X.oauthAccount})),G("tengu_oauth_roles_stored",{org_role:J.organization_role})}async function aJ(Z){try{let $=await v.post(D().API_KEY_URL,null,{headers:{Authorization:`Bearer ${Z}`}}),J=$.data?.raw_key;if(J)return await x5(J),G("tengu_oauth_api_key",{status:"success",statusCode:$.status}),J;return null}catch($){throw G("tengu_oauth_api_key",{status:"failure",error:$ instanceof Error?$.message:String($)}),$}}function M0(Z){if(Z===null)return!1;let $=300000;return Date.now()+$>=Z}async function vZ(Z){let $=await z0(Z),J=$?.organization?.organization_type,Q=null;switch(J){case"claude_max":Q="max";break;case"claude_pro":Q="pro";break;case"claude_enterprise":Q="enterprise";break;case"claude_team":Q="team";break;default:Q=null;break}let X={subscriptionType:Q,rateLimitTier:$?.organization?.rate_limit_tier??null,hasExtraUsageEnabled:$?.organization?.has_extra_usage_enabled??null,billingType:$?.organization?.billing_type??null};if($?.account?.display_name)X.displayName=$.account.display_name;if($?.account?.created_at)X.accountCreatedAt=$.account.created_at;if($?.organization?.subscription_created_at)X.subscriptionCreatedAt=$.organization.subscription_created_at;return G("tengu_oauth_profile_fetch_success",{}),{...X,rawProfile:$}}async function sJ(){let $=w().oauthAccount?.organizationUuid;if($)return $;let J=H()?.accessToken;if(J===void 0||!J0())return null;let X=(await z0(J))?.organization?.uuid;if(!X)return null;return X}async function rJ(){let Z=process.env.CLAUDE_CODE_ACCOUNT_UUID,$=process.env.CLAUDE_CODE_USER_EMAIL,J=process.env.CLAUDE_CODE_ORGANIZATION_UUID,Q=Boolean(Z&&$&&J);if(Z&&$&&J){if(!w().oauthAccount)P4({accountUuid:Z,emailAddress:$,organizationUuid:J})}await u0();let X=w();if(X.oauthAccount&&X.oauthAccount.billingType!==void 0&&X.oauthAccount.accountCreatedAt!==void 0&&X.oauthAccount.subscriptionCreatedAt!==void 0||!U()||!J0())return!1;let Y=H();if(Y?.accessToken){let V=await z0(Y.accessToken);if(V){if(Q)z("OAuth profile fetch succeeded, overriding env var account info",{level:"info"});return P4({accountUuid:V.account.uuid,emailAddress:V.account.email,organizationUuid:V.organization.uuid,displayName:V.account.display_name||void 0,hasExtraUsageEnabled:V.organization.has_extra_usage_enabled??!1,billingType:V.organization.billing_type??void 0,accountCreatedAt:V.account.created_at,subscriptionCreatedAt:V.organization.subscription_created_at??void 0}),!0}}return!1}function P4({accountUuid:Z,emailAddress:$,organizationUuid:J,displayName:Q,hasExtraUsageEnabled:X,billingType:Y,accountCreatedAt:V,subscriptionCreatedAt:W}){let x={accountUuid:Z,emailAddress:$,organizationUuid:J,hasExtraUsageEnabled:X,billingType:Y,accountCreatedAt:V,subscriptionCreatedAt:W};if(Q)x.displayName=Q;M((R)=>{if(R.oauthAccount?.accountUuid===x.accountUuid&&R.oauthAccount?.emailAddress===x.emailAddress&&R.oauthAccount?.organizationUuid===x.organizationUuid&&R.oauthAccount?.displayName===x.displayName&&R.oauthAccount?.hasExtraUsageEnabled===x.hasExtraUsageEnabled&&R.oauthAccount?.billingType===x.billingType&&R.oauthAccount?.accountCreatedAt===x.accountCreatedAt&&R.oauthAccount?.subscriptionCreatedAt===x.subscriptionCreatedAt)return R;return{...R,oauthAccount:x}})}var x4=B(()=>{_2();Z2();O0();n();q0();_0();P2()});
16
+ export{H5 as E0,R5 as F0,AZ as G0,fZ as H0,y4 as I0,T4 as J0,uZ as K0,K5 as L0,c0 as M0,d0 as N0,Y0 as O0,O2 as P0,q as Q0,dZ as R0,nZ as S0,iZ as T0,tZ as U0,r as V0,j as W0,J3 as X0,l0 as Y0,q3 as Z0,W3 as _0,_5 as $0,j3 as a1,B3 as b1,E5 as c1,D3 as d1,z0 as e1,P2 as f1,K0 as g1,EZ as h1,iJ as i1,tJ as j1,G4 as k1,lJ as l1,aJ as m1,M0 as n1,vZ as o1,sJ as p1,rJ as q1,P4 as r1,x4 as s1,E3 as t1,p4 as u1,v5 as v1,A5 as w1,r0 as x1,g5 as y1,S3 as z1,c5 as A1,S as B1,n5 as C1,P0 as D1,t5 as E1,l5 as F1,f3 as G1,u3 as H1,r5 as I1,g3 as J1,o5 as K1,p3 as L1,m3 as M1,c3 as N1,T2 as O1,h as P1,Y1 as Q1,n4 as R1,V9 as S1,q9 as T1,W9 as U1,V1,z9 as W1,G9 as X1,i4 as Y1,x9 as Z1,j9 as _1,B9 as $1,H9 as a2,R9 as b2,a4 as c2,w9 as d2,F9 as e2,L9 as f2,K9 as g2,G1 as h2,I0 as i2,e4 as j2,Z8 as k2,A2 as l2,q8 as m2,P9 as n2,R1 as o2,w1 as p2,W8 as q2,f2 as r2,K1 as s2,D1 as t2,S9 as u2,N1 as v2,r9 as w2,o9 as x2,g2 as y2,e9 as z2,R8 as A2,H0 as B2,T0 as C2,E1 as D2,Z$ as E2,v0 as F2,v1 as G2,N as H2,O as I2,w8 as J2,$$ as K2,b1 as L2,y0 as M2,J$ as N2,y1 as O2,I1 as P2,Q$ as Q2,C as R2,X$ as S2,K8 as T2,Y$ as U2,V$ as V2,q$ as W2,j0 as X2,z$ as Y2,C1 as Z2,D$ as _2,U$ as $2,N$ as a3,w0 as b3,t as c3,b$ as d3,k8 as e3,O$ as f3,E8 as g3,_$ as h3,c2 as i3,u1 as j3,g1 as k3,c$ as l3,T8 as m3,d$ as n3,n$ as o3,m1 as p3,i$ as q3,i1 as r3,S8 as s3,t$ as t3,t1 as u3,l1 as v3,o$ as w3,e$ as x3,e1 as y3,s2 as z3,Z4 as A3,JJ as B3,J4 as C3,Q4 as D3,D0 as E3,b0 as F3,Z0 as G3,l8 as H3,f0 as I3,l as J3,Y5 as K3,q5 as L3,H4 as M3,a8 as N3,R4 as O3,o2 as P3,r8 as Q3,o8 as R3,w4 as S3,X0 as T3,QZ as U3,z5 as V3,F4 as W3,L4 as X3,G5 as Y3,WZ as Z3,zZ as _3,GZ as $3,x2 as a4,x5 as b4,jZ as c4,BZ as d4,D4 as e4,H as f4,j5 as g4,h2 as h4,h0 as i4,u0 as j4,U as k4,J0 as l4,wZ as m4,W2 as n4,FZ as o4,LZ as p4,E as q4,J2 as r4,KZ as s4,Q2 as t4,DZ as u4,d2 as v4,U4 as w4,N4 as x4,z2 as y4,O4 as z4,NZ as A4,OZ as B4,_Z as C4,PZ as D4,kZ as E4,n as F4};
@@ -0,0 +1,2 @@
1
+ import{lna as _}from"./cli-0.1.9-kbrf27z8.mjs";import{stat as Cq,lstat as d,readdir as Mq,realpath as Kq}from"node:fs/promises";import{Readable as Nq}from"node:stream";import{resolve as c,relative as Yq,join as Hq,sep as Iq}from"node:path";function i(q,J={}){let Q=J.entryType||J.type;if(Q==="both")Q=Y.FILE_DIR_TYPE;if(Q)J.type=Q;if(!q)throw Error("readdirp: root argument is required. Usage: readdirp(root, options)");else if(typeof q!=="string")throw TypeError("readdirp: root argument must be a string. Usage: readdirp(root, options)");else if(Q&&!l.includes(Q))throw Error(`readdirp: Invalid type passed. Use one of ${l.join(", ")}`);return J.root=q,new h(J)}var Y,g,n="READDIRP_RECURSIVE_ERROR",Oq,l,bq,Vq,Dq=(q)=>Oq.has(q.code),Lq,o=(q)=>!0,p=(q)=>{if(q===void 0)return o;if(typeof q==="function")return q;if(typeof q==="string"){let J=q.trim();return(Q)=>Q.basename===J}if(Array.isArray(q)){let J=q.map((Q)=>Q.trim());return(Q)=>J.some((X)=>Q.basename===X)}return o},h;var s=_(()=>{Y={FILE_TYPE:"files",DIR_TYPE:"directories",FILE_DIR_TYPE:"files_directories",EVERYTHING_TYPE:"all"},g={root:".",fileFilter:(q)=>!0,directoryFilter:(q)=>!0,type:Y.FILE_TYPE,lstat:!1,depth:2147483648,alwaysStat:!1,highWaterMark:4096};Object.freeze(g);Oq=new Set(["ENOENT","EPERM","EACCES","ELOOP",n]),l=[Y.DIR_TYPE,Y.EVERYTHING_TYPE,Y.FILE_DIR_TYPE,Y.FILE_TYPE],bq=new Set([Y.DIR_TYPE,Y.EVERYTHING_TYPE,Y.FILE_DIR_TYPE]),Vq=new Set([Y.EVERYTHING_TYPE,Y.FILE_DIR_TYPE,Y.FILE_TYPE]),Lq=process.platform==="win32";h=class h extends Nq{constructor(q={}){super({objectMode:!0,autoDestroy:!0,highWaterMark:q.highWaterMark});let J={...g,...q},{root:Q,type:X}=J;this._fileFilter=p(J.fileFilter),this._directoryFilter=p(J.directoryFilter);let Z=J.lstat?d:Cq;if(Lq)this._stat=(z)=>Z(z,{bigint:!0});else this._stat=Z;this._maxDepth=J.depth??g.depth,this._wantsDir=X?bq.has(X):!1,this._wantsFile=X?Vq.has(X):!1,this._wantsEverything=X===Y.EVERYTHING_TYPE,this._root=c(Q),this._isDirent=!J.alwaysStat,this._statsProp=this._isDirent?"dirent":"stats",this._rdOptions={encoding:"utf8",withFileTypes:this._isDirent},this.parents=[this._exploreDir(Q,1)],this.reading=!1,this.parent=void 0}async _read(q){if(this.reading)return;this.reading=!0;try{while(!this.destroyed&&q>0){let J=this.parent,Q=J&&J.files;if(Q&&Q.length>0){let{path:X,depth:Z}=J,z=Q.splice(0,q).map((G)=>this._formatEntry(G,X)),$=await Promise.all(z);for(let G of $){if(!G)continue;if(this.destroyed)return;let x=await this._getEntryType(G);if(x==="directory"&&this._directoryFilter(G)){if(Z<=this._maxDepth)this.parents.push(this._exploreDir(G.fullPath,Z+1));if(this._wantsDir)this.push(G),q--}else if((x==="file"||this._includeAsFile(G))&&this._fileFilter(G)){if(this._wantsFile)this.push(G),q--}}}else{let X=this.parents.pop();if(!X){this.push(null);break}if(this.parent=await X,this.destroyed)return}}}catch(J){this.destroy(J)}finally{this.reading=!1}}async _exploreDir(q,J){let Q;try{Q=await Mq(q,this._rdOptions)}catch(X){this._onError(X)}return{files:Q,depth:J,path:q}}async _formatEntry(q,J){let Q,X=this._isDirent?q.name:q;try{let Z=c(Hq(J,X));Q={path:Yq(this._root,Z),fullPath:Z,basename:X},Q[this._statsProp]=this._isDirent?q:await this._stat(Z)}catch(Z){this._onError(Z);return}return Q}_onError(q){if(Dq(q)&&!this.destroyed)this.emit("warn",q);else this.destroy(q)}async _getEntryType(q){if(!q&&this._statsProp in q)return"";let J=q[this._statsProp];if(J.isFile())return"file";if(J.isDirectory())return"directory";if(J&&J.isSymbolicLink()){let Q=q.fullPath;try{let X=await Kq(Q),Z=await d(X);if(Z.isFile())return"file";if(Z.isDirectory()){let z=X.length;if(Q.startsWith(X)&&Q.substr(z,1)===Iq){let $=Error(`Circular symlink detected: "${Q}" points to "${X}"`);return $.code=n,this._onError($)}return"directory"}}catch(X){return this._onError(X),""}}}_includeAsFile(q){let J=q&&q[this._statsProp];return J&&this._wantsEverything&&!J.isDirectory()}}});import{watchFile as Wq,unwatchFile as a,watch as Fq}from"fs";import{open as Aq,stat as e,lstat as Rq,realpath as u}from"fs/promises";import*as M from"path";import{type as Tq}from"os";function r(q,J,Q,X,Z){let z=($,G)=>{if(Q(q),Z($,G,{watchedPath:q}),G&&q!==G)F(M.resolve(q,G),I,M.join(q,G))};try{return Fq(q,{persistent:J.persistent},z)}catch($){X($);return}}class E{constructor(q){this.fsw=q,this._boundHandleError=(J)=>q._handleError(J)}_watchWithNodeFs(q,J){let Q=this.fsw.options,X=M.dirname(q),Z=M.basename(q);this.fsw._getWatchedDir(X).add(Z);let $=M.resolve(q),G={persistent:Q.persistent};if(!J)J=A;let x;if(Q.usePolling){let U=Q.interval!==Q.binaryInterval;G.interval=U&&fq(Z)?Q.binaryInterval:Q.interval,x=dq(q,$,G,{listener:J,rawEmitter:this.fsw._emitRaw})}else x=mq(q,$,G,{listener:J,errHandler:this._boundHandleError,rawEmitter:this.fsw._emitRaw});return x}_handleFile(q,J,Q){if(this.fsw.closed)return;let X=M.dirname(q),Z=M.basename(q),z=this.fsw._getWatchedDir(X),$=J;if(z.has(Z))return;let G=async(U,j)=>{if(!this.fsw._throttle(Sq,q,5))return;if(!j||j.mtimeMs===0)try{let k=await e(q);if(this.fsw.closed)return;let{atimeMs:K,mtimeMs:N}=k;if(!K||K<=N||N!==$.mtimeMs)this.fsw._emit(H.CHANGE,q,k);if((_q||uq||Pq)&&$.ino!==k.ino){this.fsw._closeFile(U),$=k;let b=this._watchWithNodeFs(q,G);if(b)this.fsw._addPathCloser(U,b)}else $=k}catch(k){this.fsw._remove(X,Z)}else if(z.has(Z)){let{atimeMs:k,mtimeMs:K}=j;if(!k||k<=K||K!==$.mtimeMs)this.fsw._emit(H.CHANGE,q,j);$=j}},x=this._watchWithNodeFs(q,G);if(!(Q&&this.fsw.options.ignoreInitial)&&this.fsw._isntIgnored(q)){if(!this.fsw._throttle(H.ADD,q,0))return;this.fsw._emit(H.ADD,q,J)}return x}async _handleSymlink(q,J,Q,X){if(this.fsw.closed)return;let Z=q.fullPath,z=this.fsw._getWatchedDir(J);if(!this.fsw.options.followSymlinks){this.fsw._incrReadyCount();let $;try{$=await u(Q)}catch(G){return this.fsw._emitReady(),!0}if(this.fsw.closed)return;if(z.has(X)){if(this.fsw._symlinkPaths.get(Z)!==$)this.fsw._symlinkPaths.set(Z,$),this.fsw._emit(H.CHANGE,Q,q.stats)}else z.add(X),this.fsw._symlinkPaths.set(Z,$),this.fsw._emit(H.ADD,Q,q.stats);return this.fsw._emitReady(),!0}if(this.fsw._symlinkPaths.has(Z))return!0;this.fsw._symlinkPaths.set(Z,!0)}_handleRead(q,J,Q,X,Z,z,$){if(q=M.join(q,""),$=this.fsw._throttle("readdir",q,1000),!$)return;let G=this.fsw._getWatchedDir(Q.path),x=new Set,U=this.fsw._readdirp(q,{fileFilter:(j)=>Q.filterPath(j),directoryFilter:(j)=>Q.filterDir(j)});if(!U)return;return U.on(gq,async(j)=>{if(this.fsw.closed){U=void 0;return}let k=j.path,K=M.join(q,k);if(x.add(k),j.stats.isSymbolicLink()&&await this._handleSymlink(j,q,K,k))return;if(this.fsw.closed){U=void 0;return}if(k===X||!X&&!G.has(k))this.fsw._incrReadyCount(),K=M.join(Z,M.relative(Z,K)),this._addToNodeFs(K,J,Q,z+1)}).on(H.ERROR,this._boundHandleError),new Promise((j,k)=>{if(!U)return k();U.once(v,()=>{if(this.fsw.closed){U=void 0;return}let K=$?$.clear():!1;if(j(void 0),G.getChildren().filter((N)=>{return N!==q&&!x.has(N)}).forEach((N)=>{this.fsw._remove(q,N)}),U=void 0,K)this._handleRead(q,!1,Q,X,Z,z,$)})})}async _handleDir(q,J,Q,X,Z,z,$){let G=this.fsw._getWatchedDir(M.dirname(q)),x=G.has(M.basename(q));if(!(Q&&this.fsw.options.ignoreInitial)&&!Z&&!x)this.fsw._emit(H.ADD_DIR,q,J);G.add(M.basename(q)),this.fsw._getWatchedDir(q);let U,j,k=this.fsw.options.depth;if((k==null||X<=k)&&!this.fsw._symlinkPaths.has($)){if(!Z){if(await this._handleRead(q,Q,z,Z,q,X,U),this.fsw.closed)return}j=this._watchWithNodeFs(q,(K,N)=>{if(N&&N.mtimeMs===0)return;this._handleRead(K,!1,z,Z,q,X,U)})}return j}async _addToNodeFs(q,J,Q,X,Z){let z=this.fsw._emitReady;if(this.fsw._isIgnored(q)||this.fsw.closed)return z(),!1;let $=this.fsw._getWatchHelpers(q);if(Q)$.filterPath=(G)=>Q.filterPath(G),$.filterDir=(G)=>Q.filterDir(G);try{let G=await vq[$.statMethod]($.watchPath);if(this.fsw.closed)return;if(this.fsw._isIgnored($.watchPath,G))return z(),!1;let x=this.fsw.options.followSymlinks,U;if(G.isDirectory()){let j=M.resolve(q),k=x?await u(q):q;if(this.fsw.closed)return;if(U=await this._handleDir($.watchPath,G,J,X,Z,$,k),this.fsw.closed)return;if(j!==k&&k!==void 0)this.fsw._symlinkPaths.set(j,k)}else if(G.isSymbolicLink()){let j=x?await u(q):q;if(this.fsw.closed)return;let k=M.dirname($.watchPath);if(this.fsw._getWatchedDir(k).add($.watchPath),this.fsw._emit(H.ADD,$.watchPath,G),U=await this._handleDir(k,G,J,X,q,$,j),this.fsw.closed)return;if(j!==void 0)this.fsw._symlinkPaths.set(M.resolve(q),j)}else U=this._handleFile($.watchPath,G,J);if(z(),U)this.fsw._addPathCloser(q,U);return!1}catch(G){if(this.fsw._handleError(G))return z(),q}}}var gq="data",v="end",t="close",A=()=>{},R,w,_q,uq,Pq,qq,C,H,Sq="watch",vq,I="listeners",L="errHandlers",O="rawEmitters",wq,Eq,fq=(q)=>Eq.has(M.extname(q).slice(1).toLowerCase()),S=(q,J)=>{if(q instanceof Set)q.forEach(J);else J(q)},V=(q,J,Q)=>{let X=q[J];if(!(X instanceof Set))q[J]=X=new Set([X]);X.add(Q)},yq=(q)=>(J)=>{let Q=q[J];if(Q instanceof Set)Q.clear();else delete q[J]},D=(q,J,Q)=>{let X=q[J];if(X instanceof Set)X.delete(Q);else if(X===Q)delete q[J]},Jq=(q)=>q instanceof Set?q.size===0:!q,W,F=(q,J,Q,X,Z)=>{let z=W.get(q);if(!z)return;S(z[J],($)=>{$(Q,X,Z)})},mq=(q,J,Q,X)=>{let{listener:Z,errHandler:z,rawEmitter:$}=X,G=W.get(J),x;if(!Q.persistent){if(x=r(q,Q,Z,z,$),!x)return;return x.close.bind(x)}if(G)V(G,I,Z),V(G,L,z),V(G,O,$);else{if(x=r(q,Q,F.bind(null,J,I),z,F.bind(null,J,O)),!x)return;x.on(H.ERROR,async(U)=>{let j=F.bind(null,J,L);if(G)G.watcherUnusable=!0;if(w&&U.code==="EPERM")try{await(await Aq(q,"r")).close(),j(U)}catch(k){}else j(U)}),G={listeners:Z,errHandlers:z,rawEmitters:$,watcher:x},W.set(J,G)}return()=>{if(D(G,I,Z),D(G,L,z),D(G,O,$),Jq(G.listeners))G.watcher.close(),W.delete(J),wq.forEach(yq(G)),G.watcher=void 0,Object.freeze(G)}},P,dq=(q,J,Q,X)=>{let{listener:Z,rawEmitter:z}=X,$=P.get(J),G=$&&$.options;if(G&&(G.persistent<Q.persistent||G.interval>Q.interval))a(J),$=void 0;if($)V($,I,Z),V($,O,z);else $={listeners:Z,rawEmitters:z,options:Q,watcher:Wq(J,Q,(x,U)=>{S($.rawEmitters,(k)=>{k(H.CHANGE,J,{curr:x,prev:U})});let j=x.mtimeMs;if(x.size!==U.size||j>U.mtimeMs||j===0)S($.listeners,(k)=>k(q,x))})},P.set(J,$);return()=>{if(D($,I,Z),D($,O,z),Jq($.listeners))P.delete(J),a(J),$.options=$.watcher=void 0,Object.freeze($)}};var Qq=_(()=>{R=process.platform,w=R==="win32",_q=R==="darwin",uq=R==="linux",Pq=R==="freebsd",qq=Tq()==="OS400",C={ALL:"all",READY:"ready",ADD:"add",CHANGE:"change",ADD_DIR:"addDir",UNLINK:"unlink",UNLINK_DIR:"unlinkDir",RAW:"raw",ERROR:"error"},H=C,vq={lstat:Rq,stat:e},wq=[I,L,O],Eq=new Set(["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),W=new Map;P=new Map});import{stat as cq}from"fs";import{stat as lq,readdir as oq}from"fs/promises";import{EventEmitter as pq}from"events";import*as B from"path";function T(q){return Array.isArray(q)?q:[q]}function eq(q){if(typeof q==="function")return q;if(typeof q==="string")return(J)=>q===J;if(q instanceof RegExp)return(J)=>q.test(J);if(typeof q==="object"&&q!==null)return(J)=>{if(q.path===J)return!0;if(q.recursive){let Q=B.relative(q.path,J);if(!Q)return!1;return!Q.startsWith("..")&&!B.isAbsolute(Q)}return!1};return()=>!1}function tq(q){if(typeof q!=="string")throw Error("string expected");q=B.normalize(q),q=q.replace(/\\/g,"/");let J=!1;if(q.startsWith("//"))J=!0;let Q=/\/\//;while(q.match(Q))q=q.replace(Q,"/");if(J)q="/"+q;return q}function Zq(q,J,Q){let X=tq(J);for(let Z=0;Z<q.length;Z++){let z=q[Z];if(z(X,Q))return!0}return!1}function qJ(q,J){if(q==null)throw TypeError("anymatch: specify first argument");let X=T(q).map((Z)=>eq(Z));if(J==null)return(Z,z)=>{return Zq(X,Z,z)};return Zq(X,J)}class kq{constructor(q,J){this.path=q,this._removeWatcher=J,this.items=new Set}add(q){let{items:J}=this;if(!J)return;if(q!==Uq&&q!==hq)J.add(q)}async remove(q){let{items:J}=this;if(!J)return;if(J.delete(q),J.size>0)return;let Q=this.path;try{await oq(Q)}catch(X){if(this._removeWatcher)this._removeWatcher(B.dirname(Q),B.basename(Q))}}has(q){let{items:J}=this;if(!J)return;return J.has(q)}getChildren(){let{items:q}=this;if(!q)return[];return[...q.values()]}dispose(){this.items.clear(),this.path="",this._removeWatcher=A,this.items=QJ,Object.freeze(this)}}class jq{constructor(q,J,Q){this.fsw=Q;let X=q;this.path=q=q.replace(rq,""),this.watchPath=X,this.fullWatchPath=B.resolve(X),this.dirParts=[],this.dirParts.forEach((Z)=>{if(Z.length>1)Z.pop()}),this.followSymlinks=J,this.statMethod=J?XJ:ZJ}entryPath(q){return B.join(this.watchPath,B.relative(this.watchPath,q.fullPath))}filterPath(q){let{stats:J}=q;if(J&&J.isSymbolicLink())return this.filterDir(q);let Q=this.entryPath(q);return this.fsw._isntIgnored(Q,J)&&this.fsw._hasReadPermissions(J)}filterDir(q){return this.fsw._isntIgnored(this.entryPath(q),q.stats)}}function $J(q,J={}){let Q=new m(J);return Q.add(q),Q}var f="/",nq="//",Uq=".",hq="..",iq="string",sq,Xq,aq,rq,y=(q)=>typeof q==="object"&&q!==null&&!(q instanceof RegExp),$q=(q)=>{let J=T(q).flat();if(!J.every((Q)=>typeof Q===iq))throw TypeError(`Non-string provided as watch path: ${J}`);return J.map(xq)},Gq=(q)=>{let J=q.replace(sq,f),Q=!1;if(J.startsWith(nq))Q=!0;while(J.match(Xq))J=J.replace(Xq,f);if(Q)J=f+J;return J},xq=(q)=>Gq(B.normalize(Gq(q))),zq=(q="")=>(J)=>{if(typeof J==="string")return xq(B.isAbsolute(J)?J:B.join(q,J));else return J},JJ=(q,J)=>{if(B.isAbsolute(q))return q;return B.join(J,q)},QJ,XJ="stat",ZJ="lstat",m,bJ;var GJ=_(()=>{s();Qq();/*! chokidar - MIT License (c) 2012 Paul Miller (paulmillr.com) */sq=/\\/g,Xq=/\/\//,aq=/\..*\.(sw[px])$|~$|\.subl.*\.tmp/,rq=/^\.[/\\]/;QJ=Object.freeze(new Set);m=class m extends pq{constructor(q={}){super();this.closed=!1,this._closers=new Map,this._ignoredPaths=new Set,this._throttled=new Map,this._streams=new Set,this._symlinkPaths=new Map,this._watched=new Map,this._pendingWrites=new Map,this._pendingUnlinks=new Map,this._readyCount=0,this._readyEmitted=!1;let J=q.awaitWriteFinish,Q={stabilityThreshold:2000,pollInterval:100},X={persistent:!0,ignoreInitial:!1,ignorePermissionErrors:!1,interval:100,binaryInterval:300,followSymlinks:!0,usePolling:!1,atomic:!0,...q,ignored:q.ignored?T(q.ignored):T([]),awaitWriteFinish:J===!0?Q:typeof J==="object"?{...Q,...J}:!1};if(qq)X.usePolling=!0;if(X.atomic===void 0)X.atomic=!X.usePolling;let Z=process.env.CHOKIDAR_USEPOLLING;if(Z!==void 0){let G=Z.toLowerCase();if(G==="false"||G==="0")X.usePolling=!1;else if(G==="true"||G==="1")X.usePolling=!0;else X.usePolling=!!G}let z=process.env.CHOKIDAR_INTERVAL;if(z)X.interval=Number.parseInt(z,10);let $=0;this._emitReady=()=>{if($++,$>=this._readyCount)this._emitReady=A,this._readyEmitted=!0,process.nextTick(()=>this.emit(C.READY))},this._emitRaw=(...G)=>this.emit(C.RAW,...G),this._boundRemove=this._remove.bind(this),this.options=X,this._nodeFsHandler=new E(this),Object.freeze(X)}_addIgnoredPath(q){if(y(q)){for(let J of this._ignoredPaths)if(y(J)&&J.path===q.path&&J.recursive===q.recursive)return}this._ignoredPaths.add(q)}_removeIgnoredPath(q){if(this._ignoredPaths.delete(q),typeof q==="string"){for(let J of this._ignoredPaths)if(y(J)&&J.path===q)this._ignoredPaths.delete(J)}}add(q,J,Q){let{cwd:X}=this.options;this.closed=!1,this._closePromise=void 0;let Z=$q(q);if(X)Z=Z.map((z)=>{return JJ(z,X)});if(Z.forEach((z)=>{this._removeIgnoredPath(z)}),this._userIgnored=void 0,!this._readyCount)this._readyCount=0;return this._readyCount+=Z.length,Promise.all(Z.map(async(z)=>{let $=await this._nodeFsHandler._addToNodeFs(z,!Q,void 0,0,J);if($)this._emitReady();return $})).then((z)=>{if(this.closed)return;z.forEach(($)=>{if($)this.add(B.dirname($),B.basename(J||$))})}),this}unwatch(q){if(this.closed)return this;let J=$q(q),{cwd:Q}=this.options;return J.forEach((X)=>{if(!B.isAbsolute(X)&&!this._closers.has(X)){if(Q)X=B.join(Q,X);X=B.resolve(X)}if(this._closePath(X),this._addIgnoredPath(X),this._watched.has(X))this._addIgnoredPath({path:X,recursive:!0});this._userIgnored=void 0}),this}close(){if(this._closePromise)return this._closePromise;this.closed=!0,this.removeAllListeners();let q=[];return this._closers.forEach((J)=>J.forEach((Q)=>{let X=Q();if(X instanceof Promise)q.push(X)})),this._streams.forEach((J)=>J.destroy()),this._userIgnored=void 0,this._readyCount=0,this._readyEmitted=!1,this._watched.forEach((J)=>J.dispose()),this._closers.clear(),this._watched.clear(),this._streams.clear(),this._symlinkPaths.clear(),this._throttled.clear(),this._closePromise=q.length?Promise.all(q).then(()=>{return}):Promise.resolve(),this._closePromise}getWatched(){let q={};return this._watched.forEach((J,Q)=>{let Z=(this.options.cwd?B.relative(this.options.cwd,Q):Q)||Uq;q[Z]=J.getChildren().sort()}),q}emitWithAll(q,J){if(this.emit(q,...J),q!==C.ERROR)this.emit(C.ALL,q,...J)}async _emit(q,J,Q){if(this.closed)return;let X=this.options;if(w)J=B.normalize(J);if(X.cwd)J=B.relative(X.cwd,J);let Z=[J];if(Q!=null)Z.push(Q);let z=X.awaitWriteFinish,$;if(z&&($=this._pendingWrites.get(J)))return $.lastChange=new Date,this;if(X.atomic){if(q===C.UNLINK)return this._pendingUnlinks.set(J,[q,...Z]),setTimeout(()=>{this._pendingUnlinks.forEach((G,x)=>{this.emit(...G),this.emit(C.ALL,...G),this._pendingUnlinks.delete(x)})},typeof X.atomic==="number"?X.atomic:100),this;if(q===C.ADD&&this._pendingUnlinks.has(J))q=C.CHANGE,this._pendingUnlinks.delete(J)}if(z&&(q===C.ADD||q===C.CHANGE)&&this._readyEmitted){let G=(x,U)=>{if(x)q=C.ERROR,Z[0]=x,this.emitWithAll(q,Z);else if(U){if(Z.length>1)Z[1]=U;else Z.push(U);this.emitWithAll(q,Z)}};return this._awaitWriteFinish(J,z.stabilityThreshold,q,G),this}if(q===C.CHANGE){if(!this._throttle(C.CHANGE,J,50))return this}if(X.alwaysStat&&Q===void 0&&(q===C.ADD||q===C.ADD_DIR||q===C.CHANGE)){let G=X.cwd?B.join(X.cwd,J):J,x;try{x=await lq(G)}catch(U){}if(!x||this.closed)return;Z.push(x)}return this.emitWithAll(q,Z),this}_handleError(q){let J=q&&q.code;if(q&&J!=="ENOENT"&&J!=="ENOTDIR"&&(!this.options.ignorePermissionErrors||J!=="EPERM"&&J!=="EACCES"))this.emit(C.ERROR,q);return q||this.closed}_throttle(q,J,Q){if(!this._throttled.has(q))this._throttled.set(q,new Map);let X=this._throttled.get(q);if(!X)throw Error("invalid throttle");let Z=X.get(J);if(Z)return Z.count++,!1;let z,$=()=>{let x=X.get(J),U=x?x.count:0;if(X.delete(J),clearTimeout(z),x)clearTimeout(x.timeoutObject);return U};z=setTimeout($,Q);let G={timeoutObject:z,clear:$,count:0};return X.set(J,G),G}_incrReadyCount(){return this._readyCount++}_awaitWriteFinish(q,J,Q,X){let Z=this.options.awaitWriteFinish;if(typeof Z!=="object")return;let z=Z.pollInterval,$,G=q;if(this.options.cwd&&!B.isAbsolute(q))G=B.join(this.options.cwd,q);let x=new Date,U=this._pendingWrites;function j(k){cq(G,(K,N)=>{if(K||!U.has(q)){if(K&&K.code!=="ENOENT")X(K);return}let b=Number(new Date);if(k&&N.size!==k.size)U.get(q).lastChange=b;let Bq=U.get(q);if(b-Bq.lastChange>=J)U.delete(q),X(void 0,N);else $=setTimeout(j,z,N)})}if(!U.has(q))U.set(q,{lastChange:x,cancelWait:()=>{return U.delete(q),clearTimeout($),Q}}),$=setTimeout(j,z)}_isIgnored(q,J){if(this.options.atomic&&aq.test(q))return!0;if(!this._userIgnored){let{cwd:Q}=this.options,Z=(this.options.ignored||[]).map(zq(Q)),$=[...[...this._ignoredPaths].map(zq(Q)),...Z];this._userIgnored=qJ($,void 0)}return this._userIgnored(q,J)}_isntIgnored(q,J){return!this._isIgnored(q,J)}_getWatchHelpers(q){return new jq(q,this.options.followSymlinks,this)}_getWatchedDir(q){let J=B.resolve(q);if(!this._watched.has(J))this._watched.set(J,new kq(J,this._boundRemove));return this._watched.get(J)}_hasReadPermissions(q){if(this.options.ignorePermissionErrors)return!0;return Boolean(Number(q.mode)&256)}_remove(q,J,Q){let X=B.join(q,J),Z=B.resolve(X);if(Q=Q!=null?Q:this._watched.has(X)||this._watched.has(Z),!this._throttle("remove",X,100))return;if(!Q&&this._watched.size===1)this.add(q,J,!0);this._getWatchedDir(X).getChildren().forEach((k)=>this._remove(X,k));let G=this._getWatchedDir(q),x=G.has(J);if(G.remove(J),this._symlinkPaths.has(Z))this._symlinkPaths.delete(Z);let U=X;if(this.options.cwd)U=B.relative(this.options.cwd,X);if(this.options.awaitWriteFinish&&this._pendingWrites.has(U)){if(this._pendingWrites.get(U).cancelWait()===C.ADD)return}this._watched.delete(X),this._watched.delete(Z);let j=Q?C.UNLINK_DIR:C.UNLINK;if(x&&!this._isIgnored(X))this._emit(j,X);this._closePath(X)}_closePath(q){this._closeFile(q);let J=B.dirname(q);this._getWatchedDir(J).remove(B.basename(q))}_closeFile(q){let J=this._closers.get(q);if(!J)return;J.forEach((Q)=>Q()),this._closers.delete(q)}_addPathCloser(q,J){if(!J)return;let Q=this._closers.get(q);if(!Q)Q=[],this._closers.set(q,Q);Q.push(J)}_readdirp(q,J){if(this.closed)return;let Q={type:C.ALL,alwaysStat:!0,lstat:!0,...J,depth:0},X=i(q,Q);return this._streams.add(X),X.once(t,()=>{X=void 0}),X.once(v,()=>{if(X)this._streams.delete(X),X=void 0}),X}};bJ={watch:$J,FSWatcher:m}});
2
+ export{jq as EP,m as FP,$J as GP,bJ as HP,GJ as IP};