@qwen-code/qwen-code 0.23.5-preview.0 → 0.24.0-nightly.20260917.f822124af5

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 (498) hide show
  1. package/bundled/goal-draft/SKILL.md +5 -5
  2. package/bundled/qc-helper/docs/configuration/auth.md +1 -0
  3. package/bundled/qc-helper/docs/configuration/model-providers.md +43 -14
  4. package/bundled/qc-helper/docs/configuration/settings.md +2 -1
  5. package/bundled/qc-helper/docs/extension/introduction.md +2 -0
  6. package/bundled/qc-helper/docs/features/_meta.ts +1 -0
  7. package/bundled/qc-helper/docs/features/goals.md +11 -11
  8. package/bundled/qc-helper/docs/features/hooks.md +8 -10
  9. package/bundled/qc-helper/docs/features/omni-fixed-policies-preset.json +242 -0
  10. package/bundled/qc-helper/docs/features/omni-media-policies.md +443 -0
  11. package/bundled/qc-helper/docs/overview.md +1 -1
  12. package/bundled/qc-helper/docs/quickstart.md +2 -3
  13. package/bundled/review/SKILL.md +1 -1
  14. package/bundled/workflow-authoring/SKILL.md +22 -7
  15. package/chunks/MaxSizedBox-4VDYUHUI.js +148 -0
  16. package/chunks/{StandaloneSessionPicker-V635V72I.js → StandaloneSessionPicker-SGMGJOH3.js} +115 -91
  17. package/chunks/acp-subagent-executor-EGAATYQA.js +164 -0
  18. package/chunks/{acpAgent-3DPWZTNC.js → acpAgent-2JQ2N2T5.js} +361 -229
  19. package/chunks/{agent-KIHGINKN.js → agent-QWNE3MPD.js} +59 -49
  20. package/chunks/agent-headless-GRSMZK5Z.js +104 -0
  21. package/chunks/{anthropicContentGenerator-4FGOM5LK.js → anthropicContentGenerator-INV24RMG.js} +30 -27
  22. package/chunks/{artifact-tool-MUTNH4NI.js → artifact-tool-3MWM6SN2.js} +11 -7
  23. package/chunks/{askUserQuestion-AKIRLVB5.js → askUserQuestion-YFFBB4K3.js} +6 -4
  24. package/chunks/bridge-R65BJ2YL.js +156 -0
  25. package/chunks/{build-5KWQBWEQ.js → build-5OQN7CDU.js} +1 -1
  26. package/chunks/caption-audio-UXXLI3JZ.js +443 -0
  27. package/chunks/caption-image-B7O4TUFP.js +247 -0
  28. package/chunks/{channel-management-service-RRILWSXX.js → channel-management-service-GRJG5R46.js} +1 -1
  29. package/chunks/channel-settings-store-TBLCDTV2.js +158 -0
  30. package/chunks/{channel-worker-group-3DUJFZJR.js → channel-worker-group-SCSKCSBJ.js} +4 -4
  31. package/chunks/{channel-worker-manager-E5UW2VLA.js → channel-worker-manager-AHCZCKON.js} +4 -4
  32. package/chunks/{channel-worker-supervisor-VN33GSEC.js → channel-worker-supervisor-BGUAVITB.js} +3 -3
  33. package/chunks/{chunk-5NUKK2DT.js → chunk-25FMWESU.js} +47 -8
  34. package/chunks/{chunk-VVI7MK3V.js → chunk-2A6RZKP2.js} +9 -7
  35. package/chunks/{chunk-3WWPEFMX.js → chunk-2FQM443D.js} +82 -4
  36. package/chunks/{chunk-D3KVGQUV.js → chunk-37XDTMFG.js} +4 -4
  37. package/chunks/{chunk-TDKUXSJO.js → chunk-3MW6PPA5.js} +1 -1
  38. package/chunks/{chunk-4LIPOIXS.js → chunk-3NHJLWOD.js} +1 -1
  39. package/chunks/{chunk-AQP3H22J.js → chunk-3ZGIRRAE.js} +1 -1
  40. package/chunks/{chunk-WSJI6ODG.js → chunk-422D2UIO.js} +210 -150
  41. package/chunks/chunk-43QUA4MC.js +135 -0
  42. package/chunks/{chunk-Q2SAQTEJ.js → chunk-4B7U3KQP.js} +1 -1
  43. package/chunks/{chunk-SFL6U7U7.js → chunk-4JFRCIMW.js} +2 -2
  44. package/chunks/{chunk-IVFTLUZD.js → chunk-4SZ2636R.js} +3 -3
  45. package/chunks/{chunk-6OTF7TTE.js → chunk-4VYTH6OF.js} +24 -1
  46. package/chunks/{chunk-7CLLH5TI.js → chunk-4YS7RMCB.js} +6 -4
  47. package/chunks/{chunk-BW2SMO6L.js → chunk-5FHOPPLZ.js} +1 -1
  48. package/chunks/{chunk-QIPLWW6Q.js → chunk-5MYQ66UF.js} +1 -1
  49. package/chunks/{chunk-TXTCM3TC.js → chunk-5VDOVBNG.js} +18 -14
  50. package/chunks/{chunk-L2A5VBDL.js → chunk-67ZCKSV6.js} +9 -9
  51. package/chunks/chunk-6C3D7BKK.js +153 -0
  52. package/chunks/{chunk-DC4ZNGH4.js → chunk-6DB6UHY3.js} +3 -3
  53. package/chunks/{chunk-AXPOOQAW.js → chunk-736AZVPL.js} +2 -2
  54. package/chunks/{chunk-M22WLKLI.js → chunk-77ORAIEF.js} +7 -7
  55. package/chunks/{chunk-BUQN5LTI.js → chunk-7PQ65Z5F.js} +2 -2
  56. package/chunks/{chunk-CXY6BICQ.js → chunk-A5EGR6ZS.js} +204 -120
  57. package/chunks/{chunk-VQDWCQOE.js → chunk-ANKISCKU.js} +1 -0
  58. package/chunks/{chunk-7D4CV7JH.js → chunk-APHDK7GV.js} +116 -4
  59. package/chunks/{chunk-B5TJK7B3.js → chunk-ARKOX7HM.js} +1 -1
  60. package/chunks/{chunk-NXUZFW3G.js → chunk-AUFTA63J.js} +1 -1
  61. package/chunks/{chunk-36SDZ2Q4.js → chunk-B3HGO6BB.js} +7 -5
  62. package/chunks/{chunk-6USYH3EU.js → chunk-B3XJFEEH.js} +5 -3
  63. package/chunks/{chunk-AEWCOE64.js → chunk-B5WYAQ4I.js} +2 -2
  64. package/chunks/{chunk-GSKX53AN.js → chunk-BA6AXQDA.js} +1 -1
  65. package/chunks/{chunk-Y2KJC55Y.js → chunk-BBHLWLIK.js} +4 -4
  66. package/chunks/chunk-BKVPLSEI.js +133 -0
  67. package/chunks/chunk-BQMSZSG6.js +21 -0
  68. package/chunks/{chunk-3LMDSCLU.js → chunk-C4FISGDN.js} +2 -2
  69. package/chunks/{chunk-SFHX5G2S.js → chunk-C4MMZVYX.js} +80 -15
  70. package/chunks/{chunk-4JFLRHNE.js → chunk-C4QWV63F.js} +1 -1
  71. package/chunks/{chunk-XFFRI3WM.js → chunk-CA63HYHU.js} +4 -2
  72. package/chunks/{chunk-FBY32737.js → chunk-CJNWKJFH.js} +4 -4
  73. package/chunks/{chunk-QT6Z2IBF.js → chunk-CYFQLCCG.js} +2 -2
  74. package/chunks/{chunk-X7AYIXC7.js → chunk-DJLCK66M.js} +5 -3
  75. package/chunks/chunk-DJYHML3Y.js +121 -0
  76. package/chunks/{chunk-MO4XID7S.js → chunk-DNDECZXY.js} +3 -3
  77. package/chunks/{chunk-H6L4NEAT.js → chunk-DQCGGSDO.js} +1 -1
  78. package/chunks/{chunk-347O2YZJ.js → chunk-DUWQ5Q6R.js} +115 -67
  79. package/chunks/{chunk-FEDFZBGR.js → chunk-E6A52AP2.js} +28 -17
  80. package/chunks/{chunk-TIGXX4PA.js → chunk-EKBQJ627.js} +2 -2
  81. package/chunks/{chunk-RSWBT7AZ.js → chunk-ERIBG3BX.js} +35 -551
  82. package/chunks/{chunk-PPJSG2PU.js → chunk-EVZT24AF.js} +6 -142
  83. package/chunks/{chunk-YZXSDPOQ.js → chunk-F7L4ZMKS.js} +84 -40
  84. package/chunks/{chunk-HX4WXX3H.js → chunk-FGAWVV4X.js} +101 -75
  85. package/chunks/chunk-FT3O44AZ.js +1635 -0
  86. package/chunks/chunk-FTKXJMQV.js +255 -0
  87. package/chunks/{chunk-5FK4MSHB.js → chunk-FWP5GZRY.js} +6 -4
  88. package/chunks/{chunk-TRZ22SG5.js → chunk-FXPP7VLM.js} +6 -4
  89. package/chunks/{chunk-INN5ORKX.js → chunk-G25IQMCV.js} +1 -1
  90. package/chunks/{chunk-OWUAZXXN.js → chunk-GHG4PQY2.js} +3 -3
  91. package/chunks/{chunk-FASYATAZ.js → chunk-GL5TRVMS.js} +1 -1
  92. package/chunks/{chunk-G45B3INR.js → chunk-GVTAFLWB.js} +2 -2
  93. package/chunks/{chunk-G6UUOCUT.js → chunk-GXNXX7A2.js} +7 -1
  94. package/chunks/{chunk-GI7SLDOI.js → chunk-HUUBCY33.js} +6 -6
  95. package/chunks/chunk-I7MIPRIQ.js +181 -0
  96. package/chunks/{chunk-NQ272MQG.js → chunk-IAKJXTGS.js} +7 -5
  97. package/chunks/{chunk-V4JJAVHQ.js → chunk-ID7XHHY5.js} +2 -2
  98. package/chunks/{chunk-IXO2OCIP.js → chunk-IIHFUREY.js} +12 -8
  99. package/chunks/{chunk-IZ2U57NY.js → chunk-IITTKFWM.js} +4 -2
  100. package/chunks/chunk-IVPSLX4P.js +578 -0
  101. package/chunks/{chunk-BTICBRPL.js → chunk-IWMYX5LB.js} +3 -3
  102. package/chunks/{chunk-UZSB57EV.js → chunk-JR2WFCQG.js} +29 -17
  103. package/chunks/{chunk-GJKP6XOB.js → chunk-JWV5GI77.js} +16 -19
  104. package/chunks/chunk-JYGESWZM.js +149 -0
  105. package/chunks/{chunk-KVC7HZWK.js → chunk-JYTJ5FCM.js} +1 -1
  106. package/chunks/{chunk-SOLRBF7L.js → chunk-JZUSFW64.js} +10 -10
  107. package/chunks/{chunk-CDDP4ONL.js → chunk-K2T5PKFS.js} +60 -134
  108. package/chunks/{chunk-EIBECN2J.js → chunk-K5VVDHDV.js} +5 -5
  109. package/chunks/{chunk-NKTMUPHJ.js → chunk-KDM4KSVG.js} +14 -4
  110. package/chunks/{chunk-3WILPKTJ.js → chunk-KKPIFWTZ.js} +11 -6
  111. package/chunks/{chunk-3HTUE6ZR.js → chunk-KPK6NQVR.js} +4 -4
  112. package/chunks/{chunk-CXONOVBN.js → chunk-KS6F6LZQ.js} +8 -6
  113. package/chunks/{chunk-D7JMO2GP.js → chunk-KSECLXYH.js} +1 -1
  114. package/chunks/chunk-KSEKRQJO.js +253 -0
  115. package/chunks/{chunk-KEM7MWS7.js → chunk-KWZ2DDOC.js} +765 -428
  116. package/chunks/{chunk-U4AASWUQ.js → chunk-L4GF4IK2.js} +3 -3
  117. package/chunks/{chunk-CQPM66MG.js → chunk-L7HFHYGB.js} +4 -4
  118. package/chunks/{chunk-DJXSOEFB.js → chunk-LAE6RY3L.js} +1 -1
  119. package/chunks/{chunk-WNQIJTOP.js → chunk-LDM3JQZF.js} +243 -17
  120. package/chunks/{chunk-KVQ3QL4K.js → chunk-LLTRNLK2.js} +3 -3
  121. package/chunks/{chunk-IKBEIDOH.js → chunk-LVXTBFWP.js} +13 -13
  122. package/chunks/{chunk-AKRSSKUT.js → chunk-LWALWKFU.js} +10 -10
  123. package/chunks/{chunk-WL36KHUQ.js → chunk-LWV4RLBT.js} +11 -9
  124. package/chunks/{chunk-3BZI5GDP.js → chunk-M5YIHMXP.js} +6 -4
  125. package/chunks/{chunk-6WXVEDT2.js → chunk-MC2RYJMU.js} +5 -3
  126. package/chunks/chunk-MNU36NGH.js +233 -0
  127. package/chunks/{chunk-ZMYKNKET.js → chunk-MQWZWHTY.js} +3 -3
  128. package/chunks/{chunk-M4U2LTD2.js → chunk-MS4SXNJ6.js} +1 -1
  129. package/chunks/{chunk-QHSOINX6.js → chunk-MZKXPQWL.js} +2 -2
  130. package/chunks/{chunk-36NRLIR6.js → chunk-NBLWUMYE.js} +13 -11
  131. package/chunks/{chunk-DRAX5YAI.js → chunk-NFC4WTY2.js} +6 -4
  132. package/chunks/chunk-NX6JUO42.js +102 -0
  133. package/chunks/chunk-O345BAI3.js +42 -0
  134. package/chunks/{chunk-YM6KUQ2S.js → chunk-O4A2B6V2.js} +3 -3
  135. package/chunks/chunk-O55EKI4S.js +7668 -0
  136. package/chunks/{chunk-3UGMLA4V.js → chunk-OA5H5PPQ.js} +10 -10
  137. package/chunks/{chunk-DX6JTDMR.js → chunk-OB57Y2WH.js} +1 -1
  138. package/chunks/{chunk-4QPVZA5J.js → chunk-OOSOAFCT.js} +3 -3
  139. package/chunks/{chunk-E2VSBAFA.js → chunk-OXBD7VUE.js} +5 -5
  140. package/chunks/{chunk-M23GFJ5B.js → chunk-OY5GQPMU.js} +1 -1
  141. package/chunks/chunk-PF3RVYRK.js +108 -0
  142. package/chunks/{chunk-XWJFDJZK.js → chunk-PJSZXERN.js} +1 -1
  143. package/chunks/{chunk-GSAOVDTH.js → chunk-POMFSBEC.js} +4 -4
  144. package/chunks/{chunk-EWNKP4V4.js → chunk-PPVM7YLS.js} +1 -1
  145. package/chunks/{chunk-WK6DEH3Q.js → chunk-PQQV3OBW.js} +6 -4
  146. package/chunks/{chunk-ZSTCM3MX.js → chunk-Q5N5NEVT.js} +1 -1
  147. package/chunks/{chunk-HYHSMTRA.js → chunk-QCTWNYL6.js} +4 -4
  148. package/chunks/{chunk-KFFCDLKV.js → chunk-QE36VXWP.js} +1 -1
  149. package/chunks/{chunk-3LLEB5CU.js → chunk-QG73VXTF.js} +2 -2
  150. package/chunks/{chunk-QMENOK5T.js → chunk-QJJN2VJY.js} +10 -8
  151. package/chunks/{chunk-XICCGDWF.js → chunk-QKYAXSNG.js} +2 -2
  152. package/chunks/{chunk-V545KI73.js → chunk-QPTE6BKL.js} +1 -1
  153. package/chunks/{chunk-2GP6BQ2J.js → chunk-RA6PKQVM.js} +2 -2
  154. package/chunks/{chunk-TPY6HW55.js → chunk-RFAX4WKE.js} +13 -7
  155. package/chunks/chunk-RSFNJ6UU.js +1252 -0
  156. package/chunks/{chunk-EDIDYZBT.js → chunk-RVT5L74D.js} +1 -1
  157. package/chunks/{chunk-FCPJXKDG.js → chunk-RXDTMGUH.js} +9 -9
  158. package/chunks/{chunk-P42KMMU6.js → chunk-RZZLNI74.js} +27 -25
  159. package/chunks/{chunk-ZFHKUQZ4.js → chunk-S2R4L34O.js} +12 -5
  160. package/chunks/chunk-S34QJ6IR.js +290 -0
  161. package/chunks/chunk-S5BHLTHK.js +190 -0
  162. package/chunks/{chunk-2XRE4KE4.js → chunk-S7BE3FMA.js} +1 -1
  163. package/chunks/{chunk-7O5PYQ3M.js → chunk-SBP43AO6.js} +1 -1
  164. package/chunks/chunk-SLHYLVRW.js +1377 -0
  165. package/chunks/{chunk-SSWTA7CH.js → chunk-SLV3GU2S.js} +12 -12
  166. package/chunks/chunk-SLVJ55G3.js +11397 -0
  167. package/chunks/{chunk-5VQR2DD7.js → chunk-SQRZJD25.js} +5 -3
  168. package/chunks/{chunk-K4XMAIRX.js → chunk-SRFYBJ4P.js} +14 -14
  169. package/chunks/{chunk-Y4NNIGYO.js → chunk-SSFOFDNL.js} +1 -1
  170. package/chunks/{chunk-NFXXBWSE.js → chunk-SU64336V.js} +2 -2
  171. package/chunks/{chunk-RRI764F7.js → chunk-SWHBXWVS.js} +45 -26
  172. package/chunks/{chunk-BHVF3R6B.js → chunk-TAMBGU42.js} +4 -4
  173. package/chunks/chunk-TFDCK56Y.js +154 -0
  174. package/chunks/{chunk-Q54O3EIA.js → chunk-TNTYSST7.js} +55 -33
  175. package/chunks/{chunk-JRHKM3YQ.js → chunk-TS4JJ7NN.js} +2 -2
  176. package/chunks/{chunk-VEXUA6DX.js → chunk-TWD6EZLA.js} +13 -11
  177. package/chunks/{chunk-WZWTY7SG.js → chunk-TZ4QKMPU.js} +6 -6
  178. package/chunks/{chunk-C4HBZQNH.js → chunk-U3MTHCJF.js} +1 -1
  179. package/chunks/{chunk-VU3XMZ5I.js → chunk-U3VIKF53.js} +3 -3
  180. package/chunks/{chunk-BHG3H6OZ.js → chunk-U4KO33OD.js} +1 -1
  181. package/chunks/{chunk-2C5TR6HN.js → chunk-UANUZBL2.js} +1 -1
  182. package/chunks/{chunk-Y53DG2HA.js → chunk-UIWUFHRJ.js} +1 -1
  183. package/chunks/{chunk-UQGRJTDK.js → chunk-UP3XL4VB.js} +3 -3
  184. package/chunks/{chunk-43Y26NPF.js → chunk-UR27ZXFZ.js} +3 -3
  185. package/chunks/{chunk-LO2UWNO5.js → chunk-UXC6MURF.js} +3 -3
  186. package/chunks/chunk-UXEI7POA.js +273 -0
  187. package/chunks/chunk-V2XJJTAB.js +228 -0
  188. package/chunks/chunk-VDNCKE2O.js +24 -0
  189. package/chunks/{chunk-YQQ2U7AS.js → chunk-VLBL6Q7X.js} +1 -1
  190. package/chunks/{chunk-HNFKYKHH.js → chunk-VNQTV5NC.js} +104 -26
  191. package/chunks/chunk-VPGRGNNH.js +578 -0
  192. package/chunks/{chunk-TKF4JINY.js → chunk-VVQ57VLE.js} +1 -1
  193. package/chunks/{chunk-AUX2FL5T.js → chunk-W2UTVLT2.js} +641 -11
  194. package/chunks/{chunk-SYMXYRM5.js → chunk-W7JWIIRC.js} +1 -1
  195. package/chunks/{chunk-WBSJ6VPZ.js → chunk-WDVSRQIQ.js} +3 -3
  196. package/chunks/{chunk-AZCTY64Z.js → chunk-WEUQIY3Q.js} +1 -1
  197. package/chunks/{chunk-FX6PZBOV.js → chunk-WHBL5HJF.js} +4 -4
  198. package/chunks/chunk-WL2V7PTE.js +78 -0
  199. package/chunks/{chunk-OSG23MR3.js → chunk-X3T5IOX6.js} +2 -2
  200. package/chunks/{chunk-OZEV3R3S.js → chunk-XYAB5R6E.js} +3 -3
  201. package/chunks/chunk-XZA32HII.js +19 -0
  202. package/chunks/{chunk-4FLUQWJ4.js → chunk-Y3Q5OK4D.js} +1 -1
  203. package/chunks/chunk-YDERQ7ZV.js +248 -0
  204. package/chunks/{chunk-QGEISOJ2.js → chunk-YKM7SY3N.js} +3 -3
  205. package/chunks/{chunk-HXUI5D4H.js → chunk-YRNAZIDX.js} +1 -1
  206. package/chunks/{chunk-MFDKHGTD.js → chunk-YRNLF4SV.js} +3 -1
  207. package/chunks/{chunk-3XBUCOWS.js → chunk-YSD6IY6F.js} +2 -2
  208. package/chunks/{chunk-CH2YDT6X.js → chunk-YVYK3JYU.js} +5 -3
  209. package/chunks/{chunk-YL3UJML3.js → chunk-YWDVNBGE.js} +4 -4
  210. package/chunks/{chunk-KAYC5FBN.js → chunk-Z3DLUFMT.js} +1595 -1399
  211. package/chunks/chunk-Z547XC3A.js +44 -0
  212. package/chunks/{chunk-B6RMK4ED.js → chunk-Z5UFM7P6.js} +9 -7
  213. package/chunks/chunk-ZAX2LW35.js +1330 -0
  214. package/chunks/{chunk-C3T6HPNM.js → chunk-ZGADNVME.js} +5 -5
  215. package/chunks/{chunk-M3JGHRMQ.js → chunk-ZJ7KIWG5.js} +1 -1
  216. package/chunks/{chunk-SYROIHU7.js → chunk-ZRQGTRHA.js} +4 -2
  217. package/chunks/{chunk-NCPFOLM2.js → chunk-ZTBP4SFC.js} +78 -18
  218. package/chunks/{chunk-ZAFYHRVY.js → chunk-ZYDMQCQP.js} +4 -274
  219. package/chunks/{chunk-YP2K3WOS.js → chunk-ZYLZNSBW.js} +7 -4
  220. package/chunks/clip-audio-SH4L7AEY.js +255 -0
  221. package/chunks/clip-image-BQRPECIS.js +239 -0
  222. package/chunks/clip-video-JIRMV5IH.js +277 -0
  223. package/chunks/{codex-subagent-executor-AEAIQZDC.js → codex-subagent-executor-BQZZ3Z4E.js} +92 -68
  224. package/chunks/config-3X4AXU45.js +21 -0
  225. package/chunks/config-T5RO4NJV.js +17 -0
  226. package/chunks/config-utils-65HZJG2Y.js +151 -0
  227. package/chunks/contextCommand-P2WZOTZP.js +144 -0
  228. package/chunks/convert-image-D52K2FFB.js +231 -0
  229. package/chunks/{core-runtime-ZI4RTOJQ.js → core-runtime-G7RWUDR5.js} +94 -67
  230. package/chunks/{create-sub-session-MSGNIM37.js → create-sub-session-6EDEANCD.js} +7 -5
  231. package/chunks/{create-sub-session-BBWFQARJ.js → create-sub-session-C6OHZMEI.js} +90 -66
  232. package/chunks/{cron-create-U2JJ5CCF.js → cron-create-GS7ORRO6.js} +8 -5
  233. package/chunks/{cron-delete-7DM4LJWD.js → cron-delete-3GGDNNXD.js} +8 -5
  234. package/chunks/{cron-list-VCUSZK2Y.js → cron-list-EX27DW4H.js} +8 -5
  235. package/chunks/{daemon-INCM4VBX.js → daemon-62G2N3ZH.js} +1 -1
  236. package/chunks/{daemon-git-worktree-guard-KECEMV6A.js → daemon-git-worktree-guard-Y5MRUXHR.js} +90 -66
  237. package/chunks/daemon-status-provider-ORUXPQJO.js +155 -0
  238. package/chunks/daemon-trust-policy-CG35YJC5.js +150 -0
  239. package/chunks/{daemon-trust-policy-monitor-546N5ZVL.js → daemon-trust-policy-monitor-PT2ZJL3A.js} +96 -72
  240. package/chunks/deferred-core-runtime-K74JXKVR.js +153 -0
  241. package/chunks/{display-image-QTHALY6N.js → display-image-L3A755PZ.js} +10 -7
  242. package/chunks/{dist-BNW423XT.js → dist-CXDHIHN4.js} +5 -0
  243. package/chunks/downsample-audio-LPDWX6GF.js +217 -0
  244. package/chunks/downsample-image-A5JEYIV5.js +249 -0
  245. package/chunks/downscale-video-4W5BX5KO.js +249 -0
  246. package/chunks/{earlyInputCapture-BXP7V2P3.js → earlyInputCapture-UJ3KFVZQ.js} +3 -2
  247. package/chunks/{edit-CMSQB7NP.js → edit-VBS2GF24.js} +68 -56
  248. package/chunks/{en-56QLKXS2.js → en-FCK6MBTI.js} +16 -0
  249. package/chunks/{enter-worktree-DA6A4XC5.js → enter-worktree-QK7DR5EF.js} +12 -9
  250. package/chunks/{enterPlanMode-UDPMNESD.js → enterPlanMode-WC33QFGB.js} +62 -51
  251. package/chunks/environment-HN47IXJZ.js +167 -0
  252. package/chunks/errors-JC3V3RJA.js +151 -0
  253. package/chunks/{exec-RPKEY6HP.js → exec-7CFNHYCV.js} +31 -9
  254. package/chunks/{exit-worktree-4H6Z2VQI.js → exit-worktree-62COYIHF.js} +14 -10
  255. package/chunks/exitPlanMode-7R7DYPUV.js +102 -0
  256. package/chunks/extract-audio-GSSZQV6G.js +229 -0
  257. package/chunks/extract-keyframes-Q6DRMQAJ.js +621 -0
  258. package/chunks/{fast-path-F2CYDDZ4.js → fast-path-WN7SASHV.js} +6 -6
  259. package/chunks/{fast-path-settings-N2VGRGDJ.js → fast-path-settings-ASPHHCAG.js} +2 -2
  260. package/chunks/ffmpeg-N4LIIVNR.js +21 -0
  261. package/chunks/{glob-Z2JMJKKN.js → glob-HHM36TVT.js} +63 -51
  262. package/chunks/{goal-tools-HXVVLGCV.js → goal-tools-JTF7S4FP.js} +59 -49
  263. package/chunks/{grep-H2I33VAO.js → grep-JB5DGQ3B.js} +13 -9
  264. package/chunks/handleAutoUpdate-GGFSWLAH.js +147 -0
  265. package/chunks/i18n-NYQWDZWJ.js +164 -0
  266. package/chunks/{image-gen-HIAZCB5T.js → image-gen-LX3C4V3R.js} +16 -11
  267. package/chunks/initializer-6IZ4SNMM.js +151 -0
  268. package/chunks/installationInfo-K4KMCK7Q.js +145 -0
  269. package/chunks/{keychain-token-storage-NQ5XWIPX.js → keychain-token-storage-ZZNRE6D4.js} +3 -2
  270. package/chunks/list-KAWCG4I6.js +154 -0
  271. package/chunks/{list-agents-EWDCEPIW.js → list-agents-HS6HH4DJ.js} +10 -7
  272. package/chunks/{llm-LSUBOJAR.js → llm-UAZU4HC5.js} +162 -135
  273. package/chunks/{llm-content-generator-MLIONRXE.js → llm-content-generator-M3MT4BP3.js} +11 -9
  274. package/chunks/loadedSettingsAdapter-XKUVLEYR.js +152 -0
  275. package/chunks/{loggingContentGenerator-TUPEXFMM.js → loggingContentGenerator-2WW2O46K.js} +74 -63
  276. package/chunks/{loop-wakeup-ZBVRI6VH.js → loop-wakeup-4B7OY3TV.js} +9 -6
  277. package/chunks/{ls-6ZB3BEIR.js → ls-EZ5PSWU2.js} +8 -5
  278. package/chunks/{lsp-M54FQARP.js → lsp-DYFFHKB3.js} +6 -3
  279. package/chunks/{managed-npm-update-WEA5XMFZ.js → managed-npm-update-VRSID5W3.js} +91 -67
  280. package/chunks/mcp-DQEPGE5B.js +148 -0
  281. package/chunks/memory-side-query-DRV7FXK4.js +221 -0
  282. package/chunks/model-call-collection-HXYIVZDO.js +171 -0
  283. package/chunks/model-configuration-5FJL5BJE.js +161 -0
  284. package/chunks/modelConfigUtils-UE3FDHG3.js +140 -0
  285. package/chunks/{monitor-CI7YE7MT.js → monitor-IRKGV3RU.js} +63 -51
  286. package/chunks/nonInteractiveCli-LF5DTTUJ.js +235 -0
  287. package/chunks/nonInteractiveToolExecutor-KGIGCNUC.js +101 -0
  288. package/chunks/{notebook-edit-3WCVRNGL.js → notebook-edit-E2NGGRVT.js} +63 -52
  289. package/chunks/ocr-image-Q4HYJ3U7.js +252 -0
  290. package/chunks/omni-EHZU5MVU.js +147 -0
  291. package/chunks/{openaiContentGenerator-OGILGUZE.js → openaiContentGenerator-VZ4QWOSU.js} +36 -31
  292. package/chunks/{openaiResponsesContentGenerator-NXOXUPFM.js → openaiResponsesContentGenerator-OQFPKE6V.js} +15 -12
  293. package/chunks/pidfile-OQREIPGE.js +151 -0
  294. package/chunks/{processUtils-O4II3RYH.js → processUtils-VFFEEP7L.js} +2 -2
  295. package/chunks/prompt-terminal-ledger-46ELXYOX.js +143 -0
  296. package/chunks/{qwenContentGenerator-I4LRYADV.js → qwenContentGenerator-H3CWSIV5.js} +70 -60
  297. package/chunks/{qwenOAuth2-3J66TOT5.js → qwenOAuth2-GD3UIYUP.js} +9 -8
  298. package/chunks/reactive-degrade-KRTLV22M.js +375 -0
  299. package/chunks/read-file-BSZJVJ4F.js +37 -0
  300. package/chunks/{read-mcp-resource-LPSWXVOD.js → read-mcp-resource-INJIV3UC.js} +8 -4
  301. package/chunks/recall-media-memory-tool-PEE2BWRY.js +198 -0
  302. package/chunks/{record-artifact-L3CFJOMA.js → record-artifact-KKW3AIMJ.js} +6 -4
  303. package/chunks/record-source-OZ7JQFJK.js +24 -0
  304. package/chunks/{report-findings-LY5HQY4K.js → report-findings-OZSLWYAS.js} +7 -5
  305. package/chunks/{request-shutdown-53SNYGVR.js → request-shutdown-NMWMWGNR.js} +12 -9
  306. package/chunks/resumeHistoryUtils-P33LLL4M.js +156 -0
  307. package/chunks/ripGrep-2FWQ6RU3.js +43 -0
  308. package/chunks/{run-qwen-serve-ZVEKGS7Y.js → run-qwen-serve-HMQ2QCS7.js} +85 -73
  309. package/chunks/runtime-5X746HBH.js +188 -0
  310. package/chunks/sandbox-5FENHQ3J.js +170 -0
  311. package/chunks/sandboxConfig-7V6K3L4N.js +138 -0
  312. package/chunks/scheduled-tasks-Z4YOCKQV.js +167 -0
  313. package/chunks/scheduler-64LTQG3P.js +160 -0
  314. package/chunks/{sdk-exporters-http-DR4G663K.js → sdk-exporters-http-SWXTEEVT.js} +3 -2
  315. package/chunks/{sdk-impl-SJR26MQF.js → sdk-impl-FK4JY6LX.js} +5 -4
  316. package/chunks/{send-message-DN76MXDX.js → send-message-SNCXOZA7.js} +16 -13
  317. package/chunks/serve-C56AM3HW.js +156 -0
  318. package/chunks/{server-UHMKPCAZ.js → server-5NPGYNJG.js} +2169 -529
  319. package/chunks/{session-ZLUK7E4P.js → session-JOY4PHTN.js} +152 -128
  320. package/chunks/session-attachments-root-765GPAJU.js +141 -0
  321. package/chunks/{session-pr-refresh-3OMTQWCZ.js → session-pr-refresh-JUKB3A7P.js} +95 -71
  322. package/chunks/{settings-P4DHIIUP.js → settings-P326ULSH.js} +95 -71
  323. package/chunks/{shell-IMFUVQQ5.js → shell-747O3UYW.js} +59 -49
  324. package/chunks/{skill-NB5RJGZW.js → skill-DOHHQC32.js} +22 -17
  325. package/chunks/skill-settings-RI5JR6ZG.js +164 -0
  326. package/chunks/spawnChannel-745P6IB6.js +152 -0
  327. package/chunks/standalone-update-JC4E4UEO.js +156 -0
  328. package/chunks/{start-opentui-ui-JKAIWGF7.js → start-opentui-ui-RC62XZUC.js} +1611 -800
  329. package/chunks/{startInteractiveUI-YRPOT6GH.js → startInteractiveUI-PIBA3ADH.js} +521 -374
  330. package/chunks/storage-VZECDJNX.js +17 -0
  331. package/chunks/{syntheticOutput-EX5L5GYI.js → syntheticOutput-SSXJ2NEY.js} +5 -3
  332. package/chunks/task-create-FD3EJI7F.js +30 -0
  333. package/chunks/{task-list-ZLJSMRFA.js → task-list-GA5GOR74.js} +9 -6
  334. package/chunks/{task-stop-MD7P6QGK.js → task-stop-3MXTDL7H.js} +6 -3
  335. package/chunks/{task-update-3LSYQDRW.js → task-update-YHFYE7L6.js} +16 -13
  336. package/chunks/{team-create-2XTBYRJF.js → team-create-PJYGG3AE.js} +62 -51
  337. package/chunks/{team-delete-RIDINW6I.js → team-delete-V2CROTI6.js} +9 -6
  338. package/chunks/{team-plan-approval-CFNWW7ZQ.js → team-plan-approval-B36IMXRL.js} +61 -50
  339. package/chunks/terminal-image-renderer-7OSAIRLS.js +156 -0
  340. package/chunks/theme-manager-PVMU3VN5.js +140 -0
  341. package/chunks/{todoWrite-XSTG2VT5.js → todoWrite-LT75PK2W.js} +8 -5
  342. package/chunks/tool-result-media-S6D7T7TZ.js +45 -0
  343. package/chunks/{tool-search-ZHTJU2MV.js → tool-search-MNRENFML.js} +43 -21
  344. package/chunks/total-session-admission-XOFLP43R.js +151 -0
  345. package/chunks/transcribe-audio-AJQZPNEV.js +30 -0
  346. package/chunks/trustedFolders-SBORXKH4.js +160 -0
  347. package/chunks/understand-video-segments-5TMRDQUB.js +438 -0
  348. package/chunks/{update-relaunch-LI7GRP36.js → update-relaunch-FVAD6CYB.js} +5 -5
  349. package/chunks/updateCheck-PK4QHA67.js +156 -0
  350. package/chunks/upload-cache-5YULQVZZ.js +17 -0
  351. package/chunks/upload-config-AZ63YJU2.js +25 -0
  352. package/chunks/useAutoAcceptIndicator-SPTOOUWR.js +158 -0
  353. package/chunks/{validateNonInterActiveAuth-YFPCYYNL.js → validateNonInterActiveAuth-XXHRLXWV.js} +144 -120
  354. package/chunks/{version-4MTL4JVU.js → version-AGTZHZNY.js} +1 -1
  355. package/chunks/{web-fetch-O6RG6ISB.js → web-fetch-KMXKLQKY.js} +27 -20
  356. package/chunks/{web-search-JHAXVEMD.js → web-search-OLBQWW2Y.js} +14 -11
  357. package/chunks/{web-shell-static-FFWCUUZS.js → web-shell-static-XSCCMXKQ.js} +3 -3
  358. package/chunks/{workflow-O7L6VDYU.js → workflow-2LC5ZV4Z.js} +214 -73
  359. package/chunks/workspace-providers-status-4IJHDGCM.js +154 -0
  360. package/chunks/{workspace-registration-store-7G4E7YPY.js → workspace-registration-store-M4LBEY5A.js} +1 -1
  361. package/chunks/workspace-registry-D4HQ3TWX.js +160 -0
  362. package/chunks/workspace-runtime-coordinator-ZG3IRRQ6.js +163 -0
  363. package/chunks/workspace-service-7ORHK4P4.js +165 -0
  364. package/chunks/workspace-skills-status-J43O7A5Q.js +151 -0
  365. package/chunks/{workspace-trust-reconciler-XEBW5FUL.js → workspace-trust-reconciler-7ZMDX27O.js} +99 -75
  366. package/chunks/write-file-MWN2PNMG.js +107 -0
  367. package/chunks/{zh-TW-S3YTQ4DS.js → zh-TW-SRB5QSER.js} +16 -0
  368. package/chunks/{zh-F76MZTL3.js → zh-UBQIFP4A.js} +16 -0
  369. package/chunks/{zoom-image-RDPRTP4B.js → zoom-image-H7MLEC2E.js} +18 -13
  370. package/cli.js +14 -14
  371. package/export-transcript-document.js +52 -52
  372. package/locales/en.js +18 -0
  373. package/locales/zh-TW.js +17 -0
  374. package/locales/zh.js +17 -0
  375. package/package.json +3 -3
  376. package/web-shell/assets/{abnfDiagram-VCTEODGH-RxykUDmi.js → abnfDiagram-VCTEODGH-L57MVQ_O.js} +1 -1
  377. package/web-shell/assets/{arc-CZpgGCJC.js → arc-Cdl4BCU9.js} +1 -1
  378. package/web-shell/assets/{architectureDiagram-5GKGNRK7-BHSMzNDT.js → architectureDiagram-5GKGNRK7-wLGfVuoB.js} +1 -1
  379. package/web-shell/assets/{blockDiagram-NRAW4CY4-Bn4mF9SZ.js → blockDiagram-NRAW4CY4-LXdTypiA.js} +1 -1
  380. package/web-shell/assets/{c4Diagram-UCG6FXSJ-CBM-Bj6t.js → c4Diagram-UCG6FXSJ-Ci95CJAD.js} +1 -1
  381. package/web-shell/assets/channel-DwdlDVan.js +1 -0
  382. package/web-shell/assets/{chunk-2Q5K7J3B-D5Fin58O.js → chunk-2Q5K7J3B-CTb0CG3P.js} +1 -1
  383. package/web-shell/assets/{chunk-5VM5RSS4-CY05weF7.js → chunk-5VM5RSS4-BIyA8dbi.js} +1 -1
  384. package/web-shell/assets/{chunk-F27PBJKO-3neZnj5Y.js → chunk-F27PBJKO-BlcPeoaN.js} +1 -1
  385. package/web-shell/assets/{chunk-G27WJ6UU-Cd7EU4BE.js → chunk-G27WJ6UU-KdH5H1ne.js} +1 -1
  386. package/web-shell/assets/{chunk-JWPE2WC7-DwK1mqFw.js → chunk-JWPE2WC7-DEh0r7ty.js} +1 -1
  387. package/web-shell/assets/{chunk-LCL6LL3I-Sl7vY22C.js → chunk-LCL6LL3I-DwD-l0mq.js} +1 -1
  388. package/web-shell/assets/{chunk-POPQ4Y6H-BXNzpbVg.js → chunk-POPQ4Y6H-D_ybAWGG.js} +1 -1
  389. package/web-shell/assets/{chunk-SVP7TREG-DjjButcp.js → chunk-SVP7TREG-Bk6Dq0yA.js} +1 -1
  390. package/web-shell/assets/{chunk-XXDRQBXY-DNOiCjOJ.js → chunk-XXDRQBXY-D4vL2YuW.js} +1 -1
  391. package/web-shell/assets/classDiagram-DTDB5LWJ-CIyD-qft.js +1 -0
  392. package/web-shell/assets/classDiagram-v2-JRS7N3AN-CIyD-qft.js +1 -0
  393. package/web-shell/assets/{cose-bilkent-JH36ORCC-BUnker7a.js → cose-bilkent-JH36ORCC-BditfMcM.js} +1 -1
  394. package/web-shell/assets/{cynefin-OW5HDTMX-DcUgdWE5.js → cynefin-OW5HDTMX-DAlaYMkD.js} +1 -1
  395. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-CvDKsZsL.js → cynefinDiagram-5FMLGOSQ-B9jOfS3X.js} +1 -1
  396. package/web-shell/assets/{dagre-3AP2YEHR-jpCmUbr1.js → dagre-3AP2YEHR-DO6EyeMX.js} +1 -1
  397. package/web-shell/assets/{diagram-S7CK7UJ4-DBe_bKE5.js → diagram-S7CK7UJ4-DIwGJ7mC.js} +1 -1
  398. package/web-shell/assets/{diagram-UQ7AKVKN-oXvPpDgs.js → diagram-UQ7AKVKN-DT5RqZBV.js} +1 -1
  399. package/web-shell/assets/{diagram-VSXAHHWV-BD7-_SGh.js → diagram-VSXAHHWV-DJBMayCs.js} +1 -1
  400. package/web-shell/assets/{diagram-VX7I27RA-DOJL0wub.js → diagram-VX7I27RA-BllSiq1w.js} +1 -1
  401. package/web-shell/assets/{diagram-Z3DM3KII-DRIiodDD.js → diagram-Z3DM3KII-Vw1NsAH3.js} +1 -1
  402. package/web-shell/assets/{ebnfDiagram-PWID7BFC-Db31Ulmb.js → ebnfDiagram-PWID7BFC-TY7loKI3.js} +1 -1
  403. package/web-shell/assets/{erDiagram-SSCWMZ5O-CVHhwI2_.js → erDiagram-SSCWMZ5O-BYrxi-FK.js} +1 -1
  404. package/web-shell/assets/{flowDiagram-A5DVABFB-DWOFy1FK.js → flowDiagram-A5DVABFB-BTQ4IRh-.js} +1 -1
  405. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-C0sxQtPd.js → ganttDiagram-EL5Y4UJY-96GXN9_Z.js} +1 -1
  406. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-CNituBYC.js → gitGraphDiagram-WWUBYQGX-BgIxQjuh.js} +1 -1
  407. package/web-shell/assets/{index-B15NlwB8.js → index-BvmsVGIg.js} +472 -465
  408. package/web-shell/assets/{index-BSrS0tQ6.css → index-D0aLpdAG.css} +2 -2
  409. package/web-shell/assets/{index-gm9tLk7h.js → index-SPar5CcF.js} +1 -1
  410. package/web-shell/assets/{infoDiagram-RXCK75RN-CxhJYtIR.js → infoDiagram-RXCK75RN-BlyUMpEA.js} +1 -1
  411. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-By2mchUy.js → ishikawaDiagram-5VMMS53U-94uLMZ3k.js} +1 -1
  412. package/web-shell/assets/{journeyDiagram-EYS64GPL-CVH-OweI.js → journeyDiagram-EYS64GPL-DbnJfG3S.js} +1 -1
  413. package/web-shell/assets/{kanban-definition-3QL26DDD-Cc9dQXLy.js → kanban-definition-3QL26DDD-gjWM2ioU.js} +1 -1
  414. package/web-shell/assets/{layout-C_60ysHw.js → layout-CmDpGoK-.js} +1 -1
  415. package/web-shell/assets/{linear-BvAVfqwu.js → linear-DksWgqn0.js} +1 -1
  416. package/web-shell/assets/{mermaid.core-C3CoBKAc.js → mermaid.core-DCpE5atR.js} +6 -6
  417. package/web-shell/assets/{mindmap-definition-FBJOCRG2-Cuu8Q8LM.js → mindmap-definition-FBJOCRG2-DanEOvck.js} +1 -1
  418. package/web-shell/assets/{pegDiagram-XKGWAZYB-DmAeyDO2.js → pegDiagram-XKGWAZYB-V2ee76OP.js} +1 -1
  419. package/web-shell/assets/{pieDiagram-E7YTZNPT-B7vbB_xv.js → pieDiagram-E7YTZNPT-CYvmbkkp.js} +1 -1
  420. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-BqOBkRR7.js → quadrantDiagram-AXDQQJYC-BRkw6ha0.js} +1 -1
  421. package/web-shell/assets/{railroadDiagram-O6MQD6OU-sI06lZIu.js → railroadDiagram-O6MQD6OU-D_YmVT7T.js} +1 -1
  422. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-Bg13d10S.js → requirementDiagram-EFPCY7ZU-DTF9UgWw.js} +1 -1
  423. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-WFOzZHrR.js → sankeyDiagram-P5KCCOFB-znmuOvtK.js} +1 -1
  424. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-CCdRbA4E.js → sequenceDiagram-WJ2MYXX4-B8CE9gDr.js} +1 -1
  425. package/web-shell/assets/{sizeCapture-X5ZJPWSS-BH5F3bGg.js → sizeCapture-X5ZJPWSS-BqE_jooQ.js} +1 -1
  426. package/web-shell/assets/{stateDiagram-HBIQ2CUA-NwS2X3QB.js → stateDiagram-HBIQ2CUA-4AmlCOLW.js} +1 -1
  427. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DwExf4Jm.js +1 -0
  428. package/web-shell/assets/{swimlanes-XN3QIQJK-Bm38pM28.js → swimlanes-XN3QIQJK-B40gtZOq.js} +1 -1
  429. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-CXXUsHPj.js +8 -0
  430. package/web-shell/assets/{timeline-definition-24CTP7MA-Do-agLSo.js → timeline-definition-24CTP7MA-B23KIwTc.js} +1 -1
  431. package/web-shell/assets/{vennDiagram-4TSXK5OY-aggLfZzl.js → vennDiagram-4TSXK5OY-eyJpBjg6.js} +1 -1
  432. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-D5JR3mXX.js → wardleyDiagram-VM6X3IG4-BBjaaHeP.js} +1 -1
  433. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-DhtLDuXs.js → xychartDiagram-S5SC5T6Z-Cq3Bnvj4.js} +1 -1
  434. package/web-shell/index.html +2 -2
  435. package/chunks/MaxSizedBox-FCF6M53W.js +0 -124
  436. package/chunks/acp-subagent-executor-TND6W2O5.js +0 -140
  437. package/chunks/agent-headless-EJ4QOUSM.js +0 -94
  438. package/chunks/bridge-MUX5YJZT.js +0 -132
  439. package/chunks/channel-settings-store-7CBIRZER.js +0 -134
  440. package/chunks/chunk-FIJODK52.js +0 -154
  441. package/chunks/chunk-OALXNGUA.js +0 -2137
  442. package/chunks/chunk-PF7GAP6K.js +0 -16861
  443. package/chunks/config-utils-KX2YS725.js +0 -127
  444. package/chunks/contextCommand-RV6Y5LNJ.js +0 -120
  445. package/chunks/daemon-status-provider-NULJNAEV.js +0 -131
  446. package/chunks/daemon-trust-policy-S4KWGPV3.js +0 -126
  447. package/chunks/deferred-core-runtime-T23ZT443.js +0 -128
  448. package/chunks/environment-TSQJUTPV.js +0 -143
  449. package/chunks/errors-RIVYJS6T.js +0 -127
  450. package/chunks/exitPlanMode-BYBBFN2T.js +0 -92
  451. package/chunks/handleAutoUpdate-FZP45KOR.js +0 -123
  452. package/chunks/i18n-OTB62AKW.js +0 -140
  453. package/chunks/initializer-4JXZEC4B.js +0 -127
  454. package/chunks/installationInfo-2IJV5QKC.js +0 -121
  455. package/chunks/list-KQSQ4A5G.js +0 -130
  456. package/chunks/loadedSettingsAdapter-TZTTNRHI.js +0 -124
  457. package/chunks/mcp-TFDTUPIA.js +0 -124
  458. package/chunks/model-configuration-ZCAKKIOF.js +0 -137
  459. package/chunks/modelConfigUtils-J3ZPW7ZK.js +0 -116
  460. package/chunks/nonInteractiveCli-GPT3TVOK.js +0 -211
  461. package/chunks/pidfile-GBTBIGHF.js +0 -127
  462. package/chunks/prompt-terminal-ledger-ILIXZI3E.js +0 -119
  463. package/chunks/read-file-G4XKW2CS.js +0 -31
  464. package/chunks/record-source-2GSY5JD5.js +0 -22
  465. package/chunks/resumeHistoryUtils-YPJU4XFE.js +0 -132
  466. package/chunks/ripGrep-AAKMALLM.js +0 -39
  467. package/chunks/runtime-SJCRYNPA.js +0 -164
  468. package/chunks/sandbox-UIXL423Z.js +0 -146
  469. package/chunks/sandboxConfig-CY343YNJ.js +0 -114
  470. package/chunks/scheduled-tasks-5UGBEVNZ.js +0 -143
  471. package/chunks/scheduler-GCZYLZ2P.js +0 -136
  472. package/chunks/serve-2XXQLVK2.js +0 -132
  473. package/chunks/session-attachments-root-DHQM5IEZ.js +0 -117
  474. package/chunks/skill-settings-IXG5CTQO.js +0 -140
  475. package/chunks/spawnChannel-Q3YALTCJ.js +0 -128
  476. package/chunks/standalone-update-H5OJ7MM7.js +0 -132
  477. package/chunks/task-create-75HVPEAH.js +0 -28
  478. package/chunks/terminal-image-renderer-UDPJPGPQ.js +0 -132
  479. package/chunks/theme-manager-SK57EKMO.js +0 -116
  480. package/chunks/total-session-admission-UUZBDQCG.js +0 -127
  481. package/chunks/trustedFolders-4LDBLNTS.js +0 -136
  482. package/chunks/updateCheck-PKSSORPO.js +0 -132
  483. package/chunks/useAutoAcceptIndicator-I32UEQPI.js +0 -134
  484. package/chunks/workspace-providers-status-WRX6CJM4.js +0 -130
  485. package/chunks/workspace-registry-SXIMGT4D.js +0 -136
  486. package/chunks/workspace-runtime-coordinator-7DOEHXYT.js +0 -139
  487. package/chunks/workspace-service-HDXOZMYC.js +0 -141
  488. package/chunks/workspace-skills-status-VN4L37CA.js +0 -127
  489. package/chunks/write-file-LKX4ETIO.js +0 -97
  490. package/web-shell/assets/channel-DFYs_LlK.js +0 -1
  491. package/web-shell/assets/classDiagram-DTDB5LWJ-DnGrKXoM.js +0 -1
  492. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DnGrKXoM.js +0 -1
  493. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-1aU2JZXO.js +0 -1
  494. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-Dp-u6kQG.js +0 -8
  495. package/chunks/{chunk-XAJZFGD2.js → chunk-PXXYQOZO.js} +8 -8
  496. package/chunks/{chunk-WVURIAEE.js → chunk-SVWWF5TZ.js} +3 -3
  497. package/chunks/{dist-G5UMXIGF.js → dist-I6D6XOWV.js} +1 -1
  498. package/chunks/{dist-UXVNLQHG.js → dist-VIKOMAGG.js} +3 -3
