@qwen-code/qwen-code 0.20.1-preview.7215 → 0.20.1

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 (326) hide show
  1. package/bundled/qc-helper/docs/configuration/settings.md +1 -1
  2. package/bundled/qc-helper/docs/features/auto-mode.md +19 -16
  3. package/bundled/qc-helper/docs/features/commands.md +54 -0
  4. package/bundled/qc-helper/docs/features/sub-agents.md +16 -7
  5. package/bundled/qc-helper/docs/integration-github-action.md +10 -10
  6. package/bundled/qc-helper/docs/qwen-serve.md +2 -1
  7. package/bundled/review/DESIGN.md +2 -2
  8. package/bundled/review/SKILL.md +4 -4
  9. package/chunks/{MaxSizedBox-EH6G5AEH.js → MaxSizedBox-4WZYPSRU.js} +40 -36
  10. package/chunks/{StandaloneSessionPicker-264A3TEA.js → StandaloneSessionPicker-PE4JAIFA.js} +58 -54
  11. package/chunks/{acpAgent-6RBIJFDI.js → acpAgent-BVIKGJ2C.js} +1503 -520
  12. package/chunks/{agent-QURXGAA3.js → agent-DHLFAOUV.js} +36 -32
  13. package/chunks/{agent-headless-CRGX4ICQ.js → agent-headless-ZP5WTNXZ.js} +36 -32
  14. package/chunks/{anthropicContentGenerator-BWBAZGTW.js → anthropicContentGenerator-NMSS7IMV.js} +11 -11
  15. package/chunks/{artifact-tool-IUJ7QWCX.js → artifact-tool-56T5IMBP.js} +3 -3
  16. package/chunks/{askUserQuestion-IUMUUTDQ.js → askUserQuestion-E25OBIC2.js} +3 -3
  17. package/chunks/{bridge-MNFVKPMI.js → bridge-XAK7JKMD.js} +41 -37
  18. package/chunks/{build-SSCNEHZZ.js → build-GHIZ4MSZ.js} +1 -1
  19. package/chunks/{ca-2SL2BXTK.js → ca-N6VVUFVB.js} +611 -201
  20. package/chunks/{channel-worker-group-53CMOPFT.js → channel-worker-group-LFBT7K64.js} +5 -5
  21. package/chunks/{channel-worker-manager-UTXILKC2.js → channel-worker-manager-3RUPERG2.js} +5 -5
  22. package/chunks/{channel-worker-supervisor-ZGO2W2MD.js → channel-worker-supervisor-A3KVATD3.js} +4 -4
  23. package/chunks/{chunk-IUSNI6IX.js → chunk-27CLX4FV.js} +1 -1
  24. package/chunks/{chunk-2HOVDT7W.js → chunk-2LI23QA6.js} +1 -1
  25. package/chunks/chunk-2RFKHEXL.js +74 -0
  26. package/chunks/{chunk-LZYWWWCZ.js → chunk-3KQSDUK3.js} +3 -3
  27. package/chunks/{chunk-NOWTNYC7.js → chunk-3LH5Q2AR.js} +8 -8
  28. package/chunks/{chunk-IB35C3IL.js → chunk-3SXF4GMQ.js} +1 -1
  29. package/chunks/chunk-43T5WDQ7.js +127 -0
  30. package/chunks/{chunk-KXEGCGUG.js → chunk-4BRH6FP5.js} +31 -6
  31. package/chunks/{chunk-TTSKHF43.js → chunk-4DSBFQMI.js} +2 -2
  32. package/chunks/{chunk-JD3MKVKL.js → chunk-4K56OJFJ.js} +1 -1
  33. package/chunks/{chunk-KTUQMDEP.js → chunk-4K7VDKAD.js} +1 -1
  34. package/chunks/{chunk-QKYTTBYW.js → chunk-4LVZNIDO.js} +1 -1
  35. package/chunks/{chunk-OF2BBLYQ.js → chunk-52T5UHAZ.js} +2 -2
  36. package/chunks/{chunk-ZEOZL37W.js → chunk-57FIIFJN.js} +1 -1
  37. package/chunks/{chunk-WAX3ITOA.js → chunk-5EA5NVXS.js} +1 -1
  38. package/chunks/chunk-5G2SK2OO.js +20600 -0
  39. package/chunks/{chunk-6EFTQYW7.js → chunk-5I5BM454.js} +1 -1
  40. package/chunks/{chunk-GMGDLUC7.js → chunk-6IL7KRLE.js} +1 -1
  41. package/chunks/{chunk-26LLB6FM.js → chunk-6NHK6HS7.js} +2 -2
  42. package/chunks/{chunk-FVS747N7.js → chunk-6PRNSLMB.js} +11 -6
  43. package/chunks/chunk-6PVPNMXU.js +29 -0
  44. package/chunks/{chunk-BDBMYST4.js → chunk-6X4GWOPW.js} +1 -1
  45. package/chunks/{chunk-4ODB7WIB.js → chunk-6ZBPS62S.js} +1 -1
  46. package/chunks/{chunk-E5GIFWE3.js → chunk-766HLFAG.js} +54 -33
  47. package/chunks/{chunk-SDXIH6OA.js → chunk-76OFFG6L.js} +137 -5
  48. package/chunks/{chunk-ANHT55MR.js → chunk-7LH6CHKG.js} +1 -1
  49. package/chunks/{chunk-Y4CRUWFZ.js → chunk-7NDXG4MB.js} +60 -35
  50. package/chunks/{chunk-KPZNOZPC.js → chunk-7SWFAKVH.js} +22 -22
  51. package/chunks/{chunk-AYCDXHZB.js → chunk-7Z6JQEL6.js} +1 -1
  52. package/chunks/{chunk-5NWV4NFB.js → chunk-AZD6KAV7.js} +3 -3
  53. package/chunks/{chunk-7YBZGNEC.js → chunk-BKZEHVPV.js} +176 -168
  54. package/chunks/{chunk-WXAXH7IJ.js → chunk-BWQRDISK.js} +1 -1
  55. package/chunks/{chunk-X4CGDBKA.js → chunk-BZAEENUV.js} +3 -3
  56. package/chunks/{chunk-BF32GYSY.js → chunk-CHXKGIMK.js} +1 -1
  57. package/chunks/{chunk-4SLLEAQP.js → chunk-D53NR4GO.js} +562 -301
  58. package/chunks/{chunk-FLTN6NRU.js → chunk-D6ZOVZLF.js} +5 -1
  59. package/chunks/{chunk-NBMIC7DR.js → chunk-D7WXIW7H.js} +4 -4
  60. package/chunks/{chunk-MKLKHZAK.js → chunk-DPRMI6NU.js} +1 -1
  61. package/chunks/{chunk-AR27OPIU.js → chunk-DRIXALGM.js} +2 -2
  62. package/chunks/{chunk-5SCI6E3E.js → chunk-E4IMU4Y5.js} +1 -1
  63. package/chunks/{chunk-Z5Q65RVH.js → chunk-EC2ET5ZZ.js} +1 -1
  64. package/chunks/{chunk-B453NMZJ.js → chunk-EFIOE2EH.js} +3 -3
  65. package/chunks/{chunk-OKWRU4NO.js → chunk-EWXXMRMP.js} +3 -3
  66. package/chunks/{chunk-NEEB7UEN.js → chunk-FFFM6NJV.js} +1 -2
  67. package/chunks/{chunk-JVTCARQ6.js → chunk-G6LRTI62.js} +4 -4
  68. package/chunks/{chunk-6OH6A5EX.js → chunk-GEB2CGUV.js} +20262 -17752
  69. package/chunks/{chunk-OONJNQ42.js → chunk-GPSKDNEE.js} +3 -3
  70. package/chunks/{chunk-FNGK2Z5B.js → chunk-H4AR2JQF.js} +3 -3
  71. package/chunks/chunk-HTR4WV6U.js +327 -0
  72. package/chunks/chunk-IS2SBY6T.js +2256 -0
  73. package/chunks/{chunk-G45X5TRN.js → chunk-JCW2R7WC.js} +1 -72
  74. package/chunks/{chunk-6GUTHAN7.js → chunk-JHFVJQRO.js} +1 -1
  75. package/chunks/{chunk-IE4JSQ5L.js → chunk-JIBBZH37.js} +27 -23
  76. package/chunks/{chunk-UJEZQ562.js → chunk-JJEFX6U5.js} +3 -3
  77. package/chunks/{chunk-QOK6RMIP.js → chunk-JKFHJK5U.js} +4 -4
  78. package/chunks/{chunk-GA7VRJVN.js → chunk-JO7FGOSY.js} +5 -5
  79. package/chunks/{chunk-WOT64EP2.js → chunk-JTUAAVUT.js} +2 -2
  80. package/chunks/{chunk-MAQQGNQ5.js → chunk-JYS55H6Z.js} +66 -7
  81. package/chunks/{chunk-DA7OOKVN.js → chunk-KDPIV6WC.js} +29 -2
  82. package/chunks/{chunk-EIAK6Q2B.js → chunk-KHOVYUHX.js} +2 -2
  83. package/chunks/{chunk-OLMETXLX.js → chunk-KQQ757OQ.js} +2 -2
  84. package/chunks/{chunk-Z6UEAQTP.js → chunk-KSZZBDVD.js} +165 -48
  85. package/chunks/chunk-KWK7UE6L.js +6194 -0
  86. package/chunks/{chunk-OOCI5VVU.js → chunk-LIZRAKPB.js} +1 -1
  87. package/chunks/{chunk-VFAE4AGH.js → chunk-LPMBFOWH.js} +73 -68
  88. package/chunks/{chunk-IKP5DXZY.js → chunk-LYEKAAEH.js} +5 -5
  89. package/chunks/chunk-M7WBGLYP.js +151 -0
  90. package/chunks/{chunk-P2YAOGJD.js → chunk-MTSYH4MB.js} +3 -3
  91. package/chunks/{chunk-WKRXIHD6.js → chunk-N5ARKAVE.js} +8 -8
  92. package/chunks/chunk-NABLFI57.js +82 -0
  93. package/chunks/{chunk-CVDW42JT.js → chunk-NNFK277W.js} +1 -1
  94. package/chunks/{chunk-467G3SV5.js → chunk-NPQDJGKU.js} +1 -1
  95. package/chunks/chunk-OQ5SYCPE.js +10017 -0
  96. package/chunks/{chunk-C27BYUX6.js → chunk-OQB4EXO4.js} +14 -11
  97. package/chunks/{chunk-RELYEO3R.js → chunk-OUDZVU7H.js} +242 -1607
  98. package/chunks/{chunk-3EUZWNWA.js → chunk-PBED7USE.js} +1 -1
  99. package/chunks/{chunk-WBTZGWQ6.js → chunk-PIHKWN7M.js} +1 -1
  100. package/chunks/{chunk-XNP57UDV.js → chunk-PPIHLGNE.js} +2 -2
  101. package/chunks/{chunk-Q4RBU7WX.js → chunk-PSVSP2OS.js} +6 -6
  102. package/chunks/{chunk-BRXIO5WY.js → chunk-Q2V2ADXF.js} +7 -7
  103. package/chunks/{chunk-JDI67JFB.js → chunk-Q2YKNMLS.js} +3 -3
  104. package/chunks/{chunk-BAIEQKR5.js → chunk-Q3GGJDYN.js} +5 -5
  105. package/chunks/{chunk-PBATSWUQ.js → chunk-QBUDF33N.js} +1 -1
  106. package/chunks/{chunk-OMH3276Y.js → chunk-QD6BRERJ.js} +7 -7
  107. package/chunks/{chunk-Y2ENGUD6.js → chunk-QKTHJXCS.js} +1 -1
  108. package/chunks/{chunk-BVLROR2T.js → chunk-QLJUC7TG.js} +1 -1
  109. package/chunks/{chunk-UEY4AYUL.js → chunk-QNLNLENL.js} +2 -2
  110. package/chunks/{chunk-7KDI2IB2.js → chunk-QSJ6JIF5.js} +4 -4
  111. package/chunks/{chunk-Q3ZBFXK4.js → chunk-QUHJRRUA.js} +126 -30
  112. package/chunks/{chunk-N6YTEVLV.js → chunk-R3BCL5XW.js} +10 -4
  113. package/chunks/{chunk-EVSTCA7S.js → chunk-R7MPKABX.js} +307 -86
  114. package/chunks/{chunk-RFIAR4YL.js → chunk-RV4C2ZFG.js} +1 -1
  115. package/chunks/{chunk-NIJEXGV6.js → chunk-RVLZCXEE.js} +79 -10
  116. package/chunks/{chunk-T7DDD7CZ.js → chunk-RYSMKY43.js} +4 -4
  117. package/chunks/{chunk-MC2DOZS7.js → chunk-S3YQCNJE.js} +3 -3
  118. package/chunks/{chunk-4WUAQ2DO.js → chunk-SP32MK6J.js} +2 -2
  119. package/chunks/{chunk-JNWZQ27S.js → chunk-SP5WRGVG.js} +3 -3
  120. package/chunks/{chunk-FSL5W5TI.js → chunk-T2L47JJK.js} +3 -3
  121. package/chunks/{chunk-TB6UDU4T.js → chunk-THJNPLI4.js} +16 -16
  122. package/chunks/{chunk-TCKTNY66.js → chunk-TPR35HHZ.js} +6 -6
  123. package/chunks/{chunk-UQES76OO.js → chunk-TXRKCFWS.js} +6 -6
  124. package/chunks/chunk-U7ZFW55U.js +2098 -0
  125. package/chunks/{chunk-W7H223ZZ.js → chunk-UGYMA4EI.js} +1 -1
  126. package/chunks/{chunk-X6YQWCIJ.js → chunk-UH3WSE5L.js} +13 -1
  127. package/chunks/{chunk-R3VWUU2E.js → chunk-VYPFXUCB.js} +1 -1
  128. package/chunks/{chunk-2DXOIVUI.js → chunk-WCFTQD7H.js} +11 -11
  129. package/chunks/chunk-WHGVTP7Q.js +1049 -0
  130. package/chunks/{chunk-PWVTCGBP.js → chunk-WML6JOGQ.js} +31 -19
  131. package/chunks/{chunk-D2VIDMVM.js → chunk-X6N25LXS.js} +2 -2
  132. package/chunks/{chunk-Z5R4JMOL.js → chunk-X7XWGRDT.js} +4 -4
  133. package/chunks/chunk-XHATNRQA.js +1500 -0
  134. package/chunks/{chunk-V25Z5UUB.js → chunk-Y2DAH52F.js} +7 -6
  135. package/chunks/{chunk-S35ZDXOS.js → chunk-YM3SZTH4.js} +2 -1
  136. package/chunks/{chunk-GKY2OJ7R.js → chunk-ZHERRXZJ.js} +1 -1
  137. package/chunks/{computer-use-R7KA6UJ6.js → computer-use-MV4K6WJM.js} +41 -37
  138. package/chunks/{config-utils-6FXFJUYB.js → config-utils-WYUQ7II4.js} +3 -3
  139. package/chunks/{contextCommand-KAQQPHZ4.js → contextCommand-TQD36VNX.js} +38 -34
  140. package/chunks/{create-sub-session-X5RVIHCK.js → create-sub-session-AZ77LBL3.js} +3 -3
  141. package/chunks/{create-sub-session-TDPDBU4K.js → create-sub-session-JOW4BKMC.js} +36 -32
  142. package/chunks/{cron-create-AC5FFLN7.js → cron-create-KTWJM7QT.js} +5 -5
  143. package/chunks/{cron-delete-JEB3FAHA.js → cron-delete-2P3I5ULL.js} +5 -5
  144. package/chunks/{cron-list-NBYPCNIB.js → cron-list-PXDPGEDQ.js} +5 -5
  145. package/chunks/{daemon-RG2MAI6T.js → daemon-KLPTQIE4.js} +138 -81
  146. package/chunks/daemon-status-provider-TII4SMCZ.js +81 -0
  147. package/chunks/{de-I7ZIYXZC.js → de-4IBXM7CN.js} +5 -1
  148. package/chunks/{dist-2BHAYBKP.js → dist-HMU6CYS4.js} +2 -2
  149. package/chunks/{dist-AU7NQQRP.js → dist-OAV7LJGJ.js} +1 -1
  150. package/chunks/{dist-FUTEXY6A.js → dist-OMW6WDEO.js} +1 -1
  151. package/chunks/{dist-2MIU4UUH.js → dist-PJLG2XYX.js} +1 -1
  152. package/chunks/{dist-53PZYC5B.js → dist-UIFWIFRO.js} +2 -2
  153. package/chunks/{dist-WGTQO7F2.js → dist-XRYV6TJP.js} +65 -25
  154. package/chunks/{earlyInputCapture-WC7RI5HV.js → earlyInputCapture-2V57RG6H.js} +37 -33
  155. package/chunks/{edit-6MHKCJCM.js → edit-TTUH7PWR.js} +43 -41
  156. package/chunks/{en-XE34GKAA.js → en-USMCCJAJ.js} +5 -1
  157. package/chunks/{enter-worktree-O7VJ2E7A.js → enter-worktree-D4IVCXYB.js} +41 -37
  158. package/chunks/{enterPlanMode-5XYAALIO.js → enterPlanMode-WRUJTVYN.js} +47 -38
  159. package/chunks/{environment-LSKFNLBU.js → environment-SEPKXB2C.js} +38 -34
  160. package/chunks/{errors-ZFVCY6HG.js → errors-YSVGBLBU.js} +38 -34
  161. package/chunks/{exit-worktree-MYIK66T7.js → exit-worktree-MZ4JSSP6.js} +41 -37
  162. package/chunks/{exitPlanMode-7MBNU76O.js → exitPlanMode-HAZLSSOJ.js} +41 -37
  163. package/chunks/{fast-path-RNLIB64C.js → fast-path-EVBVIE2U.js} +4 -3
  164. package/chunks/{fast-path-settings-DAOVFADC.js → fast-path-settings-XB3CPUJT.js} +2 -2
  165. package/chunks/{fr-X7KDVZIY.js → fr-WVHEBDDB.js} +5 -1
  166. package/chunks/{gemini-WK5ISEAQ.js → gemini-APQ76464.js} +100 -95
  167. package/chunks/{geminiContentGenerator-NUJQBZBW.js → geminiContentGenerator-LB4MA2LI.js} +5 -5
  168. package/chunks/{getMachineId-bsd-EXV7SWPA.js → getMachineId-bsd-QFVLPUPT.js} +1 -1
  169. package/chunks/{getMachineId-darwin-IUOMFXU3.js → getMachineId-darwin-DGMQQE2E.js} +1 -1
  170. package/chunks/{getMachineId-linux-K7XJYFHL.js → getMachineId-linux-R4Z6CSWC.js} +1 -1
  171. package/chunks/{getMachineId-unsupported-EA5FDRJ6.js → getMachineId-unsupported-Z3SBVBUV.js} +1 -1
  172. package/chunks/{getMachineId-win-KBA6RAI5.js → getMachineId-win-SCK5UFDT.js} +1 -1
  173. package/chunks/{glob-7P6RYY4L.js → glob-LABYMYKG.js} +43 -39
  174. package/chunks/{grep-V3QHNP2J.js → grep-HKIKJCAS.js} +43 -39
  175. package/chunks/{handleAutoUpdate-AAQ6PL3E.js → handleAutoUpdate-RWAAL2UM.js} +40 -36
  176. package/chunks/{i18n-B7IO7WQT.js → i18n-ZUVDAJIJ.js} +37 -33
  177. package/chunks/{initializer-E5TIC3CW.js → initializer-7YUHIC36.js} +43 -39
  178. package/chunks/{installationInfo-XLPNAISK.js → installationInfo-DVEOMWDE.js} +39 -33
  179. package/chunks/{ja-2ICT3KXF.js → ja-KY4ROZTE.js} +5 -1
  180. package/chunks/{keychain-token-storage-DWRJMNH3.js → keychain-token-storage-6ACJDYIB.js} +3 -3
  181. package/chunks/list-WHCZSIR2.js +82 -0
  182. package/chunks/{loadedSettingsAdapter-X5BSC6CE.js → loadedSettingsAdapter-YCWN6AK3.js} +42 -38
  183. package/chunks/{loop-wakeup-HMHCT5GU.js → loop-wakeup-RNMRVA66.js} +6 -6
  184. package/chunks/{ls-IW5HYDG4.js → ls-J2ZI5XYK.js} +5 -5
  185. package/chunks/{lsp-4RL52YIZ.js → lsp-UMS3NUB5.js} +3 -3
  186. package/chunks/managed-npm-update-PG3463CJ.js +333 -0
  187. package/chunks/{mcp-4C4HWXAR.js → mcp-VLHDCKAN.js} +42 -38
  188. package/chunks/{monitor-3CJDNZB2.js → monitor-GG4F4YM6.js} +41 -37
  189. package/chunks/nonInteractiveCli-UYXYV4YX.js +133 -0
  190. package/chunks/{notebook-edit-MX366HCT.js → notebook-edit-US4VLN6Q.js} +44 -42
  191. package/chunks/{openaiContentGenerator-KRPNNJGZ.js → openaiContentGenerator-CVEDTMDB.js} +20 -18
  192. package/chunks/{pidfile-K7T2JLUJ.js → pidfile-QQ45OIOY.js} +37 -33
  193. package/chunks/{processUtils-YXL3VIBR.js → processUtils-3WMHLQE5.js} +2 -2
  194. package/chunks/{pt-JJ4XPIBP.js → pt-OK455PLH.js} +5 -1
  195. package/chunks/{qwenContentGenerator-GJVXFZ3U.js → qwenContentGenerator-Y2GRNYZQ.js} +42 -38
  196. package/chunks/{qwenOAuth2-UZTIBQLY.js → qwenOAuth2-J2X6E5VO.js} +18 -16
  197. package/chunks/{read-file-S5XQSYOW.js → read-file-C7Z266CU.js} +13 -11
  198. package/chunks/{read-mcp-resource-OIBCNIX7.js → read-mcp-resource-F6HYMDUY.js} +3 -3
  199. package/chunks/{record-artifact-HDMK4LHG.js → record-artifact-7GCFLDD7.js} +3 -3
  200. package/chunks/{resumeHistoryUtils-IKR6XD2S.js → resumeHistoryUtils-KBQWX77U.js} +43 -39
  201. package/chunks/{ripGrep-H65GRSQX.js → ripGrep-RW26MTQ3.js} +36 -32
  202. package/chunks/{ru-STR4KTW7.js → ru-7SPDGMGD.js} +5 -1
  203. package/chunks/{run-qwen-serve-7SKAQOAA.js → run-qwen-serve-MXFMOMEL.js} +104 -82
  204. package/chunks/{runtime-I2STBGPR.js → runtime-APNO3V6D.js} +48 -42
  205. package/chunks/{scheduler-6F7HETNO.js → scheduler-L6FYCGVO.js} +36 -32
  206. package/chunks/sdk-exporters-grpc-ETLH47EP.js +23214 -0
  207. package/chunks/sdk-exporters-http-IDGLRBGP.js +563 -0
  208. package/chunks/sdk-impl-5ESZBGJQ.js +9186 -0
  209. package/chunks/{send-message-WXVVK4DB.js → send-message-PYIJ2PZL.js} +6 -4
  210. package/chunks/{serve-4ATEWSEA.js → serve-6QBXDVWT.js} +42 -38
  211. package/chunks/{server-YPUPFV2O.js → server-5TJJEMVQ.js} +1006 -305
  212. package/chunks/{session-AZFIERIY.js → session-BWEUHKQB.js} +92 -176
  213. package/chunks/{settings-EFQHLTM3.js → settings-O7IUQNRR.js} +45 -41
  214. package/chunks/{shell-FWXWBJ4Q.js → shell-R5L4NQYY.js} +36 -32
  215. package/chunks/{skill-A634MNCD.js → skill-ITEOSNW6.js} +24 -20
  216. package/chunks/{spawnChannel-KKBGGR47.js → spawnChannel-E7NTWSGW.js} +38 -34
  217. package/chunks/{src-BVROLD6N.js → src-FFXGUTNL.js} +303 -237
  218. package/chunks/{standalone-update-ERLA3BDC.js → standalone-update-JCJOXW4P.js} +38 -34
  219. package/chunks/{startInteractiveUI-3VZ23WAY.js → startInteractiveUI-IJSBLZFO.js} +1057 -864
  220. package/chunks/{syntheticOutput-HCUFXSIA.js → syntheticOutput-H7RTI5KL.js} +4 -4
  221. package/chunks/{task-create-RIY5JTFC.js → task-create-7474AJJD.js} +10 -8
  222. package/chunks/{task-list-XBUCV3CO.js → task-list-633HGOIB.js} +6 -6
  223. package/chunks/{task-stop-QDFCCYR5.js → task-stop-MNUGHPIA.js} +3 -3
  224. package/chunks/{task-update-7PXKJQOI.js → task-update-66GQB5LI.js} +10 -8
  225. package/chunks/{team-create-ZZO7QFQ7.js → team-create-OVSZTJZO.js} +44 -40
  226. package/chunks/{team-delete-TNSSE2S5.js → team-delete-BB3CG3QF.js} +6 -6
  227. package/chunks/{team-plan-approval-3BZBJ46K.js → team-plan-approval-SLEVDLT5.js} +41 -37
  228. package/chunks/{theme-manager-FSFWNXFJ.js → theme-manager-V6ZQISHM.js} +37 -33
  229. package/chunks/{todoWrite-OMAIGB6V.js → todoWrite-KRAUN54W.js} +5 -5
  230. package/chunks/{tool-search-VYXAAIDW.js → tool-search-KYIF6C6E.js} +21 -17
  231. package/chunks/{total-session-admission-PSMLQICS.js → total-session-admission-EU77XTL7.js} +42 -38
  232. package/chunks/{trustedFolders-QA3RK2NV.js → trustedFolders-DDEF3ADH.js} +37 -33
  233. package/chunks/{update-relaunch-LNLZFX3J.js → update-relaunch-XEZTDP6K.js} +17 -17
  234. package/chunks/updateCheck-KZ5LZ545.js +89 -0
  235. package/chunks/{useAutoAcceptIndicator-DIWN27LT.js → useAutoAcceptIndicator-47EZERGQ.js} +47 -43
  236. package/chunks/{validateNonInterActiveAuth-LOEOFCAF.js → validateNonInterActiveAuth-J2DM4LWZ.js} +79 -75
  237. package/chunks/{version-HBF2VBLE.js → version-PN7WYXHP.js} +1 -1
  238. package/chunks/{web-fetch-BWGSD2BD.js → web-fetch-WRI5QRFR.js} +100 -42
  239. package/chunks/{web-search-OOHTCVR3.js → web-search-2HCXNAVX.js} +111 -60
  240. package/chunks/{workflow-LJAJBOR4.js → workflow-U5XBPGQZ.js} +48 -43
  241. package/chunks/workspace-providers-status-2T54GIJZ.js +79 -0
  242. package/chunks/{workspace-registration-store-4EHGQW4Y.js → workspace-registration-store-F3V4KBIW.js} +8 -2
  243. package/chunks/{workspace-registry-BKD7VC4Y.js → workspace-registry-U6QVZ5BU.js} +42 -38
  244. package/chunks/{workspace-service-75RHX6KR.js → workspace-service-734D36QD.js} +49 -45
  245. package/chunks/{workspace-skills-status-WBZBZI6A.js → workspace-skills-status-5ABUKOAQ.js} +43 -39
  246. package/chunks/write-file-CIH4I4CS.js +66 -0
  247. package/chunks/{zh-TW-4RR3YHNN.js → zh-TW-BM47YBFH.js} +5 -1
  248. package/chunks/{zh-6ANG2HTL.js → zh-WY5DWYZD.js} +5 -1
  249. package/cli-entry.js +164 -12
  250. package/cli.js +18 -11
  251. package/locales/ca.js +772 -203
  252. package/locales/de.js +8 -2
  253. package/locales/en.js +8 -2
  254. package/locales/fr.js +8 -2
  255. package/locales/ja.js +8 -2
  256. package/locales/pt.js +8 -2
  257. package/locales/ru.js +8 -2
  258. package/locales/zh-TW.js +8 -2
  259. package/locales/zh.js +8 -2
  260. package/package.json +3 -3
  261. package/web-shell/assets/{arc-Buk1besA.js → arc-ByltRugA.js} +1 -1
  262. package/web-shell/assets/{architectureDiagram-3BPJPVTR-B1aUKYDC.js → architectureDiagram-3BPJPVTR-CCRTto5d.js} +1 -1
  263. package/web-shell/assets/{blockDiagram-GPEHLZMM-CRTdg3Zx.js → blockDiagram-GPEHLZMM-Jfy36u1L.js} +1 -1
  264. package/web-shell/assets/{c4Diagram-AAUBKEIU-DFdRMp5g.js → c4Diagram-AAUBKEIU-4d5FfEZ0.js} +1 -1
  265. package/web-shell/assets/channel-4N2UIFcG.js +1 -0
  266. package/web-shell/assets/{chunk-2J33WTMH-4rYQdkEI.js → chunk-2J33WTMH-BPwxCEro.js} +1 -1
  267. package/web-shell/assets/{chunk-4BX2VUAB-Coi-pQJy.js → chunk-4BX2VUAB-jY7ZmJWY.js} +1 -1
  268. package/web-shell/assets/{chunk-55IACEB6-BtBjz02t.js → chunk-55IACEB6-C98HgCsS.js} +1 -1
  269. package/web-shell/assets/{chunk-727SXJPM-CGYOWorl.js → chunk-727SXJPM-cDu-ge-q.js} +1 -1
  270. package/web-shell/assets/{chunk-AQP2D5EJ-CH5AKhqx.js → chunk-AQP2D5EJ-BKdJwxXK.js} +1 -1
  271. package/web-shell/assets/{chunk-FMBD7UC4-Cd50-w85.js → chunk-FMBD7UC4-DnuxqwMu.js} +1 -1
  272. package/web-shell/assets/{chunk-ND2GUHAM-C2wF3KCK.js → chunk-ND2GUHAM-C4fZNPv0.js} +1 -1
  273. package/web-shell/assets/{chunk-QZHKN3VN-pCeRTaWi.js → chunk-QZHKN3VN-Cf4XWOmz.js} +1 -1
  274. package/web-shell/assets/classDiagram-4FO5ZUOK-Q4dYOtsh.js +1 -0
  275. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Q4dYOtsh.js +1 -0
  276. package/web-shell/assets/{cose-bilkent-S5V4N54A-B-_fAB6D.js → cose-bilkent-S5V4N54A-C82mFiqj.js} +1 -1
  277. package/web-shell/assets/{dagre-BM42HDAG-ChSPNHpL.js → dagre-BM42HDAG-Df8KACER.js} +1 -1
  278. package/web-shell/assets/{diagram-2AECGRRQ-BX7cFOF3.js → diagram-2AECGRRQ-EzNs7s_2.js} +1 -1
  279. package/web-shell/assets/{diagram-5GNKFQAL-BQUTW92n.js → diagram-5GNKFQAL-BRLNvreg.js} +1 -1
  280. package/web-shell/assets/{diagram-KO2AKTUF-BkYPh3e4.js → diagram-KO2AKTUF-2HLYHRjC.js} +1 -1
  281. package/web-shell/assets/{diagram-LMA3HP47-Cl6jsNyx.js → diagram-LMA3HP47-DeH0NzSp.js} +1 -1
  282. package/web-shell/assets/{diagram-OG6HWLK6-DRWoHz8n.js → diagram-OG6HWLK6-k5Gn47-G.js} +1 -1
  283. package/web-shell/assets/{erDiagram-TEJ5UH35-CGvFcZco.js → erDiagram-TEJ5UH35-gPHFo79f.js} +1 -1
  284. package/web-shell/assets/{flowDiagram-I6XJVG4X-vms6oVdv.js → flowDiagram-I6XJVG4X-DYBOiTRW.js} +1 -1
  285. package/web-shell/assets/{ganttDiagram-6RSMTGT7-ukT_sfmi.js → ganttDiagram-6RSMTGT7-cxjAuic9.js} +1 -1
  286. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-Bn2ZE2Ut.js → gitGraphDiagram-PVQCEYII-3nPqpmCP.js} +1 -1
  287. package/web-shell/assets/index-B7jzUZ_s.css +5 -0
  288. package/web-shell/assets/{index-wFXp7W68.js → index-Cl8d-1bK.js} +1 -1
  289. package/web-shell/assets/index-gE8OWwj_.js +1197 -0
  290. package/web-shell/assets/{infoDiagram-5YYISTIA-DHJdSi7x.js → infoDiagram-5YYISTIA-Dph21pR5.js} +1 -1
  291. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DOvd2Wph.js → ishikawaDiagram-YF4QCWOH-Cjg1hSaG.js} +1 -1
  292. package/web-shell/assets/{journeyDiagram-JHISSGLW-CH_urMCT.js → journeyDiagram-JHISSGLW-CR-IzvnU.js} +1 -1
  293. package/web-shell/assets/{kanban-definition-UN3LZRKU-FKiBdgbH.js → kanban-definition-UN3LZRKU-BYmuybuC.js} +1 -1
  294. package/web-shell/assets/{linear-0ZVQFVKf.js → linear-CngEEoy8.js} +1 -1
  295. package/web-shell/assets/{mermaid.core-DJ05ZZIK.js → mermaid.core-G6fbZRPf.js} +5 -5
  296. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BPuUhkUm.js → mindmap-definition-RKZ34NQL-BtnqnUwJ.js} +1 -1
  297. package/web-shell/assets/{pieDiagram-4H26LBE5-yLFKcXyG.js → pieDiagram-4H26LBE5-XTq6UHIA.js} +1 -1
  298. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-irWqc1pE.js → quadrantDiagram-W4KKPZXB-D1J5PrsS.js} +1 -1
  299. package/web-shell/assets/{requirementDiagram-4Y6WPE33-B_4uMoIV.js → requirementDiagram-4Y6WPE33-CLcBUy3t.js} +1 -1
  300. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-ciA4GPwk.js → sankeyDiagram-5OEKKPKP-iwKV02_6.js} +1 -1
  301. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CRdZvy0U.js → sequenceDiagram-3UESZ5HK-7NFYQcEX.js} +1 -1
  302. package/web-shell/assets/{stateDiagram-AJRCARHV-DaYIkCCn.js → stateDiagram-AJRCARHV-Bvm4Wih6.js} +1 -1
  303. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-xXU_zO2Z.js +1 -0
  304. package/web-shell/assets/{timeline-definition-PNZ67QCA-oBUKv6iH.js → timeline-definition-PNZ67QCA-B4FZFE9O.js} +1 -1
  305. package/web-shell/assets/{vennDiagram-CIIHVFJN-CGW9Sdmb.js → vennDiagram-CIIHVFJN-CvMBpmtL.js} +1 -1
  306. package/web-shell/assets/{wardley-L42UT6IY-CvwKJOCm.js → wardley-L42UT6IY-E3ag2327.js} +1 -1
  307. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-Ipc260sN.js → wardleyDiagram-YWT4CUSO-BEXWlgxC.js} +1 -1
  308. package/web-shell/assets/{xychartDiagram-2RQKCTM6-D6-CM7pK.js → xychartDiagram-2RQKCTM6-CICK05gI.js} +1 -1
  309. package/web-shell/index.html +2 -2
  310. package/chunks/chunk-ETD6K42I.js +0 -358
  311. package/chunks/chunk-I5NLVPZJ.js +0 -45
  312. package/chunks/chunk-ONWW74X6.js +0 -74639
  313. package/chunks/chunk-W7FJ3N32.js +0 -49
  314. package/chunks/daemon-status-provider-LVTVJGAD.js +0 -77
  315. package/chunks/list-3CZR5I42.js +0 -78
  316. package/chunks/nonInteractiveCli-QTEHDDFH.js +0 -129
  317. package/chunks/updateCheck-JJEUQ54U.js +0 -73
  318. package/chunks/workspace-providers-status-FYV7TTHA.js +0 -75
  319. package/chunks/write-file-M2DTFILF.js +0 -599
  320. package/web-shell/assets/channel-04R0vLbG.js +0 -1
  321. package/web-shell/assets/classDiagram-4FO5ZUOK-Bw9SOwAV.js +0 -1
  322. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-Bw9SOwAV.js +0 -1
  323. package/web-shell/assets/index-DgkKrjw3.js +0 -1187
  324. package/web-shell/assets/index-Rv6mOAN9.css +0 -5
  325. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DWBoO4UY.js +0 -1
  326. package/chunks/{chunk-PEJWA3QQ.js → chunk-QZJY47IE.js} +5 -5
