@qwen-code/qwen-code 0.18.2 → 0.18.3-nightly.20260621.6b2f800ab

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 (511) hide show
  1. package/README.md +64 -492
  2. package/bundled/loop/SKILL.md +53 -26
  3. package/bundled/loop/SKILL.test.ts +67 -0
  4. package/bundled/qc-helper/docs/configuration/auth.md +7 -6
  5. package/bundled/qc-helper/docs/configuration/model-providers.md +16 -2
  6. package/bundled/qc-helper/docs/configuration/settings.md +51 -44
  7. package/bundled/qc-helper/docs/extension/introduction.md +38 -0
  8. package/bundled/qc-helper/docs/features/approval-mode.md +2 -0
  9. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  10. package/bundled/qc-helper/docs/features/channels/overview.md +4 -4
  11. package/bundled/qc-helper/docs/features/channels/qqbot.md +179 -0
  12. package/bundled/qc-helper/docs/features/commands.md +49 -0
  13. package/bundled/qc-helper/docs/features/followup-suggestions.md +10 -6
  14. package/bundled/qc-helper/docs/features/hooks.md +6 -3
  15. package/bundled/qc-helper/docs/features/status-line.md +4 -2
  16. package/bundled/qc-helper/docs/qwen-serve.md +9 -4
  17. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +11 -5
  18. package/bundled/qc-helper/docs/support/troubleshooting.md +5 -0
  19. package/chunks/{agent-P5U6QLWL.js → agent-66UJLGYF.js} +24 -23
  20. package/chunks/{agent-headless-24356DC7.js → agent-headless-XWKLG7OO.js} +24 -23
  21. package/chunks/{anthropicContentGenerator-KLBHYGH6.js → anthropicContentGenerator-5S4OMMNL.js} +9 -7
  22. package/chunks/{askUserQuestion-QPZXR3UO.js → askUserQuestion-WHVYL2S2.js} +2 -2
  23. package/chunks/{ca-RK4QPLIX.js → ca-K6MD665I.js} +42 -2
  24. package/chunks/{chunk-WPTCDQN6.js → chunk-26ZYKTYZ.js} +2 -2
  25. package/chunks/{chunk-O4PICXES.js → chunk-2MPVVENX.js} +14 -6
  26. package/chunks/{chunk-VIEIRAK3.js → chunk-2O3NAOJG.js} +4 -2
  27. package/chunks/{chunk-NNIYWQIS.js → chunk-42HGOMED.js} +2 -1
  28. package/chunks/{chunk-B4ZF2KSI.js → chunk-AE6RQU6F.js} +2 -2
  29. package/chunks/{chunk-FIQECJTQ.js → chunk-ATLUHLZE.js} +1 -1
  30. package/chunks/{chunk-BJ5HQ23U.js → chunk-C6MI2ASN.js} +9 -10
  31. package/chunks/{chunk-LYRSMKLS.js → chunk-CTHZVIMD.js} +2 -2
  32. package/chunks/{chunk-MN5RAXVB.js → chunk-CX3SGIPK.js} +18 -6
  33. package/chunks/{chunk-IQHSD7K5.js → chunk-FH4P6RQA.js} +1 -1
  34. package/chunks/{chunk-LYSND7KR.js → chunk-G4BUMVEY.js} +12 -2
  35. package/chunks/{chunk-YJDVHAGL.js → chunk-GBN55AWZ.js} +2 -2
  36. package/chunks/{chunk-ZNUMXPNK.js → chunk-GOMVJKBL.js} +7 -3
  37. package/chunks/{chunk-NGDXHX3A.js → chunk-GRVAP37P.js} +63 -11
  38. package/chunks/{chunk-CPVI5J2L.js → chunk-ID533GA3.js} +1 -1
  39. package/chunks/{chunk-VU6A2OBJ.js → chunk-JXQ23SNT.js} +217 -219
  40. package/chunks/{chunk-ZMIBJS45.js → chunk-KGV3F6UF.js} +1 -1
  41. package/chunks/{chunk-SFRV6BGY.js → chunk-LF6BKGZT.js} +3 -3
  42. package/chunks/{chunk-LXYWINWF.js → chunk-LTN3VYMZ.js} +1 -1
  43. package/chunks/{chunk-IDYDPBBN.js → chunk-MSJ2MXJ6.js} +3 -3
  44. package/chunks/{chunk-25FFAMED.js → chunk-NLCTUNOS.js} +1048 -295
  45. package/chunks/{chunk-JZEKEWO5.js → chunk-TOSAOARP.js} +6 -6
  46. package/chunks/{chunk-M7OBURJM.js → chunk-VIA5MAE5.js} +24 -12
  47. package/chunks/{chunk-RTTAC5VW.js → chunk-VKILGMZQ.js} +1 -1
  48. package/chunks/{chunk-QFJ67S5R.js → chunk-VN7FXOAW.js} +732 -617
  49. package/chunks/{chunk-HA2UEYZP.js → chunk-WE6TNQJU.js} +13 -6
  50. package/chunks/chunk-XGU3ETVO.js +1026 -0
  51. package/chunks/{chunk-ZOFNJQNJ.js → chunk-XU7BKR3B.js} +3 -3
  52. package/chunks/{chunk-QP4R5FTG.js → chunk-Z7XXFPGP.js} +4 -3
  53. package/chunks/{chunk-TW522KN6.js → chunk-ZTQ26VBE.js} +13 -6
  54. package/chunks/{chunk-EQ5NHJBY.js → chunk-ZV5QED4A.js} +109573 -106663
  55. package/chunks/{computer-use-EGW2I2HZ.js → computer-use-5AHVGVR3.js} +26 -24
  56. package/chunks/contextCommand-PTDKJROT.js +54 -0
  57. package/chunks/{cron-create-DQKRQMCP.js → cron-create-THNDTYXU.js} +6 -6
  58. package/chunks/{cron-delete-DOFPHFTI.js → cron-delete-BS5H6TFJ.js} +6 -6
  59. package/chunks/{cron-list-RCVOO3CB.js → cron-list-7OBVHT7K.js} +24 -10
  60. package/chunks/{de-FGPM4KW5.js → de-K2F3T3TR.js} +41 -1
  61. package/chunks/{dist-2UCAYOX7.js → dist-BD27IA3L.js} +16 -5
  62. package/chunks/{dist-UH7CYT7F.js → dist-DZ6AJDX4.js} +52 -11
  63. package/chunks/{dist-KF43SZZV.js → dist-GKRNVFBH.js} +5 -1
  64. package/chunks/{dist-33LHH26D.js → dist-KIYB7DQW.js} +1 -1
  65. package/chunks/dist-QFFZWACU.js +2136 -0
  66. package/chunks/{edit-FJSOCDO2.js → edit-ADXZN3M7.js} +26 -27
  67. package/chunks/{en-VP6XPGEC.js → en-KGSAKBJP.js} +232 -0
  68. package/chunks/{enter-worktree-X6MVFDLR.js → enter-worktree-F5SJSHNH.js} +24 -23
  69. package/chunks/{enterPlanMode-MZAEQZH3.js → enterPlanMode-MCQ4HWPP.js} +52 -28
  70. package/chunks/{exit-worktree-RM2UPOYQ.js → exit-worktree-26AFS3YQ.js} +191 -41
  71. package/chunks/{exitPlanMode-7BVY3CWJ.js → exitPlanMode-UOPIPSEA.js} +85 -46
  72. package/chunks/{fr-ATYBVCLT.js → fr-2CAQEOK6.js} +41 -1
  73. package/chunks/{geminiContentGenerator-A6JHLUHK.js → geminiContentGenerator-RJA7BIHQ.js} +4 -4
  74. package/chunks/{glob-L3AZLCV6.js → glob-AWTDID4C.js} +26 -24
  75. package/chunks/{grep-SNCPCXIP.js → grep-QJ5TEMYZ.js} +96 -43
  76. package/chunks/{ja-W2QEA2OI.js → ja-QWL7V6OJ.js} +41 -1
  77. package/chunks/{keychain-token-storage-QSTRHKKL.js → keychain-token-storage-YHXIWXIB.js} +2 -2
  78. package/chunks/loop-wakeup-SSBWZ64K.js +167 -0
  79. package/chunks/{ls-TRD77UTS.js → ls-YPFUHZRQ.js} +3 -3
  80. package/chunks/{lsp-2VFWQPZS.js → lsp-FD6DNVAF.js} +2 -2
  81. package/chunks/{monitor-TS6WL6DN.js → monitor-SQYLCQAK.js} +24 -23
  82. package/chunks/{notebook-edit-26RNH24J.js → notebook-edit-7RR3ABQ5.js} +25 -26
  83. package/chunks/{openaiContentGenerator-7CA63X5G.js → openaiContentGenerator-2CHXJZ4A.js} +14 -11
  84. package/chunks/{pt-ZKEWJFBW.js → pt-2SPOLMAY.js} +41 -1
  85. package/chunks/{qwenContentGenerator-4WJTJXFZ.js → qwenContentGenerator-ZXEKDN2J.js} +27 -26
  86. package/chunks/{qwenOAuth2-KK433U33.js → qwenOAuth2-WZ54YZ4J.js} +4 -4
  87. package/chunks/{read-file-EUIHK6HD.js → read-file-AZAKLZFP.js} +9 -8
  88. package/chunks/{ripGrep-7J5B22W2.js → ripGrep-T5PS4VWB.js} +24 -23
  89. package/chunks/{ru-VEKTPJ74.js → ru-35IVJTEH.js} +41 -1
  90. package/chunks/{scheduler-J3OUGTTS.js → scheduler-VZ5KYSX6.js} +24 -23
  91. package/chunks/{send-message-QZOC5GA2.js → send-message-FWFTX62Q.js} +2 -2
  92. package/chunks/{serve-VF4ZNUJP.js → serve-RN6CHKG3.js} +1308 -291
  93. package/chunks/{shell-G6XCJAG3.js → shell-ANALFMWT.js} +24 -23
  94. package/chunks/{skill-7OVC6JIH.js → skill-JIKQTL4U.js} +11 -10
  95. package/chunks/{src-XV5MLRND.js → src-EMRXVZY7.js} +159 -59
  96. package/chunks/{syntheticOutput-WJSUK4SZ.js → syntheticOutput-JY5NEDTV.js} +3 -3
  97. package/chunks/{task-create-GGSC27HO.js → task-create-IGILDV25.js} +7 -7
  98. package/chunks/{task-list-EDHHHSK4.js → task-list-KBEJVAAG.js} +6 -6
  99. package/chunks/{task-stop-WR5PDVZY.js → task-stop-WFTMQ6AC.js} +2 -2
  100. package/chunks/{task-update-UR7NUHBV.js → task-update-UIVX7ZEV.js} +7 -7
  101. package/chunks/{team-create-JXSC7ROC.js → team-create-BVKQF4WK.js} +26 -25
  102. package/chunks/{team-delete-FC33URJK.js → team-delete-LPOXDPVB.js} +6 -6
  103. package/chunks/{todoWrite-GO2ME7ZV.js → todoWrite-R4RIJKOD.js} +4 -4
  104. package/chunks/{tool-search-YRWSWA2H.js → tool-search-E4VYDNQO.js} +9 -8
  105. package/chunks/{web-fetch-NLLATYIL.js → web-fetch-JU7SS6KE.js} +5 -5
  106. package/chunks/{workflow-ZN3DYFMU.js → workflow-VDPJJYAF.js} +242 -39
  107. package/chunks/{write-file-355M4V7Z.js → write-file-NCN66V2C.js} +26 -27
  108. package/chunks/{zh-TW-6YFNCKTA.js → zh-TW-BSG6BUWK.js} +232 -2
  109. package/chunks/{zh-OIXDDQHB.js → zh-X4KM6MTW.js} +233 -0
  110. package/cli.js +11094 -5768
  111. package/examples/agent/agents/diary.md +1 -1
  112. package/examples/mcp-server/qwen-extension.json +8 -1
  113. package/examples/starter/agents/diary.md +1 -1
  114. package/locales/ca.js +67 -2
  115. package/locales/de.js +68 -2
  116. package/locales/en.js +304 -0
  117. package/locales/fr.js +69 -2
  118. package/locales/ja.js +65 -2
  119. package/locales/pt.js +67 -2
  120. package/locales/ru.js +68 -2
  121. package/locales/zh-TW.js +288 -2
  122. package/locales/zh.js +288 -0
  123. package/package.json +4 -3
  124. package/web-shell/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
  125. package/web-shell/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
  126. package/web-shell/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
  127. package/web-shell/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
  128. package/web-shell/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
  129. package/web-shell/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
  130. package/web-shell/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
  131. package/web-shell/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
  132. package/web-shell/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
  133. package/web-shell/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
  134. package/web-shell/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
  135. package/web-shell/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
  136. package/web-shell/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
  137. package/web-shell/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
  138. package/web-shell/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
  139. package/web-shell/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
  140. package/web-shell/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
  141. package/web-shell/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
  142. package/web-shell/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
  143. package/web-shell/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
  144. package/web-shell/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
  145. package/web-shell/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
  146. package/web-shell/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
  147. package/web-shell/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
  148. package/web-shell/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
  149. package/web-shell/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
  150. package/web-shell/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
  151. package/web-shell/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
  152. package/web-shell/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
  153. package/web-shell/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
  154. package/web-shell/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
  155. package/web-shell/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
  156. package/web-shell/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
  157. package/web-shell/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
  158. package/web-shell/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
  159. package/web-shell/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
  160. package/web-shell/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
  161. package/web-shell/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
  162. package/web-shell/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
  163. package/web-shell/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
  164. package/web-shell/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
  165. package/web-shell/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
  166. package/web-shell/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
  167. package/web-shell/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
  168. package/web-shell/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
  169. package/web-shell/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
  170. package/web-shell/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
  171. package/web-shell/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
  172. package/web-shell/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
  173. package/web-shell/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
  174. package/web-shell/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
  175. package/web-shell/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
  176. package/web-shell/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
  177. package/web-shell/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
  178. package/web-shell/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
  179. package/web-shell/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
  180. package/web-shell/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
  181. package/web-shell/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
  182. package/web-shell/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
  183. package/web-shell/assets/abap-DsBKuouk.js +1 -0
  184. package/web-shell/assets/actionscript-3-D_z4Izcz.js +1 -0
  185. package/web-shell/assets/ada-727ZlQH0.js +1 -0
  186. package/web-shell/assets/andromeeda-C3khCPGq.js +1 -0
  187. package/web-shell/assets/angular-html-LfdN0zeE.js +1 -0
  188. package/web-shell/assets/angular-ts-CKsD7JZE.js +1 -0
  189. package/web-shell/assets/apache-Dn00JSTd.js +1 -0
  190. package/web-shell/assets/apex-COJ4H7py.js +1 -0
  191. package/web-shell/assets/apl-BBq3IX1j.js +1 -0
  192. package/web-shell/assets/applescript-Bu5BbsvL.js +1 -0
  193. package/web-shell/assets/ara-7O62HKoU.js +1 -0
  194. package/web-shell/assets/arc-CRFN10gD.js +1 -0
  195. package/web-shell/assets/architectureDiagram-3BPJPVTR-IRlu1CpH.js +36 -0
  196. package/web-shell/assets/asciidoc-BPT9niGB.js +1 -0
  197. package/web-shell/assets/asm-Dhn9LcZ4.js +1 -0
  198. package/web-shell/assets/astro-CqkE3fuf.js +1 -0
  199. package/web-shell/assets/aurora-x-D-2ljcwZ.js +1 -0
  200. package/web-shell/assets/awk-eg146-Ew.js +1 -0
  201. package/web-shell/assets/ayu-dark-Cv9koXgw.js +1 -0
  202. package/web-shell/assets/ballerina-Du268qiB.js +1 -0
  203. package/web-shell/assets/bat-fje9CFhw.js +1 -0
  204. package/web-shell/assets/beancount-BwXTMy5W.js +1 -0
  205. package/web-shell/assets/berry-3xVqZejG.js +1 -0
  206. package/web-shell/assets/bibtex-xW4inM5L.js +1 -0
  207. package/web-shell/assets/bicep-DHo0CJ0O.js +1 -0
  208. package/web-shell/assets/blade-a8OxSdnT.js +1 -0
  209. package/web-shell/assets/blockDiagram-GPEHLZMM-htIZ6iw8.js +132 -0
  210. package/web-shell/assets/bsl-Dgyn0ogV.js +1 -0
  211. package/web-shell/assets/c-C3t2pwGQ.js +1 -0
  212. package/web-shell/assets/c4Diagram-AAUBKEIU-A2GoRq3O.js +10 -0
  213. package/web-shell/assets/cadence-DNquZEk8.js +1 -0
  214. package/web-shell/assets/cairo--RitsXJZ.js +1 -0
  215. package/web-shell/assets/catppuccin-frappe-CD_QflpE.js +1 -0
  216. package/web-shell/assets/catppuccin-latte-DRW-0cLl.js +1 -0
  217. package/web-shell/assets/catppuccin-macchiato-C-_shW-Y.js +1 -0
  218. package/web-shell/assets/catppuccin-mocha-LGGdnPYs.js +1 -0
  219. package/web-shell/assets/channel-WwImfsc7.js +1 -0
  220. package/web-shell/assets/chunk-2J33WTMH-CdP2AC6u.js +1 -0
  221. package/web-shell/assets/chunk-4BX2VUAB-DrA07nW2.js +1 -0
  222. package/web-shell/assets/chunk-55IACEB6-CFGnVU2f.js +1 -0
  223. package/web-shell/assets/chunk-727SXJPM-BTMkq3Tk.js +206 -0
  224. package/web-shell/assets/chunk-AQP2D5EJ-C9sYg04Z.js +231 -0
  225. package/web-shell/assets/chunk-FMBD7UC4-Cag-cj6I.js +15 -0
  226. package/web-shell/assets/chunk-ND2GUHAM-CDSTFoR7.js +1 -0
  227. package/web-shell/assets/chunk-QZHKN3VN-CN9Z6oOs.js +1 -0
  228. package/web-shell/assets/clarity-BHOwM8T6.js +1 -0
  229. package/web-shell/assets/classDiagram-4FO5ZUOK-CJKQYFeJ.js +1 -0
  230. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CJKQYFeJ.js +1 -0
  231. package/web-shell/assets/clojure-DxSadP1t.js +1 -0
  232. package/web-shell/assets/cmake-DbXoA79R.js +1 -0
  233. package/web-shell/assets/cobol-PTqiYgYu.js +1 -0
  234. package/web-shell/assets/codeowners-Bp6g37R7.js +1 -0
  235. package/web-shell/assets/codeql-sacFqUAJ.js +1 -0
  236. package/web-shell/assets/coffee-dyiR41kL.js +1 -0
  237. package/web-shell/assets/common-lisp-C7gG9l05.js +1 -0
  238. package/web-shell/assets/coq-Dsg_Bt_b.js +1 -0
  239. package/web-shell/assets/cose-bilkent-S5V4N54A-DuN9j8Du.js +1 -0
  240. package/web-shell/assets/cpp-BksuvNSY.js +1 -0
  241. package/web-shell/assets/crystal-DtDmRg-F.js +1 -0
  242. package/web-shell/assets/csharp-D9R-vmeu.js +1 -0
  243. package/web-shell/assets/css-BPhBrDlE.js +1 -0
  244. package/web-shell/assets/csv-B0qRVHPH.js +1 -0
  245. package/web-shell/assets/cue-DtFQj3wx.js +1 -0
  246. package/web-shell/assets/cypher-m2LEI-9-.js +1 -0
  247. package/web-shell/assets/cytoscape.esm-CUqq0XTU.js +331 -0
  248. package/web-shell/assets/d-BoXegm-a.js +1 -0
  249. package/web-shell/assets/dagre-BM42HDAG-ByCWe45f.js +4 -0
  250. package/web-shell/assets/dark-plus-C3mMm8J8.js +1 -0
  251. package/web-shell/assets/dart-B9wLZaAG.js +1 -0
  252. package/web-shell/assets/dax-ClGRhx96.js +1 -0
  253. package/web-shell/assets/defaultLocale-DX6XiGOO.js +1 -0
  254. package/web-shell/assets/desktop-DEIpsLCJ.js +1 -0
  255. package/web-shell/assets/diagram-2AECGRRQ-eWyU_pKZ.js +43 -0
  256. package/web-shell/assets/diagram-5GNKFQAL-0Bfu3Fq5.js +10 -0
  257. package/web-shell/assets/diagram-KO2AKTUF-B6KBKkQP.js +3 -0
  258. package/web-shell/assets/diagram-LMA3HP47-TToDmeA_.js +24 -0
  259. package/web-shell/assets/diagram-OG6HWLK6-CQCkC2Yx.js +24 -0
  260. package/web-shell/assets/diff-BgYniUM_.js +1 -0
  261. package/web-shell/assets/docker-COcR7UxN.js +1 -0
  262. package/web-shell/assets/dotenv-BjQB5zDj.js +1 -0
  263. package/web-shell/assets/dracula-BzJJZx-M.js +1 -0
  264. package/web-shell/assets/dracula-soft-BXkSAIEj.js +1 -0
  265. package/web-shell/assets/dream-maker-C-nORZOA.js +1 -0
  266. package/web-shell/assets/edge-D5gP-w-T.js +1 -0
  267. package/web-shell/assets/elixir-CLiX3zqd.js +1 -0
  268. package/web-shell/assets/elm-CmHSxxaM.js +1 -0
  269. package/web-shell/assets/emacs-lisp-BX77sIaO.js +1 -0
  270. package/web-shell/assets/erDiagram-TEJ5UH35-Cm9ls1iB.js +85 -0
  271. package/web-shell/assets/erb-BYTLMnw6.js +1 -0
  272. package/web-shell/assets/erlang-B-DoSBHF.js +1 -0
  273. package/web-shell/assets/everforest-dark-BgDCqdQA.js +1 -0
  274. package/web-shell/assets/everforest-light-C8M2exoo.js +1 -0
  275. package/web-shell/assets/fennel-bCA53EVm.js +1 -0
  276. package/web-shell/assets/fish-w-ucz2PV.js +1 -0
  277. package/web-shell/assets/flowDiagram-I6XJVG4X-Dyoz80Pv.js +162 -0
  278. package/web-shell/assets/fluent-Dayu4EKP.js +1 -0
  279. package/web-shell/assets/fortran-fixed-form-TqA4NnZg.js +1 -0
  280. package/web-shell/assets/fortran-free-form-DKXYxT9g.js +1 -0
  281. package/web-shell/assets/fsharp-XplgxFYe.js +1 -0
  282. package/web-shell/assets/ganttDiagram-6RSMTGT7-Cfut9yaU.js +292 -0
  283. package/web-shell/assets/gdresource-BHYsBjWJ.js +1 -0
  284. package/web-shell/assets/gdscript-DfxzS6Rs.js +1 -0
  285. package/web-shell/assets/gdshader-SKMF96pI.js +1 -0
  286. package/web-shell/assets/genie-ajMbGru0.js +1 -0
  287. package/web-shell/assets/gherkin--30QC5Em.js +1 -0
  288. package/web-shell/assets/git-commit-i4q6IMui.js +1 -0
  289. package/web-shell/assets/git-rebase-B-v9cOL2.js +1 -0
  290. package/web-shell/assets/gitGraphDiagram-PVQCEYII-BCuJdlfD.js +106 -0
  291. package/web-shell/assets/github-dark-DHJKELXO.js +1 -0
  292. package/web-shell/assets/github-dark-default-Cuk6v7N8.js +1 -0
  293. package/web-shell/assets/github-dark-dimmed-DH5Ifo-i.js +1 -0
  294. package/web-shell/assets/github-dark-high-contrast-E3gJ1_iC.js +1 -0
  295. package/web-shell/assets/github-light-DAi9KRSo.js +1 -0
  296. package/web-shell/assets/github-light-default-D7oLnXFd.js +1 -0
  297. package/web-shell/assets/github-light-high-contrast-BfjtVDDH.js +1 -0
  298. package/web-shell/assets/gleam-B430Bg39.js +1 -0
  299. package/web-shell/assets/glimmer-js-D-cwc0-E.js +1 -0
  300. package/web-shell/assets/glimmer-ts-pgjy16dm.js +1 -0
  301. package/web-shell/assets/glsl-DBO2IWDn.js +1 -0
  302. package/web-shell/assets/gnuplot-CM8KxXT1.js +1 -0
  303. package/web-shell/assets/go-B1SYOhNW.js +1 -0
  304. package/web-shell/assets/graph-qsFoMdT2.js +1 -0
  305. package/web-shell/assets/graphql-cDcHW_If.js +1 -0
  306. package/web-shell/assets/groovy-DkBy-JyN.js +1 -0
  307. package/web-shell/assets/hack-D1yCygmZ.js +1 -0
  308. package/web-shell/assets/haml-B2EZWmdv.js +1 -0
  309. package/web-shell/assets/handlebars-BQGss363.js +1 -0
  310. package/web-shell/assets/haskell-BILxekzW.js +1 -0
  311. package/web-shell/assets/haxe-C5wWYbrZ.js +1 -0
  312. package/web-shell/assets/hcl-HzYwdGDm.js +1 -0
  313. package/web-shell/assets/hjson-T-Tgc4AT.js +1 -0
  314. package/web-shell/assets/hlsl-ifBTmRxC.js +1 -0
  315. package/web-shell/assets/houston-DnULxvSX.js +1 -0
  316. package/web-shell/assets/html-C2L_23MC.js +1 -0
  317. package/web-shell/assets/html-derivative-CSfWNPLT.js +1 -0
  318. package/web-shell/assets/http-FRrOvY1W.js +1 -0
  319. package/web-shell/assets/hxml-TIA70rKU.js +1 -0
  320. package/web-shell/assets/hy-BMj5Y0dO.js +1 -0
  321. package/web-shell/assets/imba-bv_oIlVt.js +1 -0
  322. package/web-shell/assets/index-BDZiTAkl.css +1 -0
  323. package/web-shell/assets/index-DaebdpHq.js +516 -0
  324. package/web-shell/assets/infoDiagram-5YYISTIA-CXKxF2VL.js +2 -0
  325. package/web-shell/assets/ini-BjABl1g7.js +1 -0
  326. package/web-shell/assets/init-Gi6I4Gst.js +1 -0
  327. package/web-shell/assets/ishikawaDiagram-YF4QCWOH-DE7HWSU8.js +70 -0
  328. package/web-shell/assets/java-xI-RfyKK.js +1 -0
  329. package/web-shell/assets/javascript-ySlJ1b_l.js +1 -0
  330. package/web-shell/assets/jinja-DGy0s7-h.js +1 -0
  331. package/web-shell/assets/jison-BqZprYcd.js +1 -0
  332. package/web-shell/assets/journeyDiagram-JHISSGLW-D__YUfds.js +139 -0
  333. package/web-shell/assets/json-BQoSv7ci.js +1 -0
  334. package/web-shell/assets/json5-w8dY5SsB.js +1 -0
  335. package/web-shell/assets/jsonc-TU54ms6u.js +1 -0
  336. package/web-shell/assets/jsonl-DREVFZK8.js +1 -0
  337. package/web-shell/assets/jsonnet-BfivnA6A.js +1 -0
  338. package/web-shell/assets/jssm-P4WzXJd0.js +1 -0
  339. package/web-shell/assets/jsx-BAng5TT0.js +1 -0
  340. package/web-shell/assets/julia-BBuGR-5E.js +1 -0
  341. package/web-shell/assets/kanagawa-dragon-CkXjmgJE.js +1 -0
  342. package/web-shell/assets/kanagawa-lotus-CfQXZHmo.js +1 -0
  343. package/web-shell/assets/kanagawa-wave-DWedfzmr.js +1 -0
  344. package/web-shell/assets/kanban-definition-UN3LZRKU-D82R169M.js +89 -0
  345. package/web-shell/assets/kotlin-B5lbUyaz.js +1 -0
  346. package/web-shell/assets/kusto-mebxcVVE.js +1 -0
  347. package/web-shell/assets/laserwave-DUszq2jm.js +1 -0
  348. package/web-shell/assets/latex-C-cWTeAZ.js +1 -0
  349. package/web-shell/assets/layout-CNYaLpI5.js +1 -0
  350. package/web-shell/assets/lean-XBlWyCtg.js +1 -0
  351. package/web-shell/assets/less-BfCpw3nA.js +1 -0
  352. package/web-shell/assets/light-plus-B7mTdjB0.js +1 -0
  353. package/web-shell/assets/linear-DpyMbKqT.js +1 -0
  354. package/web-shell/assets/liquid-D3W5UaiH.js +1 -0
  355. package/web-shell/assets/log-Cc5clBb7.js +1 -0
  356. package/web-shell/assets/logo-IuBKFhSY.js +1 -0
  357. package/web-shell/assets/lua-CvWAzNxB.js +1 -0
  358. package/web-shell/assets/luau-Du5NY7AG.js +1 -0
  359. package/web-shell/assets/make-Bvotw-X0.js +1 -0
  360. package/web-shell/assets/markdown-UIAJJxZW.js +1 -0
  361. package/web-shell/assets/marko-z0MBrx5-.js +1 -0
  362. package/web-shell/assets/material-theme-D5KoaKCx.js +1 -0
  363. package/web-shell/assets/material-theme-darker-BfHTSMKl.js +1 -0
  364. package/web-shell/assets/material-theme-lighter-B0m2ddpp.js +1 -0
  365. package/web-shell/assets/material-theme-ocean-CyktbL80.js +1 -0
  366. package/web-shell/assets/material-theme-palenight-Csfq5Kiy.js +1 -0
  367. package/web-shell/assets/matlab-D9-PGadD.js +1 -0
  368. package/web-shell/assets/mdc-DB_EDNY_.js +1 -0
  369. package/web-shell/assets/mdx-sdHcTMYB.js +1 -0
  370. package/web-shell/assets/mermaid-Ci6OQyBP.js +1 -0
  371. package/web-shell/assets/mermaid.core-D1KEFDhn.js +309 -0
  372. package/web-shell/assets/min-dark-CafNBF8u.js +1 -0
  373. package/web-shell/assets/min-light-CTRr51gU.js +1 -0
  374. package/web-shell/assets/mindmap-definition-RKZ34NQL-BwVUFGFE.js +96 -0
  375. package/web-shell/assets/mipsasm-BC5c_5Pe.js +1 -0
  376. package/web-shell/assets/mojo-Tz6hzZYG.js +1 -0
  377. package/web-shell/assets/monokai-D4h5O-jR.js +1 -0
  378. package/web-shell/assets/move-DB_GagMm.js +1 -0
  379. package/web-shell/assets/narrat-DLbgOhZU.js +1 -0
  380. package/web-shell/assets/nextflow-B0XVJmRM.js +1 -0
  381. package/web-shell/assets/nginx-D_VnBJ67.js +1 -0
  382. package/web-shell/assets/night-owl-C39BiMTA.js +1 -0
  383. package/web-shell/assets/nim-ZlGxZxc3.js +1 -0
  384. package/web-shell/assets/nix-shcSOmrb.js +1 -0
  385. package/web-shell/assets/nord-Ddv68eIx.js +1 -0
  386. package/web-shell/assets/nushell-D4Tzg5kh.js +1 -0
  387. package/web-shell/assets/objective-c-Deuh7S70.js +1 -0
  388. package/web-shell/assets/objective-cpp-BUEGK8hf.js +1 -0
  389. package/web-shell/assets/ocaml-BNioltXt.js +1 -0
  390. package/web-shell/assets/one-dark-pro-GBQ2dnAY.js +1 -0
  391. package/web-shell/assets/one-light-PoHY5YXO.js +1 -0
  392. package/web-shell/assets/ordinal-Cboi1Yqb.js +1 -0
  393. package/web-shell/assets/pascal-JqZropPD.js +1 -0
  394. package/web-shell/assets/perl-CHQXSrWU.js +1 -0
  395. package/web-shell/assets/php-B5ebYQev.js +1 -0
  396. package/web-shell/assets/pieDiagram-4H26LBE5-BO_qoEGx.js +30 -0
  397. package/web-shell/assets/plastic-3e1v2bzS.js +1 -0
  398. package/web-shell/assets/plsql-LKU2TuZ1.js +1 -0
  399. package/web-shell/assets/po-BFLt1xDp.js +1 -0
  400. package/web-shell/assets/poimandres-CS3Unz2-.js +1 -0
  401. package/web-shell/assets/polar-DKykz6zU.js +1 -0
  402. package/web-shell/assets/postcss-B3ZDOciz.js +1 -0
  403. package/web-shell/assets/powerquery-CSHBycmS.js +1 -0
  404. package/web-shell/assets/powershell-BIEUsx6d.js +1 -0
  405. package/web-shell/assets/prisma-B48N-Iqd.js +1 -0
  406. package/web-shell/assets/prolog-BY-TUvya.js +1 -0
  407. package/web-shell/assets/proto-zocC4JxJ.js +1 -0
  408. package/web-shell/assets/pug-CM9l7STV.js +1 -0
  409. package/web-shell/assets/puppet-Cza_XSSt.js +1 -0
  410. package/web-shell/assets/purescript-Bg-kzb6g.js +1 -0
  411. package/web-shell/assets/python-DhUJRlN_.js +1 -0
  412. package/web-shell/assets/qml-D8XfuvdV.js +1 -0
  413. package/web-shell/assets/qmldir-C8lEn-DE.js +1 -0
  414. package/web-shell/assets/qss-DhMKtDLN.js +1 -0
  415. package/web-shell/assets/quadrantDiagram-W4KKPZXB-Cx0ZaWPo.js +7 -0
  416. package/web-shell/assets/r-CwjWoCRV.js +1 -0
  417. package/web-shell/assets/racket-CzouJOBO.js +1 -0
  418. package/web-shell/assets/raku-B1bQXN8T.js +1 -0
  419. package/web-shell/assets/razor-CNLDkMZG.js +1 -0
  420. package/web-shell/assets/red-bN70gL4F.js +1 -0
  421. package/web-shell/assets/reg-5LuOXUq_.js +1 -0
  422. package/web-shell/assets/regexp-DWJ3fJO_.js +1 -0
  423. package/web-shell/assets/rel-DJlmqQ1C.js +1 -0
  424. package/web-shell/assets/requirementDiagram-4Y6WPE33-BJPXejOA.js +84 -0
  425. package/web-shell/assets/riscv-QhoSD0DR.js +1 -0
  426. package/web-shell/assets/rose-pine-CmCqftbK.js +1 -0
  427. package/web-shell/assets/rose-pine-dawn-Ds-gbosJ.js +1 -0
  428. package/web-shell/assets/rose-pine-moon-CjDtw9vr.js +1 -0
  429. package/web-shell/assets/rst-4NLicBqY.js +1 -0
  430. package/web-shell/assets/ruby-DeZ3UC14.js +1 -0
  431. package/web-shell/assets/rust-Be6lgOlo.js +1 -0
  432. package/web-shell/assets/sankeyDiagram-5OEKKPKP-C1xeIL9i.js +40 -0
  433. package/web-shell/assets/sas-BmTFh92c.js +1 -0
  434. package/web-shell/assets/sass-BJ4Li9vH.js +1 -0
  435. package/web-shell/assets/scala-DQVVAn-B.js +1 -0
  436. package/web-shell/assets/scheme-BJGe-b2p.js +1 -0
  437. package/web-shell/assets/scss-C31hgJw-.js +1 -0
  438. package/web-shell/assets/sdbl-BLhTXw86.js +1 -0
  439. package/web-shell/assets/sequenceDiagram-3UESZ5HK-CSYKQUjf.js +162 -0
  440. package/web-shell/assets/shaderlab-B7qAK45m.js +1 -0
  441. package/web-shell/assets/shellscript-atvbtKCR.js +1 -0
  442. package/web-shell/assets/shellsession-C_rIy8kc.js +1 -0
  443. package/web-shell/assets/slack-dark-BthQWCQV.js +1 -0
  444. package/web-shell/assets/slack-ochin-DqwNpetd.js +1 -0
  445. package/web-shell/assets/smalltalk-DkLiglaE.js +1 -0
  446. package/web-shell/assets/snazzy-light-Bw305WKR.js +1 -0
  447. package/web-shell/assets/solarized-dark-DXbdFlpD.js +1 -0
  448. package/web-shell/assets/solarized-light-L9t79GZl.js +1 -0
  449. package/web-shell/assets/solidity-C1w2a3ep.js +1 -0
  450. package/web-shell/assets/soy-C-lX7w71.js +1 -0
  451. package/web-shell/assets/sparql-bYkjHRlG.js +1 -0
  452. package/web-shell/assets/splunk-Cf8iN4DR.js +1 -0
  453. package/web-shell/assets/sql-COK4E0Yg.js +1 -0
  454. package/web-shell/assets/ssh-config-BknIz3MU.js +1 -0
  455. package/web-shell/assets/stata-DorPZHa4.js +1 -0
  456. package/web-shell/assets/stateDiagram-AJRCARHV-d9hiHlAW.js +1 -0
  457. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DgReoybQ.js +1 -0
  458. package/web-shell/assets/stylus-BeQkCIfX.js +1 -0
  459. package/web-shell/assets/svelte-MSaWC3Je.js +1 -0
  460. package/web-shell/assets/swift-BSxZ-RaX.js +1 -0
  461. package/web-shell/assets/synthwave-84-CbfX1IO0.js +1 -0
  462. package/web-shell/assets/system-verilog-C7L56vO4.js +1 -0
  463. package/web-shell/assets/systemd-CUnW07Te.js +1 -0
  464. package/web-shell/assets/talonscript-C1XDQQGZ.js +1 -0
  465. package/web-shell/assets/tasl-CQjiPCtT.js +1 -0
  466. package/web-shell/assets/tcl-DQ1-QYvQ.js +1 -0
  467. package/web-shell/assets/templ-dwX3ZSMB.js +1 -0
  468. package/web-shell/assets/terraform-BbSNqyBO.js +1 -0
  469. package/web-shell/assets/tex-rYs2v40G.js +1 -0
  470. package/web-shell/assets/timeline-definition-PNZ67QCA-BhCBkq8k.js +120 -0
  471. package/web-shell/assets/tokyo-night-DBQeEorK.js +1 -0
  472. package/web-shell/assets/toml-CB2ApiWb.js +1 -0
  473. package/web-shell/assets/ts-tags-CipyTH0X.js +1 -0
  474. package/web-shell/assets/tsv-B_m7g4N7.js +1 -0
  475. package/web-shell/assets/tsx-B6W0miNI.js +1 -0
  476. package/web-shell/assets/turtle-BMR_PYu6.js +1 -0
  477. package/web-shell/assets/twig-NC5TFiHP.js +1 -0
  478. package/web-shell/assets/typescript-Dj6nwHGl.js +1 -0
  479. package/web-shell/assets/typespec-BpWG_bgh.js +1 -0
  480. package/web-shell/assets/typst-BVUVsWT6.js +1 -0
  481. package/web-shell/assets/v-CAQ2eGtk.js +1 -0
  482. package/web-shell/assets/vala-BFOHcciG.js +1 -0
  483. package/web-shell/assets/vb-CdO5JTpU.js +1 -0
  484. package/web-shell/assets/vennDiagram-CIIHVFJN-DPPFWp_y.js +34 -0
  485. package/web-shell/assets/verilog-CJaU5se_.js +1 -0
  486. package/web-shell/assets/vesper-BEBZ7ncR.js +1 -0
  487. package/web-shell/assets/vhdl-DYoNaHQp.js +1 -0
  488. package/web-shell/assets/viml-m4uW47V2.js +1 -0
  489. package/web-shell/assets/vitesse-black-Bkuqu6BP.js +1 -0
  490. package/web-shell/assets/vitesse-dark-D0r3Knsf.js +1 -0
  491. package/web-shell/assets/vitesse-light-CVO1_9PV.js +1 -0
  492. package/web-shell/assets/vue-BuYVFjOK.js +1 -0
  493. package/web-shell/assets/vue-html-xdeiXROB.js +1 -0
  494. package/web-shell/assets/vyper-nyqBNV6O.js +1 -0
  495. package/web-shell/assets/wardley-L42UT6IY-CcOUIgXY.js +173 -0
  496. package/web-shell/assets/wardleyDiagram-YWT4CUSO-p7oR5X7r.js +78 -0
  497. package/web-shell/assets/wasm-C6j12Q_x.js +1 -0
  498. package/web-shell/assets/wasm-CG6Dc4jp.js +1 -0
  499. package/web-shell/assets/wenyan-7A4Fjokl.js +1 -0
  500. package/web-shell/assets/wgsl-CB0Krxn9.js +1 -0
  501. package/web-shell/assets/wikitext-DCE3LsBG.js +1 -0
  502. package/web-shell/assets/wolfram-C3FkfJm5.js +1 -0
  503. package/web-shell/assets/xml-e3z08dGr.js +1 -0
  504. package/web-shell/assets/xsl-Dd0NUgwM.js +1 -0
  505. package/web-shell/assets/xychartDiagram-2RQKCTM6-Dfr7-SEy.js +7 -0
  506. package/web-shell/assets/yaml-CVw76BM1.js +1 -0
  507. package/web-shell/assets/zenscript-HnGAYVZD.js +1 -0
  508. package/web-shell/assets/zig-BVz_zdnA.js +1 -0
  509. package/web-shell/index.html +23 -0
  510. package/chunks/chunk-C64WAJOC.js +0 -117
  511. package/chunks/contextCommand-HI2X2Y7I.js +0 -53