@@ -1,5 +1,11 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
+ import {
4
+ deriveWebSocketBase,
5
+ openQwenAsrRealtimeStream,
6
+ openVoiceStream,
7
+ openVoiceStreamWithRetry
8
+ } from "./chunk-4B7U3KQP.js";
3
9
  import {
4
10
  GENERATION_MAX_PROMPT_BYTES,
5
11
  MAX_REMEMBER_CONTENT_BYTES,
@@ -14,13 +20,7 @@ import {
14
20
  shouldSuppressRememberErrorDetails,
15
21
  workspaceMemoryFailureCode,
16
22
  workspaceMemoryFailureDiagnostics
17
- } from "./chunk-BHVF3R6B.js";
18
- import {
19
- deriveWebSocketBase,
20
- openQwenAsrRealtimeStream,
21
- openVoiceStream,
22
- openVoiceStreamWithRetry
23
- } from "./chunk-Q2SAQTEJ.js";
23
+ } from "./chunk-TAMBGU42.js";
24
24
  import {
25
25
  SetupGithubError,
26
26
  collectSessionData,
@@ -32,19 +32,61 @@ import {
32
32
  toJson,
33
33
  toJsonl,
34
34
  toMarkdown
35
- } from "./chunk-HNFKYKHH.js";
35
+ } from "./chunk-VNQTV5NC.js";
36
36
  import {
37
37
  OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
38
38
  ObservedChannelContactStore
39
- } from "./chunk-M3JGHRMQ.js";
40
- import "./chunk-VFFQAOPR.js";
39
+ } from "./chunk-ZJ7KIWG5.js";
40
+ import "./chunk-SSFOFDNL.js";
41
41
  import {
42
42
  escapeAnsiCtrlCodes
43
43
  } from "./chunk-47ECGEJC.js";
44
- import "./chunk-Y4NNIGYO.js";
45
44
  import "./chunk-2MIN6GRR.js";
46
45
  import "./chunk-QHTIBUWB.js";
46
+ import "./chunk-VFFQAOPR.js";
47
47
  import "./chunk-TXASDT2M.js";
48
+ import {
49
+ AONE_MAX_MR_VIEW_CALLS_PER_RUN,
50
+ DaemonDrainingError,
51
+ InvalidCursorError,
52
+ SessionArchiveCoordinator,
53
+ acquireWorktreeOwnershipOp,
54
+ archiveDaemonSessions,
55
+ assertSessionArchived,
56
+ assertSessionLoadable,
57
+ assertSessionRestorable,
58
+ createWorkspaceRuntimeSessionService,
59
+ defaultAoneMrBackend,
60
+ deleteDaemonSessionIfOrphan,
61
+ deleteDaemonSessions,
62
+ getWorkspaceSessionInfoForResponse,
63
+ invalidateWorkspaceSessionListCache,
64
+ isAoneDetailUrlForRepo,
65
+ laterActivityTimestamp,
66
+ listLiveWorkspaceSessionsForResponse,
67
+ listWorkspaceSessionsForResponse,
68
+ logSessionArchiveWarning,
69
+ parseSessionPageSizeQuery,
70
+ resolveAoneWorkspaceRepo,
71
+ resolveSessionIdForRestore,
72
+ runWithWorkspaceRuntimeStorage,
73
+ searchWorkspaceSessionsForResponse,
74
+ unarchiveDaemonSessions
75
+ } from "./chunk-JZUSFW64.js";
76
+ import {
77
+ LIVE_SESSION_SOURCE_PREFIX,
78
+ isCompatibleLiveSessionSource,
79
+ isReservedLiveSessionSource,
80
+ isReservedStandaloneSessionSource,
81
+ readLoadableConversationSession,
82
+ readLoadableLiveConversationMetadata
83
+ } from "./chunk-OHU2H5CS.js";
84
+ import "./chunk-4VQBQLIZ.js";
85
+ import {
86
+ STANDALONE_SESSION_SOURCE_TYPE,
87
+ isReservedStandaloneSessionSourceType,
88
+ isScheduledTaskRunSource
89
+ } from "./chunk-N4QWUPDM.js";
48
90
  import {
49
91
  ACP_PRE_ATTACH_MAX_FRAMES_GLOBAL,
50
92
  ACP_PRE_ATTACH_MAX_FRAMES_PER_CONNECTION,
@@ -115,7 +157,7 @@ import {
115
157
  singleTokenCredentials,
116
158
  tagListener,
117
159
  unsafeRevealSecret
118
- } from "./chunk-FCPJXKDG.js";
160
+ } from "./chunk-RXDTMGUH.js";
119
161
  import {
120
162
  ConversationDirectoryIdentityError,
121
163
  getConversationDirectoryName,
@@ -123,53 +165,6 @@ import {
123
165
  isSameConversationPath,
124
166
  normalizedInode
125
167
  } from "./chunk-PB7JBAHF.js";
126
- import {
127
- formatHostForAuthority,
128
- isLoopbackBind
129
- } from "./chunk-DMEUXLSS.js";
130
- import {
131
- createTotalSessionAdmissionController
132
- } from "./chunk-SENYKRII.js";
133
- import {
134
- assertValidChannelSecretUpdates
135
- } from "./chunk-VU3XMZ5I.js";
136
- import {
137
- AONE_MAX_MR_VIEW_CALLS_PER_RUN,
138
- DaemonDrainingError,
139
- InvalidCursorError,
140
- SessionArchiveCoordinator,
141
- acquireWorktreeOwnershipOp,
142
- archiveDaemonSessions,
143
- assertSessionArchived,
144
- assertSessionLoadable,
145
- assertSessionRestorable,
146
- createWorkspaceRuntimeSessionService,
147
- defaultAoneMrBackend,
148
- deleteDaemonSessionIfOrphan,
149
- deleteDaemonSessions,
150
- getWorkspaceSessionInfoForResponse,
151
- invalidateWorkspaceSessionListCache,
152
- isAoneDetailUrlForRepo,
153
- laterActivityTimestamp,
154
- listLiveWorkspaceSessionsForResponse,
155
- listWorkspaceSessionsForResponse,
156
- logSessionArchiveWarning,
157
- parseSessionPageSizeQuery,
158
- resolveAoneWorkspaceRepo,
159
- resolveSessionIdForRestore,
160
- runWithWorkspaceRuntimeStorage,
161
- searchWorkspaceSessionsForResponse,
162
- unarchiveDaemonSessions
163
- } from "./chunk-SOLRBF7L.js";
164
- import {
165
- LIVE_SESSION_SOURCE_PREFIX,
166
- isCompatibleLiveSessionSource,
167
- isReservedLiveSessionSource,
168
- isReservedStandaloneSessionSource,
169
- readLoadableConversationSession,
170
- readLoadableLiveConversationMetadata
171
- } from "./chunk-OHU2H5CS.js";
172
- import "./chunk-4VQBQLIZ.js";
173
168
  import {
174
169
  CLIENT_ID_HEADER,
175
170
  CLIENT_ID_RE,
@@ -193,37 +188,12 @@ import {
193
188
  validateMcpRuntimeServerName
194
189
  } from "./chunk-LAUEEBDL.js";
195
190
  import {
196
- STANDALONE_SESSION_SOURCE_TYPE,
197
- isReservedStandaloneSessionSourceType,
198
- isScheduledTaskRunSource
199
- } from "./chunk-N4QWUPDM.js";
200
- import "./chunk-7D4CV7JH.js";
201
- import {
202
- isServeDebugMode,
203
- mountWebShellAssets,
204
- mountWebShellSpaFallback
205
- } from "./chunk-TDKUXSJO.js";
206
- import {
207
- require_express
208
- } from "./chunk-WVURIAEE.js";
209
- import "./chunk-FBX2SDQ4.js";
210
- import {
211
- evaluateDaemonWorkspaceTrust,
212
- readDaemonTrustPolicySnapshot
213
- } from "./chunk-43Y26NPF.js";
214
- import {
215
- readRecentPromptTerminals,
216
- reconcileDanglingPromptTerminals,
217
- withPromptTerminals
218
- } from "./chunk-FASYATAZ.js";
219
- import {
220
- WorkspaceGenerationClosedError,
221
- createSingleWorkspaceRegistry,
222
- createWorkspaceSessionOwnerIndex
223
- } from "./chunk-MMRGG6R4.js";
191
+ formatHostForAuthority,
192
+ isLoopbackBind
193
+ } from "./chunk-DMEUXLSS.js";
224
194
  import {
225
195
  sessionAttachmentsRoots
226
- } from "./chunk-XWJFDJZK.js";
196
+ } from "./chunk-PJSZXERN.js";
227
197
  import {
228
198
  getWorkspaceRouteContext,
229
199
  isGenerationClosedError,
@@ -246,22 +216,19 @@ import {
246
216
  sendUntrustedWorkspaceResponse,
247
217
  sendWorkspaceRuntimeUnavailable,
248
218
  setWorkspaceRouteContext
249
- } from "./chunk-3UGMLA4V.js";
219
+ } from "./chunk-OA5H5PPQ.js";
250
220
  import {
251
221
  normalizeChannelDelivery,
252
222
  parseChannelDelivery
253
- } from "./chunk-QGEISOJ2.js";
223
+ } from "./chunk-YKM7SY3N.js";
224
+ import {
225
+ createSessionOrganizationService
226
+ } from "./chunk-C4QWV63F.js";
254
227
  import {
255
228
  isValidSessionId,
256
229
  normalizeSessionIdForLookup,
257
230
  parseCallerSuppliedSessionId
258
231
  } from "./chunk-ZEZKIS2K.js";
259
- import {
260
- createSessionOrganizationService
261
- } from "./chunk-4JFLRHNE.js";
262
- import {
263
- isInternalWorkspaceRuntime
264
- } from "./chunk-NYWWQ437.js";
265
232
  import {
266
233
  EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
267
234
  MAX_WORKSPACE_SKILL_NAME_LENGTH,
@@ -277,14 +244,14 @@ import {
277
244
  validateWorkspaceSkillName,
278
245
  validateWorkspaceVoiceState,
279
246
  voiceSettingsScopeToWire
280
- } from "./chunk-SSWTA7CH.js";
247
+ } from "./chunk-SLV3GU2S.js";
281
248
  import {
282
249
  PermissionRulesValidationError,
283
250
  buildPermissionSettings,
284
251
  isPermissionRuleType,
285
252
  normalizePermissionRules,
286
253
  readPermissionRuleSet
287
- } from "./chunk-BHG3H6OZ.js";
254
+ } from "./chunk-U4KO33OD.js";
288
255
  import {
289
256
  assertVoiceBaseUrlNetworkAllowed,
290
257
  isStreamingVoiceModel,
@@ -292,84 +259,149 @@ import {
292
259
  resolveVoiceTranscriptionConfig,
293
260
  sanitizeVoiceErrorMessage,
294
261
  transcribeVoiceAudio
295
- } from "./chunk-MO4XID7S.js";
262
+ } from "./chunk-DNDECZXY.js";
296
263
  import {
297
264
  isVoiceEnabled,
298
265
  isVoiceMode,
299
266
  readVoiceModel,
300
267
  resolveVoiceTransport
301
- } from "./chunk-KVC7HZWK.js";
268
+ } from "./chunk-JYTJ5FCM.js";
302
269
  import {
303
270
  resolvePath
304
- } from "./chunk-Y53DG2HA.js";
271
+ } from "./chunk-UIWUFHRJ.js";
272
+ import {
273
+ createTotalSessionAdmissionController
274
+ } from "./chunk-SENYKRII.js";
275
+ import {
276
+ assertValidChannelSecretUpdates
277
+ } from "./chunk-U3VIKF53.js";
278
+ import {
279
+ createWorkspaceSkillsStatusProvider
280
+ } from "./chunk-LWALWKFU.js";
281
+ import "./chunk-VVQ57VLE.js";
282
+ import {
283
+ WorkspaceRuntimeInitializationError,
284
+ WorkspaceRuntimeStillStartingError,
285
+ getWorkspaceRuntimeCoordinator,
286
+ getWorkspaceRuntimeCoordinatorIfSupported,
287
+ supportsWorkspaceRuntimeLifecycle
288
+ } from "./chunk-VLBL6Q7X.js";
289
+ import {
290
+ WorkspacePermissionRulesSessionRequiredError,
291
+ WorkspaceSettingsPartialPersistError,
292
+ WorkspaceSkillNotFoundError,
293
+ mapWorkspaceSkillToggleError
294
+ } from "./chunk-FTJMWDND.js";
295
+ import "./chunk-APHDK7GV.js";
296
+ import {
297
+ isServeDebugMode,
298
+ mountWebShellAssets,
299
+ mountWebShellSpaFallback
300
+ } from "./chunk-3MW6PPA5.js";
301
+ import {
302
+ require_express
303
+ } from "./chunk-SVWWF5TZ.js";
304
+ import "./chunk-FBX2SDQ4.js";
305
+ import {
306
+ evaluateDaemonWorkspaceTrust,
307
+ readDaemonTrustPolicySnapshot
308
+ } from "./chunk-UR27ZXFZ.js";
309
+ import {
310
+ readRecentPromptTerminals,
311
+ reconcileDanglingPromptTerminals,
312
+ withPromptTerminals
313
+ } from "./chunk-GL5TRVMS.js";
314
+ import {
315
+ WorkspaceGenerationClosedError,
316
+ createSingleWorkspaceRegistry,
317
+ createWorkspaceSessionOwnerIndex
318
+ } from "./chunk-MMRGG6R4.js";
319
+ import {
320
+ isInternalWorkspaceRuntime
321
+ } from "./chunk-NYWWQ437.js";
322
+ import "./chunk-OIBUG24X.js";
323
+ import {
324
+ MAX_SESSION_RESTORE_TIMEOUT_MS,
325
+ resolveSessionRestoreTimeoutMs,
326
+ restoreRetryAfterSeconds
327
+ } from "./chunk-4JRM2BSM.js";
305
328
  import {
306
329
  createDaemonStatusProvider
307
- } from "./chunk-CQPM66MG.js";
308
- import "./chunk-FX6PZBOV.js";
309
- import "./chunk-3LLEB5CU.js";
330
+ } from "./chunk-L7HFHYGB.js";
331
+ import "./chunk-WHBL5HJF.js";
332
+ import "./chunk-QG73VXTF.js";
310
333
  import "./chunk-FUSEMYFX.js";