@@ -14,12 +14,12 @@ import {
14
14
  shouldSuppressRememberErrorDetails,
15
15
  workspaceMemoryFailureCode,
16
16
  workspaceMemoryFailureDiagnostics
17
- } from "./chunk-TTSKHF43.js";
17
+ } from "./chunk-4DSBFQMI.js";
18
18
  import {
19
19
  openQwenAsrRealtimeStream,
20
20
  openVoiceStream,
21
21
  openVoiceStreamWithRetry
22
- } from "./chunk-GKY2OJ7R.js";
22
+ } from "./chunk-ZHERRXZJ.js";
23
23
  import {
24
24
  SetupGithubError,
25
25
  collectSessionData,
@@ -30,25 +30,17 @@ import {
30
30
  toJson,
31
31
  toJsonl,
32
32
  toMarkdown
33
- } from "./chunk-FVS747N7.js";
33
+ } from "./chunk-6PRNSLMB.js";
34
34
  import {
35
35
  OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
36
36
  ObservedChannelContactStore
37
- } from "./chunk-KTUQMDEP.js";
37
+ } from "./chunk-4K7VDKAD.js";
38
38
  import "./chunk-RS7MT2QG.js";
39
- import "./chunk-CVDW42JT.js";
39
+ import "./chunk-NNFK277W.js";
40
40
  import "./chunk-H2XVO6NE.js";
41
- import "./chunk-QTERJVPZ.js";
42
41
  import "./chunk-QHTIBUWB.js";
42
+ import "./chunk-QTERJVPZ.js";
43
43
  import "./chunk-L573Z2QZ.js";
44
- import {
45
- createTotalSessionAdmissionController
46
- } from "./chunk-R3VWUU2E.js";
47
- import {
48
- createSingleWorkspaceRegistry,
49
- createWorkspaceSessionOwnerIndex
50
- } from "./chunk-W7H223ZZ.js";
51
- import "./chunk-GRC5HGPI.js";
52
44
  import {
53
45
  CAPABILITIES_SCHEMA_VERSION,
54
46
  CLIENT_ID_HEADER,
@@ -104,42 +96,29 @@ import {
104
96
  setRateLimiter,
105
97
  unsafeRevealSecret,
106
98
  validateMcpRuntimeServerName
107
- } from "./chunk-7YBZGNEC.js";
99
+ } from "./chunk-BKZEHVPV.js";
108
100
  import {
109
101
  isLoopbackBind
110
102
  } from "./chunk-RXFQM6FQ.js";
111
103
  import {
112
104
  createDaemonStatusProvider
113
- } from "./chunk-T7DDD7CZ.js";
105
+ } from "./chunk-RYSMKY43.js";
114
106
  import "./chunk-LXXMOYPL.js";
115
- import "./chunk-7KDI2IB2.js";
107
+ import "./chunk-QSJ6JIF5.js";
116
108
  import "./chunk-E5Z2AVNV.js";