@@ -63,10 +63,11 @@ import {
63
63
  getNpmVersion,
64
64
  getSettingDefinition,
65
65
  isNotCurrentlyGeneratingCancelError,
66
+ isWorkspaceTrusted,
66
67
  loadSettings,
67
68
  mapDomainErrorToErrorKind,
68
69
  reloadEnvironment
69
- } from "./chunk-QFJ67S5R.js";
70
+ } from "./chunk-VN7FXOAW.js";
70
71
  import {
71
72
  ClientSideConnection,
72
73
  PROTOCOL_VERSION,
@@ -77,13 +78,14 @@ import {
77
78
  SUPPORTED_LANGUAGES,
78
79
  writeStderrLine,
79
80
  writeStdoutLine
80
- } from "./chunk-M7OBURJM.js";
81
+ } from "./chunk-VIA5MAE5.js";
81
82
  import {
82
83
  ALL_PROVIDERS,
83
84
  APPROVAL_MODES,
84
85
  BTW_MAX_INPUT_LENGTH,
85
86
  BuiltinAgentRegistry,
86
87
  Client,
88
+ ExtensionManager,
87
89
  SessionService,
88
90
  ShellExecutionService,
89
91
  StandardFileSystemService,
@@ -98,32 +100,36 @@ import {
98
100
  applyProviderInstallPlan,
99
101
  buildInstallPlan,
100
102
  canUseRipgrep,
103
+ checkForExtensionUpdate,
101
104
  detectLineEnding,
102
105
  encodeTextFileContent,
103
106
  findProviderById,
104
107
  getDefaultModelIds,
105
108
  glob,
106
109
  loadIgnoreRules,
110
+ parseInstallSource,
111
+ redactUrlCredentials,
107
112
  require_once,
108
113
  resolveBaseUrl,
114
+ resolveBundleDir,
109
115
  shouldShowStep,
110
116
  writeWorkspaceContextFile
111
- } from "./chunk-EQ5NHJBY.js";
117
+ } from "./chunk-ZV5QED4A.js";
112
118
  import "./chunk-K5PGHDBN.js";
113
- import "./chunk-VIEIRAK3.js";
114
- import "./chunk-O4PICXES.js";
115
- import "./chunk-TW522KN6.js";
116
- import "./chunk-BJ5HQ23U.js";
117
- import "./chunk-SFRV6BGY.js";
118
- import "./chunk-ZOFNJQNJ.js";
119
- import "./chunk-WPTCDQN6.js";
120
- import "./chunk-OMX7CUOE.js";
119
+ import "./chunk-XU7BKR3B.js";
120
+ import "./chunk-2O3NAOJG.js";
121
+ import "./chunk-XGU3ETVO.js";
122
+ import "./chunk-2MPVVENX.js";
123
+ import "./chunk-ZTQ26VBE.js";
124
+ import "./chunk-C6MI2ASN.js";
125
+ import "./chunk-LF6BKGZT.js";
126
+ import "./chunk-26ZYKTYZ.js";
121
127
  import "./chunk-MLZQVCF3.js";
122
128
  import "./chunk-LD2XBG6Z.js";
123
- import "./chunk-CPVI5J2L.js";
124
- import "./chunk-ZMIBJS45.js";
129
+ import "./chunk-ID533GA3.js";
130
+ import "./chunk-KGV3F6UF.js";
125
131
  import "./chunk-77WXWU44.js";
126
- import "./chunk-B4ZF2KSI.js";
132
+ import "./chunk-AE6RQU6F.js";
127
133
  import {
128
134
  DAEMON_TRACEPARENT_META_KEY,
129
135
  DAEMON_TRACESTATE_META_KEY,
@@ -154,14 +160,15 @@ import {
154
160
  resolveTelemetrySettings,
155
161
  shutdownTelemetry,
156
162
  withDaemonRequestSpan
157
- } from "./chunk-25FFAMED.js";
163
+ } from "./chunk-NLCTUNOS.js";
158
164
  import "./chunk-3PJXIDKI.js";
159
165
  import "./chunk-UWCTAVOD.js";
160
166
  import "./chunk-OFEVLU4C.js";
161
- import "./chunk-IQHSD7K5.js";
162
- import "./chunk-LYRSMKLS.js";
163
- import "./chunk-RTTAC5VW.js";
164
- import "./chunk-ZNUMXPNK.js";
167
+ import "./chunk-OMX7CUOE.js";
168
+ import "./chunk-FH4P6RQA.js";
169
+ import "./chunk-CTHZVIMD.js";
170
+ import "./chunk-VKILGMZQ.js";
171
+ import "./chunk-GOMVJKBL.js";
165
172
  import {
166
173
  QwenOAuth2Client,
167
174
  QwenOAuthPollError,
@@ -170,15 +177,15 @@ import {
170
177
  isDeviceAuthorizationSuccess,
171
178
  isDeviceTokenPending,
172
179
  isDeviceTokenSuccess
173
- } from "./chunk-IDYDPBBN.js";
174
- import "./chunk-FIQECJTQ.js";
180
+ } from "./chunk-MSJ2MXJ6.js";
181
+ import "./chunk-ATLUHLZE.js";
175
182
  import "./chunk-64WXLC72.js";