334
+ import {
335
+ SessionArtifactAuthorizationError,
336
+ SessionArtifactValidationError,
337
+ createAcpSessionBridge,
338
+ extractErrorCode,
339
+ extractErrorMessage,
340
+ parseSessionSource
341
+ } from "./chunk-67ZCKSV6.js";
342
+ import {
343
+ EVENT_SCHEMA_VERSION,
344
+ EventBus,
345
+ SubscriberLimitExceededError,
346
+ summarizeReplay
347
+ } from "./chunk-KWYTSSTJ.js";
348
+ import "./chunk-WCCLLK7X.js";
349
+ import "./chunk-OCPBI7J5.js";
350
+ import {
351
+ createSpawnChannelFactory
352
+ } from "./chunk-UANUZBL2.js";
353
+ import "./chunk-LYD3T3H7.js";
311
354
  import {
312
355
  createWorkspaceProvidersStatusProvider
313
- } from "./chunk-K4XMAIRX.js";
356
+ } from "./chunk-SRFYBJ4P.js";
314
357
  import {
315
358
  PERSIST_REASONING_SELECTION_META_KEY,
316
359
  REASONING_SELECTION_PERSISTED_META_KEY
317
- } from "./chunk-4QPVZA5J.js";
360
+ } from "./chunk-OOSOAFCT.js";
318
361
  import {
319
362
  snapshotProcessEnv
320
- } from "./chunk-XICCGDWF.js";
363
+ } from "./chunk-QKYAXSNG.js";
364
+ import {
365
+ BridgeTimeoutError,
366
+ SERVE_CONTROL_EXT_METHODS,
367
+ STATUS_SCHEMA_VERSION,
368
+ SessionRestoreTimeoutError,
369
+ createIdleWorkspaceMemoryStatus,
370
+ mapDomainErrorToErrorKind,
371
+ readServeWorkflowActionInput
372
+ } from "./chunk-OY5GQPMU.js";
321
373
  import {
322
374
  getAuthTypeFromEnv,
323
375
  resolveCliGenerationConfig
324
- } from "./chunk-UZSB57EV.js";
376
+ } from "./chunk-JR2WFCQG.js";
325
377
  import {
326
378
  findModelConfiguration,
327
379
  findModelConfigurationForDeletion,
328
380
  isConversationModelConfiguration,
329
381
  isImageModelConfiguration,
330
382
  listModelConfigurations
331
- } from "./chunk-FEDFZBGR.js";
332
- import "./chunk-4FLUQWJ4.js";
383
+ } from "./chunk-E6A52AP2.js";
333
384
  import {
334
- createWorkspaceSkillsStatusProvider
335
- } from "./chunk-AKRSSKUT.js";
336
- import "./chunk-TKF4JINY.js";
385
+ sanitizeProviderBaseUrl
386
+ } from "./chunk-Y3Q5OK4D.js";
337
387
  import {
338
388
  lookupSkillDisablement,
339
389
  resolveSkillSettings
340
- } from "./chunk-D7JMO2GP.js";
341
- import {
342
- WorkspaceRuntimeInitializationError,
343
- WorkspaceRuntimeStillStartingError,
344
- getWorkspaceRuntimeCoordinator,
345
- getWorkspaceRuntimeCoordinatorIfSupported,
346
- supportsWorkspaceRuntimeLifecycle
347
- } from "./chunk-YQQ2U7AS.js";
348
- import "./chunk-OIBUG24X.js";
349
- import {
350
- MAX_SESSION_RESTORE_TIMEOUT_MS,
351
- resolveSessionRestoreTimeoutMs,
352
- restoreRetryAfterSeconds
353
- } from "./chunk-4JRM2BSM.js";
354
- import {
355
- WorkspacePermissionRulesSessionRequiredError,
356
- WorkspaceSettingsPartialPersistError,
357
- WorkspaceSkillNotFoundError,
358
- mapWorkspaceSkillToggleError
359
- } from "./chunk-FTJMWDND.js";
390
+ } from "./chunk-KSECLXYH.js";
360
391
  import {
361
392
  daemonObservedContactsPath,
362
393
  loadChannelsConfig
363
- } from "./chunk-WZWTY7SG.js";
364
- import "./chunk-E2VSBAFA.js";
394
+ } from "./chunk-TZ4QKMPU.js";
395
+ import "./chunk-OXBD7VUE.js";
365
396
  import "./chunk-57OAHC2Y.js";
366
397
  import {
367
398
  parseChannelWebhookConfigLenient
368
- } from "./chunk-SYMXYRM5.js";
399
+ } from "./chunk-W7JWIIRC.js";
369
400
  import {
370
401
  supportedChannelCatalog
371
- } from "./chunk-U4AASWUQ.js";
402
+ } from "./chunk-L4GF4IK2.js";
372
403
  import "./chunk-LFKXIOGC.js";
404
+ import "./chunk-V6WHFGST.js";
373
405
  import {
374
406
  assertLiveDiscoveryPublisher,
375
407
  getStableLiveDiscoveryBaseDir
@@ -386,39 +418,9 @@ import {
386
418
  conversationRuntimeOwnershipCompromisedError,
387
419
  conversationRuntimeUnavailableError
388
420
  } from "./chunk-Y5TM7SBV.js";
389
- import {
390
- SessionArtifactAuthorizationError,
391
- SessionArtifactValidationError,
392
- createAcpSessionBridge,
393
- extractErrorCode,
394
- extractErrorMessage,
395
- parseSessionSource
396
- } from "./chunk-L2A5VBDL.js";
397
- import {
398
- EVENT_SCHEMA_VERSION,
399
- EventBus,
400
- SubscriberLimitExceededError,
401
- summarizeReplay
402
- } from "./chunk-KWYTSSTJ.js";
403
- import "./chunk-WCCLLK7X.js";
404
- import "./chunk-OCPBI7J5.js";
405
- import {
406
- createSpawnChannelFactory
407
- } from "./chunk-2C5TR6HN.js";
408
- import "./chunk-LYD3T3H7.js";
409
- import {
410
- BridgeTimeoutError,
411
- SERVE_CONTROL_EXT_METHODS,
412
- STATUS_SCHEMA_VERSION,
413
- SessionRestoreTimeoutError,
414
- createIdleWorkspaceMemoryStatus,
415
- mapDomainErrorToErrorKind,
416
- readServeWorkflowActionInput
417
- } from "./chunk-M23GFJ5B.js";
418
- import "./chunk-K6KS3LTN.js";
419
421
  import "./chunk-ZL4HFSL6.js";
422
+ import "./chunk-K6KS3LTN.js";
420
423
  import "./chunk-OSHQMOBS.js";
421
- import "./chunk-V6WHFGST.js";
422
424
  import {
423
425
  MAX_REGISTERED_WORKSPACES,
424
426
  WorkspaceDisplayNameValidationError,
@@ -428,7 +430,7 @@ import {
428
430
  normalizeWorkspaceDisplayName,
429
431
  resolveMaxRegisteredWorkspaces,
430
432
  workspaceRegistrationId
431
- } from "./chunk-INN5ORKX.js";
433
+ } from "./chunk-G25IQMCV.js";
432
434
  import {
433
435
  CHANNEL_PROMPT_META_KEY,
434
436
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
@@ -495,17 +497,17 @@ import {
495
497
  import {
496
498
  normalizeWorkerDiagnostic
497
499
  } from "./chunk-L3SNMEDW.js";
498
- import {
499
- QWEN_SERVER_TOKEN_ENV
500
- } from "./chunk-GYTKQYDB.js";
501
500
  import {
502
501
  normalizeServeChannelSelection
503
502
  } from "./chunk-GDWE23OR.js";
504
- import "./chunk-CJ3DHN5I.js";
503
+ import {
504
+ QWEN_SERVER_TOKEN_ENV
505
+ } from "./chunk-GYTKQYDB.js";
505
506
  import {
506
507
  ChannelDeliveryError,
507
508
  isChannelDeliveryError
508
509
  } from "./chunk-RKFGE7JH.js";
510
+ import "./chunk-CJ3DHN5I.js";
509
511
  import "./chunk-UDG5EZJI.js";
510
512
  import {
511
513
  redactLogCredentials
@@ -516,6 +518,7 @@ import {
516
518
  } from "./chunk-PZRXWQUA.js";
517
519
  import "./chunk-IJOS26LH.js";
518
520
  import {
521
+ LoadedSettings,
519
522
  WORKSPACE_RESTRICTED_SETTING_KEYS,
520
523
  getDialogSettingKeys,
521
524
  getModelProvidersOwnerScope,
@@ -527,9 +530,9 @@ import {
527
530
  resolveOutputLanguageOrPreserveAuto,
528
531
  updateOutputLanguageFile,
529
532
  validateSettingValue
530
- } from "./chunk-RRI764F7.js";
533
+ } from "./chunk-SWHBXWVS.js";
534
+ import "./chunk-W2UTVLT2.js";
531
535
  import "./chunk-RKUWKYED.js";
532
- import "./chunk-AUX2FL5T.js";
533
536
  import "./chunk-BW4333PP.js";
534
537
  import "./chunk-IDS7MSUP.js";
535
538
  import {
@@ -537,16 +540,20 @@ import {
537
540
  getCurrentLanguage,
538
541
  resolveLanguageSetting,
539
542
  setLanguageAsync
540
- } from "./chunk-GSAOVDTH.js";
543
+ } from "./chunk-POMFSBEC.js";
541
544
  import {
542
545
  SUPPORTED_LANGUAGES,
543
546
  resolveSupportedLanguage
544
547
  } from "./chunk-5EJZE3FP.js";
545
- import "./chunk-NKTMUPHJ.js";
546
- import "./chunk-6OTF7TTE.js";
548
+ import {
549
+ buildRuntimeEnvironment
550
+ } from "./chunk-KDM4KSVG.js";
551
+ import "./chunk-4VYTH6OF.js";
552
+ import "./chunk-3ZGIRRAE.js";
553
+ import "./chunk-W3N5XAZ6.js";
547
554
  import {
548
555
  getWorkspaceTrustStatus
549
- } from "./chunk-NQ272MQG.js";
556
+ } from "./chunk-IAKJXTGS.js";
550
557
  import "./chunk-NPQ5ZKRP.js";
551
558
  import {
552
559
  isWithinRoot as isWithinRoot2
@@ -561,31 +568,43 @@ import {
561
568
  buildUsageDashboard,
562
569
  loadIgnoreRules,
563
570
  writeWorkspaceContextFile
564
- } from "./chunk-347O2YZJ.js";
571
+ } from "./chunk-DUWQ5Q6R.js";
565
572
  import "./chunk-GELRJXE2.js";
566
573
  import "./chunk-32CM56LO.js";
567
- import "./chunk-AQP3H22J.js";
568
- import "./chunk-W3N5XAZ6.js";
569
- import "./chunk-6WXVEDT2.js";
574
+ import "./chunk-MC2RYJMU.js";
570
575
  import "./chunk-LJZSMWOH.js";
571
- import "./chunk-VEXUA6DX.js";
572
- import "./chunk-TXTCM3TC.js";
573
- import "./chunk-X7AYIXC7.js";
574
- import "./chunk-TRZ22SG5.js";
576
+ import "./chunk-DJLCK66M.js";
575
577
  import {
576
578
  clearWorktreeSession,
577
579
  readWorktreeSession,
578
580
  readWorktreeSessionStrict,
579
581
  writeWorktreeSession
580
- } from "./chunk-3BZI5GDP.js";
582
+ } from "./chunk-M5YIHMXP.js";
583
+ import "./chunk-TWD6EZLA.js";
584
+ import "./chunk-IIHFUREY.js";
585
+ import "./chunk-LAE6RY3L.js";
586
+ import "./chunk-5VDOVBNG.js";
587
+ import "./chunk-FXPP7VLM.js";
588
+ import "./chunk-7PQ65Z5F.js";
581
589
  import "./chunk-ZPJWUGCS.js";
582
- import "./chunk-YM6KUQ2S.js";
583
- import "./chunk-IXO2OCIP.js";
584
- import "./chunk-DJXSOEFB.js";
585
- import "./chunk-SFHX5G2S.js";
586
- import "./chunk-5VQR2DD7.js";
587
- import "./chunk-BUQN5LTI.js";
588
- import "./chunk-LO2UWNO5.js";
590
+ import "./chunk-O4A2B6V2.js";
591
+ import "./chunk-C4MMZVYX.js";
592
+ import "./chunk-SQRZJD25.js";
593
+ import "./chunk-FT3O44AZ.js";
594
+ import "./chunk-DJYHML3Y.js";
595
+ import "./chunk-Z547XC3A.js";
596
+ import "./chunk-V2XJJTAB.js";
597
+ import "./chunk-ZAX2LW35.js";
598
+ import "./chunk-UXEI7POA.js";
599
+ import "./chunk-SLHYLVRW.js";
600
+ import "./chunk-YDERQ7ZV.js";
601
+ import "./chunk-UXC6MURF.js";
602
+ import "./chunk-RSFNJ6UU.js";
603
+ import "./chunk-JYGESWZM.js";
604
+ import "./chunk-TFDCK56Y.js";
605
+ import "./chunk-FTKXJMQV.js";
606
+ import "./chunk-S5BHLTHK.js";
607
+ import "./chunk-KSEKRQJO.js";
589
608
  import {
590
609
  BuiltinAgentRegistry,
591
610
  Client,
@@ -659,27 +678,24 @@ import {
659
678
  replaceSessionPrs,
660
679
  repoKeyFromWebUrl,
661
680
  resolveBranchName,
681
+ runGit,
662
682
  sessionPrSourceAuthority,
663
683
  sleepInhibitor,
664
684
  toSessionPrInfo,
665
685
  upsertSessionPr,
666
686
  watchRepoBranch
667
- } from "./chunk-KAYC5FBN.js";
687
+ } from "./chunk-Z3DLUFMT.js";
668
688
  import "./chunk-GOFAQQZA.js";
669
689
  import "./chunk-65I7S4Z3.js";
670
690
  import "./chunk-HEOH7JZY.js";
671
691
  import "./chunk-TWPJO254.js";
672
692
  import "./chunk-CQ35AJ4Z.js";
673
- import "./chunk-IVFTLUZD.js";
674
- import "./chunk-7CLLH5TI.js";
675
- import "./chunk-WK6DEH3Q.js";
676
- import "./chunk-6PVPNMXU.js";
677
- import {
678
- resolveModelId
679
- } from "./chunk-DX6JTDMR.js";
693
+ import "./chunk-4YS7RMCB.js";
694
+ import "./chunk-PQQV3OBW.js";
680
695
  import {
681
696
  readArtifactSnapshot
682
- } from "./chunk-VQDWCQOE.js";
697
+ } from "./chunk-ANKISCKU.js";
698
+ import "./chunk-4SZ2636R.js";
683
699
  import "./chunk-5EZRLTLQ.js";
684
700
  import "./chunk-QHWCP53L.js";
685
701
  import {
@@ -688,10 +704,7 @@ import {
688
704
  readCronTasks,
689
705
  taskHasLegacyCondition,
690
706
  updateCronTasks
691
- } from "./chunk-3LMDSCLU.js";
692
- import {
693
- glob
694
- } from "./chunk-QJNDUTOL.js";
707
+ } from "./chunk-C4FISGDN.js";
695
708
  import "./chunk-O6GEWCJA.js";
696
709
  import {
697
710
  GitWorktreeService,
@@ -699,9 +712,11 @@ import {
699
712
  createWorktreeSessionMarkerExclusive,
700
713
  readWorktreeSessionMarkerStrict,
701
714
  transferWorktreeSessionMarkerOwner
702
- } from "./chunk-CXONOVBN.js";
703
- import "./chunk-OWUAZXXN.js";
704
- import "./chunk-CH2YDT6X.js";
715
+ } from "./chunk-KS6F6LZQ.js";
716
+ import "./chunk-6PVPNMXU.js";
717
+ import {
718
+ resolveModelId
719
+ } from "./chunk-OB57Y2WH.js";
705
720
  import {
706
721
  parseGoalControlRequest,
707
722
  qualifySkillName,
@@ -709,44 +724,67 @@ import {
709
724
  recordDaemonHttpRequest,
710
725
  stripTerminalControlSequences,
711
726
  validateSkillName
712
- } from "./chunk-P42KMMU6.js";
713
- import "./chunk-BTICBRPL.js";
714
- import "./chunk-V545KI73.js";
715
- import "./chunk-ADN5KESB.js";
716
- import "./chunk-PPJSG2PU.js";
727
+ } from "./chunk-RZZLNI74.js";
728
+ import "./chunk-IWMYX5LB.js";
717
729
  import {
718
- SessionSourceError
719
- } from "./chunk-ELRMZTPF.js";
730
+ glob
731
+ } from "./chunk-QJNDUTOL.js";
732
+ import "./chunk-QPTE6BKL.js";
720
733
  import "./chunk-U6H3XTFA.js";
721
734
  import "./chunk-ACHCT36C.js";
722
735
  import "./chunk-CHEIIBT3.js";
723
- import "./chunk-AEWCOE64.js";
736
+ import "./chunk-GHG4PQY2.js";
737
+ import "./chunk-YVYK3JYU.js";
738
+ import "./chunk-Q5N5NEVT.js";
739
+ import "./chunk-ADN5KESB.js";
740
+ import "./chunk-SK3RZOPS.js";
741
+ import "./chunk-EVZT24AF.js";
742
+ import {
743
+ SessionSourceError
744
+ } from "./chunk-ELRMZTPF.js";
745
+ import "./chunk-B5WYAQ4I.js";
724
746
  import {
725
747
  APPROVAL_MODES
726
748
  } from "./chunk-JX6XHPTX.js";
727
- import "./chunk-ZSTCM3MX.js";
728
- import "./chunk-SK3RZOPS.js";
729
- import "./chunk-MLXTMF7H.js";
730
- import "./chunk-36SDZ2Q4.js";
749
+ import "./chunk-6C3D7BKK.js";
750
+ import "./chunk-O345BAI3.js";
751
+ import "./chunk-MNU36NGH.js";
752
+ import "./chunk-B3HGO6BB.js";
731
753
  import {
732
754
  NO_EXEC_CONFIG,
733
755
  findGitRoot
734
- } from "./chunk-NXUZFW3G.js";
756
+ } from "./chunk-AUFTA63J.js";
757
+ import "./chunk-NX6JUO42.js";
758
+ import "./chunk-MLXTMF7H.js";
759
+ import "./chunk-BQMSZSG6.js";
760
+ import "./chunk-VNOVK4I7.js";
735
761
  import "./chunk-WFNEY5G7.js";
736
- import "./chunk-YP2K3WOS.js";
737
- import "./chunk-BW2SMO6L.js";
762
+ import "./chunk-5FHOPPLZ.js";
738
763
  import "./chunk-S6LOFUVP.js";
764
+ import "./chunk-BKVPLSEI.js";
765
+ import "./chunk-ZYLZNSBW.js";
766
+ import "./chunk-S7UQ3V2H.js";
767
+ import "./chunk-QE36VXWP.js";
739
768
  import {
740
769
  SubagentError,
741
770
  SubagentErrorCode
742
- } from "./chunk-VVI7MK3V.js";
743
- import "./chunk-WBSJ6VPZ.js";
771
+ } from "./chunk-2A6RZKP2.js";
772
+ import "./chunk-WDVSRQIQ.js";
744
773
  import {
745
774
  escapeXml
746
- } from "./chunk-G6UUOCUT.js";
747
- import "./chunk-IZ2U57NY.js";
775
+ } from "./chunk-GXNXX7A2.js";
776
+ import "./chunk-IITTKFWM.js";
748
777
  import "./chunk-Z72PLR74.js";
749
778
  import "./chunk-NUQ4GK5I.js";
779
+ import "./chunk-KP2FHIFR.js";
780
+ import {
781
+ ALL_PROVIDERS,
782
+ ModelsConfig,
783
+ ProviderInstallError,
784
+ resolveModelProtocol,
785
+ shouldShowStep,
786
+ tryResolveModelProtocol
787
+ } from "./chunk-KWZ2DDOC.js";
750
788
  import {
751
789
  QwenOAuth2Client,
752
790
  QwenOAuthPollError,
@@ -755,24 +793,13 @@ import {
755
793
  isDeviceAuthorizationSuccess,
756
794
  isDeviceTokenPending,
757
795
  isDeviceTokenSuccess
758
- } from "./chunk-DC4ZNGH4.js";
796
+ } from "./chunk-6DB6UHY3.js";
759
797
  import "./chunk-NAVJD2PQ.js";
760
- import "./chunk-3WILPKTJ.js";
761
- import "./chunk-DRAX5YAI.js";
762
- import "./chunk-VNOVK4I7.js";
763
- import "./chunk-S7UQ3V2H.js";
798
+ import "./chunk-KKPIFWTZ.js";
799
+ import "./chunk-NFC4WTY2.js";
800
+ import "./chunk-YSD6IY6F.js";
764
801
  import "./chunk-DJ2GSRLV.js";
765
- import "./chunk-3XBUCOWS.js";
766
- import "./chunk-M4U2LTD2.js";
767
- import "./chunk-KFFCDLKV.js";
768
- import "./chunk-KP2FHIFR.js";
769
- import {
770
- ALL_PROVIDERS,
771
- ModelsConfig,
772
- ProviderInstallError,
773
- resolveProviderProtocol,
774
- shouldShowStep
775
- } from "./chunk-KEM7MWS7.js";
802
+ import "./chunk-MS4SXNJ6.js";
776
803
  import {
777
804
  addDaemonRequestAttribute,
778
805
  captureDaemonTelemetryContext,
@@ -784,14 +811,16 @@ import {
784
811
  recordDaemonHttpResponse,
785
812
  runWithDaemonTelemetryContext,
786
813
  withDaemonRequestSpan
787
- } from "./chunk-G45B3INR.js";
814
+ } from "./chunk-GVTAFLWB.js";
788
815
  import "./chunk-XWRJCPHC.js";
789
816
  import {
790
817
  parseLineTolerant,
791
818
  read
792
- } from "./chunk-CDDP4ONL.js";
819
+ } from "./chunk-K2T5PKFS.js";
793
820
  import "./chunk-5ETULJLP.js";
794
821
  import "./chunk-VGC4I5JJ.js";
822
+ import "./chunk-RVT5L74D.js";
823
+ import "./chunk-HD7O6WLV.js";
795
824
  import {
796
825
  CursorNotAtLineBoundaryError,
797
826
  LargeNonUtf8TextError,
@@ -800,31 +829,34 @@ import {
800
829
  getAllMemoryFilenames,
801
830
  isUtf8CompatibleEncoding,
802
831
  isWithinRoot
803
- } from "./chunk-5NUKK2DT.js";
804
- import "./chunk-EDIDYZBT.js";
805
- import "./chunk-HD7O6WLV.js";
832
+ } from "./chunk-25FMWESU.js";
806
833
  import "./chunk-CFMZLE3L.js";
834
+ import "./chunk-43QUA4MC.js";
807
835
  import "./chunk-WZAD4ZNJ.js";
808
- import "./chunk-TIGXX4PA.js";
809
- import "./chunk-XFFRI3WM.js";
810
- import "./chunk-GJKP6XOB.js";
811
- import "./chunk-7O5PYQ3M.js";
836
+ import "./chunk-EKBQJ627.js";
837
+ import "./chunk-JWV5GI77.js";
838
+ import "./chunk-XZA32HII.js";
839
+ import "./chunk-CA63HYHU.js";
840
+ import "./chunk-SBP43AO6.js";
812
841
  import "./chunk-HHJLM3WQ.js";
813
842
  import {
814
843
  isTelemetrySdkInitialized,
815
844
  redactUrlCredentials,
816
845
  stripAnsiAndControl
817
- } from "./chunk-6USYH3EU.js";
846
+ } from "./chunk-B3XJFEEH.js";
818
847
  import "./chunk-74TONY4F.js";
819
- import "./chunk-SYROIHU7.js";
820
- import "./chunk-RSWBT7AZ.js";
848
+ import "./chunk-ZRQGTRHA.js";
849
+ import "./chunk-VPGRGNNH.js";
850
+ import "./chunk-ERIBG3BX.js";
821
851
  import {
822
- FatalConfigError,
823
852
  Storage,
824
853
  createDebugLogger,
825
- getErrorMessage,
826
854
  runWithoutDebugLogSession
827
- } from "./chunk-ZAFYHRVY.js";
855
+ } from "./chunk-ZYDMQCQP.js";
856
+ import {
857
+ FatalConfigError,
858
+ getErrorMessage
859
+ } from "./chunk-S34QJ6IR.js";
828
860
  import "./chunk-TBWQLLFO.js";