117
- import {
118
- SessionArtifactAuthorizationError,
119
- SessionArtifactValidationError,
120
- createAcpSessionBridge,
121
- parseSessionSource
122
- } from "./chunk-EVSTCA7S.js";
123
- import {
124
- EVENT_SCHEMA_VERSION,
125
- SubscriberLimitExceededError
126
- } from "./chunk-6RLROE6G.js";
127
- import "./chunk-COH43MRJ.js";
128
- import "./chunk-QR6U5QPP.js";
129
- import "./chunk-6GUTHAN7.js";
130
109
  import {
131
110
  createWorkspaceProvidersStatusProvider
132
- } from "./chunk-WKRXIHD6.js";
111
+ } from "./chunk-N5ARKAVE.js";
133
112
  import {
134
113
  getAuthTypeFromEnv,
135
114
  resolveCliGenerationConfig
136
- } from "./chunk-TCKTNY66.js";
115
+ } from "./chunk-TPR35HHZ.js";
137
116
  import {
138
117
  snapshotProcessEnv
139
- } from "./chunk-AR27OPIU.js";
118
+ } from "./chunk-DRIXALGM.js";
140
119
  import {
141
120
  createWorkspaceSkillsStatusProvider
142
- } from "./chunk-5NWV4NFB.js";
121
+ } from "./chunk-AZD6KAV7.js";
143
122
  import "./chunk-2W3OOD4W.js";
144
123
  import {
145
124
  EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
@@ -154,14 +133,14 @@ import {
154
133
  validateWorkspaceSkillName,
155
134
  validateWorkspaceVoiceState,
156
135
  voiceSettingsScopeToWire
157
- } from "./chunk-Y4CRUWFZ.js";
136
+ } from "./chunk-7NDXG4MB.js";
158
137
  import {
159
138
  PermissionRulesValidationError,
160
139
  buildPermissionSettings,
161
140
  isPermissionRuleType,
162
141
  normalizePermissionRules,
163
142
  readPermissionRuleSet
164
- } from "./chunk-WAX3ITOA.js";
143
+ } from "./chunk-5EA5NVXS.js";
165
144
  import {
166
145
  assertVoiceBaseUrlNetworkAllowed,
167
146
  isStreamingVoiceModel,
@@ -169,13 +148,50 @@ import {
169
148
  resolveVoiceTranscriptionConfig,
170
149
  sanitizeVoiceErrorMessage,
171
150
  transcribeVoiceAudio
172
- } from "./chunk-B453NMZJ.js";
151
+ } from "./chunk-EFIOE2EH.js";
173
152
  import {
174
153
  isVoiceEnabled,
175
154
  isVoiceMode,
176
155
  readVoiceModel
177
- } from "./chunk-IB35C3IL.js";
178
- import "./chunk-BVLROR2T.js";
156
+ } from "./chunk-3SXF4GMQ.js";
157
+ import "./chunk-QLJUC7TG.js";
158
+ import {
159
+ WorkspacePermissionRulesSessionRequiredError,
160
+ WorkspaceSettingsPartialPersistError,
161
+ WorkspaceSkillNotFoundError,
162
+ WorkspaceSkillNotToggleableError
163
+ } from "./chunk-OA4JVLSA.js";
164
+ import {
165
+ createTotalSessionAdmissionController
166
+ } from "./chunk-VYPFXUCB.js";
167
+ import {
168
+ createSingleWorkspaceRegistry,
169
+ createWorkspaceSessionOwnerIndex
170
+ } from "./chunk-UGYMA4EI.js";
171
+ import "./chunk-GRC5HGPI.js";
172
+ import {
173
+ daemonObservedContactsPath,
174
+ loadChannelsConfig
175
+ } from "./chunk-4BRH6FP5.js";
176
+ import "./chunk-G6LRTI62.js";
177
+ import "./chunk-57OAHC2Y.js";
178
+ import {
179
+ parseChannelWebhookConfigLenient
180
+ } from "./chunk-QD6BRERJ.js";
181
+ import "./chunk-6ZBPS62S.js";
182
+ import "./chunk-V6WHFGST.js";
183
+ import {
184
+ SessionArtifactAuthorizationError,
185
+ SessionArtifactValidationError,
186
+ createAcpSessionBridge,
187
+ parseSessionSource
188
+ } from "./chunk-R7MPKABX.js";
189
+ import {
190
+ EVENT_SCHEMA_VERSION,
191
+ SubscriberLimitExceededError
192
+ } from "./chunk-6RLROE6G.js";
193
+ import "./chunk-COH43MRJ.js";
194
+ import "./chunk-QR6U5QPP.js";
179
195
  import {
180
196
  BranchWhilePromptActiveError,
181
197
  CancelSentinelCollisionError,
@@ -189,6 +205,7 @@ import {
189
205
  McpServerRestartFailedError,
190
206
  PermissionForbiddenError,
191
207
  PermissionPolicyNotImplementedError,
208
+ PromptDeadlineExceededError,
192
209
  PromptQueueFullError,
193
210
  RestoreInProgressError,
194
211
  SessionArchivedError,
@@ -207,42 +224,13 @@ import {
207
224
  WorkspaceInitRaceError,
208
225
  WorkspaceInitSymlinkError,
209
226
  WorkspaceMismatchError
210
- } from "./chunk-X6YQWCIJ.js";
227
+ } from "./chunk-UH3WSE5L.js";
228
+ import "./chunk-JHFVJQRO.js";
211
229
  import {
212
230
  STATUS_SCHEMA_VERSION,
213
231
  createIdleWorkspaceMemoryStatus,
214
232
  mapDomainErrorToErrorKind
215
- } from "./chunk-WXAXH7IJ.js";
216
- import {
217
- WorkspacePermissionRulesSessionRequiredError,
218
- WorkspaceSettingsPartialPersistError,
219
- WorkspaceSkillNotFoundError,
220
- WorkspaceSkillNotToggleableError
221
- } from "./chunk-OA4JVLSA.js";
222
- import "./chunk-WBL3FJEU.js";
223
- import "./chunk-T2NCM2ET.js";
224
- import {
225
- daemonObservedContactsPath,
226
- loadChannelsConfig
227
- } from "./chunk-KXEGCGUG.js";
228
- import "./chunk-JVTCARQ6.js";
229
- import "./chunk-57OAHC2Y.js";
230
- import {
231
- parseChannelWebhookConfigLenient
232
- } from "./chunk-OMH3276Y.js";
233
- import "./chunk-4ODB7WIB.js";
234
- import "./chunk-V6WHFGST.js";
235
- import {
236
- MAX_REGISTERED_WORKSPACES,
237
- WorkspaceRegistrationStoreCommittedError,
238
- WorkspaceRegistrationStoreLimitError,
239
- workspaceRegistrationId
240
- } from "./chunk-SDXIH6OA.js";
241
- import {
242
- MAX_WORKSPACE_PATH_LENGTH,
243
- canonicalizeWorkspace,
244
- canonicalizeWorkspaces
245
- } from "./chunk-W7FJ3N32.js";
233
+ } from "./chunk-BWQRDISK.js";
246
234
  import {
247
235
  MAX_CHANNEL_STARTUP_FAILURES,
248
236
  MAX_CHANNEL_STARTUP_FAILURE_CHANNEL_LENGTH,
@@ -251,17 +239,18 @@ import {
251
239
  QWEN_SERVER_TOKEN_ENV,
252
240
  isChannelWebhookEnqueueError,
253
241
  normalizeWorkerDiagnostic
254
- } from "./chunk-Y2ENGUD6.js";
242
+ } from "./chunk-QKTHJXCS.js";
255
243
  import {
256
244
  normalizeServeChannelSelection
257
245
  } from "./chunk-TJTKSVIV.js";
258
246
  import {
259
247
  redactLogCredentials
260
248
  } from "./chunk-M5GB774H.js";
261
- import "./chunk-5HBA2Z7V.js";
249
+ import "./chunk-WBL3FJEU.js";
250
+ import "./chunk-T2NCM2ET.js";
262
251
  import {
263
252
  sanitizeLogText
264
- } from "./chunk-NIJEXGV6.js";
253
+ } from "./chunk-RVLZCXEE.js";
265
254
  import "./chunk-UDXSXLER.js";
266
255
  import {
267
256
  getDialogSettingKeys,
@@ -272,20 +261,38 @@ import {
272
261
  getWritableScopes,
273
262
  loadSettings,
274
263
  validateSettingValue
275
- } from "./chunk-KPZNOZPC.js";
264
+ } from "./chunk-7SWFAKVH.js";
276
265
  import "./chunk-RKUWKYED.js";
277
- import "./chunk-GOXKNSDZ.js";
278
- import "./chunk-IDS7MSUP.js";
279
266
  import {
280
- SUPPORTED_LANGUAGES
281
- } from "./chunk-2DXOIVUI.js";
282
- import "./chunk-OF2BBLYQ.js";
267
+ SUPPORTED_LANGUAGES,
268
+ detectSystemLanguage,
269
+ resolveLanguageSetting,
270
+ resolveSupportedLanguage
271
+ } from "./chunk-WCFTQD7H.js";
272
+ import "./chunk-52T5UHAZ.js";
273
+ import "./chunk-GOXKNSDZ.js";
283
274
  import "./chunk-QRUIS3DN.js";
284
- import "./chunk-IUSNI6IX.js";
275
+ import {
276
+ MAX_REGISTERED_WORKSPACES,
277
+ WorkspaceDisplayNameValidationError,
278
+ WorkspaceRegistrationStoreCommittedError,
279
+ WorkspaceRegistrationStoreLimitError,
280
+ normalizeWorkspaceDisplayName,
281
+ workspaceRegistrationId
282
+ } from "./chunk-76OFFG6L.js";
283
+ import {
284
+ MAX_WORKSPACE_PATH_LENGTH,
285
+ canonicalizeWorkspace,
286
+ canonicalizeWorkspaces,
287
+ translateAndCheckAbsoluteWorkspacePath
288
+ } from "./chunk-2RFKHEXL.js";
289
+ import "./chunk-5HBA2Z7V.js";
290
+ import "./chunk-IDS7MSUP.js";
291
+ import "./chunk-27CLX4FV.js";
285
292
  import "./chunk-VJNBRRZG.js";
286
293
  import {
287
294
  getWorkspaceTrustStatus
288
- } from "./chunk-MC2DOZS7.js";
295
+ } from "./chunk-S3YQCNJE.js";
289
296
  import "./chunk-ALGGS7UH.js";
290
297
  import {
291
298
  isWithinRoot as isWithinRoot2
@@ -299,15 +306,19 @@ import {
299
306
  BuiltinAgentRegistry,
300
307
  Client,
301
308
  ClientMcpRegistrar,
309
+ DEFAULT_LOG_LIMIT,
302
310
  ExtensionManager,
303
311
  GROUP_COLOR_OPTIONS,
312
+ GitWorktreeService,
304
313
  IMAGE_CAPABILITY,
305
314
  InvalidSessionTranscriptCursorError,
315
+ MAX_LOG_LIMIT,
306
316
  ModelsConfig,
307
317
  RUNTIME_MCP_IF_ABSENT_CONFIG_FLAG,
308
318
  SESSION_TRANSCRIPT_MAX_INDEX_BYTES,
309
319
  SESSION_TRANSCRIPT_MAX_LIMIT,
310
320
  SESSION_TRANSCRIPT_MAX_PAGE_BYTES,
321
+ SESSION_WRITER_RPC_CODES,
311
322
  SessionOrganizationError,
312
323
  SessionOrganizationService,
313
324
  SessionService,
@@ -316,6 +327,7 @@ import {
316
327
  SessionTranscriptReader,
317
328
  SessionTranscriptSnapshotUnavailableError,
318
329
  SessionTranscriptTooLargeError,
330
+ SessionWriterError,
319
331
  StandardFileSystemService,
320
332
  StdioClientTransport,
321
333
  StreamableHTTPClientTransport,
@@ -326,13 +338,16 @@ import {
326
338
  buildUsageDashboard,
327
339
  detectLineEnding,
328
340
  encodeTextFileContent,
341
+ fetchGitCommitDetail,
329
342
  fetchGitDiff,
330
343
  fetchGitDiffHunksForFile,
344
+ fetchGitLog,
331
345
  getGitWorkingTreeStatus,
332
346
  glob,
333
347
  loadIgnoreRules,
334
348
  loadUsageHistoryWithLive,
335
349
  parseInstallSource,
350
+ readWorktreeSession,
336
351
  redactUrlCredentials,
337
352
  resolveBranchName,
338
353
  resolveProviderProtocol,
@@ -340,16 +355,21 @@ import {
340
355
  stripAnsiAndControl,
341
356
  stripTerminalControlSequences,
342
357
  watchRepoBranch,
343
- writeWorkspaceContextFile
344
- } from "./chunk-6OH6A5EX.js";
345
- import "./chunk-5M6IDOMF.js";
358
+ writeWorkspaceContextFile,
359
+ writeWorktreeSession,
360
+ writeWorktreeSessionMarker
361
+ } from "./chunk-GEB2CGUV.js";
346
362
  import "./chunk-T4TZQJ7W.js";
347
363
  import "./chunk-H6XPXXMH.js";
348
- import "./chunk-OONJNQ42.js";
364
+ import "./chunk-5M6IDOMF.js";
365
+ import "./chunk-T2L47JJK.js";
366
+ import "./chunk-GPSKDNEE.js";
367
+ import "./chunk-X6N25LXS.js";
368
+ import "./chunk-E2UVIFI2.js";
349
369
  import {
350
370
  MAX_JOBS,
351
371
  nextDurableFireMs
352
- } from "./chunk-JDI67JFB.js";
372
+ } from "./chunk-Q2YKNMLS.js";
353
373
  import {
354
374
  nextFireTime,
355
375
  parseCron
@@ -362,24 +382,27 @@ import {
362
382
  readCronTasks,
363
383
  taskHasLegacyCondition,
364
384
  updateCronTasks
365
- } from "./chunk-EIAK6Q2B.js";
366
- import "./chunk-FSL5W5TI.js";
367
- import "./chunk-D2VIDMVM.js";
368
- import "./chunk-E2UVIFI2.js";
369
- import "./chunk-WBTZGWQ6.js";
385
+ } from "./chunk-KHOVYUHX.js";
370
386
  import "./chunk-SZRN75WQ.js";
371
- import "./chunk-HTO4JFDZ.js";
387
+ import "./chunk-6PVPNMXU.js";
388
+ import "./chunk-PIHKWN7M.js";
372
389
  import "./chunk-CPBF7KYF.js";
390
+ import "./chunk-NABLFI57.js";
391
+ import "./chunk-QBUDF33N.js";
392
+ import "./chunk-LIZRAKPB.js";
373
393
  import {
374
394
  APPROVAL_MODES,
375
395
  SubagentError,
376
396
  SubagentErrorCode
377
- } from "./chunk-ETD6K42I.js";
397
+ } from "./chunk-WHGVTP7Q.js";
378
398
  import "./chunk-6AM5D4ME.js";
379
- import "./chunk-G45X5TRN.js";
380
- import "./chunk-PBATSWUQ.js";
381
- import "./chunk-ZEOZL37W.js";
382
- import "./chunk-OOCI5VVU.js";
399
+ import "./chunk-JCW2R7WC.js";
400
+ import "./chunk-57FIIFJN.js";
401
+ import "./chunk-HTO4JFDZ.js";
402
+ import "./chunk-XVNQMZ2I.js";
403
+ import "./chunk-CR3C7WXL.js";
404
+ import "./chunk-FODK6UMO.js";
405
+ import "./chunk-GLNBDYUX.js";
383
406
  import {
384
407
  QwenOAuth2Client,
385
408
  QwenOAuthPollError,
@@ -388,10 +411,12 @@ import {
388
411
  isDeviceAuthorizationSuccess,
389
412
  isDeviceTokenPending,
390
413
  isDeviceTokenSuccess
391
- } from "./chunk-UQES76OO.js";
392
- import "./chunk-OKWRU4NO.js";
393
- import "./chunk-XNP57UDV.js";
414
+ } from "./chunk-TXRKCFWS.js";
394
415
  import "./chunk-JESCGQM3.js";
416
+ import "./chunk-EWXXMRMP.js";
417
+ import "./chunk-PPIHLGNE.js";
418
+ import "./chunk-DJ2GSRLV.js";
419
+ import "./chunk-5I5BM454.js";
395
420
  import {
396
421
  addDaemonRequestAttribute,
397
422
  decodeBufferWithEncodingInfo,
@@ -405,38 +430,35 @@ import {
405
430
  recordDaemonHttpRequest,
406
431
  recordDaemonHttpResponse,
407
432
  withDaemonRequestSpan
408
- } from "./chunk-ONWW74X6.js";
409
- import "./chunk-4WKAA4KS.js";
410
- import "./chunk-CR3C7WXL.js";
433
+ } from "./chunk-5G2SK2OO.js";
411
434
  import "./chunk-VGC4I5JJ.js";
412
- import "./chunk-JD3MKVKL.js";
413
- import "./chunk-UEY4AYUL.js";
414
- import "./chunk-BDBMYST4.js";
415
- import "./chunk-467G3SV5.js";
416
- import "./chunk-S35ZDXOS.js";
417
- import "./chunk-XVNQMZ2I.js";
418
- import "./chunk-FODK6UMO.js";
419
- import "./chunk-GLNBDYUX.js";
420
- import "./chunk-DJ2GSRLV.js";
421
- import "./chunk-6EFTQYW7.js";
422
- import "./chunk-MAQQGNQ5.js";
435
+ import "./chunk-4K56OJFJ.js";
436
+ import "./chunk-JYS55H6Z.js";
423
437
  import "./chunk-A4UCTEB5.js";
424
438
  import "./chunk-XWRJCPHC.js";
439
+ import "./chunk-QNLNLENL.js";
440
+ import "./chunk-6X4GWOPW.js";
425
441
  import "./chunk-TYQMGACW.js";
426
442
  import {
427
443
  import_websocket_server
428
444
  } from "./chunk-TYAMGABM.js";
429
445
  import "./chunk-FCMNKVXT.js";
446
+ import "./chunk-IS2SBY6T.js";
447
+ import "./chunk-HTR4WV6U.js";
448
+ import "./chunk-M7WBGLYP.js";
449
+ import "./chunk-U7ZFW55U.js";
450
+ import "./chunk-NPQDJGKU.js";
451
+ import "./chunk-YM3SZTH4.js";
430
452
  import {
431
453
  FatalConfigError,
432
454
  Storage,
433
455
  createDebugLogger,
434
456
  runWithoutDebugLogSession
435
- } from "./chunk-C27BYUX6.js";
457
+ } from "./chunk-OQB4EXO4.js";
436
458
  import "./chunk-75DOP5OR.js";
437
459
  import "./chunk-DMTGGOSA.js";
438
460
  import "./chunk-YQ3U5MUC.js";
439
- import "./chunk-TB6UDU4T.js";
461
+ import "./chunk-THJNPLI4.js";
440
462
  import {
441
463
  init_esbuild_shims
442
464
  } from "./chunk-5O2XNYP6.js";
@@ -455,7 +477,6 @@ import { createHash as createHash3, timingSafeEqual } from "node:crypto";
455
477
 
456
478
  // packages/cli/src/serve/acp-http/dispatch.ts
457
479
  init_esbuild_shims();
458
- import path9 from "node:path";
459
480
 
460
481
  // packages/cli/src/serve/fs/errors.ts
461
482
  init_esbuild_shims();
@@ -1746,17 +1767,17 @@ var WorkspaceFileSystemImpl = class {
1746
1767
  * for their `sendFsError` serializer.
1747
1768
  */
1748
1769
  recordAndWrap(err, intent, input) {
1749
- const fs3 = wrapAsFsError(err);
1770
+ const fs5 = wrapAsFsError(err);
1750
1771
  this.deps.audit.recordDenied(this.deps.ctx, {
1751
1772
  intent,
1752
1773
  input,
1753
- errorKind: fs3.kind,
1754
- hint: fs3.hint,
1774
+ errorKind: fs5.kind,
1775
+ hint: fs5.hint,
1755
1776
  // Quote the underlying OS / FsError message so audit
1756
1777
  // consumers debugging a production incident can see the
1757
1778
  // actual cause (errno text, byte counts, glob pattern,
1758
1779
  // etc.) rather than just `errorKind` + `hint`.
1759
- message: fs3.message,
1780
+ message: fs5.message,
1760
1781
  // For glob denials (parse_error pattern rejection,
1761
1782
  // catastrophic walk failures) the input IS the pattern
1762
1783
  // already; surfacing it on the dedicated `pattern` field
@@ -1765,7 +1786,7 @@ var WorkspaceFileSystemImpl = class {
1765
1786
  // branching on intent.
1766
1787
  pattern: intent === "glob" ? input : void 0
1767
1788
  });
1768
- return fs3;
1789
+ return fs5;
1769
1790
  }
1770
1791
  };
1771
1792
  var CONTENT_HASH_RE = /^sha256:[0-9a-f]{64}$/;
@@ -2247,7 +2268,7 @@ async function renameWithRetryLocal(src, dest, retries, delayMs) {
2247
2268
  const retryable = code === "EPERM" || code === "EACCES";
2248
2269
  if (!retryable || attempt === retries) throw err;
2249
2270
  await new Promise(
2250
- (resolve5) => setTimeout(resolve5, delayMs * 2 ** attempt)
2271
+ (resolve6) => setTimeout(resolve6, delayMs * 2 ** attempt)
2251
2272
  );
2252
2273
  }
2253
2274
  }
