@namzu/cli 44.1.1 → 44.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (451) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/acp-OUBJWH5B.js +7754 -0
  4. package/dist/chunks/acp-OUBJWH5B.js.map +6 -0
  5. package/dist/chunks/{activity-command-Y5ZLCQ63.js → activity-command-R7MUSZIY.js} +16 -15
  6. package/dist/chunks/activity-command-R7MUSZIY.js.map +6 -0
  7. package/dist/chunks/{add-F7M57FGR.js → add-PSEIDDRW.js} +21 -18
  8. package/dist/chunks/add-PSEIDDRW.js.map +6 -0
  9. package/dist/chunks/{agent-AFX2UZU5.js → agent-YPEXUYPH.js} +35 -30
  10. package/dist/chunks/agent-session-EZB2OYG3.js +65 -0
  11. package/dist/chunks/{archive-6NM6DYAT.js → archive-ET4PXE34.js} +11 -10
  12. package/dist/chunks/archive-ET4PXE34.js.map +6 -0
  13. package/dist/chunks/{bin-main-I6CHRYYQ.js → bin-main-PMB57AZJ.js} +9 -9
  14. package/dist/chunks/binding-K6RIQ5AP.js +17 -0
  15. package/dist/chunks/{browser-OPMOTWTV.js → browser-SKTIAVBF.js} +6 -6
  16. package/dist/chunks/{chat-KGVPXQS6.js → chat-AVIVXXMD.js} +20 -19
  17. package/dist/chunks/chat-AVIVXXMD.js.map +6 -0
  18. package/dist/chunks/chunk-26C37THH.js +867 -0
  19. package/dist/chunks/chunk-26C37THH.js.map +6 -0
  20. package/dist/chunks/{chunk-CTN4O42X.js → chunk-2EHPXO4E.js} +3 -3
  21. package/dist/chunks/{chunk-LS75R55C.js → chunk-2NI5NS5S.js} +3 -3
  22. package/dist/chunks/{chunk-RV5QY3IY.js → chunk-2U5M5IYH.js} +6 -6
  23. package/dist/chunks/{chunk-PWOG3OMH.js → chunk-2X6JZAKH.js} +9 -9
  24. package/dist/chunks/{chunk-W5QFVC74.js → chunk-2Y26DLOF.js} +27 -10
  25. package/dist/chunks/{chunk-W5QFVC74.js.map → chunk-2Y26DLOF.js.map} +1 -1
  26. package/dist/chunks/{chunk-BR6EWAKQ.js → chunk-3QGJXD7U.js} +5 -5
  27. package/dist/chunks/{chunk-XFNCCDJK.js → chunk-435DYOG4.js} +2 -2
  28. package/dist/chunks/{chunk-Y44FAVKA.js → chunk-4OXIJ2EF.js} +3 -3
  29. package/dist/chunks/{chunk-RSRJQB6Q.js → chunk-6EJFXJDO.js} +204 -68
  30. package/dist/chunks/chunk-6EJFXJDO.js.map +6 -0
  31. package/dist/chunks/{chunk-UC3ZACVN.js → chunk-6FWFSPUL.js} +2 -2
  32. package/dist/chunks/chunk-6HTC5TQ3.js +89 -0
  33. package/dist/chunks/chunk-6HTC5TQ3.js.map +6 -0
  34. package/dist/chunks/chunk-6IDFHPY3.js +413 -0
  35. package/dist/chunks/chunk-6IDFHPY3.js.map +6 -0
  36. package/dist/chunks/chunk-7FPKSX4M.js +61 -0
  37. package/dist/chunks/chunk-7FPKSX4M.js.map +6 -0
  38. package/dist/chunks/{chunk-EFEZWLZC.js → chunk-7QQOUCGI.js} +12 -10
  39. package/dist/chunks/chunk-7QQOUCGI.js.map +6 -0
  40. package/dist/chunks/{chunk-KHM2XON5.js → chunk-7TEXDZVO.js} +17 -3
  41. package/dist/chunks/chunk-7TEXDZVO.js.map +6 -0
  42. package/dist/chunks/{chunk-WPNT6IGU.js → chunk-A5GTZ7R2.js} +2 -2
  43. package/dist/chunks/{chunk-BIGRB2H4.js → chunk-ACSG5R5P.js} +3 -3
  44. package/dist/chunks/{chunk-QV43JSBP.js → chunk-AI6PBE5G.js} +2 -2
  45. package/dist/chunks/{chunk-HXZ2JXCO.js → chunk-AX5ESG6K.js} +2 -2
  46. package/dist/chunks/{chunk-DESOZLEL.js → chunk-B3XIVOLM.js} +2 -2
  47. package/dist/chunks/{chunk-ZXKN4TWP.js → chunk-BGKQCLLH.js} +242 -447
  48. package/dist/chunks/chunk-BGKQCLLH.js.map +6 -0
  49. package/dist/chunks/chunk-BT7ZELXJ.js +63 -0
  50. package/dist/chunks/chunk-BT7ZELXJ.js.map +6 -0
  51. package/dist/chunks/{chunk-ZUN2WRCB.js → chunk-DECJPLLA.js} +13 -13
  52. package/dist/chunks/{chunk-GSYPRZZU.js → chunk-DFCJYRT5.js} +2 -2
  53. package/dist/chunks/{chunk-QNTR7X7D.js → chunk-DQLSLXDF.js} +5 -5
  54. package/dist/chunks/chunk-EXFSMYH4.js +83 -0
  55. package/dist/chunks/chunk-EXFSMYH4.js.map +6 -0
  56. package/dist/chunks/{chunk-6Z2ZJ4BA.js → chunk-FHQTXWDA.js} +4 -4
  57. package/dist/chunks/chunk-G73G2WGR.js +242 -0
  58. package/dist/chunks/chunk-G73G2WGR.js.map +6 -0
  59. package/dist/chunks/{chunk-BLM6IQS4.js → chunk-GANFMGV7.js} +5 -5
  60. package/dist/chunks/{chunk-REDD2WY7.js → chunk-GBS6ATYF.js} +2 -2
  61. package/dist/chunks/{chunk-ORVWGSLG.js → chunk-GCCFTP47.js} +4 -4
  62. package/dist/chunks/{chunk-FKIO77IY.js → chunk-GNEDN6MU.js} +12 -12
  63. package/dist/chunks/{chunk-NS7EU37U.js → chunk-HB5ZN5KQ.js} +2 -2
  64. package/dist/chunks/{chunk-EFQ6FUFZ.js → chunk-HELINLSD.js} +2 -2
  65. package/dist/chunks/{chunk-AY7B43MK.js → chunk-HKCIZR5P.js} +13 -13
  66. package/dist/chunks/chunk-HRJPVPSU.js +164 -0
  67. package/dist/chunks/chunk-HRJPVPSU.js.map +6 -0
  68. package/dist/chunks/{chunk-NPZY5OJ5.js → chunk-HTBMDD6Y.js} +8 -8
  69. package/dist/chunks/{chunk-LN26A356.js → chunk-I5E4MT3C.js} +4 -4
  70. package/dist/chunks/{chunk-KK2L4FD2.js → chunk-IJZ7SLBV.js} +3 -3
  71. package/dist/chunks/{chunk-YAEHAYI4.js → chunk-ITA57VY5.js} +7 -5
  72. package/dist/chunks/chunk-ITA57VY5.js.map +6 -0
  73. package/dist/chunks/{chunk-W4E2N7TY.js → chunk-IZVN6K6U.js} +4 -4
  74. package/dist/chunks/{chunk-7U36A4WQ.js → chunk-JL64XHSL.js} +55 -5
  75. package/dist/chunks/chunk-JL64XHSL.js.map +6 -0
  76. package/dist/chunks/chunk-KLKAK2O5.js +5817 -0
  77. package/dist/chunks/chunk-KLKAK2O5.js.map +6 -0
  78. package/dist/chunks/{chunk-465CVUN4.js → chunk-L2NNJ4XL.js} +3 -3
  79. package/dist/chunks/{chunk-JCUPTKQY.js → chunk-LF76CVOZ.js} +4 -4
  80. package/dist/chunks/{chunk-ZATO2QOS.js → chunk-LFPTXRMM.js} +2 -2
  81. package/dist/chunks/chunk-LG27EJU6.js +189 -0
  82. package/dist/chunks/chunk-LG27EJU6.js.map +6 -0
  83. package/dist/chunks/{chunk-UHPRMPWX.js → chunk-LKJBDF7W.js} +15 -3
  84. package/dist/chunks/chunk-LKJBDF7W.js.map +6 -0
  85. package/dist/chunks/chunk-LKODRKMZ.js +575 -0
  86. package/dist/chunks/chunk-LKODRKMZ.js.map +6 -0
  87. package/dist/chunks/{chunk-WLUGKIYQ.js → chunk-LQRP2VRQ.js} +4 -4
  88. package/dist/chunks/{chunk-UGAT33T5.js → chunk-LYGD5P7O.js} +3 -3
  89. package/dist/chunks/{chunk-CRWNJ62V.js → chunk-M2OZ4SVS.js} +3 -3
  90. package/dist/chunks/{chunk-I32JTWDW.js → chunk-MGZSEPDY.js} +2 -2
  91. package/dist/chunks/{chunk-HYFX32Y3.js → chunk-MJBGVVI5.js} +3 -3
  92. package/dist/chunks/{chunk-YPRKTJ5P.js → chunk-MYL75RA4.js} +2 -2
  93. package/dist/chunks/chunk-PIVHVYCN.js +3925 -0
  94. package/dist/chunks/chunk-PIVHVYCN.js.map +6 -0
  95. package/dist/chunks/{chunk-AE4LOPZF.js → chunk-PMX2WTZL.js} +2 -2
  96. package/dist/chunks/{chunk-FPLDTTM2.js → chunk-QWSZ5P4C.js} +6 -6
  97. package/dist/chunks/{chunk-T5POXPXY.js → chunk-RSIWTHYS.js} +3 -3
  98. package/dist/chunks/{chunk-UP3SWACV.js → chunk-S4QOQGAT.js} +2 -2
  99. package/dist/chunks/chunk-S7WRWA25.js +33 -0
  100. package/dist/chunks/chunk-S7WRWA25.js.map +6 -0
  101. package/dist/chunks/{chunk-ZRBGY4SL.js → chunk-SGRO4RJP.js} +2 -2
  102. package/dist/chunks/{chunk-WKUTR7YW.js → chunk-SJFPZPOJ.js} +80 -17
  103. package/dist/chunks/chunk-SJFPZPOJ.js.map +6 -0
  104. package/dist/chunks/{chunk-JAYPFJGZ.js → chunk-TZZOQ62Z.js} +2 -2
  105. package/dist/chunks/chunk-U4SST7AD.js +219 -0
  106. package/dist/chunks/chunk-U4SST7AD.js.map +6 -0
  107. package/dist/chunks/{chunk-CMAZ3DYB.js → chunk-UGDZ7MLG.js} +4 -4
  108. package/dist/chunks/chunk-VDKDXDOH.js +290 -0
  109. package/dist/chunks/chunk-VDKDXDOH.js.map +6 -0
  110. package/dist/chunks/{chunk-2NFPIARP.js → chunk-VFVWHYHT.js} +4 -4
  111. package/dist/chunks/{chunk-5UB2LLPG.js → chunk-VZ4PKWLF.js} +2 -2
  112. package/dist/chunks/{chunk-WLAI3VCE.js → chunk-WKFHQQOU.js} +2 -2
  113. package/dist/chunks/{chunk-JSFF2HGX.js → chunk-WKPRYH24.js} +3 -3
  114. package/dist/chunks/{chunk-VR4MTSMH.js → chunk-WQFHJ4TO.js} +3 -3
  115. package/dist/chunks/{chunk-RFMODICJ.js → chunk-WYJ3CNXX.js} +80 -38
  116. package/dist/chunks/chunk-WYJ3CNXX.js.map +6 -0
  117. package/dist/chunks/{chunk-ZNYKZ3MI.js → chunk-XPLHAOGE.js} +2 -2
  118. package/dist/chunks/{chunk-2NGXQQPP.js → chunk-XX2SP5AM.js} +3 -3
  119. package/dist/chunks/{chunk-T2PF65KB.js → chunk-YDSWGJWF.js} +2 -2
  120. package/dist/chunks/{chunk-LUSUJZR2.js → chunk-YJ6NWB2B.js} +2 -2
  121. package/dist/chunks/{chunk-O4MFP726.js → chunk-YTE3QIH3.js} +998 -393
  122. package/dist/chunks/chunk-YTE3QIH3.js.map +6 -0
  123. package/dist/chunks/{chunk-JH3SDABI.js → chunk-YUYNIAJX.js} +6 -6
  124. package/dist/chunks/{chunk-TX2PUHTP.js → chunk-YXIG4OT2.js} +2 -2
  125. package/dist/chunks/{cli-runtime-HTTDQPEZ.js → cli-runtime-F4MEMBDL.js} +11 -10
  126. package/dist/chunks/cli-runtime-F4MEMBDL.js.map +6 -0
  127. package/dist/chunks/{commands-ZD2L5QMI.js → commands-ZCNZVYTG.js} +5 -5
  128. package/dist/chunks/{crash-report-2IRIZSBD.js → crash-report-K53VF4H5.js} +6 -6
  129. package/dist/chunks/{dist-GSYFGRQT.js → dist-6IPPA55L.js} +2 -2
  130. package/dist/chunks/{dist-45IFTDJW.js → dist-H53G25BE.js} +2 -2
  131. package/dist/chunks/{dist-RQJEJN3Z.js → dist-L5LBM77I.js} +2 -2
  132. package/dist/chunks/{dist-OJTB6QLR.js → dist-RIH2Q2ER.js} +2 -2
  133. package/dist/chunks/{dist-OCZJJFHF.js → dist-RTIKLSUV.js} +2 -2
  134. package/dist/chunks/{dist-TWYNAZDN.js → dist-T6KE7URX.js} +2 -2
  135. package/dist/chunks/{dist-FNGLTQIG.js → dist-VSJGDIXP.js} +32 -2
  136. package/dist/chunks/{dist-NL7WG7PX.js → dist-XNGK3C4G.js} +2 -2
  137. package/dist/chunks/{doctor-NKPCWPB4.js → doctor-DOCGTBME.js} +17 -15
  138. package/dist/chunks/{drain-YTSVAQP5.js → drain-LT3J2MEA.js} +13 -13
  139. package/dist/chunks/entry-UHKDLPDS.js +232 -0
  140. package/dist/chunks/entry-UHKDLPDS.js.map +6 -0
  141. package/dist/chunks/{eval-ILFXDQUQ.js → eval-DH26W2QK.js} +2 -2
  142. package/dist/chunks/{exec-3JDAB34N.js → exec-QGAHWUUQ.js} +57 -47
  143. package/dist/chunks/exec-QGAHWUUQ.js.map +6 -0
  144. package/dist/chunks/{github-FH7PPWVW.js → github-JTMZJAZL.js} +4 -4
  145. package/dist/chunks/{home-5OIZIDIT.js → home-GGVNSCCU.js} +3 -3
  146. package/dist/chunks/host-6CUYPX4T.js +23 -0
  147. package/dist/chunks/{host-queries-SO2NOQRR.js → host-queries-4EW7M54U.js} +16 -15
  148. package/dist/chunks/host-queries-4EW7M54U.js.map +6 -0
  149. package/dist/chunks/{learn-RHNMJ4BD.js → learn-PAO3IOYA.js} +13 -13
  150. package/dist/chunks/{learn-builtin-UQ3MWGK6.js → learn-builtin-DXZUXOGG.js} +19 -19
  151. package/dist/chunks/{lifecycle-RTDYXKBW.js → lifecycle-KDN4D7DP.js} +30 -26
  152. package/dist/chunks/{list-G6OA34RL.js → list-KSP6S57Z.js} +15 -14
  153. package/dist/chunks/list-KSP6S57Z.js.map +6 -0
  154. package/dist/chunks/{live-44HBQCQY.js → live-XWJ2JOFO.js} +15 -13
  155. package/dist/chunks/{login-J4PWR4FM.js → login-3Q2HKQUW.js} +10 -8
  156. package/dist/chunks/{logs-22QAEH2Q.js → logs-UYB55HOX.js} +4 -4
  157. package/dist/chunks/{mcp-EXFVIHPJ.js → mcp-JWSI4KA6.js} +25 -22
  158. package/dist/chunks/mcp-JWSI4KA6.js.map +6 -0
  159. package/dist/chunks/{message-command-B4L2W4YZ.js → message-command-YP6TGD3K.js} +47 -42
  160. package/dist/chunks/message-command-YP6TGD3K.js.map +6 -0
  161. package/dist/chunks/open-QUDHJK5H.js +19 -0
  162. package/dist/chunks/{operator-tools-TEP4UTI6.js → operator-tools-43NL7HKO.js} +15 -14
  163. package/dist/chunks/operator-tools-43NL7HKO.js.map +6 -0
  164. package/dist/chunks/{output-schema-FZXJ7V33.js → output-schema-TLW5FA37.js} +3 -3
  165. package/dist/chunks/{pal-BUDEBIBJ.js → pal-EZE2KLYZ.js} +16 -14
  166. package/dist/chunks/pal-EZE2KLYZ.js.map +6 -0
  167. package/dist/chunks/palette-WDPS7W6Q.js +15 -0
  168. package/dist/chunks/peers-OBENILN2.js +18 -0
  169. package/dist/chunks/prefix-MLAG4KTK.js +14 -0
  170. package/dist/chunks/{providers-EQ32NZAT.js → providers-PJIHLTXP.js} +22 -18
  171. package/dist/chunks/pty-HDEXCPR6.js +29 -0
  172. package/dist/chunks/{resident-FSUGNG56.js → resident-2GHB3BKR.js} +32 -30
  173. package/dist/chunks/resident-2GHB3BKR.js.map +6 -0
  174. package/dist/chunks/resume-FHPY2RU3.js +24 -0
  175. package/dist/chunks/resume-FHPY2RU3.js.map +6 -0
  176. package/dist/chunks/{resume-command-DHPXCZVL.js → resume-command-VB6VA64L.js} +4 -4
  177. package/dist/chunks/resume-command-VB6VA64L.js.map +6 -0
  178. package/dist/chunks/{schedule-OJMZEWJG.js → schedule-42N4JOQJ.js} +8 -8
  179. package/dist/chunks/{service-EP2QHCK7.js → service-6WGZKKI4.js} +33 -29
  180. package/dist/chunks/service-6WGZKKI4.js.map +6 -0
  181. package/dist/chunks/{session-step-44XBOUDV.js → session-step-SBWIM4MZ.js} +15 -15
  182. package/dist/chunks/session-step-SBWIM4MZ.js.map +6 -0
  183. package/dist/chunks/{skills-YHAQXVP2.js → skills-V3VDOL3D.js} +11 -11
  184. package/dist/chunks/spaces-6II4JYTZ.js +231 -0
  185. package/dist/chunks/spaces-6II4JYTZ.js.map +6 -0
  186. package/dist/chunks/{start-check-KVZFDBD3.js → start-check-MRSPS5JT.js} +2 -2
  187. package/dist/chunks/start-check-MRSPS5JT.js.map +6 -0
  188. package/dist/chunks/{state-NXFKMBOX.js → state-HX3XRNPC.js} +2 -2
  189. package/dist/chunks/store-7P462EUD.js +17 -0
  190. package/dist/chunks/store-7P462EUD.js.map +6 -0
  191. package/dist/chunks/{store-KFJWAELA.js → store-FUQE7EWU.js} +13 -10
  192. package/dist/chunks/store-FUQE7EWU.js.map +6 -0
  193. package/dist/chunks/{store-QNY242NN.js → store-IX6KNJA4.js} +6 -6
  194. package/dist/chunks/store-IX6KNJA4.js.map +6 -0
  195. package/dist/chunks/{store-JLTSSGKL.js → store-MQXI7G2H.js} +4 -4
  196. package/dist/chunks/store-MQXI7G2H.js.map +6 -0
  197. package/dist/chunks/{tui-L5GKR237.js → tui-PH5B6UCO.js} +1822 -816
  198. package/dist/chunks/tui-PH5B6UCO.js.map +6 -0
  199. package/dist/chunks/{upgrade-PROVWX55.js → upgrade-HDW5MWLE.js} +6 -6
  200. package/dist/chunks/{worktree-ELHDXX4X.js → worktree-MLFYZF56.js} +13 -12
  201. package/dist/chunks/worktree-MLFYZF56.js.map +6 -0
  202. package/dist/cli.d.ts.map +1 -1
  203. package/dist/commands/exec-json.d.ts.map +1 -1
  204. package/dist/commands/manifest.d.ts +1 -0
  205. package/dist/commands/manifest.d.ts.map +1 -1
  206. package/dist/commands/spaces.d.ts +42 -0
  207. package/dist/commands/spaces.d.ts.map +1 -0
  208. package/dist/config/load.d.ts.map +1 -1
  209. package/dist/config/schema.d.ts +7 -0
  210. package/dist/config/schema.d.ts.map +1 -1
  211. package/dist/doctor/checks/index.d.ts +2 -1
  212. package/dist/doctor/checks/index.d.ts.map +1 -1
  213. package/dist/doctor/checks/terminal.d.ts +12 -0
  214. package/dist/doctor/checks/terminal.d.ts.map +1 -0
  215. package/dist/index.js +22 -19
  216. package/dist/integrations/accounts/activity.d.ts +39 -0
  217. package/dist/integrations/accounts/activity.d.ts.map +1 -0
  218. package/dist/integrations/accounts/binding.d.ts +30 -0
  219. package/dist/integrations/accounts/binding.d.ts.map +1 -0
  220. package/dist/integrations/accounts/codex-login.d.ts +33 -0
  221. package/dist/integrations/accounts/codex-login.d.ts.map +1 -0
  222. package/dist/integrations/accounts/host-facts.d.ts +22 -0
  223. package/dist/integrations/accounts/host-facts.d.ts.map +1 -0
  224. package/dist/integrations/accounts/open.d.ts +23 -0
  225. package/dist/integrations/accounts/open.d.ts.map +1 -0
  226. package/dist/integrations/accounts/rows.d.ts +45 -0
  227. package/dist/integrations/accounts/rows.d.ts.map +1 -0
  228. package/dist/integrations/peers/runtime.d.ts +12 -0
  229. package/dist/integrations/peers/runtime.d.ts.map +1 -1
  230. package/dist/integrations/providers/codex-account.d.ts +30 -0
  231. package/dist/integrations/providers/codex-account.d.ts.map +1 -0
  232. package/dist/integrations/providers/codex-oauth.d.ts +12 -0
  233. package/dist/integrations/providers/codex-oauth.d.ts.map +1 -1
  234. package/dist/integrations/providers/preferences.d.ts +8 -0
  235. package/dist/integrations/providers/preferences.d.ts.map +1 -1
  236. package/dist/integrations/resident/runner-worker.js +24 -23
  237. package/dist/integrations/resident/runner-worker.js.map +1 -1
  238. package/dist/integrations/sessions/store.d.ts +13 -1
  239. package/dist/integrations/sessions/store.d.ts.map +1 -1
  240. package/dist/spaces/git.d.ts +27 -0
  241. package/dist/spaces/git.d.ts.map +1 -0
  242. package/dist/spaces/goto.d.ts +31 -0
  243. package/dist/spaces/goto.d.ts.map +1 -0
  244. package/dist/spaces/host.d.ts +380 -0
  245. package/dist/spaces/host.d.ts.map +1 -0
  246. package/dist/spaces/input.d.ts +87 -0
  247. package/dist/spaces/input.d.ts.map +1 -0
  248. package/dist/spaces/keymap.d.ts +30 -0
  249. package/dist/spaces/keymap.d.ts.map +1 -0
  250. package/dist/spaces/layout.d.ts +34 -0
  251. package/dist/spaces/layout.d.ts.map +1 -0
  252. package/dist/spaces/overlay.d.ts +105 -0
  253. package/dist/spaces/overlay.d.ts.map +1 -0
  254. package/dist/spaces/palette.d.ts +35 -0
  255. package/dist/spaces/palette.d.ts.map +1 -0
  256. package/dist/spaces/peers.d.ts +19 -0
  257. package/dist/spaces/peers.d.ts.map +1 -0
  258. package/dist/spaces/prefix.d.ts +19 -0
  259. package/dist/spaces/prefix.d.ts.map +1 -0
  260. package/dist/spaces/roster.d.ts +111 -0
  261. package/dist/spaces/roster.d.ts.map +1 -0
  262. package/dist/spaces/session.d.ts +83 -0
  263. package/dist/spaces/session.d.ts.map +1 -0
  264. package/dist/spaces/sidebar.d.ts +99 -0
  265. package/dist/spaces/sidebar.d.ts.map +1 -0
  266. package/dist/spaces/signal.d.ts +28 -0
  267. package/dist/spaces/signal.d.ts.map +1 -0
  268. package/dist/spaces/status.d.ts +20 -0
  269. package/dist/spaces/status.d.ts.map +1 -0
  270. package/dist/spaces/store.d.ts +69 -0
  271. package/dist/spaces/store.d.ts.map +1 -0
  272. package/dist/spaces/tabbar.d.ts +36 -0
  273. package/dist/spaces/tabbar.d.ts.map +1 -0
  274. package/dist/spaces/tiling.d.ts +90 -0
  275. package/dist/spaces/tiling.d.ts.map +1 -0
  276. package/dist/terminal/host/cell.d.ts +35 -0
  277. package/dist/terminal/host/cell.d.ts.map +1 -0
  278. package/dist/terminal/host/frame.d.ts +64 -0
  279. package/dist/terminal/host/frame.d.ts.map +1 -0
  280. package/dist/terminal/host/index.d.ts +5 -0
  281. package/dist/terminal/host/index.d.ts.map +1 -0
  282. package/dist/terminal/host/writer.d.ts +21 -0
  283. package/dist/terminal/host/writer.d.ts.map +1 -0
  284. package/dist/terminal/host/xterm-source.d.ts +18 -0
  285. package/dist/terminal/host/xterm-source.d.ts.map +1 -0
  286. package/dist/terminal/pty.d.ts.map +1 -1
  287. package/dist/terminal/screen.d.ts +12 -0
  288. package/dist/terminal/screen.d.ts.map +1 -1
  289. package/dist/tui/App.d.ts +106 -1
  290. package/dist/tui/App.d.ts.map +1 -1
  291. package/dist/tui/Composer.d.ts +7 -1
  292. package/dist/tui/Composer.d.ts.map +1 -1
  293. package/dist/tui/ResumePicker.d.ts.map +1 -1
  294. package/dist/tui/TextPrompt.d.ts +5 -1
  295. package/dist/tui/TextPrompt.d.ts.map +1 -1
  296. package/dist/tui/account-flow.d.ts +126 -0
  297. package/dist/tui/account-flow.d.ts.map +1 -0
  298. package/dist/tui/agent.d.ts +17 -1
  299. package/dist/tui/agent.d.ts.map +1 -1
  300. package/dist/tui/compaction-rows.d.ts.map +1 -1
  301. package/dist/tui/context-usage.d.ts +14 -0
  302. package/dist/tui/context-usage.d.ts.map +1 -1
  303. package/dist/tui/index.d.ts.map +1 -1
  304. package/dist/tui/launch-settings.d.ts +5 -2
  305. package/dist/tui/launch-settings.d.ts.map +1 -1
  306. package/dist/tui/plain-interruption.d.ts +3 -1
  307. package/dist/tui/plain-interruption.d.ts.map +1 -1
  308. package/dist/tui/resume-picker-state.d.ts +7 -0
  309. package/dist/tui/resume-picker-state.d.ts.map +1 -1
  310. package/dist/tui/slashCommands.d.ts +11 -0
  311. package/dist/tui/slashCommands.d.ts.map +1 -1
  312. package/dist/tui/tidy-tool-output.d.ts +3 -1
  313. package/dist/tui/tidy-tool-output.d.ts.map +1 -1
  314. package/dist/tui/tool-end-rows.d.ts +2 -0
  315. package/dist/tui/tool-end-rows.d.ts.map +1 -1
  316. package/dist/tui/zoom/entry.d.ts +34 -0
  317. package/dist/tui/zoom/entry.d.ts.map +1 -0
  318. package/dist/tui/zoom/gesture.d.ts +51 -0
  319. package/dist/tui/zoom/gesture.d.ts.map +1 -0
  320. package/dist/tui/zoom/leave.d.ts +11 -0
  321. package/dist/tui/zoom/leave.d.ts.map +1 -0
  322. package/dist/tui/zoom/local.d.ts +55 -0
  323. package/dist/tui/zoom/local.d.ts.map +1 -0
  324. package/dist/tui/zoom/proxy.d.ts +40 -0
  325. package/dist/tui/zoom/proxy.d.ts.map +1 -0
  326. package/package.json +9 -8
  327. package/dist/chunks/acp-P3S54TTC.js +0 -13601
  328. package/dist/chunks/acp-P3S54TTC.js.map +0 -6
  329. package/dist/chunks/activity-command-Y5ZLCQ63.js.map +0 -6
  330. package/dist/chunks/add-F7M57FGR.js.map +0 -6
  331. package/dist/chunks/agent-session-CFWQHSYT.js +0 -60
  332. package/dist/chunks/archive-6NM6DYAT.js.map +0 -6
  333. package/dist/chunks/chat-KGVPXQS6.js.map +0 -6
  334. package/dist/chunks/chunk-43PPWWYD.js +0 -1415
  335. package/dist/chunks/chunk-43PPWWYD.js.map +0 -6
  336. package/dist/chunks/chunk-7U36A4WQ.js.map +0 -6
  337. package/dist/chunks/chunk-EFEZWLZC.js.map +0 -6
  338. package/dist/chunks/chunk-KHM2XON5.js.map +0 -6
  339. package/dist/chunks/chunk-O4MFP726.js.map +0 -6
  340. package/dist/chunks/chunk-RFMODICJ.js.map +0 -6
  341. package/dist/chunks/chunk-RSRJQB6Q.js.map +0 -6
  342. package/dist/chunks/chunk-UHPRMPWX.js.map +0 -6
  343. package/dist/chunks/chunk-WKUTR7YW.js.map +0 -6
  344. package/dist/chunks/chunk-YAEHAYI4.js.map +0 -6
  345. package/dist/chunks/chunk-ZXKN4TWP.js.map +0 -6
  346. package/dist/chunks/cli-runtime-HTTDQPEZ.js.map +0 -6
  347. package/dist/chunks/exec-3JDAB34N.js.map +0 -6
  348. package/dist/chunks/host-queries-SO2NOQRR.js.map +0 -6
  349. package/dist/chunks/list-G6OA34RL.js.map +0 -6
  350. package/dist/chunks/mcp-EXFVIHPJ.js.map +0 -6
  351. package/dist/chunks/message-command-B4L2W4YZ.js.map +0 -6
  352. package/dist/chunks/operator-tools-TEP4UTI6.js.map +0 -6
  353. package/dist/chunks/pal-BUDEBIBJ.js.map +0 -6
  354. package/dist/chunks/resident-FSUGNG56.js.map +0 -6
  355. package/dist/chunks/resume-VXHGE5GC.js +0 -23
  356. package/dist/chunks/service-EP2QHCK7.js.map +0 -6
  357. package/dist/chunks/tui-L5GKR237.js.map +0 -6
  358. package/dist/chunks/worktree-ELHDXX4X.js.map +0 -6
  359. /package/dist/chunks/{agent-AFX2UZU5.js.map → agent-YPEXUYPH.js.map} +0 -0
  360. /package/dist/chunks/{agent-session-CFWQHSYT.js.map → agent-session-EZB2OYG3.js.map} +0 -0
  361. /package/dist/chunks/{bin-main-I6CHRYYQ.js.map → bin-main-PMB57AZJ.js.map} +0 -0
  362. /package/dist/chunks/{commands-ZD2L5QMI.js.map → binding-K6RIQ5AP.js.map} +0 -0
  363. /package/dist/chunks/{browser-OPMOTWTV.js.map → browser-SKTIAVBF.js.map} +0 -0
  364. /package/dist/chunks/{chunk-CTN4O42X.js.map → chunk-2EHPXO4E.js.map} +0 -0
  365. /package/dist/chunks/{chunk-LS75R55C.js.map → chunk-2NI5NS5S.js.map} +0 -0
  366. /package/dist/chunks/{chunk-RV5QY3IY.js.map → chunk-2U5M5IYH.js.map} +0 -0
  367. /package/dist/chunks/{chunk-PWOG3OMH.js.map → chunk-2X6JZAKH.js.map} +0 -0
  368. /package/dist/chunks/{chunk-BR6EWAKQ.js.map → chunk-3QGJXD7U.js.map} +0 -0
  369. /package/dist/chunks/{chunk-XFNCCDJK.js.map → chunk-435DYOG4.js.map} +0 -0
  370. /package/dist/chunks/{chunk-Y44FAVKA.js.map → chunk-4OXIJ2EF.js.map} +0 -0
  371. /package/dist/chunks/{chunk-UC3ZACVN.js.map → chunk-6FWFSPUL.js.map} +0 -0
  372. /package/dist/chunks/{chunk-WPNT6IGU.js.map → chunk-A5GTZ7R2.js.map} +0 -0
  373. /package/dist/chunks/{chunk-BIGRB2H4.js.map → chunk-ACSG5R5P.js.map} +0 -0
  374. /package/dist/chunks/{chunk-QV43JSBP.js.map → chunk-AI6PBE5G.js.map} +0 -0
  375. /package/dist/chunks/{chunk-HXZ2JXCO.js.map → chunk-AX5ESG6K.js.map} +0 -0
  376. /package/dist/chunks/{chunk-DESOZLEL.js.map → chunk-B3XIVOLM.js.map} +0 -0
  377. /package/dist/chunks/{chunk-ZUN2WRCB.js.map → chunk-DECJPLLA.js.map} +0 -0
  378. /package/dist/chunks/{chunk-GSYPRZZU.js.map → chunk-DFCJYRT5.js.map} +0 -0
  379. /package/dist/chunks/{chunk-QNTR7X7D.js.map → chunk-DQLSLXDF.js.map} +0 -0
  380. /package/dist/chunks/{chunk-6Z2ZJ4BA.js.map → chunk-FHQTXWDA.js.map} +0 -0
  381. /package/dist/chunks/{chunk-BLM6IQS4.js.map → chunk-GANFMGV7.js.map} +0 -0
  382. /package/dist/chunks/{chunk-REDD2WY7.js.map → chunk-GBS6ATYF.js.map} +0 -0
  383. /package/dist/chunks/{chunk-ORVWGSLG.js.map → chunk-GCCFTP47.js.map} +0 -0
  384. /package/dist/chunks/{chunk-FKIO77IY.js.map → chunk-GNEDN6MU.js.map} +0 -0
  385. /package/dist/chunks/{chunk-NS7EU37U.js.map → chunk-HB5ZN5KQ.js.map} +0 -0
  386. /package/dist/chunks/{chunk-EFQ6FUFZ.js.map → chunk-HELINLSD.js.map} +0 -0
  387. /package/dist/chunks/{chunk-AY7B43MK.js.map → chunk-HKCIZR5P.js.map} +0 -0
  388. /package/dist/chunks/{chunk-NPZY5OJ5.js.map → chunk-HTBMDD6Y.js.map} +0 -0
  389. /package/dist/chunks/{chunk-LN26A356.js.map → chunk-I5E4MT3C.js.map} +0 -0
  390. /package/dist/chunks/{chunk-KK2L4FD2.js.map → chunk-IJZ7SLBV.js.map} +0 -0
  391. /package/dist/chunks/{chunk-W4E2N7TY.js.map → chunk-IZVN6K6U.js.map} +0 -0
  392. /package/dist/chunks/{chunk-465CVUN4.js.map → chunk-L2NNJ4XL.js.map} +0 -0
  393. /package/dist/chunks/{chunk-JCUPTKQY.js.map → chunk-LF76CVOZ.js.map} +0 -0
  394. /package/dist/chunks/{chunk-ZATO2QOS.js.map → chunk-LFPTXRMM.js.map} +0 -0
  395. /package/dist/chunks/{chunk-WLUGKIYQ.js.map → chunk-LQRP2VRQ.js.map} +0 -0
  396. /package/dist/chunks/{chunk-UGAT33T5.js.map → chunk-LYGD5P7O.js.map} +0 -0
  397. /package/dist/chunks/{chunk-CRWNJ62V.js.map → chunk-M2OZ4SVS.js.map} +0 -0
  398. /package/dist/chunks/{chunk-I32JTWDW.js.map → chunk-MGZSEPDY.js.map} +0 -0
  399. /package/dist/chunks/{chunk-HYFX32Y3.js.map → chunk-MJBGVVI5.js.map} +0 -0
  400. /package/dist/chunks/{chunk-YPRKTJ5P.js.map → chunk-MYL75RA4.js.map} +0 -0
  401. /package/dist/chunks/{chunk-AE4LOPZF.js.map → chunk-PMX2WTZL.js.map} +0 -0
  402. /package/dist/chunks/{chunk-FPLDTTM2.js.map → chunk-QWSZ5P4C.js.map} +0 -0
  403. /package/dist/chunks/{chunk-T5POXPXY.js.map → chunk-RSIWTHYS.js.map} +0 -0
  404. /package/dist/chunks/{chunk-UP3SWACV.js.map → chunk-S4QOQGAT.js.map} +0 -0
  405. /package/dist/chunks/{chunk-ZRBGY4SL.js.map → chunk-SGRO4RJP.js.map} +0 -0
  406. /package/dist/chunks/{chunk-JAYPFJGZ.js.map → chunk-TZZOQ62Z.js.map} +0 -0
  407. /package/dist/chunks/{chunk-CMAZ3DYB.js.map → chunk-UGDZ7MLG.js.map} +0 -0
  408. /package/dist/chunks/{chunk-2NFPIARP.js.map → chunk-VFVWHYHT.js.map} +0 -0
  409. /package/dist/chunks/{chunk-5UB2LLPG.js.map → chunk-VZ4PKWLF.js.map} +0 -0
  410. /package/dist/chunks/{chunk-WLAI3VCE.js.map → chunk-WKFHQQOU.js.map} +0 -0
  411. /package/dist/chunks/{chunk-JSFF2HGX.js.map → chunk-WKPRYH24.js.map} +0 -0
  412. /package/dist/chunks/{chunk-VR4MTSMH.js.map → chunk-WQFHJ4TO.js.map} +0 -0
  413. /package/dist/chunks/{chunk-ZNYKZ3MI.js.map → chunk-XPLHAOGE.js.map} +0 -0
  414. /package/dist/chunks/{chunk-2NGXQQPP.js.map → chunk-XX2SP5AM.js.map} +0 -0
  415. /package/dist/chunks/{chunk-T2PF65KB.js.map → chunk-YDSWGJWF.js.map} +0 -0
  416. /package/dist/chunks/{chunk-LUSUJZR2.js.map → chunk-YJ6NWB2B.js.map} +0 -0
  417. /package/dist/chunks/{chunk-JH3SDABI.js.map → chunk-YUYNIAJX.js.map} +0 -0
  418. /package/dist/chunks/{chunk-TX2PUHTP.js.map → chunk-YXIG4OT2.js.map} +0 -0
  419. /package/dist/chunks/{crash-report-2IRIZSBD.js.map → commands-ZCNZVYTG.js.map} +0 -0
  420. /package/dist/chunks/{dist-FNGLTQIG.js.map → crash-report-K53VF4H5.js.map} +0 -0
  421. /package/dist/chunks/{dist-GSYFGRQT.js.map → dist-6IPPA55L.js.map} +0 -0
  422. /package/dist/chunks/{dist-45IFTDJW.js.map → dist-H53G25BE.js.map} +0 -0
  423. /package/dist/chunks/{dist-RQJEJN3Z.js.map → dist-L5LBM77I.js.map} +0 -0
  424. /package/dist/chunks/{dist-OJTB6QLR.js.map → dist-RIH2Q2ER.js.map} +0 -0
  425. /package/dist/chunks/{dist-OCZJJFHF.js.map → dist-RTIKLSUV.js.map} +0 -0
  426. /package/dist/chunks/{dist-TWYNAZDN.js.map → dist-T6KE7URX.js.map} +0 -0
  427. /package/dist/chunks/{doctor-NKPCWPB4.js.map → dist-VSJGDIXP.js.map} +0 -0
  428. /package/dist/chunks/{dist-NL7WG7PX.js.map → dist-XNGK3C4G.js.map} +0 -0
  429. /package/dist/chunks/{home-5OIZIDIT.js.map → doctor-DOCGTBME.js.map} +0 -0
  430. /package/dist/chunks/{drain-YTSVAQP5.js.map → drain-LT3J2MEA.js.map} +0 -0
  431. /package/dist/chunks/{eval-ILFXDQUQ.js.map → eval-DH26W2QK.js.map} +0 -0
  432. /package/dist/chunks/{github-FH7PPWVW.js.map → github-JTMZJAZL.js.map} +0 -0
  433. /package/dist/chunks/{lifecycle-RTDYXKBW.js.map → home-GGVNSCCU.js.map} +0 -0
  434. /package/dist/chunks/{live-44HBQCQY.js.map → host-6CUYPX4T.js.map} +0 -0
  435. /package/dist/chunks/{learn-RHNMJ4BD.js.map → learn-PAO3IOYA.js.map} +0 -0
  436. /package/dist/chunks/{learn-builtin-UQ3MWGK6.js.map → learn-builtin-DXZUXOGG.js.map} +0 -0
  437. /package/dist/chunks/{login-J4PWR4FM.js.map → lifecycle-KDN4D7DP.js.map} +0 -0
  438. /package/dist/chunks/{output-schema-FZXJ7V33.js.map → live-XWJ2JOFO.js.map} +0 -0
  439. /package/dist/chunks/{providers-EQ32NZAT.js.map → login-3Q2HKQUW.js.map} +0 -0
  440. /package/dist/chunks/{logs-22QAEH2Q.js.map → logs-UYB55HOX.js.map} +0 -0
  441. /package/dist/chunks/{resume-VXHGE5GC.js.map → open-QUDHJK5H.js.map} +0 -0
  442. /package/dist/chunks/{resume-command-DHPXCZVL.js.map → output-schema-TLW5FA37.js.map} +0 -0
  443. /package/dist/chunks/{session-step-44XBOUDV.js.map → palette-WDPS7W6Q.js.map} +0 -0
  444. /package/dist/chunks/{start-check-KVZFDBD3.js.map → peers-OBENILN2.js.map} +0 -0
  445. /package/dist/chunks/{store-JLTSSGKL.js.map → prefix-MLAG4KTK.js.map} +0 -0
  446. /package/dist/chunks/{store-KFJWAELA.js.map → providers-PJIHLTXP.js.map} +0 -0
  447. /package/dist/chunks/{store-QNY242NN.js.map → pty-HDEXCPR6.js.map} +0 -0
  448. /package/dist/chunks/{schedule-OJMZEWJG.js.map → schedule-42N4JOQJ.js.map} +0 -0
  449. /package/dist/chunks/{skills-YHAQXVP2.js.map → skills-V3VDOL3D.js.map} +0 -0
  450. /package/dist/chunks/{state-NXFKMBOX.js.map → state-HX3XRNPC.js.map} +0 -0
  451. /package/dist/chunks/{upgrade-PROVWX55.js.map → upgrade-HDW5MWLE.js.map} +0 -0