176
- import "./chunk-LXYWINWF.js";
183
+ import "./chunk-LTN3VYMZ.js";
177
184
  import {
178
185
  detectRuntime,
179
186
  redactProxyCredentials
180
- } from "./chunk-NNIYWQIS.js";
181
- import "./chunk-LYSND7KR.js";
187
+ } from "./chunk-42HGOMED.js";
188
+ import "./chunk-G4BUMVEY.js";
182
189
  import "./chunk-55ZMG67I.js";
183
190
  import {
184
191
  import_websocket_server
@@ -187,7 +194,7 @@ import "./chunk-5IFG2VC4.js";
187
194
  import {
188
195
  Storage,
189
196
  updateSymlink
190
- } from "./chunk-HA2UEYZP.js";
197
+ } from "./chunk-WE6TNQJU.js";
191
198
  import "./chunk-ZERZSAZL.js";
192
199
  import {
193
200
  require_src
@@ -9239,11 +9246,11 @@ var require_mime_types = __commonJS({
9239
9246
  return exts[0];
9240
9247
  }
9241
9248
  __name(extension, "extension");
9242
- function lookup(path14) {
9243
- if (!path14 || typeof path14 !== "string") {
9249
+ function lookup(path15) {
9250
+ if (!path15 || typeof path15 !== "string") {
9244
9251
  return false;
9245
9252
  }
9246
- var extension2 = extname("x." + path14).toLowerCase().slice(1);
9253
+ var extension2 = extname("x." + path15).toLowerCase().slice(1);
9247
9254
  if (!extension2) {
9248
9255
  return false;
9249
9256
  }
@@ -10374,13 +10381,13 @@ var require_view = __commonJS({
10374
10381
  "use strict";
10375
10382
  init_esbuild_shims();
10376
10383
  var debug = require_src()("express:view");
10377
- var path14 = __require("node:path");
10384
+ var path15 = __require("node:path");
10378
10385
  var fs7 = __require("node:fs");
10379
- var dirname5 = path14.dirname;
10380
- var basename3 = path14.basename;
10381
- var extname = path14.extname;
10382
- var join6 = path14.join;
10383
- var resolve6 = path14.resolve;
10386
+ var dirname6 = path15.dirname;
10387
+ var basename3 = path15.basename;
10388
+ var extname = path15.extname;
10389
+ var join7 = path15.join;
10390
+ var resolve6 = path15.resolve;
10384
10391
  module.exports = View;
10385
10392
  function View(name, options) {
10386
10393
  var opts = options || {};
@@ -10410,17 +10417,17 @@ var require_view = __commonJS({
10410
10417
  }
10411
10418
  __name(View, "View");
10412
10419
  View.prototype.lookup = /* @__PURE__ */ __name(function lookup(name) {
10413
- var path15;
10420
+ var path16;
10414
10421
  var roots = [].concat(this.root);
10415
10422
  debug('lookup "%s"', name);
10416
- for (var i = 0; i < roots.length && !path15; i++) {
10423
+ for (var i = 0; i < roots.length && !path16; i++) {
10417
10424
  var root = roots[i];
10418
10425
  var loc = resolve6(root, name);
10419
- var dir = dirname5(loc);
10426
+ var dir = dirname6(loc);
10420
10427
  var file = basename3(loc);
10421
- path15 = this.resolve(dir, file);
10428
+ path16 = this.resolve(dir, file);
10422
10429
  }
10423
- return path15;
10430
+ return path16;
10424
10431
  }, "lookup");
10425
10432
  View.prototype.render = /* @__PURE__ */ __name(function render(options, callback) {
10426
10433
  var sync = true;
@@ -10442,21 +10449,21 @@ var require_view = __commonJS({
10442
10449
  }, "render");
10443
10450
  View.prototype.resolve = /* @__PURE__ */ __name(function resolve7(dir, file) {
10444
10451
  var ext = this.ext;
10445
- var path15 = join6(dir, file);
10446
- var stat = tryStat(path15);
10452
+ var path16 = join7(dir, file);
10453
+ var stat = tryStat(path16);
10447
10454
  if (stat && stat.isFile()) {
10448
- return path15;
10455
+ return path16;
10449
10456
  }
10450
- path15 = join6(dir, basename3(file, ext), "index" + ext);
10451
- stat = tryStat(path15);
10457
+ path16 = join7(dir, basename3(file, ext), "index" + ext);
10458
+ stat = tryStat(path16);
10452
10459
  if (stat && stat.isFile()) {
10453
- return path15;
10460
+ return path16;
10454
10461
  }
10455
10462
  }, "resolve");
10456
- function tryStat(path15) {
10457
- debug('stat "%s"', path15);
10463
+ function tryStat(path16) {
10464
+ debug('stat "%s"', path16);
10458
10465
  try {
10459
- return fs7.statSync(path15);
10466
+ return fs7.statSync(path16);
10460
10467
  } catch (e) {
10461
10468
  return void 0;
10462
10469
  }
@@ -11646,9 +11653,9 @@ var require_dist2 = __commonJS({
11646
11653
  function consume(endType) {
11647
11654
  const tokens2 = [];
11648
11655
  while (true) {
11649
- const path14 = it.text();
11650
- if (path14)
11651
- tokens2.push({ type: "text", value: encodePath(path14) });
11656
+ const path15 = it.text();
11657
+ if (path15)
11658
+ tokens2.push({ type: "text", value: encodePath(path15) });
11652
11659
  const param = it.tryConsume("PARAM");
11653
11660
  if (param) {
11654
11661
  tokens2.push({
@@ -11682,16 +11689,16 @@ var require_dist2 = __commonJS({
11682
11689
  return new TokenData(tokens);
11683
11690
  }
11684
11691
  __name(parse, "parse");
11685
- function compile(path14, options = {}) {
11692
+ function compile(path15, options = {}) {
11686
11693
  const { encode = encodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
11687
- const data = path14 instanceof TokenData ? path14 : parse(path14, options);
11694
+ const data = path15 instanceof TokenData ? path15 : parse(path15, options);
11688
11695
  const fn = tokensToFunction(data.tokens, delimiter, encode);
11689
- return /* @__PURE__ */ __name(function path15(data2 = {}) {
11690
- const [path16, ...missing] = fn(data2);
11696
+ return /* @__PURE__ */ __name(function path16(data2 = {}) {
11697
+ const [path17, ...missing] = fn(data2);
11691
11698
  if (missing.length) {
11692
11699
  throw new TypeError(`Missing parameters: ${missing.join(", ")}`);
11693
11700
  }
11694
- return path16;
11701
+ return path17;
11695
11702
  }, "path");
11696
11703
  }
11697
11704
  __name(compile, "compile");
@@ -11750,9 +11757,9 @@ var require_dist2 = __commonJS({
11750
11757
  };
11751
11758
  }
11752
11759
  __name(tokenToFunction, "tokenToFunction");
11753
- function match(path14, options = {}) {
11760
+ function match(path15, options = {}) {
11754
11761
  const { decode = decodeURIComponent, delimiter = DEFAULT_DELIMITER } = options;
11755
- const { regexp, keys } = pathToRegexp(path14, options);
11762
+ const { regexp, keys } = pathToRegexp(path15, options);
11756
11763
  const decoders = keys.map((key) => {
11757
11764
  if (decode === false)
11758
11765
  return NOOP_VALUE;
@@ -11764,7 +11771,7 @@ var require_dist2 = __commonJS({
11764
11771
  const m = regexp.exec(input);
11765
11772
  if (!m)
11766
11773
  return false;
11767
- const path15 = m[0];
11774
+ const path16 = m[0];
11768
11775
  const params = /* @__PURE__ */ Object.create(null);
11769
11776
  for (let i = 1; i < m.length; i++) {
11770
11777
  if (m[i] === void 0)
@@ -11773,17 +11780,17 @@ var require_dist2 = __commonJS({
11773
11780
  const decoder = decoders[i - 1];
11774
11781
  params[key.name] = decoder(m[i]);
11775
11782
  }
11776
- return { path: path15, params };
11783
+ return { path: path16, params };
11777
11784
  }, "match");
11778
11785
  }
11779
11786
  __name(match, "match");
11780
- function pathToRegexp(path14, options = {}) {
11787
+ function pathToRegexp(path15, options = {}) {
11781
11788
  const { delimiter = DEFAULT_DELIMITER, end = true, sensitive = false, trailing = true } = options;
11782
11789
  const keys = [];
11783
11790
  const sources = [];
11784
11791
  const flags = sensitive ? "" : "i";
11785
- const paths = Array.isArray(path14) ? path14 : [path14];
11786
- const items = paths.map((path15) => path15 instanceof TokenData ? path15 : parse(path15, options));
11792
+ const paths = Array.isArray(path15) ? path15 : [path15];
11793
+ const items = paths.map((path16) => path16 instanceof TokenData ? path16 : parse(path16, options));
11787
11794
  for (const { tokens } of items) {
11788
11795
  for (const seq of flatten(tokens, 0, [])) {
11789
11796
  const regexp2 = sequenceToRegExp(seq, delimiter, keys);
@@ -11901,18 +11908,18 @@ var require_layer = __commonJS({
11901
11908
  var TRAILING_SLASH_REGEXP = /\/+$/;
11902
11909
  var MATCHING_GROUP_REGEXP = /\((?:\?<(.*?)>)?(?!\?)/g;
11903
11910
  module.exports = Layer;
11904
- function Layer(path14, options, fn) {
11911
+ function Layer(path15, options, fn) {
11905
11912
  if (!(this instanceof Layer)) {
11906
- return new Layer(path14, options, fn);
11913
+ return new Layer(path15, options, fn);
11907
11914
  }
11908
- debug("new %o", path14);
11915
+ debug("new %o", path15);
11909
11916
  const opts = options || {};
11910
11917
  this.handle = fn;
11911
11918
  this.keys = [];
11912
11919
  this.name = fn.name || "<anonymous>";
11913
11920
  this.params = void 0;
11914
11921
  this.path = void 0;
11915
- this.slash = path14 === "/" && opts.end === false;
11922
+ this.slash = path15 === "/" && opts.end === false;
11916
11923
  function matcher(_path) {
11917
11924
  if (_path instanceof RegExp) {
11918
11925
  const keys = [];
@@ -11952,7 +11959,7 @@ var require_layer = __commonJS({
11952
11959
  });
11953
11960
  }
11954
11961
  __name(matcher, "matcher");
11955
- this.matchers = Array.isArray(path14) ? path14.map(matcher) : [matcher(path14)];
11962
+ this.matchers = Array.isArray(path15) ? path15.map(matcher) : [matcher(path15)];
11956
11963
  }
11957
11964
  __name(Layer, "Layer");
11958
11965
  Layer.prototype.handleError = /* @__PURE__ */ __name(function handleError(error2, req, res, next) {
@@ -11993,9 +12000,9 @@ var require_layer = __commonJS({
11993
12000
  next(err);
11994
12001
  }
11995
12002
  }, "handleRequest");
11996
- Layer.prototype.match = /* @__PURE__ */ __name(function match(path14) {
12003
+ Layer.prototype.match = /* @__PURE__ */ __name(function match(path15) {
11997
12004
  let match2;
11998
- if (path14 != null) {
12005
+ if (path15 != null) {
11999
12006
  if (this.slash) {
12000
12007
  this.params = {};
12001
12008
  this.path = "";
@@ -12003,7 +12010,7 @@ var require_layer = __commonJS({
12003
12010
  }
12004
12011
  let i = 0;
12005
12012
  while (!match2 && i < this.matchers.length) {
12006
- match2 = this.matchers[i](path14);
12013
+ match2 = this.matchers[i](path15);
12007
12014
  i++;
12008
12015
  }
12009
12016
  }
@@ -12032,13 +12039,13 @@ var require_layer = __commonJS({
12032
12039
  }
12033
12040
  }
12034
12041
  __name(decodeParam, "decodeParam");
12035
- function loosen(path14) {
12036
- if (path14 instanceof RegExp || path14 === "/") {
12037
- return path14;
12042
+ function loosen(path15) {
12043
+ if (path15 instanceof RegExp || path15 === "/") {
12044
+ return path15;
12038
12045
  }
12039
- return Array.isArray(path14) ? path14.map(function(p) {
12046
+ return Array.isArray(path15) ? path15.map(function(p) {
12040
12047
  return loosen(p);
12041
- }) : String(path14).replace(TRAILING_SLASH_REGEXP, "");
12048
+ }) : String(path15).replace(TRAILING_SLASH_REGEXP, "");
12042
12049
  }
12043
12050
  __name(loosen, "loosen");
12044
12051
  }
@@ -12056,9 +12063,9 @@ var require_route = __commonJS({
12056
12063
  var flatten = Array.prototype.flat;
12057
12064
  var methods = METHODS.map((method) => method.toLowerCase());
12058
12065
  module.exports = Route;
12059
- function Route(path14) {
12060
- debug("new %o", path14);
12061
- this.path = path14;
12066
+ function Route(path15) {
12067
+ debug("new %o", path15);
12068
+ this.path = path15;
12062
12069
  this.stack = [];
12063
12070
  this.methods = /* @__PURE__ */ Object.create(null);
12064
12071
  }
@@ -12271,8 +12278,8 @@ var require_router = __commonJS({
12271
12278
  if (++sync > 100) {
12272
12279
  return setImmediate(next, err);
12273
12280
  }
12274
- const path14 = getPathname(req);
12275
- if (path14 == null) {
12281
+ const path15 = getPathname(req);
12282
+ if (path15 == null) {
12276
12283
  return done(layerError);
12277
12284
  }
12278
12285
  let layer;
@@ -12280,7 +12287,7 @@ var require_router = __commonJS({
12280
12287
  let route;
12281
12288
  while (match !== true && idx < stack.length) {
12282
12289
  layer = stack[idx++];
12283
- match = matchLayer(layer, path14);
12290
+ match = matchLayer(layer, path15);
12284
12291
  route = layer.route;
12285
12292
  if (typeof match !== "boolean") {
12286
12293
  layerError = layerError || match;
@@ -12318,19 +12325,19 @@ var require_router = __commonJS({
12318
12325
  } else if (route) {
12319
12326
  layer.handleRequest(req, res, next);
12320
12327
  } else {
12321
- trimPrefix(layer, layerError, layerPath, path14);
12328
+ trimPrefix(layer, layerError, layerPath, path15);
12322
12329
  }
12323
12330
  sync = 0;
12324
12331
  });
12325
12332
  }
12326
12333
  __name(next, "next");
12327
- function trimPrefix(layer, layerError, layerPath, path14) {
12334
+ function trimPrefix(layer, layerError, layerPath, path15) {
12328
12335
  if (layerPath.length !== 0) {
12329
- if (layerPath !== path14.substring(0, layerPath.length)) {
12336
+ if (layerPath !== path15.substring(0, layerPath.length)) {
12330
12337
  next(layerError);
12331
12338
  return;
12332
12339
  }
12333
- const c = path14[layerPath.length];
12340
+ const c = path15[layerPath.length];
12334
12341
  if (c && c !== "/") {
12335
12342
  next(layerError);
12336
12343
  return;
@@ -12355,7 +12362,7 @@ var require_router = __commonJS({
12355
12362
  }, "handle");
12356
12363
  Router.prototype.use = /* @__PURE__ */ __name(function use(handler) {
12357
12364
  let offset = 0;
12358
- let path14 = "/";
12365
+ let path15 = "/";
12359
12366
  if (typeof handler !== "function") {
12360
12367
  let arg = handler;
12361
12368
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -12363,7 +12370,7 @@ var require_router = __commonJS({
12363
12370
  }
12364
12371
  if (typeof arg !== "function") {
12365
12372
  offset = 1;
12366
- path14 = handler;
12373
+ path15 = handler;
12367
12374
  }
12368
12375
  }
12369
12376
  const callbacks = flatten.call(slice.call(arguments, offset), Infinity);
@@ -12375,8 +12382,8 @@ var require_router = __commonJS({
12375
12382
  if (typeof fn !== "function") {
12376
12383
  throw new TypeError("argument handler must be a function");
12377
12384
  }
12378
- debug("use %o %s", path14, fn.name || "<anonymous>");
12379
- const layer = new Layer(path14, {
12385
+ debug("use %o %s", path15, fn.name || "<anonymous>");
12386
+ const layer = new Layer(path15, {
12380
12387
  sensitive: this.caseSensitive,
12381
12388
  strict: false,
12382
12389
  end: false
@@ -12386,9 +12393,9 @@ var require_router = __commonJS({
12386
12393
  }
12387
12394
  return this;
12388
12395
  }, "use");
12389
- Router.prototype.route = /* @__PURE__ */ __name(function route(path14) {
12390
- const route2 = new Route(path14);
12391
- const layer = new Layer(path14, {
12396
+ Router.prototype.route = /* @__PURE__ */ __name(function route(path15) {
12397
+ const route2 = new Route(path15);
12398
+ const layer = new Layer(path15, {
12392
12399
  sensitive: this.caseSensitive,
12393
12400
  strict: this.strict,
12394
12401
  end: true
@@ -12402,8 +12409,8 @@ var require_router = __commonJS({
12402
12409
  return route2;
12403
12410
  }, "route");
12404
12411
  methods.concat("all").forEach(function(method) {
12405
- Router.prototype[method] = function(path14) {
12406
- const route = this.route(path14);
12412
+ Router.prototype[method] = function(path15) {
12413
+ const route = this.route(path15);
12407
12414
  route[method].apply(route, slice.call(arguments, 1));
12408
12415
  return this;
12409
12416
  };
@@ -12435,9 +12442,9 @@ var require_router = __commonJS({
12435
12442
  return fqdnIndex !== -1 ? url.substring(0, url.indexOf("/", 3 + fqdnIndex)) : void 0;
12436
12443
  }
12437
12444
  __name(getProtohost, "getProtohost");
12438
- function matchLayer(layer, path14) {
12445
+ function matchLayer(layer, path15) {
12439
12446
  try {
12440
- return layer.match(path14);
12447
+ return layer.match(path15);
12441
12448
  } catch (err) {
12442
12449
  return err;
12443
12450
  }
@@ -12675,7 +12682,7 @@ var require_application = __commonJS({
12675
12682
  }, "handle");
12676
12683
  app.use = /* @__PURE__ */ __name(function use(fn) {
12677
12684
  var offset = 0;
12678
- var path14 = "/";
12685
+ var path15 = "/";
12679
12686
  if (typeof fn !== "function") {
12680
12687
  var arg = fn;
12681
12688
  while (Array.isArray(arg) && arg.length !== 0) {
@@ -12683,7 +12690,7 @@ var require_application = __commonJS({
12683
12690
  }
12684
12691
  if (typeof arg !== "function") {
12685
12692
  offset = 1;
12686
- path14 = fn;
12693
+ path15 = fn;
12687
12694
  }
12688
12695
  }
12689
12696
  var fns = flatten.call(slice.call(arguments, offset), Infinity);
@@ -12693,12 +12700,12 @@ var require_application = __commonJS({
12693
12700
  var router = this.router;
12694
12701
  fns.forEach(function(fn2) {
12695
12702
  if (!fn2 || !fn2.handle || !fn2.set) {
12696
- return router.use(path14, fn2);
12703
+ return router.use(path15, fn2);
12697
12704
  }
12698
- debug(".use app under %s", path14);
12699
- fn2.mountpath = path14;
12705
+ debug(".use app under %s", path15);
12706
+ fn2.mountpath = path15;
12700
12707
  fn2.parent = this;
12701
- router.use(path14, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
12708
+ router.use(path15, /* @__PURE__ */ __name(function mounted_app(req, res, next) {
12702
12709
  var orig = req.app;
12703
12710
  fn2.handle(req, res, function(err) {
12704
12711
  Object.setPrototypeOf(req, orig.request);
@@ -12710,8 +12717,8 @@ var require_application = __commonJS({
12710
12717
  }, this);
12711
12718
  return this;
12712
12719
  }, "use");
12713
- app.route = /* @__PURE__ */ __name(function route(path14) {
12714
- return this.router.route(path14);
12720
+ app.route = /* @__PURE__ */ __name(function route(path15) {
12721
+ return this.router.route(path15);
12715
12722
  }, "route");
12716
12723
  app.engine = /* @__PURE__ */ __name(function engine(ext, fn) {
12717
12724
  if (typeof fn !== "function") {
@@ -12754,7 +12761,7 @@ var require_application = __commonJS({
12754
12761
  }
12755
12762
  return this;
12756
12763
  }, "set");
12757
- app.path = /* @__PURE__ */ __name(function path14() {
12764
+ app.path = /* @__PURE__ */ __name(function path15() {
12758
12765
  return this.parent ? this.parent.path() + this.mountpath : "";
12759
12766
  }, "path");
12760
12767
  app.enabled = /* @__PURE__ */ __name(function enabled(setting) {
@@ -12770,17 +12777,17 @@ var require_application = __commonJS({
12770
12777
  return this.set(setting, false);
12771
12778
  }, "disable");
12772
12779
  methods.forEach(function(method) {
12773
- app[method] = function(path14) {
12780
+ app[method] = function(path15) {
12774
12781
  if (method === "get" && arguments.length === 1) {
12775
- return this.set(path14);
12782
+ return this.set(path15);
12776
12783
  }
12777
- var route = this.route(path14);
12784
+ var route = this.route(path15);
12778
12785
  route[method].apply(route, slice.call(arguments, 1));
12779
12786
  return this;
12780
12787
  };
12781
12788
  });
12782
- app.all = /* @__PURE__ */ __name(function all(path14) {
12783
- var route = this.route(path14);
12789
+ app.all = /* @__PURE__ */ __name(function all(path15) {
12790
+ var route = this.route(path15);
12784
12791
  var args = slice.call(arguments, 1);
12785
12792
  for (var i = 0; i < methods.length; i++) {
12786
12793
  route[methods[i]].apply(route, args);
@@ -13750,7 +13757,7 @@ var require_request = __commonJS({
13750
13757
  var subdomains2 = !isIP2(hostname) ? hostname.split(".").reverse() : [hostname];
13751
13758
  return subdomains2.slice(offset);
13752
13759
  }, "subdomains"));
13753
- defineGetter(req, "path", /* @__PURE__ */ __name(function path14() {
13760
+ defineGetter(req, "path", /* @__PURE__ */ __name(function path15() {
13754
13761
  return parse(this).pathname;
13755
13762
  }, "path"));
13756
13763
  defineGetter(req, "host", /* @__PURE__ */ __name(function host() {
@@ -13973,8 +13980,8 @@ var require_content_disposition = __commonJS({
13973
13980
  this.parameters = parameters;
13974
13981
  }
13975
13982
  __name(ContentDisposition, "ContentDisposition");
13976
- function basename3(path14) {
13977
- const normalized = path14.replaceAll("\\", "/");
13983
+ function basename3(path15) {
13984
+ const normalized = path15.replaceAll("\\", "/");
13978
13985
  let end = normalized.length;
13979
13986
  while (end > 0 && normalized[end - 1] === "/") {
13980
13987
  end--;
@@ -14234,28 +14241,28 @@ var require_send = __commonJS({
14234
14241
  var ms = require_ms();
14235
14242
  var onFinished = require_on_finished();
14236
14243
  var parseRange = require_range_parser();
14237
- var path14 = __require("path");
14244
+ var path15 = __require("path");
14238
14245
  var statuses = require_statuses();
14239
14246
  var Stream = __require("stream");
14240
14247
  var util = __require("util");
14241
- var extname = path14.extname;
14242
- var join6 = path14.join;
14243
- var normalize = path14.normalize;
14244
- var resolve6 = path14.resolve;
14245
- var sep4 = path14.sep;
14248
+ var extname = path15.extname;
14249
+ var join7 = path15.join;
14250
+ var normalize = path15.normalize;
14251
+ var resolve6 = path15.resolve;
14252
+ var sep4 = path15.sep;
14246
14253
  var BYTES_RANGE_REGEXP = /^ *bytes=/;
14247
14254
  var MAX_MAXAGE = 60 * 60 * 24 * 365 * 1e3;
14248
14255
  var UP_PATH_REGEXP = /(?:^|[\\/])\.\.(?:[\\/]|$)/;
14249
14256
  module.exports = send;
14250
- function send(req, path15, options) {
14251
- return new SendStream(req, path15, options);
14257
+ function send(req, path16, options) {
14258
+ return new SendStream(req, path16, options);
14252
14259
  }
14253
14260
  __name(send, "send");
14254
- function SendStream(req, path15, options) {
14261
+ function SendStream(req, path16, options) {
14255
14262
  Stream.call(this);
14256
14263
  var opts = options || {};
14257
14264
  this.options = opts;
14258
- this.path = path15;
14265
+ this.path = path16;
14259
14266
  this.req = req;
14260
14267
  this._acceptRanges = opts.acceptRanges !== void 0 ? Boolean(opts.acceptRanges) : true;
14261
14268
  this._cacheControl = opts.cacheControl !== void 0 ? Boolean(opts.cacheControl) : true;
@@ -14370,10 +14377,10 @@ var require_send = __commonJS({
14370
14377
  var lastModified = this.res.getHeader("Last-Modified");
14371
14378
  return parseHttpDate(lastModified) <= parseHttpDate(ifRange);
14372
14379
  }, "isRangeFresh");
14373
- SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(path15) {
14380
+ SendStream.prototype.redirect = /* @__PURE__ */ __name(function redirect(path16) {
14374
14381
  var res = this.res;
14375
14382
  if (hasListeners(this, "directory")) {
14376
- this.emit("directory", res, path15);
14383
+ this.emit("directory", res, path16);
14377
14384
  return;
14378
14385
  }
14379
14386
  if (this.hasTrailingSlash()) {
@@ -14393,38 +14400,38 @@ var require_send = __commonJS({
14393
14400
  SendStream.prototype.pipe = /* @__PURE__ */ __name(function pipe(res) {
14394
14401
  var root = this._root;
14395
14402
  this.res = res;
14396
- var path15 = decode(this.path);
14397
- if (path15 === -1) {
14403
+ var path16 = decode(this.path);
14404
+ if (path16 === -1) {
14398
14405
  this.error(400);
14399
14406
  return res;
14400
14407
  }
14401
- if (~path15.indexOf("\0")) {
14408
+ if (~path16.indexOf("\0")) {
14402
14409
  this.error(400);
14403
14410
  return res;
14404
14411
  }
14405
14412
  var parts;
14406
14413
  if (root !== null) {
14407
- if (path15) {
14408
- path15 = normalize("." + sep4 + path15);
14414
+ if (path16) {
14415
+ path16 = normalize("." + sep4 + path16);
14409
14416
  }
14410
- if (UP_PATH_REGEXP.test(path15)) {
14411
- debug('malicious path "%s"', path15);
14417
+ if (UP_PATH_REGEXP.test(path16)) {
14418
+ debug('malicious path "%s"', path16);
14412
14419
  this.error(403);
14413
14420
  return res;
14414
14421
  }
14415
- parts = path15.split(sep4);
14416
- path15 = normalize(join6(root, path15));
14422
+ parts = path16.split(sep4);
14423
+ path16 = normalize(join7(root, path16));
14417
14424
  } else {
14418
- if (UP_PATH_REGEXP.test(path15)) {
14419
- debug('malicious path "%s"', path15);
14425
+ if (UP_PATH_REGEXP.test(path16)) {
14426
+ debug('malicious path "%s"', path16);
14420
14427
  this.error(403);
14421
14428
  return res;
14422
14429
  }
14423
- parts = normalize(path15).split(sep4);
14424
- path15 = resolve6(path15);
14430
+ parts = normalize(path16).split(sep4);
14431
+ path16 = resolve6(path16);
14425
14432
  }
14426
14433
  if (containsDotFile(parts)) {
14427
- debug('%s dotfile "%s"', this._dotfiles, path15);
14434
+ debug('%s dotfile "%s"', this._dotfiles, path16);
14428
14435
  switch (this._dotfiles) {
14429
14436
  case "allow":
14430
14437
  break;
@@ -14438,13 +14445,13 @@ var require_send = __commonJS({
14438
14445
  }
14439
14446
  }
14440
14447
  if (this._index.length && this.hasTrailingSlash()) {
14441
- this.sendIndex(path15);
14448
+ this.sendIndex(path16);
14442
14449
  return res;
14443
14450
  }
14444
- this.sendFile(path15);
14451
+ this.sendFile(path16);
14445
14452
  return res;
14446
14453
  }, "pipe");
14447
- SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path15, stat) {
14454
+ SendStream.prototype.send = /* @__PURE__ */ __name(function send2(path16, stat) {
14448
14455
  var len = stat.size;
14449
14456
  var options = this.options;
14450
14457
  var opts = {};
@@ -14456,9 +14463,9 @@ var require_send = __commonJS({
14456
14463
  this.headersAlreadySent();
14457
14464
  return;
14458
14465
  }
14459
- debug('pipe "%s"', path15);
14460
- this.setHeader(path15, stat);
14461
- this.type(path15);
14466
+ debug('pipe "%s"', path16);
14467
+ this.setHeader(path16, stat);
14468
+ this.type(path16);
14462
14469
  if (this.isConditionalGET()) {
14463
14470
  if (this.isPreconditionFailure()) {
14464
14471
  this.error(412);
@@ -14507,28 +14514,28 @@ var require_send = __commonJS({
14507
14514
  res.end();
14508
14515
  return;
14509
14516
  }
14510
- this.stream(path15, opts);
14517
+ this.stream(path16, opts);
14511
14518
  }, "send");
14512
- SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path15) {
14519
+ SendStream.prototype.sendFile = /* @__PURE__ */ __name(function sendFile(path16) {
14513
14520
  var i = 0;
14514
14521
  var self = this;
14515
- debug('stat "%s"', path15);
14516
- fs7.stat(path15, /* @__PURE__ */ __name(function onstat(err, stat) {
14517
- var pathEndsWithSep = path15[path15.length - 1] === sep4;
14518
- if (err && err.code === "ENOENT" && !extname(path15) && !pathEndsWithSep) {
14522
+ debug('stat "%s"', path16);
14523
+ fs7.stat(path16, /* @__PURE__ */ __name(function onstat(err, stat) {
14524
+ var pathEndsWithSep = path16[path16.length - 1] === sep4;
14525
+ if (err && err.code === "ENOENT" && !extname(path16) && !pathEndsWithSep) {
14519
14526
  return next(err);
14520
14527
  }
14521
14528
  if (err) return self.onStatError(err);
14522
- if (stat.isDirectory()) return self.redirect(path15);
14529
+ if (stat.isDirectory()) return self.redirect(path16);
14523
14530
  if (pathEndsWithSep) return self.error(404);
14524
- self.emit("file", path15, stat);
14525
- self.send(path15, stat);
14531
+ self.emit("file", path16, stat);
14532
+ self.send(path16, stat);
14526
14533
  }, "onstat"));
14527
14534
  function next(err) {
14528
14535
  if (self._extensions.length <= i) {
14529
14536
  return err ? self.onStatError(err) : self.error(404);
14530
14537
  }
14531
- var p = path15 + "." + self._extensions[i++];
14538
+ var p = path16 + "." + self._extensions[i++];
14532
14539
  debug('stat "%s"', p);
14533
14540
  fs7.stat(p, function(err2, stat) {
14534
14541
  if (err2) return next(err2);
@@ -14539,7 +14546,7 @@ var require_send = __commonJS({
14539
14546
  }
14540
14547
  __name(next, "next");
14541
14548
  }, "sendFile");
14542
- SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(path15) {
14549
+ SendStream.prototype.sendIndex = /* @__PURE__ */ __name(function sendIndex(path16) {
14543
14550
  var i = -1;
14544
14551
  var self = this;
14545
14552
  function next(err) {
@@ -14547,7 +14554,7 @@ var require_send = __commonJS({
14547
14554
  if (err) return self.onStatError(err);
14548
14555
  return self.error(404);
14549
14556
  }
14550
- var p = join6(path15, self._index[i]);
14557
+ var p = join7(path16, self._index[i]);
14551
14558
  debug('stat "%s"', p);
14552
14559
  fs7.stat(p, function(err2, stat) {
14553
14560
  if (err2) return next(err2);
@@ -14559,10 +14566,10 @@ var require_send = __commonJS({
14559
14566
  __name(next, "next");
14560
14567
  next();
14561
14568
  }, "sendIndex");
14562
- SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(path15, options) {
14569
+ SendStream.prototype.stream = /* @__PURE__ */ __name(function stream(path16, options) {
14563
14570
  var self = this;
14564
14571
  var res = this.res;
14565
- var stream2 = fs7.createReadStream(path15, options);
14572
+ var stream2 = fs7.createReadStream(path16, options);
14566
14573
  this.emit("stream", stream2);
14567
14574
  stream2.pipe(res);
14568
14575
  function cleanup() {
@@ -14578,17 +14585,17 @@ var require_send = __commonJS({
14578
14585
  self.emit("end");
14579
14586
  }, "onend"));
14580
14587
  }, "stream");
14581
- SendStream.prototype.type = /* @__PURE__ */ __name(function type(path15) {
14588
+ SendStream.prototype.type = /* @__PURE__ */ __name(function type(path16) {
14582
14589
  var res = this.res;
14583
14590
  if (res.getHeader("Content-Type")) return;
14584
- var ext = extname(path15);
14591
+ var ext = extname(path16);
14585
14592
  var type2 = mime.contentType(ext) || "application/octet-stream";
14586
14593
  debug("content-type %s", type2);
14587
14594
  res.setHeader("Content-Type", type2);
14588
14595
  }, "type");
14589
- SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(path15, stat) {
14596
+ SendStream.prototype.setHeader = /* @__PURE__ */ __name(function setHeader(path16, stat) {
14590
14597
  var res = this.res;
14591
- this.emit("headers", res, path15, stat);
14598
+ this.emit("headers", res, path16, stat);
14592
14599
  if (this._acceptRanges && !res.getHeader("Accept-Ranges")) {
14593
14600
  debug("accept ranges");
14594
14601
  res.setHeader("Accept-Ranges", "bytes");
@@ -14652,9 +14659,9 @@ var require_send = __commonJS({
14652
14659
  return err instanceof Error ? createError(status, err, { expose: false }) : createError(status, err);
14653
14660
  }
14654
14661
  __name(createHttpError, "createHttpError");
14655
- function decode(path15) {
14662
+ function decode(path16) {
14656
14663
  try {
14657
- return decodeURIComponent(path15);
14664
+ return decodeURIComponent(path16);
14658
14665
  } catch (err) {
14659
14666
  return -1;
14660
14667
  }
@@ -14809,7 +14816,7 @@ var require_response = __commonJS({
14809
14816
  var http = __require("node:http");
14810
14817
  var onFinished = require_on_finished();
14811
14818
  var mime = require_mime_types();
14812
- var path14 = __require("node:path");
14819
+ var path15 = __require("node:path");
14813
14820
  var pathIsAbsolute = __require("node:path").isAbsolute;
14814
14821
  var statuses = require_statuses();
14815
14822
  var sign = require_cookie_signature().sign;
@@ -14818,8 +14825,8 @@ var require_response = __commonJS({
14818
14825
  var setCharset = require_utils2().setCharset;
14819
14826
  var cookie = require_cookie();
14820
14827
  var send = require_send();
14821
- var extname = path14.extname;
14822
- var resolve6 = path14.resolve;
14828
+ var extname = path15.extname;
14829
+ var resolve6 = path15.resolve;
14823
14830
  var vary = require_vary();
14824
14831
  var { Buffer: Buffer2 } = __require("node:buffer");
14825
14832
  var res = Object.create(http.ServerResponse.prototype);
@@ -14965,26 +14972,26 @@ var require_response = __commonJS({
14965
14972
  this.type("txt");
14966
14973
  return this.send(body);
14967
14974
  }, "sendStatus");
14968
- res.sendFile = /* @__PURE__ */ __name(function sendFile(path15, options, callback) {
14975
+ res.sendFile = /* @__PURE__ */ __name(function sendFile(path16, options, callback) {
14969
14976
  var done = callback;
14970
14977
  var req = this.req;
14971
14978
  var res2 = this;
14972
14979
  var next = req.next;
14973
14980
  var opts = options || {};
14974
- if (!path15) {
14981
+ if (!path16) {
14975
14982
  throw new TypeError("path argument is required to res.sendFile");
14976
14983
  }
14977
- if (typeof path15 !== "string") {
14984
+ if (typeof path16 !== "string") {
14978
14985
  throw new TypeError("path must be a string to res.sendFile");
14979
14986
  }
14980
14987
  if (typeof options === "function") {
14981
14988
  done = options;
14982
14989
  opts = {};
14983
14990
  }
14984
- if (!opts.root && !pathIsAbsolute(path15)) {
14991
+ if (!opts.root && !pathIsAbsolute(path16)) {
14985
14992
  throw new TypeError("path must be absolute or specify root to res.sendFile");
14986
14993
  }
14987
- var pathname = encodeURI(path15);
14994
+ var pathname = encodeURI(path16);
14988
14995
  opts.etag = this.app.enabled("etag");
14989
14996
  var file = send(req, pathname, opts);
14990
14997
  sendfile(res2, file, opts, function(err) {
@@ -14995,7 +15002,7 @@ var require_response = __commonJS({
14995
15002
  }
14996
15003
  });
14997
15004
  }, "sendFile");
14998
- res.download = /* @__PURE__ */ __name(function download(path15, filename, options, callback) {
15005
+ res.download = /* @__PURE__ */ __name(function download(path16, filename, options, callback) {
14999
15006
  var done = callback;
15000
15007
  var name = filename;
15001
15008
  var opts = options || null;
@@ -15012,7 +15019,7 @@ var require_response = __commonJS({
15012
15019
  opts = filename;
15013
15020
  }
15014
15021
  var headers = {
15015
- "Content-Disposition": contentDisposition(name || path15)
15022
+ "Content-Disposition": contentDisposition(name || path16)
15016
15023
  };
15017
15024
  if (opts && opts.headers) {
15018
15025
  var keys = Object.keys(opts.headers);
@@ -15025,7 +15032,7 @@ var require_response = __commonJS({
15025
15032
  }
15026
15033
  opts = Object.create(opts);
15027
15034
  opts.headers = headers;
15028
- var fullPath = !opts.root ? resolve6(path15) : path15;
15035
+ var fullPath = !opts.root ? resolve6(path16) : path16;
15029
15036
  return this.sendFile(fullPath, opts, done);
15030
15037
  }, "download");
15031
15038
  res.contentType = res.type = /* @__PURE__ */ __name(function contentType(type) {
@@ -15318,11 +15325,11 @@ var require_serve_static = __commonJS({
15318
15325
  }
15319
15326
  var forwardError = !fallthrough;
15320
15327
  var originalUrl = parseUrl.original(req);
15321
- var path14 = parseUrl(req).pathname;
15322
- if (path14 === "/" && originalUrl.pathname.substr(-1) !== "/") {
15323
- path14 = "";
15328
+ var path15 = parseUrl(req).pathname;
15329
+ if (path15 === "/" && originalUrl.pathname.substr(-1) !== "/") {
15330
+ path15 = "";
15324
15331
  }
15325
- var stream = send(req, path14, opts);
15332
+ var stream = send(req, path15, opts);
15326
15333
  stream.on("directory", onDirectory);
15327
15334
  if (setHeaders) {
15328
15335
  stream.on("headers", setHeaders);
@@ -15442,10 +15449,10 @@ init_esbuild_shims();
15442
15449
 
15443
15450
  // packages/cli/src/serve/server.ts
15444
15451
  init_esbuild_shims();
15445
- var import_express = __toESM(require_express2(), 1);
15452
+ var import_express2 = __toESM(require_express2(), 1);
15446
15453
  import * as crypto from "node:crypto";
15447
15454
  import * as net from "node:net";
15448
- import * as path12 from "node:path";
15455
+ import * as path13 from "node:path";
15449
15456
 
15450
15457
  // packages/cli/src/serve/auth.ts
15451
15458
  init_esbuild_shims();
@@ -17267,7 +17274,8 @@ __name(createSpawnChannelFactory, "createSpawnChannelFactory");
17267
17274
  var defaultSpawnChannelFactory = createSpawnChannelFactory();
17268
17275
  var KILL_HARD_DEADLINE_MS = 1e4;
17269
17276
  var SCRUBBED_CHILD_ENV_KEYS = /* @__PURE__ */ new Set([
17270
- "QWEN_SERVER_TOKEN"
17277
+ "QWEN_SERVER_TOKEN",
17278
+ "QWEN_CODE_SIMPLE"
17271
17279
  ]);
17272
17280
  function scrubChildEnv(source, scrubbed, overrides) {
17273
17281
  const childEnv = { ...source };
@@ -17334,6 +17342,10 @@ import { randomUUID as randomUUID2 } from "node:crypto";
17334
17342
  import { promises as fs } from "node:fs";
17335
17343
  import * as path from "node:path";
17336
17344
 
17345
+ // packages/acp-bridge/src/daemonEventTypes.ts
17346
+ init_esbuild_shims();
17347
+ var MID_TURN_MESSAGE_INJECTED_EVENT = "mid_turn_message_injected";
17348
+
17337
17349
  // packages/acp-bridge/src/internal/stderrLine.ts
17338
17350
  init_esbuild_shims();
17339
17351
  function writeStderrLine2(message) {
@@ -17407,7 +17419,6 @@ function sliceLineRange(content, startLine, endLine) {
17407
17419
  return content.slice(offset, end > offset ? end - 1 : end);
17408
17420
  }
17409
17421
  __name(sliceLineRange, "sliceLineRange");
17410
- var MID_TURN_MESSAGE_INJECTED_EVENT = "mid_turn_message_injected";
17411
17422
  var BridgeClient = class {
17412
17423
  constructor(resolveEntry, resolvePendingRestoreEvents, mediator, permissionTimeoutMs, maxPendingPerSession, fileSystem, onModelPromoted, onModePromoted) {
17413
17424
  this.resolveEntry = resolveEntry;
@@ -18628,7 +18639,14 @@ function createAcpSessionBridge(opts) {
18628
18639
  );
18629
18640
  }
18630
18641
  const permissionTimeoutRaw = opts.permissionResponseTimeoutMs ?? DEFAULT_PERMISSION_TIMEOUT_MS;
18631
- const permissionTimeoutMs = permissionTimeoutRaw > 0 && Number.isFinite(permissionTimeoutRaw) ? permissionTimeoutRaw : 0;
18642
+ const permissionTimeoutMs = permissionTimeoutRaw > 0 && Number.isFinite(permissionTimeoutRaw) ? (
18643
+ // Clamp to 2^31-1: Node treats setTimeout delays larger than
18644
+ // this as 1ms (TimeoutOverflowWarning), which would make a
18645
+ // huge "effectively never" timeout cancel prompts almost
18646
+ // immediately — the opposite of intent. Mirrors the sibling
18647
+ // `resolvePositiveFiniteMs` / `resolvedChannelIdleTimeoutMs`.
18648
+ Math.min(permissionTimeoutRaw, 2147483647)
18649
+ ) : 0;
18632
18650
  const maxPendingRaw = opts.maxPendingPermissionsPerSession ?? DEFAULT_MAX_PENDING_PER_SESSION;
18633
18651
  const maxPendingPerSession = maxPendingRaw > 0 && Number.isFinite(maxPendingRaw) ? maxPendingRaw : Infinity;
18634
18652
  const maxPendingPromptsRaw = opts.maxPendingPromptsPerSession ?? DEFAULT_MAX_PENDING_PROMPTS_PER_SESSION;
@@ -18662,6 +18680,12 @@ function createAcpSessionBridge(opts) {
18662
18680
  DEFAULT_SESSION_IDLE_TIMEOUT_MS
18663
18681
  );
18664
18682
  let sessionReaper;
18683
+ let lastActivityTimestamp = null;
18684
+ let activePromptCounter = 0;
18685
+ function touchActivity() {
18686
+ lastActivityTimestamp = Date.now();
18687
+ }
18688
+ __name(touchActivity, "touchActivity");
18665
18689
  function resolvePositiveFiniteMs(raw, fallback) {
18666
18690
  if (raw === void 0) return fallback;
18667
18691
  return raw > 0 && Number.isFinite(raw) ? Math.min(raw, 2147483647) : 0;
@@ -18924,6 +18948,11 @@ function createAcpSessionBridge(opts) {
18924
18948
  });
18925
18949
  } catch {
18926
18950
  }
18951
+ if (sessEntry.promptActive) {
18952
+ sessEntry.promptActive = false;
18953
+ activePromptCounter--;
18954
+ touchActivity();
18955
+ }
18927
18956
  byId.delete(sid);
18928
18957
  telemetry.metrics?.sessionLifecycle("die");
18929
18958
  info.client.markSessionClosed(sid);
@@ -19121,6 +19150,12 @@ function createAcpSessionBridge(opts) {
19121
19150
  }
19122
19151
  return void 0;
19123
19152
  }, "channelInfoForEntry");
19153
+ const assertLivePromptEntry = /* @__PURE__ */ __name((sessionId, entry) => {
19154
+ const info = channelInfoForEntry(entry);
19155
+ if (byId.get(sessionId) !== entry || !info || info.isDying) {
19156
+ throw new SessionNotFoundError(sessionId);
19157
+ }
19158
+ }, "assertLivePromptEntry");
19124
19159
  const getChannelClosedReject = /* @__PURE__ */ __name((info) => {
19125
19160
  if (!info.statusClosedReject) {
19126
19161
  info.statusClosedReject = info.channel.exited.then(() => {
@@ -19321,6 +19356,7 @@ function createAcpSessionBridge(opts) {
19321
19356
  };
19322
19357
  ci.sessionIds.add(entry.sessionId);
19323
19358
  byId.set(entry.sessionId, entry);
19359
+ touchActivity();
19324
19360
  telemetry.metrics?.sessionLifecycle("spawn");
19325
19361
  ci.client.drainEarlyEvents(entry.sessionId, entry);
19326
19362
  return entry;
@@ -19571,6 +19607,11 @@ function createAcpSessionBridge(opts) {
19571
19607
  }
19572
19608
  permissionMediator.forgetSession(sessionId);
19573
19609
  entry.pendingPermissionIds.clear();
19610
+ if (entry.promptActive) {
19611
+ entry.promptActive = false;
19612
+ activePromptCounter--;
19613
+ touchActivity();
19614
+ }
19574
19615
  byId.delete(sessionId);
19575
19616
  telemetry.metrics?.sessionLifecycle("close");
19576
19617
  ci?.client.markSessionClosed(sessionId);
@@ -19644,6 +19685,15 @@ function createAcpSessionBridge(opts) {
19644
19685
  get sessionCount() {
19645
19686
  return byId.size;
19646
19687
  },
19688
+ get activePromptCount() {
19689
+ return activePromptCounter;
19690
+ },
19691
+ get lastActivityAt() {
19692
+ return lastActivityTimestamp;
19693
+ },
19694
+ get idleSinceMs() {
19695
+ return lastActivityTimestamp !== null ? Date.now() - lastActivityTimestamp : null;
19696
+ },
19647
19697
  isChannelLive() {
19648
19698
  return !!liveChannelInfo();
19649
19699
  },
@@ -19784,6 +19834,7 @@ function createAcpSessionBridge(opts) {
19784
19834
  if (signal?.aborted) {
19785
19835
  throw new DOMException("Prompt aborted", "AbortError");
19786
19836
  }
19837
+ assertLivePromptEntry(sessionId, entry);
19787
19838
  const requestedRetry = req.retry === true;
19788
19839
  const isRetry = requestedRetry && entry.retryAllowed;
19789
19840
  entry.retryAllowed = false;
@@ -19805,7 +19856,9 @@ function createAcpSessionBridge(opts) {
19805
19856
  return copy;
19806
19857
  })();
19807
19858
  entry.promptActive = true;
19859
+ activePromptCounter++;
19808
19860
  entry.sessionLastSeenAt = Date.now();
19861
+ touchActivity();
19809
19862
  if (originatorClientId === void 0) {
19810
19863
  delete entry.activePromptOriginatorClientId;
19811
19864
  } else {
@@ -19821,13 +19874,21 @@ function createAcpSessionBridge(opts) {
19821
19874
  );
19822
19875
  }
19823
19876
  } catch (echoErr) {
19824
- entry.promptActive = false;
19825
19877
  delete entry.activePromptOriginatorClientId;
19878
+ if (entry.promptActive) {
19879
+ entry.promptActive = false;
19880
+ activePromptCounter--;
19881
+ touchActivity();
19882
+ }
19826
19883
  throw echoErr;
19827
19884
  }
19828
19885
  const promptPromise = entry.connection.prompt(promptRequest).finally(() => {
19829
- entry.promptActive = false;
19830
- entry.sessionLastSeenAt = Date.now();
19886
+ if (entry.promptActive) {
19887
+ entry.promptActive = false;
19888
+ activePromptCounter--;
19889
+ entry.sessionLastSeenAt = Date.now();
19890
+ touchActivity();
19891
+ }
19831
19892
  delete entry.activePromptOriginatorClientId;
19832
19893
  if (entry.clientIds.size === 0 && entry.events.subscriberCount === 0 && byId.has(sessionId)) {
19833
19894
  void closeSessionImpl(sessionId, void 0, {
@@ -20090,11 +20151,13 @@ function createAcpSessionBridge(opts) {
20090
20151
  initTimeoutMs,
20091
20152
  "branchSession"
20092
20153
  );
20093
- if (!result || typeof result.newSessionId !== "string" || typeof result.title !== "string") {
20154
+ if (!result || typeof result.newSessionId !== "string") {
20094
20155
  throw new Error(
20095
20156
  `branchSession: agent returned invalid response: ${JSON.stringify(result)}`
20096
20157
  );
20097
20158
  }
20159
+ const rawBranchName = result.displayName ?? result.title;
20160
+ const branchDisplayName = typeof rawBranchName === "string" ? rawBranchName : result.newSessionId.slice(0, 8);
20098
20161
  let restored;
20099
20162
  try {
20100
20163
  restored = await restoreSession("resume", {
@@ -20119,11 +20182,11 @@ function createAcpSessionBridge(opts) {
20119
20182
  throw restoreErr;
20120
20183
  }
20121
20184
  const newEntry = byId.get(result.newSessionId);
20122
- if (newEntry) newEntry.displayName = result.title;
20185
+ if (newEntry) newEntry.displayName = branchDisplayName;
20123
20186
  const eventData = {
20124
20187
  sourceSessionId: sessionId,
20125
20188
  newSessionId: result.newSessionId,
20126
- displayName: result.title
20189
+ displayName: branchDisplayName
20127
20190
  };
20128
20191
  const branchEnvelope = {
20129
20192
  type: "session_branched",
@@ -20134,10 +20197,10 @@ function createAcpSessionBridge(opts) {
20134
20197
  broadcastWorkspaceEvent(branchEnvelope, sessionId);
20135
20198
  return {
20136
20199
  ...restored,
20137
- title: result.title,
20200
+ displayName: branchDisplayName,
20138
20201
  forkedFrom: {
20139
20202
  sessionId,
20140
- title: entry.displayName ?? sessionId.slice(0, 8)
20203
+ displayName: entry.displayName ?? sessionId.slice(0, 8)
20141
20204
  }
20142
20205
  };
20143
20206
  });
@@ -20173,6 +20236,24 @@ function createAcpSessionBridge(opts) {
20173
20236
  writeStderrLine2(
20174
20237
  `qwen serve: updated session metadata ${JSON.stringify(sessionId)} displayName=${entry.displayName === void 0 ? "cleared" : "set"}` + (context?.clientId ? ` by client ${JSON.stringify(context.clientId)}` : "")
20175
20238
  );
20239
+ if (nextDisplayName) {
20240
+ entry.connection.extMethod(SERVE_CONTROL_EXT_METHODS.sessionTitle, {
20241
+ sessionId,
20242
+ displayName: nextDisplayName,
20243
+ titleSource: "manual"
20244
+ }).then((res) => {
20245
+ const r = res;
20246
+ if (r && r.persisted === false) {
20247
+ writeStderrLine2(
20248
+ `qwen serve: displayName for ${sessionId} was not persisted (recording service unavailable)`
20249
+ );
20250
+ }
20251
+ }).catch((err) => {
20252
+ writeStderrLine2(
20253
+ `qwen serve: failed to persist displayName for ${sessionId}: ${err instanceof Error ? err.message : String(err)}`
20254
+ );
20255
+ });
20256
+ }
20176
20257
  try {
20177
20258
  entry.events.publish({
20178
20259
  type: "session_metadata_updated",
@@ -20384,6 +20465,54 @@ function createAcpSessionBridge(opts) {
20384
20465
  () => createIdleWorkspaceExtensionsStatus(boundWorkspace)
20385
20466
  );
20386
20467
  },
20468
+ async refreshExtensionsForAllSessions(data) {
20469
+ const sessions = Array.from(byId.values());
20470
+ const results = await Promise.all(
20471
+ sessions.map(async (entry) => {
20472
+ const info = channelInfoForEntry(entry);
20473
+ if (!info || info.isDying) {
20474
+ return { refreshed: 0, failed: 0 };
20475
+ }
20476
+ try {
20477
+ await Promise.race([
20478
+ withTimeout(
20479
+ entry.connection.extMethod(
20480
+ SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh,
20481
+ { sessionId: entry.sessionId }
20482
+ ),
20483
+ 3e4,
20484
+ SERVE_CONTROL_EXT_METHODS.workspaceExtensionsRefresh
20485
+ ),
20486
+ getTransportClosedReject(entry)
20487
+ ]);
20488
+ return { refreshed: 1, failed: 0 };
20489
+ } catch (err) {
20490
+ writeServeDebugLine(
20491
+ `refreshExtensions: session ${entry.sessionId} failed: ${err instanceof Error ? err.message : String(err)}`
20492
+ );
20493
+ return { refreshed: 0, failed: 1 };
20494
+ }
20495
+ })
20496
+ );
20497
+ const refreshed = results.reduce(
20498
+ (sum, result) => sum + result.refreshed,
20499
+ 0
20500
+ );
20501
+ const failed = results.reduce((sum, result) => sum + result.failed, 0);
20502
+ if (refreshed > 0 || failed > 0 || data?.status !== void 0) {
20503
+ broadcastWorkspaceEvent({
20504
+ type: "extensions_changed",
20505
+ data: { ...data, refreshed, failed }
20506
+ });
20507
+ }
20508
+ return { refreshed, failed };
20509
+ },
20510
+ broadcastExtensionsChanged(data) {
20511
+ broadcastWorkspaceEvent({
20512
+ type: "extensions_changed",
20513
+ data
20514
+ });
20515
+ },
20387
20516
  async setSessionModel(sessionId, req, context) {
20388
20517
  const entry = byId.get(sessionId);
20389
20518
  if (!entry) throw new SessionNotFoundError(sessionId);
@@ -20993,6 +21122,11 @@ function createAcpSessionBridge(opts) {
20993
21122
  }
20994
21123
  permissionMediator.forgetSession(sessionId);
20995
21124
  entry.pendingPermissionIds.clear();
21125
+ if (entry.promptActive) {
21126
+ entry.promptActive = false;
21127
+ activePromptCounter--;
21128
+ touchActivity();
21129
+ }
20996
21130
  if (defaultEntry === entry) defaultEntry = void 0;
20997
21131
  byId.delete(sessionId);
20998
21132
  telemetry.metrics?.sessionLifecycle("die");
@@ -23243,11 +23377,21 @@ var CONN_ROUTED_METHODS = /* @__PURE__ */ new Set([
23243
23377
  ...ALL_QWEN_VENDOR_METHODS
23244
23378
  ]);
23245
23379
  var MAX_NAME_LENGTH = 256;
23380
+ var DEFAULT_FILE_GLOB_MAX_RESULTS = 5e3;
23381
+ var MAX_FILE_GLOB_MAX_RESULTS = 5e4;
23246
23382
  var AcpParamError = class extends Error {
23247
23383
  static {
23248
23384
  __name(this, "AcpParamError");
23249
23385
  }
23250
23386
  };
23387
+ function parseOptionalPositiveInteger(value, fallback, max) {
23388
+ if (value === void 0) return fallback;
23389
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1 || value > max) {
23390
+ return null;
23391
+ }
23392
+ return value;
23393
+ }
23394
+ __name(parseOptionalPositiveInteger, "parseOptionalPositiveInteger");
23251
23395
  function parseOptionalWorkspaceCwd(params, boundWorkspace) {
23252
23396
  if (!("cwd" in params) || params["cwd"] === void 0) return boundWorkspace;
23253
23397
  const cwd = params["cwd"];
@@ -23728,7 +23872,7 @@ var AcpDispatcher = class {
23728
23872
  sessions: result.sessions.map((s) => ({
23729
23873
  sessionId: s.sessionId,
23730
23874
  cwd: s.workspaceCwd,
23731
- title: s.title,
23875
+ title: s.displayName,
23732
23876
  updatedAt: s.updatedAt
23733
23877
  })),
23734
23878
  ...result.nextCursor != null ? { nextCursor: result.nextCursor } : {}
@@ -24447,11 +24591,22 @@ var AcpDispatcher = class {
24447
24591
  originatorClientId: conn.clientId,
24448
24592
  route: `ACP ${method}`
24449
24593
  });
24450
- const MAX_GLOB = 5e3;
24451
- const maxResults = typeof params["maxResults"] === "number" ? Math.max(
24452
- 1,
24453
- Math.min(Number(params["maxResults"]) || 5e3, 5e4)
24454
- ) : MAX_GLOB;
24594
+ const maxResults = parseOptionalPositiveInteger(
24595
+ params["maxResults"],
24596
+ DEFAULT_FILE_GLOB_MAX_RESULTS,
24597
+ MAX_FILE_GLOB_MAX_RESULTS
24598
+ );
24599
+ if (maxResults === null) {
24600
+ if (id !== void 0)
24601
+ conn.sendConn(
24602
+ error(
24603
+ id,
24604
+ RPC.INVALID_PARAMS,
24605
+ "`maxResults` must be an integer between 1 and 50000"
24606
+ )
24607
+ );
24608
+ return;
24609
+ }
24455
24610
  const matches = await fs7.glob(pattern, {
24456
24611
  maxResults: maxResults + 1
24457
24612
  });
@@ -25828,7 +25983,7 @@ var WS_READ_METHODS = /* @__PURE__ */ new Set([
25828
25983
  function mountAcpHttp(app, bridge, opts) {
25829
25984
  const enabled = opts.enabled ?? process.env["QWEN_SERVE_ACP_HTTP"] !== "0";
25830
25985
  if (!enabled) return void 0;
25831
- const path14 = opts.path ?? "/acp";
25986
+ const path15 = opts.path ?? "/acp";
25832
25987
  const dispatcher = new AcpDispatcher(
25833
25988
  bridge,
25834
25989
  opts.boundWorkspace,
@@ -25850,7 +26005,7 @@ function mountAcpHttp(app, bridge, opts) {
25850
26005
  },
25851
26006
  opts.maxConnections
25852
26007
  );
25853
- app.post(path14, async (req, res) => {
26008
+ app.post(path15, async (req, res) => {
25854
26009
  const ct = req.headers["content-type"];
25855
26010
  if (!ct || !ct.startsWith("application/json")) {
25856
26011
  res.status(415).json({ error: "Content-Type must be application/json" });
@@ -25954,7 +26109,7 @@ function mountAcpHttp(app, bridge, opts) {
25954
26109
  );
25955
26110
  });
25956
26111
  });
25957
- app.get(path14, (req, res) => {
26112
+ app.get(path15, (req, res) => {
25958
26113
  const accept = req.headers["accept"] ?? "";
25959
26114
  if (!accept.includes("text/event-stream")) {
25960
26115
  res.status(406).json({ error: "Accept header must include text/event-stream" });
@@ -26030,7 +26185,7 @@ function mountAcpHttp(app, bridge, opts) {
26030
26185
  }
26031
26186
  );
26032
26187
  });
26033
- app.delete(path14, (req, res) => {
26188
+ app.delete(path15, (req, res) => {
26034
26189
  const connectionId = headerOf(req, ACP_CONNECTION_HEADER);
26035
26190
  if (!connectionId) {
26036
26191
  res.status(400).json({ error: "Missing Acp-Connection-Id" });
@@ -26063,7 +26218,7 @@ function mountAcpHttp(app, bridge, opts) {
26063
26218
  socket.destroy();
26064
26219
  return;
26065
26220
  }
26066
- if (url.pathname !== path14) {
26221
+ if (url.pathname !== path15) {
26067
26222
  socket.destroy();
26068
26223
  return;
26069
26224
  }
@@ -26298,7 +26453,7 @@ function mountAcpHttp(app, bridge, opts) {
26298
26453
  });
26299
26454
  }, "upgradeListener");
26300
26455
  httpServer.on("upgrade", upgradeListener);
26301
- writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path14}`);
26456
+ writeStderrLine(`qwen serve: /acp WebSocket transport enabled on ${path15}`);
26302
26457
  }
26303
26458
  __name(setupWebSocket, "setupWebSocket");
26304
26459
  return {
@@ -27678,16 +27833,116 @@ function getDemoHtml(_port) {
27678
27833
  }
27679
27834
  __name(getDemoHtml, "getDemoHtml");
27680
27835
 
27836
+ // packages/cli/src/serve/webShellStatic.ts
27837
+ init_esbuild_shims();
27838
+ var import_express = __toESM(require_express2(), 1);
27839
+ import { existsSync } from "node:fs";
27840
+ import * as path6 from "node:path";
27841
+ import { fileURLToPath } from "node:url";
27842
+ var WEB_SHELL_CSP = [
27843
+ "default-src 'self'",
27844
+ "script-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval'",
27845
+ "style-src 'self' 'unsafe-inline'",
27846
+ "font-src 'self' data:",
27847
+ "img-src 'self' data: blob:",
27848
+ "connect-src 'self'",
27849
+ "worker-src 'self' blob:",
27850
+ // base-uri does NOT fall back to default-src; lock it so an injected <base>
27851
+ // (the SPA renders AI-generated markdown) cannot repoint relative URLs to an
27852
+ // attacker origin.
27853
+ "base-uri 'none'",
27854
+ "frame-ancestors 'none'"
27855
+ ].join("; ");
27856
+ function resolveWebShellDir() {
27857
+ const selfDir = path6.dirname(fileURLToPath(import.meta.url));
27858
+ const hasShell = /* @__PURE__ */ __name((dir2) => existsSync(path6.join(dir2, "index.html")) && existsSync(path6.join(dir2, "assets")), "hasShell");
27859
+ const bundled = path6.join(resolveBundleDir(import.meta.url), "web-shell");
27860
+ if (hasShell(bundled)) return bundled;
27861
+ let dir = selfDir;
27862
+ for (let i = 0; i < 10; i++) {
27863
+ const candidate = path6.join(dir, "packages", "web-shell", "dist");
27864
+ if (hasShell(candidate)) return candidate;
27865
+ const parent = path6.dirname(dir);
27866
+ if (parent === dir) break;
27867
+ dir = parent;
27868
+ }
27869
+ return void 0;
27870
+ }
27871
+ __name(resolveWebShellDir, "resolveWebShellDir");
27872
+ function isDocumentNavigation(req) {
27873
+ const fetchMode = req.headers["sec-fetch-mode"];
27874
+ const fetchDest = req.headers["sec-fetch-dest"];
27875
+ const accept = req.headers.accept ?? "";
27876
+ return fetchMode === "navigate" || fetchDest === "document" || accept.trim().toLowerCase().startsWith("text/html");
27877
+ }
27878
+ __name(isDocumentNavigation, "isDocumentNavigation");
27879
+ function createSendIndex(webShellDir) {
27880
+ const indexPath = path6.join(webShellDir, "index.html");
27881
+ return (res) => {
27882
+ res.status(200).set("Content-Security-Policy", WEB_SHELL_CSP).set("X-Frame-Options", "DENY").set("X-Content-Type-Options", "nosniff").set("Referrer-Policy", "no-referrer").set(
27883
+ "Permissions-Policy",
27884
+ "camera=(), microphone=(), geolocation=(), payment=()"
27885
+ ).set("Cache-Control", "no-cache");
27886
+ res.sendFile(indexPath, { cacheControl: false }, (err) => {
27887
+ if (!err) return;
27888
+ writeStderrLine(
27889
+ `qwen serve: Web Shell index send failed: ${err instanceof Error ? err.message : String(err)}`
27890
+ );
27891
+ if (!res.headersSent) {
27892
+ res.status(500).type("text/plain").send("Failed to load Web Shell");
27893
+ } else {
27894
+ res.end();
27895
+ }
27896
+ });
27897
+ };
27898
+ }
27899
+ __name(createSendIndex, "createSendIndex");
27900
+ function mountWebShellAssets(app, webShellDir) {
27901
+ const sendIndex = createSendIndex(webShellDir);
27902
+ app.use(
27903
+ "/assets",
27904
+ import_express.default.static(path6.join(webShellDir, "assets"), {
27905
+ index: false,
27906
+ immutable: true,
27907
+ maxAge: "1y"
27908
+ })
27909
+ );
27910
+ app.use("/assets", (req, res) => {
27911
+ if (isServeDebugMode()) {
27912
+ writeStderrLine(
27913
+ `qwen serve: Web Shell asset not found: ${req.originalUrl}`
27914
+ );
27915
+ }
27916
+ res.status(404).type("text/plain").send("Not found");
27917
+ });
27918
+ app.get("/", (_req, res) => sendIndex(res));
27919
+ }
27920
+ __name(mountWebShellAssets, "mountWebShellAssets");
27921
+ function mountWebShellSpaFallback(app, webShellDir) {
27922
+ const sendIndex = createSendIndex(webShellDir);
27923
+ app.use((req, res, next) => {
27924
+ if (req.method !== "GET" && req.method !== "HEAD") return next();
27925
+ if (!isDocumentNavigation(req)) return next();
27926
+ if (isServeDebugMode()) {
27927
+ writeStderrLine(
27928
+ `qwen serve: Web Shell SPA fallback served for ${req.method} ${req.originalUrl}`
27929
+ );
27930
+ }
27931
+ sendIndex(res);
27932
+ });
27933
+ }
27934
+ __name(mountWebShellSpaFallback, "mountWebShellSpaFallback");
27935
+
27681
27936
  // packages/cli/src/serve/fs/index.ts
27682
27937
  init_esbuild_shims();
27683
27938
 
27684
27939
  // packages/cli/src/serve/fs/policy.ts
27685
27940
  init_esbuild_shims();
27686
- import * as path6 from "node:path";
27941
+ import * as path7 from "node:path";
27687
27942
  var MAX_READ_BYTES = 256 * 1024;
27688
27943
  var MAX_WRITE_BYTES = 5 * 1024 * 1024;
27689
27944
  function shouldIgnore(absolute, boundWorkspace, ignore, kind = "file") {
27690
- const rel = path6.relative(boundWorkspace, absolute);
27945
+ const rel = path7.relative(boundWorkspace, absolute);
27691
27946
  if (rel === "" || rel.startsWith("..")) return { ignored: false };
27692
27947
  const fileFilter = ignore.getFileFilter();
27693
27948
  const dirFilter = ignore.getDirectoryFilter();
@@ -27759,7 +28014,7 @@ __name(detectBinary, "detectBinary");
27759
28014
  // packages/cli/src/serve/fs/audit.ts
27760
28015
  init_esbuild_shims();
27761
28016
  import { createHash as createHash3 } from "node:crypto";
27762
- import * as path7 from "node:path";
28017
+ import * as path8 from "node:path";
27763
28018
  var FS_ACCESS_EVENT_TYPE = "fs.access";
27764
28019
  var FS_DENIED_EVENT_TYPE = "fs.denied";
27765
28020
  function hashPath(absolute) {
@@ -27768,8 +28023,8 @@ function hashPath(absolute) {
27768
28023
  __name(hashPath, "hashPath");
27769
28024
  var CROSS_DRIVE_RELPATH = "<cross-drive>";
27770
28025
  function relForAudit(raw, boundWorkspace) {
27771
- const rel = path7.isAbsolute(raw) ? path7.relative(boundWorkspace, raw) : raw;
27772
- return path7.isAbsolute(rel) ? CROSS_DRIVE_RELPATH : rel;
28026
+ const rel = path8.isAbsolute(raw) ? path8.relative(boundWorkspace, raw) : raw;
28027
+ return path8.isAbsolute(rel) ? CROSS_DRIVE_RELPATH : rel;
27773
28028
  }
27774
28029
  __name(relForAudit, "relForAudit");
27775
28030
  function rawPathsEnabled() {
@@ -27807,7 +28062,7 @@ function createAuditPublisher(deps) {
27807
28062
  });
27808
28063
  },
27809
28064
  recordDenied(ctx, record) {
27810
- const probe = path7.isAbsolute(record.input) ? record.input : path7.resolve(boundWorkspace, record.input);
28065
+ const probe = path8.isAbsolute(record.input) ? record.input : path8.resolve(boundWorkspace, record.input);
27811
28066
  const payload = {
27812
28067
  kind: FS_DENIED_EVENT_TYPE,
27813
28068
  intent: record.intent,
@@ -27841,7 +28096,7 @@ __name(createAuditPublisher, "createAuditPublisher");
27841
28096
  init_esbuild_shims();
27842
28097
  import { createHash as createHash4, randomBytes } from "node:crypto";
27843
28098
  import { promises as fsp2 } from "node:fs";
27844
- import * as path8 from "node:path";
28099
+ import * as path9 from "node:path";
27845
28100
  function createWorkspaceFileSystemFactory(deps) {
27846
28101
  const boundWorkspace = canonicalizeWorkspace(deps.boundWorkspace);
27847
28102
  const ignore = deps.ignore ?? loadIgnoreRules({
@@ -28022,7 +28277,7 @@ var WorkspaceFileSystemImpl = class {
28022
28277
  const entries = [];
28023
28278
  const dir = await fsp2.opendir(p);
28024
28279
  for await (const d of dir) {
28025
- const childAbs = path8.join(p, d.name);
28280
+ const childAbs = path9.join(p, d.name);
28026
28281
  const kind = kindFromStatLike(d);
28027
28282
  const verdict = shouldIgnore(
28028
28283
  childAbs,
@@ -28058,7 +28313,7 @@ var WorkspaceFileSystemImpl = class {
28058
28313
  `glob pattern may not contain '..' segments: ${pattern}`
28059
28314
  );
28060
28315
  }
28061
- if (path8.isAbsolute(pattern) || /^[A-Za-z]:[\\/]/.test(pattern) || pattern.startsWith("\\\\") || pattern.startsWith("//")) {
28316
+ if (path9.isAbsolute(pattern) || /^[A-Za-z]:[\\/]/.test(pattern) || pattern.startsWith("\\\\") || pattern.startsWith("//")) {
28062
28317
  throw new FsError(
28063
28318
  "parse_error",
28064
28319
  `glob pattern must be workspace-relative: ${pattern}`,
@@ -28071,7 +28326,7 @@ var WorkspaceFileSystemImpl = class {
28071
28326
  cwdReal = cwd;
28072
28327
  } else {
28073
28328
  try {
28074
- cwdReal = await fsp2.realpath(path8.resolve(cwd));
28329
+ cwdReal = await fsp2.realpath(path9.resolve(cwd));
28075
28330
  } catch (err) {
28076
28331
  const code = err?.code;
28077
28332
  if (code === "ENOENT") {
@@ -28105,7 +28360,7 @@ var WorkspaceFileSystemImpl = class {
28105
28360
  let transientErrorCount = 0;
28106
28361
  for (const hit of matches) {
28107
28362
  if (out.length >= max) break;
28108
- const absolute = path8.resolve(hit);
28363
+ const absolute = path9.resolve(hit);
28109
28364
  let canonical;
28110
28365
  try {
28111
28366
  canonical = await fsp2.realpath(absolute);
@@ -28120,8 +28375,8 @@ var WorkspaceFileSystemImpl = class {
28120
28375
  }
28121
28376
  continue;
28122
28377
  }
28123
- const rel = path8.relative(this.deps.boundWorkspace, canonical);
28124
- if (rel.startsWith("..") || path8.isAbsolute(rel)) {
28378
+ const rel = path9.relative(this.deps.boundWorkspace, canonical);
28379
+ if (rel.startsWith("..") || path9.isAbsolute(rel)) {
28125
28380
  escapedCount += 1;
28126
28381
  continue;
28127
28382
  }
@@ -28727,7 +28982,7 @@ function mergeWriteMeta(existing, opts) {
28727
28982
  __name(mergeWriteMeta, "mergeWriteMeta");
28728
28983
  async function atomicWriteTextResolvedFile(input) {
28729
28984
  const target = input.target;
28730
- const parent = path8.dirname(target);
28985
+ const parent = path9.dirname(target);
28731
28986
  const parentStat = await fsp2.lstat(parent);
28732
28987
  if (parentStat.isSymbolicLink()) {
28733
28988
  throw new FsError("symlink_escape", `parent path is a symlink: ${parent}`, {
@@ -28740,9 +28995,9 @@ async function atomicWriteTextResolvedFile(input) {
28740
28995
  `parent path is not a directory: ${parent}`
28741
28996
  );
28742
28997
  }
28743
- const tmpPath = path8.join(
28998
+ const tmpPath = path9.join(
28744
28999
  parent,
28745
- `.${path8.basename(target)}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`
29000
+ `.${path9.basename(target)}.${process.pid}.${randomBytes(6).toString("hex")}.tmp`
28746
29001
  );
28747
29002
  let tempLive = false;
28748
29003
  let tempHandle;
@@ -29110,7 +29365,7 @@ __name(buildWriteMeta, "buildWriteMeta");
29110
29365
 
29111
29366
  // packages/cli/src/serve/routes/workspaceFileRead.ts
29112
29367
  init_esbuild_shims();
29113
- import * as path9 from "node:path";
29368
+ import * as path10 from "node:path";
29114
29369
  var MAX_LIST_ENTRIES = 2e3;
29115
29370
  var MAX_FILE_LINE_LIMIT = 2e3;
29116
29371
  var DEFAULT_FILE_BYTES_MAX_BYTES = 64 * 1024;
@@ -29441,9 +29696,9 @@ function workspaceRelative(req, resolved) {
29441
29696
  if (!boundWorkspace) {
29442
29697
  throw new Error("bound workspace is not configured");
29443
29698
  }
29444
- const rel = path9.relative(boundWorkspace, resolved);
29699
+ const rel = path10.relative(boundWorkspace, resolved);
29445
29700
  if (rel === "") return ".";
29446
- return path9.sep === "/" ? rel : rel.split(path9.sep).join("/");
29701
+ return path10.sep === "/" ? rel : rel.split(path10.sep).join("/");
29447
29702
  }
29448
29703
  __name(workspaceRelative, "workspaceRelative");
29449
29704
  function registerWorkspaceFileReadRoutes(app, deps) {
@@ -29682,7 +29937,7 @@ __name(registerWorkspaceFileWriteRoutes, "registerWorkspaceFileWriteRoutes");
29682
29937
  // packages/cli/src/serve/workspace-service/index.ts
29683
29938
  init_esbuild_shims();
29684
29939
  import { promises as fs5, constants as fsConstants } from "node:fs";
29685
- import * as path10 from "node:path";
29940
+ import * as path11 from "node:path";
29686
29941
  async function canonicalizeExistingAncestor(inputPath) {
29687
29942
  let current = inputPath;
29688
29943
  while (true) {
@@ -29693,7 +29948,7 @@ async function canonicalizeExistingAncestor(inputPath) {
29693
29948
  if (code !== "ENOENT" && code !== "ENOTDIR" && code !== "ELOOP") {
29694
29949
  throw err;
29695
29950
  }
29696
- const parent = path10.dirname(current);
29951
+ const parent = path11.dirname(current);
29697
29952
  if (parent === current) throw err;
29698
29953
  current = parent;
29699
29954
  }
@@ -29702,9 +29957,9 @@ async function canonicalizeExistingAncestor(inputPath) {
29702
29957
  __name(canonicalizeExistingAncestor, "canonicalizeExistingAncestor");
29703
29958
  async function verifyParentPostOpen(target, wsCanonical, _fh) {
29704
29959
  const parentCanonical = await canonicalizeExistingAncestor(
29705
- path10.dirname(target)
29960
+ path11.dirname(target)
29706
29961
  );
29707
- const within = parentCanonical === wsCanonical || parentCanonical.startsWith(wsCanonical + path10.sep);
29962
+ const within = parentCanonical === wsCanonical || parentCanonical.startsWith(wsCanonical + path11.sep);
29708
29963
  if (within) return;
29709
29964
  throw new WorkspaceInitSymlinkError(
29710
29965
  target,
@@ -29722,6 +29977,7 @@ function createDaemonWorkspaceService(deps) {
29722
29977
  persistDisabledTools,
29723
29978
  queryWorkspaceStatus,
29724
29979
  invokeWorkspaceCommand,
29980
+ refreshExtensionsForAllSessions: refreshExtensionsForAllSessionsOnBridge,
29725
29981
  publishWorkspaceEvent
29726
29982
  } = deps;
29727
29983
  return {
@@ -29833,16 +30089,16 @@ function createDaemonWorkspaceService(deps) {
29833
30089
  },
29834
30090
  async initWorkspace(ctx, opts) {
29835
30091
  const filename = contextFilename;
29836
- const target = path10.resolve(boundWorkspace, filename);
29837
- const withinWorkspace = target === boundWorkspace || target.startsWith(boundWorkspace + path10.sep);
30092
+ const target = path11.resolve(boundWorkspace, filename);
30093
+ const withinWorkspace = target === boundWorkspace || target.startsWith(boundWorkspace + path11.sep);
29838
30094
  if (!withinWorkspace) {
29839
30095
  throw new WorkspaceInitPathEscapeError(filename, boundWorkspace);
29840
30096
  }
29841
30097
  const wsCanonical = await fs5.realpath(boundWorkspace);
29842
30098
  const parentCanonical = await canonicalizeExistingAncestor(
29843
- path10.dirname(target)
30099
+ path11.dirname(target)
29844
30100
  );
29845
- const parentWithinWorkspace = parentCanonical === wsCanonical || parentCanonical.startsWith(wsCanonical + path10.sep);
30101
+ const parentWithinWorkspace = parentCanonical === wsCanonical || parentCanonical.startsWith(wsCanonical + path11.sep);
29846
30102
  if (!parentWithinWorkspace) {
29847
30103
  throw new WorkspaceInitSymlinkError(
29848
30104
  target,
@@ -30094,6 +30350,19 @@ function createDaemonWorkspaceService(deps) {
30094
30350
  sessionsSkipped,
30095
30351
  childError
30096
30352
  };
30353
+ },
30354
+ async refreshExtensionsForAllSessions() {
30355
+ try {
30356
+ if (!refreshExtensionsForAllSessionsOnBridge) {
30357
+ throw new Error("refreshExtensionsForAllSessions is not wired");
30358
+ }
30359
+ return await refreshExtensionsForAllSessionsOnBridge();
30360
+ } catch (err) {
30361
+ writeStderrLine(
30362
+ `qwen serve: refreshExtensionsForAllSessions failed: ${err instanceof Error ? err.message : String(err)}`
30363
+ );
30364
+ return { refreshed: 0, failed: 1 };
30365
+ }
30097
30366
  }
30098
30367
  };
30099
30368
  }
@@ -30327,7 +30596,7 @@ __name(registerWorkspaceSettingsRoutes, "registerWorkspaceSettingsRoutes");
30327
30596
  // packages/cli/src/serve/routes/a2uiAction.ts
30328
30597
  init_esbuild_shims();
30329
30598
  import * as fsp3 from "node:fs/promises";
30330
- import * as path11 from "node:path";
30599
+ import * as path12 from "node:path";
30331
30600
  var A2UI_MIME = "application/a2ui+json";
30332
30601
  var ACTION_TOOL = "action";
30333
30602
  var CALL_TIMEOUT_MS = 15e3;
@@ -30338,7 +30607,7 @@ __name(usableServerConfig, "usableServerConfig");
30338
30607
  async function findFromSettingsFile(workspaceCwd) {
30339
30608
  try {
30340
30609
  const raw = await fsp3.readFile(
30341
- path11.join(workspaceCwd, ".qwen", "settings.json"),
30610
+ path12.join(workspaceCwd, ".qwen", "settings.json"),
30342
30611
  "utf8"
30343
30612
  );
30344
30613
  const settings = JSON.parse(raw);
@@ -30466,8 +30735,8 @@ init_esbuild_shims();
30466
30735
  var MAX_BUCKETS = 1e4;
30467
30736
  var GC_REQUEST_INTERVAL = 1e3;
30468
30737
  var GC_TIMER_INTERVAL_MS = 5 * 60 * 1e3;
30469
- function resolveTier(method, path14) {
30470
- const p = path14.endsWith("/") && path14.length > 1 ? path14.slice(0, -1) : path14;
30738
+ function resolveTier(method, path15) {
30739
+ const p = path15.endsWith("/") && path15.length > 1 ? path15.slice(0, -1) : path15;
30471
30740
  if (method === "OPTIONS") return null;
30472
30741
  if ((method === "GET" || method === "HEAD") && (p === "/health" || p === "/demo"))
30473
30742
  return null;
@@ -30734,10 +31003,9 @@ var InvalidCursorError = class extends Error {
30734
31003
  }
30735
31004
  };
30736
31005
  async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options) {
30737
- const pageSize = Math.min(
30738
- Math.max(options?.size ?? DEFAULT_SESSION_PAGE_SIZE, 1),
30739
- MAX_SESSION_PAGE_SIZE
30740
- );
31006
+ const rawSize = options?.size;
31007
+ const requestedSize = typeof rawSize === "number" && Number.isSafeInteger(rawSize) ? rawSize : DEFAULT_SESSION_PAGE_SIZE;
31008
+ const pageSize = Math.min(Math.max(requestedSize, 1), MAX_SESSION_PAGE_SIZE);
30741
31009
  let numericCursor;
30742
31010
  if (options?.cursor) {
30743
31011
  const parsed = Number(options.cursor);
@@ -30759,7 +31027,7 @@ async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options) {
30759
31027
  workspaceCwd: item.cwd,
30760
31028
  createdAt: item.startTime,
30761
31029
  updatedAt: new Date(item.mtime).toISOString(),
30762
- title: item.customTitle ?? item.prompt,
31030
+ displayName: item.customTitle || item.prompt,
30763
31031
  clientCount: 0,
30764
31032
  hasActivePrompt: false
30765
31033
  });
@@ -30772,7 +31040,7 @@ async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options) {
30772
31040
  ...existing,
30773
31041
  ...live,
30774
31042
  createdAt: existing.createdAt,
30775
- title: live.title ?? existing.title,
31043
+ displayName: live.displayName ?? existing.displayName,
30776
31044
  updatedAt: live.updatedAt ?? existing.updatedAt,
30777
31045
  clientCount: live.clientCount,
30778
31046
  hasActivePrompt: live.hasActivePrompt
@@ -30795,6 +31063,16 @@ async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options) {
30795
31063
  return { sessions, nextCursor };
30796
31064
  }
30797
31065
  __name(listWorkspaceSessionsForResponse, "listWorkspaceSessionsForResponse");
31066
+ function parseSessionPageSizeQuery(raw) {
31067
+ if (typeof raw !== "string") return void 0;
31068
+ const trimmed = raw.trim();
31069
+ if (!/^[+-]?\d+$/.test(trimmed)) return void 0;
31070
+ const parsed = Number.parseInt(trimmed, 10);
31071
+ if (!Number.isFinite(parsed)) return void 0;
31072
+ if (Number.isSafeInteger(parsed)) return parsed;
31073
+ return trimmed.startsWith("-") ? 1 : MAX_SESSION_PAGE_SIZE;
31074
+ }
31075
+ __name(parseSessionPageSizeQuery, "parseSessionPageSizeQuery");
30798
31076
  var AUTH_PROVIDER_STEPS = [
30799
31077
  "protocol",
30800
31078
  "baseUrl",
@@ -30894,25 +31172,61 @@ function parseIPv6FirstHextet(host) {
30894
31172
  return Number.parseInt(first, 16);
30895
31173
  }
30896
31174
  __name(parseIPv6FirstHextet, "parseIPv6FirstHextet");
31175
+ function parseLegacyIPv4Part(value, max) {
31176
+ let parsed;
31177
+ if (/^0x[0-9a-f]+$/i.test(value)) {
31178
+ parsed = Number.parseInt(value.slice(2), 16);
31179
+ } else if (/^0[0-7]+$/.test(value)) {
31180
+ parsed = Number.parseInt(value, 8);
31181
+ } else if (/^[0-9]+$/.test(value)) {
31182
+ parsed = Number.parseInt(value, 10);
31183
+ } else {
31184
+ return void 0;
31185
+ }
31186
+ return parsed <= max ? parsed : void 0;
31187
+ }
31188
+ __name(parseLegacyIPv4Part, "parseLegacyIPv4Part");
31189
+ function parseLegacyIPv4Host(host) {
31190
+ const parts = host.split(".");
31191
+ if (parts.length < 1 || parts.length > 4 || parts.some((part) => !part)) {
31192
+ return void 0;
31193
+ }
31194
+ const maxLastPart = [4294967295, 16777215, 65535, 255][parts.length - 1];
31195
+ if (maxLastPart === void 0) return void 0;
31196
+ const parsed = parts.map(
31197
+ (part, index) => parseLegacyIPv4Part(part, index === parts.length - 1 ? maxLastPart : 255)
31198
+ );
31199
+ if (parsed.some((part) => part === void 0)) return void 0;
31200
+ const values = parsed;
31201
+ const numeric = values.length === 1 ? values[0] : values.length === 2 ? values[0] * 16777216 + values[1] : values.length === 3 ? values[0] * 16777216 + values[1] * 65536 + values[2] : values[0] * 16777216 + values[1] * 65536 + values[2] * 256 + values[3];
31202
+ return [
31203
+ Math.floor(numeric / 16777216) & 255,
31204
+ Math.floor(numeric / 65536) & 255,
31205
+ Math.floor(numeric / 256) & 255,
31206
+ numeric & 255
31207
+ ].join(".");
31208
+ }
31209
+ __name(parseLegacyIPv4Host, "parseLegacyIPv4Host");
30897
31210
  function isBlockedAuthProviderHost(hostname) {
30898
31211
  const stripped = hostname.endsWith(".") ? hostname.slice(0, -1) : hostname;
30899
31212
  const host = stripped.toLowerCase();
30900
31213
  if (host === "localhost" || host.endsWith(".localhost")) return true;
30901
31214
  const bareHost = host.startsWith("[") && host.endsWith("]") ? host.slice(1, -1) : host;
30902
- const ipVersion = net.isIP(bareHost);
31215
+ const blocklistHost = parseLegacyIPv4Host(bareHost) ?? bareHost;
31216
+ const ipVersion = net.isIP(blocklistHost);
30903
31217
  if (ipVersion === 4) {
30904
- const parts = bareHost.split(".").map((part) => Number(part));
31218
+ const parts = blocklistHost.split(".").map((part) => Number(part));
30905
31219
  const [a, b] = parts;
30906
31220
  return a === 0 || a === 10 || a === 127 || a === 100 && b !== void 0 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b !== void 0 && b >= 16 && b <= 31 || a === 192 && b === 168;
30907
31221
  }
30908
31222
  if (ipVersion === 6) {
30909
- if (bareHost === "::" || bareHost === "::1") return true;
30910
- const firstHextet = parseIPv6FirstHextet(bareHost);
31223
+ if (blocklistHost === "::" || blocklistHost === "::1") return true;
31224
+ const firstHextet = parseIPv6FirstHextet(blocklistHost);
30911
31225
  if (firstHextet !== void 0 && (firstHextet >= 65152 && firstHextet <= 65215 || (firstHextet & 65024) === 64512)) {
30912
31226
  return true;
30913
31227
  }
30914
- if (bareHost.startsWith("::ffff:")) {
30915
- const suffix = bareHost.slice("::ffff:".length);
31228
+ if (blocklistHost.startsWith("::ffff:")) {
31229
+ const suffix = blocklistHost.slice("::ffff:".length);
30916
31230
  if (net.isIP(suffix) === 4) {
30917
31231
  return isBlockedAuthProviderHost(suffix);
30918
31232
  }
@@ -31004,17 +31318,17 @@ function parseAuthProviderInstallRequest(body, options) {
31004
31318
  }
31005
31319
  __name(parseAuthProviderInstallRequest, "parseAuthProviderInstallRequest");
31006
31320
  function resolveDaemonTelemetryRoute(req) {
31007
- const path14 = req.path.replace(/\/$/, "") || "/";
31008
- if (req.method === "POST" && path14 === "/session") {
31321
+ const path15 = req.path.replace(/\/$/, "") || "/";
31322
+ if (req.method === "POST" && path15 === "/session") {
31009
31323
  return { route: "POST /session" };
31010
31324
  }
31011
- if (req.method === "POST" && path14 === "/sessions/delete") {
31325
+ if (req.method === "POST" && path15 === "/sessions/delete") {
31012
31326
  return { route: "POST /sessions/delete" };
31013
31327
  }
31014
- if (req.method === "GET" && path14 === "/daemon/status") {
31328
+ if (req.method === "GET" && path15 === "/daemon/status") {
31015
31329
  return { route: "GET /daemon/status" };
31016
31330
  }
31017
- const sessionAction = path14.match(
31331
+ const sessionAction = path15.match(
31018
31332
  /^\/session\/([^/]+)\/(load|resume|prompt|cancel|recap|btw|mid-turn-message|model|shell|detach|rewind|approval-mode|language|a2ui-action)$/
31019
31333
  );
31020
31334
  const sessionActionId = sessionAction?.[1];
@@ -31025,14 +31339,14 @@ function resolveDaemonTelemetryRoute(req) {
31025
31339
  sessionId: sessionActionId
31026
31340
  };
31027
31341
  }
31028
- const sessionMetadata = path14.match(/^\/session\/([^/]+)\/metadata$/);
31342
+ const sessionMetadata = path15.match(/^\/session\/([^/]+)\/metadata$/);
31029
31343
  if (sessionMetadata?.[1] && req.method === "PATCH") {
31030
31344
  return {
31031
31345
  route: "PATCH /session/:id/metadata",
31032
31346
  sessionId: sessionMetadata[1]
31033
31347
  };
31034
31348
  }
31035
- const sessionPermission = path14.match(
31349
+ const sessionPermission = path15.match(
31036
31350
  /^\/session\/([^/]+)\/permission\/([^/]+)$/
31037
31351
  );
31038
31352
  if (sessionPermission?.[1] && sessionPermission?.[2] && req.method === "POST") {
@@ -31043,7 +31357,7 @@ function resolveDaemonTelemetryRoute(req) {
31043
31357
  ...rawRequestId.length <= MAX_CLIENT_ID_LENGTH2 && CLIENT_ID_RE2.test(rawRequestId) ? { permissionRequestId: rawRequestId } : {}
31044
31358
  };
31045
31359
  }
31046
- const globalPermission = path14.match(/^\/permission\/([^/]+)$/);
31360
+ const globalPermission = path15.match(/^\/permission\/([^/]+)$/);
31047
31361
  if (globalPermission?.[1] && req.method === "POST") {
31048
31362
  const rawRequestId = globalPermission[1];
31049
31363
  return {
@@ -31051,45 +31365,45 @@ function resolveDaemonTelemetryRoute(req) {
31051
31365
  ...rawRequestId.length <= MAX_CLIENT_ID_LENGTH2 && CLIENT_ID_RE2.test(rawRequestId) ? { permissionRequestId: rawRequestId } : {}
31052
31366
  };
31053
31367
  }
31054
- const deleteSession = path14.match(/^\/session\/([^/]+)$/);
31368
+ const deleteSession = path15.match(/^\/session\/([^/]+)$/);
31055
31369
  const deleteSessionId = deleteSession?.[1];
31056
31370
  if (deleteSessionId && req.method === "DELETE") {
31057
31371
  return { route: "DELETE /session/:id", sessionId: deleteSessionId };
31058
31372
  }
31059
- if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path14)) {
31373
+ if (req.method === "GET" && /^\/workspace\/[^/]+\/sessions$/.test(path15)) {
31060
31374
  return { route: "GET /workspace/:id/sessions" };
31061
31375
  }
31062
- if (req.method === "POST" && path14 === "/workspace/init") {
31376
+ if (req.method === "POST" && path15 === "/workspace/init") {
31063
31377
  return { route: "POST /workspace/init" };
31064
31378
  }
31065
- if (req.method === "POST" && path14 === "/workspace/reload") {
31379
+ if (req.method === "POST" && path15 === "/workspace/reload") {
31066
31380
  return { route: "POST /workspace/reload" };
31067
31381
  }
31068
- const mcpRestart = path14.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
31382
+ const mcpRestart = path15.match(/^\/workspace\/mcp\/([^/]+)\/restart$/);
31069
31383
  if (mcpRestart?.[1] && req.method === "POST") {
31070
31384
  return { route: "POST /workspace/mcp/:server/restart" };
31071
31385
  }
31072
- if (req.method === "POST" && path14 === "/workspace/mcp/servers") {
31386
+ if (req.method === "POST" && path15 === "/workspace/mcp/servers") {
31073
31387
  return { route: "POST /workspace/mcp/servers" };
31074
31388
  }
31075
- const mcpDelete = path14.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
31389
+ const mcpDelete = path15.match(/^\/workspace\/mcp\/servers\/([^/]+)$/);
31076
31390
  if (mcpDelete?.[1] && req.method === "DELETE") {
31077
31391
  return { route: "DELETE /workspace/mcp/servers/:name" };
31078
31392
  }
31079
- if (req.method === "POST" && path14 === "/workspace/auth/device-flow") {
31393
+ if (req.method === "POST" && path15 === "/workspace/auth/device-flow") {
31080
31394
  return { route: "POST /workspace/auth/device-flow" };
31081
31395
  }
31082
- const deviceFlowDelete = path14.match(
31396
+ const deviceFlowDelete = path15.match(
31083
31397
  /^\/workspace\/auth\/device-flow\/([^/]+)$/
31084
31398
  );
31085
31399
  if (deviceFlowDelete?.[1] && req.method === "DELETE") {
31086
31400
  return { route: "DELETE /workspace/auth/device-flow/:id" };
31087
31401
  }
31088
- const toolEnable = path14.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
31402
+ const toolEnable = path15.match(/^\/workspace\/tools\/([^/]+)\/enable$/);
31089
31403
  if (toolEnable?.[1] && req.method === "POST") {
31090
31404
  return { route: "POST /workspace/tools/:name/enable" };
31091
31405
  }
31092
- if (path14 === "/workspace/settings") {
31406
+ if (path15 === "/workspace/settings") {
31093
31407
  if (req.method === "GET") return { route: "GET /workspace/settings" };
31094
31408
  if (req.method === "POST") return { route: "POST /workspace/settings" };
31095
31409
  }
@@ -31171,7 +31485,7 @@ function advertisedMaxPendingPromptsPerSession(value) {
31171
31485
  }
31172
31486
  __name(advertisedMaxPendingPromptsPerSession, "advertisedMaxPendingPromptsPerSession");
31173
31487
  function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31174
- const app = (0, import_express.default)();
31488
+ const app = (0, import_express2.default)();
31175
31489
  const boundWorkspace = deps.boundWorkspace ?? canonicalizeWorkspace(opts.workspace ?? process.cwd());
31176
31490
  if (!deps.fsFactory && !deps.bridge && !warnedDefaultTrust) {
31177
31491
  warnedDefaultTrust = true;
@@ -31190,6 +31504,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31190
31504
  maxSessions: opts.maxSessions,
31191
31505
  maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession,
31192
31506
  eventRingSize: opts.eventRingSize,
31507
+ permissionResponseTimeoutMs: opts.permissionResponseTimeoutMs,
31193
31508
  boundWorkspace,
31194
31509
  sessionShellCommandEnabled,
31195
31510
  // Wire the production status provider so direct embeds / tests
@@ -31280,8 +31595,291 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31280
31595
  }),
31281
31596
  queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => bridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
31282
31597
  invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => bridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
31598
+ refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => bridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
31283
31599
  publishWorkspaceEvent: /* @__PURE__ */ __name((event) => bridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
31284
31600
  });
31601
+ let extensionInstallQueue = Promise.resolve();
31602
+ let extensionInstallQueueDepth = 0;
31603
+ const MAX_EXTENSION_INSTALL_QUEUE_DEPTH = 10;
31604
+ const enqueueExtensionInstall = /* @__PURE__ */ __name(async (run) => {
31605
+ if (extensionInstallQueueDepth >= MAX_EXTENSION_INSTALL_QUEUE_DEPTH) {
31606
+ throw new Error("Extension operation queue is full");
31607
+ }
31608
+ extensionInstallQueueDepth += 1;
31609
+ const next = extensionInstallQueue.then(run, run).finally(() => {
31610
+ extensionInstallQueueDepth -= 1;
31611
+ });
31612
+ extensionInstallQueue = next.catch(() => void 0);
31613
+ return next;
31614
+ }, "enqueueExtensionInstall");
31615
+ const EXTENSION_MUTATION_TIMEOUT_MS = 12e4;
31616
+ const EXTENSION_REFRESH_TIMEOUT_MS = 3e4;
31617
+ const isExtensionQueueFullError = /* @__PURE__ */ __name((err) => err instanceof Error && err.message === "Extension operation queue is full", "isExtensionQueueFullError");
31618
+ const sendExtensionQueueFull = /* @__PURE__ */ __name((res) => {
31619
+ res.status(429).json({
31620
+ error: "Extension operation queue is full",
31621
+ code: "extension_queue_full"
31622
+ });
31623
+ }, "sendExtensionQueueFull");
31624
+ const withExtensionTimeout = /* @__PURE__ */ __name(async (promise, timeoutMs, operation) => await new Promise((resolve6, reject) => {
31625
+ const timeout = setTimeout(() => {
31626
+ reject(new Error(`${operation} timed out after ${timeoutMs}ms`));
31627
+ }, timeoutMs);
31628
+ promise.then(
31629
+ (value) => {
31630
+ clearTimeout(timeout);
31631
+ resolve6(value);
31632
+ },
31633
+ (err) => {
31634
+ clearTimeout(timeout);
31635
+ reject(err);
31636
+ }
31637
+ );
31638
+ }), "withExtensionTimeout");
31639
+ const createExtensionManager = /* @__PURE__ */ __name(() => new ExtensionManager({
31640
+ workspaceDir: boundWorkspace,
31641
+ isWorkspaceTrusted: !!isWorkspaceTrusted(
31642
+ loadSettings(boundWorkspace).merged
31643
+ ),
31644
+ requestConsent: /* @__PURE__ */ __name(() => Promise.resolve(), "requestConsent"),
31645
+ requestSetting: /* @__PURE__ */ __name(async (setting) => {
31646
+ throw new Error(
31647
+ `Extension setting "${setting.envVar}" requires interactive configuration and is not supported over the daemon install endpoint.`
31648
+ );
31649
+ }, "requestSetting"),
31650
+ requestChoicePlugin: /* @__PURE__ */ __name(async () => {
31651
+ throw new Error(
31652
+ "Marketplace plugin selection is not supported over the daemon install endpoint. Specify a plugin name in the source."
31653
+ );
31654
+ }, "requestChoicePlugin")
31655
+ }), "createExtensionManager");
31656
+ const validateExtensionMutationClient = /* @__PURE__ */ __name((req, res, route) => {
31657
+ const clientId = parseAndValidateWorkspaceClientId(req, res, bridge);
31658
+ if (clientId === null) return false;
31659
+ if (clientId === void 0) {
31660
+ res.status(400).json({
31661
+ error: "Missing X-Qwen-Client-Id header",
31662
+ code: "missing_client_id"
31663
+ });
31664
+ return false;
31665
+ }
31666
+ buildWorkspaceCtx(req, route, clientId);
31667
+ return true;
31668
+ }, "validateExtensionMutationClient");
31669
+ const parseExtensionScope = /* @__PURE__ */ __name((body, res) => {
31670
+ const scope = body["scope"];
31671
+ if (scope !== "user" && scope !== "workspace") {
31672
+ res.status(400).json({ error: '`scope` must be either "user" or "workspace"' });
31673
+ return null;
31674
+ }
31675
+ return scope === "user" ? "User" /* User */ : "Workspace" /* Workspace */;
31676
+ }, "parseExtensionScope");
31677
+ const parseExtensionRegistryUrl = /* @__PURE__ */ __name((value, res) => {
31678
+ let parsed;
31679
+ try {
31680
+ parsed = new URL(value);
31681
+ } catch {
31682
+ res.status(400).json({ error: "`registry` must be a valid URL" });
31683
+ return null;
31684
+ }
31685
+ if (parsed.protocol !== "https:") {
31686
+ res.status(400).json({ error: "`registry` must use https" });
31687
+ return null;
31688
+ }
31689
+ if (parsed.username || parsed.password) {
31690
+ res.status(400).json({ error: "`registry` must not include credentials" });
31691
+ return null;
31692
+ }
31693
+ if (isBlockedAuthProviderHost(parsed.hostname)) {
31694
+ res.status(400).json({ error: "`registry` host is not allowed" });
31695
+ return null;
31696
+ }
31697
+ return parsed.toString().replace(/\/$/, "");
31698
+ }, "parseExtensionRegistryUrl");
31699
+ const parsePotentialSourceUrl = /* @__PURE__ */ __name((source) => {
31700
+ if (/^[a-zA-Z]:[\\/]/.test(source)) return null;
31701
+ try {
31702
+ return new URL(source);
31703
+ } catch {
31704
+ const sshMatch = /^(?:[^@]+@)?(\[[^\]]+\]|[^:]+):/.exec(source);
31705
+ if (!sshMatch?.[1]) return null;
31706
+ try {
31707
+ return new URL(`ssh://${sshMatch[1]}`);
31708
+ } catch {
31709
+ return null;
31710
+ }
31711
+ }
31712
+ }, "parsePotentialSourceUrl");
31713
+ const validateExtensionSourceHost = /* @__PURE__ */ __name((source, res) => {
31714
+ const parsed = parsePotentialSourceUrl(source);
31715
+ if (!parsed) return true;
31716
+ if (parsed.username || parsed.password) {
31717
+ res.status(400).json({ error: "`source` must not include credentials" });
31718
+ return false;
31719
+ }
31720
+ if (isBlockedAuthProviderHost(parsed.hostname)) {
31721
+ res.status(400).json({ error: "`source` host is not allowed" });
31722
+ return false;
31723
+ }
31724
+ if (parsed.protocol !== "https:" && parsed.protocol !== "ssh:") {
31725
+ res.status(400).json({ error: "`source` must use https or ssh" });
31726
+ return false;
31727
+ }
31728
+ return true;
31729
+ }, "validateExtensionSourceHost");
31730
+ const validateExtensionSourceMetadata = /* @__PURE__ */ __name((installMetadata) => {
31731
+ if (installMetadata.type !== "git") return true;
31732
+ const parsed = parsePotentialSourceUrl(installMetadata.source);
31733
+ return !!parsed && (parsed.protocol === "https:" || parsed.protocol === "ssh:") && !isBlockedAuthProviderHost(parsed.hostname);
31734
+ }, "validateExtensionSourceMetadata");
31735
+ const findLoadedExtension = /* @__PURE__ */ __name((extensionManager, extensionName) => {
31736
+ const requested = extensionName.toLowerCase();
31737
+ const extensions = extensionManager.getLoadedExtensions();
31738
+ const byName = extensions.find(
31739
+ (extension) => extension.name.toLowerCase() === requested
31740
+ );
31741
+ if (byName) return byName;
31742
+ if (!extensionName.includes("://") && !extensionName.includes("@")) {
31743
+ return void 0;
31744
+ }
31745
+ return extensions.find(
31746
+ (extension) => extension.installMetadata?.source?.toLowerCase() === requested
31747
+ );
31748
+ }, "findLoadedExtension");
31749
+ const runQueuedExtensionMutation = /* @__PURE__ */ __name((operation, failureContext, res, run) => {
31750
+ if (extensionInstallQueueDepth >= MAX_EXTENSION_INSTALL_QUEUE_DEPTH) {
31751
+ sendExtensionQueueFull(res);
31752
+ return;
31753
+ }
31754
+ res.status(202).json({ accepted: true });
31755
+ void enqueueExtensionInstall(async () => {
31756
+ try {
31757
+ const extensionManager = createExtensionManager();
31758
+ await extensionManager.refreshCache();
31759
+ const event = await withExtensionTimeout(
31760
+ run(extensionManager),
31761
+ EXTENSION_MUTATION_TIMEOUT_MS,
31762
+ `extension ${operation}`
31763
+ );
31764
+ extensionsStatusCache = void 0;
31765
+ try {
31766
+ const result = await bridge.refreshExtensionsForAllSessions(event);
31767
+ writeStderrLine(
31768
+ `qwen serve: extensions ${operation}: refreshed ${result.refreshed} session(s), ${result.failed} failed`
31769
+ );
31770
+ } catch (refreshErr) {
31771
+ const message = redactUrlCredentials(
31772
+ refreshErr instanceof Error ? refreshErr.message : String(refreshErr)
31773
+ );
31774
+ try {
31775
+ bridge.broadcastExtensionsChanged({
31776
+ ...event,
31777
+ refreshed: 0,
31778
+ failed: 1,
31779
+ error: message.slice(0, 500)
31780
+ });
31781
+ } catch (broadcastErr) {
31782
+ writeStderrLine(
31783
+ `qwen serve: extensions ${operation}: failed to broadcast refresh failure: ${broadcastErr instanceof Error ? redactUrlCredentials(broadcastErr.message) : String(broadcastErr)}`
31784
+ );
31785
+ }
31786
+ writeStderrLine(
31787
+ `qwen serve: extensions ${operation}: mutation succeeded but refresh failed: ${message}`
31788
+ );
31789
+ }
31790
+ } catch (err) {
31791
+ const message = redactUrlCredentials(
31792
+ err instanceof Error ? err.message : String(err)
31793
+ );
31794
+ try {
31795
+ bridge.broadcastExtensionsChanged({
31796
+ status: "failed",
31797
+ ...failureContext.source ? { source: redactUrlCredentials(failureContext.source) } : {},
31798
+ ...failureContext.name ? { name: failureContext.name } : {},
31799
+ refreshed: 0,
31800
+ failed: 0,
31801
+ error: message.slice(0, 500)
31802
+ });
31803
+ } catch (broadcastErr) {
31804
+ writeStderrLine(
31805
+ `qwen serve: extensions ${operation}: failed to broadcast failure: ${broadcastErr instanceof Error ? redactUrlCredentials(broadcastErr.message) : String(broadcastErr)}`
31806
+ );
31807
+ }
31808
+ try {
31809
+ writeStderrLine(
31810
+ `qwen serve: extensions ${operation}: background task failed: ${message}`
31811
+ );
31812
+ } catch {
31813
+ }
31814
+ }
31815
+ }).catch((err) => {
31816
+ try {
31817
+ writeStderrLine(
31818
+ `qwen serve: extensions ${operation}: queued task failed: ${err instanceof Error ? err.message : String(err)}`
31819
+ );
31820
+ } catch {
31821
+ }
31822
+ });
31823
+ }, "runQueuedExtensionMutation");
31824
+ let extensionsStatusCache;
31825
+ const buildLocalExtensionsStatus = /* @__PURE__ */ __name(async () => {
31826
+ const now = Date.now();
31827
+ if (extensionsStatusCache && extensionsStatusCache.expiresAt > now) {
31828
+ return extensionsStatusCache.value;
31829
+ }
31830
+ const extensionManager = createExtensionManager();
31831
+ await extensionManager.refreshCache();
31832
+ const entries = extensionManager.getLoadedExtensions().map((ext) => {
31833
+ const capabilities = {
31834
+ mcpServerCount: ext.mcpServers ? Object.keys(ext.mcpServers).length : 0,
31835
+ skillCount: ext.skills?.length ?? 0,
31836
+ agentCount: ext.agents?.length ?? 0,
31837
+ hookCount: ext.hooks ? Object.values(ext.hooks).reduce(
31838
+ (sum, defs) => sum + (defs?.length ?? 0),
31839
+ 0
31840
+ ) : 0,
31841
+ commandCount: ext.commands?.length ?? 0,
31842
+ contextFileCount: ext.contextFiles.length,
31843
+ channelCount: ext.channels ? Object.keys(ext.channels).length : 0,
31844
+ hasSettings: (ext.settings?.length ?? 0) > 0
31845
+ };
31846
+ return {
31847
+ kind: "extension",
31848
+ id: ext.id,
31849
+ name: ext.name,
31850
+ ...ext.displayName ? { displayName: ext.displayName } : {},
31851
+ version: ext.version,
31852
+ isActive: ext.isActive,
31853
+ path: ext.path,
31854
+ ...ext.installMetadata?.source ? { source: redactUrlCredentials(ext.installMetadata.source) } : {},
31855
+ ...ext.installMetadata?.type ? { installType: ext.installMetadata.type } : {},
31856
+ ...ext.installMetadata?.originSource ? { originSource: ext.installMetadata.originSource } : {},
31857
+ ...ext.installMetadata?.ref ? { ref: ext.installMetadata.ref } : {},
31858
+ ...ext.installMetadata?.autoUpdate !== void 0 ? { autoUpdate: ext.installMetadata.autoUpdate } : {},
31859
+ updateState: ext.installMetadata ? "unknown" : "not updatable",
31860
+ capabilities,
31861
+ details: {
31862
+ mcpServers: ext.mcpServers ? Object.keys(ext.mcpServers) : [],
31863
+ commands: ext.commands ?? [],
31864
+ skills: ext.skills?.map((skill) => skill.name) ?? [],
31865
+ agents: ext.agents?.map((agent) => agent.name) ?? [],
31866
+ contextFiles: ext.contextFiles,
31867
+ settings: ext.resolvedSettings?.map((setting) => setting.name) ?? []
31868
+ }
31869
+ };
31870
+ });
31871
+ const status = {
31872
+ v: STATUS_SCHEMA_VERSION,
31873
+ workspaceCwd: boundWorkspace,
31874
+ initialized: true,
31875
+ extensions: entries
31876
+ };
31877
+ extensionsStatusCache = {
31878
+ expiresAt: now + 2e3,
31879
+ value: status
31880
+ };
31881
+ return status;
31882
+ }, "buildLocalExtensionsStatus");
31285
31883
  if (opts.allowOrigins && opts.allowOrigins.length > 0) {
31286
31884
  const parsedAllowOrigins = parseAllowOriginPatterns(opts.allowOrigins);
31287
31885
  if (parsedAllowOrigins.allowAny && !opts.token) {
@@ -31315,10 +31913,17 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31315
31913
  return;
31316
31914
  }
31317
31915
  try {
31916
+ const lastActivity = bridge.lastActivityAt;
31917
+ const now = Date.now();
31318
31918
  res.status(200).json({
31319
31919
  status: "ok",
31320
31920
  sessions: bridge.sessionCount,
31321
31921
  pendingPermissions: bridge.pendingPermissionCount,
31922
+ activePrompts: bridge.activePromptCount,
31923
+ connectedClients: getActiveSseCount(),
31924
+ channelAlive: bridge.isChannelLive(),
31925
+ lastActivityAt: lastActivity !== null ? new Date(lastActivity).toISOString() : null,
31926
+ idleSinceMs: lastActivity !== null ? now - lastActivity : null,
31322
31927
  ...rateLimiter ? { rateLimitHits: rateLimiter.getHitCounts() } : {}
31323
31928
  });
31324
31929
  } catch (err) {
@@ -31370,6 +31975,10 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31370
31975
  next();
31371
31976
  });
31372
31977
  }
31978
+ const webShellDir = opts.serveWebShell !== false ? deps.webShellDir : void 0;
31979
+ if (webShellDir) {
31980
+ mountWebShellAssets(app, webShellDir);
31981
+ }
31373
31982
  app.use(bearerAuth(opts.token));
31374
31983
  let rateLimiter;
31375
31984
  if (opts.rateLimit) {
@@ -31387,16 +31996,16 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31387
31996
  { tier, key: key.slice(0, 64) }
31388
31997
  );
31389
31998
  } : void 0,
31390
- onError: daemonLog ? (err, path14) => {
31999
+ onError: daemonLog ? (err, path15) => {
31391
32000
  daemonLog.warn(
31392
32001
  `rate limiter error (fail-open): ${err instanceof Error ? err.message : String(err)}`,
31393
- { path: path14 }
32002
+ { path: path15 }
31394
32003
  );
31395
32004
  } : void 0
31396
32005
  });
31397
32006
  app.use(rateLimiter.middleware);
31398
32007
  }
31399
- app.use(import_express.default.json({ limit: "10mb" }));
32008
+ app.use(import_express2.default.json({ limit: "10mb" }));
31400
32009
  app.use(
31401
32010
  (err, _req, res, next) => {
31402
32011
  if (sendJsonBodyParserError(res, err)) return;
@@ -31594,12 +32203,376 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31594
32203
  });
31595
32204
  app.get("/workspace/extensions", async (req, res) => {
31596
32205
  try {
31597
- const ctx = buildWorkspaceCtx(req, "GET /workspace/extensions");
31598
- res.status(200).json(await workspace.getWorkspaceExtensionsStatus(ctx));
32206
+ buildWorkspaceCtx(req, "GET /workspace/extensions");
32207
+ res.status(200).json(await buildLocalExtensionsStatus());
31599
32208
  } catch (err) {
31600
32209
  sendBridgeError(res, err, { route: "GET /workspace/extensions" });
31601
32210
  }
31602
32211
  });
32212
+ app.post(
32213
+ "/workspace/extensions/install",
32214
+ mutate({ strict: true }),
32215
+ async (req, res) => {
32216
+ try {
32217
+ if (!validateExtensionMutationClient(
32218
+ req,
32219
+ res,
32220
+ "POST /workspace/extensions/install"
32221
+ )) {
32222
+ return;
32223
+ }
32224
+ const body = safeBody(req);
32225
+ const source = body["source"];
32226
+ const ref = body["ref"];
32227
+ const autoUpdate = body["autoUpdate"];
32228
+ const allowPreRelease = body["allowPreRelease"];
32229
+ const registry = body["registry"];
32230
+ const consent = body["consent"];
32231
+ if (!source || typeof source !== "string") {
32232
+ res.status(400).json({ error: "Missing or invalid source" });
32233
+ return;
32234
+ }
32235
+ if (ref !== void 0 && (typeof ref !== "string" || ref === "")) {
32236
+ res.status(400).json({ error: "`ref` must be a string" });
32237
+ return;
32238
+ }
32239
+ if (typeof ref === "string" && ref.startsWith("-")) {
32240
+ res.status(400).json({ error: '`ref` must not start with "-"' });
32241
+ return;
32242
+ }
32243
+ if (autoUpdate !== void 0 && typeof autoUpdate !== "boolean") {
32244
+ res.status(400).json({ error: "`autoUpdate` must be a boolean" });
32245
+ return;
32246
+ }
32247
+ if (allowPreRelease !== void 0 && typeof allowPreRelease !== "boolean") {
32248
+ res.status(400).json({ error: "`allowPreRelease` must be a boolean" });
32249
+ return;
32250
+ }
32251
+ if (registry !== void 0 && typeof registry !== "string") {
32252
+ res.status(400).json({ error: "`registry` must be a string" });
32253
+ return;
32254
+ }
32255
+ const registryUrl = registry !== void 0 ? parseExtensionRegistryUrl(registry, res) : void 0;
32256
+ if (registryUrl === null) return;
32257
+ if (consent !== true) {
32258
+ res.status(400).json({
32259
+ error: "Extension installation requires explicit consent"
32260
+ });
32261
+ return;
32262
+ }
32263
+ if (!validateExtensionSourceHost(source, res)) {
32264
+ return;
32265
+ }
32266
+ runQueuedExtensionMutation(
32267
+ "install",
32268
+ { source },
32269
+ res,
32270
+ async (extensionManager) => {
32271
+ const installMetadata = await parseInstallSource(source);
32272
+ if (installMetadata.type !== "git" && installMetadata.type !== "github-release" && installMetadata.type !== "npm") {
32273
+ throw new Error(
32274
+ "Only GitHub, Git, and npm extension installs are supported over the daemon endpoint."
32275
+ );
32276
+ }
32277
+ if (installMetadata.type === "npm" && ref) {
32278
+ throw new Error("--ref is not applicable for npm extensions.");
32279
+ }
32280
+ if (installMetadata.type !== "npm" && registry) {
32281
+ throw new Error(
32282
+ "--registry is only applicable for npm extensions."
32283
+ );
32284
+ }
32285
+ if (!validateExtensionSourceMetadata(installMetadata)) {
32286
+ throw new Error("`source` host is not allowed");
32287
+ }
32288
+ if (installMetadata.type === "npm" && registryUrl) {
32289
+ installMetadata.registryUrl = registryUrl;
32290
+ }
32291
+ const extension = await extensionManager.installExtension(
32292
+ { ...installMetadata, ref, autoUpdate, allowPreRelease },
32293
+ () => Promise.resolve()
32294
+ );
32295
+ return {
32296
+ status: "installed",
32297
+ source,
32298
+ name: extension.name,
32299
+ version: extension.config.version
32300
+ };
32301
+ }
32302
+ );
32303
+ } catch (err) {
32304
+ sendBridgeError(res, err, {
32305
+ route: "POST /workspace/extensions/install"
32306
+ });
32307
+ }
32308
+ }
32309
+ );
32310
+ app.post(
32311
+ "/workspace/extensions/check-updates",
32312
+ mutate({ strict: true }),
32313
+ async (req, res) => {
32314
+ try {
32315
+ if (!validateExtensionMutationClient(
32316
+ req,
32317
+ res,
32318
+ "POST /workspace/extensions/check-updates"
32319
+ )) {
32320
+ return;
32321
+ }
32322
+ const states = await enqueueExtensionInstall(
32323
+ async () => withExtensionTimeout(
32324
+ (async () => {
32325
+ const extensionManager = createExtensionManager();
32326
+ await extensionManager.refreshCache();
32327
+ const updateStates = {};
32328
+ await extensionManager.checkForAllExtensionUpdates(
32329
+ (name, state) => {
32330
+ updateStates[name] = state;
32331
+ }
32332
+ );
32333
+ return updateStates;
32334
+ })(),
32335
+ EXTENSION_REFRESH_TIMEOUT_MS,
32336
+ "extension update check"
32337
+ )
32338
+ );
32339
+ res.status(200).json({ states });
32340
+ } catch (err) {
32341
+ if (isExtensionQueueFullError(err)) {
32342
+ sendExtensionQueueFull(res);
32343
+ return;
32344
+ }
32345
+ sendBridgeError(res, err, {
32346
+ route: "POST /workspace/extensions/check-updates"
32347
+ });
32348
+ }
32349
+ }
32350
+ );
32351
+ app.post(
32352
+ "/workspace/extensions/refresh",
32353
+ mutate({ strict: true }),
32354
+ async (req, res) => {
32355
+ try {
32356
+ if (!validateExtensionMutationClient(
32357
+ req,
32358
+ res,
32359
+ "POST /workspace/extensions/refresh"
32360
+ )) {
32361
+ return;
32362
+ }
32363
+ const result = await enqueueExtensionInstall(
32364
+ async () => withExtensionTimeout(
32365
+ workspace.refreshExtensionsForAllSessions(),
32366
+ EXTENSION_REFRESH_TIMEOUT_MS,
32367
+ "extension refresh"
32368
+ )
32369
+ );
32370
+ res.status(200).json(result);
32371
+ } catch (err) {
32372
+ if (isExtensionQueueFullError(err)) {
32373
+ sendExtensionQueueFull(res);
32374
+ return;
32375
+ }
32376
+ sendBridgeError(res, err, {
32377
+ route: "POST /workspace/extensions/refresh"
32378
+ });
32379
+ }
32380
+ }
32381
+ );
32382
+ app.post(
32383
+ "/workspace/extensions/:name/enable",
32384
+ mutate({ strict: true }),
32385
+ async (req, res) => {
32386
+ try {
32387
+ if (!validateExtensionMutationClient(
32388
+ req,
32389
+ res,
32390
+ "POST /workspace/extensions/:name/enable"
32391
+ )) {
32392
+ return;
32393
+ }
32394
+ const name = req.params["name"];
32395
+ if (!name) {
32396
+ res.status(400).json({ error: "Missing extension name" });
32397
+ return;
32398
+ }
32399
+ const scope = parseExtensionScope(safeBody(req), res);
32400
+ if (scope === null) return;
32401
+ runQueuedExtensionMutation(
32402
+ "enable",
32403
+ { name },
32404
+ res,
32405
+ async (extensionManager) => {
32406
+ const extension = findLoadedExtension(extensionManager, name);
32407
+ if (!extension) {
32408
+ throw new Error(`Extension "${name}" not found`);
32409
+ }
32410
+ await extensionManager.enableExtension(
32411
+ extension.name,
32412
+ scope,
32413
+ boundWorkspace
32414
+ );
32415
+ return { status: "enabled", name: extension.name };
32416
+ }
32417
+ );
32418
+ } catch (err) {
32419
+ sendBridgeError(res, err, {
32420
+ route: "POST /workspace/extensions/:name/enable"
32421
+ });
32422
+ }
32423
+ }
32424
+ );
32425
+ app.post(
32426
+ "/workspace/extensions/:name/disable",
32427
+ mutate({ strict: true }),
32428
+ async (req, res) => {
32429
+ try {
32430
+ if (!validateExtensionMutationClient(
32431
+ req,
32432
+ res,
32433
+ "POST /workspace/extensions/:name/disable"
32434
+ )) {
32435
+ return;
32436
+ }
32437
+ const name = req.params["name"];
32438
+ if (!name) {
32439
+ res.status(400).json({ error: "Missing extension name" });
32440
+ return;
32441
+ }
32442
+ const scope = parseExtensionScope(safeBody(req), res);
32443
+ if (scope === null) return;
32444
+ runQueuedExtensionMutation(
32445
+ "disable",
32446
+ { name },
32447
+ res,
32448
+ async (extensionManager) => {
32449
+ const extension = findLoadedExtension(extensionManager, name);
32450
+ if (!extension) {
32451
+ throw new Error(`Extension "${name}" not found`);
32452
+ }
32453
+ await extensionManager.disableExtension(
32454
+ extension.name,
32455
+ scope,
32456
+ boundWorkspace
32457
+ );
32458
+ return { status: "disabled", name: extension.name };
32459
+ }
32460
+ );
32461
+ } catch (err) {
32462
+ sendBridgeError(res, err, {
32463
+ route: "POST /workspace/extensions/:name/disable"
32464
+ });
32465
+ }
32466
+ }
32467
+ );
32468
+ app.post(
32469
+ "/workspace/extensions/:name/update",
32470
+ mutate({ strict: true }),
32471
+ async (req, res) => {
32472
+ try {
32473
+ if (!validateExtensionMutationClient(
32474
+ req,
32475
+ res,
32476
+ "POST /workspace/extensions/:name/update"
32477
+ )) {
32478
+ return;
32479
+ }
32480
+ const name = req.params["name"];
32481
+ if (!name) {
32482
+ res.status(400).json({ error: "Missing extension name" });
32483
+ return;
32484
+ }
32485
+ runQueuedExtensionMutation(
32486
+ "update",
32487
+ { name },
32488
+ res,
32489
+ async (extensionManager) => {
32490
+ const extension = findLoadedExtension(extensionManager, name);
32491
+ if (!extension) {
32492
+ throw new Error(`Extension "${name}" not found`);
32493
+ }
32494
+ let updateError;
32495
+ const updateState = await withExtensionTimeout(
32496
+ checkForExtensionUpdate(extension, extensionManager).catch(
32497
+ (err) => {
32498
+ updateError = err;
32499
+ return "error" /* ERROR */;
32500
+ }
32501
+ ),
32502
+ EXTENSION_REFRESH_TIMEOUT_MS,
32503
+ "extension update check"
32504
+ );
32505
+ if (updateState === "error" /* ERROR */) {
32506
+ const message = updateError === void 0 ? void 0 : redactUrlCredentials(
32507
+ updateError instanceof Error ? updateError.message : String(updateError)
32508
+ );
32509
+ throw new Error(
32510
+ `Update check failed for extension "${extension.name}"${message ? `: ${message}` : ""}`
32511
+ );
32512
+ }
32513
+ if (updateState !== "update available" /* UPDATE_AVAILABLE */) {
32514
+ throw new Error(`Extension "${extension.name}" has no update`);
32515
+ }
32516
+ const info = await extensionManager.updateExtension(
32517
+ extension,
32518
+ updateState,
32519
+ () => void 0
32520
+ );
32521
+ return {
32522
+ status: "updated",
32523
+ name: extension.name,
32524
+ ...info?.updatedVersion ? { version: info.updatedVersion } : {}
32525
+ };
32526
+ }
32527
+ );
32528
+ } catch (err) {
32529
+ sendBridgeError(res, err, {
32530
+ route: "POST /workspace/extensions/:name/update"
32531
+ });
32532
+ }
32533
+ }
32534
+ );
32535
+ app.delete(
32536
+ "/workspace/extensions/:name",
32537
+ mutate({ strict: true }),
32538
+ async (req, res) => {
32539
+ try {
32540
+ if (!validateExtensionMutationClient(
32541
+ req,
32542
+ res,
32543
+ "DELETE /workspace/extensions/:name"
32544
+ )) {
32545
+ return;
32546
+ }
32547
+ const name = req.params["name"];
32548
+ if (!name) {
32549
+ res.status(400).json({ error: "Missing extension name" });
32550
+ return;
32551
+ }
32552
+ runQueuedExtensionMutation(
32553
+ "uninstall",
32554
+ { name },
32555
+ res,
32556
+ async (extensionManager) => {
32557
+ const extension = findLoadedExtension(extensionManager, name);
32558
+ if (!extension) {
32559
+ throw new Error(`Extension "${name}" not found`);
32560
+ }
32561
+ await extensionManager.uninstallExtension(
32562
+ extension.name,
32563
+ false,
32564
+ boundWorkspace
32565
+ );
32566
+ return { status: "uninstalled", name: extension.name };
32567
+ }
32568
+ );
32569
+ } catch (err) {
32570
+ sendBridgeError(res, err, {
32571
+ route: "DELETE /workspace/extensions/:name"
32572
+ });
32573
+ }
32574
+ }
32575
+ );
31603
32576
  registerWorkspaceFileReadRoutes(app, {
31604
32577
  parseClientId: parseClientIdHeader
31605
32578
  });
@@ -31826,7 +32799,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
31826
32799
  return;
31827
32800
  }
31828
32801
  const cwd = hasCwd ? body["cwd"] : boundWorkspace;
31829
- if (!path12.isAbsolute(cwd)) {
32802
+ if (!path13.isAbsolute(cwd)) {
31830
32803
  res.status(400).json({ error: "`cwd` must be an absolute path when provided" });
31831
32804
  return;
31832
32805
  }
@@ -32370,15 +33343,6 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
32370
33343
  { displayName },
32371
33344
  clientId !== void 0 ? { clientId } : void 0
32372
33345
  );
32373
- if (displayName !== void 0) {
32374
- try {
32375
- await new SessionService(boundWorkspace).renameSession(
32376
- sessionId,
32377
- displayName
32378
- );
32379
- } catch {
32380
- }
32381
- }
32382
33346
  res.status(200).json({ sessionId, ...effective });
32383
33347
  } catch (err) {
32384
33348
  sendBridgeError(res, err, {
@@ -32389,7 +33353,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
32389
33353
  });
32390
33354
  app.get("/workspace/:id/sessions", async (req, res) => {
32391
33355
  const workspaceCwd = req.params["id"] ?? "";
32392
- if (!path12.isAbsolute(workspaceCwd)) {
33356
+ if (!path13.isAbsolute(workspaceCwd)) {
32393
33357
  res.status(400).json({ error: "`:id` must decode to an absolute workspace path" });
32394
33358
  return;
32395
33359
  }
@@ -32405,11 +33369,10 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
32405
33369
  }
32406
33370
  try {
32407
33371
  const cursor = typeof req.query["cursor"] === "string" ? req.query["cursor"] : void 0;
32408
- const sizeParam = req.query["size"];
32409
- const size = typeof sizeParam === "string" ? parseInt(sizeParam, 10) : void 0;
33372
+ const size = parseSessionPageSizeQuery(req.query["size"]);
32410
33373
  const result = await listWorkspaceSessionsForResponse(bridge, key, {
32411
33374
  cursor,
32412
- size: Number.isFinite(size) ? size : void 0
33375
+ size
32413
33376
  });
32414
33377
  res.status(200).json({
32415
33378
  sessions: result.sessions,
@@ -33289,6 +34252,9 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
33289
34252
  if (acpHandleRef.current) {
33290
34253
  app.locals["acpHandle"] = acpHandleRef.current;
33291
34254
  }
34255
+ if (webShellDir) {
34256
+ mountWebShellSpaFallback(app, webShellDir);
34257
+ }
33292
34258
  app.use(
33293
34259
  (err, _req, res, _next) => {
33294
34260
  if (sendJsonBodyParserError(res, err)) return;
@@ -33355,7 +34321,7 @@ function parseOptionalWorkspaceCwd2(body, boundWorkspace, res) {
33355
34321
  return void 0;
33356
34322
  }
33357
34323
  const cwd = hasCwd ? body["cwd"] : boundWorkspace;
33358
- if (!path12.isAbsolute(cwd)) {
34324
+ if (!path13.isAbsolute(cwd)) {
33359
34325
  res.status(400).json({ error: "`cwd` must be an absolute path when provided" });
33360
34326
  return void 0;
33361
34327
  }
@@ -33917,7 +34883,7 @@ __name(errorPayload, "errorPayload");
33917
34883
  // packages/cli/src/serve/runQwenServe.ts
33918
34884
  init_esbuild_shims();
33919
34885
  import * as fs6 from "node:fs";
33920
- import * as path13 from "node:path";
34886
+ import * as path14 from "node:path";
33921
34887
 
33922
34888
  // packages/cli/src/serve/permissionAudit.ts
33923
34889
  init_esbuild_shims();
@@ -34189,6 +35155,10 @@ function isNonNegativeIntegerOrInfinity(value) {
34189
35155
  return value === Number.POSITIVE_INFINITY || Number.isFinite(value) && Number.isInteger(value) && value >= 0;
34190
35156
  }
34191
35157
  __name(isNonNegativeIntegerOrInfinity, "isNonNegativeIntegerOrInfinity");
35158
+ function isNonNegativeIntegerMs(value) {
35159
+ return Number.isFinite(value) && Number.isInteger(value) && value >= 0;
35160
+ }
35161
+ __name(isNonNegativeIntegerMs, "isNonNegativeIntegerMs");
34192
35162
  var MAX_TIMEOUT_MS = 2147483647;
34193
35163
  function assertTimerDelayInRange(name, value) {
34194
35164
  if (value > MAX_TIMEOUT_MS) {
@@ -34382,7 +35352,7 @@ async function runQwenServe(optsIn, deps = {}) {
34382
35352
  );
34383
35353
  }
34384
35354
  const rawWorkspace = opts.workspace ?? process.cwd();
34385
- if (!path13.isAbsolute(rawWorkspace)) {
35355
+ if (!path14.isAbsolute(rawWorkspace)) {
34386
35356
  throw new Error(
34387
35357
  `Invalid --workspace "${rawWorkspace}": must be an absolute path.`
34388
35358
  );
@@ -34456,6 +35426,27 @@ async function runQwenServe(optsIn, deps = {}) {
34456
35426
  );
34457
35427
  }
34458
35428
  }
35429
+ if (opts.sessionReapIntervalMs !== void 0) {
35430
+ if (!isNonNegativeIntegerMs(opts.sessionReapIntervalMs)) {
35431
+ throw new TypeError(
35432
+ `Invalid sessionReapIntervalMs: ${opts.sessionReapIntervalMs}. Must be a non-negative integer (milliseconds, 0 = disabled).`
35433
+ );
35434
+ }
35435
+ }
35436
+ if (opts.sessionIdleTimeoutMs !== void 0) {
35437
+ if (!isNonNegativeIntegerMs(opts.sessionIdleTimeoutMs)) {
35438
+ throw new TypeError(
35439
+ `Invalid sessionIdleTimeoutMs: ${opts.sessionIdleTimeoutMs}. Must be a non-negative integer (milliseconds, 0 = disabled).`
35440
+ );
35441
+ }
35442
+ }
35443
+ if (opts.permissionResponseTimeoutMs !== void 0) {
35444
+ if (!Number.isFinite(opts.permissionResponseTimeoutMs) || !Number.isInteger(opts.permissionResponseTimeoutMs) || opts.permissionResponseTimeoutMs < 0) {
35445
+ throw new TypeError(
35446
+ `Invalid permissionResponseTimeoutMs: ${opts.permissionResponseTimeoutMs}. Must be a non-negative integer (milliseconds, 0 = disabled / wait forever).`
35447
+ );
35448
+ }
35449
+ }
34459
35450
  const inheritedNoPool = process.env["QWEN_SERVE_NO_MCP_POOL"] === "1";
34460
35451
  if (opts.mcpPoolActive === void 0 && inheritedNoPool) {
34461
35452
  opts.mcpPoolActive = false;
@@ -34567,6 +35558,7 @@ async function runQwenServe(optsIn, deps = {}) {
34567
35558
  ...opts.channelIdleTimeoutMs !== void 0 ? { channelIdleTimeoutMs: opts.channelIdleTimeoutMs } : {},
34568
35559
  ...opts.sessionReapIntervalMs !== void 0 ? { sessionReapIntervalMs: opts.sessionReapIntervalMs } : {},
34569
35560
  ...opts.sessionIdleTimeoutMs !== void 0 ? { sessionIdleTimeoutMs: opts.sessionIdleTimeoutMs } : {},
35561
+ ...opts.permissionResponseTimeoutMs !== void 0 ? { permissionResponseTimeoutMs: opts.permissionResponseTimeoutMs } : {},
34570
35562
  boundWorkspace,
34571
35563
  sessionShellCommandEnabled,
34572
35564
  childEnvOverrides,
@@ -34628,6 +35620,7 @@ async function runQwenServe(optsIn, deps = {}) {
34628
35620
  }), "reloadDaemonEnv"),
34629
35621
  queryWorkspaceStatus: /* @__PURE__ */ __name((method, idle) => bridge.queryWorkspaceStatus(method, idle), "queryWorkspaceStatus"),
34630
35622
  invokeWorkspaceCommand: /* @__PURE__ */ __name((method, params, invokeOpts) => bridge.invokeWorkspaceCommand(method, params, invokeOpts), "invokeWorkspaceCommand"),
35623
+ refreshExtensionsForAllSessions: /* @__PURE__ */ __name(() => bridge.refreshExtensionsForAllSessions(), "refreshExtensionsForAllSessions"),
34631
35624
  publishWorkspaceEvent: /* @__PURE__ */ __name((event) => bridge.publishWorkspaceEvent(event), "publishWorkspaceEvent")
34632
35625
  });
34633
35626
  registerDaemonGaugeCallbacks({
@@ -34636,8 +35629,30 @@ async function runQwenServe(optsIn, deps = {}) {
34636
35629
  heapUsed: /* @__PURE__ */ __name(() => process.memoryUsage().heapUsed, "heapUsed")
34637
35630
  });
34638
35631
  let actualPort = opts.port;
35632
+ const webShellDir = opts.serveWebShell === false ? void 0 : resolveWebShellDir();
35633
+ if (opts.serveWebShell !== false) {
35634
+ if (!webShellDir) {
35635
+ writeStderrLine(
35636
+ "qwen serve: Web Shell assets not found; serving API only. Build the web-shell workspace (npm run build) or pass --no-web to silence this."
35637
+ );
35638
+ } else {
35639
+ writeStderrLine(`qwen serve: Web Shell UI served from ${webShellDir}`);
35640
+ if (!isLoopbackBind(opts.hostname)) {
35641
+ writeStderrLine(
35642
+ "qwen serve: Web Shell UI is served WITHOUT auth on a non-loopback bind (the static shell has no secrets; the API stays token-gated). Pass --no-web to disable the UI."
35643
+ );
35644
+ if (!opts.allowOrigins || opts.allowOrigins.length === 0) {
35645
+ writeStderrLine(
35646
+ "qwen serve: without --allow-origin the Web Shell is read-only on a non-loopback bind \u2014 same-origin POSTs are blocked by CORS (403). Pass --allow-origin <origin> or front it with a same-origin proxy."
35647
+ );
35648
+ }
35649
+ }
35650
+ }
35651
+ }
35652
+ const webShellMounted = !!webShellDir;
34639
35653
  const app = createServeApp(opts, () => actualPort, {
34640
35654
  bridge,
35655
+ webShellDir,
34641
35656
  boundWorkspace,
34642
35657
  qwenCodeVersion: cliVersion,
34643
35658
  fsFactory,
@@ -34752,6 +35767,8 @@ async function runQwenServe(optsIn, deps = {}) {
34752
35767
  server,
34753
35768
  url,
34754
35769
  bridge,
35770
+ webShellMounted,
35771
+ resolvedToken: token,
34755
35772
  close: /* @__PURE__ */ __name(() => {
34756
35773
  if (closePromise) return closePromise;
34757
35774
  closePromise = new Promise((res, rej) => {