@@ -2502,12 +2523,12 @@ __name(applyReadHeaders, "applyReadHeaders");
2502
2523
  function sendFsError(res, err, route) {
2503
2524
  applyReadHeaders(res);
2504
2525
  if (isFsError(err)) {
2505
- const fs3 = err;
2506
- res.status(fs3.status).json({
2507
- errorKind: fs3.kind,
2508
- error: fs3.message,
2509
- hint: fs3.hint,
2510
- status: fs3.status
2526
+ const fs5 = err;
2527
+ res.status(fs5.status).json({
2528
+ errorKind: fs5.kind,
2529
+ error: fs5.message,
2530
+ hint: fs5.hint,
2531
+ status: fs5.status
2511
2532
  });
2512
2533
  return;
2513
2534
  }
@@ -2609,13 +2630,13 @@ async function handleGetFile(req, res, deps) {
2609
2630
  });
2610
2631
  return;
2611
2632
  }
2612
- const fs3 = factory.forRequest({
2633
+ const fs5 = factory.forRequest({
2613
2634
  originatorClientId: clientId ?? void 0,
2614
2635
  route: ROUTE2
2615
2636
  });
2616
2637
  try {
2617
- const resolved = await fs3.resolve(queryPath, "read");
2618
- const out = await fs3.readText(resolved, { maxBytes, line, limit });
2638
+ const resolved = await fs5.resolve(queryPath, "read");
2639
+ const out = await fs5.readText(resolved, { maxBytes, line, limit });
2619
2640
  const returnedBytes = Buffer.byteLength(out.content, "utf-8");
2620
2641
  applyReadHeaders(res);
2621
2642
  res.status(200).json({
@@ -2669,13 +2690,13 @@ async function handleGetFileBytes(req, res, deps) {
2669
2690
  });
2670
2691
  return;
2671
2692
  }
2672
- const fs3 = factory.forRequest({
2693
+ const fs5 = factory.forRequest({
2673
2694
  originatorClientId: clientId ?? void 0,
2674
2695
  route: ROUTE2
2675
2696
  });
2676
2697
  try {
2677
- const resolved = await fs3.resolve(queryPath, "read");
2678
- const out = await fs3.readBytesWindow(resolved, {
2698
+ const resolved = await fs5.resolve(queryPath, "read");
2699
+ const out = await fs5.readBytesWindow(resolved, {
2679
2700
  offset: offset ?? 0,
2680
2701
  maxBytes: maxBytes ?? DEFAULT_FILE_BYTES_MAX_BYTES
2681
2702
  });
@@ -2703,13 +2724,13 @@ async function handleGetStat(req, res, deps) {
2703
2724
  if (clientId === null) return;
2704
2725
  const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
2705
2726
  if (queryPath === null) return;
2706
- const fs3 = factory.forRequest({
2727
+ const fs5 = factory.forRequest({
2707
2728
  originatorClientId: clientId ?? void 0,
2708
2729
  route: ROUTE2
2709
2730
  });
2710
2731
  try {
2711
- const resolved = await fs3.resolve(queryPath, "stat");
2712
- const st = await fs3.stat(resolved);
2732
+ const resolved = await fs5.resolve(queryPath, "stat");
2733
+ const st = await fs5.stat(resolved);
2713
2734
  applyReadHeaders(res);
2714
2735
  res.status(200).json({
2715
2736
  kind: "stat",
@@ -2732,13 +2753,13 @@ async function handleGetList(req, res, deps) {
2732
2753
  const queryPath = requireStringQuery(res, req.query["path"], "path", ROUTE2);
2733
2754
  if (queryPath === null) return;
2734
2755
  const includeIgnored = parseBoolFlag(req.query["includeIgnored"]);
2735
- const fs3 = factory.forRequest({
2756
+ const fs5 = factory.forRequest({
2736
2757
  originatorClientId: clientId ?? void 0,
2737
2758
  route: ROUTE2
2738
2759
  });
2739
2760
  try {
2740
- const resolved = await fs3.resolve(queryPath, "list");
2741
- const entries = await fs3.list(resolved, {
2761
+ const resolved = await fs5.resolve(queryPath, "list");
2762
+ const entries = await fs5.list(resolved, {
2742
2763
  includeIgnored,
2743
2764
  maxEntries: MAX_LIST_ENTRIES + 1
2744
2765
  });
@@ -2791,15 +2812,15 @@ async function handleGetGlob(req, res, deps) {
2791
2812
  }
2792
2813
  const cwdRaw = req.query["cwd"];
2793
2814
  const cwdString = typeof cwdRaw === "string" && cwdRaw.length > 0 ? cwdRaw : void 0;
2794
- const fs3 = factory.forRequest({
2815
+ const fs5 = factory.forRequest({
2795
2816
  originatorClientId: clientId ?? void 0,
2796
2817
  route: ROUTE2
2797
2818
  });
2798
2819
  const start = performance.now();
2799
2820
  try {
2800
- const cwdResolved = cwdString ? await fs3.resolve(cwdString, "list") : void 0;
2821
+ const cwdResolved = cwdString ? await fs5.resolve(cwdString, "list") : void 0;
2801
2822
  const cap = maxResults ?? DEFAULT_GLOB_MAX_RESULTS;
2802
- const probe = await fs3.glob(pattern, {
2823
+ const probe = await fs5.glob(pattern, {
2803
2824
  cwd: cwdResolved,
2804
2825
  includeIgnored,
2805
2826
  maxResults: cap + 1
@@ -2861,7 +2882,7 @@ function registerWorkspaceFileReadRoutes(app, deps) {
2861
2882
  }
2862
2883
  __name(registerWorkspaceFileReadRoutes, "registerWorkspaceFileReadRoutes");
2863
2884
  function registerWorkspaceQualifiedFileReadRoutes(app, deps) {
2864
- const resolve5 = /* @__PURE__ */ __name((req, res) => {
2885
+ const resolve6 = /* @__PURE__ */ __name((req, res) => {
2865
2886
  const runtime = resolveWorkspaceRuntimeFromParam(
2866
2887
  deps.workspaceRegistry,
2867
2888
  req,
@@ -2875,23 +2896,23 @@ function registerWorkspaceQualifiedFileReadRoutes(app, deps) {
2875
2896
  return true;
2876
2897
  }, "resolve");
2877
2898
  app.get("/workspaces/:workspace/file", (req, res) => {
2878
- if (!resolve5(req, res)) return;
2899
+ if (!resolve6(req, res)) return;
2879
2900
  void handleGetFile(req, res, deps);
2880
2901
  });
2881
2902
  app.get("/workspaces/:workspace/file/bytes", (req, res) => {
2882
- if (!resolve5(req, res)) return;
2903
+ if (!resolve6(req, res)) return;
2883
2904
  void handleGetFileBytes(req, res, deps);
2884
2905
  });
2885
2906
  app.get("/workspaces/:workspace/stat", (req, res) => {
2886
- if (!resolve5(req, res)) return;
2907
+ if (!resolve6(req, res)) return;
2887
2908
  void handleGetStat(req, res, deps);
2888
2909
  });
2889
2910
  app.get("/workspaces/:workspace/list", (req, res) => {
2890
- if (!resolve5(req, res)) return;
2911
+ if (!resolve6(req, res)) return;
2891
2912
  void handleGetList(req, res, deps);
2892
2913
  });
2893
2914
  app.get("/workspaces/:workspace/glob", (req, res) => {
2894
- if (!resolve5(req, res)) return;
2915
+ if (!resolve6(req, res)) return;
2895
2916
  void handleGetGlob(req, res, deps);
2896
2917
  });
2897
2918
  }
@@ -2973,7 +2994,7 @@ function validateClientId(clientId, deps, res) {
2973
2994
  }
2974
2995
  __name(validateClientId, "validateClientId");
2975
2996
  function createSetupGithubFileOps(factory, route, originatorClientId) {
2976
- const fs3 = factory.forRequest({
2997
+ const fs5 = factory.forRequest({
2977
2998
  route,
2978
2999
  ...originatorClientId ? { originatorClientId } : {}
2979
3000
  });
@@ -2996,14 +3017,14 @@ function createSetupGithubFileOps(factory, route, originatorClientId) {
2996
3017
  ]);
2997
3018
  },
2998
3019
  async writeTextFile(_gitRepoRoot, relativePath, content) {
2999
- const resolved = await fs3.resolve(relativePath, "write");
3000
- const out = await fs3.writeTextOverwrite(resolved, content);
3020
+ const resolved = await fs5.resolve(relativePath, "write");
3021
+ const out = await fs5.writeTextOverwrite(resolved, content);
3001
3022
  return { sizeBytes: out.sizeBytes };
3002
3023
  },
3003
3024
  async readTextFile(_gitRepoRoot, relativePath) {
3004
3025
  try {
3005
- const resolved = await fs3.resolve(relativePath, "read");
3006
- const out = await fs3.readText(resolved);
3026
+ const resolved = await fs5.resolve(relativePath, "read");
3027
+ const out = await fs5.readText(resolved);
3007
3028
  return out.content;
3008
3029
  } catch (error2) {
3009
3030
  if (isFsError(error2) && error2.kind === "path_not_found") {
@@ -6563,6 +6584,43 @@ function errMsg(err) {
6563
6584
  return err instanceof Error ? err.message : String(err);
6564
6585
  }
6565
6586
  __name(errMsg, "errMsg");
6587
+ var SESSION_WRITER_RPC_ERRORS = {
6588
+ session_writer_conflict: {
6589
+ code: SESSION_WRITER_RPC_CODES.session_writer_conflict,
6590
+ message: "This session is already open in another Qwen process."
6591
+ },
6592
+ session_writer_lost: {
6593
+ code: SESSION_WRITER_RPC_CODES.session_writer_lost,
6594
+ message: "Write ownership for this session was lost."
6595
+ },
6596
+ session_transcript_changed: {
6597
+ code: SESSION_WRITER_RPC_CODES.session_transcript_changed,
6598
+ message: "The session transcript changed outside its active writer."
6599
+ },
6600
+ session_writer_unavailable: {
6601
+ code: SESSION_WRITER_RPC_CODES.session_writer_unavailable,
6602
+ message: "Session write ownership could not be verified."
6603
+ }
6604
+ };
6605
+ function sessionWriterRpcError(err) {
6606
+ if (!err || typeof err !== "object") return void 0;
6607
+ const candidate = err;
6608
+ const data = isObject(candidate["data"]) ? candidate["data"] : void 0;
6609
+ const errorKind = data?.["errorKind"] ?? candidate["errorKind"];
6610
+ if (typeof errorKind !== "string" || !(errorKind in SESSION_WRITER_RPC_ERRORS)) {
6611
+ return void 0;
6612
+ }
6613
+ const typedKind = errorKind;
6614
+ const expected = SESSION_WRITER_RPC_ERRORS[typedKind];
6615
+ const code = candidate["code"] ?? candidate["rpcCode"];
6616
+ if (code !== expected.code) return void 0;
6617
+ return {
6618
+ code: expected.code,
6619
+ message: expected.message,
6620
+ data: { errorKind: typedKind }
6621
+ };
6622
+ }
6623
+ __name(sessionWriterRpcError, "sessionWriterRpcError");
6566
6624
  var debugLogger2 = createDebugLogger("ACP_HTTP_DISPATCH");
6567
6625
  var SESSION_SHELL_METHOD = `${QWEN_METHOD_NS}session/shell`;
6568
6626
  var INVALID_PERMISSION_OUTCOME_ERROR = '`outcome` must be `{ outcome: "cancelled" }` or `{ outcome: "selected", optionId: string }`';
@@ -6695,10 +6753,11 @@ function parseOptionalWorkspaceCwd2(params, boundWorkspace) {
6695
6753
  `\`cwd\` exceeds the ${MAX_WORKSPACE_PATH_LENGTH}-character limit`
6696
6754
  );
6697
6755
  }
6698
- if (!path9.isAbsolute(cwd)) {
6756
+ const sandboxCwd = translateAndCheckAbsoluteWorkspacePath(cwd);
6757
+ if (sandboxCwd === null) {
6699
6758
  throw new AcpParamError("`cwd` must be an absolute path when provided");
6700
6759
  }
6701
- return cwd;
6760
+ return sandboxCwd;
6702
6761
  }
6703
6762
  __name(parseOptionalWorkspaceCwd2, "parseOptionalWorkspaceCwd");
6704
6763
  function validatePrompt(params) {
@@ -6775,6 +6834,8 @@ function pickSessionArtifactInput(params) {
6775
6834
  }
6776
6835
  __name(pickSessionArtifactInput, "pickSessionArtifactInput");
6777
6836
  function toRpcError(err) {
6837
+ const writerError = sessionWriterRpcError(err);
6838
+ if (writerError) return writerError;
6778
6839
  if (err instanceof AcpParamError || err instanceof InvalidCursorError) {
6779
6840
  return { code: RPC.INVALID_PARAMS, message: err.message };
6780
6841
  }
@@ -7511,22 +7572,21 @@ var AcpDispatcher = class {
7511
7572
  conn.ownedSessions.delete(sessionId);
7512
7573
  conn.closingSessions.add(sessionId);
7513
7574
  let closeStarted = false;
7514
- const closeSession = /* @__PURE__ */ __name(async () => {
7515
- closeStarted = true;
7575
+ const closeLocalSessionStream = /* @__PURE__ */ __name(() => {
7516
7576
  try {
7517
- await this.bridge.closeSession(
7518
- sessionId,
7519
- this.sessionCtx(conn, sessionId, loopback)
7577
+ conn.closeSessionStream(sessionId);
7578
+ } catch (teardownErr) {
7579
+ writeStderrLine(
7580
+ `qwen serve: /acp session/close local teardown failed (${logSafe(sessionId)}): ${logSafe(errMsg(teardownErr))}`
7520
7581
  );
7521
- } finally {
7522
- try {
7523
- conn.closeSessionStream(sessionId);
7524
- } catch (teardownErr) {
7525
- writeStderrLine(
7526
- `qwen serve: /acp session/close local teardown failed (${logSafe(sessionId)}): ${logSafe(errMsg(teardownErr))}`
7527
- );
7528
- }
7529
7582
  }
7583
+ }, "closeLocalSessionStream");
7584
+ const closeSession = /* @__PURE__ */ __name(async () => {
7585
+ closeStarted = true;
7586
+ await this.bridge.closeSession(
7587
+ sessionId,
7588
+ this.sessionCtx(conn, sessionId, loopback)
7589
+ );
7530
7590
  }, "closeSession");
7531
7591
  try {
7532
7592
  try {
@@ -7548,11 +7608,19 @@ var AcpDispatcher = class {
7548
7608
  } catch (err) {
7549
7609
  if (!closeStarted) {
7550
7610
  conn.ownedSessions.add(sessionId);
7611
+ } else {
7612
+ try {
7613
+ this.bridge.getSessionSummary(sessionId);
7614
+ conn.ownedSessions.add(sessionId);
7615
+ } catch {
7616
+ closeLocalSessionStream();
7617
+ }
7551
7618
  }
7552
7619
  throw err;
7553
7620
  } finally {
7554
7621
  conn.closingSessions.delete(sessionId);
7555
7622
  }
7623
+ closeLocalSessionStream();
7556
7624
  this.replyConn(conn, id, {});
7557
7625
  return;
7558
7626
  }
@@ -8977,7 +9045,7 @@ var AcpDispatcher = class {
8977
9045
  );
8978
9046
  return;
8979
9047
  }
8980
- const fs3 = this.fsFactory.forRequest({
9048
+ const fs5 = this.fsFactory.forRequest({
8981
9049
  originatorClientId: conn.clientId,
8982
9050
  route: `ACP ${method}`
8983
9051
  });
@@ -9029,8 +9097,8 @@ var AcpDispatcher = class {
9029
9097
  );
9030
9098
  return;
9031
9099
  }
9032
- const resolved = await fs3.resolve(p, "read");
9033
- const out = await fs3.readText(resolved, { maxBytes, line, limit });
9100
+ const resolved = await fs5.resolve(p, "read");
9101
+ const out = await fs5.readText(resolved, { maxBytes, line, limit });
9034
9102
  this.replyConn(conn, id, {
9035
9103
  path: p,
9036
9104
  content: out.content,
@@ -9052,7 +9120,7 @@ var AcpDispatcher = class {
9052
9120
  conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
9053
9121
  return;
9054
9122
  }
9055
- const fs3 = this.fsFactory.forRequest({
9123
+ const fs5 = this.fsFactory.forRequest({
9056
9124
  originatorClientId: conn.clientId,
9057
9125
  route: `ACP ${method}`
9058
9126
  });
@@ -9088,8 +9156,8 @@ var AcpDispatcher = class {
9088
9156
  );
9089
9157
  return;
9090
9158
  }
9091
- const resolved = await fs3.resolve(p, "read");
9092
- const buf = await fs3.readBytesWindow(resolved, { offset, maxBytes });
9159
+ const resolved = await fs5.resolve(p, "read");
9160
+ const buf = await fs5.readBytesWindow(resolved, { offset, maxBytes });
9093
9161
  this.replyConn(conn, id, { path: p, ...buf });
9094
9162
  return;
9095
9163
  }
@@ -9107,12 +9175,12 @@ var AcpDispatcher = class {
9107
9175
  conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
9108
9176
  return;
9109
9177
  }
9110
- const fs3 = this.fsFactory.forRequest({
9178
+ const fs5 = this.fsFactory.forRequest({
9111
9179
  originatorClientId: conn.clientId,
9112
9180
  route: `ACP ${method}`
9113
9181
  });
9114
- const resolved = await fs3.resolve(p, "read");
9115
- const result = await fs3.stat(resolved);
9182
+ const resolved = await fs5.resolve(p, "read");
9183
+ const result = await fs5.stat(resolved);
9116
9184
  this.replyConn(conn, id, { path: p, ...result });
9117
9185
  return;
9118
9186
  }
@@ -9130,13 +9198,13 @@ var AcpDispatcher = class {
9130
9198
  conn.sendConn(error(id, RPC.INVALID_PARAMS, "`path` required"));
9131
9199
  return;
9132
9200
  }
9133
- const fs3 = this.fsFactory.forRequest({
9201
+ const fs5 = this.fsFactory.forRequest({
9134
9202
  originatorClientId: conn.clientId,
9135
9203
  route: `ACP ${method}`
9136
9204
  });
9137
- const resolved = await fs3.resolve(p, "read");
9205
+ const resolved = await fs5.resolve(p, "read");
9138
9206
  const MAX_LIST = 2e3;
9139
- const entries = await fs3.list(resolved, { maxEntries: MAX_LIST + 1 });
9207
+ const entries = await fs5.list(resolved, { maxEntries: MAX_LIST + 1 });
9140
9208
  const truncated = entries.length > MAX_LIST;
9141
9209
  this.replyConn(conn, id, {
9142
9210
  path: p,
@@ -9161,7 +9229,7 @@ var AcpDispatcher = class {
9161
9229
  );
9162
9230
  return;
9163
9231
  }
9164
- const fs3 = this.fsFactory.forRequest({
9232
+ const fs5 = this.fsFactory.forRequest({
9165
9233
  originatorClientId: conn.clientId,
9166
9234
  route: `ACP ${method}`
9167
9235
  });
@@ -9181,7 +9249,7 @@ var AcpDispatcher = class {
9181
9249
  );
9182
9250
  return;
9183
9251
  }
9184
- const matches = await fs3.glob(pattern, {
9252
+ const matches = await fs5.glob(pattern, {
9185
9253
  maxResults: maxResults + 1
9186
9254
  });
9187
9255
  const truncated = matches.length > maxResults;
@@ -9213,11 +9281,11 @@ var AcpDispatcher = class {
9213
9281
  );
9214
9282
  return;
9215
9283
  }
9216
- const fs3 = this.fsFactory.forRequest({
9284
+ const fs5 = this.fsFactory.forRequest({
9217
9285
  originatorClientId: conn.clientId,
9218
9286
  route: `ACP ${method}`
9219
9287
  });
9220
- const resolved = await fs3.resolve(p, "write");
9288
+ const resolved = await fs5.resolve(p, "write");
9221
9289
  if (Buffer.byteLength(params["content"], "utf8") > 10 * 1024 * 1024) {
9222
9290
  if (id !== void 0)
9223
9291
  conn.sendConn(
@@ -9225,7 +9293,7 @@ var AcpDispatcher = class {
9225
9293
  );
9226
9294
  return;
9227
9295
  }
9228
- await fs3.writeTextOverwrite(resolved, params["content"]);
9296
+ await fs5.writeTextOverwrite(resolved, params["content"]);
9229
9297
  this.replyConn(conn, id, { ok: true, path: p });
9230
9298
  return;
9231
9299
  }
@@ -9254,12 +9322,12 @@ var AcpDispatcher = class {
9254
9322
  );
9255
9323
  return;
9256
9324
  }
9257
- const fs3 = this.fsFactory.forRequest({
9325
+ const fs5 = this.fsFactory.forRequest({
9258
9326
  originatorClientId: conn.clientId,
9259
9327
  route: `ACP ${method}`
9260
9328
  });
9261
- const resolved = await fs3.resolve(p, "write");
9262
- const result = await fs3.edit(
9329
+ const resolved = await fs5.resolve(p, "write");
9330
+ const result = await fs5.edit(
9263
9331
  resolved,
9264
9332
  params["oldText"],
9265
9333
  params["newText"]
@@ -10802,9 +10870,9 @@ var SseStream = class {
10802
10870
  return next;
10803
10871
  }
10804
10872
  doWrite(chunk) {
10805
- return new Promise((resolve5, reject) => {
10873
+ return new Promise((resolve6, reject) => {
10806
10874
  if (this.closed || this.res.writableEnded) {
10807
- resolve5();
10875
+ resolve6();
10808
10876
  return;
10809
10877
  }
10810
10878
  let ok;
@@ -10815,7 +10883,7 @@ var SseStream = class {
10815
10883
  return;
10816
10884
  }
10817
10885
  if (ok) {
10818
- resolve5();
10886
+ resolve6();
10819
10887
  return;
10820
10888
  }
10821
10889
  const cleanup = /* @__PURE__ */ __name(() => {
@@ -10825,11 +10893,11 @@ var SseStream = class {
10825
10893
  }, "cleanup");
10826
10894
  const onDrain = /* @__PURE__ */ __name(() => {
10827
10895
  cleanup();
10828
- resolve5();
10896
+ resolve6();
10829
10897
  }, "onDrain");
10830
10898
  const onCloseEv = /* @__PURE__ */ __name(() => {
10831
10899
  cleanup();
10832
- resolve5();
10900
+ resolve6();
10833
10901
  }, "onCloseEv");
10834
10902
  const onErrorEv = /* @__PURE__ */ __name((err) => {
10835
10903
  cleanup();
@@ -10891,14 +10959,14 @@ var WsStream = class {
10891
10959
  send(message, _id) {
10892
10960
  const data = JSON.stringify(message);
10893
10961
  const next = this.writeChain.then(
10894
- () => new Promise((resolve5, reject) => {
10962
+ () => new Promise((resolve6, reject) => {
10895
10963
  if (this._closed) {
10896
- resolve5();
10964
+ resolve6();
10897
10965
  return;
10898
10966
  }
10899
10967
  this.ws.send(data, (err) => {
10900
10968
  if (err) reject(err);
10901
- else resolve5();
10969
+ else resolve6();
10902
10970
  });
10903
10971
  })
10904
10972
  );
@@ -11203,7 +11271,7 @@ var CdpReverseLink = class {
11203
11271
  throw { code: -32e3, message: "CDP tunnel closed" };
11204
11272
  }
11205
11273
  await this.attach();
11206
- return new Promise((resolve5, reject) => {
11274
+ return new Promise((resolve6, reject) => {
11207
11275
  if (this.disposed) {
11208
11276
  reject({ code: -32e3, message: "CDP tunnel closed" });
11209
11277
  return;
@@ -11214,7 +11282,7 @@ var CdpReverseLink = class {
11214
11282
  `CDP command id=${id} method=${method} timed out after ${this.commandTimeoutMs}ms`
11215
11283
  );
11216
11284
  const progressTimer = this.armProgressLog(id, method);
11217
- this.pending.set(id, { resolve: resolve5, reject, timer, progressTimer });
11285
+ this.pending.set(id, { resolve: resolve6, reject, timer, progressTimer });
11218
11286
  try {
11219
11287
  this.log?.(
11220
11288
  `qwen serve: /cdp forwarded command id=${id} method=${method} to extension`
@@ -11241,7 +11309,7 @@ var CdpReverseLink = class {
11241
11309
  if (this.attached) return Promise.resolve({});
11242
11310
  if (this.attachPromise) return this.attachPromise;
11243
11311
  this.attachPromise = new Promise(
11244
- (resolve5, reject) => {
11312
+ (resolve6, reject) => {
11245
11313
  if (this.disposed) {
11246
11314
  reject({ code: -32e3, message: "CDP tunnel closed" });
11247
11315
  return;
@@ -11251,7 +11319,7 @@ var CdpReverseLink = class {
11251
11319
  this.pendingAttach = {
11252
11320
  id,
11253
11321
  pending: {
11254
- resolve: /* @__PURE__ */ __name((result) => resolve5(result ?? {}), "resolve"),
11322
+ resolve: /* @__PURE__ */ __name((result) => resolve6(result ?? {}), "resolve"),
11255
11323
  reject,
11256
11324
  timer
11257
11325
  }
@@ -11819,7 +11887,7 @@ function isAcpChannelUnavailable(err) {
11819
11887
  }
11820
11888
  __name(isAcpChannelUnavailable, "isAcpChannelUnavailable");
11821
11889
  function delay(ms) {
11822
- return new Promise((resolve5) => setTimeout(resolve5, ms));
11890
+ return new Promise((resolve6) => setTimeout(resolve6, ms));
11823
11891
  }
11824
11892
  __name(delay, "delay");
11825
11893
  function buildChromeDevToolsMcpRuntimeConfig(localPort, hostname, env) {
@@ -13700,7 +13768,7 @@ var CdpTunnelRegistry = class {
13700
13768
  // packages/cli/src/serve/web-shell-static.ts
13701
13769
  init_esbuild_shims();
13702
13770
  var import_express2 = __toESM(require_express(), 1);
13703
- import * as path10 from "node:path";
13771
+ import * as path9 from "node:path";
13704
13772
  var WEB_SHELL_CSP_DIRECTIVES = [
13705
13773
  "default-src 'self'",
13706
13774
  "script-src 'self' 'unsafe-inline' 'unsafe-eval' 'wasm-unsafe-eval'",
@@ -13728,7 +13796,7 @@ function isDocumentNavigation(req) {
13728
13796
  }
13729
13797
  __name(isDocumentNavigation, "isDocumentNavigation");
13730
13798
  function createSendIndex(webShellDir, frameAncestors = []) {
13731
- const indexPath = path10.join(webShellDir, "index.html");
13799
+ const indexPath = path9.join(webShellDir, "index.html");
13732
13800
  const csp = buildWebShellCsp(frameAncestors);
13733
13801
  return (res) => {
13734
13802
  res.status(200).set("Content-Security-Policy", csp).set("X-Content-Type-Options", "nosniff").set("Referrer-Policy", "no-referrer").set(
@@ -13764,7 +13832,7 @@ function mountWebShellAssets(app, webShellDir, frameAncestors = []) {
13764
13832
  const sendIndex = createSendIndex(webShellDir, frameAncestors);
13765
13833
  app.use(
13766
13834
  "/assets",
13767
- import_express2.default.static(path10.join(webShellDir, "assets"), {
13835
+ import_express2.default.static(path9.join(webShellDir, "assets"), {
13768
13836
  index: false,
13769
13837
  immutable: true,
13770
13838
  maxAge: "1y"
@@ -15109,7 +15177,7 @@ function createFifoTaskQueue(limit) {
15109
15177
  Promise.resolve().then(() => item.task(release)).then(item.resolve, item.reject).finally(release);
15110
15178
  }
15111
15179
  }, "pump");
15112
- const enqueue = /* @__PURE__ */ __name((task, options = {}) => new Promise((resolve5, reject) => {
15180
+ const enqueue = /* @__PURE__ */ __name((task, options = {}) => new Promise((resolve6, reject) => {
15113
15181
  if (options.signal?.aborted) {
15114
15182
  reject(abortReason(options.signal));
15115
15183
  return;
@@ -15118,7 +15186,7 @@ function createFifoTaskQueue(limit) {
15118
15186
  task,
15119
15187
  ...options.signal ? { signal: options.signal } : {},
15120
15188
  ...options.onStart ? { onStart: options.onStart } : {},
15121
- resolve: resolve5,
15189
+ resolve: resolve6,
15122
15190
  reject
15123
15191
  };
15124
15192
  if (options.signal) {
@@ -15160,6 +15228,14 @@ var redactExtensionDisplaySource = /* @__PURE__ */ __name((source) => {
15160
15228
  var EXTENSION_PREPARATION_CONCURRENCY = 2;
15161
15229
  var EXTENSION_REFRESH_TIMEOUT_MS = 3e4;
15162
15230
  var RECONCILE_SLOW_MS = 3e4;
15231
+ var resolveExtensionLocale = /* @__PURE__ */ __name((workspaceDir) => {
15232
+ const configuredLanguage = loadSettings(workspaceDir).merged.general?.language;
15233
+ const requestedLocale = resolveLanguageSetting(configuredLanguage);
15234
+ if (requestedLocale === "auto") {
15235
+ return detectSystemLanguage();
15236
+ }
15237
+ return resolveSupportedLanguage(requestedLocale) ?? requestedLocale;
15238
+ }, "resolveExtensionLocale");
15163
15239
  var EXTENSION_QUEUE_FULL_MESSAGE = "Extension operation queue is full";
15164
15240
  function createExtensionsController(deps) {
15165
15241
  const { boundWorkspace, bridge, workspace } = deps;
@@ -15187,6 +15263,7 @@ function createExtensionsController(deps) {
15187
15263
  }, "acquireOperationSlot");
15188
15264
  const createExtensionManager = /* @__PURE__ */ __name((workspaceDir = boundWorkspace, trustedOverride, interactions) => new ExtensionManager({
15189
15265
  workspaceDir,
15266
+ locale: resolveExtensionLocale(workspaceDir),
15190
15267
  isWorkspaceTrusted: trustedOverride ?? getWorkspaceTrustStatus(loadSettings(workspaceDir).merged, workspaceDir).effective.state === "trusted",
15191
15268
  requestConsent: /* @__PURE__ */ __name(() => Promise.resolve(), "requestConsent"),
15192
15269
  networkPolicy: "public",
@@ -15714,8 +15791,9 @@ function createExtensionsController(deps) {
15714
15791
  })();
15715
15792
  }, "runQueuedExtensionMutation");
15716
15793
  const buildLocalExtensionsStatus = /* @__PURE__ */ __name(async () => {
15794
+ const locale = resolveExtensionLocale(boundWorkspace);
15717
15795
  const now = Date.now();
15718
- if (extensionsStatusCache && extensionsStatusCache.expiresAt > now) {
15796
+ if (extensionsStatusCache?.locale === locale && extensionsStatusCache.expiresAt > now) {
15719
15797
  return extensionsStatusCache.value;
15720
15798
  }
15721
15799
  const extensionManager = createExtensionManager();
@@ -15771,6 +15849,7 @@ function createExtensionsController(deps) {
15771
15849
  extensions: entries
15772
15850
  };
15773
15851
  extensionsStatusCache = {
15852
+ locale,
15774
15853
  expiresAt: Date.now() + 2e3,
15775
15854
  value: status
15776
15855
  };
@@ -15939,7 +16018,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
15939
16018
  ...interaction,
15940
16019
  id: crypto2.randomUUID()
15941
16020
  };
15942
- return new Promise((resolve5, reject) => {
16021
+ return new Promise((resolve6, reject) => {
15943
16022
  const timeout = setTimeout(() => {
15944
16023
  pendingExtensionInteractions.delete(operationId);
15945
16024
  controller.updateOperation(operationId, {
@@ -15953,7 +16032,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
15953
16032
  timeout.unref?.();
15954
16033
  pendingExtensionInteractions.set(operationId, {
15955
16034
  interaction: pendingInteraction,
15956
- resolve: resolve5,
16035
+ resolve: resolve6,
15957
16036
  reject,
15958
16037
  timeout
15959
16038
  });
@@ -15998,8 +16077,8 @@ function registerWorkspaceExtensionRoutes(app, deps) {
15998
16077
  const reserveRuntimeReconciliation = /* @__PURE__ */ __name(() => {
15999
16078
  let provideTask;
16000
16079
  const task = new Promise(
16001
- (resolve5) => {
16002
- provideTask = resolve5;
16080
+ (resolve6) => {
16081
+ provideTask = resolve6;
16003
16082
  }
16004
16083
  );
16005
16084
  const queued = runtimeReconciliationQueue.run(async () => {
@@ -16100,9 +16179,9 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16100
16179
  generationPoller.unref();
16101
16180
  app.locals.stopExtensionGenerationReconciler = () => clearInterval(generationPoller);
16102
16181
  }
16103
- const registerFor = /* @__PURE__ */ __name((base, resolve5) => {
16182
+ const registerFor = /* @__PURE__ */ __name((base, resolve6) => {
16104
16183
  app.get(base, async (req, res) => {
16105
- const ctrl = resolve5(req, res, false);
16184
+ const ctrl = resolve6(req, res, false);
16106
16185
  if (!ctrl) return;
16107
16186
  try {
16108
16187
  res.status(200).json(await ctrl.buildLocalExtensionsStatus());
@@ -16111,12 +16190,12 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16111
16190
  }
16112
16191
  });
16113
16192
  app.get(`${base}/operations`, async (req, res) => {
16114
- const ctrl = resolve5(req, res, false);
16193
+ const ctrl = resolve6(req, res, false);
16115
16194
  if (!ctrl) return;
16116
16195
  res.status(200).json({ v: 1, operations: ctrl.getActiveOperations() });
16117
16196
  });
16118
16197
  app.get(`${base}/operations/:operationId`, async (req, res) => {
16119
- const ctrl = resolve5(req, res, false);
16198
+ const ctrl = resolve6(req, res, false);
16120
16199
  if (!ctrl) return;
16121
16200
  try {
16122
16201
  const operationId = req.params["operationId"];
@@ -16160,7 +16239,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16160
16239
  `${base}/operations/:operationId/interactions/:interactionId`,
16161
16240
  mutate({ strict: true }),
16162
16241
  async (req, res) => {
16163
- const ctrl = resolve5(req, res, false);
16242
+ const ctrl = resolve6(req, res, false);
16164
16243
  if (!ctrl) return;
16165
16244
  try {
16166
16245
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -16229,7 +16308,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16229
16308
  }
16230
16309
  );
16231
16310
  app.post(`${base}/install`, mutate({ strict: true }), async (req, res) => {
16232
- const ctrl = resolve5(req, res, true);
16311
+ const ctrl = resolve6(req, res, true);
16233
16312
  if (!ctrl) return;
16234
16313
  try {
16235
16314
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -16412,7 +16491,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16412
16491
  `${base}/check-updates`,
16413
16492
  mutate({ strict: true }),
16414
16493
  async (req, res) => {
16415
- const ctrl = resolve5(req, res, true);
16494
+ const ctrl = resolve6(req, res, true);
16416
16495
  if (!ctrl) return;
16417
16496
  let timer;
16418
16497
  let releaseOperationSlot;
@@ -16476,7 +16555,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16476
16555
  }
16477
16556
  );
16478
16557
  app.post(`${base}/refresh`, mutate({ strict: true }), async (req, res) => {
16479
- const ctrl = resolve5(req, res, true);
16558
+ const ctrl = resolve6(req, res, true);
16480
16559
  if (!ctrl) return;
16481
16560
  try {
16482
16561
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -16500,7 +16579,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16500
16579
  `${base}/:name/enable`,
16501
16580
  mutate({ strict: true }),
16502
16581
  async (req, res) => {
16503
- const ctrl = resolve5(req, res, true);
16582
+ const ctrl = resolve6(req, res, true);
16504
16583
  if (!ctrl) return;
16505
16584
  try {
16506
16585
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -16547,7 +16626,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16547
16626
  `${base}/:name/disable`,
16548
16627
  mutate({ strict: true }),
16549
16628
  async (req, res) => {
16550
- const ctrl = resolve5(req, res, true);
16629
+ const ctrl = resolve6(req, res, true);
16551
16630
  if (!ctrl) return;
16552
16631
  try {
16553
16632
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -16594,7 +16673,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16594
16673
  `${base}/:name/update`,
16595
16674
  mutate({ strict: true }),
16596
16675
  async (req, res) => {
16597
- const ctrl = resolve5(req, res, true);
16676
+ const ctrl = resolve6(req, res, true);
16598
16677
  if (!ctrl) return;
16599
16678
  try {
16600
16679
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -16677,7 +16756,7 @@ function registerWorkspaceExtensionRoutes(app, deps) {
16677
16756
  }
16678
16757
  );
16679
16758
  app.delete(`${base}/:name`, mutate({ strict: true }), async (req, res) => {
16680
- const ctrl = resolve5(req, res, true);
16759
+ const ctrl = resolve6(req, res, true);
16681
16760
  if (!ctrl) return;
16682
16761
  try {
16683
16762
  if (!ctrl.validateExtensionMutationClient(req, res, {
@@ -17439,13 +17518,13 @@ async function handlePostFileWrite(req, res, deps) {
17439
17518
  req
17440
17519
  );
17441
17520
  if (originatorClientId === null) return;
17442
- const fs3 = factory.forRequest({
17521
+ const fs5 = factory.forRequest({
17443
17522
  originatorClientId,
17444
17523
  route: ROUTE2
17445
17524
  });
17446
17525
  try {
17447
- const resolved = await fs3.resolve(queryPath, "write");
17448
- const out = await fs3.writeTextAtomic(resolved, content, {
17526
+ const resolved = await fs5.resolve(queryPath, "write");
17527
+ const out = await fs5.writeTextAtomic(resolved, content, {
17449
17528
  mode,
17450
17529
  ...expectedHash ? { expectedHash } : {},
17451
17530
  ...bom !== void 0 ? { bom } : {},
@@ -17498,13 +17577,13 @@ async function handlePostFileEdit(req, res, deps) {
17498
17577
  req
17499
17578
  );
17500
17579
  if (originatorClientId === null) return;
17501
- const fs3 = factory.forRequest({
17580
+ const fs5 = factory.forRequest({
17502
17581
  originatorClientId,
17503
17582
  route: ROUTE2
17504
17583
  });
17505
17584
  try {
17506
- const resolved = await fs3.resolve(queryPath, "edit");
17507
- const out = await fs3.editAtomic(resolved, oldText, newText, {
17585
+ const resolved = await fs5.resolve(queryPath, "edit");
17586
+ const out = await fs5.editAtomic(resolved, oldText, newText, {
17508
17587
  expectedHash
17509
17588
  });
17510
17589
  applyReadHeaders(res);
@@ -17538,7 +17617,7 @@ function registerWorkspaceFileWriteRoutes(app, deps) {
17538
17617
  }
17539
17618
  __name(registerWorkspaceFileWriteRoutes, "registerWorkspaceFileWriteRoutes");
17540
17619
  function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
17541
- const resolve5 = /* @__PURE__ */ __name((req, res) => {
17620
+ const resolve6 = /* @__PURE__ */ __name((req, res) => {
17542
17621
  const runtime = resolveWorkspaceRuntimeFromParam(
17543
17622
  deps.workspaceRegistry,
17544
17623
  req,
@@ -17556,7 +17635,7 @@ function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
17556
17635
  "/workspaces/:workspace/file/write",
17557
17636
  deps.mutate({ strict: true }),
17558
17637
  (req, res) => {
17559
- if (!resolve5(req, res)) return;
17638
+ if (!resolve6(req, res)) return;
17560
17639
  void handlePostFileWrite(req, res, deps);
17561
17640
  }
17562
17641
  );
@@ -17564,7 +17643,7 @@ function registerWorkspaceQualifiedFileWriteRoutes(app, deps) {
17564
17643
  "/workspaces/:workspace/file/edit",
17565
17644
  deps.mutate({ strict: true }),
17566
17645
  (req, res) => {
17567
- if (!resolve5(req, res)) return;
17646
+ if (!resolve6(req, res)) return;
17568
17647
  void handlePostFileEdit(req, res, deps);
17569
17648
  }
17570
17649
  );
@@ -18309,7 +18388,7 @@ function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
18309
18388
  deferredRuntimePath: deferredRuntime.path
18310
18389
  } : {}
18311
18390
  },
18312
- async (span) => await new Promise((resolve5, reject) => {
18391
+ async (span) => await new Promise((resolve6, reject) => {
18313
18392
  let done = false;
18314
18393
  const finish = /* @__PURE__ */ __name(() => {
18315
18394
  if (done) return;
@@ -18339,7 +18418,7 @@ function daemonTelemetryMiddleware(resolveWorkspaceCwd, recordRequest) {
18339
18418
  if (!successfulSse && route.route !== "GET /daemon/status" && route.route !== "POST /session/:id/heartbeat") {
18340
18419
  recordRequest?.(durationMs, res.statusCode);
18341
18420
  }
18342
- resolve5();
18421
+ resolve6();
18343
18422
  }, "finish");
18344
18423
  res.once("finish", finish);
18345
18424
  res.once("close", finish);
@@ -18514,21 +18593,11 @@ __name(registerPermissionRoutes, "registerPermissionRoutes");
18514
18593
  // packages/cli/src/serve/routes/session.ts
18515
18594
  init_esbuild_shims();
18516
18595
  import * as crypto3 from "node:crypto";
18517
- import * as path11 from "node:path";
18596
+ import * as fs3 from "node:fs";
18597
+ import * as path10 from "node:path";
18518
18598
 
18519
18599
  // packages/cli/src/serve/server/prompt-deadline.ts
18520
18600
  init_esbuild_shims();
18521
- var PromptDeadlineExceededError = class extends Error {
18522
- static {
18523
- __name(this, "PromptDeadlineExceededError");
18524
- }
18525
- deadlineMs;
18526
- constructor(deadlineMs) {
18527
- super(`prompt exceeded the ${deadlineMs}ms deadline`);
18528
- this.name = "PromptDeadlineExceededError";
18529
- this.deadlineMs = deadlineMs;
18530
- }
18531
- };
18532
18601
  function resolvePromptDeadlineMs(serverMs, requestMs) {
18533
18602
  if (serverMs === void 0 || !Number.isFinite(serverMs) || serverMs <= 0) {
18534
18603
  return void 0;
@@ -18638,6 +18707,25 @@ function encodeMetadataSessionCursor(last, filter, archiveState) {
18638
18707
  ).toString("base64url");
18639
18708
  }
18640
18709
  __name(encodeMetadataSessionCursor, "encodeMetadataSessionCursor");
18710
+ async function enrichWorktreeSidecars(bySessionId, sessionService, archiveState = "active") {
18711
+ for (const [sessionId, summary] of bySessionId) {
18712
+ if (summary.worktree) continue;
18713
+ const sidecar = await readWorktreeSession(
18714
+ sessionService.getWorktreeSessionPathForArchiveState(
18715
+ sessionId,
18716
+ archiveState
18717
+ )
18718
+ ).catch(() => null);
18719
+ if (sidecar) {
18720
+ summary.worktree = {
18721
+ slug: sidecar.slug,
18722
+ path: sidecar.worktreePath,
18723
+ branch: sidecar.worktreeBranch
18724
+ };
18725
+ }
18726
+ }
18727
+ }
18728
+ __name(enrichWorktreeSidecars, "enrichWorktreeSidecars");
18641
18729
  function toSummary2(item) {
18642
18730
  return {
18643
18731
  sessionId: item.sessionId,
@@ -18783,6 +18871,7 @@ async function listOrganizedWorkspaceSessionsForResponse(bridge, workspaceCwd, o
18783
18871
  applyOrganization(session, snapshot.sessions.get(session.sessionId))
18784
18872
  );
18785
18873
  }
18874
+ await enrichWorktreeSidecars(bySessionId, sessionService, archiveState);
18786
18875
  if (readOptions.mergeLive !== false && archiveState !== "archived" && isFirstPage) {
18787
18876
  try {
18788
18877
  const liveSessions = bridge.listWorkspaceSessions(workspaceCwd);
@@ -18868,6 +18957,7 @@ async function listWorkspaceSessionsByMetadataForResponse(bridge, workspaceCwd,
18868
18957
  for (const session of persisted.sessions) {
18869
18958
  bySessionId.set(session.sessionId, session);
18870
18959
  }
18960
+ await enrichWorktreeSidecars(bySessionId, sessionService, archiveState);
18871
18961
  let liveMergeFailed = false;
18872
18962
  if (readOptions.mergeLive !== false && archiveState !== "archived") {
18873
18963
  try {
@@ -18970,6 +19060,7 @@ async function listWorkspaceSessionsForResponse(bridge, workspaceCwd, options, r
18970
19060
  for (const item of persisted.items) {
18971
19061
  bySessionId.set(item.sessionId, toSummary2(item));
18972
19062
  }
19063
+ await enrichWorktreeSidecars(bySessionId, sessionService, archiveState);
18973
19064
  if (archiveState === "archived" || readOptions.mergeLive === false) {
18974
19065
  const sessions2 = [...bySessionId.values()];
18975
19066
  const nextCursor2 = persisted.nextCursor != null ? String(persisted.nextCursor) : void 0;
@@ -19141,7 +19232,7 @@ function writeGenerationSseChunk(res, chunk) {
19141
19232
  if (writable) {
19142
19233
  return res.destroyed ? Promise.reject(new Error("Generation SSE connection destroyed")) : Promise.resolve();
19143
19234
  }
19144
- return new Promise((resolve5, reject) => {
19235
+ return new Promise((resolve6, reject) => {
19145
19236
  const cleanup = /* @__PURE__ */ __name(() => {
19146
19237
  res.off("drain", onDrain);
19147
19238
  res.off("close", onClose);
@@ -19149,7 +19240,7 @@ function writeGenerationSseChunk(res, chunk) {
19149
19240
  }, "cleanup");
19150
19241
  const onDrain = /* @__PURE__ */ __name(() => {
19151
19242
  cleanup();
19152
- resolve5();
19243
+ resolve6();
19153
19244
  }, "onDrain");
19154
19245
  const onClose = /* @__PURE__ */ __name(() => {
19155
19246
  cleanup();
@@ -19433,7 +19524,7 @@ function registerSessionRoutes(app, deps) {
19433
19524
  const workspaceParam = req.params[paramName] ?? "";
19434
19525
  const byId = workspaceRegistry.getByWorkspaceId(workspaceParam);
19435
19526
  if (byId) return byId;
19436
- if (!path11.isAbsolute(workspaceParam)) {
19527
+ if (!path10.isAbsolute(workspaceParam)) {
19437
19528
  res.status(400).json({
19438
19529
  error: `\`:${paramName}\` must decode to a workspace id or absolute path`
19439
19530
  });
@@ -19847,7 +19938,7 @@ function registerSessionRoutes(app, deps) {
19847
19938
  })), "serializeSessionErrors");
19848
19939
  const resolveWorkspaceParam = /* @__PURE__ */ __name((req, res) => {
19849
19940
  const workspaceCwd = req.params["id"] ?? "";
19850
- if (!path11.isAbsolute(workspaceCwd)) {
19941
+ if (!path10.isAbsolute(workspaceCwd)) {
19851
19942
  res.status(400).json({ error: "`:id` must decode to an absolute workspace path" });
19852
19943
  return null;
19853
19944
  }
@@ -19919,6 +20010,68 @@ function registerSessionRoutes(app, deps) {
19919
20010
  }
19920
20011
  const clientId = parseClientIdHeader(req, res);
19921
20012
  if (clientId === null) return;
20013
+ let worktreeMeta;
20014
+ const rawWorktree = body["worktree"];
20015
+ if (rawWorktree !== void 0 && rawWorktree !== null) {
20016
+ if (typeof rawWorktree !== "object" || Array.isArray(rawWorktree)) {
20017
+ res.status(400).json({
20018
+ error: '`worktree` must be an object (e.g. `{}` or `{"slug":"my-task"}`)',
20019
+ code: "invalid_worktree"
20020
+ });
20021
+ return;
20022
+ }
20023
+ const wtReq = rawWorktree;
20024
+ let wtService;
20025
+ try {
20026
+ wtService = new GitWorktreeService(workspaceCwd);
20027
+ } catch {
20028
+ res.status(500).json({
20029
+ error: "Failed to initialize worktree service",
20030
+ code: "worktree_init_failed"
20031
+ });
20032
+ return;
20033
+ }
20034
+ if (!await wtService.isGitRepository()) {
20035
+ res.status(400).json({
20036
+ error: "Worktree isolation requires a git repository",
20037
+ code: "worktree_not_git_repo"
20038
+ });
20039
+ return;
20040
+ }
20041
+ const rawSlug = wtReq["slug"];
20042
+ let slug;
20043
+ if (rawSlug === void 0 || rawSlug === null) {
20044
+ slug = GitWorktreeService.generateAutoSlug();
20045
+ } else if (typeof rawSlug !== "string" || rawSlug.length === 0) {
20046
+ res.status(400).json({
20047
+ error: "`worktree.slug` must be a non-empty string when provided",
20048
+ code: "worktree_invalid_slug"
20049
+ });
20050
+ return;
20051
+ } else {
20052
+ slug = rawSlug;
20053
+ }
20054
+ const slugError = GitWorktreeService.validateUserWorktreeSlug(slug);
20055
+ if (slugError) {
20056
+ res.status(400).json({ error: slugError, code: "worktree_invalid_slug" });
20057
+ return;
20058
+ }
20059
+ const baseBranch = await wtService.getCurrentBranch().catch(() => void 0);
20060
+ const wtResult = await wtService.createUserWorktree(slug, baseBranch);
20061
+ if (!wtResult.success || !wtResult.worktree) {
20062
+ res.status(500).json({
20063
+ error: wtResult.error ?? "Failed to create worktree",
20064
+ code: "worktree_create_failed"
20065
+ });
20066
+ return;
20067
+ }
20068
+ worktreeMeta = {
20069
+ slug,
20070
+ path: wtResult.worktree.path,
20071
+ branch: wtResult.worktree.branch
20072
+ };
20073
+ sessionScope = "thread";
20074
+ }
19922
20075
  try {
19923
20076
  const session = await runtime.bridge.spawnOrAttach({
19924
20077
  workspaceCwd,
@@ -19927,7 +20080,8 @@ function registerSessionRoutes(app, deps) {
19927
20080
  ...sessionScope !== void 0 ? { sessionScope } : {},
19928
20081
  ...approvalMode !== void 0 ? { approvalMode } : {},
19929
20082
  ...source.sourceType !== void 0 ? { sourceType: source.sourceType } : {},
19930
- ...source.sourceId !== void 0 ? { sourceId: source.sourceId } : {}
20083
+ ...source.sourceId !== void 0 ? { sourceId: source.sourceId } : {},
20084
+ ...worktreeMeta ? { worktree: worktreeMeta } : {}
19931
20085
  });
19932
20086
  if (daemonLog) {
19933
20087
  daemonLog.info(
@@ -19954,6 +20108,10 @@ function registerSessionRoutes(app, deps) {
19954
20108
  await new SessionService(runtime.workspaceCwd).removeSession(
19955
20109
  session.sessionId
19956
20110
  );
20111
+ if (worktreeMeta) {
20112
+ await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
20113
+ });
20114
+ }
19957
20115
  }
19958
20116
  } catch {
19959
20117
  }
@@ -19963,8 +20121,73 @@ function registerSessionRoutes(app, deps) {
19963
20121
  }
19964
20122
  return;
19965
20123
  }
20124
+ if (worktreeMeta) {
20125
+ try {
20126
+ const createAllowedRoots = [
20127
+ path10.join(workspaceCwd, ".qwen", "worktrees")
20128
+ ];
20129
+ let createRepoTop = null;
20130
+ try {
20131
+ createRepoTop = await new GitWorktreeService(
20132
+ workspaceCwd
20133
+ ).getRepoTopLevel();
20134
+ } catch {
20135
+ }
20136
+ if (createRepoTop && createRepoTop !== workspaceCwd) {
20137
+ createAllowedRoots.push(
20138
+ path10.join(createRepoTop, ".qwen", "worktrees")
20139
+ );
20140
+ }
20141
+ await runtime.bridge.changeSessionCwd(session.sessionId, {
20142
+ path: worktreeMeta.path,
20143
+ allowedRoots: createAllowedRoots
20144
+ });
20145
+ await writeWorktreeSessionMarker(
20146
+ worktreeMeta.path,
20147
+ session.sessionId
20148
+ ).catch(() => {
20149
+ });
20150
+ await writeWorktreeSession(
20151
+ new SessionService(workspaceCwd).getWorktreeSessionPath(
20152
+ session.sessionId
20153
+ ),
20154
+ {
20155
+ slug: worktreeMeta.slug,
20156
+ worktreePath: worktreeMeta.path,
20157
+ worktreeBranch: worktreeMeta.branch,
20158
+ originalCwd: workspaceCwd,
20159
+ originalBranch: "",
20160
+ originalHeadCommit: ""
20161
+ }
20162
+ ).catch(() => {
20163
+ });
20164
+ } catch (cdErr) {
20165
+ if (daemonLog) {
20166
+ daemonLog.warn("worktree cd failed, rolling back", {
20167
+ sessionId: session.sessionId,
20168
+ error: cdErr instanceof Error ? cdErr.message : String(cdErr)
20169
+ });
20170
+ }
20171
+ const killed = await runtime.bridge.killSession(session.sessionId, { requireZeroAttaches: true }).catch(() => false);
20172
+ if (killed) {
20173
+ await new SessionService(workspaceCwd).removeSession(session.sessionId).catch(() => {
20174
+ });
20175
+ }
20176
+ await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
20177
+ });
20178
+ res.status(500).json({
20179
+ error: "Failed to relocate session into worktree",
20180
+ code: "worktree_relocate_failed"
20181
+ });
20182
+ return;
20183
+ }
20184
+ }
19966
20185
  res.status(200).json(session);
19967
20186
  } catch (err) {
20187
+ if (worktreeMeta) {
20188
+ await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
20189
+ });
20190
+ }
19968
20191
  sendBridgeError2(res, err, { route: "POST /session" });
19969
20192
  }
19970
20193
  });
@@ -20050,6 +20273,72 @@ function registerSessionRoutes(app, deps) {
20050
20273
  }
20051
20274
  return;
20052
20275
  }
20276
+ if (!session.worktree) {
20277
+ const sidecar = await readWorktreeSession(
20278
+ new SessionService(workspaceCwd).getWorktreeSessionPath(sessionId)
20279
+ ).catch(() => null);
20280
+ if (sidecar) {
20281
+ let realTarget;
20282
+ const candidateRoots = [
20283
+ path10.join(workspaceCwd, ".qwen", "worktrees")
20284
+ ];
20285
+ try {
20286
+ realTarget = fs3.realpathSync(sidecar.worktreePath);
20287
+ let repoTop = null;
20288
+ try {
20289
+ repoTop = await new GitWorktreeService(
20290
+ workspaceCwd
20291
+ ).getRepoTopLevel();
20292
+ } catch {
20293
+ }
20294
+ if (repoTop && repoTop !== workspaceCwd) {
20295
+ candidateRoots.push(path10.join(repoTop, ".qwen", "worktrees"));
20296
+ }
20297
+ const contained = candidateRoots.some((root) => {
20298
+ try {
20299
+ const realRoot = fs3.realpathSync(root);
20300
+ const rel = path10.relative(realRoot, realTarget);
20301
+ return !rel.startsWith("..") && !path10.isAbsolute(rel);
20302
+ } catch {
20303
+ return false;
20304
+ }
20305
+ });
20306
+ if (!contained) {
20307
+ realTarget = void 0;
20308
+ }
20309
+ } catch {
20310
+ realTarget = void 0;
20311
+ }
20312
+ if (!realTarget) {
20313
+ daemonLog?.warn("worktree sidecar path failed containment", {
20314
+ sessionId,
20315
+ path: sidecar.worktreePath
20316
+ });
20317
+ } else {
20318
+ const wt = {
20319
+ slug: sidecar.slug,
20320
+ path: realTarget,
20321
+ branch: sidecar.worktreeBranch
20322
+ };
20323
+ try {
20324
+ if (!session.hasActivePrompt) {
20325
+ await runtime.bridge.changeSessionCwd(sessionId, {
20326
+ path: wt.path,
20327
+ allowedRoots: candidateRoots
20328
+ });
20329
+ }
20330
+ runtime.bridge.setSessionWorktree(sessionId, wt);
20331
+ session.worktree = wt;
20332
+ } catch (restoreErr) {
20333
+ daemonLog?.warn("worktree restore failed on load/resume", {
20334
+ sessionId,
20335
+ worktreePath: wt.path,
20336
+ error: restoreErr instanceof Error ? restoreErr.message : String(restoreErr)
20337
+ });
20338
+ }
20339
+ }
20340
+ }
20341
+ }
20053
20342
  res.status(200).json(session);
20054
20343
  } catch (err) {
20055
20344
  sendBridgeError2(res, err, {
@@ -20131,7 +20420,7 @@ function registerSessionRoutes(app, deps) {
20131
20420
  async (req, res, sessionId) => {
20132
20421
  const body = safeBody(req);
20133
20422
  const targetPath = body["path"];
20134
- if (typeof targetPath !== "string" || targetPath.length === 0 || !path11.isAbsolute(targetPath)) {
20423
+ if (typeof targetPath !== "string" || targetPath.length === 0 || !path10.isAbsolute(targetPath)) {
20135
20424
  res.status(400).json({
20136
20425
  error: "`path` is required and must be an absolute path",
20137
20426
  code: "invalid_path"
@@ -20633,15 +20922,6 @@ function registerSessionRoutes(app, deps) {
20633
20922
  promptDeadlineMs,
20634
20923
  requestDeadlineMs
20635
20924
  );
20636
- let deadlineTimer;
20637
- if (effectiveDeadlineMs !== void 0) {
20638
- deadlineTimer = setTimeout(() => {
20639
- if (!abort.signal.aborted) {
20640
- abort.abort(new PromptDeadlineExceededError(effectiveDeadlineMs));
20641
- }
20642
- }, effectiveDeadlineMs);
20643
- deadlineTimer.unref();
20644
- }
20645
20925
  let promptPromise;
20646
20926
  try {
20647
20927
  promptPromise = ownerBridge.sendPrompt(
@@ -20654,11 +20934,11 @@ function registerSessionRoutes(app, deps) {
20654
20934
  abort.signal,
20655
20935
  {
20656
20936
  ...clientId !== void 0 ? { clientId } : {},
20657
- promptId
20937
+ promptId,
20938
+ ...effectiveDeadlineMs !== void 0 ? { deadlineMs: effectiveDeadlineMs } : {}
20658
20939
  }
20659
20940
  );
20660
20941
  } catch (err) {
20661
- if (deadlineTimer !== void 0) clearTimeout(deadlineTimer);
20662
20942
  res.off("close", onResClose);
20663
20943
  res.off("finish", onResFinish);
20664
20944
  if (daemonLog && err instanceof PromptQueueFullError) {
@@ -20703,9 +20983,7 @@ function registerSessionRoutes(app, deps) {
20703
20983
  );
20704
20984
  }
20705
20985
  }
20706
- ).finally(() => {
20707
- if (deadlineTimer !== void 0) clearTimeout(deadlineTimer);
20708
- }).catch(() => {
20986
+ ).catch(() => {
20709
20987
  });
20710
20988
  if (daemonLog) {
20711
20989
  daemonLog.info("prompt enqueued", { sessionId, promptId, clientId });
@@ -22578,7 +22856,7 @@ __name(registerUsageStatsRoutes, "registerUsageStatsRoutes");
22578
22856
  // packages/cli/src/serve/scheduled-task-keepalive.ts
22579
22857
  init_esbuild_shims();
22580
22858
  import * as fsSync from "node:fs";
22581
- import * as path12 from "node:path";
22859
+ import * as path11 from "node:path";
22582
22860
  var log = createDebugLogger("SCHED_KEEPALIVE");
22583
22861
  function collectBoundSessionIds(tasks) {
22584
22862
  const seen = /* @__PURE__ */ new Set();
@@ -22789,8 +23067,8 @@ function startScheduledTaskKeepalive(opts) {
22789
23067
  timer.unref?.();
22790
23068
  let bindDebounce;
22791
23069
  const cronFilePath = getCronFilePath(boundWorkspace);
22792
- const cronDir = path12.dirname(cronFilePath);
22793
- const cronFileName = path12.basename(cronFilePath);
23070
+ const cronDir = path11.dirname(cronFilePath);
23071
+ const cronFileName = path11.basename(cronFilePath);
22794
23072
  let fileWatcher;
22795
23073
  try {
22796
23074
  fsSync.mkdirSync(cronDir, { recursive: true });
@@ -22881,7 +23159,7 @@ async function rehydrateScheduledTaskSessions(deps) {
22881
23159
  }
22882
23160
  __name(rehydrateScheduledTaskSessions, "rehydrateScheduledTaskSessions");
22883
23161
  function withTimeout(p, ms, label) {
22884
- return new Promise((resolve5, reject) => {
23162
+ return new Promise((resolve6, reject) => {
22885
23163
  const timer = setTimeout(() => {
22886
23164
  reject(new Error(`${label} timed out after ${ms}ms`));
22887
23165
  }, ms);
@@ -22889,7 +23167,7 @@ function withTimeout(p, ms, label) {
22889
23167
  p.then(
22890
23168
  (v) => {
22891
23169
  clearTimeout(timer);
22892
- resolve5(v);
23170
+ resolve6(v);
22893
23171
  },
22894
23172
  (e) => {
22895
23173
  clearTimeout(timer);
@@ -22973,7 +23251,7 @@ function registerWorkspaceStatusRoutes(app, deps) {
22973
23251
  const ctx = buildWorkspaceCtx("POST /workspace/acp/preheat");
22974
23252
  const timeoutMsRaw = req.query["timeoutMs"];
22975
23253
  const timeoutMs = typeof timeoutMsRaw === "string" && timeoutMsRaw.trim() ? Number(timeoutMsRaw) : void 0;
22976
- if (timeoutMs !== void 0 && (!Number.isFinite(timeoutMs) || !Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_ACP_PREHEAT_TIMEOUT_MS)) {
23254
+ if (timeoutMsRaw !== void 0 && (timeoutMs === void 0 || !Number.isFinite(timeoutMs) || !Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_ACP_PREHEAT_TIMEOUT_MS)) {
22977
23255
  res.status(400).json({
22978
23256
  error: "`timeoutMs` must be a positive integer no greater than 60000",
22979
23257
  code: "invalid_timeout"
@@ -23307,6 +23585,7 @@ function registerCapabilitiesRoutes(app, deps) {
23307
23585
  workspaces: runtimes.map((runtime) => ({
23308
23586
  id: runtime.workspaceId,
23309
23587
  cwd: runtime.workspaceCwd,
23588
+ ...runtime.displayName !== void 0 ? { displayName: runtime.displayName } : {},
23310
23589
  primary: runtime.primary,
23311
23590
  trusted: runtime.trusted,
23312
23591
  ...runtimeRemoval ? { removable: runtime.removable === true } : {}
@@ -23979,6 +24258,12 @@ init_esbuild_shims();
23979
24258
 
23980
24259
  // packages/cli/src/serve/server/error-response.ts
23981
24260
  init_esbuild_shims();
24261
+ var SESSION_WRITER_ERROR_MESSAGES = {
24262
+ session_writer_conflict: "This session is already open in another Qwen process.",
24263
+ session_writer_lost: "Write ownership for this session was lost.",
24264
+ session_transcript_changed: "The session transcript changed outside its active writer.",
24265
+ session_writer_unavailable: "Session write ownership could not be verified."
24266
+ };
23982
24267
  function bridgeErrorExtraContext(ctx) {
23983
24268
  const extra = {};
23984
24269
  for (const [key, value] of Object.entries(ctx ?? {})) {
@@ -24031,6 +24316,14 @@ function sendPermissionVoteError(res, err, ctx, daemonLog) {
24031
24316
  }
24032
24317
  __name(sendPermissionVoteError, "sendPermissionVoteError");
24033
24318
  function sendBridgeError(res, err, ctx, daemonLog) {
24319
+ if (err instanceof SessionWriterError) {
24320
+ res.status(err.httpStatus).json({
24321
+ error: err.message,
24322
+ code: err.errorKind,
24323
+ errorKind: err.errorKind
24324
+ });
24325
+ return;
24326
+ }
24034
24327
  if (err instanceof WorkspaceSkillNotFoundError) {
24035
24328
  res.status(404).json({
24036
24329
  error: err.message,
@@ -24343,6 +24636,22 @@ function sendBridgeError(res, err, ctx, daemonLog) {
24343
24636
  const data = err.data;
24344
24637
  if (data && typeof data === "object") {
24345
24638
  const kind = data.errorKind;
24639
+ if (kind === "session_writer_conflict" || kind === "session_writer_lost" || kind === "session_transcript_changed") {
24640
+ res.status(409).json({
24641
+ error: SESSION_WRITER_ERROR_MESSAGES[kind],
24642
+ code: kind,
24643
+ errorKind: kind
24644
+ });
24645
+ return;
24646
+ }
24647
+ if (kind === "session_writer_unavailable") {
24648
+ res.status(503).json({
24649
+ error: SESSION_WRITER_ERROR_MESSAGES[kind],
24650
+ code: kind,
24651
+ errorKind: kind
24652
+ });
24653
+ return;
24654
+ }
24346
24655
  if (kind === "mcp_budget_would_exceed") {
24347
24656
  const d = data;
24348
24657
  res.status(409).json({
@@ -24619,9 +24928,9 @@ function registerSseEventsRoutes(app, deps) {
24619
24928
  let writeChain = Promise.resolve();
24620
24929
  const trackWriterIdle = writerIdleTimeoutMs !== void 0 && writerIdleTimeoutMs > 0;
24621
24930
  let lastWriteAt = trackWriterIdle ? Date.now() : 0;
24622
- const doWrite = /* @__PURE__ */ __name((chunk) => new Promise((resolve5, reject) => {
24931
+ const doWrite = /* @__PURE__ */ __name((chunk) => new Promise((resolve6, reject) => {
24623
24932
  if (res.writableEnded) {
24624
- resolve5();
24933
+ resolve6();
24625
24934
  return;
24626
24935
  }
24627
24936
  let ok;
@@ -24633,19 +24942,19 @@ function registerSseEventsRoutes(app, deps) {
24633
24942
  }
24634
24943
  if (ok) {
24635
24944
  if (trackWriterIdle) lastWriteAt = Date.now();
24636
- resolve5();
24945
+ resolve6();
24637
24946
  return;
24638
24947
  }
24639
24948
  const onDrain = /* @__PURE__ */ __name(() => {
24640
24949
  res.off("close", onClose);
24641
24950
  res.off("error", onError);
24642
24951
  if (trackWriterIdle) lastWriteAt = Date.now();
24643
- resolve5();
24952
+ resolve6();
24644
24953
  }, "onDrain");
24645
24954
  const onClose = /* @__PURE__ */ __name(() => {
24646
24955
  res.off("drain", onDrain);
24647
24956
  res.off("error", onError);
24648
- resolve5();
24957
+ resolve6();
24649
24958
  }, "onClose");
24650
24959
  const onError = /* @__PURE__ */ __name((err) => {
24651
24960
  res.off("drain", onDrain);
@@ -24974,7 +25283,7 @@ __name(registerWorkspaceModelsRoutes, "registerWorkspaceModelsRoutes");
24974
25283
  // packages/cli/src/serve/routes/a2ui-action.ts
24975
25284
  init_esbuild_shims();
24976
25285
  import * as fsp4 from "node:fs/promises";
24977
- import * as path13 from "node:path";
25286
+ import * as path12 from "node:path";
24978
25287
  var A2UI_MIME = "application/a2ui+json";
24979
25288
  var ACTION_TOOL = "action";
24980
25289
  var CALL_TIMEOUT_MS = 15e3;
@@ -24997,7 +25306,7 @@ __name(usableServerConfig, "usableServerConfig");
24997
25306
  async function findFromSettingsFile(workspaceCwd) {
24998
25307
  try {
24999
25308
  const raw = await fsp4.readFile(
25000
- path13.join(workspaceCwd, ".qwen", "settings.json"),
25309
+ path12.join(workspaceCwd, ".qwen", "settings.json"),
25001
25310
  "utf8"
25002
25311
  );
25003
25312
  const settings = JSON.parse(raw);
@@ -25134,7 +25443,7 @@ __name(registerA2uiActionRoutes, "registerA2uiActionRoutes");
25134
25443
 
25135
25444
  // packages/cli/src/serve/server/fs-factory.ts
25136
25445
  init_esbuild_shims();
25137
- import * as path14 from "node:path";
25446
+ import * as path13 from "node:path";
25138
25447
  var IDE_WORKSPACE_PATH_ENV_VAR = "QWEN_CODE_IDE_WORKSPACE_PATH";
25139
25448
  function createDefaultFsAuditEmit() {
25140
25449
  const WARN_EVERY = 100;
@@ -25208,14 +25517,14 @@ function parseIdeWorkspacePathEnv(value) {
25208
25517
  const parsed = JSON.parse(value);
25209
25518
  if (Array.isArray(parsed) && parsed.every((item) => typeof item === "string")) {
25210
25519
  return parsed.filter(
25211
- (workspace) => workspace.length > 0 && path14.isAbsolute(workspace)
25520
+ (workspace) => workspace.length > 0 && path13.isAbsolute(workspace)
25212
25521
  );
25213
25522
  }
25214
25523
  throw new Error("IDE workspace path JSON must be a string array");
25215
25524
  } catch {
25216
25525
  }
25217
25526
  }
25218
- return value.split(path14.delimiter).filter((workspace) => workspace.length > 0 && path14.isAbsolute(workspace));
25527
+ return value.split(path13.delimiter).filter((workspace) => workspace.length > 0 && path13.isAbsolute(workspace));
25219
25528
  }
25220
25529
  __name(parseIdeWorkspacePathEnv, "parseIdeWorkspacePathEnv");
25221
25530
  function dropNestedWorkspacesPreservingPrimary(workspaces) {
@@ -25721,8 +26030,8 @@ __name(registerWorkspaceQualifiedLifecycleRoutes, "registerWorkspaceQualifiedLif
25721
26030
  // packages/cli/src/serve/routes/workspace-management.ts
25722
26031
  init_esbuild_shims();
25723
26032
  import { readdir, stat } from "node:fs/promises";
25724
- import { realpathSync } from "node:fs";
25725
- import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute7, join as join7, resolve as resolve4, sep as sep3 } from "node:path";
26033
+ import { realpathSync as realpathSync2 } from "node:fs";
26034
+ import { basename as basename4, dirname as dirname4, isAbsolute as isAbsolute7, join as join8, resolve as resolve4, sep as sep3 } from "node:path";
25726
26035
  var MAX_PATH_SUGGESTIONS = 50;
25727
26036
  function registerWorkspaceManagementRoutes(app, deps) {
25728
26037
  const {
@@ -25753,6 +26062,31 @@ function registerWorkspaceManagementRoutes(app, deps) {
25753
26062
  code: "daemon_shutting_down"
25754
26063
  });
25755
26064
  }, "sendSealed");
26065
+ const attachRegistrationIds = /* @__PURE__ */ __name((runtime, registrationIds) => {
26066
+ runtime.registrationIds ??= [];
26067
+ for (const registrationId of registrationIds) {
26068
+ if (!runtime.registrationIds.includes(registrationId)) {
26069
+ runtime.registrationIds.push(registrationId);
26070
+ }
26071
+ }
26072
+ }, "attachRegistrationIds");
26073
+ const restorePersistedDisplayName = /* @__PURE__ */ __name(async (runtime, canonical) => {
26074
+ const snapshot = await workspaceRegistrationStore.read();
26075
+ const storedWorkspace = snapshot.workspaces.find(
26076
+ (stored) => process.platform === "win32" ? stored.toLowerCase() === canonical.toLowerCase() : stored === canonical
26077
+ );
26078
+ const storedDisplayName = storedWorkspace ? snapshot.displayNames?.[workspaceRegistrationId(storedWorkspace)] : void 0;
26079
+ if (storedWorkspace) {
26080
+ attachRegistrationIds(runtime, [
26081
+ workspaceRegistrationId(storedWorkspace)
26082
+ ]);
26083
+ }
26084
+ if (storedDisplayName === void 0) {
26085
+ delete runtime.displayName;
26086
+ } else {
26087
+ runtime.displayName = storedDisplayName;
26088
+ }
26089
+ }, "restorePersistedDisplayName");
25756
26090
  app.get(
25757
26091
  "/workspace-path-suggestions",
25758
26092
  async (req, res) => {
@@ -25780,7 +26114,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
25780
26114
  return;
25781
26115
  }
25782
26116
  const endsWithSep = prefix.endsWith("/") || process.platform === "win32" && prefix.endsWith("\\");
25783
- const dir = endsWithSep ? join7(prefix, ".") : dirname4(prefix);
26117
+ const dir = endsWithSep ? join8(prefix, ".") : dirname4(prefix);
25784
26118
  const filter = endsWithSep ? "" : basename4(prefix);
25785
26119
  const filterLower = filter.toLowerCase();
25786
26120
  const suggestions = [];
@@ -25796,7 +26130,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
25796
26130
  let isDir = entry.isDirectory();
25797
26131
  if (!isDir && entry.isSymbolicLink()) {
25798
26132
  try {
25799
- isDir = (await stat(join7(dir, entry.name))).isDirectory();
26133
+ isDir = (await stat(join8(dir, entry.name))).isDirectory();
25800
26134
  } catch {
25801
26135
  continue;
25802
26136
  }
@@ -25806,7 +26140,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
25806
26140
  truncated = true;
25807
26141
  break;
25808
26142
  }
25809
- suggestions.push({ name: entry.name, path: join7(dir, entry.name) });
26143
+ suggestions.push({ name: entry.name, path: join8(dir, entry.name) });
25810
26144
  }
25811
26145
  } catch {
25812
26146
  }
@@ -25826,6 +26160,20 @@ function registerWorkspaceManagementRoutes(app, deps) {
25826
26160
  const body = safeBody2(req);
25827
26161
  const cwd = body["cwd"];
25828
26162
  const persist = body["persist"] ?? false;
26163
+ const hasDisplayName = Object.hasOwn(body, "displayName");
26164
+ let displayName;
26165
+ if (hasDisplayName) {
26166
+ try {
26167
+ displayName = normalizeWorkspaceDisplayName(body["displayName"]);
26168
+ } catch (err) {
26169
+ if (!(err instanceof WorkspaceDisplayNameValidationError)) throw err;
26170
+ res.status(400).json({
26171
+ error: err.message,
26172
+ code: "invalid_display_name"
26173
+ });
26174
+ return;
26175
+ }
26176
+ }
25829
26177
  if (typeof cwd !== "string" || cwd.trim().length === 0) {
25830
26178
  res.status(400).json({
25831
26179
  error: "`cwd` must be a non-empty string",
@@ -25854,23 +26202,24 @@ function registerWorkspaceManagementRoutes(app, deps) {
25854
26202
  });
25855
26203
  return;
25856
26204
  }
25857
- if (!isAbsolute7(cwd)) {
26205
+ if (cwd.length > MAX_WORKSPACE_PATH_LENGTH) {
25858
26206
  res.status(400).json({
25859
- error: "`cwd` must be an absolute path",
26207
+ error: `\`cwd\` exceeds the ${MAX_WORKSPACE_PATH_LENGTH}-character limit`,
25860
26208
  code: "invalid_path"
25861
26209
  });
25862
26210
  return;
25863
26211
  }
25864
- if (cwd.length > MAX_WORKSPACE_PATH_LENGTH) {
26212
+ const sandboxCwd = translateAndCheckAbsoluteWorkspacePath(cwd);
26213
+ if (sandboxCwd === null) {
25865
26214
  res.status(400).json({
25866
- error: `\`cwd\` exceeds the ${MAX_WORKSPACE_PATH_LENGTH}-character limit`,
26215
+ error: "`cwd` must be an absolute path",
25867
26216
  code: "invalid_path"
25868
26217
  });
25869
26218
  return;
25870
26219
  }
25871
26220
  let canonical;
25872
26221
  try {
25873
- canonical = realpathSync.native(resolve4(cwd));
26222
+ canonical = realpathSync2.native(resolve4(sandboxCwd));
25874
26223
  } catch {
25875
26224
  res.status(400).json({
25876
26225
  error: "Path does not exist or is not accessible",
@@ -25945,11 +26294,12 @@ function registerWorkspaceManagementRoutes(app, deps) {
25945
26294
  operationStarted();
25946
26295
  try {
25947
26296
  const snapshot = await workspaceRegistrationStore.read();
25948
- const alreadyPersisted = snapshot.workspaces.some(
26297
+ const persistedWorkspaces = snapshot.workspaces.filter(
25949
26298
  (stored) => existingRuntime.registrationIds?.includes(
25950
26299
  workspaceRegistrationId(stored)
25951
26300
  ) === true || (process.platform === "win32" ? stored.toLowerCase() === canonical.toLowerCase() : stored === canonical)
25952
26301
  );
26302
+ const alreadyPersisted = persistedWorkspaces.length > 0;
25953
26303
  if (!alreadyPersisted && snapshot.workspaces.length >= MAX_REGISTERED_WORKSPACES - 1) {
25954
26304
  res.status(409).json({
25955
26305
  error: "Workspace registration limit reached",
@@ -25957,22 +26307,56 @@ function registerWorkspaceManagementRoutes(app, deps) {
25957
26307
  });
25958
26308
  return;
25959
26309
  }
25960
- if (!alreadyPersisted) {
26310
+ if (alreadyPersisted) {
26311
+ attachRegistrationIds(
26312
+ existingRuntime,
26313
+ persistedWorkspaces.map(workspaceRegistrationId)
26314
+ );
26315
+ const storedDisplayName = persistedWorkspaces.map(
26316
+ (stored) => snapshot.displayNames?.[workspaceRegistrationId(stored)]
26317
+ ).find((name) => name !== void 0);
26318
+ if (storedDisplayName === void 0) {
26319
+ delete existingRuntime.displayName;
26320
+ } else {
26321
+ existingRuntime.displayName = storedDisplayName;
26322
+ }
26323
+ } else {
26324
+ let added = false;
25961
26325
  try {
25962
- await workspaceRegistrationStore.add(canonical);
26326
+ const persistedDisplayName = hasDisplayName ? displayName : existingRuntime.displayName;
26327
+ added = persistedDisplayName === void 0 ? await workspaceRegistrationStore.add(canonical) : await workspaceRegistrationStore.add(
26328
+ canonical,
26329
+ persistedDisplayName
26330
+ );
25963
26331
  } catch (err) {
25964
26332
  if (!(err instanceof WorkspaceRegistrationStoreCommittedError)) {
25965
26333
  throw err;
25966
26334
  }
26335
+ added = true;
25967
26336
  try {
25968
26337
  writeStderrLine(`qwen serve: ${err.message}`);
25969
26338
  } catch {
25970
26339
  }
25971
26340
  }
26341
+ if (added) {
26342
+ attachRegistrationIds(existingRuntime, [
26343
+ workspaceRegistrationId(canonical)
26344
+ ]);
26345
+ }
26346
+ if (added && hasDisplayName) {
26347
+ if (displayName === void 0) {
26348
+ delete existingRuntime.displayName;
26349
+ } else {
26350
+ existingRuntime.displayName = displayName;
26351
+ }
26352
+ } else if (!added) {
26353
+ await restorePersistedDisplayName(existingRuntime, canonical);
26354
+ }
25972
26355
  }
25973
26356
  res.status(200).json({
25974
26357
  id: existingRuntime.workspaceId,
25975
26358
  cwd: existingRuntime.workspaceCwd,
26359
+ ...existingRuntime.displayName !== void 0 ? { displayName: existingRuntime.displayName } : {},
25976
26360
  primary: existingRuntime.primary,
25977
26361
  trusted: existingRuntime.trusted,
25978
26362
  persisted: true
@@ -26045,12 +26429,18 @@ function registerWorkspaceManagementRoutes(app, deps) {
26045
26429
  let persistenceFailed = false;
26046
26430
  try {
26047
26431
  const runtime = await createWorkspaceRuntime(canonical);
26432
+ if (!persist && displayName !== void 0) {
26433
+ runtime.displayName = displayName;
26434
+ }
26048
26435
  let persistedRecordAdded = false;
26049
26436
  try {
26050
26437
  if (persist) {
26051
26438
  try {
26052
26439
  try {
26053
- persistedRecordAdded = await workspaceRegistrationStore.add(canonical);
26440
+ persistedRecordAdded = displayName === void 0 ? await workspaceRegistrationStore.add(canonical) : await workspaceRegistrationStore.add(
26441
+ canonical,
26442
+ displayName
26443
+ );
26054
26444
  } catch (err) {
26055
26445
  if (!(err instanceof WorkspaceRegistrationStoreCommittedError)) {
26056
26446
  throw err;
@@ -26061,6 +26451,16 @@ function registerWorkspaceManagementRoutes(app, deps) {
26061
26451
  } catch {
26062
26452
  }
26063
26453
  }
26454
+ if (persistedRecordAdded) {
26455
+ attachRegistrationIds(runtime, [
26456
+ workspaceRegistrationId(canonical)
26457
+ ]);
26458
+ if (displayName !== void 0) {
26459
+ runtime.displayName = displayName;
26460
+ }
26461
+ } else {
26462
+ await restorePersistedDisplayName(runtime, canonical);
26463
+ }
26064
26464
  } catch (err) {
26065
26465
  persistenceFailed = true;
26066
26466
  throw err;
@@ -26104,6 +26504,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
26104
26504
  res.status(201).json({
26105
26505
  id: runtime.workspaceId,
26106
26506
  cwd: runtime.workspaceCwd,
26507
+ ...runtime.displayName !== void 0 ? { displayName: runtime.displayName } : {},
26107
26508
  primary: runtime.primary,
26108
26509
  trusted: runtime.trusted,
26109
26510
  ...persist ? { persisted: true } : {}
@@ -26171,6 +26572,98 @@ function registerWorkspaceManagementRoutes(app, deps) {
26171
26572
  });
26172
26573
  return void 0;
26173
26574
  }, "resolveManagedRuntime");
26575
+ app.patch(
26576
+ "/workspaces/:workspace",
26577
+ mutate({ strict: true }),
26578
+ async (req, res) => {
26579
+ const body = safeBody2(req);
26580
+ const unsupportedField = Object.keys(body).find(
26581
+ (field) => field !== "displayName"
26582
+ );
26583
+ if (unsupportedField) {
26584
+ res.status(400).json({
26585
+ error: `\`${unsupportedField}\` is not an updatable workspace field`,
26586
+ code: "unsupported_field"
26587
+ });
26588
+ return;
26589
+ }
26590
+ if (!Object.hasOwn(body, "displayName")) {
26591
+ res.status(400).json({
26592
+ error: "No updatable fields provided",
26593
+ code: "empty_patch"
26594
+ });
26595
+ return;
26596
+ }
26597
+ let displayName;
26598
+ try {
26599
+ displayName = body["displayName"] === null ? void 0 : normalizeWorkspaceDisplayName(body["displayName"]);
26600
+ } catch (err) {
26601
+ if (!(err instanceof WorkspaceDisplayNameValidationError)) throw err;
26602
+ res.status(400).json({
26603
+ error: err.message,
26604
+ code: "invalid_display_name"
26605
+ });
26606
+ return;
26607
+ }
26608
+ if (sealed) {
26609
+ sendSealed(res);
26610
+ return;
26611
+ }
26612
+ const runtime = resolveManagedRuntime(req, res);
26613
+ if (!runtime) return;
26614
+ if (inFlight.has(runtime.workspaceCwd)) {
26615
+ res.status(409).json({
26616
+ error: "Workspace registration is in progress",
26617
+ code: "workspace_registration_in_progress"
26618
+ });
26619
+ return;
26620
+ }
26621
+ inFlight.set(runtime.workspaceCwd, "update");
26622
+ operationStarted();
26623
+ try {
26624
+ if (workspaceRegistrationStore && runtime.registrationIds !== void 0 && runtime.registrationIds.length > 0) {
26625
+ try {
26626
+ await workspaceRegistrationStore.setDisplayNameByIds(
26627
+ runtime.registrationIds,
26628
+ displayName
26629
+ );
26630
+ } catch (err) {
26631
+ if (!(err instanceof WorkspaceRegistrationStoreCommittedError)) {
26632
+ throw err;
26633
+ }
26634
+ try {
26635
+ writeStderrLine(`qwen serve: ${err.message}`);
26636
+ } catch {
26637
+ }
26638
+ }
26639
+ }
26640
+ if (displayName === void 0) {
26641
+ delete runtime.displayName;
26642
+ } else {
26643
+ runtime.displayName = displayName;
26644
+ }
26645
+ res.status(200).json({
26646
+ id: runtime.workspaceId,
26647
+ cwd: runtime.workspaceCwd,
26648
+ ...runtime.displayName !== void 0 ? { displayName: runtime.displayName } : {},
26649
+ primary: runtime.primary,
26650
+ trusted: runtime.trusted,
26651
+ ...runtimeRemoval ? { removable: runtime.removable === true } : {}
26652
+ });
26653
+ } catch (err) {
26654
+ writeStderrLine(
26655
+ `qwen serve: failed to persist workspace display name: ${err instanceof Error ? err.message : String(err)}`
26656
+ );
26657
+ res.status(500).json({
26658
+ error: "Failed to persist workspace display name",
26659
+ code: "workspace_registration_store_error"
26660
+ });
26661
+ } finally {
26662
+ inFlight.delete(runtime.workspaceCwd);
26663
+ operationFinished();
26664
+ }
26665
+ }
26666
+ );
26174
26667
  app.delete(
26175
26668
  "/workspaces/:workspace",
26176
26669
  mutate({ strict: true }),
@@ -26406,11 +26899,13 @@ function registerWorkspaceManagementRoutes(app, deps) {
26406
26899
  schemaVersion: snapshot.schemaVersion,
26407
26900
  primaryWorkspace: snapshot.primaryWorkspace,
26408
26901
  entries: snapshot.workspaces.map((cwd) => {
26902
+ const registrationId = workspaceRegistrationId(cwd);
26409
26903
  const runtime = workspaceRegistry.getByWorkspaceCwd(cwd);
26410
26904
  return {
26411
- id: workspaceRegistrationId(cwd),
26905
+ id: registrationId,
26412
26906
  cwd,
26413
- active: runtime !== void 0 || registrationIsActive(workspaceRegistrationId(cwd)),
26907
+ ...snapshot.displayNames?.[registrationId] !== void 0 ? { displayName: snapshot.displayNames[registrationId] } : {},
26908
+ active: runtime !== void 0 || registrationIsActive(registrationId),
26414
26909
  persisted: true
26415
26910
  };
26416
26911
  })
@@ -26468,7 +26963,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
26468
26963
  }
26469
26964
  if (storedCwd) {
26470
26965
  try {
26471
- operationCwd = realpathSync.native(resolve4(storedCwd));
26966
+ operationCwd = realpathSync2.native(resolve4(storedCwd));
26472
26967
  } catch {
26473
26968
  operationCwd = resolve4(storedCwd);
26474
26969
  }
@@ -26508,6 +27003,11 @@ function registerWorkspaceManagementRoutes(app, deps) {
26508
27003
  });
26509
27004
  return;
26510
27005
  }
27006
+ if (runtime?.registrationIds) {
27007
+ runtime.registrationIds = runtime.registrationIds.filter(
27008
+ (id) => id !== registrationId
27009
+ );
27010
+ }
26511
27011
  res.json({
26512
27012
  removed: true,
26513
27013
  active,
@@ -26539,6 +27039,8 @@ __name(registerWorkspaceManagementRoutes, "registerWorkspaceManagementRoutes");
26539
27039
 
26540
27040
  // packages/cli/src/serve/routes/workspace-git.ts
26541
27041
  init_esbuild_shims();
27042
+ import * as fs4 from "node:fs";
27043
+ import * as path14 from "node:path";
26542
27044
  function registerWorkspaceGitRoutes(app, deps) {
26543
27045
  app.get("/workspace/git", async (_req, res) => {
26544
27046
  try {
@@ -26560,10 +27062,43 @@ function registerWorkspaceQualifiedGitRoutes(app, deps) {
26560
27062
  const runtime = resolveTrustedRuntime2(deps.workspaceRegistry, req, res);
26561
27063
  if (!runtime) return;
26562
27064
  const route = "GET /workspaces/:workspace/git";
27065
+ const rawCwd = req.query["cwd"];
27066
+ let gitCwd = runtime.workspaceCwd;
27067
+ if (typeof rawCwd === "string" && rawCwd.length > 0) {
27068
+ try {
27069
+ const resolved = fs4.realpathSync(path14.resolve(rawCwd));
27070
+ const root = fs4.realpathSync(runtime.workspaceCwd);
27071
+ const rel = path14.relative(root, resolved);
27072
+ if (!rel.startsWith("..") && !path14.isAbsolute(rel)) {
27073
+ gitCwd = resolved;
27074
+ }
27075
+ } catch {
27076
+ }
27077
+ }
26563
27078
  try {
26564
- res.status(200).json(
26565
- await deps.gitState.getStatus(runtime.workspaceCwd, runtime.bridge)
26566
- );
27079
+ if (gitCwd !== runtime.workspaceCwd) {
27080
+ const status = await getGitWorkingTreeStatus(gitCwd).catch(() => null);
27081
+ res.status(200).json(
27082
+ status ? {
27083
+ v: 2,
27084
+ workspaceCwd: gitCwd,
27085
+ branch: status.branch ?? null,
27086
+ detached: status.detached,
27087
+ staged: status.staged,
27088
+ unstaged: status.unstaged,
27089
+ untracked: status.untracked,
27090
+ conflicted: status.conflicted,
27091
+ hasUpstream: status.hasUpstream,
27092
+ ahead: status.ahead,
27093
+ behind: status.behind,
27094
+ stashCount: status.stashCount,
27095
+ ...status.operation ? { operation: status.operation } : {},
27096
+ computedAt: Date.now()
27097
+ } : { v: 2, workspaceCwd: gitCwd, branch: null }
27098
+ );
27099
+ } else {
27100
+ res.status(200).json(await deps.gitState.getStatus(gitCwd, runtime.bridge));
27101
+ }
26567
27102
  } catch (err) {
26568
27103
  deps.sendBridgeError(res, err, { route });
26569
27104
  }
@@ -26716,6 +27251,163 @@ function registerWorkspaceQualifiedGitDiffRoutes(app, deps) {
26716
27251
  }
26717
27252
  __name(registerWorkspaceQualifiedGitDiffRoutes, "registerWorkspaceQualifiedGitDiffRoutes");
26718
27253
 
27254
+ // packages/cli/src/serve/routes/workspace-git-log.ts
27255
+ init_esbuild_shims();
27256
+ function buildLogList(workspaceCwd, result) {
27257
+ if (!result) {
27258
+ return {
27259
+ v: 1,
27260
+ workspaceCwd,
27261
+ available: false,
27262
+ entries: [],
27263
+ hasMore: false
27264
+ };
27265
+ }
27266
+ return {
27267
+ v: 1,
27268
+ workspaceCwd,
27269
+ available: true,
27270
+ entries: result.entries.map((e) => ({
27271
+ sha: e.sha,
27272
+ shortSha: e.shortSha,
27273
+ authorName: e.authorName,
27274
+ authorEmail: e.authorEmail,
27275
+ authorDate: e.authorDate,
27276
+ subject: e.subject,
27277
+ ...e.refs ? { refs: e.refs } : {},
27278
+ parents: e.parents
27279
+ })),
27280
+ hasMore: result.hasMore
27281
+ };
27282
+ }
27283
+ __name(buildLogList, "buildLogList");
27284
+ function buildCommitDetail(workspaceCwd, result) {
27285
+ if (!result) {
27286
+ return { v: 1, workspaceCwd, available: false };
27287
+ }
27288
+ return {
27289
+ v: 1,
27290
+ workspaceCwd,
27291
+ available: true,
27292
+ sha: result.sha,
27293
+ shortSha: result.shortSha,
27294
+ authorName: result.authorName,
27295
+ authorEmail: result.authorEmail,
27296
+ authorDate: result.authorDate,
27297
+ subject: result.subject,
27298
+ body: result.body,
27299
+ ...result.refs ? { refs: result.refs } : {},
27300
+ parents: result.parents,
27301
+ files: result.files.map((f) => ({
27302
+ path: f.path,
27303
+ added: f.added,
27304
+ removed: f.removed,
27305
+ isBinary: f.isBinary
27306
+ })),
27307
+ filesCount: result.filesCount,
27308
+ linesAdded: result.linesAdded,
27309
+ linesRemoved: result.linesRemoved,
27310
+ hiddenCount: result.hiddenCount
27311
+ };
27312
+ }
27313
+ __name(buildCommitDetail, "buildCommitDetail");
27314
+ function parsePagination(req) {
27315
+ const rawLimit = req.query["limit"];
27316
+ const rawSkip = req.query["skip"];
27317
+ const parsedLimit = typeof rawLimit === "string" ? parseInt(rawLimit, 10) : NaN;
27318
+ const parsedSkip = typeof rawSkip === "string" ? parseInt(rawSkip, 10) : NaN;
27319
+ const limit = Math.min(
27320
+ Math.max(Number.isNaN(parsedLimit) ? DEFAULT_LOG_LIMIT : parsedLimit, 1),
27321
+ MAX_LOG_LIMIT
27322
+ );
27323
+ const skip = Math.max(Number.isNaN(parsedSkip) ? 0 : parsedSkip, 0);
27324
+ return { limit, skip };
27325
+ }
27326
+ __name(parsePagination, "parsePagination");
27327
+ async function handleLogList(req, res, workspaceCwd, sendBridgeError2, route) {
27328
+ try {
27329
+ applyReadHeaders(res);
27330
+ const { limit, skip } = parsePagination(req);
27331
+ const result = await fetchGitLog(workspaceCwd, { limit, skip });
27332
+ res.status(200).json(buildLogList(workspaceCwd, result));
27333
+ } catch (err) {
27334
+ sendBridgeError2(res, err, { route });
27335
+ }
27336
+ }
27337
+ __name(handleLogList, "handleLogList");
27338
+ async function handleCommitDetail(req, res, workspaceCwd, sendBridgeError2, route) {
27339
+ const sha = req.query["sha"];
27340
+ if (typeof sha !== "string" || sha.length === 0 || !/^[0-9a-f]{7,40}$/i.test(sha)) {
27341
+ applyReadHeaders(res);
27342
+ res.status(400).json({
27343
+ errorKind: "parse_error",
27344
+ error: "sha query parameter is required",
27345
+ status: 400
27346
+ });
27347
+ return;
27348
+ }
27349
+ try {
27350
+ applyReadHeaders(res);
27351
+ const result = await fetchGitCommitDetail(workspaceCwd, sha);
27352
+ res.status(200).json(buildCommitDetail(workspaceCwd, result));
27353
+ } catch (err) {
27354
+ sendBridgeError2(res, err, { route });
27355
+ }
27356
+ }
27357
+ __name(handleCommitDetail, "handleCommitDetail");
27358
+ function registerWorkspaceGitLogRoutes(app, deps) {
27359
+ app.get("/workspace/git/log", (req, res) => {
27360
+ void handleLogList(
27361
+ req,
27362
+ res,
27363
+ deps.boundWorkspace,
27364
+ deps.sendBridgeError,
27365
+ "GET /workspace/git/log"
27366
+ );
27367
+ });
27368
+ app.get("/workspace/git/log/commit", (req, res) => {
27369
+ void handleCommitDetail(
27370
+ req,
27371
+ res,
27372
+ deps.boundWorkspace,
27373
+ deps.sendBridgeError,
27374
+ "GET /workspace/git/log/commit"
27375
+ );
27376
+ });
27377
+ }
27378
+ __name(registerWorkspaceGitLogRoutes, "registerWorkspaceGitLogRoutes");
27379
+ function resolveTrustedRuntime4(registry, req, res) {
27380
+ const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
27381
+ if (!runtime) return null;
27382
+ return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
27383
+ }
27384
+ __name(resolveTrustedRuntime4, "resolveTrustedRuntime");
27385
+ function registerWorkspaceQualifiedGitLogRoutes(app, deps) {
27386
+ app.get("/workspaces/:workspace/git/log", (req, res) => {
27387
+ const runtime = resolveTrustedRuntime4(deps.workspaceRegistry, req, res);
27388
+ if (!runtime) return;
27389
+ void handleLogList(
27390
+ req,
27391
+ res,
27392
+ runtime.workspaceCwd,
27393
+ deps.sendBridgeError,
27394
+ "GET /workspaces/:workspace/git/log"
27395
+ );
27396
+ });
27397
+ app.get("/workspaces/:workspace/git/log/commit", (req, res) => {
27398
+ const runtime = resolveTrustedRuntime4(deps.workspaceRegistry, req, res);
27399
+ if (!runtime) return;
27400
+ void handleCommitDetail(
27401
+ req,
27402
+ res,
27403
+ runtime.workspaceCwd,
27404
+ deps.sendBridgeError,
27405
+ "GET /workspaces/:workspace/git/log/commit"
27406
+ );
27407
+ });
27408
+ }
27409
+ __name(registerWorkspaceQualifiedGitLogRoutes, "registerWorkspaceQualifiedGitLogRoutes");
27410
+
26719
27411
  // packages/cli/src/serve/workspace-git-state.ts
26720
27412
  init_esbuild_shims();
26721
27413
  var WorkspaceGitState = class {
@@ -28446,6 +29138,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
28446
29138
  maxPendingPromptsPerSession: opts.maxPendingPromptsPerSession,
28447
29139
  eventRingSize: opts.eventRingSize,
28448
29140
  compactedReplayMaxBytes: opts.compactedReplayMaxBytes,
29141
+ initializeTimeoutMs: opts.initializeTimeoutMs,
28449
29142
  permissionResponseTimeoutMs: opts.permissionResponseTimeoutMs,
28450
29143
  boundWorkspace,
28451
29144
  sessionShellCommandEnabled,
@@ -28722,6 +29415,14 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
28722
29415
  workspaceRegistry,
28723
29416
  sendBridgeError: sendBridgeError2
28724
29417
  });
29418
+ registerWorkspaceGitLogRoutes(app, {
29419
+ boundWorkspace: primaryBoundWorkspace,
29420
+ sendBridgeError: sendBridgeError2
29421
+ });
29422
+ registerWorkspaceQualifiedGitLogRoutes(app, {
29423
+ workspaceRegistry,
29424
+ sendBridgeError: sendBridgeError2
29425
+ });
28725
29426
  mountWorkspaceMemoryRoutes(app, {
28726
29427
  bridge: primaryBridge,
28727
29428
  boundWorkspace: primaryBoundWorkspace,