@@ -0,0 +1,867 @@
1
+ import { createRequire as __namzuCreateRequire } from 'node:module';
2
+ const require = __namzuCreateRequire(import.meta.url);
3
+ import {
4
+ PROVIDER_REGISTRY,
5
+ unsupportedProviderMessage
6
+ } from "./chunk-6LLJQ3KY.js";
7
+ import {
8
+ KEYCHAIN_SERVICE,
9
+ preferFresherCredential,
10
+ readAgentKeychainCredential,
11
+ readClaudeFileCredentialCandidates,
12
+ readCodexFileCredentialCandidates,
13
+ readOpenCodeApiCredentialCandidates,
14
+ wslWindowsHome
15
+ } from "./chunk-LKODRKMZ.js";
16
+ import {
17
+ findActiveZenModel
18
+ } from "./chunk-IE5XIE4W.js";
19
+ import {
20
+ isExperimentalFreeZenModel
21
+ } from "./chunk-B73OIFL6.js";
22
+ import {
23
+ apiKeysPath,
24
+ credentialsPath,
25
+ googleApiKeyPath,
26
+ readStoredApiKey,
27
+ readStoredCodexCredential,
28
+ readStoredGeminiApiKey,
29
+ readStoredSubscriptionCredential
30
+ } from "./chunk-TZZOQ62Z.js";
31
+ import {
32
+ namzuHomePath
33
+ } from "./chunk-HB5ZN5KQ.js";
34
+ import {
35
+ EnvCredentialProvider,
36
+ ProviderRegistry,
37
+ resolveProviderCapabilities
38
+ } from "./chunk-YTE3QIH3.js";
39
+ import {
40
+ __name
41
+ } from "./chunk-76FLAFCG.js";
42
+
43
+ // src/integrations/providers/access.ts
44
+ function hasApiCredential(entry, apiKey) {
45
+ if (entry.id === "zen" || entry.id === "zen-go") {
46
+ return Boolean(apiKey?.trim() && apiKey.trim() !== "public");
47
+ }
48
+ return Boolean(apiKey);
49
+ }
50
+ __name(hasApiCredential, "hasApiCredential");
51
+ function requiresCredentialForModel(entry, model) {
52
+ return entry.requiresApiKey || entry.id === "zen" && !isExperimentalFreeZenModel("zen", findActiveZenModel("zen", model));
53
+ }
54
+ __name(requiresCredentialForModel, "requiresCredentialForModel");
55
+ function canSelectModel(entry, apiKey, model) {
56
+ return hasApiCredential(entry, apiKey) || !requiresCredentialForModel(entry, model);
57
+ }
58
+ __name(canSelectModel, "canSelectModel");
59
+
60
+ // src/integrations/providers/gemini-credentials.ts
61
+ import { constants, closeSync, fstatSync, openSync, readSync } from "node:fs";
62
+ import { homedir } from "node:os";
63
+ import { join } from "node:path";
64
+ var REFRESH_URL = "https://oauth2.googleapis.com/token";
65
+ var MAX_BYTES = 1024 * 1024;
66
+ function readGeminiCredentialFile(path) {
67
+ let fd;
68
+ try {
69
+ fd = openSync(path, constants.O_RDONLY | constants.O_NONBLOCK);
70
+ const stat = fstatSync(fd);
71
+ if (!stat.isFile() || stat.size > MAX_BYTES) return null;
72
+ const buffer = Buffer.alloc(MAX_BYTES + 1);
73
+ let size = 0;
74
+ while (size < buffer.length) {
75
+ const count = readSync(fd, buffer, size, buffer.length - size, null);
76
+ if (count === 0) break;
77
+ size += count;
78
+ }
79
+ if (size > MAX_BYTES) return null;
80
+ const value = JSON.parse(buffer.subarray(0, size).toString("utf8"));
81
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
82
+ const record = value;
83
+ if (typeof record.access_token !== "string" || !record.access_token.trim()) return null;
84
+ if (record.expiry_date !== void 0 && (typeof record.expiry_date !== "number" || !Number.isFinite(record.expiry_date) || record.expiry_date <= 0))
85
+ return null;
86
+ return {
87
+ accessToken: record.access_token,
88
+ ...typeof record.refresh_token === "string" && record.refresh_token.trim() ? { refreshToken: record.refresh_token } : {},
89
+ ...typeof record.expiry_date === "number" ? { expiresAt: record.expiry_date } : {}
90
+ };
91
+ } catch {
92
+ return null;
93
+ } finally {
94
+ if (fd !== void 0) closeSync(fd);
95
+ }
96
+ }
97
+ __name(readGeminiCredentialFile, "readGeminiCredentialFile");
98
+ function readGeminiFileCredentialCandidates(home, env = process.env, windowsHome = home === void 0 ? wslWindowsHome(env) : null) {
99
+ const paths = env.GEMINI_CLI_HOME ? [join(env.GEMINI_CLI_HOME, ".gemini", "oauth_creds.json")] : [
100
+ join(home ?? homedir(), ".gemini", "oauth_creds.json"),
101
+ ...windowsHome ? [join(windowsHome, ".gemini", "oauth_creds.json")] : []
102
+ ];
103
+ return [...new Set(paths)].flatMap((path) => {
104
+ const credential = readGeminiCredentialFile(path);
105
+ return credential && (credential.expiresAt === void 0 || credential.expiresAt > Date.now() + 6e4 || credential.refreshToken) ? [{ path, credential }] : [];
106
+ });
107
+ }
108
+ __name(readGeminiFileCredentialCandidates, "readGeminiFileCredentialCandidates");
109
+ function createGeminiAccessTokenResolver(path, fetchFn = globalThis.fetch, env = process.env) {
110
+ let source;
111
+ let cached;
112
+ let pending;
113
+ return async (signal) => {
114
+ signal?.throwIfAborted();
115
+ const owner = readGeminiCredentialFile(path);
116
+ if (!owner)
117
+ throw new Error("Gemini CLI sign-in is no longer available. Sign in with Gemini CLI again.");
118
+ const fingerprint = JSON.stringify(owner);
119
+ if (source !== fingerprint) {
120
+ source = fingerprint;
121
+ cached = owner;
122
+ pending = void 0;
123
+ }
124
+ const current = cached ?? owner;
125
+ if (current.expiresAt === void 0 || current.expiresAt > Date.now() + 6e4)
126
+ return current.accessToken;
127
+ if (!current.refreshToken)
128
+ throw new Error("Gemini CLI sign-in has expired. Sign in with Gemini CLI again.");
129
+ const clientId = env.GOOGLE_OAUTH_CLIENT_ID?.trim();
130
+ const clientSecret = env.GOOGLE_OAUTH_CLIENT_SECRET?.trim();
131
+ if (!clientId || !clientSecret)
132
+ throw new Error(
133
+ "Gemini CLI sign-in has expired. Refresh it in Gemini CLI, or configure the matching GOOGLE_OAUTH_CLIENT_ID and GOOGLE_OAUTH_CLIENT_SECRET."
134
+ );
135
+ if (!pending) {
136
+ const refresh = current.refreshToken;
137
+ const operation = (async () => {
138
+ const response = await fetchFn(REFRESH_URL, {
139
+ method: "POST",
140
+ redirect: "error",
141
+ signal: AbortSignal.timeout(15e3),
142
+ headers: { "content-type": "application/x-www-form-urlencoded" },
143
+ body: new URLSearchParams({
144
+ client_id: clientId,
145
+ client_secret: clientSecret,
146
+ refresh_token: refresh,
147
+ grant_type: "refresh_token"
148
+ })
149
+ });
150
+ if (!response.ok)
151
+ throw new Error(
152
+ `Gemini CLI sign-in could not be refreshed (HTTP ${response.status}). Sign in with Gemini CLI again.`
153
+ );
154
+ const value = await response.json();
155
+ if (typeof value.access_token !== "string" || !value.access_token || typeof value.expires_in !== "number" || !Number.isFinite(value.expires_in) || value.expires_in <= 0)
156
+ throw new Error("Google returned an invalid sign-in refresh response.");
157
+ if (source === fingerprint)
158
+ cached = {
159
+ accessToken: value.access_token,
160
+ refreshToken: typeof value.refresh_token === "string" ? value.refresh_token : refresh,
161
+ expiresAt: Date.now() + value.expires_in * 1e3
162
+ };
163
+ return value.access_token;
164
+ })();
165
+ pending = operation;
166
+ void operation.finally(() => {
167
+ if (pending === operation) pending = void 0;
168
+ }).catch(() => {
169
+ });
170
+ }
171
+ if (!signal) return pending;
172
+ signal.throwIfAborted();
173
+ return new Promise((resolve, reject) => {
174
+ const abort = /* @__PURE__ */ __name(() => reject(signal.reason), "abort");
175
+ signal.addEventListener("abort", abort, { once: true });
176
+ pending?.then(resolve, reject).finally(() => signal.removeEventListener("abort", abort));
177
+ });
178
+ };
179
+ }
180
+ __name(createGeminiAccessTokenResolver, "createGeminiAccessTokenResolver");
181
+
182
+ // src/integrations/providers/discover.ts
183
+ function signedInSubscriptionProviders(detected) {
184
+ return detected.filter((provider) => {
185
+ if (provider.entry.id === "google") return provider.source.kind === "gemini-file";
186
+ if (provider.entry.subscriptionLogin === void 0) return false;
187
+ return [provider.source, ...provider.alternatives].some(
188
+ (source) => source.kind === "claude-file" || source.kind === "codex-file" || source.kind === "keychain" || source.kind === "stored" || source.kind === "env" && source.envName === "CLAUDE_CODE_OAUTH_TOKEN"
189
+ );
190
+ });
191
+ }
192
+ __name(signedInSubscriptionProviders, "signedInSubscriptionProviders");
193
+ var DEFAULT_PROBE_TIMEOUT_MS = 300;
194
+ async function discoverProviders(opts = {}) {
195
+ const env = opts.env ?? process.env;
196
+ const credentials = new EnvCredentialProvider({ env, anyKey: true });
197
+ const detected = [];
198
+ const geminiCredentials = readGeminiFileCredentialCandidates(opts.home, env, opts.windowsHome);
199
+ const storedCredential = opts.skipStored ? null : readStoredSubscriptionCredential(...opts.home === void 0 ? [] : [opts.home]);
200
+ const storedCodexCredential = opts.skipStored ? null : readStoredCodexCredential(...opts.home === void 0 ? [] : [opts.home]);
201
+ const storedGeminiApiKey = opts.skipStored ? null : readStoredGeminiApiKey(...opts.home === void 0 ? [] : [opts.home]);
202
+ const keychainCredential = opts.skipKeychain || env.CLAUDE_CONFIG_DIR ? null : readAgentKeychainCredential();
203
+ const claudeFileCredentials = readClaudeFileCredentialCandidates(opts.home, env, opts.windowsHome);
204
+ const openCodeCredentials = readOpenCodeApiCredentialCandidates(opts.home, env, opts.windowsHome);
205
+ const codexFileCredentials = readCodexFileCredentialCandidates(
206
+ opts.home,
207
+ env,
208
+ opts.windowsHome
209
+ ).filter(
210
+ (candidate) => candidate.credential.expiresAt === void 0 || candidate.credential.expiresAt - Date.now() > 6e4
211
+ );
212
+ const usableCodexFileCredential = codexFileCredentials.reduce((current, candidate) => {
213
+ if (!current) return candidate;
214
+ return preferFresherCredential(current.credential, candidate.credential) === candidate.credential ? candidate : current;
215
+ }, null);
216
+ const probes = /* @__PURE__ */ new Map();
217
+ if (!opts.skipProbes) {
218
+ for (const probed of Object.values(PROVIDER_REGISTRY)) {
219
+ if (probed.probeUrl) probes.set(probed.id, probe(probed.probeUrl, opts));
220
+ }
221
+ }
222
+ for (const id of Object.keys(PROVIDER_REGISTRY)) {
223
+ const entry = PROVIDER_REGISTRY[id];
224
+ const sources = [];
225
+ let apiKey;
226
+ let anonymousSelected = false;
227
+ let oauth;
228
+ let codex;
229
+ let gemini;
230
+ if (id === "anthropic") {
231
+ const borrowedCandidates = [
232
+ ...claudeFileCredentials.map(({ credential, path }) => ({
233
+ credential,
234
+ source: { kind: "claude-file", path }
235
+ })),
236
+ ...keychainCredential ? [
237
+ {
238
+ credential: keychainCredential,
239
+ source: {
240
+ kind: "keychain",
241
+ service: KEYCHAIN_SERVICE
242
+ }
243
+ }
244
+ ] : []
245
+ ].filter(
246
+ (candidate) => candidate.credential.expiresAt === void 0 || candidate.credential.expiresAt - Date.now() > 6e4 || candidate.source.kind === "claude-file" && candidate.credential.refreshToken !== void 0
247
+ );
248
+ const borrowed = borrowedCandidates.reduce(
249
+ (current, candidate) => {
250
+ if (!current) return candidate;
251
+ return preferFresherCredential(current.credential, candidate.credential) === candidate.credential ? candidate : current;
252
+ },
253
+ null
254
+ );
255
+ if (borrowed) {
256
+ if (apiKey === void 0) {
257
+ apiKey = borrowed.credential.accessToken;
258
+ oauth = {
259
+ refreshToken: borrowed.credential.refreshToken,
260
+ expiresAt: borrowed.credential.expiresAt,
261
+ origin: borrowed.source.kind === "claude-file" ? "claude-file" : "keychain",
262
+ ...borrowed.source.kind === "claude-file" ? { sourcePath: borrowed.source.path } : {}
263
+ };
264
+ }
265
+ sources.push(borrowed.source);
266
+ }
267
+ for (const candidate of borrowedCandidates) {
268
+ if (candidate !== borrowed) sources.push(candidate.source);
269
+ }
270
+ if (storedCredential) {
271
+ if (apiKey === void 0) {
272
+ apiKey = storedCredential.accessToken;
273
+ oauth = {
274
+ refreshToken: storedCredential.refreshToken,
275
+ expiresAt: storedCredential.expiresAt,
276
+ origin: "stored"
277
+ };
278
+ }
279
+ sources.push({
280
+ kind: "stored",
281
+ path: credentialsPath(...opts.home === void 0 ? [] : [opts.home])
282
+ });
283
+ }
284
+ }
285
+ if (id === "codex" && (storedCodexCredential || usableCodexFileCredential)) {
286
+ const credential = usableCodexFileCredential?.credential ?? storedCodexCredential;
287
+ if (!credential) throw new Error("unreachable");
288
+ apiKey = credential.accessToken;
289
+ sources.push({
290
+ kind: usableCodexFileCredential ? "codex-file" : "stored",
291
+ path: usableCodexFileCredential ? usableCodexFileCredential.path : credentialsPath(...opts.home === void 0 ? [] : [opts.home])
292
+ });
293
+ codex = {
294
+ accountId: credential.accountId,
295
+ expiresAt: credential.expiresAt,
296
+ origin: usableCodexFileCredential ? "codex-file" : "stored"
297
+ };
298
+ if (storedCodexCredential && usableCodexFileCredential) {
299
+ sources.push({
300
+ kind: "stored",
301
+ path: credentialsPath(...opts.home === void 0 ? [] : [opts.home])
302
+ });
303
+ }
304
+ for (const candidate of codexFileCredentials) {
305
+ if (candidate !== usableCodexFileCredential) {
306
+ sources.push({ kind: "codex-file", path: candidate.path });
307
+ }
308
+ }
309
+ }
310
+ for (const envName of entry.envVars) {
311
+ const resolved = await credentials.resolve(envName);
312
+ if (anonymousSelected) continue;
313
+ if ((id === "zen" || id === "zen-go") && resolved?.value.trim() === "public") {
314
+ if (sources.length === 0) {
315
+ anonymousSelected = true;
316
+ sources.push({ kind: "env", envName });
317
+ }
318
+ continue;
319
+ }
320
+ if (resolved && hasApiCredential(entry, resolved.value)) {
321
+ if (apiKey === void 0) apiKey = resolved.value;
322
+ sources.push({ kind: "env", envName });
323
+ }
324
+ }
325
+ if (!opts.skipStored && id !== "google" && entry.acceptsTypedCredential) {
326
+ const saved = readStoredApiKey(id, opts.home);
327
+ if (saved && hasApiCredential(entry, saved)) {
328
+ if (apiKey === void 0) apiKey = saved;
329
+ sources.push({ kind: "stored-api-key", path: apiKeysPath(opts.home) });
330
+ }
331
+ }
332
+ if (id === "google") {
333
+ if (storedGeminiApiKey && hasApiCredential(entry, storedGeminiApiKey)) {
334
+ if (apiKey === void 0) apiKey = storedGeminiApiKey;
335
+ sources.push({
336
+ kind: "stored-gemini-key",
337
+ path: googleApiKeyPath(...opts.home === void 0 ? [] : [opts.home])
338
+ });
339
+ }
340
+ const borrowed = geminiCredentials[0];
341
+ if (borrowed) {
342
+ if (apiKey === void 0) {
343
+ apiKey = borrowed.credential.accessToken;
344
+ const projectId = env.GOOGLE_CLOUD_PROJECT?.trim() || env.GOOGLE_CLOUD_PROJECT_ID?.trim();
345
+ gemini = {
346
+ sourcePath: borrowed.path,
347
+ ...projectId ? { projectId } : {}
348
+ };
349
+ }
350
+ sources.push({ kind: "gemini-file", path: borrowed.path });
351
+ }
352
+ }
353
+ if (id === "zen" || id === "zen-go") {
354
+ for (const candidate of openCodeCredentials) {
355
+ if (anonymousSelected) break;
356
+ if (candidate.provider !== id) continue;
357
+ if (apiKey === void 0) apiKey = candidate.apiKey;
358
+ sources.push(candidate.source);
359
+ }
360
+ if (id === "zen" && sources.length === 0) sources.push({ kind: "public" });
361
+ }
362
+ if (id === "zen-go" && anonymousSelected) continue;
363
+ if (sources.length === 0 && entry.probeUrl && probes.has(id)) {
364
+ const reachable = await probes.get(id);
365
+ if (reachable) {
366
+ sources.push({ kind: "probe", url: entry.probeUrl });
367
+ }
368
+ }
369
+ if (sources.length > 0) {
370
+ detected.push({
371
+ entry,
372
+ source: sources[0],
373
+ apiKey,
374
+ baseUrl: entry.defaultBaseUrl,
375
+ ...oauth ? { oauth } : {},
376
+ ...codex ? { codex } : {},
377
+ ...gemini ? { gemini } : {},
378
+ alternatives: sources.slice(1)
379
+ });
380
+ }
381
+ }
382
+ return detected.sort((left, right) => automaticRank(left) - automaticRank(right));
383
+ }
384
+ __name(discoverProviders, "discoverProviders");
385
+ function isAnonymousZen(provider) {
386
+ return provider.entry.id === "zen" && !hasApiCredential(provider.entry, provider.apiKey);
387
+ }
388
+ __name(isAnonymousZen, "isAnonymousZen");
389
+ var AUTOMATIC_ORDER = ["sign-in", "key", "local", "free"];
390
+ function automaticKind(provider) {
391
+ if (isAnonymousZen(provider)) return "free";
392
+ if (signedInSubscriptionProviders([provider]).length > 0) return "sign-in";
393
+ if (provider.source?.kind === "probe") return "local";
394
+ return "key";
395
+ }
396
+ __name(automaticKind, "automaticKind");
397
+ function automaticRank(provider) {
398
+ return AUTOMATIC_ORDER.indexOf(automaticKind(provider));
399
+ }
400
+ __name(automaticRank, "automaticRank");
401
+ function automaticChoice(detected) {
402
+ const ranked = [...detected].sort((left, right) => automaticRank(left) - automaticRank(right));
403
+ const provider = ranked[0];
404
+ return provider ? { provider, kind: automaticKind(provider) } : null;
405
+ }
406
+ __name(automaticChoice, "automaticChoice");
407
+ function describeAutomaticChoice(choice) {
408
+ const { provider, kind } = choice;
409
+ const product = provider.entry.label.replace(/\s*\(.*\)\s*$/, "").trim() || provider.entry.label;
410
+ switch (kind) {
411
+ case "sign-in": {
412
+ const account = provider.entry.id === "anthropic" ? "Claude" : provider.entry.id === "codex" ? "ChatGPT or Codex" : product;
413
+ return `Using your ${account} sign-in, found on this computer.`;
414
+ }
415
+ case "key":
416
+ return `Using your ${product} key, found on this computer.`;
417
+ case "local":
418
+ return `Using ${product} running on this computer.`;
419
+ case "free":
420
+ return "Using Zen's free models (experimental).";
421
+ }
422
+ }
423
+ __name(describeAutomaticChoice, "describeAutomaticChoice");
424
+ async function probe(url, opts) {
425
+ const fetchFn = opts.fetch ?? globalThis.fetch;
426
+ const controller = new AbortController();
427
+ const timer = setTimeout(
428
+ () => controller.abort(),
429
+ opts.probeTimeoutMs ?? DEFAULT_PROBE_TIMEOUT_MS
430
+ );
431
+ try {
432
+ const res = await fetchFn(url, {
433
+ method: "GET",
434
+ signal: controller.signal
435
+ });
436
+ return res.ok;
437
+ } catch {
438
+ return false;
439
+ } finally {
440
+ clearTimeout(timer);
441
+ }
442
+ }
443
+ __name(probe, "probe");
444
+ function findDetected(list, id) {
445
+ return list.find((d) => d.entry.id === id) ?? null;
446
+ }
447
+ __name(findDetected, "findDetected");
448
+
449
+ // src/integrations/providers/preferences.ts
450
+ import { randomBytes } from "node:crypto";
451
+ import { chmodSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs";
452
+ import { dirname, join as join2 } from "node:path";
453
+ var FILE_MODE = 384;
454
+ var DIR_MODE = 448;
455
+ var PREFERENCES_FILE_VERSION = 3;
456
+ function chainPositionName(index) {
457
+ return index === 0 ? "primary provider" : `fallback #${index}`;
458
+ }
459
+ __name(chainPositionName, "chainPositionName");
460
+ var PreferencesError = class extends Error {
461
+ static {
462
+ __name(this, "PreferencesError");
463
+ }
464
+ constructor(message) {
465
+ super(message);
466
+ this.name = "PreferencesError";
467
+ }
468
+ };
469
+ function primaryProvider(prefs) {
470
+ const first = prefs.providers?.[0];
471
+ if (!first) {
472
+ throw new PreferencesError("preferences.providers is empty \u2014 no provider to run");
473
+ }
474
+ return first;
475
+ }
476
+ __name(primaryProvider, "primaryProvider");
477
+ function preferencesPath(home) {
478
+ return join2(namzuHomePath(home), "preferences.json");
479
+ }
480
+ __name(preferencesPath, "preferencesPath");
481
+ function readPreferences(home) {
482
+ const path = preferencesPath(home);
483
+ let raw;
484
+ try {
485
+ raw = readFileSync(path, "utf8");
486
+ } catch (err) {
487
+ if (err.code === "ENOENT") return { status: "missing" };
488
+ throw new PreferencesError(
489
+ `could not read ${path}: ${err instanceof Error ? err.message : String(err)}`
490
+ );
491
+ }
492
+ let parsed;
493
+ try {
494
+ parsed = JSON.parse(raw);
495
+ } catch (err) {
496
+ throw new PreferencesError(
497
+ `${path} is not valid JSON: ${err instanceof Error ? err.message : String(err)}`
498
+ );
499
+ }
500
+ if (typeof parsed !== "object" || parsed === null) {
501
+ throw new PreferencesError(`${path} top-level must be an object`);
502
+ }
503
+ const v = parsed;
504
+ if (v.version === 1) {
505
+ return {
506
+ status: "needs-repick",
507
+ reason: "preferences file uses an older schema (v1) \u2014 namzu now picks an LLM provider client directly. Please re-pick."
508
+ };
509
+ }
510
+ if (v.version === 2) {
511
+ const migrated = migrateV2(parsed);
512
+ if (!migrated) {
513
+ throw new PreferencesError(`${path} has an unexpected shape for a v2 file`);
514
+ }
515
+ const invalid2 = describeInvalidChain(migrated.providers);
516
+ if (invalid2) return { status: "needs-repick", reason: `${invalid2} \u2014 please re-pick.` };
517
+ return { status: "ok", prefs: migrated };
518
+ }
519
+ if (v.version !== PREFERENCES_FILE_VERSION) {
520
+ return {
521
+ status: "needs-repick",
522
+ reason: `preferences file at unsupported version ${String(v.version)} \u2014 please re-pick.`
523
+ };
524
+ }
525
+ if (!isPreferences(parsed)) {
526
+ throw new PreferencesError(`${path} has an unexpected shape`);
527
+ }
528
+ const invalid = describeInvalidChain(parsed.providers);
529
+ if (invalid) return { status: "needs-repick", reason: `${invalid} \u2014 please re-pick.` };
530
+ return { status: "ok", prefs: parsed };
531
+ }
532
+ __name(readPreferences, "readPreferences");
533
+ function writePreferences(prefs, home) {
534
+ if (prefs.version !== PREFERENCES_FILE_VERSION) {
535
+ throw new PreferencesError(
536
+ `unsupported preferences version: ${String(prefs.version)} (expected ${PREFERENCES_FILE_VERSION})`
537
+ );
538
+ }
539
+ if (!Array.isArray(prefs.providers) || prefs.providers.length === 0) {
540
+ throw new PreferencesError("preferences.providers must list at least one provider");
541
+ }
542
+ const invalid = describeInvalidChain(prefs.providers);
543
+ if (invalid) throw new PreferencesError(invalid);
544
+ const path = preferencesPath(home);
545
+ mkdirSync(dirname(path), { recursive: true, mode: DIR_MODE });
546
+ const body = `${JSON.stringify(prefs, null, 2)}
547
+ `;
548
+ const tmp = `${path}.tmp.${process.pid}.${randomBytes(4).toString("hex")}`;
549
+ writeFileSync(tmp, body, { mode: FILE_MODE });
550
+ chmodSync(tmp, FILE_MODE);
551
+ renameSync(tmp, path);
552
+ }
553
+ __name(writePreferences, "writePreferences");
554
+ function migrateV2(value) {
555
+ const v = value;
556
+ if (typeof v.provider !== "string" || v.provider.length === 0) return null;
557
+ if (v.model !== void 0 && typeof v.model !== "string") return null;
558
+ if (!isSubagents(v.subagents)) return null;
559
+ const member = {
560
+ id: v.provider,
561
+ ...typeof v.model === "string" ? { model: v.model } : {}
562
+ };
563
+ return {
564
+ version: PREFERENCES_FILE_VERSION,
565
+ providers: [member],
566
+ ...v.subagents !== void 0 ? { subagents: v.subagents } : {}
567
+ };
568
+ }
569
+ __name(migrateV2, "migrateV2");
570
+ function describeInvalidChain(members) {
571
+ if (members.length === 0) {
572
+ return "preferences lists no providers";
573
+ }
574
+ const seen = /* @__PURE__ */ new Set();
575
+ for (const [index, member] of members.entries()) {
576
+ const position = chainPositionName(index);
577
+ if (!(member.id in PROVIDER_REGISTRY)) {
578
+ return `${position} "${member.id}" is not a provider namzu knows (known: ${Object.keys(PROVIDER_REGISTRY).join(", ")})`;
579
+ }
580
+ if (index === 0 && !PROVIDER_REGISTRY[member.id].constructible) {
581
+ return unsupportedProviderMessage(member.id);
582
+ }
583
+ const key = JSON.stringify([member.id, member.model ?? null, member.account ?? null]);
584
+ if (seen.has(key)) {
585
+ const shown = member.model ? `${member.id} (${member.model})` : member.id;
586
+ return `${position} repeats "${shown}", which is already earlier in the chain \u2014 a provider cannot be its own fallback`;
587
+ }
588
+ seen.add(key);
589
+ }
590
+ return null;
591
+ }
592
+ __name(describeInvalidChain, "describeInvalidChain");
593
+ function isSubagents(value) {
594
+ if (value === void 0) return true;
595
+ if (typeof value !== "object" || value === null) return false;
596
+ const sa = value;
597
+ if (!Array.isArray(sa.active)) return false;
598
+ for (const item of sa.active) {
599
+ if (typeof item !== "string") return false;
600
+ }
601
+ return true;
602
+ }
603
+ __name(isSubagents, "isSubagents");
604
+ function isProviderChoice(value) {
605
+ if (typeof value !== "object" || value === null) return false;
606
+ const v = value;
607
+ if (typeof v.id !== "string" || v.id.length === 0) return false;
608
+ if (v.model !== void 0 && typeof v.model !== "string") return false;
609
+ if (v.account !== void 0 && (typeof v.account !== "string" || v.account.length === 0)) {
610
+ return false;
611
+ }
612
+ return true;
613
+ }
614
+ __name(isProviderChoice, "isProviderChoice");
615
+ function isPreferences(value) {
616
+ if (typeof value !== "object" || value === null) return false;
617
+ const v = value;
618
+ if (v.version !== PREFERENCES_FILE_VERSION) return false;
619
+ if (!Array.isArray(v.providers)) return false;
620
+ for (const member of v.providers) {
621
+ if (!isProviderChoice(member)) return false;
622
+ }
623
+ if (v.allowCapabilityMismatch !== void 0 && typeof v.allowCapabilityMismatch !== "boolean") {
624
+ return false;
625
+ }
626
+ if (!isSubagents(v.subagents)) return false;
627
+ return true;
628
+ }
629
+ __name(isPreferences, "isPreferences");
630
+
631
+ // src/integrations/providers/chain-capabilities.ts
632
+ var BOOLEAN_CAPABILITIES = [
633
+ {
634
+ key: "supportsTools",
635
+ has: "it can call tools",
636
+ lacks: "it cannot call tools",
637
+ consequence: "tools become unavailable"
638
+ },
639
+ {
640
+ key: "supportsFunctionCalling",
641
+ has: "it supports function calling",
642
+ lacks: "it does not support function calling",
643
+ consequence: "function calling becomes unavailable"
644
+ },
645
+ {
646
+ key: "supportsStreaming",
647
+ has: "it can stream replies",
648
+ lacks: "it cannot stream replies",
649
+ consequence: "replies stop streaming"
650
+ },
651
+ {
652
+ key: "supportsVision",
653
+ has: "it can read image attachments",
654
+ lacks: "it cannot read image attachments",
655
+ consequence: "image attachments stop being sent"
656
+ },
657
+ {
658
+ key: "supportsDocuments",
659
+ has: "it can read document attachments",
660
+ lacks: "it cannot read document attachments",
661
+ consequence: "document attachments stop being sent"
662
+ }
663
+ ];
664
+ function describe(index, member) {
665
+ const entry = PROVIDER_REGISTRY[member.id];
666
+ return `${chainPositionName(index)} (${entry ? entry.label : member.id})`;
667
+ }
668
+ __name(describe, "describe");
669
+ function chainCapabilityDisagreements(members, resolved) {
670
+ const out = [];
671
+ for (const capability of BOOLEAN_CAPABILITIES) {
672
+ const firstWithIt = resolved.findIndex(
673
+ (entry) => entry.kind === "known" && entry.capabilities[capability.key] === true
674
+ );
675
+ if (firstWithIt === -1) continue;
676
+ const has = members[firstWithIt];
677
+ if (!has) continue;
678
+ for (const [index, entry] of resolved.entries()) {
679
+ if (entry.kind !== "known" || index === firstWithIt) continue;
680
+ if (entry.capabilities[capability.key] === true) continue;
681
+ const lacks = members[index];
682
+ if (!lacks) continue;
683
+ out.push({
684
+ declaredBy: firstWithIt,
685
+ missingFrom: index,
686
+ sentence: `${describe(index, lacks)} declares ${capability.lacks}, while ${describe(firstWithIt, has)} declares ${capability.has} \u2014 if the chain falls over to it, ${capability.consequence}.`
687
+ });
688
+ }
689
+ }
690
+ out.push(...ceilingDisagreements(members, resolved));
691
+ return out;
692
+ }
693
+ __name(chainCapabilityDisagreements, "chainCapabilityDisagreements");
694
+ function ceilingDisagreements(members, resolved) {
695
+ const ceilings = [];
696
+ for (const [index, entry] of resolved.entries()) {
697
+ if (entry.kind !== "known") continue;
698
+ const value = entry.capabilities.maxOutputTokens;
699
+ if (typeof value === "number") ceilings.push({ index, value });
700
+ }
701
+ let largest;
702
+ for (const ceiling of ceilings) {
703
+ if (!largest || ceiling.value > largest.value) largest = ceiling;
704
+ }
705
+ if (!largest) return [];
706
+ const out = [];
707
+ for (const ceiling of ceilings) {
708
+ if (ceiling.value >= largest.value) continue;
709
+ const has = members[largest.index];
710
+ const lacks = members[ceiling.index];
711
+ if (!has || !lacks) continue;
712
+ out.push({
713
+ declaredBy: largest.index,
714
+ missingFrom: ceiling.index,
715
+ sentence: `${describe(ceiling.index, lacks)} declares a maximum output of ${ceiling.value} tokens, below ${describe(largest.index, has)} at ${largest.value} \u2014 if the chain falls over to it, replies are capped at ${ceiling.value}.`
716
+ });
717
+ }
718
+ return out;
719
+ }
720
+ __name(ceilingDisagreements, "ceilingDisagreements");
721
+ function unresolvedMembers(members, resolved) {
722
+ const out = [];
723
+ for (const [index, entry] of resolved.entries()) {
724
+ const member = members[index];
725
+ if (entry.kind !== "unresolved" || !member) continue;
726
+ out.push(`${describe(index, member)}: ${entry.reason}`);
727
+ }
728
+ return out;
729
+ }
730
+ __name(unresolvedMembers, "unresolvedMembers");
731
+ function describeCapabilityRefusal(disagreements) {
732
+ if (disagreements.length === 0) return null;
733
+ return [
734
+ "The providers in your chain declare different capabilities, so namzu cannot honour the chain as written:",
735
+ ...disagreements.map((d) => ` - ${d.sentence}`),
736
+ "",
737
+ "Taking the strongest answer would advertise abilities a fallback does not have. Taking the weakest would cost your primary a capability on every turn, to guard against a failure that happens rarely. Neither is chosen for you.",
738
+ 'Either drop the member that disagrees, or set "allowCapabilityMismatch": true in ~/.namzu/preferences.json to accept the limitation \u2014 it is printed on every launch.'
739
+ ].join("\n");
740
+ }
741
+ __name(describeCapabilityRefusal, "describeCapabilityRefusal");
742
+ function describeAcceptedMismatch(disagreements) {
743
+ if (disagreements.length === 0) return null;
744
+ return [
745
+ "Provider chain: the members declare different capabilities, and you have accepted that.",
746
+ ...disagreements.map((d) => ` - ${d.sentence}`)
747
+ ].join("\n");
748
+ }
749
+ __name(describeAcceptedMismatch, "describeAcceptedMismatch");
750
+
751
+ // src/integrations/providers/register.ts
752
+ var registered = /* @__PURE__ */ new Set();
753
+ async function ensureRegistered(id) {
754
+ if (registered.has(id)) return;
755
+ switch (id) {
756
+ case "anthropic": {
757
+ const mod = await import("./dist-L5LBM77I.js");
758
+ mod.registerAnthropic();
759
+ break;
760
+ }
761
+ case "google": {
762
+ const mod = await import("./dist-RTIKLSUV.js");
763
+ mod.registerGoogle();
764
+ break;
765
+ }
766
+ case "openai": {
767
+ const mod = await import("./dist-T6KE7URX.js");
768
+ mod.registerOpenAI();
769
+ break;
770
+ }
771
+ case "codex": {
772
+ const mod = await import("./dist-T6KE7URX.js");
773
+ mod.registerCodex();
774
+ break;
775
+ }
776
+ case "deepseek": {
777
+ const mod = await import("./dist-H53G25BE.js");
778
+ mod.registerDeepSeek();
779
+ break;
780
+ }
781
+ case "openrouter": {
782
+ const mod = await import("./dist-XNGK3C4G.js");
783
+ mod.registerOpenRouter();
784
+ break;
785
+ }
786
+ case "zen": {
787
+ const mod = await import("./dist-6IPPA55L.js");
788
+ mod.registerZen();
789
+ break;
790
+ }
791
+ case "zen-go": {
792
+ const mod = await import("./dist-6IPPA55L.js");
793
+ mod.registerZenGo();
794
+ break;
795
+ }
796
+ case "ollama": {
797
+ const mod = await import("./dist-RIH2Q2ER.js");
798
+ mod.registerOllama();
799
+ break;
800
+ }
801
+ default:
802
+ throw new Error(unsupportedProviderMessage(id));
803
+ }
804
+ registered.add(id);
805
+ }
806
+ __name(ensureRegistered, "ensureRegistered");
807
+ function isRegistered(id) {
808
+ return registered.has(id);
809
+ }
810
+ __name(isRegistered, "isRegistered");
811
+ async function resolveChainCapabilities(members) {
812
+ const out = [];
813
+ for (const member of members) {
814
+ if (!(member.id in PROVIDER_REGISTRY)) {
815
+ out.push({
816
+ kind: "unresolved",
817
+ reason: `"${member.id}" is not a provider namzu knows`
818
+ });
819
+ continue;
820
+ }
821
+ try {
822
+ await ensureRegistered(member.id);
823
+ out.push({
824
+ kind: "known",
825
+ capabilities: resolveProviderCapabilities({
826
+ capabilities: ProviderRegistry.getCapabilities(member.id)
827
+ })
828
+ });
829
+ } catch (err) {
830
+ out.push({
831
+ kind: "unresolved",
832
+ reason: err instanceof Error ? err.message : String(err)
833
+ });
834
+ }
835
+ }
836
+ return out;
837
+ }
838
+ __name(resolveChainCapabilities, "resolveChainCapabilities");
839
+
840
+ export {
841
+ hasApiCredential,
842
+ requiresCredentialForModel,
843
+ canSelectModel,
844
+ createGeminiAccessTokenResolver,
845
+ signedInSubscriptionProviders,
846
+ discoverProviders,
847
+ isAnonymousZen,
848
+ automaticKind,
849
+ automaticChoice,
850
+ describeAutomaticChoice,
851
+ findDetected,
852
+ PREFERENCES_FILE_VERSION,
853
+ chainPositionName,
854
+ PreferencesError,
855
+ primaryProvider,
856
+ preferencesPath,
857
+ readPreferences,
858
+ writePreferences,
859
+ chainCapabilityDisagreements,
860
+ unresolvedMembers,
861
+ describeCapabilityRefusal,
862
+ describeAcceptedMismatch,
863
+ ensureRegistered,
864
+ isRegistered,
865
+ resolveChainCapabilities
866
+ };
867
+ //# sourceMappingURL=chunk-26C37THH.js.map