829
861
  import {
830
862
  writeStderrLine,
@@ -2783,7 +2815,7 @@ var require_saxes = __commonJS({
2783
2815
  // packages/cli/src/serve/server.ts
2784
2816
  init_esbuild_shims();
2785
2817
  var import_express7 = __toESM(require_express(), 1);
2786
- import * as path19 from "node:path";
2818
+ import * as path21 from "node:path";
2787
2819
 
2788
2820
  // packages/cli/src/serve/local-control/index.ts
2789
2821
  init_esbuild_shims();
@@ -2930,8 +2962,8 @@ var LocalControlService = class {
2930
2962
  async #serialize(operation) {
2931
2963
  const previous = this.#transition;
2932
2964
  let release;
2933
- this.#transition = new Promise((resolve8) => {
2934
- release = resolve8;
2965
+ this.#transition = new Promise((resolve10) => {
2966
+ release = resolve10;
2935
2967
  });
2936
2968
  await previous;
2937
2969
  try {
@@ -2963,14 +2995,14 @@ function buildPairedUrl(scheme, authority, secret, target) {
2963
2995
  }
2964
2996
  __name(buildPairedUrl, "buildPairedUrl");
2965
2997
  function listen(server, port, host) {
2966
- return new Promise((resolve8, reject) => {
2998
+ return new Promise((resolve10, reject) => {
2967
2999
  const onError = /* @__PURE__ */ __name((error2) => {
2968
3000
  server.removeListener("listening", onListening);
2969
3001
  reject(error2);
2970
3002
  }, "onError");
2971
3003
  const onListening = /* @__PURE__ */ __name(() => {
2972
3004
  server.removeListener("error", onError);
2973
- resolve8();
3005
+ resolve10();
2974
3006
  }, "onListening");
2975
3007
  server.once("error", onError);
2976
3008
  server.once("listening", onListening);
@@ -2979,9 +3011,9 @@ function listen(server, port, host) {
2979
3011
  }
2980
3012
  __name(listen, "listen");
2981
3013
  function close(server) {
2982
- return new Promise((resolve8) => {
3014
+ return new Promise((resolve10) => {
2983
3015
  server.closeAllConnections?.();
2984
- server.close(() => resolve8());
3016
+ server.close(() => resolve10());
2985
3017
  });
2986
3018
  }
2987
3019
  __name(close, "close");
@@ -3749,11 +3781,11 @@ function decodeTextCursor(cursor) {
3749
3781
  return { off, size, dev, ino };
3750
3782
  }
3751
3783
  __name(decodeTextCursor, "decodeTextCursor");
3752
- function assertCursorMatchesFile(cursor, stats, path20) {
3784
+ function assertCursorMatchesFile(cursor, stats, path22) {
3753
3785
  if (String(stats.dev) !== cursor.dev || String(stats.ino) !== cursor.ino || stats.size < cursor.size) {
3754
3786
  throw new FsError(
3755
3787
  "hash_mismatch",
3756
- `cursor no longer matches the file it was issued for: ${path20}`,
3788
+ `cursor no longer matches the file it was issued for: ${path22}`,
3757
3789
  { hint: "re-read the file from the beginning to get a fresh cursor" }
3758
3790
  );
3759
3791
  }
@@ -4732,20 +4764,20 @@ var WorkspaceFileSystemImpl = class {
4732
4764
  if (err instanceof Error && "code" in err && err.code === "workspace_generation_closed") {
4733
4765
  return err;
4734
4766
  }
4735
- const fs11 = wrapAsFsError(err);
4767
+ const fs13 = wrapAsFsError(err);
4736
4768
  if (opts?.audit === false) {
4737
- return fs11;
4769
+ return fs13;
4738
4770
  }
4739
4771
  this.deps.audit.recordDenied(this.deps.ctx, {
4740
4772
  intent,
4741
4773
  input,
4742
- errorKind: fs11.kind,
4743
- hint: fs11.hint,
4774
+ errorKind: fs13.kind,
4775
+ hint: fs13.hint,
4744
4776
  // Quote the underlying OS / FsError message so audit
4745
4777
  // consumers debugging a production incident can see the
4746
4778
  // actual cause (errno text, byte counts, glob pattern,
4747
4779
  // etc.) rather than just `errorKind` + `hint`.
4748
- message: fs11.message,
4780
+ message: fs13.message,
4749
4781
  // For glob denials (parse_error pattern rejection,
4750
4782
  // catastrophic walk failures) the input IS the pattern
4751
4783
  // already; surfacing it on the dedicated `pattern` field
@@ -4754,7 +4786,7 @@ var WorkspaceFileSystemImpl = class {
4754
4786
  // branching on intent.
4755
4787
  pattern: intent === "glob" ? input : void 0
4756
4788
  });
4757
- return fs11;
4789
+ return fs13;
4758
4790
  }
4759
4791
  };
4760
4792
  var CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;
@@ -5580,7 +5612,7 @@ async function renameWithRetryLocal(src, dest, retries, delayMs) {
5580
5612
  const retryable = code === "EPERM" || code === "EACCES";
5581
5613
  if (!retryable || attempt === retries) throw err;
5582
5614
  await new Promise(
5583
- (resolve8) => setTimeout(resolve8, delayMs * 2 ** attempt)
5615
+ (resolve10) => setTimeout(resolve10, delayMs * 2 ** attempt)
5584
5616
  );
5585
5617
  }
5586
5618
  }
@@ -5693,12 +5725,12 @@ function sendFsError(res, err, route) {
5693
5725
  applyReadHeaders(res);
5694
5726
  if (sendGenerationClosedError(res, err)) return;
5695
5727
  if (isFsError(err)) {
5696
- const fs11 = err;
5697
- res.status(fs11.status).json({
5698
- errorKind: fs11.kind,
5699
- error: fs11.message,
5700
- hint: fs11.hint,
5701
- status: fs11.status
5728
+ const fs13 = err;
5729
+ res.status(fs13.status).json({
5730
+ errorKind: fs13.kind,
5731
+ error: fs13.message,
5732
+ hint: fs13.hint,
5733
+ status: fs13.status
5702
5734
  });
5703
5735
  return;
5704
5736
  }
@@ -5811,13 +5843,13 @@ async function handleGetFile(req, res, deps) {
5811
5843
  return;
5812
5844
  }
5813
5845
  const cursor = rawCursor;
5814
- const fs11 = factory.forRequest({
5846
+ const fs13 = factory.forRequest({
5815
5847
  originatorClientId: clientId ?? void 0,
5816
5848
  route: ROUTE2
5817
5849
  });
5818
5850
  try {
5819
- const resolved = await fs11.resolve(queryPath, "read");
5820
- const out = await fs11.readText(resolved, {
5851
+ const resolved = await fs13.resolve(queryPath, "read");
5852
+ const out = await fs13.readText(resolved, {
5821
5853
  maxBytes,
5822
5854
  line,
5823
5855
  limit,
@@ -5878,13 +5910,13 @@ async function handleGetFileBytes(req, res, deps) {
5878
5910
  });
5879
5911
  return;
5880
5912
  }
5881
- const fs11 = factory.forRequest({
5913
+ const fs13 = factory.forRequest({
5882
5914
  originatorClientId: clientId ?? void 0,
5883
5915
  route: ROUTE2
5884
5916
  });
5885
5917
  try {
5886
- const resolved = await fs11.resolve(queryPath, "read");
5887
- const out = await fs11.readBytesWindow(resolved, {
5918
+ const resolved = await fs13.resolve(queryPath, "read");
5919
+ const out = await fs13.readBytesWindow(resolved, {
5888
5920
  offset: offset ?? 0,
5889
5921
  maxBytes: maxBytes ?? DEFAULT_FILE_BYTES_MAX_BYTES
5890
5922
  });
@@ -5912,13 +5944,13 @@ async function handleGetStat(req, res, deps) {
5912
5944
  if (clientId === null) return;
5913
5945
  const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
5914
5946
  if (queryPath === null) return;
5915
- const fs11 = factory.forRequest({
5947
+ const fs13 = factory.forRequest({
5916
5948
  originatorClientId: clientId ?? void 0,
5917
5949
  route: ROUTE2
5918
5950
  });
5919
5951
  try {
5920
- const resolved = await fs11.resolve(queryPath, "stat");
5921
- const st = await fs11.stat(resolved);
5952
+ const resolved = await fs13.resolve(queryPath, "stat");
5953
+ const st = await fs13.stat(resolved);
5922
5954
  applyReadHeaders(res);
5923
5955
  res.status(200).json({
5924
5956
  kind: "stat",
@@ -5941,13 +5973,13 @@ async function handleGetList(req, res, deps) {
5941
5973
  const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
5942
5974
  if (queryPath === null) return;
5943
5975
  const includeIgnored = parseBoolFlag(req.query["includeIgnored"]);
5944
- const fs11 = factory.forRequest({
5976
+ const fs13 = factory.forRequest({
5945
5977
  originatorClientId: clientId ?? void 0,
5946
5978
  route: ROUTE2
5947
5979
  });
5948
5980
  try {
5949
- const resolved = await fs11.resolve(queryPath, "list");
5950
- const entries = await fs11.list(resolved, {
5981
+ const resolved = await fs13.resolve(queryPath, "list");
5982
+ const entries = await fs13.list(resolved, {
5951
5983
  includeIgnored,
5952
5984
  maxEntries: MAX_LIST_ENTRIES + 1
5953
5985
  });
@@ -6000,15 +6032,15 @@ async function handleGetGlob(req, res, deps) {
6000
6032
  }
6001
6033
  const cwdRaw = req.query["cwd"];
6002
6034
  const cwdString = typeof cwdRaw === "string" && cwdRaw.length > 0 ? cwdRaw : void 0;
6003
- const fs11 = factory.forRequest({
6035
+ const fs13 = factory.forRequest({
6004
6036
  originatorClientId: clientId ?? void 0,
6005
6037
  route: ROUTE2
6006
6038
  });
6007
6039
  const start = performance.now();
6008
6040
  try {
6009
- const cwdResolved = cwdString ? await fs11.resolve(cwdString, "list") : void 0;
6041
+ const cwdResolved = cwdString ? await fs13.resolve(cwdString, "list") : void 0;
6010
6042
  const cap = maxResults ?? DEFAULT_GLOB_MAX_RESULTS;
6011
- const probe = await fs11.glob(pattern, {
6043
+ const probe = await fs13.glob(pattern, {
6012
6044
  cwd: cwdResolved,
6013
6045
  includeIgnored,
6014
6046
  maxResults: cap + 1
@@ -6070,7 +6102,7 @@ function registerWorkspaceFileReadRoutes(app, deps) {
6070
6102
  }
6071
6103
  __name(registerWorkspaceFileReadRoutes, "registerWorkspaceFileReadRoutes");
6072
6104
  function registerWorkspaceQualifiedFileReadRoutes(app, deps) {
6073
- const resolve8 = /* @__PURE__ */ __name((req, res) => {
6105
+ const resolve10 = /* @__PURE__ */ __name((req, res) => {
6074
6106
  const runtime = resolveWorkspaceRuntimeFromParam(
6075
6107
  deps.workspaceRegistry,
6076
6108
  req,
@@ -6084,23 +6116,23 @@ function registerWorkspaceQualifiedFileReadRoutes(app, deps) {
6084
6116
  return true;
6085
6117
  }, "resolve");
6086
6118
  app.get("/workspaces/:workspace/file", (req, res) => {
6087
- if (!resolve8(req, res)) return;
6119
+ if (!resolve10(req, res)) return;
6088
6120
  void handleGetFile(req, res, deps);
6089
6121
  });
6090
6122
  app.get("/workspaces/:workspace/file/bytes", (req, res) => {
6091
- if (!resolve8(req, res)) return;
6123
+ if (!resolve10(req, res)) return;
6092
6124
  void handleGetFileBytes(req, res, deps);
6093
6125
  });
6094
6126
  app.get("/workspaces/:workspace/stat", (req, res) => {
6095
- if (!resolve8(req, res)) return;
6127
+ if (!resolve10(req, res)) return;
6096
6128
  void handleGetStat(req, res, deps);
6097
6129
  });
6098
6130
  app.get("/workspaces/:workspace/list", (req, res) => {
6099
- if (!resolve8(req, res)) return;
6131
+ if (!resolve10(req, res)) return;
6100
6132
  void handleGetList(req, res, deps);
6101
6133
  });
6102
6134
  app.get("/workspaces/:workspace/glob", (req, res) => {
6103
- if (!resolve8(req, res)) return;
6135
+ if (!resolve10(req, res)) return;
6104
6136
  void handleGetGlob(req, res, deps);
6105
6137
  });
6106
6138
  }
@@ -6196,7 +6228,7 @@ function validateClientId(clientId, deps, res) {
6196
6228
  }
6197
6229
  __name(validateClientId, "validateClientId");
6198
6230
  function createSetupGithubFileOps(factory, route, originatorClientId, assertGenerationOpen) {
6199
- const fs11 = factory.forRequest({
6231
+ const fs13 = factory.forRequest({
6200
6232
  route,
6201
6233
  ...originatorClientId ? { originatorClientId } : {}
6202
6234
  });
@@ -6224,14 +6256,14 @@ function createSetupGithubFileOps(factory, route, originatorClientId, assertGene
6224
6256
  );
6225
6257
  },
6226
6258
  async writeTextFile(_gitRepoRoot, relativePath, content) {
6227
- const resolved = await fs11.resolve(relativePath, "write");
6228
- const out = await fs11.writeTextOverwrite(resolved, content);
6259
+ const resolved = await fs13.resolve(relativePath, "write");
6260
+ const out = await fs13.writeTextOverwrite(resolved, content);
6229
6261
  return { sizeBytes: out.sizeBytes };
6230
6262
  },
6231
6263
  async readTextFile(_gitRepoRoot, relativePath) {
6232
6264
  try {
6233
- const resolved = await fs11.resolve(relativePath, "read");
6234
- const out = await fs11.readText(resolved);
6265
+ const resolved = await fs13.resolve(relativePath, "read");
6266
+ const out = await fs13.readText(resolved);
6235
6267
  return out.content;
6236
6268
  } catch (error2) {
6237
6269
  if (isFsError(error2) && error2.kind === "path_not_found") {
@@ -9298,8 +9330,8 @@ var StandaloneSessionService = class {
9298
9330
  await this.options.lifecycle.runSharedMany([sessionId], async () => {
9299
9331
  await this.assertCwdReadyUnderShared(runtime, sessionId);
9300
9332
  let resolveAdmission;
9301
- const admission = new Promise((resolve8) => {
9302
- resolveAdmission = resolve8;
9333
+ const admission = new Promise((resolve10) => {
9334
+ resolveAdmission = resolve10;
9303
9335
  });
9304
9336
  let admitted = false;
9305
9337
  const onPromptAdmitted = /* @__PURE__ */ __name(() => {
@@ -11086,8 +11118,8 @@ var StandaloneSessionService = class {
11086
11118
  async admitInitialPrompt(bridge, sessionId, prompt, promptId) {
11087
11119
  const lastEventId = bridge.getSessionLastEventId(sessionId);
11088
11120
  let resolveAdmission;
11089
- const admission = new Promise((resolve8) => {
11090
- resolveAdmission = resolve8;
11121
+ const admission = new Promise((resolve10) => {
11122
+ resolveAdmission = resolve10;
11091
11123
  });
11092
11124
  let admitted = false;
11093
11125
  const turn = bridge.sendPrompt(
@@ -16728,7 +16760,7 @@ var AcpDispatcher = class {
16728
16760
  );
16729
16761
  return;
16730
16762
  }
16731
- const fs11 = this.fsFactory.forRequest({
16763
+ const fs13 = this.fsFactory.forRequest({
16732
16764
  originatorClientId: conn.clientId,
16733
16765
  route: `ACP ${method}`
16734
16766
  });
@@ -16793,8 +16825,8 @@ var AcpDispatcher = class {
16793
16825
  return;
16794
16826
  }
16795
16827
  const cursor = rawCursor;
16796
- const resolved = await fs11.resolve(p, "read");
16797
- const out = await fs11.readText(resolved, {
16828
+ const resolved = await fs13.resolve(p, "read");
16829
+ const out = await fs13.readText(resolved, {
16798
16830
  maxBytes,
16799
16831
  line,
16800
16832
  limit,
@@ -16821,7 +16853,7 @@ var AcpDispatcher = class {
16821
16853
  conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
16822
16854
  return;
16823
16855
  }
16824
- const fs11 = this.fsFactory.forRequest({
16856
+ const fs13 = this.fsFactory.forRequest({
16825
16857
  originatorClientId: conn.clientId,
16826
16858
  route: `ACP ${method}`
16827
16859
  });
@@ -16857,8 +16889,8 @@ var AcpDispatcher = class {
16857
16889
  );
16858
16890
  return;
16859
16891
  }
16860
- const resolved = await fs11.resolve(p, "read");
16861
- const buf = await fs11.readBytesWindow(resolved, { offset, maxBytes });
16892
+ const resolved = await fs13.resolve(p, "read");
16893
+ const buf = await fs13.readBytesWindow(resolved, { offset, maxBytes });
16862
16894
  this.replyConn(conn, id, { path: p, ...buf });
16863
16895
  return;
16864
16896
  }
@@ -16876,12 +16908,12 @@ var AcpDispatcher = class {
16876
16908
  conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
16877
16909
  return;
16878
16910
  }
16879
- const fs11 = this.fsFactory.forRequest({
16911
+ const fs13 = this.fsFactory.forRequest({
16880
16912
  originatorClientId: conn.clientId,
16881
16913
  route: `ACP ${method}`
16882
16914
  });
16883
- const resolved = await fs11.resolve(p, "read");
16884
- const result = await fs11.stat(resolved);
16915
+ const resolved = await fs13.resolve(p, "read");
16916
+ const result = await fs13.stat(resolved);
16885
16917
  this.replyConn(conn, id, { path: p, ...result });
16886
16918
  return;
16887
16919
  }
@@ -16899,13 +16931,13 @@ var AcpDispatcher = class {
16899
16931
  conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
16900
16932
  return;
16901
16933
  }
16902
- const fs11 = this.fsFactory.forRequest({
16934
+ const fs13 = this.fsFactory.forRequest({
16903
16935
  originatorClientId: conn.clientId,
16904
16936
  route: `ACP ${method}`
16905
16937
  });
16906
- const resolved = await fs11.resolve(p, "read");
16938
+ const resolved = await fs13.resolve(p, "read");
16907
16939
  const MAX_LIST = 2e3;
16908
- const entries = await fs11.list(resolved, { maxEntries: MAX_LIST + 1 });
16940
+ const entries = await fs13.list(resolved, { maxEntries: MAX_LIST + 1 });
16909
16941
  const truncated = entries.length > MAX_LIST;
16910
16942
  this.replyConn(conn, id, {
16911
16943
  path: p,
@@ -16930,7 +16962,7 @@ var AcpDispatcher = class {
16930
16962
  );
16931
16963
  return;
16932
16964
  }
16933
- const fs11 = this.fsFactory.forRequest({
16965
+ const fs13 = this.fsFactory.forRequest({
16934
16966
  originatorClientId: conn.clientId,
16935
16967
  route: `ACP ${method}`
16936
16968
  });
@@ -16950,7 +16982,7 @@ var AcpDispatcher = class {
16950
16982
  );
16951
16983
  return;
16952
16984
  }
16953
- const matches = await fs11.glob(pattern, {
16985
+ const matches = await fs13.glob(pattern, {
16954
16986
  maxResults: maxResults + 1
16955
16987
  });
16956
16988
  const truncated = matches.length > maxResults;
@@ -16982,11 +17014,11 @@ var AcpDispatcher = class {
16982
17014
  );
16983
17015
  return;
16984
17016
  }
16985
- const fs11 = this.fsFactory.forRequest({
17017
+ const fs13 = this.fsFactory.forRequest({
16986
17018
  originatorClientId: conn.clientId,
16987
17019
  route: `ACP ${method}`
16988
17020
  });
16989
- const resolved = await fs11.resolve(p, "write");
17021
+ const resolved = await fs13.resolve(p, "write");
16990
17022
  if (Buffer.byteLength(params["content"], "utf8") > 10 * 1024 * 1024) {
16991
17023
  if (id !== void 0)
16992
17024
  conn.sendConn(
@@ -16994,7 +17026,7 @@ var AcpDispatcher = class {
16994
17026
  );
16995
17027
  return;
16996
17028
  }
16997
- await fs11.writeTextOverwrite(resolved, params["content"]);
17029
+ await fs13.writeTextOverwrite(resolved, params["content"]);
16998
17030
  assertGenerationOpen?.();
16999
17031
  this.replyConn(conn, id, { ok: true, path: p });
17000
17032
  return;
@@ -17024,12 +17056,12 @@ var AcpDispatcher = class {
17024
17056
  );
17025
17057
  return;
17026
17058
  }
17027
- const fs11 = this.fsFactory.forRequest({
17059
+ const fs13 = this.fsFactory.forRequest({
17028
17060
  originatorClientId: conn.clientId,
17029
17061
  route: `ACP ${method}`
17030
17062
  });
17031
- const resolved = await fs11.resolve(p, "write");
17032
- const result = await fs11.edit(
17063
+ const resolved = await fs13.resolve(p, "write");
17064
+ const result = await fs13.edit(
17033
17065
  resolved,
17034
17066
  params["oldText"],
17035
17067
  params["newText"]
@@ -18577,9 +18609,9 @@ var AcpConnection = class {
18577
18609
  return Promise.resolve("failed");
18578
18610
  }
18579
18611
  }
18580
- let resolve8;
18612
+ let resolve10;
18581
18613
  const result = new Promise((accept) => {
18582
- resolve8 = accept;
18614
+ resolve10 = accept;
18583
18615
  });
18584
18616
  const prepared = {
18585
18617
  payload,
@@ -18590,7 +18622,7 @@ var AcpConnection = class {
18590
18622
  lease,
18591
18623
  binding,
18592
18624
  requeueOnStreamReplacement,
18593
- resolve: resolve8
18625
+ resolve: resolve10
18594
18626
  };
18595
18627
  if (deliverImmediately) {
18596
18628
  this.deliverPrepared(liveStream, prepared);
@@ -19140,9 +19172,9 @@ var SseStream = class {
19140
19172
  return next.catch(() => "failed");
19141
19173
  }
19142
19174
  doWrite(chunk) {
19143
- return new Promise((resolve8, reject) => {
19175
+ return new Promise((resolve10, reject) => {
19144
19176
  if (this.closed || this.res.writableEnded) {
19145
- resolve8("closed");
19177
+ resolve10("closed");
19146
19178
  return;
19147
19179
  }
19148
19180
  let settled = false;
@@ -19160,7 +19192,7 @@ var SseStream = class {
19160
19192
  if (settled) return;
19161
19193
  settled = true;
19162
19194
  cleanup();
19163
- resolve8(result);
19195
+ resolve10(result);
19164
19196
  }, "settle");
19165
19197
  const finishIfReady = /* @__PURE__ */ __name(() => {
19166
19198
  if (writeReturned !== void 0 && callbackDone && drainDone) {
@@ -19265,9 +19297,9 @@ var WsStream = class {
19265
19297
  }
19266
19298
  enqueueSend(data, options) {
19267
19299
  const next = this.writeChain.then(
19268
- () => new Promise((resolve8) => {
19300
+ () => new Promise((resolve10) => {
19269
19301
  if (this._closed) {
19270
- resolve8("closed");
19302
+ resolve10("closed");
19271
19303
  return;
19272
19304
  }
19273
19305
  let settled = false;
@@ -19275,7 +19307,7 @@ var WsStream = class {
19275
19307
  if (settled) return;
19276
19308
  settled = true;
19277
19309
  this.activeSendClosers.delete(onSocketClose);
19278
- resolve8(result);
19310
+ resolve10(result);
19279
19311
  }, "settle");
19280
19312
  const onSocketClose = /* @__PURE__ */ __name(() => settle("outcome_unknown"), "onSocketClose");
19281
19313
  const callback = /* @__PURE__ */ __name((err) => {
@@ -19657,7 +19689,7 @@ var CdpReverseLink = class {
19657
19689
  throw { code: -32e3, message: "CDP tunnel closed" };
19658
19690
  }
19659
19691
  await this.attach();
19660
- return new Promise((resolve8, reject) => {
19692
+ return new Promise((resolve10, reject) => {
19661
19693
  if (this.disposed) {
19662
19694
  reject({ code: -32e3, message: "CDP tunnel closed" });
19663
19695
  return;
@@ -19668,7 +19700,7 @@ var CdpReverseLink = class {
19668
19700
  `CDP command id=${id} method=${method} timed out after ${this.commandTimeoutMs}ms`
19669
19701
  );
19670
19702
  const progressTimer = this.armProgressLog(id, method);
19671
- this.pending.set(id, { resolve: resolve8, reject, timer, progressTimer });
19703
+ this.pending.set(id, { resolve: resolve10, reject, timer, progressTimer });
19672
19704
  try {
19673
19705
  this.log?.(
19674
19706
  `qwen serve: /cdp forwarded command id=${id} method=${method} to extension`
@@ -19695,7 +19727,7 @@ var CdpReverseLink = class {
19695
19727
  if (this.attached) return Promise.resolve({});
19696
19728
  if (this.attachPromise) return this.attachPromise;
19697
19729
  this.attachPromise = new Promise(
19698
- (resolve8, reject) => {
19730
+ (resolve10, reject) => {
19699
19731
  if (this.disposed) {
19700
19732
  reject({ code: -32e3, message: "CDP tunnel closed" });
19701
19733
  return;
@@ -19705,7 +19737,7 @@ var CdpReverseLink = class {
19705
19737
  this.pendingAttach = {
19706
19738
  id,
19707
19739
  pending: {
19708
- resolve: /* @__PURE__ */ __name((result) => resolve8(result ?? {}), "resolve"),
19740
+ resolve: /* @__PURE__ */ __name((result) => resolve10(result ?? {}), "resolve"),
19709
19741
  reject,
19710
19742
  timer
19711
19743
  }
@@ -20391,7 +20423,7 @@ function isAcpChannelUnavailable(err) {
20391
20423
  }
20392
20424
  __name(isAcpChannelUnavailable, "isAcpChannelUnavailable");
20393
20425
  function delay(ms) {
20394
- return new Promise((resolve8) => setTimeout(resolve8, ms));
20426
+ return new Promise((resolve10) => setTimeout(resolve10, ms));
20395
20427
  }
20396
20428
  __name(delay, "delay");
20397
20429
  function buildChromeDevToolsMcpRuntimeConfig(localPort, hostname, env) {
@@ -20537,7 +20569,7 @@ function mountAcpHttp(app, bridge, opts) {
20537
20569
  const archiveCoordinator = opts.archiveCoordinator ?? new SessionArchiveCoordinator();
20538
20570
  const requestedSessionIdAdmission = opts.requestedSessionIdAdmission;
20539
20571
  const getPrimaryEnv = /* @__PURE__ */ __name(() => opts.workspaceRegistry ? runtimeEffectiveEnv(opts.workspaceRegistry.primary, daemonEnv) : daemonEnv, "getPrimaryEnv");
20540
- const path20 = opts.path ?? "/acp";
20572
+ const path22 = opts.path ?? "/acp";
20541
20573
  const preAttachBudget = new AcpPreAttachBudget({
20542
20574
  maxFrames: ACP_PRE_ATTACH_MAX_FRAMES_GLOBAL,
20543
20575
  maxBytes: ACP_PRE_ATTACH_MAX_PAYLOAD_BYTES_GLOBAL
@@ -20727,7 +20759,7 @@ function mountAcpHttp(app, bridge, opts) {
20727
20759
  const primaryMount = {
20728
20760
  primary: true,
20729
20761
  workspaceCwd: opts.boundWorkspace,
20730
- routeLabel: logSafe(path20),
20762
+ routeLabel: logSafe(path22),
20731
20763
  rateLimitScope: opts.workspaceRegistry?.primary.workspaceId ?? "primary",
20732
20764
  registry,
20733
20765
  dispatcher,
@@ -20881,7 +20913,7 @@ function mountAcpHttp(app, bridge, opts) {
20881
20913
  });
20882
20914
  }, "handleAcpPost");
20883
20915
  app.post(
20884
- path20,
20916
+ path22,
20885
20917
  (req, res) => handleAcpPost(primaryMount, req, res)
20886
20918
  );
20887
20919
  const handleAcpGet = /* @__PURE__ */ __name((mount, req, res) => {
@@ -20980,10 +21012,10 @@ function mountAcpHttp(app, bridge, opts) {
20980
21012
  onPumpSettled();
20981
21013
  });
20982
21014
  }, "handleAcpGet");
20983
- app.get(path20, (req, res) => {
21015
+ app.get(path22, (req, res) => {
20984
21016
  handleAcpGet(primaryMount, req, res);
20985
21017
  });
20986
- app.delete(path20, (req, res) => {
21018
+ app.delete(path22, (req, res) => {
20987
21019
  handleAcpDelete(primaryMount, req, res);
20988
21020
  });
20989
21021
  const createSecondaryAcpMount = /* @__PURE__ */ __name((rt) => {
@@ -21202,7 +21234,7 @@ function mountAcpHttp(app, bridge, opts) {
21202
21234
  const isPluralAcpShape = pluralRawSelector !== null;
21203
21235
  const pluralVoiceRawSelector = opts.workspaceVoiceConnection ? pluralWorkspaceRawSelector(rawPath, PLURAL_VOICE_WS_SUFFIX) : null;
21204
21236
  const isPluralVoiceShape = pluralVoiceRawSelector !== null;
21205
- if (rawPath !== path20 && !isCdpPath && !extraRoute && !isPluralAcpShape && !isPluralVoiceShape) {
21237
+ if (rawPath !== path22 && !isCdpPath && !extraRoute && !isPluralAcpShape && !isPluralVoiceShape) {
21206
21238
  logReject(`unknown-path ${logSafe(rawPath)}`);
21207
21239
  socket.destroy();
21208
21240
  return;
@@ -21772,7 +21804,7 @@ function mountAcpHttp(app, bridge, opts) {
21772
21804
  });
21773
21805
  }, "upgradeListener");
21774
21806
  httpServer.on("upgrade", upgradeListener);
21775
- writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path20}`);
21807
+ writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path22}`);
21776
21808
  }
21777
21809
  __name(setupWebSocket, "setupWebSocket");
21778
21810
  return {
@@ -21979,7 +22011,7 @@ function buildModelsConfig(settings, env) {
21979
22011
  env
21980
22012
  });
21981
22013
  return new ModelsConfig({
21982
- initialAuthType: selectedAuthType,
22014
+ initialAuthType: resolvedCliConfig.authType,
21983
22015
  modelProvidersConfig: merged.modelProviders,
21984
22016
  providerProtocolConfig: merged.providerProtocol,
21985
22017
  generationConfig: resolvedCliConfig.generationConfig,
@@ -22893,7 +22925,7 @@ function writeGenerationSseChunk(res, chunk) {
22893
22925
  if (writable) {
22894
22926
  return res.destroyed ? Promise.reject(new Error("Generation SSE connection destroyed")) : Promise.resolve();
22895
22927
  }
22896
- return new Promise((resolve8, reject) => {
22928
+ return new Promise((resolve10, reject) => {
22897
22929
  const cleanup = /* @__PURE__ */ __name(() => {
22898
22930
  res.off("drain", onDrain);
22899
22931
  res.off("close", onClose);
@@ -22901,7 +22933,7 @@ function writeGenerationSseChunk(res, chunk) {
22901
22933
  }, "cleanup");
22902
22934
  const onDrain = /* @__PURE__ */ __name(() => {
22903
22935
  cleanup();
22904
- resolve8();
22936
+ resolve10();
22905
22937
  }, "onDrain");
22906
22938
  const onClose = /* @__PURE__ */ __name(() => {
22907
22939
  cleanup();
@@ -23155,6 +23187,7 @@ init_esbuild_shims();
23155
23187
  import * as net from "node:net";
23156
23188
  var AUTH_PROVIDER_STEPS = [
23157
23189
  "protocol",
23190
+ "wireApi",
23158
23191
  "baseUrl",
23159
23192
  "apiKey",
23160
23193
  "models",
@@ -23347,6 +23380,14 @@ function parseAuthProviderInstallRequest(body, options) {
23347
23380
  };
23348
23381
  }
23349
23382
  const protocol = body["protocol"];
23383
+ const wireApi = body["wireApi"];
23384
+ if (wireApi !== void 0 && wireApi !== "chat-completions" && wireApi !== "responses") {
23385
+ return {
23386
+ ok: false,
23387
+ code: "invalid_api",
23388
+ error: "`wireApi` must be chat-completions or responses"
23389
+ };
23390
+ }
23350
23391
  const baseUrl = parseAuthProviderBaseUrl(
23351
23392
  body["baseUrl"],
23352
23393
  options?.allowPrivateBaseUrl === true
@@ -23375,11 +23416,11 @@ function parseAuthProviderInstallRequest(body, options) {
23375
23416
  error: "Model purpose requires a custom provider"
23376
23417
  };
23377
23418
  }
23378
- if (purpose === "voice" && ((protocol ?? "openai") !== "openai" || !baseUrl || !modelIds?.length || modelIds.some((id) => resolveVoiceTransport(id) === "unsupported"))) {
23419
+ if (purpose === "voice" && ((protocol ?? "openai") !== "openai" || wireApi === "responses" || !baseUrl || !modelIds?.length || modelIds.some((id) => resolveVoiceTransport(id) === "unsupported"))) {
23379
23420
  return {
23380
23421
  ok: false,
23381
23422
  code: "invalid_voice_model",
23382
- error: "Voice transcription requires OpenAI protocol and a supported ASR model ID"
23423
+ error: "Voice transcription requires OpenAI Chat Completions and a supported ASR model ID"
23383
23424
  };
23384
23425
  }
23385
23426
  if (purpose === "image" && (!modelIds?.length || !baseUrl?.startsWith("https://") || new URL(baseUrl).search || new URL(baseUrl).hash)) {
@@ -23417,6 +23458,7 @@ function parseAuthProviderInstallRequest(body, options) {
23417
23458
  ok: true,
23418
23459
  value: {
23419
23460
  providerId: providerId.trim(),
23461
+ ...wireApi ? { wireApi } : {},
23420
23462
  ...typeof protocol === "string" && protocol.trim() ? {
23421
23463
  protocol: protocol.trim()
23422
23464
  } : {},
@@ -23658,6 +23700,20 @@ function registerWorkspaceAuthRoutes(app, deps) {
23658
23700
  return;
23659
23701
  }
23660
23702
  }
23703
+ try {
23704
+ resolveModelProtocol(
23705
+ installRequest.protocol ?? knownProvider.protocol,
23706
+ {
23707
+ wireApi: installRequest.wireApi
23708
+ }
23709
+ );
23710
+ } catch (error2) {
23711
+ res.status(400).json({
23712
+ error: error2 instanceof Error ? error2.message : String(error2),
23713
+ code: "invalid_api"
23714
+ });
23715
+ return;
23716
+ }
23661
23717
  try {
23662
23718
  const assertGenerationOpen = captureGenerationAssertion?.();
23663
23719
  assertGenerationOpen?.();
@@ -23745,7 +23801,7 @@ function createFifoTaskQueue(limit) {
23745
23801
  Promise.resolve().then(() => item.task(release)).then(item.resolve, item.reject).finally(release);
23746
23802
  }
23747
23803
  }, "pump");
23748
- const enqueue = /* @__PURE__ */ __name((task, options = {}) => new Promise((resolve8, reject) => {
23804
+ const enqueue = /* @__PURE__ */ __name((task, options = {}) => new Promise((resolve10, reject) => {
23749
23805
  if (options.signal?.aborted) {
23750
23806
  reject(abortReason(options.signal));
23751
23807
  return;
@@ -23754,7 +23810,7 @@ function createFifoTaskQueue(limit) {
23754
23810
  task,
23755
23811
  ...options.signal ? { signal: options.signal } : {},
23756
23812
  ...options.onStart ? { onStart: options.onStart } : {},
23757
- resolve: resolve8,
23813
+ resolve: resolve10,
23758
23814
  reject
23759
23815
  };
23760
23816
  if (options.signal) {
@@ -24855,7 +24911,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
24855
24911
  ...interaction,
24856
24912
  id: crypto2.randomUUID()
24857
24913
  };
24858
- return new Promise((resolve8, reject) => {
24914
+ return new Promise((resolve10, reject) => {
24859
24915
  const timeout = setTimeout(() => {
24860
24916
  pendingExtensionInteractions.delete(operationId);
24861
24917
  controller.updateOperation(operationId, {
@@ -24869,7 +24925,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
24869
24925
  timeout.unref?.();
24870
24926
  pendingExtensionInteractions.set(operationId, {
24871
24927
  interaction: pendingInteraction,
24872
- resolve: resolve8,
24928
+ resolve: resolve10,
24873
24929
  reject,
24874
24930
  timeout
24875
24931
  });
@@ -24914,8 +24970,8 @@ function registerWorkspaceExtensionRoutes(app, deps) {
24914
24970
  const reserveRuntimeReconciliation = /* @__PURE__ */ __name(() => {
24915
24971
  let provideTask;
24916
24972
  const task = new Promise(
24917
- (resolve8) => {
24918
- provideTask = resolve8;
24973
+ (resolve10) => {
24974
+ provideTask = resolve10;
24919
24975
  }
24920
24976
  );
24921
24977
  const queued = runtimeReconciliationQueue.run(async () => {
@@ -25018,10 +25074,10 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25018
25074
  generationPoller.unref();
25019
25075
  app.locals.stopExtensionGenerationReconciler = () => clearInterval(generationPoller);
25020
25076
  }
25021
- const registerFor4 = /* @__PURE__ */ __name((base, resolve8) => {
25077
+ const registerFor4 = /* @__PURE__ */ __name((base, resolve10) => {
25022
25078
  app.get(base, async (req, res) => {
25023
25079
  const assertGenerationOpen = deps.captureGenerationAssertion?.();
25024
- const ctrl = resolve8(req, res, false);
25080
+ const ctrl = resolve10(req, res, false);
25025
25081
  if (!ctrl) return;
25026
25082
  try {
25027
25083
  assertGenerationOpen?.();
@@ -25033,12 +25089,12 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25033
25089
  }
25034
25090
  });
25035
25091
  app.get(`${base}/operations`, async (req, res) => {
25036
- const ctrl = resolve8(req, res, false);
25092
+ const ctrl = resolve10(req, res, false);
25037
25093
  if (!ctrl) return;
25038
25094
  res.status(200).json({ v: 1, operations: ctrl.getActiveOperations() });
25039
25095
  });
25040
25096
  app.get(`${base}/operations/:operationId`, async (req, res) => {
25041
- const ctrl = resolve8(req, res, false);
25097
+ const ctrl = resolve10(req, res, false);
25042
25098
  if (!ctrl) return;
25043
25099
  try {
25044
25100
  const operationId = req.params["operationId"];
@@ -25082,7 +25138,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25082
25138
  `${base}/operations/:operationId/interactions/:interactionId`,
25083
25139
  mutate({ strict: true }),
25084
25140
  async (req, res) => {
25085
- const ctrl = resolve8(req, res, false);
25141
+ const ctrl = resolve10(req, res, false);
25086
25142
  if (!ctrl) return;
25087
25143
  try {
25088
25144
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25156,7 +25212,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25156
25212
  extensionArchiveUploadMetadata,
25157
25213
  extensionArchiveBodyParser,
25158
25214
  async (req, res) => {
25159
- const ctrl = resolve8(req, res, true);
25215
+ const ctrl = resolve10(req, res, true);
25160
25216
  if (!ctrl) return;
25161
25217
  try {
25162
25218
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25272,7 +25328,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25272
25328
  }
25273
25329
  );
25274
25330
  app.post(`${base}/install`, mutate({ strict: true }), async (req, res) => {
25275
- const ctrl = resolve8(req, res, true);
25331
+ const ctrl = resolve10(req, res, true);
25276
25332
  if (!ctrl) return;
25277
25333
  try {
25278
25334
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25480,7 +25536,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25480
25536
  `${base}/check-updates`,
25481
25537
  mutate({ strict: true }),
25482
25538
  async (req, res) => {
25483
- const ctrl = resolve8(req, res, true);
25539
+ const ctrl = resolve10(req, res, true);
25484
25540
  if (!ctrl) return;
25485
25541
  let timer;
25486
25542
  let releaseOperationSlot;
@@ -25544,7 +25600,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25544
25600
  }
25545
25601
  );
25546
25602
  app.post(`${base}/refresh`, mutate({ strict: true }), async (req, res) => {
25547
- const ctrl = resolve8(req, res, true);
25603
+ const ctrl = resolve10(req, res, true);
25548
25604
  if (!ctrl) return;
25549
25605
  try {
25550
25606
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25568,7 +25624,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25568
25624
  `${base}/:name/enable`,
25569
25625
  mutate({ strict: true }),
25570
25626
  async (req, res) => {
25571
- const ctrl = resolve8(req, res, true);
25627
+ const ctrl = resolve10(req, res, true);
25572
25628
  if (!ctrl) return;
25573
25629
  try {
25574
25630
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25615,7 +25671,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25615
25671
  `${base}/:name/disable`,
25616
25672
  mutate({ strict: true }),
25617
25673
  async (req, res) => {
25618
- const ctrl = resolve8(req, res, true);
25674
+ const ctrl = resolve10(req, res, true);
25619
25675
  if (!ctrl) return;
25620
25676
  try {
25621
25677
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25662,7 +25718,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25662
25718
  `${base}/:name/update`,
25663
25719
  mutate({ strict: true }),
25664
25720
  async (req, res) => {
25665
- const ctrl = resolve8(req, res, true);
25721
+ const ctrl = resolve10(req, res, true);
25666
25722
  if (!ctrl) return;
25667
25723
  try {
25668
25724
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -25745,7 +25801,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
25745
25801
  }
25746
25802
  );
25747
25803
  app.delete(`${base}/:name`, mutate({ strict: true }), async (req, res) => {
25748
- const ctrl = resolve8(req, res, true);
25804
+ const ctrl = resolve10(req, res, true);
25749
25805
  if (!ctrl) return;
25750
25806
  try {
25751
25807
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -26780,13 +26836,13 @@ async function handlePostFileWrite(req, res, deps) {
26780
26836
  req
26781
26837
  );
26782
26838
  if (originatorClientId === null) return;
26783
- const fs11 = factory.forRequest({
26839
+ const fs13 = factory.forRequest({
26784
26840
  originatorClientId,
26785
26841
  route: ROUTE2
26786
26842
  });
26787
26843
  try {
26788
- const resolved = await fs11.resolve(queryPath, "write");
26789
- const out = await fs11.writeTextAtomic(resolved, content, {
26844
+ const resolved = await fs13.resolve(queryPath, "write");
26845
+ const out = await fs13.writeTextAtomic(resolved, content, {
26790
26846
  mode,
26791
26847
  ...expectedHash ? { expectedHash } : {},
26792
26848
  ...bom !== void 0 ? { bom } : {},
@@ -26839,13 +26895,13 @@ async function handlePostFileEdit(req, res, deps) {
26839
26895
  req
26840
26896
  );
26841
26897
  if (originatorClientId === null) return;
26842
- const fs11 = factory.forRequest({
26898
+ const fs13 = factory.forRequest({
26843
26899
  originatorClientId,
26844
26900
  route: ROUTE2
26845
26901
  });
26846
26902
  try {
26847
- const resolved = await fs11.resolve(queryPath, "edit");
26848
- const out = await fs11.editAtomic(resolved, oldText, newText, {
26903
+ const resolved = await fs13.resolve(queryPath, "edit");
26904
+ const out = await fs13.editAtomic(resolved, oldText, newText, {
26849
26905
  expectedHash
26850
26906
  });
26851
26907
  applyReadHeaders(res);
@@ -26879,7 +26935,7 @@ function registerWorkspaceFileWriteRoutes(app, deps) {
26879
26935
  }
26880
26936
  __name(registerWorkspaceFileWriteRoutes, "registerWorkspaceFileWriteRoutes");
26881
26937
  function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
26882
- const resolve8 = /* @__PURE__ */ __name((req, res) => {
26938
+ const resolve10 = /* @__PURE__ */ __name((req, res) => {
26883
26939
  const runtime = resolveWorkspaceRuntimeFromParam(
26884
26940
  deps.workspaceRegistry,
26885
26941
  req,
@@ -26897,7 +26953,7 @@ function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
26897
26953
  "/workspaces/:workspace/file/write",
26898
26954
  deps.mutate({ strict: true }),
26899
26955
  (req, res) => {
26900
- if (!resolve8(req, res)) return;
26956
+ if (!resolve10(req, res)) return;
26901
26957
  void handlePostFileWrite(req, res, deps);
26902
26958
  }
26903
26959
  );
@@ -26905,7 +26961,7 @@ function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
26905
26961
  "/workspaces/:workspace/file/edit",
26906
26962
  deps.mutate({ strict: true }),
26907
26963
  (req, res) => {
26908
- if (!resolve8(req, res)) return;
26964
+ if (!resolve10(req, res)) return;
26909
26965
  void handlePostFileEdit(req, res, deps);
26910
26966
  }
26911
26967
  );
@@ -26931,10 +26987,10 @@ function createUploadConcurrencyGate(max = MAX_CONCURRENT_UPLOADS) {
26931
26987
  }
26932
26988
  __name(createUploadConcurrencyGate, "createUploadConcurrencyGate");
26933
26989
  var uploadAdmissions = /* @__PURE__ */ new WeakMap();
26934
- function splitStemExtension(basename9) {
26935
- const lastDot = basename9.lastIndexOf(".");
26936
- if (lastDot <= 0) return { stem: basename9, ext: "" };
26937
- return { stem: basename9.slice(0, lastDot), ext: basename9.slice(lastDot) };
26990
+ function splitStemExtension(basename10) {
26991
+ const lastDot = basename10.lastIndexOf(".");
26992
+ if (lastDot <= 0) return { stem: basename10, ext: "" };
26993
+ return { stem: basename10.slice(0, lastDot), ext: basename10.slice(lastDot) };
26938
26994
  }
26939
26995
  __name(splitStemExtension, "splitStemExtension");
26940
26996
  function fitFilenameToByteCap(stem, suffix, ext, capBytes) {
@@ -27067,8 +27123,8 @@ function fileUploadAdmission(deps, opts) {
27067
27123
  return;
27068
27124
  }
27069
27125
  const dir = path10.dirname(queryPath);
27070
- const basename9 = path10.basename(queryPath);
27071
- if (queryPath.endsWith("/") || basename9.length === 0 || basename9 === "." || basename9 === "..") {
27126
+ const basename10 = path10.basename(queryPath);
27127
+ if (queryPath.endsWith("/") || basename10.length === 0 || basename10 === "." || basename10 === "..") {
27072
27128
  sendParseError(res, ROUTE2, "`path` must name a file");
27073
27129
  return;
27074
27130
  }
@@ -27084,11 +27140,11 @@ function fileUploadAdmission(deps, opts) {
27084
27140
  sendParseError(res, ROUTE2, "path must not contain null bytes");
27085
27141
  return;
27086
27142
  }
27087
- if (hasSuspiciousPathPattern(basename9)) {
27143
+ if (hasSuspiciousPathPattern(basename10)) {
27088
27144
  sendParseError(res, ROUTE2, "filename contains a suspicious pattern");
27089
27145
  return;
27090
27146
  }
27091
- if (Buffer.byteLength(basename9, "utf-8") > MAX_UPLOAD_FILENAME_BYTES) {
27147
+ if (Buffer.byteLength(basename10, "utf-8") > MAX_UPLOAD_FILENAME_BYTES) {
27092
27148
  sendParseError(
27093
27149
  res,
27094
27150
  ROUTE2,
@@ -27115,18 +27171,18 @@ function fileUploadAdmission(deps, opts) {
27115
27171
  if (originatorClientId === null) return;
27116
27172
  const factory = getFsFactory3(req, res);
27117
27173
  if (!factory) return;
27118
- const fs11 = factory.forRequest({
27174
+ const fs13 = factory.forRequest({
27119
27175
  originatorClientId,
27120
27176
  route: ROUTE2
27121
27177
  });
27122
- const resolvedDir = await fs11.resolve(dir, "write");
27178
+ const resolvedDir = await fs13.resolve(dir, "write");
27123
27179
  let dirStat;
27124
27180
  try {
27125
- dirStat = await fs11.stat(resolvedDir);
27181
+ dirStat = await fs13.stat(resolvedDir);
27126
27182
  } catch (err) {
27127
27183
  if (isFsError(err) && err.kind === "path_not_found") {
27128
- await fs11.mkdir(resolvedDir, { recursive: true });
27129
- dirStat = await fs11.stat(resolvedDir);
27184
+ await fs13.mkdir(resolvedDir, { recursive: true });
27185
+ dirStat = await fs13.stat(resolvedDir);
27130
27186
  } else {
27131
27187
  throw err;
27132
27188
  }
@@ -27137,8 +27193,8 @@ function fileUploadAdmission(deps, opts) {
27137
27193
  }
27138
27194
  uploadAdmissions.set(req, {
27139
27195
  route: ROUTE2,
27140
- fs: fs11,
27141
- basename: basename9,
27196
+ fs: fs13,
27197
+ basename: basename10,
27142
27198
  resolvedDir,
27143
27199
  queryDir: dir
27144
27200
  });
@@ -27165,8 +27221,8 @@ async function handlePostFileUpload(req, res) {
27165
27221
  });
27166
27222
  return;
27167
27223
  }
27168
- const { route, fs: fs11, basename: basename9, resolvedDir, queryDir } = admission;
27169
- const { stem, ext } = splitStemExtension(basename9);
27224
+ const { route, fs: fs13, basename: basename10, resolvedDir, queryDir } = admission;
27225
+ const { stem, ext } = splitStemExtension(basename10);
27170
27226
  const lease = uploadGateLeases.get(req);
27171
27227
  if (lease) lease.handlerStarted = true;
27172
27228
  try {
@@ -27174,7 +27230,7 @@ async function handlePostFileUpload(req, res) {
27174
27230
  const body = req.body;
27175
27231
  const data = body === void 0 || body === null ? Buffer.alloc(0) : body;
27176
27232
  for (let n = 0; n < NUMBERED_CANDIDATE_CAP; n++) {
27177
- const candidateBasename = n === 0 ? basename9 : fitFilenameToByteCap(
27233
+ const candidateBasename = n === 0 ? basename10 : fitFilenameToByteCap(
27178
27234
  stem,
27179
27235
  ` (${n})`,
27180
27236
  ext,
@@ -27191,7 +27247,7 @@ async function handlePostFileUpload(req, res) {
27191
27247
  const candidateAbs = path10.join(resolvedDir, candidateBasename);
27192
27248
  let resolved;
27193
27249
  try {
27194
- resolved = await fs11.resolve(
27250
+ resolved = await fs13.resolve(
27195
27251
  path10.join(queryDir, candidateBasename),
27196
27252
  "write"
27197
27253
  );
@@ -27206,7 +27262,7 @@ async function handlePostFileUpload(req, res) {
27206
27262
  continue;
27207
27263
  }
27208
27264
  try {
27209
- const out = await fs11.writeBytesAtomic(resolved, data);
27265
+ const out = await fs13.writeBytesAtomic(resolved, data);
27210
27266
  applyReadHeaders(res);
27211
27267
  res.status(201).json({
27212
27268
  kind: "file_upload",
@@ -27226,7 +27282,7 @@ async function handlePostFileUpload(req, res) {
27226
27282
  applyReadHeaders(res);
27227
27283
  res.status(409).json({
27228
27284
  errorKind: "file_already_exists",
27229
- error: `could not allocate a free filename for "${basename9}"`,
27285
+ error: `could not allocate a free filename for "${basename10}"`,
27230
27286
  status: 409
27231
27287
  });
27232
27288
  } catch (err) {
@@ -27977,8 +28033,8 @@ function decodePathSegment(value) {
27977
28033
  }
27978
28034
  __name(decodePathSegment, "decodePathSegment");
27979
28035
  function matchLegacySessionTelemetryRoute(method, requestPath) {
27980
- const path20 = requestPath.length > 1 && requestPath.endsWith("/") ? requestPath.slice(0, -1) : requestPath;
27981
- const requestSegments = path20.split("/").slice(1);
28036
+ const path22 = requestPath.length > 1 && requestPath.endsWith("/") ? requestPath.slice(0, -1) : requestPath;
28037
+ const requestSegments = path22.split("/").slice(1);
27982
28038
  const prefix = requestSegments[0]?.toLowerCase();
27983
28039
  if (prefix !== "session" && prefix !== "sessions" && prefix !== "permission") {
27984
28040
  return void 0;
@@ -28030,26 +28086,26 @@ __name(setDaemonTelemetryWorkspace, "setDaemonTelemetryWorkspace");
28030
28086
  function resolveDaemonTelemetryRoute(req) {
28031
28087
  const legacyRoute = matchLegacySessionTelemetryRoute(req.method, req.path);
28032
28088
  if (legacyRoute) return legacyRoute;
28033
- const path20 = req.path.replace(/\/$/, "") || "/";
28034
- if (req.method === "GET" && path20 === "/daemon/status") {
28089
+ const path22 = req.path.replace(/\/$/, "") || "/";
28090
+ if (req.method === "GET" && path22 === "/daemon/status") {
28035
28091
  return { route: "GET /daemon/status" };
28036
28092
  }
28037
- if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path20)) {
28093
+ if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path22)) {
28038
28094
  return { route: "GET /workspace/:id/sessions" };
28039
28095
  }
28040
- if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions$/.test(path20)) {
28096
+ if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions$/.test(path22)) {
28041
28097
  return { route: "GET /workspace/:id/sessions" };
28042
28098
  }
28043
- if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions\/live-state$/.test(path20)) {
28099
+ if (req.method === "GET" && /^\/workspaces\/[^/]+\/sessions\/live-state$/.test(path22)) {
28044
28100
  return { route: "GET /workspaces/:workspace/sessions/live-state" };
28045
28101
  }
28046
- if (req.method === "GET" && /^\/workspace\/[^/]+\/session-info$/.test(path20)) {
28102
+ if (req.method === "GET" && /^\/workspace\/[^/]+\/session-info$/.test(path22)) {
28047
28103
  return { route: "GET /workspace/:id/session-info" };
28048
28104
  }
28049
- if (req.method === "GET" && /^\/workspaces\/[^/]+\/session-info$/.test(path20)) {
28105
+ if (req.method === "GET" && /^\/workspaces\/[^/]+\/session-info$/.test(path22)) {
28050
28106
  return { route: "GET /workspace/:id/session-info" };
28051
28107
  }
28052
- const workspaceTranscript = path20.match(
28108
+ const workspaceTranscript = path22.match(
28053
28109
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/transcript$/
28054
28110
  );
28055
28111
  if (workspaceTranscript?.[1] && req.method === "GET") {
@@ -28058,7 +28114,7 @@ function resolveDaemonTelemetryRoute(req) {
28058
28114
  sessionId: decodePathSegment(workspaceTranscript[1])
28059
28115
  };
28060
28116
  }
28061
- const workspaceTurnIndex = path20.match(
28117
+ const workspaceTurnIndex = path22.match(
28062
28118
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/turn-index$/
28063
28119
  );
28064
28120
  if (workspaceTurnIndex?.[1] && req.method === "GET") {
@@ -28067,7 +28123,7 @@ function resolveDaemonTelemetryRoute(req) {
28067
28123
  sessionId: decodePathSegment(workspaceTurnIndex[1])
28068
28124
  };
28069
28125
  }
28070
- const workspaceExport = path20.match(
28126
+ const workspaceExport = path22.match(
28071
28127
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/export$/
28072
28128
  );
28073
28129
  if (workspaceExport?.[1] && req.method === "GET") {
@@ -28076,7 +28132,7 @@ function resolveDaemonTelemetryRoute(req) {
28076
28132
  sessionId: decodePathSegment(workspaceExport[1])
28077
28133
  };
28078
28134
  }
28079
- const workspaceArchivedExport = path20.match(
28135
+ const workspaceArchivedExport = path22.match(
28080
28136
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/archive\/export$/
28081
28137
  );
28082
28138
  if (workspaceArchivedExport?.[1] && req.method === "GET") {
@@ -28086,8 +28142,8 @@ function resolveDaemonTelemetryRoute(req) {
28086
28142
  };
28087
28143
  }
28088
28144
  const pluralWorkspacePrefix = /^\/workspaces\/[^/]+/;
28089
- if (pluralWorkspacePrefix.test(path20)) {
28090
- const suffix = path20.replace(pluralWorkspacePrefix, "/workspace");
28145
+ if (pluralWorkspacePrefix.test(path22)) {
28146
+ const suffix = path22.replace(pluralWorkspacePrefix, "/workspace");
28091
28147
  if (req.method === "GET") {
28092
28148
  if (suffix === "/workspace/mcp" || suffix === "/workspace/skills" || suffix === "/workspace/tools" || suffix === "/workspace/providers" || suffix === "/workspace/env" || suffix === "/workspace/preflight" || suffix === "/workspace/hooks" || suffix === "/workspace/settings" || suffix === "/workspace/voice" || suffix === "/workspace/permissions" || suffix === "/workspace/trust" || suffix === "/workspace/memory" || suffix === "/workspace/agents") {
28093
28149
  return { route: `GET ${suffix}` };
@@ -28146,61 +28202,61 @@ function resolveDaemonTelemetryRoute(req) {
28146
28202
  return { route: "DELETE /workspace/session-groups/:groupId" };
28147
28203
  }
28148
28204
  }
28149
- if (req.method === "POST" && path20 === "/workspace/init") {
28205
+ if (req.method === "POST" && path22 === "/workspace/init") {
28150
28206
  return { route: "POST /workspace/init" };
28151
28207
  }
28152
- if (req.method === "POST" && path20 === "/workspace/setup-github") {
28208
+ if (req.method === "POST" && path22 === "/workspace/setup-github") {
28153
28209
  return { route: "POST /workspace/setup-github" };
28154
28210
  }
28155
- if (req.method === "POST" && path20 === "/workspace/reload") {
28211
+ if (req.method === "POST" && path22 === "/workspace/reload") {
28156
28212
  return { route: "POST /workspace/reload" };
28157
28213
  }
28158
- if (req.method === "POST" && path20 === "/language") {
28214
+ if (req.method === "POST" && path22 === "/language") {
28159
28215
  return { route: "POST /language" };
28160
28216
  }
28161
- const mcpRestart = path20.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
28217
+ const mcpRestart = path22.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
28162
28218
  if (mcpRestart?.[1] && req.method === "POST") {
28163
28219
  return { route: "POST /workspace/mcp/:server/restart" };
28164
28220
  }
28165
- if (req.method === "POST" && path20 === "/workspace/mcp/servers") {
28221
+ if (req.method === "POST" && path22 === "/workspace/mcp/servers") {
28166
28222
  return { route: "POST /workspace/mcp/servers" };
28167
28223
  }
28168
- const mcpDelete = path20.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
28224
+ const mcpDelete = path22.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
28169
28225
  if (mcpDelete?.[1] && req.method === "DELETE") {
28170
28226
  return { route: "DELETE /workspace/mcp/servers/:name" };
28171
28227
  }
28172
- if (req.method === "POST" && path20 === "/workspace/auth/device-flow") {
28228
+ if (req.method === "POST" && path22 === "/workspace/auth/device-flow") {
28173
28229
  return { route: "POST /workspace/auth/device-flow" };
28174
28230
  }
28175
- const deviceFlowDelete = path20.match(
28231
+ const deviceFlowDelete = path22.match(
28176
28232
  /^\/workspace\/auth\/device-flow\/([^/]+)$/
28177
28233
  );
28178
28234
  if (deviceFlowDelete?.[1] && req.method === "DELETE") {
28179
28235
  return { route: "DELETE /workspace/auth/device-flow/:id" };
28180
28236
  }
28181
- const toolEnable = path20.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
28237
+ const toolEnable = path22.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
28182
28238
  if (toolEnable?.[1] && req.method === "POST") {
28183
28239
  return { route: "POST /workspace/tools/:name/enable" };
28184
28240
  }
28185
- if (path20 === "/workspace/settings") {
28241
+ if (path22 === "/workspace/settings") {
28186
28242
  if (req.method === "GET") return { route: "GET /workspace/settings" };
28187
28243
  if (req.method === "POST") return { route: "POST /workspace/settings" };
28188
28244
  }
28189
- if (path20 === "/workspace/permissions") {
28245
+ if (path22 === "/workspace/permissions") {
28190
28246
  if (req.method === "GET") return { route: "GET /workspace/permissions" };
28191
28247
  if (req.method === "POST") return { route: "POST /workspace/permissions" };
28192
28248
  }
28193
- if (path20 === "/workspace/trust") {
28249
+ if (path22 === "/workspace/trust") {
28194
28250
  if (req.method === "GET") return { route: "GET /workspace/trust" };
28195
28251
  }
28196
- if (req.method === "POST" && path20 === "/workspace/trust/request") {
28252
+ if (req.method === "POST" && path22 === "/workspace/trust/request") {
28197
28253
  return { route: "POST /workspace/trust/request" };
28198
28254
  }
28199
- if (path20 === "/workspace/voice") {
28255
+ if (path22 === "/workspace/voice") {
28200
28256
  if (req.method === "GET") return { route: "GET /workspace/voice" };
28201
28257
  if (req.method === "POST") return { route: "POST /workspace/voice" };
28202
28258
  }
28203
- if (req.method === "POST" && path20 === "/workspace/voice/transcribe") {
28259
+ if (req.method === "POST" && path22 === "/workspace/voice/transcribe") {
28204
28260
  return { route: "POST /workspace/voice/transcribe" };
28205
28261
  }
28206
28262
  return void 0;
@@ -28313,7 +28369,7 @@ function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
28313
28369
  deferredRuntimePath: deferredRuntime.path
28314
28370
  } : {}
28315
28371
  },
28316
- async (span) => await new Promise((resolve8, reject) => {
28372
+ async (span) => await new Promise((resolve10, reject) => {
28317
28373
  let done = false;
28318
28374
  const finish = /* @__PURE__ */ __name(() => {
28319
28375
  if (done) return;
@@ -28343,7 +28399,7 @@ function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
28343
28399
  if (!successfulSse && route.route !== "GET /daemon/status" && route.route !== "POST /session/:id/heartbeat") {
28344
28400
  recordRequest?.(durationMs, res.statusCode);
28345
28401
  }
28346
- resolve8();
28402
+ resolve10();
28347
28403
  }, "finish");
28348
28404
  res.once("finish", finish);
28349
28405
  res.once("close", finish);
@@ -37930,7 +37986,7 @@ async function rehydrateScheduledTaskSessions(deps) {
37930
37986
  __name(rehydrateScheduledTaskSessions, "rehydrateScheduledTaskSessions");
37931
37987
  function withTimeout(p, ms, label) {
37932
37988
  if (ms > MAX_SESSION_RESTORE_TIMEOUT_MS) return p;
37933
- return new Promise((resolve8, reject) => {
37989
+ return new Promise((resolve10, reject) => {
37934
37990
  const timer = setTimeout(() => {
37935
37991
  reject(new Error(`${label} timed out after ${ms}ms`));
37936
37992
  }, ms);
@@ -37938,7 +37994,7 @@ function withTimeout(p, ms, label) {
37938
37994
  p.then(
37939
37995
  (v) => {
37940
37996
  clearTimeout(timer);
37941
- resolve8(v);
37997
+ resolve10(v);
37942
37998
  },
37943
37999
  (e) => {
37944
38000
  clearTimeout(timer);
@@ -41259,9 +41315,9 @@ function registerSseEventsRoutes(app, deps) {
41259
41315
  );
41260
41316
  activeDrainStartedAt = void 0;
41261
41317
  }, "settleDrainMeasurement");
41262
- const doWrite = /* @__PURE__ */ __name((chunk) => new Promise((resolve8, reject) => {
41318
+ const doWrite = /* @__PURE__ */ __name((chunk) => new Promise((resolve10, reject) => {
41263
41319
  if (res.writableEnded) {
41264
- resolve8("closed");
41320
+ resolve10("closed");
41265
41321
  return;
41266
41322
  }
41267
41323
  let ok;
@@ -41274,7 +41330,7 @@ function registerSseEventsRoutes(app, deps) {
41274
41330
  }
41275
41331
  if (ok) {
41276
41332
  if (trackWriterIdle) lastWriteAt = Date.now();
41277
- resolve8("settled");
41333
+ resolve10("settled");
41278
41334
  return;
41279
41335
  }
41280
41336
  backpressureCount += 1;
@@ -41284,13 +41340,13 @@ function registerSseEventsRoutes(app, deps) {
41284
41340
  res.off("error", onError);
41285
41341
  settleDrainMeasurement();
41286
41342
  if (trackWriterIdle) lastWriteAt = Date.now();
41287
- resolve8("settled");
41343
+ resolve10("settled");
41288
41344
  }, "onDrain");
41289
41345
  const onClose = /* @__PURE__ */ __name(() => {
41290
41346
  res.off("drain", onDrain);
41291
41347
  res.off("error", onError);
41292
41348
  settleDrainMeasurement();
41293
- resolve8("closed");
41349
+ resolve10("closed");
41294
41350
  }, "onClose");
41295
41351
  const onError = /* @__PURE__ */ __name((err) => {
41296
41352
  res.off("drain", onDrain);
@@ -41530,10 +41586,12 @@ __name(registerSseEventsRoutes, "registerSseEventsRoutes");
41530
41586
 
41531
41587
  // packages/cli/src/serve/routes/workspace-models.ts
41532
41588
  init_esbuild_shims();
41589
+ import * as os2 from "node:os";
41533
41590
 
41534
41591
  // packages/cli/src/serve/model-providers-edit.ts
41535
41592
  init_esbuild_shims();
41536
- function isActiveModelSelection(activeModelName, activeBaseUrl, target) {
41593
+ function isActiveModelSelection(activeModelName, activeBaseUrl, target, activeAuthType) {
41594
+ if (activeAuthType && activeAuthType !== target.authType) return false;
41537
41595
  if (!activeModelName || activeModelName !== target.modelId) return false;
41538
41596
  if (!activeBaseUrl) return true;
41539
41597
  if (!target.baseUrl) return false;
@@ -41711,6 +41769,7 @@ function registerWorkspaceModelsRoutes(app, deps) {
41711
41769
  "Model settings changed. Reload and try again."
41712
41770
  );
41713
41771
  let writes;
41772
+ let clearedActiveModel = false;
41714
41773
  try {
41715
41774
  const workspaceTrusted = deps.isWorkspaceTrusted?.();
41716
41775
  const loaded = loadSettings(boundWorkspace, {
@@ -41744,18 +41803,20 @@ function registerWorkspaceModelsRoutes(app, deps) {
41744
41803
  const seenRoutes = /* @__PURE__ */ new Set();
41745
41804
  const remaining = Object.entries(remainingProviders).flatMap(
41746
41805
  ([provider, models]) => {
41747
- const authType = resolveProviderProtocol(
41748
- provider,
41749
- loaded.merged.providerProtocol
41750
- );
41751
- if (!authType || authType === "qwen-oauth" || !Array.isArray(models))
41752
- return [];
41753
- return models.filter((model) => model?.id === removedModelId).filter((model) => {
41806
+ if (!Array.isArray(models)) return [];
41807
+ return models.flatMap((model) => {
41808
+ if (model?.id !== removedModelId) return [];
41809
+ const authType = tryResolveModelProtocol(
41810
+ provider,
41811
+ model,
41812
+ loaded.merged.providerProtocol
41813
+ );
41814
+ if (!authType || authType === "qwen-oauth") return [];
41754
41815
  const route = JSON.stringify([authType, model.baseUrl ?? ""]);
41755
- if (seenRoutes.has(route)) return false;
41816
+ if (seenRoutes.has(route)) return [];
41756
41817
  seenRoutes.add(route);
41757
- return true;
41758
- }).map((model) => ({ model, authType }));
41818
+ return [{ model, authType }];
41819
+ });
41759
41820
  }
41760
41821
  );
41761
41822
  writes = [{ scope, key: "modelProviders", value: next }];
@@ -41764,15 +41825,78 @@ function registerWorkspaceModelsRoutes(app, deps) {
41764
41825
  modelId: removedModelId,
41765
41826
  ...removedBaseUrl ? { baseUrl: removedBaseUrl } : {}
41766
41827
  };
41767
- const remainingRoute = remaining.find(
41768
- ({ model, authType }) => authType === parsed.authType && (model.baseUrl ?? "") === (removedBaseUrl ?? "")
41769
- )?.model;
41828
+ const isOpenAiFamily = /* @__PURE__ */ __name((authType) => authType === "openai" /* USE_OPENAI */ || authType === "openai-responses" /* USE_OPENAI_RESPONSES */, "isOpenAiFamily");
41829
+ const userSettings = new LoadedSettings(
41830
+ loaded.system,
41831
+ loaded.systemDefaults,
41832
+ loaded.user,
41833
+ { ...loaded.workspace, settings: {}, originalSettings: {} },
41834
+ false,
41835
+ /* @__PURE__ */ new Set()
41836
+ ).merged;
41837
+ let workspaceSelectionSurvives = false;
41770
41838
  for (const activeScope of getWritableScopes(loaded)) {
41839
+ const settings = activeScope === "User" /* User */ ? userSettings : loaded.merged;
41771
41840
  const scopeModel = loaded.forScope(activeScope).settings.model;
41772
- if ((!remainingRoute || !isConversationModelConfiguration(remainingRoute)) && isActiveModelSelection(
41841
+ const validProviders = Object.fromEntries(
41842
+ Object.entries(settings.modelProviders ?? {}).map(
41843
+ ([providerId, models]) => [
41844
+ providerId,
41845
+ Array.isArray(models) ? models.filter(
41846
+ (model) => tryResolveModelProtocol(
41847
+ providerId,
41848
+ model,
41849
+ settings.providerProtocol
41850
+ ) !== void 0
41851
+ ) : models
41852
+ ]
41853
+ )
41854
+ );
41855
+ const selectionEnv = activeScope === "User" /* User */ ? buildRuntimeEnvironment(
41856
+ userSettings,
41857
+ os2.homedir(),
41858
+ deps.baseEnv ?? {},
41859
+ false
41860
+ ).effectiveEnv : deps.env ?? {};
41861
+ const selectedAuthType = settings.security?.auth?.selectedType ?? getAuthTypeFromEnv(selectionEnv);
41862
+ const activeSelection = selectedAuthType ? resolveCliGenerationConfig({
41863
+ argv: {},
41864
+ settings: { ...settings, modelProviders: validProviders },
41865
+ selectedAuthType,
41866
+ env: selectionEnv
41867
+ }) : void 0;
41868
+ const activeAuthType = activeSelection?.authType;
41869
+ const providersAfterRemoval = { ...settings.modelProviders };
41870
+ if (scope === "User" /* User */ || activeScope === scope) {
41871
+ providersAfterRemoval[configuration.provider] = remainingProviders[configuration.provider];
41872
+ }
41873
+ const survivor = Object.entries(providersAfterRemoval).flatMap(
41874
+ ([providerId, models]) => Array.isArray(models) ? models.map((model) => ({ providerId, model })) : []
41875
+ ).find(
41876
+ ({ providerId, model }) => model?.id === settings.model?.name && tryResolveModelProtocol(
41877
+ providerId,
41878
+ model,
41879
+ settings.providerProtocol
41880
+ ) === (activeAuthType ?? parsed.authType) && (model.baseUrl ?? null) === (activeSelection ? activeSelection.registryBaseUrl : removedBaseUrl ?? null)
41881
+ )?.model;
41882
+ const selectionAffected = !survivor || !isConversationModelConfiguration(survivor);
41883
+ const selectionMatches = isActiveModelSelection(
41884
+ settings.model?.name,
41885
+ settings.model?.baseUrl,
41886
+ activeTarget,
41887
+ isOpenAiFamily(activeAuthType) ? void 0 : activeAuthType
41888
+ );
41889
+ if (activeScope === "Workspace" /* Workspace */) {
41890
+ workspaceSelectionSurvives = !selectionAffected || !selectionMatches;
41891
+ clearedActiveModel = !workspaceSelectionSurvives;
41892
+ } else if (!loaded.isTrusted) {
41893
+ clearedActiveModel = selectionAffected && selectionMatches;
41894
+ }
41895
+ if (selectionAffected && isActiveModelSelection(
41773
41896
  scopeModel?.name,
41774
41897
  scopeModel?.baseUrl,
41775
- activeTarget
41898
+ activeTarget,
41899
+ isOpenAiFamily(activeAuthType) ? void 0 : activeAuthType
41776
41900
  )) {
41777
41901
  writes.push({ scope: activeScope, key: "model.name", value: "" });
41778
41902
  writes.push({
@@ -41782,6 +41906,39 @@ function registerWorkspaceModelsRoutes(app, deps) {
41782
41906
  });
41783
41907
  }
41784
41908
  }
41909
+ const workspaceModel = loaded.workspace.settings.model;
41910
+ if (loaded.isTrusted && workspaceModel?.name === void 0 && workspaceModel?.baseUrl === void 0) {
41911
+ const nameCleared = writes.some(
41912
+ (write) => write.key === "model.name"
41913
+ );
41914
+ const userCleared = writes.some(
41915
+ (write) => write.scope === "User" /* User */ && write.key === "model.name"
41916
+ );
41917
+ if (!workspaceSelectionSurvives && !nameCleared) {
41918
+ writes.push({
41919
+ scope: "Workspace" /* Workspace */,
41920
+ key: "model.name",
41921
+ value: ""
41922
+ });
41923
+ writes.push({
41924
+ scope: "Workspace" /* Workspace */,
41925
+ key: "model.baseUrl",
41926
+ value: ""
41927
+ });
41928
+ } else if (workspaceSelectionSurvives && userCleared) {
41929
+ const inheritedBaseUrl = loaded.merged.model?.baseUrl ?? "";
41930
+ writes.push({
41931
+ scope: "Workspace" /* Workspace */,
41932
+ key: "model.name",
41933
+ value: loaded.merged.model?.name ?? ""
41934
+ });
41935
+ writes.push({
41936
+ scope: "Workspace" /* Workspace */,
41937
+ key: "model.baseUrl",
41938
+ value: sanitizeProviderBaseUrl(inheritedBaseUrl) === inheritedBaseUrl ? inheritedBaseUrl : ""
41939
+ });
41940
+ }
41941
+ }
41785
41942
  const stillConfigured = remaining.length > 0;
41786
41943
  for (const selectionScope of getWritableScopes(loaded)) {
41787
41944
  const settings = loaded.forScope(selectionScope).settings;
@@ -41934,7 +42091,6 @@ function registerWorkspaceModelsRoutes(app, deps) {
41934
42091
  throw err;
41935
42092
  }
41936
42093
  }
41937
- const clearedActiveModel = writes.some((w) => w.key === "model.name");
41938
42094
  const requiresRestart = writes.some(
41939
42095
  (w) => getSettingDefinition(w.key)?.requiresRestart === true
41940
42096
  );
@@ -42564,10 +42720,10 @@ function installRateLimiter(app, opts, daemonLog, options = {}) {
42564
42720
  { tier, key: key.slice(0, 64) }
42565
42721
  );
42566
42722
  } : void 0,
42567
- onError: daemonLog ? (err, path20) => {
42723
+ onError: daemonLog ? (err, path22) => {
42568
42724
  daemonLog.warn(
42569
42725
  `rate limiter error (fail-open): ${err instanceof Error ? err.message : String(err)}`,
42570
- { path: path20 }
42726
+ { path: path22 }
42571
42727
  );
42572
42728
  } : void 0
42573
42729
  });
@@ -43201,11 +43357,11 @@ function registerWorkspaceManagementRoutes(app, deps) {
43201
43357
  const controller = new AbortController();
43202
43358
  res.on("close", () => controller.abort());
43203
43359
  try {
43204
- const path20 = await pickWorkspaceDirectory(controller.signal);
43360
+ const path22 = await pickWorkspaceDirectory(controller.signal);
43205
43361
  res.status(200).json({
43206
43362
  kind: "workspace-directory-picker",
43207
- selected: path20 !== void 0,
43208
- ...path20 === void 0 ? {} : { path: path20 }
43363
+ selected: path22 !== void 0,
43364
+ ...path22 === void 0 ? {} : { path: path22 }
43209
43365
  });
43210
43366
  } catch (error2) {
43211
43367
  const detail = error2 instanceof Error ? error2.message : String(error2);
@@ -44276,8 +44432,8 @@ function buildDiffList(workspaceCwd, result) {
44276
44432
  hiddenCount: 0
44277
44433
  };
44278
44434
  }
44279
- const files = [...result.perFileStats.entries()].map(([path20, s]) => ({
44280
- path: path20,
44435
+ const files = [...result.perFileStats.entries()].map(([path22, s]) => ({
44436
+ path: path22,
44281
44437
  oldPath: s.oldPath,
44282
44438
  added: s.added,
44283
44439
  removed: s.removed,
@@ -44572,6 +44728,8 @@ __name(registerWorkspaceQualifiedGitLogRoutes, "registerWorkspaceQualifiedGitLog
44572
44728
 
44573
44729
  // packages/cli/src/serve/routes/workspace-git-branches.ts
44574
44730
  init_esbuild_shims();
44731
+ import * as fs9 from "node:fs";
44732
+ import * as path17 from "node:path";
44575
44733
  var GIT_ERROR_MESSAGE_MAX = 512;
44576
44734
  function redactGitPaths(detail, cwd) {
44577
44735
  const gitRoot = findGitRoot(cwd);
@@ -44579,9 +44737,133 @@ function redactGitPaths(detail, cwd) {
44579
44737
  if (gitRoot && gitRoot !== cwd) {
44580
44738
  message = message.split(gitRoot).join("<workspace>");
44581
44739
  }
44740
+ const externals = gitExternalDirs(gitRoot ?? cwd);
44741
+ for (const dir of externals.dirs) {
44742
+ message = message.split(dir).join("<workspace>");
44743
+ }
44744
+ for (const key of externals.truncatedKeys) {
44745
+ message = replaceTruncatedKey(message, key);
44746
+ }
44747
+ const home = process.env["HOME"];
44748
+ if (home) {
44749
+ message = message.split(path17.join(home, ".gitconfig")).join("<home>");
44750
+ message = message.split(`${home}/.gitconfig`).join("<home>");
44751
+ }
44752
+ const xdg = process.env["XDG_CONFIG_HOME"] || (home ? `${home}/.config` : void 0);
44753
+ if (xdg) {
44754
+ message = message.split(path17.join(xdg, "git", "config")).join("<home>");
44755
+ message = message.split(`${xdg}/git/config`).join("<home>");
44756
+ }
44757
+ message = message.split(/(\s+)/).map((token) => /\/etc\/gitconfig\b/.test(token) ? "<home>" : token).join("");
44758
+ message = message.replace(/( in file )(?!<)[^\n]+/g, "$1<config>");
44759
+ message = message.replace(
44760
+ /(unable to access ')(?!<)((?:\/|[A-Za-z]:[\\/]|\\\\)[^']*)(')/g,
44761
+ "$1<config>$3"
44762
+ );
44763
+ message = message.replace(/(<config>')[^'\n]*(')/g, "$1$2");
44764
+ message = message.replace(
44765
+ /(^|[\s(<])'((?:\/|[A-Za-z]:[\\/]|\\\\)[^'\n]*)'/g,
44766
+ "$1'<path>'"
44767
+ );
44768
+ message = message.replace(/('<path>')[^'\n]*\/[^'\n]*(')/g, "$1$2");
44769
+ message = message.replace(
44770
+ /(^|[\s'"(<])(?:\/|[A-Za-z]:[\\/]|\\\\)[^\s'"<>]*/g,
44771
+ "$1<path>"
44772
+ );
44582
44773
  return message;
44583
44774
  }
44584
44775
  __name(redactGitPaths, "redactGitPaths");
44776
+ function replaceTruncatedKey(message, key) {
44777
+ let out = "";
44778
+ let cursor = 0;
44779
+ for (let at = message.indexOf(key); at !== -1; at = message.indexOf(key, cursor)) {
44780
+ const runLength = /^\S*/.exec(message.slice(at + key.length))[0].length;
44781
+ const end = at + key.length + runLength;
44782
+ out += message.slice(cursor, at) + "<workspace>";
44783
+ cursor = end;
44784
+ }
44785
+ return out + message.slice(cursor);
44786
+ }
44787
+ __name(replaceTruncatedKey, "replaceTruncatedKey");
44788
+ function gitExternalDirs(repoRoot) {
44789
+ const out = { dirs: [], truncatedKeys: [] };
44790
+ try {
44791
+ const dotgit = path17.join(repoRoot, ".git");
44792
+ if (!fs9.statSync(dotgit).isFile()) return out;
44793
+ const head = readHead(dotgit, 8192);
44794
+ if (head === null) return out;
44795
+ const m = /^gitdir:\s*(\S[^\n]*?)(?:\r?\n|$)/m.exec(head.text);
44796
+ if (!m) return out;
44797
+ const target = m[1].split("\0")[0] ?? "";
44798
+ if (head.truncated && !m[0].endsWith("\n")) {
44799
+ const key = target.replace(/\uFFFD+$/, "");
44800
+ if (key) out.truncatedKeys.push(key);
44801
+ return out;
44802
+ }
44803
+ const gitdir = path17.resolve(path17.dirname(dotgit), target);
44804
+ const dirs = [];
44805
+ const push = /* @__PURE__ */ __name((dir) => {
44806
+ dirs.push(dir);
44807
+ try {
44808
+ dirs.push(fs9.realpathSync(dir));
44809
+ } catch {
44810
+ }
44811
+ }, "push");
44812
+ push(gitdir);
44813
+ let canonical = gitdir;
44814
+ try {
44815
+ canonical = fs9.realpathSync(gitdir);
44816
+ } catch {
44817
+ }
44818
+ const common = readHead(path17.join(canonical, "commondir"), 4096);
44819
+ if (common !== null) {
44820
+ const commonText = common.text.split("\0")[0] ?? "";
44821
+ if (common.truncated && !commonText.includes("\n")) {
44822
+ const key = commonText.trim().replace(/\uFFFD+$/, "");
44823
+ if (key) out.truncatedKeys.push(key);
44824
+ } else {
44825
+ const first = commonText.split("\n", 1)[0].trim();
44826
+ if (first) {
44827
+ push(path17.resolve(gitdir, first));
44828
+ if (canonical !== gitdir) push(path17.resolve(canonical, first));
44829
+ }
44830
+ }
44831
+ }
44832
+ for (const base of /* @__PURE__ */ new Set([gitdir, canonical])) {
44833
+ if (path17.basename(path17.dirname(base)) === "worktrees") {
44834
+ push(path17.dirname(path17.dirname(base)));
44835
+ }
44836
+ }
44837
+ out.dirs = dirs;
44838
+ return out;
44839
+ } catch {
44840
+ return out;
44841
+ }
44842
+ }
44843
+ __name(gitExternalDirs, "gitExternalDirs");
44844
+ function readHead(file, cap) {
44845
+ let fd = null;
44846
+ try {
44847
+ if (!fs9.statSync(file).isFile()) return null;
44848
+ fd = fs9.openSync(file, "r");
44849
+ const buf = Buffer.alloc(cap + 1);
44850
+ const bytes = fs9.readSync(fd, buf, 0, cap + 1, 0);
44851
+ return {
44852
+ text: buf.toString("utf8", 0, Math.min(bytes, cap)),
44853
+ truncated: bytes > cap
44854
+ };
44855
+ } catch {
44856
+ return null;
44857
+ } finally {
44858
+ if (fd !== null) {
44859
+ try {
44860
+ fs9.closeSync(fd);
44861
+ } catch {
44862
+ }
44863
+ }
44864
+ }
44865
+ }
44866
+ __name(readHead, "readHead");
44585
44867
  function redactGitMessage(detail, cwd) {
44586
44868
  return redactGitPaths(detail, cwd).slice(0, GIT_ERROR_MESSAGE_MAX);
44587
44869
  }
@@ -44590,12 +44872,44 @@ function sendGitError(res, err, route, sendBridgeError2, cwd) {
44590
44872
  let detail;
44591
44873
  if (err && typeof err === "object" && ("stdout" in err || "stderr" in err)) {
44592
44874
  const e = err;
44593
- detail = `${e.stdout ?? ""}
44594
- ${e.stderr ?? ""}`;
44875
+ detail = [e.stdout, e.stderr].filter((part) => typeof part === "string" && part.length > 0).join("\n");
44595
44876
  } else {
44596
44877
  detail = err instanceof Error ? err.message : String(err);
44597
44878
  }
44598
- const message = redactGitMessage(detail, cwd);
44879
+ const fullMessage = redactGitPaths(detail, cwd);
44880
+ const message = fullMessage.slice(0, GIT_ERROR_MESSAGE_MAX);
44881
+ if (/^(?:error|fatal): could not (?:remove config section |set 'remote\.|unset 'branch\.)/i.test(
44882
+ fullMessage
44883
+ ) || /^(?:error|fatal): could not lock config file [^\n]*\n(?:error|fatal): could not (?:remove config section |set 'remote\.|unset 'branch\.)/i.test(
44884
+ fullMessage
44885
+ )) {
44886
+ res.status(409).json({ error: "git_config_write_failed", message });
44887
+ return;
44888
+ }
44889
+ if (/^(?:error|fatal): remote .+ already exists\.?\s*$/i.test(fullMessage)) {
44890
+ res.status(409).json({ error: "remote_already_exists", message });
44891
+ return;
44892
+ }
44893
+ if (/^(?:error|fatal): No such remote: /i.test(fullMessage)) {
44894
+ res.status(404).json({ error: "no_such_remote", message });
44895
+ return;
44896
+ }
44897
+ if (/^remote still configured after removal$/i.test(fullMessage)) {
44898
+ res.status(409).json({ error: "remote_still_configured", message });
44899
+ return;
44900
+ }
44901
+ if (/^remote section lives in an included config file$/i.test(fullMessage)) {
44902
+ res.status(409).json({ error: "remote_section_in_included_file", message });
44903
+ return;
44904
+ }
44905
+ if (/^(?:error|fatal): invalid refspec/i.test(fullMessage)) {
44906
+ res.status(409).json({ error: "remote_config_unparsable", message });
44907
+ return;
44908
+ }
44909
+ if (/^remote already configured in an inherited scope$/i.test(fullMessage)) {
44910
+ res.status(409).json({ error: "remote_shadows_inherited", message });
44911
+ return;
44912
+ }
44599
44913
  if (/not a git repository/i.test(message) || /invalid reference/i.test(message)) {
44600
44914
  res.status(404).json({ error: "not_a_git_repository", message });
44601
44915
  return;
@@ -45096,6 +45410,1325 @@ function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
45096
45410
  }
45097
45411
  __name(registerWorkspaceQualifiedGitBranchRoutes, "registerWorkspaceQualifiedGitBranchRoutes");
45098
45412
 
45413
+ // packages/cli/src/serve/routes/workspace-git-remotes.ts
45414
+ init_esbuild_shims();
45415
+
45416
+ // packages/core/src/utils/git-remotes.ts
45417
+ init_esbuild_shims();
45418
+ import * as fs10 from "node:fs";
45419
+ import * as path18 from "node:path";
45420
+ var CONTROL_CHARS = /[\x00-\x1f\x7f]/;
45421
+ var INVISIBLE_CHARS = /[\u2028\u2029\p{Cc}\p{Cf}\p{Default_Ignorable_Code_Point}]/u;
45422
+ var EXECUTING_HELPER_URL = /^[A-Za-z0-9_.+-]*::/;
45423
+ function isValidRemoteName(name) {
45424
+ return isValidRefName(name) && !name.includes("/") && !name.startsWith("-") && !INVISIBLE_CHARS.test(name);
45425
+ }
45426
+ __name(isValidRemoteName, "isValidRemoteName");
45427
+ function isValidRemoteUrl(url) {
45428
+ return url.length > 0 && !url.startsWith("-") && !EXECUTING_HELPER_URL.test(url) && !CONTROL_CHARS.test(url) && !INVISIBLE_CHARS.test(url);
45429
+ }
45430
+ __name(isValidRemoteUrl, "isValidRemoteUrl");
45431
+ function isRemovableRemoteName(name) {
45432
+ return name.length > 0 && !name.includes("\0") && !name.includes("/");
45433
+ }
45434
+ __name(isRemovableRemoteName, "isRemovableRemoteName");
45435
+ function isNoMatchConfigError(err) {
45436
+ if (!err || typeof err !== "object") return false;
45437
+ const e = err;
45438
+ return e.code === 1 && e.killed !== true && typeof e.signal !== "string" && e.stdout === "" && e.stderr === "";
45439
+ }
45440
+ __name(isNoMatchConfigError, "isNoMatchConfigError");
45441
+ function defaultRefspec(name) {
45442
+ return `+refs/heads/*:refs/remotes/${name}/*`;
45443
+ }
45444
+ __name(defaultRefspec, "defaultRefspec");
45445
+ function stripConfigDump(err) {
45446
+ if (err && typeof err === "object" && "stdout" in err) {
45447
+ err.stdout = "";
45448
+ }
45449
+ }
45450
+ __name(stripConfigDump, "stripConfigDump");
45451
+ async function gitConfigBool(cwd, key, env) {
45452
+ try {
45453
+ const out = await runGit(
45454
+ cwd,
45455
+ ["config", "--type=bool", "--get-all", key],
45456
+ env
45457
+ );
45458
+ return out.split("\n").some((line) => line.trim() === "true");
45459
+ } catch (err) {
45460
+ if (isKillError(err)) {
45461
+ stripConfigDump(err);
45462
+ throw err;
45463
+ }
45464
+ return false;
45465
+ }
45466
+ }
45467
+ __name(gitConfigBool, "gitConfigBool");
45468
+ function isKillError(err) {
45469
+ if (!err || typeof err !== "object") return false;
45470
+ const e = err;
45471
+ return e.killed === true || typeof e.signal === "string";
45472
+ }
45473
+ __name(isKillError, "isKillError");
45474
+ var CONFIG_SCOPES = /* @__PURE__ */ new Set([
45475
+ "system",
45476
+ "global",
45477
+ "local",
45478
+ "worktree",
45479
+ "command",
45480
+ // Apple Git labels its runtime-prefix defaults file `unknown`; the
45481
+ // records are real and git resolves them, so the verification folds
45482
+ // must see them (the listing and the sweep filter on
45483
+ // REPOSITORY_SCOPES regardless).
45484
+ "unknown"
45485
+ ]);
45486
+ var REPOSITORY_SCOPES = /* @__PURE__ */ new Set(["local", "worktree"]);
45487
+ function* iterConfigRecords(raw, withOrigin = false) {
45488
+ const records = raw.split("\0");
45489
+ const stride = withOrigin ? 3 : 2;
45490
+ for (let i = 0; i < records.length; ) {
45491
+ const head = records[i] ?? "";
45492
+ const scoped = CONFIG_SCOPES.has(head);
45493
+ const entry = scoped ? records[i + stride - 1] ?? "" : head;
45494
+ const origin = withOrigin && scoped ? records[i + 1] : void 0;
45495
+ i += scoped ? stride : 1;
45496
+ if (!scoped) continue;
45497
+ const newline = entry.indexOf("\n");
45498
+ yield {
45499
+ scope: head,
45500
+ key: newline === -1 ? entry : entry.slice(0, newline),
45501
+ value: newline === -1 ? "" : entry.slice(newline + 1),
45502
+ valueless: newline === -1,
45503
+ ...origin === void 0 ? {} : { origin }
45504
+ };
45505
+ }
45506
+ }
45507
+ __name(iterConfigRecords, "iterConfigRecords");
45508
+ async function fetchGitRemotes(cwd, env) {
45509
+ await runGit(cwd, ["rev-parse", "--git-dir"], env);
45510
+ let raw;
45511
+ try {
45512
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
45513
+ } catch (err) {
45514
+ if (isNoMatchConfigError(err)) return [];
45515
+ stripConfigDump(err);
45516
+ throw err;
45517
+ }
45518
+ const sections = /* @__PURE__ */ new Map();
45519
+ const promisorNames = /* @__PURE__ */ new Set();
45520
+ for (const record of iterConfigRecords(raw)) {
45521
+ const { scope, key, value } = record;
45522
+ if (!key.startsWith("remote.")) continue;
45523
+ const rest = key.slice("remote.".length);
45524
+ const dot = rest.lastIndexOf(".");
45525
+ if (dot <= 0) continue;
45526
+ const name = rest.slice(0, dot);
45527
+ const sub = rest.slice(dot + 1);
45528
+ if (sub === "promisor") promisorNames.add(name);
45529
+ if (!REPOSITORY_SCOPES.has(scope)) continue;
45530
+ let section = sections.get(name);
45531
+ if (!section) {
45532
+ section = {
45533
+ urls: [],
45534
+ pushUrls: [],
45535
+ refspecs: [],
45536
+ otherSettings: 0
45537
+ };
45538
+ sections.set(name, section);
45539
+ }
45540
+ if (sub === "url") section.urls.push(value);
45541
+ else if (sub === "pushurl") section.pushUrls.push(value);
45542
+ else if (sub === "fetch") section.refspecs.push(value);
45543
+ else if (sub === "partialclonefilter") section.partialCloneFilter = value;
45544
+ else if (sub === "promisor") {
45545
+ } else section.otherSettings += 1;
45546
+ }
45547
+ const remotes = [];
45548
+ for (const [name, section] of sections) {
45549
+ const fetchUrl = section.urls[0] ?? "";
45550
+ remotes.push({
45551
+ name,
45552
+ fetchUrl,
45553
+ pushUrl: section.pushUrls[0] ?? fetchUrl,
45554
+ extraFetchUrls: Math.max(0, section.urls.length - 1),
45555
+ // With no pushurl key git pushes to EVERY url, so the push fan-out
45556
+ // falls back to the url list — `git remote -v` reports all of
45557
+ // them, and the badge must not under-report what a removal loses.
45558
+ extraPushUrls: Math.max(
45559
+ 0,
45560
+ (section.pushUrls.length > 0 ? section.pushUrls.length : section.urls.length) - 1
45561
+ ),
45562
+ promisor: promisorNames.has(name) ? await gitConfigBool(cwd, `remote.${name}.promisor`, env) : false,
45563
+ ...section.partialCloneFilter === void 0 ? {} : { partialCloneFilter: section.partialCloneFilter },
45564
+ customRefspec: section.refspecs.some(
45565
+ (refspec) => refspec !== defaultRefspec(name)
45566
+ ),
45567
+ otherSettings: section.otherSettings
45568
+ });
45569
+ }
45570
+ return remotes;
45571
+ }
45572
+ __name(fetchGitRemotes, "fetchGitRemotes");
45573
+ async function gitRemoteAdd(cwd, name, url, env) {
45574
+ const trimmedUrl = url.trim();
45575
+ if (!isValidRemoteName(name)) {
45576
+ throw new Error(`invalid remote name: ${name}`);
45577
+ }
45578
+ if (!isValidRemoteUrl(trimmedUrl)) {
45579
+ throw new Error("invalid remote url");
45580
+ }
45581
+ await runGit(cwd, ["rev-parse", "--git-dir"], env);
45582
+ const existing = await remoteSectionScopes(cwd, name, env);
45583
+ for (const scope of existing) {
45584
+ if (scope !== "local" && scope !== "worktree") {
45585
+ throw new Error("remote already configured in an inherited scope");
45586
+ }
45587
+ }
45588
+ await runGit(cwd, ["remote", "add", "--", name, trimmedUrl], env);
45589
+ return fetchGitRemotes(cwd, env);
45590
+ }
45591
+ __name(gitRemoteAdd, "gitRemoteAdd");
45592
+ async function gitRemoteRemove(cwd, name, env) {
45593
+ if (!isRemovableRemoteName(name)) {
45594
+ throw new Error("invalid remote name");
45595
+ }
45596
+ const sectionCheck = await remoteSectionRemovalBlock(cwd, name, env);
45597
+ if (sectionCheck.block === "inherited") {
45598
+ throw new Error("remote already configured in an inherited scope");
45599
+ }
45600
+ if (sectionCheck.block === "included") {
45601
+ throw new Error("remote section lives in an included config file");
45602
+ }
45603
+ if ([...remoteSectionScopesFromRaw(sectionCheck.raw, name, true)].some(
45604
+ (scope) => REPOSITORY_SCOPES.has(scope)
45605
+ ) && pushInsteadOfAliasesFromRaw(sectionCheck.raw, true).some(
45606
+ (alias) => name.startsWith(alias)
45607
+ )) {
45608
+ throw new Error("remote still configured after removal");
45609
+ }
45610
+ const pointed = await pointingBranches(cwd, name, env);
45611
+ let removeError = null;
45612
+ try {
45613
+ await runGit(cwd, ["remote", "remove", "--", name], env);
45614
+ } catch (err) {
45615
+ removeError = err;
45616
+ }
45617
+ if (removeError !== null) {
45618
+ await restoreLocalUpstreamBackups(
45619
+ cwd,
45620
+ pointed,
45621
+ name,
45622
+ env,
45623
+ () => discountGate(cwd, name, env)
45624
+ );
45625
+ const detail = execDetail(removeError);
45626
+ const completed = !/^(?:error|fatal): invalid refspec/m.test(detail) && /^(?:error|fatal): Could not remove config section/m.test(detail) && await removeWorktreeScopeSection(cwd, name, env);
45627
+ if (!completed) {
45628
+ if (/^(?:error|fatal): No such remote: /m.test(detail) && // A sectionless NAME that skips the probes (`.` or a scp-like
45629
+ // colon-before-slash spelling — the name predicate excludes
45630
+ // `/`, so the URL and colon-after-slash shapes arise only as
45631
+ // upstream VALUES, in the unmask gate) is admitted by the
45632
+ // lenient name predicate, and a repo whose branch tracks such a
45633
+ // value holds LIVE config a value-matched sweep would destroy
45634
+ // over a 404; bare words and dotted names reach the probes and
45635
+ // refuse there when dangling. The skip trades away one
45636
+ // residual: git accepts a scp-like SECTION name (colon before
45637
+ // the first slash) too, so a hand-made sectionless-named remote
45638
+ // of that shape whose first-attempt cleanup died mid-sweep
45639
+ // converges nothing on retry — accepted
45640
+ // because the two states (never-sectioned live upstream vs
45641
+ // orphaned-by-failed-removal) are indistinguishable once the
45642
+ // section is gone, and sweeping risks the live one.
45643
+ // Pure string test, ahead of the scope read: no spawn for a
45644
+ // name git resolves without a section.
45645
+ !isSectionlessUpstream(name) && (await remoteSectionScopes(cwd, name, env)).size === 0 && // Bare words are distinguishable post-hoc: a name git still
45646
+ // RESOLVES without any config section (an insteadOf alias —
45647
+ // probed to fail no-such-remote with nothing touched) is a live
45648
+ // upstream too — the sweep must not run over git's 404. The
45649
+ // resolver leg here covers insteadOf-aliased names (they probe
45650
+ // to no-such-remote with nothing touched, so the sweep is safe
45651
+ // to skip); a legacy `$GIT_DIR/remotes|branches` file never
45652
+ // reaches this arm — with the file alone git's rm dies "Could
45653
+ // not remove config section" (409) on every attempt, and with
45654
+ // a section plus the file the first attempt's certification
45655
+ // gate is where the leg skips destruction over the live
45656
+ // upstream (git's behavior, mirrored — outside the converge
45657
+ // arm, as both design docs state). Fail-closed: a blind
45658
+ // resolver read throws rather than sweeping.
45659
+ !await remoteStillResolves(cwd, name, env) && // A bare word naming a DIRECTORY repo inside the worktree is a
45660
+ // live local-path upstream (git resolves the path transport),
45661
+ // which the resolver never sees — `--get-url` echoes the name
45662
+ // verbatim without consulting the filesystem (probed). Probe
45663
+ // the path before sweeping.
45664
+ !await bareWordResolvesAsRepoPath(cwd, name, env) && // A `url.<base>.pushInsteadOf = <prefix>` alias keeps a bare
45665
+ // name resolving PUSH-side (the `gh:` pattern) while nothing
45666
+ // fetch-side answers it — no resolver probe can see it (git has
45667
+ // no push-side equivalent), so the dump itself answers. A
45668
+ // prefix over-match skips the sweep: the safe polarity.
45669
+ !(await pushInsteadOfAliases(cwd, env)).some(
45670
+ (alias) => name.startsWith(alias)
45671
+ )) {
45672
+ await deleteRemoteTrackingRefs(cwd, name, env, false);
45673
+ if ((await remoteTrackingRefs(cwd, name, env, false)).length > 0) {
45674
+ throw new Error("remote still configured after removal");
45675
+ }
45676
+ await unsetUpstreamKeys(cwd, pointed, name, env);
45677
+ await sweepSiblingWorktreeKeys(cwd, name, env);
45678
+ if (await sweptUpstreamResolving(cwd, pointed, name, env)) {
45679
+ throw new Error("remote still configured after removal");
45680
+ }
45681
+ const upstreamCtx = await readUpstreamContext(cwd, env);
45682
+ if (await unmaskedPointedUpstream(cwd, pointed, name, env, upstreamCtx)) {
45683
+ throw new Error("remote still configured after removal");
45684
+ }
45685
+ }
45686
+ throw removeError;
45687
+ }
45688
+ }
45689
+ await restoreLocalUpstreamBackups(
45690
+ cwd,
45691
+ pointed,
45692
+ name,
45693
+ env,
45694
+ () => discountGate(cwd, name, env)
45695
+ );
45696
+ let remotes = await fetchGitRemotes(cwd, env);
45697
+ let completedHalf = false;
45698
+ if (remotes.some((remote) => remote.name === name)) {
45699
+ if (await removeWorktreeScopeSection(cwd, name, env)) {
45700
+ completedHalf = true;
45701
+ remotes = await fetchGitRemotes(cwd, env);
45702
+ }
45703
+ }
45704
+ if (completedHalf) {
45705
+ await restoreLocalUpstreamBackups(
45706
+ cwd,
45707
+ pointed,
45708
+ name,
45709
+ env,
45710
+ () => discountGate(cwd, name, env)
45711
+ );
45712
+ }
45713
+ if (remotes.some((remote) => remote.name === name)) {
45714
+ throw new Error("remote still configured after removal");
45715
+ }
45716
+ let unionDump;
45717
+ try {
45718
+ unionDump = await runGit(
45719
+ cwd,
45720
+ ["config", "--list", "--show-scope", "-z"],
45721
+ env
45722
+ );
45723
+ } catch (err) {
45724
+ if (isNoMatchConfigError(err)) {
45725
+ unionDump = "";
45726
+ } else {
45727
+ stripConfigDump(err);
45728
+ throw err;
45729
+ }
45730
+ }
45731
+ if (remoteSectionScopesFromRaw(unionDump, name, false).size > 0 || pushInsteadOfAliasesFromRaw(unionDump, false).some(
45732
+ (alias) => name.startsWith(alias)
45733
+ ) || await remoteStillResolves(cwd, name, env)) {
45734
+ throw new Error("remote still configured after removal");
45735
+ }
45736
+ await deleteRemoteTrackingRefs(cwd, name, env);
45737
+ if ((await remoteTrackingRefs(cwd, name, env)).length > 0) {
45738
+ throw new Error("remote still configured after removal");
45739
+ }
45740
+ await unsetUpstreamKeys(cwd, pointed, name, env);
45741
+ if (await sweptUpstreamResolving(cwd, pointed, name, env)) {
45742
+ throw new Error("remote still configured after removal");
45743
+ }
45744
+ await sweepSiblingWorktreeKeys(cwd, name, env);
45745
+ if (await survivingUpstreamKeys(cwd, name, pointed, env)) {
45746
+ throw new Error("remote still configured after removal");
45747
+ }
45748
+ return remotes;
45749
+ }
45750
+ __name(gitRemoteRemove, "gitRemoteRemove");
45751
+ function execDetail(err) {
45752
+ if (err && typeof err === "object") {
45753
+ const e = err;
45754
+ const stdout = typeof e.stdout === "string" ? e.stdout : "";
45755
+ const stderr = typeof e.stderr === "string" ? e.stderr : "";
45756
+ if (stdout || stderr) return `${stdout}
45757
+ ${stderr}`;
45758
+ return typeof e.message === "string" ? e.message : String(err);
45759
+ }
45760
+ return String(err);
45761
+ }
45762
+ __name(execDetail, "execDetail");
45763
+ async function pathSpellings(cwd, file) {
45764
+ const resolved = path18.resolve(cwd, file).replace(/\\/g, "/");
45765
+ const spellings = /* @__PURE__ */ new Set([resolved]);
45766
+ try {
45767
+ spellings.add((await fs10.promises.realpath(resolved)).replace(/\\/g, "/"));
45768
+ } catch {
45769
+ }
45770
+ return spellings;
45771
+ }
45772
+ __name(pathSpellings, "pathSpellings");
45773
+ async function editableConfigSpellings(cwd, env) {
45774
+ const [gitDir, commonDir] = await Promise.all([
45775
+ runGit(cwd, ["rev-parse", "--git-dir"], env),
45776
+ runGit(cwd, ["rev-parse", "--git-common-dir"], env)
45777
+ ]);
45778
+ const spellings = await pathSpellings(
45779
+ cwd,
45780
+ path18.join(path18.resolve(cwd, commonDir.trim()), "config")
45781
+ );
45782
+ for (const spelling of await pathSpellings(
45783
+ cwd,
45784
+ path18.join(path18.resolve(cwd, gitDir.trim()), "config.worktree")
45785
+ )) {
45786
+ spellings.add(spelling);
45787
+ }
45788
+ return spellings;
45789
+ }
45790
+ __name(editableConfigSpellings, "editableConfigSpellings");
45791
+ async function repoTopLevel(cwd, env) {
45792
+ try {
45793
+ return (await runGit(cwd, ["rev-parse", "--show-toplevel"], env)).trim();
45794
+ } catch (err) {
45795
+ if (isKillError(err)) {
45796
+ stripConfigDump(err);
45797
+ throw err;
45798
+ }
45799
+ return cwd;
45800
+ }
45801
+ }
45802
+ __name(repoTopLevel, "repoTopLevel");
45803
+ async function remoteSectionRemovalBlock(cwd, name, env) {
45804
+ let raw;
45805
+ try {
45806
+ raw = await runGit(
45807
+ cwd,
45808
+ ["config", "--list", "--show-origin", "--show-scope", "-z"],
45809
+ env
45810
+ );
45811
+ } catch (err) {
45812
+ if (isNoMatchConfigError(err)) return { block: null, raw: "" };
45813
+ stripConfigDump(err);
45814
+ throw err;
45815
+ }
45816
+ const [editable, originBase] = await Promise.all([
45817
+ editableConfigSpellings(cwd, env),
45818
+ repoTopLevel(cwd, env)
45819
+ ]);
45820
+ let included = false;
45821
+ let inheritedSeen = false;
45822
+ let repoRecordSeen = false;
45823
+ const prefix = `remote.${name}.`;
45824
+ for (const record of iterConfigRecords(raw, true)) {
45825
+ const { scope, key, origin } = record;
45826
+ if (!key.startsWith(prefix)) continue;
45827
+ const rest = key.slice("remote.".length);
45828
+ const dot = rest.lastIndexOf(".");
45829
+ if (dot <= 0 || rest.slice(0, dot) !== name) continue;
45830
+ if (!REPOSITORY_SCOPES.has(scope)) {
45831
+ inheritedSeen = true;
45832
+ continue;
45833
+ }
45834
+ repoRecordSeen = true;
45835
+ if (origin === void 0 || !origin.startsWith("file:")) {
45836
+ included = true;
45837
+ continue;
45838
+ }
45839
+ let editableOrigin = false;
45840
+ for (const spelling of await pathSpellings(originBase, origin.slice(5))) {
45841
+ if (editable.has(spelling)) {
45842
+ editableOrigin = true;
45843
+ break;
45844
+ }
45845
+ }
45846
+ if (!editableOrigin) included = true;
45847
+ }
45848
+ if (repoRecordSeen && inheritedSeen) return { block: "inherited", raw };
45849
+ return { block: included ? "included" : null, raw };
45850
+ }
45851
+ __name(remoteSectionRemovalBlock, "remoteSectionRemovalBlock");
45852
+ async function remoteStillResolves(cwd, name, env) {
45853
+ try {
45854
+ const out = await runGit(cwd, ["ls-remote", "--get-url", "--", name], env);
45855
+ return (out.endsWith("\n") ? out.slice(0, -1) : out) !== name;
45856
+ } catch (err) {
45857
+ stripConfigDump(err);
45858
+ throw err;
45859
+ }
45860
+ }
45861
+ __name(remoteStillResolves, "remoteStillResolves");
45862
+ async function bareWordResolvesAsRepoPath(cwd, name, env) {
45863
+ try {
45864
+ await runGit(cwd, ["ls-remote", "--", name], env);
45865
+ return true;
45866
+ } catch (err) {
45867
+ if (isKillError(err)) {
45868
+ stripConfigDump(err);
45869
+ throw err;
45870
+ }
45871
+ return false;
45872
+ }
45873
+ }
45874
+ __name(bareWordResolvesAsRepoPath, "bareWordResolvesAsRepoPath");
45875
+ async function pushInsteadOfAliases(cwd, env) {
45876
+ let raw;
45877
+ try {
45878
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
45879
+ } catch (err) {
45880
+ stripConfigDump(err);
45881
+ throw err;
45882
+ }
45883
+ return pushInsteadOfAliasesFromRaw(raw, false);
45884
+ }
45885
+ __name(pushInsteadOfAliases, "pushInsteadOfAliases");
45886
+ function pushInsteadOfAliasesFromRaw(raw, withOrigin) {
45887
+ const out = [];
45888
+ for (const record of iterConfigRecords(raw, withOrigin)) {
45889
+ if (record.value && record.key.startsWith("url.") && record.key.endsWith(".pushinsteadof")) {
45890
+ out.push(record.value);
45891
+ }
45892
+ }
45893
+ return out;
45894
+ }
45895
+ __name(pushInsteadOfAliasesFromRaw, "pushInsteadOfAliasesFromRaw");
45896
+ async function remoteNameResolves(cwd, value, env) {
45897
+ try {
45898
+ const out = await runGit(cwd, ["ls-remote", "--get-url", "--", value], env);
45899
+ return (out.endsWith("\n") ? out.slice(0, -1) : out) !== value;
45900
+ } catch (err) {
45901
+ if (isKillError(err)) {
45902
+ stripConfigDump(err);
45903
+ throw err;
45904
+ }
45905
+ return false;
45906
+ }
45907
+ }
45908
+ __name(remoteNameResolves, "remoteNameResolves");
45909
+ async function remoteSectionScopes(cwd, name, env) {
45910
+ let raw;
45911
+ try {
45912
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
45913
+ } catch (err) {
45914
+ if (isNoMatchConfigError(err)) return /* @__PURE__ */ new Set();
45915
+ stripConfigDump(err);
45916
+ throw err;
45917
+ }
45918
+ return remoteSectionScopesFromRaw(raw, name, false);
45919
+ }
45920
+ __name(remoteSectionScopes, "remoteSectionScopes");
45921
+ function remoteSectionScopesFromRaw(raw, name, withOrigin) {
45922
+ const scopes = /* @__PURE__ */ new Set();
45923
+ const prefix = `remote.${name}.`;
45924
+ for (const record of iterConfigRecords(raw, withOrigin)) {
45925
+ const { scope, key } = record;
45926
+ if (!key.startsWith(prefix)) continue;
45927
+ const rest = key.slice("remote.".length);
45928
+ const dot = rest.lastIndexOf(".");
45929
+ if (dot > 0 && rest.slice(0, dot) === name) scopes.add(scope);
45930
+ }
45931
+ return scopes;
45932
+ }
45933
+ __name(remoteSectionScopesFromRaw, "remoteSectionScopesFromRaw");
45934
+ async function removeWorktreeScopeSection(cwd, name, env) {
45935
+ const scopes = await remoteSectionScopes(cwd, name, env);
45936
+ if (scopes.size !== 1 || !scopes.has("worktree")) return false;
45937
+ try {
45938
+ await runGit(
45939
+ cwd,
45940
+ ["config", "--worktree", "--remove-section", `remote.${name}`],
45941
+ env
45942
+ );
45943
+ } catch {
45944
+ return false;
45945
+ }
45946
+ return true;
45947
+ }
45948
+ __name(removeWorktreeScopeSection, "removeWorktreeScopeSection");
45949
+ async function pointingBranches(cwd, name, env) {
45950
+ let raw;
45951
+ try {
45952
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
45953
+ } catch (err) {
45954
+ stripConfigDump(err);
45955
+ throw err;
45956
+ }
45957
+ const local = /* @__PURE__ */ new Map();
45958
+ const worktree = /* @__PURE__ */ new Map();
45959
+ let pushDefault;
45960
+ let pushDefaultBackup;
45961
+ const collect = /* @__PURE__ */ __name((m, key, value) => {
45962
+ const list = m.get(key) ?? [];
45963
+ list.push(value);
45964
+ m.set(key, list);
45965
+ }, "collect");
45966
+ for (const record of iterConfigRecords(raw)) {
45967
+ const { scope, key, value } = record;
45968
+ if (key === "remote.pushdefault") {
45969
+ pushDefault = value;
45970
+ if (scope === "local") {
45971
+ pushDefaultBackup = pushDefaultBackup ?? [];
45972
+ pushDefaultBackup.push(value);
45973
+ }
45974
+ }
45975
+ if (scope !== "local" && scope !== "worktree") continue;
45976
+ if (!key.startsWith("branch.")) continue;
45977
+ const rest = key.slice("branch.".length);
45978
+ const dot = rest.lastIndexOf(".");
45979
+ if (dot <= 0) continue;
45980
+ const sub = rest.slice(dot + 1);
45981
+ if (sub !== "remote" && sub !== "pushremote" && sub !== "merge") continue;
45982
+ collect(
45983
+ scope === "worktree" ? worktree : local,
45984
+ `${rest.slice(0, dot)}.${sub}`,
45985
+ value
45986
+ );
45987
+ }
45988
+ const pointed = {
45989
+ fetch: /* @__PURE__ */ new Set(),
45990
+ push: /* @__PURE__ */ new Set(),
45991
+ pushDefault,
45992
+ localBackup: /* @__PURE__ */ new Map(),
45993
+ pushDefaultBackup
45994
+ };
45995
+ const lastOf = /* @__PURE__ */ __name((m, key) => m.get(key)?.at(-1), "lastOf");
45996
+ for (const key2 of /* @__PURE__ */ new Set([...local.keys(), ...worktree.keys()])) {
45997
+ if (key2.endsWith(".merge")) continue;
45998
+ if ((lastOf(worktree, key2) ?? lastOf(local, key2)) !== name) continue;
45999
+ const branch = key2.slice(0, key2.lastIndexOf("."));
46000
+ (key2.endsWith(".remote") ? pointed.fetch : pointed.push).add(branch);
46001
+ const backup = {};
46002
+ for (const sub of ["remote", "merge", "pushremote"]) {
46003
+ const values = local.get(`${branch}.${sub}`);
46004
+ if (values !== void 0) backup[sub] = values;
46005
+ }
46006
+ pointed.localBackup.set(branch, backup);
46007
+ }
46008
+ return pointed;
46009
+ }
46010
+ __name(pointingBranches, "pointingBranches");
46011
+ async function upstreamKeysToSweep(cwd, pointed, name, env) {
46012
+ let raw;
46013
+ try {
46014
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
46015
+ } catch (err) {
46016
+ stripConfigDump(err);
46017
+ throw err;
46018
+ }
46019
+ const byScope = /* @__PURE__ */ new Map();
46020
+ for (const record of iterConfigRecords(raw)) {
46021
+ if (record.scope !== "local" && record.scope !== "worktree") continue;
46022
+ let byKey = byScope.get(record.scope);
46023
+ if (!byKey) {
46024
+ byKey = /* @__PURE__ */ new Map();
46025
+ byScope.set(record.scope, byKey);
46026
+ }
46027
+ const list = byKey.get(record.key) ?? [];
46028
+ list.push(record.value);
46029
+ byKey.set(record.key, list);
46030
+ }
46031
+ const keys = [];
46032
+ const seen = /* @__PURE__ */ new Set();
46033
+ const pushKey = /* @__PURE__ */ __name((key) => {
46034
+ const id = `${key.scope}\0${key.key}`;
46035
+ if (!seen.has(id)) {
46036
+ seen.add(id);
46037
+ keys.push(key);
46038
+ }
46039
+ }, "pushKey");
46040
+ for (const [scope, byKey] of byScope) {
46041
+ for (const branch of pointed.fetch) {
46042
+ if ((byKey.get(`branch.${branch}.remote`) ?? []).includes(name)) {
46043
+ pushKey({ scope, key: `branch.${branch}.remote`, fixedValue: name });
46044
+ }
46045
+ const remoteValues = byKey.get(`branch.${branch}.remote`);
46046
+ if ((remoteValues === void 0 || remoteValues.every((value) => value === name)) && byKey.has(`branch.${branch}.merge`)) {
46047
+ pushKey({ scope, key: `branch.${branch}.merge` });
46048
+ }
46049
+ if ((byKey.get(`branch.${branch}.pushremote`) ?? []).includes(name)) {
46050
+ pushKey({
46051
+ scope,
46052
+ key: `branch.${branch}.pushremote`,
46053
+ fixedValue: name
46054
+ });
46055
+ }
46056
+ }
46057
+ for (const branch of pointed.push) {
46058
+ if ((byKey.get(`branch.${branch}.pushremote`) ?? []).includes(name)) {
46059
+ pushKey({
46060
+ scope,
46061
+ key: `branch.${branch}.pushremote`,
46062
+ fixedValue: name
46063
+ });
46064
+ }
46065
+ }
46066
+ if ((byKey.get("remote.pushdefault") ?? []).includes(name)) {
46067
+ pushKey({ scope, key: "remote.pushdefault", fixedValue: name });
46068
+ }
46069
+ for (const [key, values] of byKey) {
46070
+ if (!key.startsWith("branch.")) continue;
46071
+ const rest = key.slice("branch.".length);
46072
+ const dot = rest.lastIndexOf(".");
46073
+ if (dot <= 0) continue;
46074
+ const sub = rest.slice(dot + 1);
46075
+ if (sub !== "remote" && sub !== "pushremote") continue;
46076
+ if (values.includes(name)) {
46077
+ pushKey({ scope, key, fixedValue: name });
46078
+ }
46079
+ }
46080
+ }
46081
+ return keys;
46082
+ }
46083
+ __name(upstreamKeysToSweep, "upstreamKeysToSweep");
46084
+ async function remoteTrackingRefs(cwd, name, env, includeBareRef = true) {
46085
+ let refsRaw;
46086
+ let namesRaw;
46087
+ let fetchRaw;
46088
+ try {
46089
+ [refsRaw, namesRaw, fetchRaw] = await Promise.all([
46090
+ runGit(
46091
+ cwd,
46092
+ ["for-each-ref", "--format=%(refname)", "refs/remotes/"],
46093
+ env
46094
+ ),
46095
+ runGit(cwd, ["remote"], env),
46096
+ // Surviving remotes can own refs OUTSIDE their own namespace (a
46097
+ // second fetch refspec desting into refs/remotes/release/*, or a
46098
+ // flat refs/remotes/*): name-prefix ownership would hand those
46099
+ // live refs to the sweep of an unconfigured name. Read the dest
46100
+ // namespaces and treat them as foreign. NUL-framed like every
46101
+ // sibling read: a newline-bearing fetch value would otherwise
46102
+ // hide its own namespace (or inject a fake `remote.<x>.fetch`
46103
+ // line) under line framing.
46104
+ runGit(
46105
+ cwd,
46106
+ ["config", "-z", "--get-regexp", "^remote\\..*\\.fetch$"],
46107
+ env
46108
+ ).catch((err) => {
46109
+ if (isNoMatchConfigError(err)) return "";
46110
+ stripConfigDump(err);
46111
+ throw err;
46112
+ })
46113
+ ]);
46114
+ } catch (err) {
46115
+ stripConfigDump(err);
46116
+ throw err;
46117
+ }
46118
+ const foreignRoots = /* @__PURE__ */ new Set();
46119
+ for (const entry of fetchRaw.split("\0")) {
46120
+ if (entry === "") continue;
46121
+ const nl = entry.indexOf("\n");
46122
+ if (nl < 0) continue;
46123
+ const value = entry.slice(nl + 1);
46124
+ const colon = value.lastIndexOf(":");
46125
+ const target = colon >= 0 ? value.slice(colon + 1) : value;
46126
+ if (!target.startsWith("refs/remotes/")) continue;
46127
+ const rest = target.slice("refs/remotes/".length);
46128
+ if (!rest.includes("*")) {
46129
+ foreignRoots.add(rest);
46130
+ } else if (rest === "*") {
46131
+ foreignRoots.add("");
46132
+ } else if (rest.endsWith("/*") && !rest.slice(0, -2).includes("*")) {
46133
+ foreignRoots.add(rest.slice(0, -2));
46134
+ } else {
46135
+ foreignRoots.add("");
46136
+ }
46137
+ }
46138
+ const owners = [...namesRaw.split("\n").filter(Boolean), name];
46139
+ return refsRaw.split("\n").filter((ref) => ref !== "").filter((ref) => {
46140
+ if (owningRemote(ref, owners) !== name) return false;
46141
+ const rel = ref.slice("refs/remotes/".length);
46142
+ for (const root of foreignRoots) {
46143
+ if (root === "" || rel === root || rel.startsWith(`${root}/`)) {
46144
+ return false;
46145
+ }
46146
+ }
46147
+ return includeBareRef || ref !== `refs/remotes/${name}`;
46148
+ });
46149
+ }
46150
+ __name(remoteTrackingRefs, "remoteTrackingRefs");
46151
+ function owningRemote(ref, names) {
46152
+ let best;
46153
+ for (const n of names) {
46154
+ const prefix = `refs/remotes/${n}`;
46155
+ if (ref !== prefix && !ref.startsWith(`${prefix}/`)) continue;
46156
+ if (best === void 0 || n.length > best.length) best = n;
46157
+ }
46158
+ return best;
46159
+ }
46160
+ __name(owningRemote, "owningRemote");
46161
+ async function deleteRemoteTrackingRefs(cwd, name, env, includeBareRef = true) {
46162
+ for (const ref of await remoteTrackingRefs(cwd, name, env, includeBareRef)) {
46163
+ try {
46164
+ await runGit(cwd, ["update-ref", "--no-deref", "-d", ref], env);
46165
+ } catch {
46166
+ }
46167
+ }
46168
+ }
46169
+ __name(deleteRemoteTrackingRefs, "deleteRemoteTrackingRefs");
46170
+ async function worktreeScopeRecords(cwd, env) {
46171
+ let raw;
46172
+ try {
46173
+ raw = await runGit(cwd, ["config", "--worktree", "--list", "-z"], env);
46174
+ } catch (err) {
46175
+ const detail = err && typeof err === "object" ? String(
46176
+ err.stderr ?? err.message ?? ""
46177
+ ) : "";
46178
+ if (/unable to read config file.*No such file/s.test(detail) || /--worktree cannot be used/s.test(detail)) {
46179
+ return /* @__PURE__ */ new Map();
46180
+ }
46181
+ stripConfigDump(err);
46182
+ throw err;
46183
+ }
46184
+ const byKey = /* @__PURE__ */ new Map();
46185
+ for (const entry of raw.split("\0")) {
46186
+ if (entry === "") continue;
46187
+ const newline = entry.indexOf("\n");
46188
+ const key = newline === -1 ? entry : entry.slice(0, newline);
46189
+ const value = newline === -1 ? "" : entry.slice(newline + 1);
46190
+ const list = byKey.get(key) ?? [];
46191
+ list.push(value);
46192
+ byKey.set(key, list);
46193
+ }
46194
+ return byKey;
46195
+ }
46196
+ __name(worktreeScopeRecords, "worktreeScopeRecords");
46197
+ async function sweepSiblingWorktreeKeys(cwd, name, env) {
46198
+ let listed;
46199
+ try {
46200
+ listed = await runGit(cwd, ["worktree", "list", "--porcelain", "-z"], env);
46201
+ } catch (err) {
46202
+ stripConfigDump(err);
46203
+ throw err;
46204
+ }
46205
+ let topSpellings;
46206
+ let ownCommonSpellings;
46207
+ const records = [];
46208
+ let lines = [];
46209
+ for (const field of listed.split("\0")) {
46210
+ if (field === "") {
46211
+ if (lines.length > 0) records.push(lines);
46212
+ lines = [];
46213
+ } else {
46214
+ lines.push(field);
46215
+ }
46216
+ }
46217
+ if (lines.length > 0) records.push(lines);
46218
+ for (const record of records) {
46219
+ const first = record[0] ?? "";
46220
+ if (!first.startsWith("worktree ")) continue;
46221
+ const wt = first.slice("worktree ".length);
46222
+ if (record.some((line) => line === "prunable" || line.startsWith("prunable ")))
46223
+ continue;
46224
+ if (topSpellings === void 0) {
46225
+ topSpellings = await pathSpellings(cwd, await repoTopLevel(cwd, env));
46226
+ }
46227
+ const wtSpellings = await pathSpellings(cwd, wt);
46228
+ if ([...wtSpellings].some((spelling) => topSpellings.has(spelling))) {
46229
+ continue;
46230
+ }
46231
+ let siblingCommon;
46232
+ try {
46233
+ siblingCommon = (await runGit(wt, ["rev-parse", "--git-common-dir"], env)).trim();
46234
+ } catch (err) {
46235
+ stripConfigDump(err);
46236
+ throw err;
46237
+ }
46238
+ if (ownCommonSpellings === void 0) {
46239
+ let ownCommon;
46240
+ try {
46241
+ ownCommon = (await runGit(cwd, ["rev-parse", "--git-common-dir"], env)).trim();
46242
+ } catch (err) {
46243
+ stripConfigDump(err);
46244
+ throw err;
46245
+ }
46246
+ ownCommonSpellings = await pathSpellings(
46247
+ cwd,
46248
+ path18.resolve(cwd, ownCommon)
46249
+ );
46250
+ }
46251
+ const siblingSpellings = await pathSpellings(
46252
+ wt,
46253
+ path18.resolve(wt, siblingCommon)
46254
+ );
46255
+ if (![...siblingSpellings].some((sp) => ownCommonSpellings.has(sp))) {
46256
+ continue;
46257
+ }
46258
+ let byKey;
46259
+ try {
46260
+ byKey = await worktreeScopeRecords(wt, env);
46261
+ } catch (err) {
46262
+ stripConfigDump(err);
46263
+ throw err;
46264
+ }
46265
+ for (const key of byKey.keys()) {
46266
+ if (!key.startsWith(`remote.${name}.`)) continue;
46267
+ const rest = key.slice("remote.".length);
46268
+ const dot = rest.lastIndexOf(".");
46269
+ if (dot > 0 && rest.slice(0, dot) === name) {
46270
+ throw new Error("remote still configured after removal");
46271
+ }
46272
+ }
46273
+ const keys = [];
46274
+ for (const [key, values] of byKey) {
46275
+ if (key === "remote.pushdefault") {
46276
+ if (values.includes(name)) keys.push(key);
46277
+ continue;
46278
+ }
46279
+ if (!key.startsWith("branch.")) continue;
46280
+ const rest = key.slice("branch.".length);
46281
+ const dot = rest.lastIndexOf(".");
46282
+ if (dot <= 0) continue;
46283
+ const sub = rest.slice(dot + 1);
46284
+ if (sub === "remote" || sub === "pushremote") {
46285
+ if (values.includes(name)) keys.push(key);
46286
+ } else if (sub === "merge") {
46287
+ const remoteValues = byKey.get(`branch.${rest.slice(0, dot)}.remote`);
46288
+ if (remoteValues !== void 0 && remoteValues.includes(name) && remoteValues.every((value) => value === name)) {
46289
+ keys.push(key);
46290
+ }
46291
+ }
46292
+ }
46293
+ for (const key of keys) {
46294
+ const isMerge = key.endsWith(".merge");
46295
+ const args = isMerge ? ["config", "--worktree", "--unset-all", key] : ["config", "--worktree", "--fixed-value", "--unset-all", key, name];
46296
+ try {
46297
+ await runGit(wt, args, env);
46298
+ } catch {
46299
+ }
46300
+ }
46301
+ const after = await worktreeScopeRecords(wt, env);
46302
+ for (const [key, values] of after) {
46303
+ if (key === "remote.pushdefault" && values.includes(name)) {
46304
+ throw new Error("remote still configured after removal");
46305
+ }
46306
+ if (key.startsWith("branch.") && (key.endsWith(".remote") || key.endsWith(".pushremote")) && values.includes(name)) {
46307
+ throw new Error("remote still configured after removal");
46308
+ }
46309
+ }
46310
+ }
46311
+ }
46312
+ __name(sweepSiblingWorktreeKeys, "sweepSiblingWorktreeKeys");
46313
+ async function localBranchKeyValues(cwd, key, env) {
46314
+ try {
46315
+ const out = await runGit(
46316
+ cwd,
46317
+ ["config", "--local", "--includes", "--get-all", "-z", key],
46318
+ env
46319
+ );
46320
+ return out.split("\0").filter((v, i, a) => v !== "" || i < a.length - 1);
46321
+ } catch (err) {
46322
+ if (isNoMatchConfigError(err)) return [];
46323
+ stripConfigDump(err);
46324
+ throw err;
46325
+ }
46326
+ }
46327
+ __name(localBranchKeyValues, "localBranchKeyValues");
46328
+ async function restoreLocalUpstreamBackups(cwd, pointed, name, env, sectionGone) {
46329
+ let gateMemo;
46330
+ const sectionGoneOnce = /* @__PURE__ */ __name(async () => {
46331
+ if (gateMemo === void 0) gateMemo = await sectionGone();
46332
+ return gateMemo;
46333
+ }, "sectionGoneOnce");
46334
+ for (const [branch, backup] of pointed.localBackup) {
46335
+ const remoteNowRaw = await localBranchKeyValues(
46336
+ cwd,
46337
+ `branch.${branch}.remote`,
46338
+ env
46339
+ );
46340
+ const remoteRestore = (backup.remote ?? []).filter((v) => v !== name);
46341
+ const pushNowRaw = await localBranchKeyValues(
46342
+ cwd,
46343
+ `branch.${branch}.pushremote`,
46344
+ env
46345
+ );
46346
+ const pushRestore = (backup.pushremote ?? []).filter((v) => v !== name);
46347
+ const sectionGoneNow = remoteNowRaw.includes(name) && remoteRestore.length > 0 || pushNowRaw.includes(name) && pushRestore.length > 0 ? await sectionGoneOnce() : true;
46348
+ const remoteNow = sectionGoneNow ? remoteNowRaw.filter((v) => v !== name) : remoteNowRaw;
46349
+ const remoteRestored = remoteNow.length === 0 && remoteRestore.length > 0;
46350
+ if (remoteRestored) {
46351
+ for (const value of remoteRestore) {
46352
+ await runGit(
46353
+ cwd,
46354
+ ["config", "--local", "--add", `branch.${branch}.remote`, value],
46355
+ env
46356
+ );
46357
+ }
46358
+ }
46359
+ if (remoteRestored || remoteNowRaw.length > 0) {
46360
+ const mergeNow = await localBranchKeyValues(
46361
+ cwd,
46362
+ `branch.${branch}.merge`,
46363
+ env
46364
+ );
46365
+ if (mergeNow.length === 0) {
46366
+ for (const value of backup.merge ?? []) {
46367
+ await runGit(
46368
+ cwd,
46369
+ ["config", "--local", "--add", `branch.${branch}.merge`, value],
46370
+ env
46371
+ );
46372
+ }
46373
+ }
46374
+ }
46375
+ const pushNow = sectionGoneNow ? pushNowRaw.filter((v) => v !== name) : pushNowRaw;
46376
+ if (pushNow.length === 0 && pushRestore.length > 0) {
46377
+ for (const value of pushRestore) {
46378
+ await runGit(
46379
+ cwd,
46380
+ ["config", "--local", "--add", `branch.${branch}.pushremote`, value],
46381
+ env
46382
+ );
46383
+ }
46384
+ }
46385
+ }
46386
+ const pdRestore = (pointed.pushDefaultBackup ?? []).filter((v) => v !== name);
46387
+ if (pdRestore.length > 0) {
46388
+ const pdNowRaw = await localBranchKeyValues(cwd, "remote.pushdefault", env);
46389
+ const pdNow = pdNowRaw.includes(name) ? await sectionGoneOnce() ? pdNowRaw.filter((v) => v !== name) : pdNowRaw : pdNowRaw;
46390
+ if (pdNow.length === 0) {
46391
+ for (const value of pdRestore) {
46392
+ await runGit(
46393
+ cwd,
46394
+ ["config", "--local", "--add", "remote.pushdefault", value],
46395
+ env
46396
+ );
46397
+ }
46398
+ }
46399
+ }
46400
+ }
46401
+ __name(restoreLocalUpstreamBackups, "restoreLocalUpstreamBackups");
46402
+ async function discountGate(cwd, name, env) {
46403
+ let gateDump;
46404
+ try {
46405
+ gateDump = await runGit(
46406
+ cwd,
46407
+ ["config", "--list", "--show-scope", "-z"],
46408
+ env
46409
+ );
46410
+ } catch (err) {
46411
+ if (isNoMatchConfigError(err)) {
46412
+ gateDump = "";
46413
+ } else {
46414
+ stripConfigDump(err);
46415
+ throw err;
46416
+ }
46417
+ }
46418
+ if (remoteSectionScopesFromRaw(gateDump, name, false).size > 0) {
46419
+ return false;
46420
+ }
46421
+ if (pushInsteadOfAliasesFromRaw(gateDump, false).some(
46422
+ (alias) => name.startsWith(alias)
46423
+ )) {
46424
+ return false;
46425
+ }
46426
+ if (isSectionlessUpstream(name)) return false;
46427
+ try {
46428
+ return !await remoteStillResolves(cwd, name, env) && !await bareWordResolvesAsRepoPath(cwd, name, env);
46429
+ } catch {
46430
+ return false;
46431
+ }
46432
+ }
46433
+ __name(discountGate, "discountGate");
46434
+ async function readUpstreamContext(cwd, env) {
46435
+ let raw;
46436
+ try {
46437
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
46438
+ } catch (err) {
46439
+ stripConfigDump(err);
46440
+ throw err;
46441
+ }
46442
+ const lastValue = /* @__PURE__ */ new Map();
46443
+ const pushurlSections = /* @__PURE__ */ new Set();
46444
+ const pushAliases = [];
46445
+ for (const record of iterConfigRecords(raw)) {
46446
+ lastValue.set(record.key, record.value);
46447
+ if (record.value && record.key.startsWith("url.") && record.key.endsWith(".pushinsteadof")) {
46448
+ pushAliases.push(record.value);
46449
+ continue;
46450
+ }
46451
+ if (!record.key.startsWith("remote.")) continue;
46452
+ if (!record.key.endsWith(".pushurl")) continue;
46453
+ const rest = record.key.slice("remote.".length, -".pushurl".length);
46454
+ if (rest.length > 0) pushurlSections.add(rest);
46455
+ }
46456
+ return {
46457
+ lastValue,
46458
+ pushurlSections,
46459
+ pushAliasMatches: /* @__PURE__ */ __name((value) => pushAliases.some((alias) => value.startsWith(alias)), "pushAliasMatches")
46460
+ };
46461
+ }
46462
+ __name(readUpstreamContext, "readUpstreamContext");
46463
+ async function survivingUpstreamKeys(cwd, name, pointed, env) {
46464
+ const ctx = await readUpstreamContext(cwd, env);
46465
+ for (const [key, value] of ctx.lastValue) {
46466
+ if (value !== name) continue;
46467
+ if (key === "remote.pushdefault") return true;
46468
+ if (!key.startsWith("branch.")) continue;
46469
+ const rest = key.slice("branch.".length);
46470
+ const dot = rest.lastIndexOf(".");
46471
+ if (dot <= 0) continue;
46472
+ const sub = rest.slice(dot + 1);
46473
+ if (sub === "remote" || sub === "pushremote") return true;
46474
+ }
46475
+ return unmaskedPointedUpstream(cwd, pointed, name, env, ctx);
46476
+ }
46477
+ __name(survivingUpstreamKeys, "survivingUpstreamKeys");
46478
+ async function unmaskedPointedUpstream(cwd, pointed, name, env, ctx) {
46479
+ const { lastValue, pushurlSections, pushAliasMatches } = ctx;
46480
+ for (const branch of pointed.fetch) {
46481
+ const value = lastValue.get(`branch.${branch}.remote`);
46482
+ if (value !== void 0 && value !== name && !isSectionlessUpstream(value) && !await remoteNameResolves(cwd, value, env) && !await bareWordResolvesAsRepoPath(cwd, value, env)) {
46483
+ return true;
46484
+ }
46485
+ }
46486
+ for (const branch of pointed.push) {
46487
+ const value = lastValue.get(`branch.${branch}.pushremote`);
46488
+ if (value !== void 0 && value !== name && !isSectionlessUpstream(value) && !pushurlSections.has(value) && !pushAliasMatches(value) && !await remoteNameResolves(cwd, value, env) && !await bareWordResolvesAsRepoPath(cwd, value, env)) {
46489
+ return true;
46490
+ }
46491
+ }
46492
+ if (pointed.pushDefault === name) {
46493
+ const value = lastValue.get("remote.pushdefault");
46494
+ if (value !== void 0 && value !== name && !isSectionlessUpstream(value) && !pushurlSections.has(value) && !pushAliasMatches(value) && !await remoteNameResolves(cwd, value, env) && !await bareWordResolvesAsRepoPath(cwd, value, env)) {
46495
+ return true;
46496
+ }
46497
+ }
46498
+ return false;
46499
+ }
46500
+ __name(unmaskedPointedUpstream, "unmaskedPointedUpstream");
46501
+ function dosDrivePrefixLength(value) {
46502
+ const first = value.codePointAt(0);
46503
+ if (first === void 0 || first === 0) return 0;
46504
+ if (first < 128) return value[1] === ":" ? 2 : 0;
46505
+ const lead = [...value][0]?.length ?? 1;
46506
+ return value[lead] === ":" ? lead + 1 : 0;
46507
+ }
46508
+ __name(dosDrivePrefixLength, "dosDrivePrefixLength");
46509
+ var WIN32_FORBIDDEN_CHAR = /[:<>"|?*\x00-\x1f]/;
46510
+ var WIN32_RESERVED_PREFIX = /^(?:conin\$|conout\$|con|aux|com[1-9]|lpt[0-9]|nul|prn)/i;
46511
+ function win32SegmentIsInvalid(segment) {
46512
+ const reserved = WIN32_RESERVED_PREFIX.exec(segment);
46513
+ if (reserved) {
46514
+ let i = reserved[0].length;
46515
+ while (segment[i] === " ") i++;
46516
+ const c = segment[i];
46517
+ if (c === void 0 || c === "." || c === ":" || /[\\/]/.test(c)) {
46518
+ return true;
46519
+ }
46520
+ }
46521
+ const periods = /\.+$/.exec(segment)?.[0].length ?? 0;
46522
+ if (segment.endsWith(" ")) return true;
46523
+ if (periods > 0 && !(segment.length === periods && periods <= 2)) {
46524
+ return true;
46525
+ }
46526
+ return false;
46527
+ }
46528
+ __name(win32SegmentIsInvalid, "win32SegmentIsInvalid");
46529
+ function win32DriveTailIsLocalPath(tail) {
46530
+ if (WIN32_FORBIDDEN_CHAR.test(tail)) return false;
46531
+ for (const segment of tail.split(/[\\/]/)) {
46532
+ if (win32SegmentIsInvalid(segment)) return false;
46533
+ }
46534
+ return true;
46535
+ }
46536
+ __name(win32DriveTailIsLocalPath, "win32DriveTailIsLocalPath");
46537
+ function isSectionlessUpstream(value) {
46538
+ if (value === ".") return true;
46539
+ const lead0 = value[0];
46540
+ const lead1 = value[1];
46541
+ if (process.platform === "win32" && (lead0 === "\\" || lead0 === "/") && (lead1 === "\\" || lead1 === "/")) {
46542
+ return true;
46543
+ }
46544
+ const colon = value.indexOf(":");
46545
+ if (colon < 0) return false;
46546
+ const slash = value.indexOf("/");
46547
+ if (slash !== -1 && slash < colon) return false;
46548
+ if (process.platform === "win32") {
46549
+ const prefix = dosDrivePrefixLength(value);
46550
+ if (prefix > 0) return !win32DriveTailIsLocalPath(value.slice(prefix));
46551
+ }
46552
+ return true;
46553
+ }
46554
+ __name(isSectionlessUpstream, "isSectionlessUpstream");
46555
+ async function sweptUpstreamResolving(cwd, pointed, name, env) {
46556
+ let raw;
46557
+ try {
46558
+ raw = await runGit(cwd, ["config", "--list", "--show-scope", "-z"], env);
46559
+ } catch (err) {
46560
+ stripConfigDump(err);
46561
+ throw err;
46562
+ }
46563
+ const lastValue = /* @__PURE__ */ new Map();
46564
+ for (const record of iterConfigRecords(raw)) {
46565
+ lastValue.set(record.key, record.value);
46566
+ }
46567
+ for (const branch of pointed.fetch) {
46568
+ if (lastValue.get(`branch.${branch}.remote`) === name) return true;
46569
+ }
46570
+ for (const branch of pointed.push) {
46571
+ if (lastValue.get(`branch.${branch}.pushremote`) === name) return true;
46572
+ }
46573
+ return lastValue.get("remote.pushdefault") === name;
46574
+ }
46575
+ __name(sweptUpstreamResolving, "sweptUpstreamResolving");
46576
+ async function unsetUpstreamKeys(cwd, pointed, name, env) {
46577
+ for (const { scope, key, fixedValue } of await upstreamKeysToSweep(
46578
+ cwd,
46579
+ pointed,
46580
+ name,
46581
+ env
46582
+ )) {
46583
+ try {
46584
+ await runGit(
46585
+ cwd,
46586
+ fixedValue === void 0 ? ["config", `--${scope}`, "--unset-all", key] : [
46587
+ "config",
46588
+ `--${scope}`,
46589
+ "--fixed-value",
46590
+ "--unset-all",
46591
+ key,
46592
+ fixedValue
46593
+ ],
46594
+ env
46595
+ );
46596
+ } catch {
46597
+ }
46598
+ }
46599
+ }
46600
+ __name(unsetUpstreamKeys, "unsetUpstreamKeys");
46601
+
46602
+ // packages/cli/src/serve/routes/workspace-git-remotes.ts
46603
+ async function handleRemotes(res, cwd, sendBridgeError2, route, assertGenerationOpen, env) {
46604
+ try {
46605
+ assertGenerationOpen?.();
46606
+ const remotes = await fetchGitRemotes(cwd, env);
46607
+ assertGenerationOpen?.();
46608
+ res.status(200).json({ v: 1, workspaceCwd: cwd, available: true, remotes });
46609
+ } catch (err) {
46610
+ if (sendGenerationClosedError(res, err)) return;
46611
+ sendGitError(res, err, route, sendBridgeError2, cwd);
46612
+ }
46613
+ }
46614
+ __name(handleRemotes, "handleRemotes");
46615
+ async function handleRemoteAdd(req, res, cwd, sendBridgeError2, route, env) {
46616
+ const body = safeBody(req);
46617
+ const name = body["name"];
46618
+ if (typeof name !== "string" || !isValidRemoteName(name)) {
46619
+ res.status(400).json({ error: "invalid_remote_name", message: "Invalid remote name" });
46620
+ return;
46621
+ }
46622
+ const url = body["url"];
46623
+ if (typeof url !== "string" || !isValidRemoteUrl(url.trim())) {
46624
+ res.status(400).json({ error: "invalid_remote_url", message: "Invalid remote URL" });
46625
+ return;
46626
+ }
46627
+ try {
46628
+ const remotes = await gitRemoteAdd(cwd, name, url, env);
46629
+ res.status(200).json({ v: 1, workspaceCwd: cwd, remotes });
46630
+ } catch (err) {
46631
+ sendGitError(res, err, route, sendBridgeError2, cwd);
46632
+ }
46633
+ }
46634
+ __name(handleRemoteAdd, "handleRemoteAdd");
46635
+ async function handleRemoteRemove(req, res, cwd, sendBridgeError2, route, env) {
46636
+ const body = safeBody(req);
46637
+ const name = body["name"];
46638
+ if (typeof name !== "string" || !isRemovableRemoteName(name)) {
46639
+ res.status(400).json({ error: "invalid_remote_name", message: "Invalid remote name" });
46640
+ return;
46641
+ }
46642
+ try {
46643
+ const remotes = await gitRemoteRemove(cwd, name, env);
46644
+ res.status(200).json({ v: 1, workspaceCwd: cwd, remotes });
46645
+ } catch (err) {
46646
+ sendGitError(res, err, route, sendBridgeError2, cwd);
46647
+ }
46648
+ }
46649
+ __name(handleRemoteRemove, "handleRemoteRemove");
46650
+ function registerWorkspaceQualifiedGitRemotesRoutes(app, deps) {
46651
+ app.get("/workspaces/:workspace/git/remotes", (req, res) => {
46652
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
46653
+ if (!runtime) return;
46654
+ void handleRemotes(
46655
+ res,
46656
+ resolveContainedCwd(req, runtime.workspaceCwd),
46657
+ deps.sendBridgeError,
46658
+ "GET /workspaces/:workspace/git/remotes",
46659
+ () => runtime.generationGuard?.assertOpen(),
46660
+ runtime.env.effectiveEnv
46661
+ );
46662
+ });
46663
+ app.post(
46664
+ "/workspaces/:workspace/git/remote",
46665
+ deps.mutate({ strict: true }),
46666
+ (req, res) => {
46667
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
46668
+ if (!runtime) return;
46669
+ try {
46670
+ runtime.generationGuard?.assertOpen();
46671
+ } catch (err) {
46672
+ if (sendGenerationClosedError(res, err)) return;
46673
+ deps.sendBridgeError(res, err, {
46674
+ route: "POST /workspaces/:workspace/git/remote"
46675
+ });
46676
+ return;
46677
+ }
46678
+ const cwd = resolveContainedCwdOrFail(req, runtime.workspaceCwd);
46679
+ if (cwd === null) {
46680
+ res.status(400).json({
46681
+ error: "invalid_cwd",
46682
+ message: "The supplied cwd is invalid or outside the workspace"
46683
+ });
46684
+ return;
46685
+ }
46686
+ void handleRemoteAdd(
46687
+ req,
46688
+ res,
46689
+ cwd,
46690
+ deps.sendBridgeError,
46691
+ "POST /workspaces/:workspace/git/remote",
46692
+ runtime.env.effectiveEnv
46693
+ );
46694
+ }
46695
+ );
46696
+ app.post(
46697
+ "/workspaces/:workspace/git/remote/remove",
46698
+ deps.mutate({ strict: true }),
46699
+ (req, res) => {
46700
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
46701
+ if (!runtime) return;
46702
+ try {
46703
+ runtime.generationGuard?.assertOpen();
46704
+ } catch (err) {
46705
+ if (sendGenerationClosedError(res, err)) return;
46706
+ deps.sendBridgeError(res, err, {
46707
+ route: "POST /workspaces/:workspace/git/remote/remove"
46708
+ });
46709
+ return;
46710
+ }
46711
+ const cwd = resolveContainedCwdOrFail(req, runtime.workspaceCwd);
46712
+ if (cwd === null) {
46713
+ res.status(400).json({
46714
+ error: "invalid_cwd",
46715
+ message: "The supplied cwd is invalid or outside the workspace"
46716
+ });
46717
+ return;
46718
+ }
46719
+ void handleRemoteRemove(
46720
+ req,
46721
+ res,
46722
+ cwd,
46723
+ deps.sendBridgeError,
46724
+ "POST /workspaces/:workspace/git/remote/remove",
46725
+ runtime.env.effectiveEnv
46726
+ );
46727
+ }
46728
+ );
46729
+ }
46730
+ __name(registerWorkspaceQualifiedGitRemotesRoutes, "registerWorkspaceQualifiedGitRemotesRoutes");
46731
+
45099
46732
  // packages/cli/src/serve/routes/workspace-github-prs.ts
45100
46733
  init_esbuild_shims();
45101
46734
  var DEFAULT_CACHE_TTL_MS2 = 6e4;
@@ -48926,8 +50559,8 @@ var LiveHostCoordinator = class {
48926
50559
  ++this.actionGeneration;
48927
50560
  this.pendingStartMode = void 0;
48928
50561
  if (this.call) {
48929
- const stopped = new Promise((resolve8) => {
48930
- this.inactiveWaiters.add(resolve8);
50562
+ const stopped = new Promise((resolve10) => {
50563
+ this.inactiveWaiters.add(resolve10);
48931
50564
  });
48932
50565
  this.stop();
48933
50566
  await stopped;
@@ -49138,7 +50771,7 @@ var LiveHostCoordinator = class {
49138
50771
  );
49139
50772
  }
49140
50773
  const requestId = randomUUID11();
49141
- return new Promise((resolve8, reject) => {
50774
+ return new Promise((resolve10, reject) => {
49142
50775
  const timer = setTimeout(() => {
49143
50776
  this.rejectPendingShortcut(
49144
50777
  new Error("Qwen Live Host did not confirm the shortcut change.")
@@ -49149,7 +50782,7 @@ var LiveHostCoordinator = class {
49149
50782
  requestId,
49150
50783
  shortcut: normalized,
49151
50784
  timer,
49152
- resolve: resolve8,
50785
+ resolve: resolve10,
49153
50786
  reject
49154
50787
  };
49155
50788
  if (!this.sendHost({
@@ -49228,7 +50861,7 @@ var LiveHostCoordinator = class {
49228
50861
  );
49229
50862
  }
49230
50863
  const requestId = randomUUID11();
49231
- return new Promise((resolve8, reject) => {
50864
+ return new Promise((resolve10, reject) => {
49232
50865
  const timer = setTimeout(() => {
49233
50866
  this.pendingAppshots.delete(requestId);
49234
50867
  reject(new Error("Live Host Appshot timed out."));
@@ -49237,7 +50870,7 @@ var LiveHostCoordinator = class {
49237
50870
  this.pendingAppshots.set(requestId, {
49238
50871
  epoch: call.epoch,
49239
50872
  timer,
49240
- resolve: resolve8,
50873
+ resolve: resolve10,
49241
50874
  reject
49242
50875
  });
49243
50876
  if (!this.sendHost({
@@ -49753,7 +51386,7 @@ var LiveHostCoordinator = class {
49753
51386
  }
49754
51387
  notifyInactive() {
49755
51388
  if (this.call) return;
49756
- for (const resolve8 of this.inactiveWaiters) resolve8();
51389
+ for (const resolve10 of this.inactiveWaiters) resolve10();
49757
51390
  this.inactiveWaiters.clear();
49758
51391
  }
49759
51392
  };
@@ -50209,7 +51842,7 @@ function openQwenRealtimeSession(config, callbacks = {}, deps = {}) {
50209
51842
  perMessageDeflate: options.perMessageDeflate,
50210
51843
  handshakeTimeout: options.handshakeTimeout
50211
51844
  }));
50212
- return new Promise((resolve8, reject) => {
51845
+ return new Promise((resolve10, reject) => {
50213
51846
  if (deps.abortSignal?.aborted) {
50214
51847
  reject(new QwenRealtimeError("Realtime connection was aborted."));
50215
51848
  return;
@@ -51026,7 +52659,7 @@ function openQwenRealtimeSession(config, callbacks = {}, deps = {}) {
51026
52659
  break;
51027
52660
  }
51028
52661
  settled = true;
51029
- resolve8(session);
52662
+ resolve10(session);
51030
52663
  break;
51031
52664
  }
51032
52665
  case "input_audio_buffer.speech_started": {
@@ -52048,10 +53681,10 @@ __name(registerLiveSetupRoutes, "registerLiveSetupRoutes");
52048
53681
  init_esbuild_shims();
52049
53682
  import { execFile as execFile2 } from "node:child_process";
52050
53683
  import { createHash as createHash4, randomUUID as randomUUID14 } from "node:crypto";
52051
- import * as fs9 from "node:fs";
53684
+ import * as fs11 from "node:fs";
52052
53685
  import * as fsp5 from "node:fs/promises";
52053
- import * as os2 from "node:os";
52054
- import * as path17 from "node:path";
53686
+ import * as os3 from "node:os";
53687
+ import * as path19 from "node:path";
52055
53688
  import { Readable, Transform } from "node:stream";
52056
53689
  import { pipeline } from "node:stream/promises";
52057
53690
  import { promisify as promisify2 } from "node:util";
@@ -52131,7 +53764,7 @@ async function readBundleValue(appPath, key) {
52131
53764
  "raw",
52132
53765
  "-o",
52133
53766
  "-",
52134
- path17.join(appPath, "Contents", "Info.plist")
53767
+ path19.join(appPath, "Contents", "Info.plist")
52135
53768
  ]);
52136
53769
  }
52137
53770
  __name(readBundleValue, "readBundleValue");
@@ -52251,7 +53884,7 @@ async function downloadAsset(asset, url, destination, onProgress, fetchImpl) {
52251
53884
  await pipeline(
52252
53885
  Readable.fromWeb(response.body),
52253
53886
  guard,
52254
- fs9.createWriteStream(destination, { flags: "wx", mode: 384 })
53887
+ fs11.createWriteStream(destination, { flags: "wx", mode: 384 })
52255
53888
  );
52256
53889
  if (received !== asset.size || hash.digest("hex") !== asset.sha256) {
52257
53890
  throw new Error("Live Host checksum verification failed.");
@@ -52285,11 +53918,11 @@ async function downloadLiveHostRelease(currentArchitecture, destination, onProgr
52285
53918
  __name(downloadLiveHostRelease, "downloadLiveHostRelease");
52286
53919
  async function installLatestHost(currentArchitecture, onStatus) {
52287
53920
  const temporaryDirectory = await fsp5.mkdtemp(
52288
- path17.join(os2.tmpdir(), "qwen-live-host-")
53921
+ path19.join(os3.tmpdir(), "qwen-live-host-")
52289
53922
  );
52290
- const archivePath = path17.join(temporaryDirectory, "Qwen-Live-Host.zip");
52291
- const extractedPath = path17.join(temporaryDirectory, "extracted");
52292
- const candidatePath = path17.join(extractedPath, LIVE_HOST_APP_NAME);
53923
+ const archivePath = path19.join(temporaryDirectory, "Qwen-Live-Host.zip");
53924
+ const extractedPath = path19.join(temporaryDirectory, "extracted");
53925
+ const candidatePath = path19.join(extractedPath, LIVE_HOST_APP_NAME);
52293
53926
  const stagingPath = `/Applications/.Qwen Live Host.install-${randomUUID14()}.app`;
52294
53927
  const backupPath = `/Applications/.Qwen Live Host.backup-${randomUUID14()}.app`;
52295
53928
  let movedExisting = false;
@@ -52450,13 +54083,13 @@ var LiveHostInstaller = class {
52450
54083
  init_esbuild_shims();
52451
54084
  import { createHash as createHash5, randomUUID as randomUUID15 } from "node:crypto";
52452
54085
  import { createWriteStream as createWriteStream2, mkdirSync as mkdirSync2 } from "node:fs";
52453
- import { join as join14 } from "node:path";
54086
+ import { join as join16 } from "node:path";
52454
54087
 
52455
54088
  // packages/cli/src/serve/live/realtime-startup-context.ts
52456
54089
  init_esbuild_shims();
52457
54090
  import { readdirSync } from "node:fs";
52458
- import { homedir } from "node:os";
52459
- import { basename as basename8, join as join13 } from "node:path";
54091
+ import { homedir as homedir2 } from "node:os";
54092
+ import { basename as basename9, join as join15 } from "node:path";
52460
54093
  var STARTUP_CONTEXT_HEADER = "Startup context from Qwen Code.\nThis is background context about recent work and machine/workspace layout. It may be incomplete or stale. Use it to inform responses, and do not repeat it back unless relevant.";
52461
54094
  var CURRENT_THREAD_SECTION_TOKEN_BUDGET = 1200;
52462
54095
  var RECENT_WORK_SECTION_TOKEN_BUDGET = 2200;
@@ -52698,7 +54331,7 @@ function collectTreeLines(directory, depth, lines) {
52698
54331
  const indent = " ".repeat(depth);
52699
54332
  lines.push(`${indent}- ${entry.name}${entry.isDirectory() ? "/" : ""}`);
52700
54333
  if (entry.isDirectory()) {
52701
- collectTreeLines(join13(directory, entry.name), depth + 1, lines);
54334
+ collectTreeLines(join15(directory, entry.name), depth + 1, lines);
52702
54335
  }
52703
54336
  }
52704
54337
  if (entries.length > DIR_ENTRY_LIMIT) {
@@ -52722,11 +54355,11 @@ function buildWorkspaceSection(currentCwd, userRoot) {
52722
54355
  if (!cwdTree && !gitRoot && !userRootTree) return void 0;
52723
54356
  const lines = [
52724
54357
  `Current working directory: ${currentCwd}`,
52725
- `Working directory name: ${basename8(currentCwd) || currentCwd}`
54358
+ `Working directory name: ${basename9(currentCwd) || currentCwd}`
52726
54359
  ];
52727
54360
  if (gitRoot) {
52728
54361
  lines.push(`Git root: ${gitRoot}`);
52729
- lines.push(`Git project: ${basename8(gitRoot) || gitRoot}`);
54362
+ lines.push(`Git project: ${basename9(gitRoot) || gitRoot}`);
52730
54363
  }
52731
54364
  if (userRoot) lines.push(`User root: ${userRoot}`);
52732
54365
  if (cwdTree) lines.push("", "Working directory tree:", ...cwdTree);
@@ -52757,7 +54390,7 @@ async function buildRealtimeStartupContext(options) {
52757
54390
  );
52758
54391
  const workspace = buildWorkspaceSection(
52759
54392
  options.currentCwd,
52760
- options.userRoot ?? homedir()
54393
+ options.userRoot ?? homedir2()
52761
54394
  );
52762
54395
  if (!currentThread && !recentWork && !workspace) return void 0;
52763
54396
  const parts = [STARTUP_CONTEXT_HEADER];
@@ -52817,13 +54450,13 @@ function openLiveAudioCapture(source, identifier) {
52817
54450
  try {
52818
54451
  mkdirSync2(directory, { recursive: true, mode: 448 });
52819
54452
  const safeIdentifier = identifier.replace(/[^A-Za-z0-9_-]/g, "_");
52820
- const path20 = join14(
54453
+ const path22 = join16(
52821
54454
  directory,
52822
54455
  `${source}-${Date.now()}-${safeIdentifier}.pcm`
52823
54456
  );
52824
- const stream = createWriteStream2(path20, { flags: "wx", mode: 384 });
54457
+ const stream = createWriteStream2(path22, { flags: "wx", mode: 384 });
52825
54458
  stream.on("error", () => void 0);
52826
- return { source, path: path20, stream, hash: createHash5("sha256"), bytes: 0 };
54459
+ return { source, path: path22, stream, hash: createHash5("sha256"), bytes: 0 };
52827
54460
  } catch {
52828
54461
  return void 0;
52829
54462
  }
@@ -52842,32 +54475,32 @@ function closeLiveAudioCapture(capture, reason) {
52842
54475
  }
52843
54476
  __name(closeLiveAudioCapture, "closeLiveAudioCapture");
52844
54477
  function createTurnCompletion() {
52845
- let resolve8;
54478
+ let resolve10;
52846
54479
  let settled = false;
52847
54480
  return {
52848
54481
  turnComplete: new Promise((next) => {
52849
- resolve8 = next;
54482
+ resolve10 = next;
52850
54483
  }),
52851
54484
  finishTurn: /* @__PURE__ */ __name(() => {
52852
54485
  if (settled) return;
52853
54486
  settled = true;
52854
- resolve8();
54487
+ resolve10();
52855
54488
  }, "finishTurn")
52856
54489
  };
52857
54490
  }
52858
54491
  __name(createTurnCompletion, "createTurnCompletion");
52859
54492
  function createDelegateAdmission() {
52860
- let resolve8;
54493
+ let resolve10;
52861
54494
  let settled = false;
52862
54495
  const admission = {
52863
54496
  state: "scheduled",
52864
54497
  promise: new Promise((next) => {
52865
- resolve8 = next;
54498
+ resolve10 = next;
52866
54499
  }),
52867
54500
  settle: /* @__PURE__ */ __name((admitted) => {
52868
54501
  if (settled) return;
52869
54502
  settled = true;
52870
- resolve8(admitted);
54503
+ resolve10(admitted);
52871
54504
  }, "settle")
52872
54505
  };
52873
54506
  return admission;
@@ -53536,8 +55169,8 @@ var LiveSessionCoordinator = class {
53536
55169
  }
53537
55170
  beginGracefulStop(context) {
53538
55171
  if (context.stopCompletion) return context.stopCompletion;
53539
- context.stopCompletion = new Promise((resolve8) => {
53540
- context.finishStop = resolve8;
55172
+ context.stopCompletion = new Promise((resolve10) => {
55173
+ context.finishStop = resolve10;
53541
55174
  });
53542
55175
  if (!this.isActive(context)) {
53543
55176
  context.finishStop?.();
@@ -55222,11 +56855,11 @@ var ConversationRuntimeActivityGate = class {
55222
56855
  this.sealed = true;
55223
56856
  if (this.active === 0) return Promise.resolve();
55224
56857
  if (!this.drain) {
55225
- let resolve8;
56858
+ let resolve10;
55226
56859
  const promise = new Promise((done) => {
55227
- resolve8 = done;
56860
+ resolve10 = done;
55228
56861
  });
55229
- this.drain = { promise, resolve: resolve8 };
56862
+ this.drain = { promise, resolve: resolve10 };
55230
56863
  }
55231
56864
  return this.drain.promise;
55232
56865
  }
@@ -55394,8 +57027,8 @@ var ConversationRuntimeManager = class {
55394
57027
  // packages/cli/src/serve/conversations/conversation-runtime-ownership.ts
55395
57028
  init_esbuild_shims();
55396
57029
  import { constants as fsConstants3 } from "node:fs";
55397
- import * as fs10 from "node:fs/promises";
55398
- import * as path18 from "node:path";
57030
+ import * as fs12 from "node:fs/promises";
57031
+ import * as path20 from "node:path";
55399
57032
  var OWNER_DIRECTORY = "conversations";
55400
57033
  var OWNER_FILE = "runtime-owner.json";
55401
57034
  var OWNER_LOCK = ".runtime-owner.lock";
@@ -55408,7 +57041,7 @@ var UnsafeOwnershipStateError = class extends Error {
55408
57041
  }
55409
57042
  };
55410
57043
  function getConversationRuntimeOwnerPath(stableBaseDir) {
55411
- return path18.join(stableBaseDir, OWNER_DIRECTORY, OWNER_FILE);
57044
+ return path20.join(stableBaseDir, OWNER_DIRECTORY, OWNER_FILE);
55412
57045
  }
55413
57046
  __name(getConversationRuntimeOwnerPath, "getConversationRuntimeOwnerPath");
55414
57047
  function processIsAlive(pid) {
@@ -55421,8 +57054,8 @@ function processIsAlive(pid) {
55421
57054
  }
55422
57055
  __name(processIsAlive, "processIsAlive");
55423
57056
  function delay2(milliseconds) {
55424
- return new Promise((resolve8) => {
55425
- setTimeout(resolve8, milliseconds);
57057
+ return new Promise((resolve10) => {
57058
+ setTimeout(resolve10, milliseconds);
55426
57059
  });
55427
57060
  }
55428
57061
  __name(delay2, "delay");
@@ -55454,7 +57087,7 @@ function sameRecord(left, right) {
55454
57087
  }
55455
57088
  __name(sameRecord, "sameRecord");
55456
57089
  async function inspectDirectory(directory, requirePrivateMode) {
55457
- const stat3 = await fs10.lstat(directory);
57090
+ const stat3 = await fs12.lstat(directory);
55458
57091
  if (!stat3.isDirectory() || stat3.isSymbolicLink()) {
55459
57092
  throw new UnsafeOwnershipStateError();
55460
57093
  }
@@ -55474,7 +57107,7 @@ __name(assertDirectoryIdentity, "assertDirectoryIdentity");
55474
57107
  async function assertLockShapeIfPresent(lockPath) {
55475
57108
  let stat3;
55476
57109
  try {
55477
- stat3 = await fs10.lstat(lockPath);
57110
+ stat3 = await fs12.lstat(lockPath);
55478
57111
  } catch (error2) {
55479
57112
  if (isMissing2(error2)) return;
55480
57113
  throw error2;
@@ -55487,7 +57120,7 @@ __name(assertLockShapeIfPresent, "assertLockShapeIfPresent");
55487
57120
  async function readOwnerRecord(ownerPath) {
55488
57121
  let pathStat;
55489
57122
  try {
55490
- pathStat = await fs10.lstat(ownerPath);
57123
+ pathStat = await fs12.lstat(ownerPath);
55491
57124
  } catch (error2) {
55492
57125
  if (isMissing2(error2)) return void 0;
55493
57126
  throw error2;
@@ -55497,7 +57130,7 @@ async function readOwnerRecord(ownerPath) {
55497
57130
  }
55498
57131
  let handle;
55499
57132
  try {
55500
- handle = await fs10.open(
57133
+ handle = await fs12.open(
55501
57134
  ownerPath,
55502
57135
  process.platform === "win32" ? fsConstants3.O_RDONLY : fsConstants3.O_RDONLY | fsConstants3.O_NOFOLLOW
55503
57136
  );
@@ -55527,7 +57160,7 @@ async function readOwnerRecord(ownerPath) {
55527
57160
  __name(readOwnerRecord, "readOwnerRecord");
55528
57161
  async function syncDirectory(directory) {
55529
57162
  if (process.platform === "win32") return;
55530
- const handle = await fs10.open(directory, fsConstants3.O_RDONLY);
57163
+ const handle = await fs12.open(directory, fsConstants3.O_RDONLY);
55531
57164
  try {
55532
57165
  await handle.sync();
55533
57166
  } finally {
@@ -55537,8 +57170,8 @@ async function syncDirectory(directory) {
55537
57170
  __name(syncDirectory, "syncDirectory");
55538
57171
  async function checkLegacyConversationRuntimeOwner(options) {
55539
57172
  const ownerPath = getConversationRuntimeOwnerPath(options.stableBaseDir);
55540
- const directory = path18.dirname(ownerPath);
55541
- const lockPath = path18.join(directory, OWNER_LOCK);
57173
+ const directory = path20.dirname(ownerPath);
57174
+ const lockPath = path20.join(directory, OWNER_LOCK);
55542
57175
  let reclaimed = false;
55543
57176
  try {
55544
57177
  let base;
@@ -55582,7 +57215,7 @@ async function checkLegacyConversationRuntimeOwner(options) {
55582
57215
  await assertDirectoryIdentity(options.stableBaseDir, base, false);
55583
57216
  await assertDirectoryIdentity(directory, identity);
55584
57217
  if (compromised) throw new UnsafeOwnershipStateError();
55585
- await fs10.unlink(ownerPath);
57218
+ await fs12.unlink(ownerPath);
55586
57219
  await syncDirectory(directory);
55587
57220
  reclaimed = true;
55588
57221
  }
@@ -56209,7 +57842,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
56209
57842
  }
56210
57843
  }, "getProviderReadiness")
56211
57844
  });
56212
- const stableLiveDiscoveryBaseDir = path19.resolve(
57845
+ const stableLiveDiscoveryBaseDir = path21.resolve(
56213
57846
  deps.liveDiscoveryStableBaseDir ?? getStableLiveDiscoveryBaseDir()
56214
57847
  );
56215
57848
  liveCoordinator.setAppshotReadiness(
@@ -56404,7 +58037,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
56404
58037
  }, "ensureConversationRuntimeWithLifecycle");
56405
58038
  if (conversationRuntimeManager && conversationRuntimeActivity && deps.liveConversationWorkspace) {
56406
58039
  const deletionJournal = new StandaloneDeletionJournal(
56407
- path19.resolve(
58040
+ path21.resolve(
56408
58041
  deps.liveDiscoveryStableBaseDir ?? getStableLiveDiscoveryBaseDir()
56409
58042
  )
56410
58043
  );
@@ -56940,6 +58573,11 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
56940
58573
  sendBridgeError: sendBridgeError2,
56941
58574
  mutate
56942
58575
  });
58576
+ registerWorkspaceQualifiedGitRemotesRoutes(app, {
58577
+ workspaceRegistry,
58578
+ sendBridgeError: sendBridgeError2,
58579
+ mutate
58580
+ });
56943
58581
  registerWorkspaceQualifiedGitHubPrsRoutes(app, {
56944
58582
  workspaceRegistry,
56945
58583
  sendBridgeError: sendBridgeError2,
@@ -57294,6 +58932,8 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
57294
58932
  if (deps.persistSettings) {
57295
58933
  registerWorkspaceModelsRoutes(app, {
57296
58934
  boundWorkspace: primaryBoundWorkspace,
58935
+ env: primaryRuntimeEffectiveEnv,
58936
+ baseEnv: deps.modelSelectionBaseEnv ?? daemonEnvAtBoot,
57297
58937
  isWorkspaceTrusted: isPrimaryWorkspaceTrusted,
57298
58938
  captureGenerationAssertion: capturePrimaryGenerationAssertion,
57299
58939
  mutate,