@qwen-code/qwen-code 0.22.0 → 0.22.2-preview.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (449) hide show
  1. package/bundled/computer-use/SKILL.md +229 -0
  2. package/bundled/computer-use/agents/openai.yaml +4 -0
  3. package/bundled/coordinate/SKILL.md +5 -5
  4. package/bundled/qc-helper/docs/configuration/auth.md +7 -7
  5. package/bundled/qc-helper/docs/configuration/model-providers.md +70 -9
  6. package/bundled/qc-helper/docs/configuration/settings.md +40 -40
  7. package/bundled/qc-helper/docs/extension/introduction.md +3 -1
  8. package/bundled/qc-helper/docs/features/channels/_meta.ts +1 -0
  9. package/bundled/qc-helper/docs/features/channels/dingtalk.md +12 -0
  10. package/bundled/qc-helper/docs/features/channels/dws.md +120 -0
  11. package/bundled/qc-helper/docs/features/channels/overview.md +3 -3
  12. package/bundled/qc-helper/docs/features/code-review.md +25 -21
  13. package/bundled/qc-helper/docs/features/commands.md +2 -2
  14. package/bundled/qc-helper/docs/features/computer-use.md +57 -51
  15. package/bundled/qc-helper/docs/features/mcp.md +35 -12
  16. package/bundled/qc-helper/docs/features/sub-agents.md +1 -1
  17. package/bundled/qc-helper/docs/features/worktree.md +1 -1
  18. package/bundled/qc-helper/docs/overview.md +1 -1
  19. package/bundled/qc-helper/docs/quickstart.md +1 -1
  20. package/bundled/qc-helper/docs/qwen-serve.md +29 -6
  21. package/bundled/review/SKILL.md +119 -417
  22. package/bundled/review/references/aone.md +18 -0
  23. package/bundled/review/references/persistence.md +105 -0
  24. package/bundled/review/references/posting.md +270 -0
  25. package/chunks/MaxSizedBox-XYQOMOBE.js +112 -0
  26. package/chunks/{StandaloneSessionPicker-KTHPCSR6.js → StandaloneSessionPicker-KFMJILVY.js} +87 -86
  27. package/chunks/{acp-startup-profiler-T4GEAPLX.js → acp-startup-profiler-GNYAL6LI.js} +2 -2
  28. package/chunks/{acpAgent-CRY3JZ5O.js → acpAgent-KNFTTDWL.js} +2216 -1931
  29. package/chunks/agent-6V6MZOA7.js +97 -0
  30. package/chunks/agent-headless-3ZC4LX3E.js +87 -0
  31. package/chunks/{anthropicContentGenerator-Y2OX6LS4.js → anthropicContentGenerator-U76GTVB6.js} +128 -58
  32. package/chunks/{artifact-tool-SBXMTVCB.js → artifact-tool-XDJCZZCF.js} +2 -2
  33. package/chunks/{askUserQuestion-KEQJRFD6.js → askUserQuestion-ZXXERLEV.js} +2 -2
  34. package/chunks/bridge-LFFLHLU5.js +119 -0
  35. package/chunks/{ca-D3F4S6NG.js → ca-7HPYOYSZ.js} +3 -0
  36. package/chunks/{channel-management-service-IRTT7RNE.js → channel-management-service-HXXS3HOZ.js} +4 -4
  37. package/chunks/channel-settings-store-CAL2HWAH.js +117 -0
  38. package/chunks/{channel-worker-group-BJNMR2MP.js → channel-worker-group-EVDC2P4K.js} +8 -7
  39. package/chunks/{channel-worker-manager-EMA7CQDJ.js → channel-worker-manager-IJJZHGEI.js} +8 -7
  40. package/chunks/{channel-worker-supervisor-F6I6WSWW.js → channel-worker-supervisor-YSKB5GVB.js} +12 -7
  41. package/chunks/{chunk-2TRNCJK4.js → chunk-27ONXAFY.js} +1 -1
  42. package/chunks/{read-package-up-UXSW3YPB.js → chunk-2EAZ43JQ.js} +1 -0
  43. package/chunks/{chunk-DB2OKNTU.js → chunk-2FN2HNTI.js} +2 -2
  44. package/chunks/{chunk-KM73TBQ4.js → chunk-2LD5U7Q3.js} +31 -0
  45. package/chunks/{chunk-QJHPWLZC.js → chunk-2MHGD7EE.js} +1 -1
  46. package/chunks/{chunk-A5F2YNO6.js → chunk-2NNTE2ED.js} +245 -10
  47. package/chunks/{chunk-Z3JMO2CH.js → chunk-2SERYG4T.js} +1 -1
  48. package/chunks/{chunk-4J7OPYNS.js → chunk-2YDYDDE2.js} +6 -6
  49. package/chunks/{chunk-SE55HQGF.js → chunk-3B5DCAQU.js} +74 -52
  50. package/chunks/{chunk-UIRLQ3N7.js → chunk-3BV7TZNQ.js} +3 -3
  51. package/chunks/{chunk-2Z6LSQMF.js → chunk-3FSBMAYD.js} +1 -1
  52. package/chunks/{chunk-S4C4JJKE.js → chunk-3UXJFOB3.js} +5 -5
  53. package/chunks/{chunk-DJEHYM4H.js → chunk-3UZCLCXR.js} +3 -3
  54. package/chunks/{chunk-BUGYW6FB.js → chunk-4IDJQOCO.js} +1 -1
  55. package/chunks/chunk-4K7NQDCG.js +104 -0
  56. package/chunks/{chunk-WS7PAXXR.js → chunk-4N6UAPD3.js} +18 -13
  57. package/chunks/{chunk-VYC7XFYV.js → chunk-4PLAO7FS.js} +5 -5
  58. package/chunks/{chunk-UZPYR3EV.js → chunk-4TPAG3O7.js} +1 -1
  59. package/chunks/{chunk-2E3V7G6Y.js → chunk-4X5GYZFO.js} +55 -50
  60. package/chunks/{chunk-XYQHT3AW.js → chunk-4Z3PSHN4.js} +2 -2
  61. package/chunks/{chunk-PDL6LKB5.js → chunk-5AFPOEY3.js} +1 -1
  62. package/chunks/{chunk-BB5IMQCV.js → chunk-5CW26JIE.js} +2 -2
  63. package/chunks/{chunk-7KOFLDEP.js → chunk-5JTIYALA.js} +1 -1
  64. package/chunks/{chunk-U2UYQMM6.js → chunk-5NV2AN56.js} +3 -3
  65. package/chunks/{chunk-CXJHQVEK.js → chunk-5PA6UEYA.js} +4 -0
  66. package/chunks/{chunk-IBJ5S45N.js → chunk-5T4LWWNX.js} +2 -2
  67. package/chunks/{chunk-VUMLT7E5.js → chunk-5Y2JCJAH.js} +2 -2
  68. package/chunks/{chunk-BEGIBJAZ.js → chunk-6HOU52QX.js} +4 -4
  69. package/chunks/{chunk-GAHYKJPV.js → chunk-6US7BF3G.js} +7 -59
  70. package/chunks/{chunk-3CLIDIVQ.js → chunk-73WFGVIZ.js} +3 -3
  71. package/chunks/{chunk-ZZUVC6RI.js → chunk-76WGY6LW.js} +3 -3
  72. package/chunks/{chunk-XLDFW44M.js → chunk-77TOMRBG.js} +3 -3
  73. package/chunks/{chunk-ND7NOI4P.js → chunk-7CWEZQ6T.js} +0 -15
  74. package/chunks/{chunk-DWCKACFL.js → chunk-7DPKPBOQ.js} +2 -2
  75. package/chunks/{chunk-X7V3N6YH.js → chunk-7JJUFI36.js} +218 -37
  76. package/chunks/{chunk-45NQKMYB.js → chunk-7JPW6IYH.js} +1 -1
  77. package/chunks/{chunk-HDKCKCYO.js → chunk-7QGEJI7M.js} +1 -1
  78. package/chunks/{chunk-PHJJ3RVO.js → chunk-7XKW4CVK.js} +7 -15
  79. package/chunks/{chunk-O5Z7EB6Y.js → chunk-AYHQZBJ4.js} +170 -207
  80. package/chunks/{chunk-7DYNJFES.js → chunk-AYVIGUUK.js} +6 -1
  81. package/chunks/{chunk-43T5WDQ7.js → chunk-BFSFJR3D.js} +1 -1
  82. package/chunks/{chunk-OARZJFZX.js → chunk-BGWT7VBV.js} +4 -4
  83. package/chunks/{chunk-AP3B7LKD.js → chunk-BKDAF7ES.js} +2 -2
  84. package/chunks/{chunk-B6UBOIFE.js → chunk-BQBUZDDH.js} +14 -11
  85. package/chunks/{chunk-6PCOVQO2.js → chunk-BU7OUDQB.js} +8 -8
  86. package/chunks/{chunk-VLRBJ24J.js → chunk-BVE5EMIG.js} +2 -2
  87. package/chunks/{chunk-6UQSU7CQ.js → chunk-C2BAEV64.js} +58 -107
  88. package/chunks/{chunk-QKBYFU2Q.js → chunk-CFKIH3D3.js} +21 -1
  89. package/chunks/{chunk-URN2JIAQ.js → chunk-CITGRGCM.js} +2 -1
  90. package/chunks/{chunk-WU5E4HMO.js → chunk-CPPYZHBN.js} +1 -1
  91. package/chunks/{chunk-T6XLJRQY.js → chunk-D6XO27Z5.js} +36509 -5182
  92. package/chunks/{chunk-Q54XG7IX.js → chunk-DEYPMJPD.js} +1 -1
  93. package/chunks/{chunk-KSPRQSB4.js → chunk-DIMEPKCW.js} +52 -12
  94. package/chunks/{chunk-I432KXWD.js → chunk-DP7LABIB.js} +1 -1
  95. package/chunks/{chunk-P47E4SJC.js → chunk-DWRFOH3G.js} +3 -3
  96. package/chunks/{chunk-J5ZDDUKM.js → chunk-DX5FZGHZ.js} +4 -4
  97. package/chunks/{chunk-36OF5PRW.js → chunk-E4I5MVBR.js} +7 -3
  98. package/chunks/{chunk-AW27A43Y.js → chunk-E55H6BZ7.js} +93 -1
  99. package/chunks/{chunk-K623ENWT.js → chunk-E6FGMDFQ.js} +4 -0
  100. package/chunks/{chunk-YZBDKFRQ.js → chunk-EADEZDPO.js} +993 -895
  101. package/chunks/{chunk-5XUTPXQU.js → chunk-EAV3TENS.js} +6 -9
  102. package/chunks/{chunk-LI4YHTQK.js → chunk-EB4VDXNI.js} +1 -1
  103. package/chunks/{chunk-JOLJTKIG.js → chunk-EC5BONC3.js} +1 -1
  104. package/chunks/{chunk-W4CRPSC5.js → chunk-ELY4QVIB.js} +1 -1
  105. package/chunks/{chunk-AVCCKIZ6.js → chunk-EWBY3PFB.js} +1 -1
  106. package/chunks/chunk-FBX2SDQ4.js +48 -0
  107. package/chunks/{chunk-C72BXMJ5.js → chunk-FJWICLG7.js} +1 -1
  108. package/chunks/{chunk-LDGWX737.js → chunk-FN5C6C7G.js} +160 -59
  109. package/chunks/{chunk-3ZFJUBTP.js → chunk-FPH6TXD3.js} +1 -1
  110. package/chunks/{chunk-WRT324N6.js → chunk-FVDQ5E67.js} +3 -3
  111. package/chunks/{chunk-2A4C2MEG.js → chunk-FY62MBPS.js} +35 -12
  112. package/chunks/{chunk-VFACN2CE.js → chunk-GNMJNDZE.js} +1 -1
  113. package/chunks/{chunk-6QSA4JHL.js → chunk-GQAIZL3H.js} +2772 -814
  114. package/chunks/{chunk-PZRUV52H.js → chunk-GTUKW3I6.js} +20 -2
  115. package/chunks/{chunk-7DMTAQJ6.js → chunk-GXWY24QS.js} +132 -49
  116. package/chunks/chunk-GYTKQYDB.js +23 -0
  117. package/chunks/{chunk-VMJL7RH6.js → chunk-GZJUCMH4.js} +4 -4
  118. package/chunks/{chunk-2GXYDNXP.js → chunk-H2MDBYLL.js} +8 -8
  119. package/chunks/{chunk-RDG44S5I.js → chunk-H4JK2A2V.js} +2 -2
  120. package/chunks/{chunk-FVBVJEBG.js → chunk-HOANA6GC.js} +10 -8
  121. package/chunks/{chunk-AO4M6NMD.js → chunk-I6HWGOWD.js} +60 -20
  122. package/chunks/{chunk-7IV52LTO.js → chunk-I6VVOZDK.js} +2 -2
  123. package/chunks/{chunk-SQS55KR4.js → chunk-IJVDHPKD.js} +2 -2
  124. package/chunks/{chunk-QS4ENGVF.js → chunk-IKN3IUJP.js} +9 -8
  125. package/chunks/{chunk-2UZJWSVD.js → chunk-ILPXSKGQ.js} +2 -2
  126. package/chunks/{chunk-OVH5Y7KS.js → chunk-IN66KO3N.js} +19 -3
  127. package/chunks/{chunk-ZRYQMWEP.js → chunk-IPQA4SR5.js} +2 -2
  128. package/chunks/{chunk-AZF6SME3.js → chunk-JECO75XD.js} +3 -3
  129. package/chunks/{chunk-MQP3MHWN.js → chunk-JJJD6QCC.js} +21 -15
  130. package/chunks/chunk-JLGFGPZJ.js +346 -0
  131. package/chunks/{chunk-WZDM44SB.js → chunk-JUIJ3FXC.js} +7 -7
  132. package/chunks/{chunk-A6NRNRKE.js → chunk-JVPFTDBK.js} +1 -1
  133. package/chunks/{chunk-2J3OJGTL.js → chunk-K2OJUPOE.js} +1 -21
  134. package/chunks/{chunk-GHY5OIYP.js → chunk-K5PNJ6VL.js} +13 -13
  135. package/chunks/{chunk-NW35NVFN.js → chunk-K6FURWIX.js} +4 -4
  136. package/chunks/{chunk-6NFAEG54.js → chunk-KOJ6MHD5.js} +24 -13
  137. package/chunks/{chunk-A5F63FEW.js → chunk-L436XFLJ.js} +1 -1
  138. package/chunks/{chunk-GIWB5QLV.js → chunk-LJP2BBMK.js} +4 -4
  139. package/chunks/{chunk-FYZMB6DB.js → chunk-LKOSBI2M.js} +11 -11
  140. package/chunks/{create-sub-session-XBCVGNFU.js → chunk-LRKMQPMD.js} +4 -6
  141. package/chunks/{chunk-5HJUPACR.js → chunk-LRLMDV5X.js} +2 -2
  142. package/chunks/{chunk-MHG6NDS6.js → chunk-MB4OCRQ2.js} +2 -2
  143. package/chunks/{chunk-IIWGSX4L.js → chunk-MI7CMXPU.js} +1 -1
  144. package/chunks/{chunk-ZLCT4C5A.js → chunk-MZS7GEC7.js} +1 -1
  145. package/chunks/{chunk-WWUSHZ7M.js → chunk-N4B7VPXK.js} +5 -5
  146. package/chunks/{chunk-BMCSKS37.js → chunk-NUHCXGAD.js} +6 -6
  147. package/chunks/{chunk-XZJKSETB.js → chunk-O3BUXIPM.js} +3 -3
  148. package/chunks/{chunk-4XPSVIED.js → chunk-O5YGAEQS.js} +6 -6
  149. package/chunks/{chunk-ZRFUT5VV.js → chunk-OAAPGZVH.js} +7 -7
  150. package/chunks/{chunk-UU4WC7DK.js → chunk-OGZAQWJP.js} +82 -12
  151. package/chunks/{chunk-5XHAOUWD.js → chunk-OI2DR6QB.js} +3 -3
  152. package/chunks/{chunk-EFB657PR.js → chunk-OX44MOAN.js} +3 -3
  153. package/chunks/{chunk-LURJYO2T.js → chunk-OZ6KS6KW.js} +4 -0
  154. package/chunks/{chunk-4F5WV4RF.js → chunk-PAJGKZAA.js} +281 -10
  155. package/chunks/{chunk-HIK2OF33.js → chunk-PVBT5QPD.js} +1 -1
  156. package/chunks/{chunk-MPHLIJYL.js → chunk-QB5DD75E.js} +14 -8
  157. package/chunks/chunk-QHMLYMMS.js +32 -0
  158. package/chunks/{chunk-4CWDWDL6.js → chunk-RCDXSEJ5.js} +1 -1
  159. package/chunks/{chunk-L4HVF7LM.js → chunk-RQ5ASDFQ.js} +3 -3
  160. package/chunks/{chunk-PXOJLJ5W.js → chunk-RQAMNZ4Y.js} +333 -184
  161. package/chunks/{chunk-K52PZNU4.js → chunk-RRKNX553.js} +2 -2
  162. package/chunks/{chunk-RPJQ3O4M.js → chunk-RUJTCU46.js} +31 -41
  163. package/chunks/{chunk-62JOGZL5.js → chunk-RUQBJS34.js} +199 -87
  164. package/chunks/chunk-RXFQM6FQ.js +42 -0
  165. package/chunks/{chunk-SJ4HB27T.js → chunk-SDVF6A42.js} +3 -3
  166. package/chunks/{chunk-TBVSALA3.js → chunk-SKNVVYIJ.js} +3 -3
  167. package/chunks/{chunk-JGUBDRBC.js → chunk-SLEWBQWM.js} +3 -3
  168. package/chunks/{chunk-UUQFJILB.js → chunk-SQPOJ4ZI.js} +15 -3
  169. package/chunks/{chunk-ISJMN3ML.js → chunk-T2CRBIDJ.js} +1 -1
  170. package/chunks/{chunk-MZKWFWVG.js → chunk-T2HMXHYA.js} +6 -6
  171. package/chunks/{chunk-FEMQ6Y7W.js → chunk-T6OODF2U.js} +47 -126
  172. package/chunks/{chunk-KVGR4MCF.js → chunk-TOF4UZHH.js} +3 -3
  173. package/chunks/{chunk-7HFULI45.js → chunk-TQYZG5DU.js} +3 -3
  174. package/chunks/{chunk-LD5VIJ7S.js → chunk-TWSKM647.js} +1 -1
  175. package/chunks/{chunk-25NESM4G.js → chunk-TWUA5EIL.js} +29 -5
  176. package/chunks/{chunk-6FRJEE2S.js → chunk-U66FXEH2.js} +5 -5
  177. package/chunks/{chunk-7NBVNAJJ.js → chunk-UCSV2IZW.js} +3 -3
  178. package/chunks/chunk-UVDOONRU.js +20 -0
  179. package/chunks/{chunk-FDD2IUEL.js → chunk-UX3IFLJM.js} +229 -21
  180. package/chunks/{chunk-YDJRMQU4.js → chunk-V3GINY6K.js} +3 -3
  181. package/chunks/{chunk-XL5K4SVK.js → chunk-VL4YX3FH.js} +1 -1
  182. package/chunks/{chunk-ZS5BHEPD.js → chunk-VLY6XOBY.js} +1 -1
  183. package/chunks/{chunk-KIVGVFMM.js → chunk-VUZY6MEQ.js} +16 -4
  184. package/chunks/{chunk-OE52YHCZ.js → chunk-W2WRNJKX.js} +11 -11
  185. package/chunks/{chunk-YLFLHKDL.js → chunk-W3N5XAZ6.js} +1 -1
  186. package/chunks/{chunk-IWOWEENB.js → chunk-WBT3STGU.js} +385 -25
  187. package/chunks/{chunk-S3G6YFQC.js → chunk-WEGXPP5E.js} +1 -1
  188. package/chunks/{chunk-RDQ7QB4Y.js → chunk-XJS54K4A.js} +2 -2
  189. package/chunks/{chunk-7JBHIQS2.js → chunk-XO4NGYRP.js} +7 -13
  190. package/chunks/{chunk-F6WFNA7U.js → chunk-XZA32HII.js} +3 -6
  191. package/chunks/{chunk-VEND4KA4.js → chunk-YT5XN3HV.js} +1 -1
  192. package/chunks/{chunk-NUGZAFR2.js → chunk-ZEADBZLO.js} +147 -6
  193. package/chunks/chunk-ZELCTN6Y.js +29 -0
  194. package/chunks/{chunk-TQOF5KBL.js → chunk-ZEZKIS2K.js} +0 -31
  195. package/chunks/{chunk-IOSEW6KP.js → chunk-ZJG323IA.js} +5 -4
  196. package/chunks/{chunk-VSNPOSDN.js → chunk-ZKAZP2ZG.js} +107 -12
  197. package/chunks/{chunk-YMVFIYHV.js → chunk-ZLTEQYNC.js} +2 -2
  198. package/chunks/{chunk-O5BDEWBC.js → chunk-ZWKGZB2K.js} +3 -3
  199. package/chunks/chunk-ZYNTSXWK.js +32 -0
  200. package/chunks/config-utils-YMJNA25D.js +113 -0
  201. package/chunks/contextCommand-WMPSNKPG.js +108 -0
  202. package/chunks/{core-runtime-CES6JSVV.js → core-runtime-6TBMEULI.js} +63 -58
  203. package/chunks/create-sub-session-RVHSWVAP.js +17 -0
  204. package/chunks/{create-sub-session-UJTPMVOG.js → create-sub-session-SAOMTP62.js} +60 -58
  205. package/chunks/{cron-create-IKA56DAF.js → cron-create-IJGVR5R2.js} +4 -4
  206. package/chunks/{cron-delete-K5Q62EGH.js → cron-delete-4N5BI6GL.js} +4 -4
  207. package/chunks/{cron-list-QBFGAMP7.js → cron-list-2CATIPUX.js} +4 -4
  208. package/chunks/{daemon-RZZUPGOJ.js → daemon-NAYK4XXU.js} +51 -24
  209. package/chunks/{daemon-git-worktree-guard-3QY2BQYB.js → daemon-git-worktree-guard-TYLESM6G.js} +338 -92
  210. package/chunks/daemon-status-provider-YBQAZD3G.js +118 -0
  211. package/chunks/daemon-trust-policy-O75ZSIJN.js +114 -0
  212. package/chunks/{daemon-trust-policy-monitor-TK4K7M63.js → daemon-trust-policy-monitor-WWX7I7P6.js} +68 -66
  213. package/chunks/{de-RYUHH2C6.js → de-X6HLSIFE.js} +1 -0
  214. package/chunks/deferred-core-runtime-MGCCR6LA.js +116 -0
  215. package/chunks/{display-image-OEJMJV3S.js → display-image-DR55LL6M.js} +5 -5
  216. package/chunks/dist-4Q7NTUNB.js +2512 -0
  217. package/chunks/{dist-ESS34DHC.js → dist-6H6RZ5H6.js} +2 -2
  218. package/chunks/{dist-LZO24N3E.js → dist-7CKN54NL.js} +1 -1
  219. package/chunks/{dist-5EV2G6MC.js → dist-DJBNNPLN.js} +1 -1
  220. package/chunks/{dist-J6P3C52Z.js → dist-FVJZSIO4.js} +28 -7
  221. package/chunks/{dist-K7IQB53U.js → dist-SATKXKUR.js} +1 -1
  222. package/chunks/{dist-ES6HNUW2.js → dist-TJUDJTCB.js} +246 -17
  223. package/chunks/{dist-VVQBOKDH.js → dist-UQUFZDIY.js} +1 -1
  224. package/chunks/{dist-2OG3PGKO.js → dist-ZBVOXSKF.js} +3 -3
  225. package/chunks/earlyInputCapture-2EJKJET3.js +109 -0
  226. package/chunks/{edit-A2633SLR.js → edit-GBDKI5DZ.js} +48 -48
  227. package/chunks/{en-3RHLPITS.js → en-6MDBWMTG.js} +3 -0
  228. package/chunks/{enter-worktree-OIAHE2TB.js → enter-worktree-UOZ6ZTP7.js} +7 -8
  229. package/chunks/{enterPlanMode-SUGIKLR7.js → enterPlanMode-2KTIPPM3.js} +47 -47
  230. package/chunks/environment-XJ75LJ6N.js +131 -0
  231. package/chunks/errors-XEI3SJRV.js +115 -0
  232. package/chunks/{exit-worktree-3UT3SSWT.js → exit-worktree-G2QATUCV.js} +7 -8
  233. package/chunks/exitPlanMode-AUMYTFIQ.js +85 -0
  234. package/chunks/{fast-path-3AVP3G35.js → fast-path-TU7U2ETU.js} +28 -7
  235. package/chunks/{fast-path-settings-WHX3J3ZI.js → fast-path-settings-XMFBYFUH.js} +2 -2
  236. package/chunks/{fr-4PL5GHG4.js → fr-FTZWF462.js} +1 -0
  237. package/chunks/{gemini-7PVQWHTH.js → gemini-FKMYDP64.js} +129 -123
  238. package/chunks/{geminiContentGenerator-B2FOJJDJ.js → geminiContentGenerator-WSHP7CSR.js} +16 -13
  239. package/chunks/{glob-7YGXE6OV.js → glob-EOM6XK7H.js} +47 -47
  240. package/chunks/{goal-tools-TLJCE7YZ.js → goal-tools-CNVXMSZD.js} +72 -28
  241. package/chunks/{grep-6DV6LTON.js → grep-3NLSS32D.js} +6 -6
  242. package/chunks/handleAutoUpdate-S4CLP36D.js +111 -0
  243. package/chunks/i18n-XX7U2Q3X.js +126 -0
  244. package/chunks/{image-gen-7CSCJ73T.js → image-gen-63NN2H5N.js} +9 -11
  245. package/chunks/initializer-D3CA3272.js +115 -0
  246. package/chunks/installationInfo-HVDQOSIE.js +109 -0
  247. package/chunks/{ja-HZ7X7PQO.js → ja-2GL5FKYJ.js} +1 -0
  248. package/chunks/{keychain-token-storage-MTFTAESK.js → keychain-token-storage-3MGFRYGM.js} +2 -2
  249. package/chunks/list-XUDSTGT3.js +118 -0
  250. package/chunks/{list-agents-43XUEXJV.js → list-agents-EXRSHIDJ.js} +2 -2
  251. package/chunks/loadedSettingsAdapter-ZOJ4QEID.js +112 -0
  252. package/chunks/{loggingContentGenerator-RNE66CKK.js → loggingContentGenerator-TUDGCVUG.js} +27 -30
  253. package/chunks/{loop-wakeup-E54KDUXC.js → loop-wakeup-XBPB2BRO.js} +5 -5
  254. package/chunks/{ls-CGL2UC3H.js → ls-WFONAND2.js} +4 -4
  255. package/chunks/{lsp-5IKUO5DX.js → lsp-DUKPDUXN.js} +2 -2
  256. package/chunks/{managed-npm-update-Y3SC3GLJ.js → managed-npm-update-5K4FWFX2.js} +61 -59
  257. package/chunks/mcp-QJ6AUYE5.js +112 -0
  258. package/chunks/{monitor-PXYSGSUN.js → monitor-UUHIAGT7.js} +47 -47
  259. package/chunks/nonInteractiveCli-PAWO75YO.js +185 -0
  260. package/chunks/{notebook-edit-ISIBJVBR.js → notebook-edit-GZPB3Q57.js} +48 -48
  261. package/chunks/open-with-auth-4UI3KHUR.js +55 -0
  262. package/chunks/{openaiContentGenerator-6TBOPEGT.js → openaiContentGenerator-RPP6YBS3.js} +29 -30
  263. package/chunks/pidfile-RF3WUFKR.js +113 -0
  264. package/chunks/{processUtils-YK2TDTTU.js → processUtils-ENAY2GSA.js} +2 -2
  265. package/chunks/prompt-terminal-ledger-4CCXZ2LF.js +107 -0
  266. package/chunks/{pt-QT5N2Q6Q.js → pt-XN2YWJVM.js} +1 -0
  267. package/chunks/{qwenContentGenerator-CLDMA2Y4.js → qwenContentGenerator-GLUZVJAU.js} +53 -59
  268. package/chunks/{qwenOAuth2-DLDR6UC5.js → qwenOAuth2-JIYAWXTW.js} +8 -10
  269. package/chunks/{read-file-2HOD2ATO.js → read-file-75R5LUWQ.js} +13 -14
  270. package/chunks/{read-mcp-resource-XYES2B42.js → read-mcp-resource-7A7NFSFL.js} +2 -2
  271. package/chunks/read-package-up-6T6ICKR7.js +13 -0
  272. package/chunks/{record-artifact-W3IBTGL7.js → record-artifact-CPJ4IJSD.js} +4 -5
  273. package/chunks/report-findings-VFM5DENC.js +33 -0
  274. package/chunks/request-shutdown-AXVOFN5C.js +133 -0
  275. package/chunks/resumeHistoryUtils-GFPJD2XB.js +120 -0
  276. package/chunks/ripGrep-FNLXQYBS.js +39 -0
  277. package/chunks/{ru-STMG5BPD.js → ru-OLTMFJEW.js} +1 -0
  278. package/chunks/{run-qwen-serve-XJHOW2NY.js → run-qwen-serve-FJD4VMI2.js} +622 -79
  279. package/chunks/{runtime-J4SPTJRQ.js → runtime-INDSJB4K.js} +73 -71
  280. package/chunks/{scheduler-VRAEZZ4E.js → scheduler-Z52TCSUG.js} +62 -60
  281. package/chunks/{sdk-exporters-http-RSIOP3G2.js → sdk-exporters-http-XXSKBD2C.js} +5 -5
  282. package/chunks/{sdk-impl-CB3KARSK.js → sdk-impl-VPNBLV7I.js} +7 -7
  283. package/chunks/{send-message-J4VT46OI.js → send-message-A2GXDX3B.js} +10 -31
  284. package/chunks/serve-GVD2WXVL.js +120 -0
  285. package/chunks/{server-74ONDK62.js → server-PSN5OOSX.js} +965 -405
  286. package/chunks/{session-BO6VBWJP.js → session-JPE34X6Q.js} +151 -140
  287. package/chunks/{settings-35QZNFDG.js → settings-IVGC4UYK.js} +71 -69
  288. package/chunks/shell-A5PZGPBR.js +95 -0
  289. package/chunks/{skill-DKEMQSNJ.js → skill-UUXQPDEH.js} +108 -25
  290. package/chunks/skill-settings-WVRXLTK4.js +120 -0
  291. package/chunks/spawnChannel-KTURLD4B.js +113 -0
  292. package/chunks/standalone-update-IRFRNGAA.js +120 -0
  293. package/chunks/{startInteractiveUI-J2QSGWPU.js → startInteractiveUI-MC4GLL6G.js} +381 -293
  294. package/chunks/{syntheticOutput-JAXMIMZP.js → syntheticOutput-5AJ444QT.js} +3 -3
  295. package/chunks/{task-create-I2H322E4.js → task-create-CDJSOEQD.js} +11 -11
  296. package/chunks/{task-list-3OLIWFTQ.js → task-list-BELMPA75.js} +5 -5
  297. package/chunks/{task-stop-JAUY6MSY.js → task-stop-U3S3KZG2.js} +2 -2
  298. package/chunks/{task-update-B3XO4CPI.js → task-update-77VCFDDZ.js} +11 -11
  299. package/chunks/{team-create-W534PMGX.js → team-create-WO5ZBCFW.js} +48 -48
  300. package/chunks/{team-delete-Q7GE7RRI.js → team-delete-YWFXX77L.js} +5 -5
  301. package/chunks/{team-plan-approval-WNV6P6NG.js → team-plan-approval-KAVKRN7U.js} +47 -47
  302. package/chunks/terminal-image-renderer-SMRRNI6Z.js +116 -0
  303. package/chunks/theme-manager-A7CPN7F4.js +104 -0
  304. package/chunks/{todoWrite-FJJTY2TI.js → todoWrite-435EO2CS.js} +4 -4
  305. package/chunks/{tool-search-Y4KL3LRE.js → tool-search-FBN6OC6U.js} +18 -19
  306. package/chunks/total-session-admission-B7U6UWKQ.js +114 -0
  307. package/chunks/trustedFolders-B4LPJBFK.js +124 -0
  308. package/chunks/{update-relaunch-OHVFN6KF.js → update-relaunch-X5TJVKVG.js} +6 -6
  309. package/chunks/updateCheck-JCLP5JFT.js +120 -0
  310. package/chunks/useAutoAcceptIndicator-VBT3NKDM.js +122 -0
  311. package/chunks/{validateNonInterActiveAuth-WJXH426F.js → validateNonInterActiveAuth-W7HYH5ZN.js} +113 -106
  312. package/chunks/{version-QMDRADXM.js → version-JG4J76GL.js} +2 -2
  313. package/chunks/{web-fetch-ROS6P4LP.js → web-fetch-SPLMEDWF.js} +25 -242
  314. package/chunks/{web-search-JS3E76O6.js → web-search-PNW6OEH6.js} +11 -11
  315. package/chunks/{web-shell-static-3NUTRHAH.js → web-shell-static-A6QMUNNV.js} +11 -4
  316. package/chunks/webapi-Z5OM224P.js +4118 -0
  317. package/chunks/{workflow-2FCMBTBZ.js → workflow-QHOIIXJO.js} +635 -94
  318. package/chunks/workspace-providers-status-653DTR35.js +116 -0
  319. package/chunks/{workspace-registration-store-SU4EJKSD.js → workspace-registration-store-H375IYR2.js} +1 -1
  320. package/chunks/workspace-registry-XTLCD7Z2.js +123 -0
  321. package/chunks/workspace-service-KVJWACCS.js +131 -0
  322. package/chunks/workspace-skills-status-TRJ2VWGU.js +115 -0
  323. package/chunks/{workspace-trust-reconciler-4Y4F7XIX.js → workspace-trust-reconciler-6SC6RKQE.js} +74 -73
  324. package/chunks/write-file-EAZSJZKR.js +90 -0
  325. package/chunks/{zh-TW-NX43Z2S2.js → zh-TW-MV4FWFB6.js} +3 -0
  326. package/chunks/{zh-3JQ75KFU.js → zh-X3WGU6SI.js} +3 -0
  327. package/chunks/{zoom-image-DNBKCGGF.js → zoom-image-WGNPZ572.js} +13 -14
  328. package/cli.js +15 -15
  329. package/locales/ca.js +3 -0
  330. package/locales/de.js +1 -0
  331. package/locales/en.js +3 -0
  332. package/locales/fr.js +1 -0
  333. package/locales/ja.js +1 -0
  334. package/locales/pt.js +1 -0
  335. package/locales/ru.js +1 -0
  336. package/locales/zh-TW.js +3 -0
  337. package/locales/zh.js +3 -0
  338. package/package.json +3 -3
  339. package/web-shell/assets/{abnfDiagram-VCTEODGH-DWHXEVlf.js → abnfDiagram-VCTEODGH-yq7z7Anb.js} +1 -1
  340. package/web-shell/assets/{arc-CXKjm86V.js → arc-CbJO0xnT.js} +1 -1
  341. package/web-shell/assets/{architectureDiagram-5GKGNRK7-B_ynI0cX.js → architectureDiagram-5GKGNRK7-CRh89421.js} +1 -1
  342. package/web-shell/assets/{blockDiagram-NRAW4CY4-DMebd9X0.js → blockDiagram-NRAW4CY4-C75KAhKv.js} +1 -1
  343. package/web-shell/assets/{c4Diagram-UCG6FXSJ-BZ5BlxS-.js → c4Diagram-UCG6FXSJ-BzlMveFB.js} +1 -1
  344. package/web-shell/assets/channel-B3sGR79J.js +1 -0
  345. package/web-shell/assets/{chunk-2Q5K7J3B-CluJKopE.js → chunk-2Q5K7J3B-DA8QDX3a.js} +1 -1
  346. package/web-shell/assets/{chunk-5VM5RSS4-hzDAPFOo.js → chunk-5VM5RSS4-Bgu7gQ7Y.js} +1 -1
  347. package/web-shell/assets/{chunk-F27PBJKO-6vHioKJe.js → chunk-F27PBJKO-BOew7pIK.js} +1 -1
  348. package/web-shell/assets/{chunk-G27WJ6UU-B_5hKTGo.js → chunk-G27WJ6UU-DHx1I-hO.js} +1 -1
  349. package/web-shell/assets/{chunk-JWPE2WC7-CO9VoFCH.js → chunk-JWPE2WC7-SarFW0WU.js} +1 -1
  350. package/web-shell/assets/{chunk-LCL6LL3I-7L5JpxYu.js → chunk-LCL6LL3I-BLzP083Z.js} +1 -1
  351. package/web-shell/assets/{chunk-POPQ4Y6H-DHLJMAqj.js → chunk-POPQ4Y6H-Bmkv_iKm.js} +1 -1
  352. package/web-shell/assets/{chunk-SVP7TREG-Dt-4Cqdl.js → chunk-SVP7TREG-MPx9r1N2.js} +1 -1
  353. package/web-shell/assets/{chunk-XXDRQBXY-QlSQ3ssG.js → chunk-XXDRQBXY-Ck-09rKG.js} +1 -1
  354. package/web-shell/assets/classDiagram-DTDB5LWJ-sTGo0K3v.js +1 -0
  355. package/web-shell/assets/classDiagram-v2-JRS7N3AN-sTGo0K3v.js +1 -0
  356. package/web-shell/assets/{cose-bilkent-JH36ORCC-DMw3EOxl.js → cose-bilkent-JH36ORCC-DWm6lfOG.js} +1 -1
  357. package/web-shell/assets/{cynefin-OW5HDTMX-s6vEA7RQ.js → cynefin-OW5HDTMX-DcBUyr5R.js} +1 -1
  358. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-AOKsvYLt.js → cynefinDiagram-5FMLGOSQ-Df8qmd_p.js} +1 -1
  359. package/web-shell/assets/{dagre-3AP2YEHR-9QAZn3m7.js → dagre-3AP2YEHR-DDmGspD7.js} +1 -1
  360. package/web-shell/assets/{diagram-S7CK7UJ4-CWpnu4FN.js → diagram-S7CK7UJ4-BK_qFvbi.js} +1 -1
  361. package/web-shell/assets/{diagram-UQ7AKVKN-9l0jXD8q.js → diagram-UQ7AKVKN-Uw3AP_bi.js} +1 -1
  362. package/web-shell/assets/{diagram-VSXAHHWV-BMUHroj4.js → diagram-VSXAHHWV-CJOQKxY7.js} +1 -1
  363. package/web-shell/assets/{diagram-VX7I27RA-Co9x27vm.js → diagram-VX7I27RA-DhdvZna5.js} +1 -1
  364. package/web-shell/assets/{diagram-Z3DM3KII-BKnTeOER.js → diagram-Z3DM3KII-edQU0nlP.js} +1 -1
  365. package/web-shell/assets/{ebnfDiagram-PWID7BFC-QBZD9CKG.js → ebnfDiagram-PWID7BFC-4kugBEsO.js} +1 -1
  366. package/web-shell/assets/{erDiagram-SSCWMZ5O-dKWAEGun.js → erDiagram-SSCWMZ5O-BMkFivWO.js} +1 -1
  367. package/web-shell/assets/{flowDiagram-A5DVABFB-CR_UgVqj.js → flowDiagram-A5DVABFB-BM1ea8g-.js} +1 -1
  368. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DQUnjWO6.js → ganttDiagram-EL5Y4UJY-CXj_cKRf.js} +1 -1
  369. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-C4j59wPL.js → gitGraphDiagram-WWUBYQGX-D0nEqwqu.js} +1 -1
  370. package/web-shell/assets/{index-tYXRIPz4.js → index-B6JN54Pd.js} +1 -1
  371. package/web-shell/assets/{index-BN_m_uHJ.css → index-C-XlQn24.css} +1 -1
  372. package/web-shell/assets/index-DLjXM0dn.js +1860 -0
  373. package/web-shell/assets/{infoDiagram-RXCK75RN-mzqbt50w.js → infoDiagram-RXCK75RN-DF7aGGbQ.js} +1 -1
  374. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-ChLOqhGl.js → ishikawaDiagram-5VMMS53U-CZYNX1lL.js} +1 -1
  375. package/web-shell/assets/{journeyDiagram-EYS64GPL-SifZE-R8.js → journeyDiagram-EYS64GPL-CvrqMUz1.js} +1 -1
  376. package/web-shell/assets/{kanban-definition-3QL26DDD-Sft2qlbc.js → kanban-definition-3QL26DDD-BZNJQZBj.js} +1 -1
  377. package/web-shell/assets/{layout-O2uHVkPd.js → layout-Bf83x7D6.js} +1 -1
  378. package/web-shell/assets/{linear-BVqYgjSc.js → linear-Bkc3ES2f.js} +1 -1
  379. package/web-shell/assets/{mermaid.core-CZ9MQaJ6.js → mermaid.core-C6xuovwz.js} +6 -6
  380. package/web-shell/assets/{mindmap-definition-FBJOCRG2-BNQYjBqM.js → mindmap-definition-FBJOCRG2-DzH6gVRg.js} +1 -1
  381. package/web-shell/assets/{pegDiagram-XKGWAZYB-rh1J8uv6.js → pegDiagram-XKGWAZYB-DCvLh2fa.js} +1 -1
  382. package/web-shell/assets/{pieDiagram-E7YTZNPT-BQHR5mn9.js → pieDiagram-E7YTZNPT-BtjVlx_6.js} +1 -1
  383. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-CLCbP7mK.js → quadrantDiagram-AXDQQJYC-IbroqxFe.js} +1 -1
  384. package/web-shell/assets/{railroadDiagram-O6MQD6OU-CDQhrkbm.js → railroadDiagram-O6MQD6OU-BvMykiWW.js} +1 -1
  385. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-BdP9uswg.js → requirementDiagram-EFPCY7ZU-D-HHMyrh.js} +1 -1
  386. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-CFZDFBXF.js → sankeyDiagram-P5KCCOFB-C0XXhB6d.js} +1 -1
  387. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-BW9WOJXI.js → sequenceDiagram-WJ2MYXX4-DseAXj5d.js} +1 -1
  388. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CPMia32z.js → sizeCapture-X5ZJPWSS-Cek2EweK.js} +1 -1
  389. package/web-shell/assets/{stateDiagram-HBIQ2CUA-BANp9p7F.js → stateDiagram-HBIQ2CUA-yLv8wafW.js} +1 -1
  390. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-DeThXnol.js +1 -0
  391. package/web-shell/assets/{swimlanes-XN3QIQJK-JroXksK-.js → swimlanes-XN3QIQJK-Cwz-opvE.js} +1 -1
  392. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-GW0R1ZSv.js +8 -0
  393. package/web-shell/assets/{timeline-definition-24CTP7MA-DfuVIfYY.js → timeline-definition-24CTP7MA-BJuFD7OG.js} +1 -1
  394. package/web-shell/assets/{vennDiagram-4TSXK5OY-BZXoSjRB.js → vennDiagram-4TSXK5OY-CNAavdoV.js} +1 -1
  395. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-BdiY8avC.js → wardleyDiagram-VM6X3IG4-DaIjAidq.js} +1 -1
  396. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-DcXh_U4H.js → xychartDiagram-S5SC5T6Z-DkcQXjTy.js} +1 -1
  397. package/web-shell/index.html +19 -4
  398. package/chunks/MaxSizedBox-3OZJCC3J.js +0 -110
  399. package/chunks/agent-BFE3DQM3.js +0 -93
  400. package/chunks/agent-headless-LLVKZZ4P.js +0 -87
  401. package/chunks/bridge-EBYO4SYM.js +0 -118
  402. package/chunks/channel-settings-store-5VP2Y2YM.js +0 -115
  403. package/chunks/chunk-AXMWHKXA.js +0 -42
  404. package/chunks/chunk-IO257NUD.js +0 -623
  405. package/chunks/chunk-YHC2EYYG.js +0 -125
  406. package/chunks/computer-use-EGPWFEX6.js +0 -2142
  407. package/chunks/config-utils-WZ43VOBS.js +0 -25
  408. package/chunks/contextCommand-5DSEQI6S.js +0 -106
  409. package/chunks/daemon-status-provider-EYMLPYJU.js +0 -116
  410. package/chunks/daemon-trust-policy-CQYKZ7VO.js +0 -112
  411. package/chunks/deferred-core-runtime-WFEPUXZR.js +0 -114
  412. package/chunks/earlyInputCapture-PN4PP7V5.js +0 -107
  413. package/chunks/environment-WUPHLPKZ.js +0 -127
  414. package/chunks/errors-WPMPVIAT.js +0 -113
  415. package/chunks/exitPlanMode-MLFHYZNB.js +0 -85
  416. package/chunks/handleAutoUpdate-F5OTWUT5.js +0 -109
  417. package/chunks/i18n-C562S6KN.js +0 -124
  418. package/chunks/initializer-7YPGOFP4.js +0 -113
  419. package/chunks/installationInfo-ARU5Q2H7.js +0 -107
  420. package/chunks/list-KTSK275C.js +0 -116
  421. package/chunks/loadedSettingsAdapter-F3T2EQ5J.js +0 -110
  422. package/chunks/mcp-6ONTVPAY.js +0 -110
  423. package/chunks/nonInteractiveCli-KZDWFAN6.js +0 -178
  424. package/chunks/pidfile-IO7ALSZF.js +0 -111
  425. package/chunks/prompt-terminal-ledger-TCE7PMCE.js +0 -105
  426. package/chunks/resumeHistoryUtils-DDSBAQJS.js +0 -118
  427. package/chunks/ripGrep-E7P6K4QR.js +0 -40
  428. package/chunks/serve-KEAWV4TI.js +0 -118
  429. package/chunks/shell-H6K63WG3.js +0 -95
  430. package/chunks/skill-settings-TCKLXIXM.js +0 -118
  431. package/chunks/spawnChannel-2K6NKWM5.js +0 -111
  432. package/chunks/standalone-update-LSCGOEFP.js +0 -118
  433. package/chunks/terminal-image-renderer-UHX3UD66.js +0 -114
  434. package/chunks/theme-manager-6B47ZPIF.js +0 -102
  435. package/chunks/total-session-admission-NSCFWGJH.js +0 -113
  436. package/chunks/trustedFolders-7XMJWGQ3.js +0 -122
  437. package/chunks/updateCheck-EOVLHD4T.js +0 -118
  438. package/chunks/useAutoAcceptIndicator-ZNMIGBTN.js +0 -120
  439. package/chunks/workspace-providers-status-GPGU5YMT.js +0 -113
  440. package/chunks/workspace-registry-BQISXT6Y.js +0 -122
  441. package/chunks/workspace-service-LLY6HCUC.js +0 -129
  442. package/chunks/workspace-skills-status-L5N2Y3ZP.js +0 -113
  443. package/chunks/write-file-EJHU2Z3E.js +0 -90
  444. package/web-shell/assets/channel-Zg3WHgq_.js +0 -1
  445. package/web-shell/assets/classDiagram-DTDB5LWJ-C16l9jQz.js +0 -1
  446. package/web-shell/assets/classDiagram-v2-JRS7N3AN-C16l9jQz.js +0 -1
  447. package/web-shell/assets/index-DrlJu79f.js +0 -1792
  448. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-NZYAoQLU.js +0 -1
  449. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-3YdVX3vj.js +0 -8
@@ -21,13 +21,13 @@ import {
21
21
  shouldSuppressRememberErrorDetails,
22
22
  workspaceMemoryFailureCode,
23
23
  workspaceMemoryFailureDiagnostics
24
- } from "./chunk-WS7PAXXR.js";
24
+ } from "./chunk-4N6UAPD3.js";
25
25
  import {
26
26
  deriveWebSocketBase,
27
27
  openQwenAsrRealtimeStream,
28
28
  openVoiceStream,
29
29
  openVoiceStreamWithRetry
30
- } from "./chunk-WU5E4HMO.js";
30
+ } from "./chunk-CPPYZHBN.js";
31
31
  import {
32
32
  SetupGithubError,
33
33
  collectSessionData,
@@ -39,15 +39,15 @@ import {
39
39
  toJson,
40
40
  toJsonl,
41
41
  toMarkdown
42
- } from "./chunk-MQP3MHWN.js";
42
+ } from "./chunk-JJJD6QCC.js";
43
43
  import {
44
44
  OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
45
45
  ObservedChannelContactStore
46
- } from "./chunk-UZPYR3EV.js";
47
- import "./chunk-A5F63FEW.js";
46
+ } from "./chunk-4TPAG3O7.js";
48
47
  import {
49
48
  escapeAnsiCtrlCodes
50
49
  } from "./chunk-E7REAOTN.js";
50
+ import "./chunk-L436XFLJ.js";
51
51
  import "./chunk-2MIN6GRR.js";
52
52
  import "./chunk-QHTIBUWB.js";
53
53
  import "./chunk-TXASDT2M.js";
@@ -128,47 +128,22 @@ import {
128
128
  tagListener,
129
129
  unsafeRevealSecret,
130
130
  validateMcpRuntimeServerName
131
- } from "./chunk-UUQFJILB.js";
131
+ } from "./chunk-SQPOJ4ZI.js";
132
132
  import "./chunk-VGHZT6JR.js";
133
133
  import {
134
- isLoopbackBind,
135
134
  isValidSessionId,
136
135
  normalizeSessionIdForLookup,
137
136
  parseCallerSuppliedSessionId
138
- } from "./chunk-TQOF5KBL.js";
139
- import "./chunk-UXEO7E3V.js";
140
- import {
141
- WorkspaceGenerationClosedError,
142
- createSingleWorkspaceRegistry,
143
- createWorkspaceSessionOwnerIndex
144
- } from "./chunk-K3LPAED5.js";
137
+ } from "./chunk-ZEZKIS2K.js";
145
138
  import {
146
- isInternalWorkspaceRuntime
147
- } from "./chunk-NYWWQ437.js";
148
- import {
149
- assertValidChannelSecretUpdates
150
- } from "./chunk-MHG6NDS6.js";
151
- import {
152
- createWorkspaceSkillsStatusProvider
153
- } from "./chunk-P47E4SJC.js";
154
- import "./chunk-BGXZBI5B.js";
155
- import {
156
- isServeDebugMode,
157
- mountWebShellAssets,
158
- mountWebShellSpaFallback
159
- } from "./chunk-KSPRQSB4.js";
160
- import {
161
- require_express
162
- } from "./chunk-O5Z7EB6Y.js";
163
- import {
164
- evaluateDaemonWorkspaceTrust,
165
- readDaemonTrustPolicySnapshot
166
- } from "./chunk-7HFULI45.js";
139
+ isLoopbackBind
140
+ } from "./chunk-RXFQM6FQ.js";
141
+ import "./chunk-UXEO7E3V.js";
167
142
  import {
168
143
  readRecentPromptTerminals,
169
144
  reconcileDanglingPromptTerminals,
170
145
  withPromptTerminals
171
- } from "./chunk-XYQHT3AW.js";
146
+ } from "./chunk-4Z3PSHN4.js";
172
147
  import {
173
148
  EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
174
149
  MAX_WORKSPACE_SKILL_NAME_LENGTH,
@@ -182,14 +157,14 @@ import {
182
157
  validateWorkspaceSkillName,
183
158
  validateWorkspaceVoiceState,
184
159
  voiceSettingsScopeToWire
185
- } from "./chunk-FYZMB6DB.js";
160
+ } from "./chunk-LKOSBI2M.js";
186
161
  import {
187
162
  PermissionRulesValidationError,
188
163
  buildPermissionSettings,
189
164
  isPermissionRuleType,
190
165
  normalizePermissionRules,
191
166
  readPermissionRuleSet
192
- } from "./chunk-ZS5BHEPD.js";
167
+ } from "./chunk-VLY6XOBY.js";
193
168
  import {
194
169
  assertVoiceBaseUrlNetworkAllowed,
195
170
  isStreamingVoiceModel,
@@ -197,22 +172,24 @@ import {
197
172
  resolveVoiceTranscriptionConfig,
198
173
  sanitizeVoiceErrorMessage,
199
174
  transcribeVoiceAudio
200
- } from "./chunk-ZZUVC6RI.js";
175
+ } from "./chunk-76WGY6LW.js";
201
176
  import {
202
177
  isVoiceEnabled,
203
178
  isVoiceMode,
204
179
  readVoiceModel
205
- } from "./chunk-QJHPWLZC.js";
206
- import "./chunk-Z3JMO2CH.js";
207
- import "./chunk-Z4X5MTRT.js";
208
- import {
209
- WorkspacePermissionRulesSessionRequiredError,
210
- WorkspaceSettingsPartialPersistError,
211
- mapWorkspaceSkillToggleError
212
- } from "./chunk-Z7VOMGDC.js";
180
+ } from "./chunk-2MHGD7EE.js";
181
+ import "./chunk-2SERYG4T.js";
213
182
  import {
214
183
  createTotalSessionAdmissionController
215
184
  } from "./chunk-X2UOOG5V.js";
185
+ import {
186
+ WorkspaceGenerationClosedError,
187
+ createSingleWorkspaceRegistry,
188
+ createWorkspaceSessionOwnerIndex
189
+ } from "./chunk-K3LPAED5.js";
190
+ import {
191
+ isInternalWorkspaceRuntime
192
+ } from "./chunk-NYWWQ437.js";
216
193
  import "./chunk-OIBUG24X.js";
217
194
  import {
218
195
  MAX_SESSION_RESTORE_TIMEOUT_MS,
@@ -220,24 +197,20 @@ import {
220
197
  restoreRetryAfterSeconds
221
198
  } from "./chunk-4JRM2BSM.js";
222
199
  import {
223
- getStableLiveDiscoveryBaseDir
224
- } from "./chunk-5MK45KZ3.js";
225
- import {
226
- LIVE_HOST_BUNDLE_ID,
227
- LIVE_HOST_PROTOCOL_VERSION,
228
- LIVE_INPUT_AUDIO_EPOCH_BYTES
229
- } from "./chunk-NKLP3DCK.js";
200
+ assertValidChannelSecretUpdates
201
+ } from "./chunk-MB4OCRQ2.js";
230
202
  import {
231
203
  createDaemonStatusProvider
232
- } from "./chunk-NW35NVFN.js";
204
+ } from "./chunk-K6FURWIX.js";
233
205
  import "./chunk-JS73NNWF.js";
234
- import "./chunk-PHJJ3RVO.js";
206
+ import "./chunk-7XKW4CVK.js";
207
+ import "./chunk-UVDOONRU.js";
235
208
  import {
236
209
  SessionArtifactAuthorizationError,
237
210
  SessionArtifactValidationError,
238
211
  createAcpSessionBridge,
239
212
  parseSessionSource
240
- } from "./chunk-X7V3N6YH.js";
213
+ } from "./chunk-7JJUFI36.js";
241
214
  import {
242
215
  EVENT_SCHEMA_VERSION,
243
216
  EventBus,
@@ -245,40 +218,74 @@ import {
245
218
  } from "./chunk-7U5G6JXI.js";
246
219
  import "./chunk-WCCLLK7X.js";
247
220
  import "./chunk-OCPBI7J5.js";
248
- import {
249
- createSpawnChannelFactory
250
- } from "./chunk-VMJL7RH6.js";
251
221
  import {
252
222
  createWorkspaceProvidersStatusProvider
253
- } from "./chunk-MPHLIJYL.js";
223
+ } from "./chunk-QB5DD75E.js";
224
+ import "./chunk-4K7NQDCG.js";
254
225
  import {
255
226
  getAuthTypeFromEnv,
256
227
  resolveCliGenerationConfig
257
- } from "./chunk-FVBVJEBG.js";
228
+ } from "./chunk-HOANA6GC.js";
258
229
  import {
259
230
  snapshotProcessEnv
260
- } from "./chunk-U2UYQMM6.js";
231
+ } from "./chunk-5NV2AN56.js";
261
232
  import {
262
- STATUS_SCHEMA_VERSION,
263
- SessionRestoreTimeoutError,
264
- createIdleWorkspaceMemoryStatus,
265
- mapDomainErrorToErrorKind
266
- } from "./chunk-URN2JIAQ.js";
267
- import "./chunk-HMJ2P3SV.js";
233
+ createWorkspaceSkillsStatusProvider
234
+ } from "./chunk-DWRFOH3G.js";
235
+ import "./chunk-BGXZBI5B.js";
236
+ import "./chunk-Z4X5MTRT.js";
237
+ import {
238
+ WorkspacePermissionRulesSessionRequiredError,
239
+ WorkspaceSettingsPartialPersistError,
240
+ mapWorkspaceSkillToggleError
241
+ } from "./chunk-Z7VOMGDC.js";
242
+ import {
243
+ isServeDebugMode,
244
+ mountWebShellAssets,
245
+ mountWebShellSpaFallback
246
+ } from "./chunk-DIMEPKCW.js";
247
+ import {
248
+ require_express
249
+ } from "./chunk-AYHQZBJ4.js";
250
+ import "./chunk-FBX2SDQ4.js";
251
+ import {
252
+ evaluateDaemonWorkspaceTrust,
253
+ readDaemonTrustPolicySnapshot
254
+ } from "./chunk-TQYZG5DU.js";
268
255
  import {
269
256
  daemonObservedContactsPath,
270
257
  loadChannelsConfig
271
- } from "./chunk-ZRFUT5VV.js";
272
- import "./chunk-S4C4JJKE.js";
258
+ } from "./chunk-OAAPGZVH.js";
259
+ import "./chunk-3UXJFOB3.js";
273
260
  import "./chunk-57OAHC2Y.js";
274
261
  import {
275
262
  parseChannelWebhookConfigLenient
276
- } from "./chunk-5XUTPXQU.js";
277
- import "./chunk-45NQKMYB.js";
263
+ } from "./chunk-EAV3TENS.js";
264
+ import "./chunk-7JPW6IYH.js";
278
265
  import {
279
266
  supportedChannelCatalog
280
- } from "./chunk-QS4ENGVF.js";
267
+ } from "./chunk-IKN3IUJP.js";
281
268
  import "./chunk-V6WHFGST.js";
269
+ import {
270
+ getStableLiveDiscoveryBaseDir
271
+ } from "./chunk-5MK45KZ3.js";
272
+ import {
273
+ LIVE_HOST_BUNDLE_ID,
274
+ LIVE_HOST_PROTOCOL_VERSION,
275
+ LIVE_INPUT_AUDIO_EPOCH_BYTES
276
+ } from "./chunk-NKLP3DCK.js";
277
+ import {
278
+ createSpawnChannelFactory
279
+ } from "./chunk-GZJUCMH4.js";
280
+ import {
281
+ STATUS_SCHEMA_VERSION,
282
+ SessionRestoreTimeoutError,
283
+ createIdleWorkspaceMemoryStatus,
284
+ mapDomainErrorToErrorKind
285
+ } from "./chunk-CITGRGCM.js";
286
+ import "./chunk-K6KS3LTN.js";
287
+ import "./chunk-HMJ2P3SV.js";
288
+ import "./chunk-7E7UCJHS.js";
282
289
  import {
283
290
  MAX_REGISTERED_WORKSPACES,
284
291
  WorkspaceDisplayNameValidationError,
@@ -286,13 +293,13 @@ import {
286
293
  WorkspaceRegistrationStoreLimitError,
287
294
  normalizeWorkspaceDisplayName,
288
295
  workspaceRegistrationId
289
- } from "./chunk-BUGYW6FB.js";
296
+ } from "./chunk-4IDJQOCO.js";
290
297
  import {
291
298
  CHANNEL_PROMPT_META_KEY,
292
299
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
293
300
  REQUESTED_SESSION_ID_META_KEY,
294
301
  gradeActiveWorkCoverage
295
- } from "./chunk-LURJYO2T.js";
302
+ } from "./chunk-OZ6KS6KW.js";
296
303
  import {
297
304
  BranchWhilePromptActiveError,
298
305
  BridgeChannelQuarantinedError,
@@ -343,29 +350,30 @@ import {
343
350
  MAX_CHANNEL_STARTUP_FAILURE_CHANNEL_LENGTH,
344
351
  MAX_CHANNEL_STARTUP_FAILURE_CODE_LENGTH,
345
352
  MAX_CHANNEL_STARTUP_FAILURE_MESSAGE_LENGTH,
346
- QWEN_SERVER_TOKEN_ENV,
347
353
  isChannelDeliveryError,
348
354
  isChannelWebhookEnqueueError
349
- } from "./chunk-ND7NOI4P.js";
355
+ } from "./chunk-7CWEZQ6T.js";
350
356
  import {
351
357
  normalizeWorkerDiagnostic
352
- } from "./chunk-A6NRNRKE.js";
358
+ } from "./chunk-JVPFTDBK.js";
359
+ import {
360
+ QWEN_SERVER_TOKEN_ENV
361
+ } from "./chunk-GYTKQYDB.js";
353
362
  import {
354
363
  normalizeServeChannelSelection
355
364
  } from "./chunk-ALMR3E6Q.js";
356
365
  import "./chunk-UDG5EZJI.js";
357
- import "./chunk-3VUENPWF.js";
358
366
  import {
359
367
  redactLogCredentials
360
368
  } from "./chunk-M5GB774H.js";
369
+ import "./chunk-3VUENPWF.js";
361
370
  import "./chunk-5HBA2Z7V.js";
362
- import "./chunk-K6KS3LTN.js";
363
- import "./chunk-7E7UCJHS.js";
364
371
  import {
365
372
  sanitizeLogText
366
- } from "./chunk-AW27A43Y.js";
373
+ } from "./chunk-E55H6BZ7.js";
367
374
  import "./chunk-IW6RQPQB.js";
368
375
  import {
376
+ WORKSPACE_RESTRICTED_SETTING_KEYS,
369
377
  getDialogSettingKeys,
370
378
  getModelProvidersOwnerScope,
371
379
  getNestedProperty,
@@ -374,26 +382,26 @@ import {
374
382
  getWritableScopes,
375
383
  loadSettings,
376
384
  validateSettingValue
377
- } from "./chunk-6UQSU7CQ.js";
378
- import "./chunk-7DMTAQJ6.js";
385
+ } from "./chunk-C2BAEV64.js";
379
386
  import "./chunk-RKUWKYED.js";
387
+ import "./chunk-GXWY24QS.js";
388
+ import "./chunk-GOXKNSDZ.js";
389
+ import "./chunk-IDS7MSUP.js";
380
390
  import {
381
391
  detectSystemLanguage,
382
392
  resolveLanguageSetting
383
- } from "./chunk-OE52YHCZ.js";
393
+ } from "./chunk-W2WRNJKX.js";
384
394
  import {
385
395
  SUPPORTED_LANGUAGES,
386
396
  resolveSupportedLanguage
387
397
  } from "./chunk-5EJZE3FP.js";
388
- import "./chunk-OVH5Y7KS.js";
389
- import "./chunk-GOXKNSDZ.js";
390
- import "./chunk-IDS7MSUP.js";
391
- import "./chunk-CXJHQVEK.js";
392
- import "./chunk-RDG44S5I.js";
393
- import "./chunk-YLFLHKDL.js";
398
+ import "./chunk-IN66KO3N.js";
399
+ import "./chunk-5PA6UEYA.js";
400
+ import "./chunk-H4JK2A2V.js";
401
+ import "./chunk-W3N5XAZ6.js";
394
402
  import {
395
403
  getWorkspaceTrustStatus
396
- } from "./chunk-L4HVF7LM.js";
404
+ } from "./chunk-RQ5ASDFQ.js";
397
405
  import "./chunk-NPQ5ZKRP.js";
398
406
  import {
399
407
  isWithinRoot as isWithinRoot2
@@ -423,18 +431,20 @@ import {
423
431
  shouldShowStep,
424
432
  watchRepoBranch,
425
433
  writeWorkspaceContextFile
426
- } from "./chunk-62JOGZL5.js";
434
+ } from "./chunk-RUQBJS34.js";
435
+ import "./chunk-LRLMDV5X.js";
436
+ import "./chunk-LRKMQPMD.js";
427
437
  import "./chunk-LJZSMWOH.js";
428
- import "./chunk-5HJUPACR.js";
429
- import "./chunk-2GXYDNXP.js";
430
- import "./chunk-TBVSALA3.js";
438
+ import "./chunk-H2MDBYLL.js";
439
+ import "./chunk-JLGFGPZJ.js";
440
+ import "./chunk-SKNVVYIJ.js";
431
441
  import {
432
442
  readWorktreeSession,
433
443
  writeWorktreeSession
434
- } from "./chunk-7NBVNAJJ.js";
435
- import "./chunk-MZKWFWVG.js";
436
- import "./chunk-2Z6LSQMF.js";
437
- import "./chunk-RDQ7QB4Y.js";
444
+ } from "./chunk-UCSV2IZW.js";
445
+ import "./chunk-T2HMXHYA.js";
446
+ import "./chunk-3FSBMAYD.js";
447
+ import "./chunk-XJS54K4A.js";
438
448
  import "./chunk-ZPJWUGCS.js";
439
449
  import {
440
450
  QwenOAuth2Client,
@@ -444,9 +454,8 @@ import {
444
454
  isDeviceAuthorizationSuccess,
445
455
  isDeviceTokenPending,
446
456
  isDeviceTokenSuccess
447
- } from "./chunk-O5BDEWBC.js";
448
- import "./chunk-KM73TBQ4.js";
449
- import "./chunk-EFB657PR.js";
457
+ } from "./chunk-ZWKGZB2K.js";
458
+ import "./chunk-OX44MOAN.js";
450
459
  import {
451
460
  BuiltinAgentRegistry,
452
461
  Client,
@@ -468,12 +477,16 @@ import {
468
477
  SessionOrganizationError,
469
478
  SessionOrganizationService,
470
479
  SessionService,
480
+ SessionStorageEntryError,
481
+ SessionTranscriptChangedError,
471
482
  SessionTranscriptCursorCodec,
483
+ SessionTranscriptIdentityUnavailableError,
472
484
  SessionTranscriptPageTooLargeError,
473
485
  SessionTranscriptReader,
474
486
  SessionTranscriptSnapshotUnavailableError,
475
487
  SessionTranscriptTooLargeError,
476
488
  SessionWriterError,
489
+ SessionWriterUnavailableError,
477
490
  StandardFileSystemService,
478
491
  StdioClientTransport,
479
492
  StreamableHTTPClientTransport,
@@ -497,20 +510,20 @@ import {
497
510
  sleepInhibitor,
498
511
  stripTerminalControlSequences,
499
512
  upsertSessionPr
500
- } from "./chunk-T6XLJRQY.js";
513
+ } from "./chunk-D6XO27Z5.js";
501
514
  import "./chunk-GOFAQQZA.js";
515
+ import "./chunk-5M6IDOMF.js";
502
516
  import "./chunk-TWPJO254.js";
503
517
  import "./chunk-CQ35AJ4Z.js";
504
- import "./chunk-5M6IDOMF.js";
505
- import "./chunk-KVGR4MCF.js";
506
- import "./chunk-XZJKSETB.js";
507
- import "./chunk-YMVFIYHV.js";
508
- import "./chunk-6PVPNMXU.js";
509
- import "./chunk-7DYNJFES.js";
510
518
  import {
511
519
  MAX_JOBS,
512
520
  nextDurableFireMs
513
- } from "./chunk-DJEHYM4H.js";
521
+ } from "./chunk-3UZCLCXR.js";
522
+ import "./chunk-TOF4UZHH.js";
523
+ import "./chunk-O3BUXIPM.js";
524
+ import "./chunk-ZLTEQYNC.js";
525
+ import "./chunk-6PVPNMXU.js";
526
+ import "./chunk-AYVIGUUK.js";
514
527
  import {
515
528
  nextFireTime,
516
529
  parseCron
@@ -523,38 +536,39 @@ import {
523
536
  readCronTasks,
524
537
  taskHasLegacyCondition,
525
538
  updateCronTasks
526
- } from "./chunk-AZF6SME3.js";
539
+ } from "./chunk-JECO75XD.js";
527
540
  import "./chunk-O6GEWCJA.js";
528
541
  import "./chunk-T26EAKDL.js";
529
542
  import {
530
543
  GitWorktreeService,
531
544
  writeWorktreeSessionMarker
532
- } from "./chunk-GIWB5QLV.js";
545
+ } from "./chunk-LJP2BBMK.js";
533
546
  import "./chunk-CPBF7KYF.js";
534
- import "./chunk-VUMLT7E5.js";
535
- import "./chunk-ISJMN3ML.js";
536
- import "./chunk-XLDFW44M.js";
547
+ import "./chunk-5Y2JCJAH.js";
548
+ import "./chunk-T2CRBIDJ.js";
549
+ import "./chunk-77TOMRBG.js";
537
550
  import {
538
551
  findGitRoot,
539
552
  glob
540
- } from "./chunk-Q54XG7IX.js";
541
- import "./chunk-FEMQ6Y7W.js";
542
- import "./chunk-2TRNCJK4.js";
543
- import "./chunk-NUGZAFR2.js";
553
+ } from "./chunk-DEYPMJPD.js";
554
+ import "./chunk-T6OODF2U.js";
555
+ import "./chunk-27ONXAFY.js";
556
+ import "./chunk-ZEADBZLO.js";
544
557
  import {
545
558
  parseGoalControlRequest
546
- } from "./chunk-LDGWX737.js";
559
+ } from "./chunk-FN5C6C7G.js";
547
560
  import {
548
561
  APPROVAL_MODES
549
- } from "./chunk-VLRBJ24J.js";
562
+ } from "./chunk-BVE5EMIG.js";
550
563
  import "./chunk-MLXTMF7H.js";
551
564
  import "./chunk-NAVJD2PQ.js";
552
- import "./chunk-WRT324N6.js";
553
- import "./chunk-YDJRMQU4.js";
565
+ import "./chunk-FVDQ5E67.js";
566
+ import "./chunk-V3GINY6K.js";
567
+ import "./chunk-QHMLYMMS.js";
554
568
  import {
555
569
  recordDaemonBridgeError,
556
570
  recordDaemonHttpRequest
557
- } from "./chunk-SJ4HB27T.js";
571
+ } from "./chunk-SDVF6A42.js";
558
572
  import "./chunk-P3QQPMQA.js";
559
573
  import {
560
574
  addDaemonRequestAttribute,
@@ -567,24 +581,24 @@ import {
567
581
  recordDaemonHttpResponse,
568
582
  runWithDaemonTelemetryContext,
569
583
  withDaemonRequestSpan
570
- } from "./chunk-2UZJWSVD.js";
584
+ } from "./chunk-ILPXSKGQ.js";
571
585
  import "./chunk-XWRJCPHC.js";
572
586
  import "./chunk-VNOVK4I7.js";
573
587
  import "./chunk-SAH4BD2J.js";
574
- import "./chunk-VSNPOSDN.js";
575
- import "./chunk-I432KXWD.js";
588
+ import "./chunk-ZKAZP2ZG.js";
589
+ import "./chunk-DP7LABIB.js";
576
590
  import "./chunk-S6LOFUVP.js";
577
- import "./chunk-7IV52LTO.js";
578
- import "./chunk-AXMWHKXA.js";
591
+ import "./chunk-2LD5U7Q3.js";
579
592
  import "./chunk-DJ2GSRLV.js";
580
- import "./chunk-2J3OJGTL.js";
581
- import "./chunk-LI4YHTQK.js";
582
- import "./chunk-QKBYFU2Q.js";
583
- import "./chunk-C72BXMJ5.js";
593
+ import "./chunk-I6VVOZDK.js";
594
+ import "./chunk-K2OJUPOE.js";
595
+ import "./chunk-CFKIH3D3.js";
596
+ import "./chunk-EB4VDXNI.js";
597
+ import "./chunk-FJWICLG7.js";
584
598
  import {
585
599
  parseLineTolerant,
586
600
  read
587
- } from "./chunk-FDD2IUEL.js";
601
+ } from "./chunk-UX3IFLJM.js";
588
602
  import "./chunk-YRLW2MSX.js";
589
603
  import "./chunk-VGC4I5JJ.js";
590
604
  import {
@@ -595,42 +609,41 @@ import {
595
609
  getAllGeminiMdFilenames,
596
610
  isUtf8CompatibleEncoding,
597
611
  isWithinRoot
598
- } from "./chunk-IWOWEENB.js";
599
- import "./chunk-HIK2OF33.js";
600
- import "./chunk-ZRYQMWEP.js";
601
- import "./chunk-2E3V7G6Y.js";
602
- import "./chunk-F6WFNA7U.js";
612
+ } from "./chunk-WBT3STGU.js";
613
+ import "./chunk-PVBT5QPD.js";
614
+ import "./chunk-IPQA4SR5.js";
603
615
  import "./chunk-WZAD4ZNJ.js";
604
616
  import "./chunk-FPGTNKCP.js";
605
- import "./chunk-YHC2EYYG.js";
606
- import "./chunk-PZRUV52H.js";
607
- import "./chunk-JGUBDRBC.js";
608
- import "./chunk-HDKCKCYO.js";
617
+ import "./chunk-SLEWBQWM.js";
618
+ import "./chunk-4X5GYZFO.js";
619
+ import "./chunk-XZA32HII.js";
620
+ import "./chunk-7QGEJI7M.js";
621
+ import "./chunk-GTUKW3I6.js";
609
622
  import "./chunk-HHJLM3WQ.js";
610
623
  import {
611
624
  isTelemetrySdkInitialized,
612
625
  redactUrlCredentials,
613
626
  stripAnsiAndControl
614
- } from "./chunk-GAHYKJPV.js";
627
+ } from "./chunk-6US7BF3G.js";
615
628
  import "./chunk-74TONY4F.js";
616
- import "./chunk-XL5K4SVK.js";
629
+ import "./chunk-VL4YX3FH.js";
617
630
  import {
618
631
  SubagentError,
619
632
  SubagentErrorCode
620
- } from "./chunk-WZDM44SB.js";
621
- import "./chunk-K623ENWT.js";
633
+ } from "./chunk-JUIJ3FXC.js";
634
+ import "./chunk-E6FGMDFQ.js";
622
635
  import {
623
636
  escapeXml
624
637
  } from "./chunk-AQ37AY7B.js";
625
- import "./chunk-K52PZNU4.js";
626
- import "./chunk-6NFAEG54.js";
638
+ import "./chunk-RRKNX553.js";
639
+ import "./chunk-KOJ6MHD5.js";
627
640
  import {
628
641
  FatalConfigError,
629
642
  Storage,
630
643
  createDebugLogger,
631
644
  getErrorMessage,
632
645
  runWithoutDebugLogSession
633
- } from "./chunk-A5F2YNO6.js";
646
+ } from "./chunk-2NNTE2ED.js";
634
647
  import {
635
648
  writeStderrLine,
636
649
  writeStderrLineSafe,
@@ -3745,6 +3758,17 @@ function resolveWorkspaceRuntimeFromParam(registry, req, res, paramName = "works
3745
3758
  return runtime;
3746
3759
  }
3747
3760
  __name(resolveWorkspaceRuntimeFromParam, "resolveWorkspaceRuntimeFromParam");
3761
+ function resolveTrustedRuntime(registry, req, res, paramName = "workspace") {
3762
+ const runtime = resolveWorkspaceRuntimeFromParam(
3763
+ registry,
3764
+ req,
3765
+ res,
3766
+ paramName
3767
+ );
3768
+ if (!runtime) return null;
3769
+ return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
3770
+ }
3771
+ __name(resolveTrustedRuntime, "resolveTrustedRuntime");
3748
3772
  function resolveWorkspaceRuntimeWithLiveCompatibilityFromParam(registry, req, res, paramName = "workspace") {
3749
3773
  if (typeof registry.getManagedEntryByWorkspaceId !== "function" || typeof registry.getManagedEntryByWorkspaceCwd !== "function") {
3750
3774
  return resolveWorkspaceRuntimeFromParam(registry, req, res, paramName);
@@ -8280,56 +8304,68 @@ function isBoundTask(task) {
8280
8304
  return typeof task.sessionId === "string" && task.sessionId.length > 0;
8281
8305
  }
8282
8306
  __name(isBoundTask, "isBoundTask");
8283
- async function disableTasksForSessions(projectRoot, sessionIds) {
8307
+ async function disableTasksForSessions(projectRoot, sessionIds, options = {}) {
8284
8308
  if (sessionIds.length === 0) return;
8285
8309
  const targets = new Set(sessionIds);
8286
- await updateCronTasks(projectRoot, (tasks) => {
8287
- let changed = false;
8288
- const next = tasks.map((task) => {
8289
- if (isBoundTask(task) && targets.has(task.sessionId) && task.enabled !== false) {
8290
- changed = true;
8291
- return { ...task, enabled: false, disabledByArchive: true };
8292
- }
8293
- return task;
8294
- });
8295
- return changed ? next : tasks;
8296
- });
8310
+ await updateCronTasks(
8311
+ projectRoot,
8312
+ (tasks) => {
8313
+ let changed = false;
8314
+ const next = tasks.map((task) => {
8315
+ if (isBoundTask(task) && targets.has(task.sessionId) && task.enabled !== false) {
8316
+ changed = true;
8317
+ return { ...task, enabled: false, disabledByArchive: true };
8318
+ }
8319
+ return task;
8320
+ });
8321
+ return changed ? next : tasks;
8322
+ },
8323
+ options
8324
+ );
8297
8325
  }
8298
8326
  __name(disableTasksForSessions, "disableTasksForSessions");
8299
- async function enableTasksForSessions(projectRoot, sessionIds, now = Date.now()) {
8327
+ async function enableTasksForSessions(projectRoot, sessionIds, now = Date.now(), options = {}) {
8300
8328
  if (sessionIds.length === 0) return;
8301
8329
  const targets = new Set(sessionIds);
8302
- await updateCronTasks(projectRoot, (tasks) => {
8303
- let changed = false;
8304
- const next = tasks.map((task) => {
8305
- if (isBoundTask(task) && targets.has(task.sessionId) && task.enabled === false && task.disabledByArchive === true) {
8306
- changed = true;
8307
- const resumed = { ...task, enabled: true };
8308
- delete resumed.disabledByArchive;
8309
- const minute = now - now % 6e4;
8310
- if (resumed.recurring) {
8311
- resumed.lastFiredAt = minute;
8312
- } else {
8313
- resumed.createdAt = now;
8314
- resumed.lastFiredAt = minute;
8330
+ await updateCronTasks(
8331
+ projectRoot,
8332
+ (tasks) => {
8333
+ let changed = false;
8334
+ const next = tasks.map((task) => {
8335
+ if (isBoundTask(task) && targets.has(task.sessionId) && task.enabled === false && task.disabledByArchive === true) {
8336
+ changed = true;
8337
+ const resumed = { ...task, enabled: true };
8338
+ delete resumed.disabledByArchive;
8339
+ const minute = now - now % 6e4;
8340
+ if (resumed.recurring) {
8341
+ resumed.lastFiredAt = minute;
8342
+ } else {
8343
+ resumed.createdAt = now;
8344
+ resumed.lastFiredAt = minute;
8345
+ }
8346
+ return resumed;
8315
8347
  }
8316
- return resumed;
8317
- }
8318
- return task;
8319
- });
8320
- return changed ? next : tasks;
8321
- });
8348
+ return task;
8349
+ });
8350
+ return changed ? next : tasks;
8351
+ },
8352
+ options
8353
+ );
8322
8354
  }
8323
8355
  __name(enableTasksForSessions, "enableTasksForSessions");
8324
- async function removeTasksForSessions(projectRoot, sessionIds) {
8356
+ async function removeTasksForSessions(projectRoot, sessionIds, options = {}) {
8325
8357
  if (sessionIds.length === 0) return;
8326
8358
  const targets = new Set(sessionIds);
8327
- await updateCronTasks(projectRoot, (tasks) => {
8328
- const next = tasks.filter(
8329
- (task) => !isBoundTask(task) || !targets.has(task.sessionId)
8330
- );
8331
- return next.length === tasks.length ? tasks : next;
8332
- });
8359
+ await updateCronTasks(
8360
+ projectRoot,
8361
+ (tasks) => {
8362
+ const next = tasks.filter(
8363
+ (task) => !isBoundTask(task) || !targets.has(task.sessionId)
8364
+ );
8365
+ return next.length === tasks.length ? tasks : next;
8366
+ },
8367
+ options
8368
+ );
8333
8369
  }
8334
8370
  __name(removeTasksForSessions, "removeTasksForSessions");
8335
8371
 
@@ -8451,10 +8487,22 @@ async function runWithDaemonWriterLease(params) {
8451
8487
  } = params;
8452
8488
  let lease;
8453
8489
  try {
8454
- lease = await service.acquireSessionWriterLease(sessionId, {
8490
+ const leaseOptions = {
8455
8491
  processKind: "daemon",
8456
- reclaimPolicy: "never"
8457
- });
8492
+ reclaimPolicy: "never",
8493
+ takeoverPolicy: "certified"
8494
+ };
8495
+ try {
8496
+ lease = await service.acquireSessionWriterLease(sessionId, leaseOptions);
8497
+ } catch (error2) {
8498
+ if (!(error2 instanceof SessionWriterUnavailableError) && !(error2 instanceof SessionTranscriptChangedError)) {
8499
+ throw error2;
8500
+ }
8501
+ lease = await service.acquireSessionMaintenanceLease(
8502
+ sessionId,
8503
+ leaseOptions
8504
+ );
8505
+ }
8458
8506
  } catch (error2) {
8459
8507
  return { mutationApplied: false, error: error2 };
8460
8508
  }
@@ -8531,27 +8579,61 @@ function logMaintenanceLeaseReleaseFailure(params) {
8531
8579
  }
8532
8580
  __name(logMaintenanceLeaseReleaseFailure, "logMaintenanceLeaseReleaseFailure");
8533
8581
  async function classifySessionLocation(service, sessionId) {
8534
- return service.getSessionLocation(sessionId);
8582
+ return service.getMaintainableSessionLocation(sessionId);
8535
8583
  }
8536
8584
  __name(classifySessionLocation, "classifySessionLocation");
8537
8585
  function sessionLocationError(sessionId) {
8538
- return new Error(`Session archive conflict: ${sessionId}`);
8586
+ const error2 = new SessionConflictError(sessionId);
8587
+ error2.message = `Session "${sessionId}" exists in both active and archived directories. Retry with resolveConflicts: true to keep one copy.`;
8588
+ return error2;
8539
8589
  }
8540
8590
  __name(sessionLocationError, "sessionLocationError");
8541
- function updateScheduledTaskForMaintenance(service, sessionId, action) {
8591
+ function updateScheduledTaskForMaintenance(service, sessionId, action, assertCanMutate) {
8542
8592
  if (action === "archive") {
8543
- return disableTasksForSessions(service.getProjectRoot(), [sessionId]);
8593
+ return disableTasksForSessions(service.getProjectRoot(), [sessionId], {
8594
+ assertCanCommit: assertCanMutate
8595
+ });
8544
8596
  }
8545
8597
  if (action === "unarchive") {
8546
- return enableTasksForSessions(service.getProjectRoot(), [sessionId]);
8598
+ return enableTasksForSessions(
8599
+ service.getProjectRoot(),
8600
+ [sessionId],
8601
+ Date.now(),
8602
+ { assertCanCommit: assertCanMutate }
8603
+ );
8547
8604
  }
8548
- return removeTasksForSessions(service.getProjectRoot(), [sessionId]);
8605
+ return removeTasksForSessions(service.getProjectRoot(), [sessionId], {
8606
+ assertCanCommit: assertCanMutate
8607
+ });
8549
8608
  }
8550
8609
  __name(updateScheduledTaskForMaintenance, "updateScheduledTaskForMaintenance");
8551
- async function deletePersistedSessionWithLease(service, sessionId) {
8610
+ async function deletePersistedSessionWithLease(service, sessionId, assertCanMutate) {
8552
8611
  const initialLocation = await classifySessionLocation(service, sessionId);
8553
8612
  if (initialLocation === void 0) {
8554
- return { kind: "notFound", mutationApplied: false };
8613
+ let maintenanceError;
8614
+ try {
8615
+ assertCanMutate?.();
8616
+ await updateScheduledTaskForMaintenance(
8617
+ service,
8618
+ sessionId,
8619
+ "delete",
8620
+ assertCanMutate
8621
+ );
8622
+ } catch (error2) {
8623
+ maintenanceError = error2;
8624
+ logSessionArchiveWarning(
8625
+ `scheduled task lifecycle update failed action=delete workspace=${safeLogValue(
8626
+ service.getProjectRoot()
8627
+ )} session=${safeLogValue(sessionId)} error=${safeLogValue(
8628
+ errorMessage(error2)
8629
+ )}`
8630
+ );
8631
+ }
8632
+ return {
8633
+ kind: "notFound",
8634
+ mutationApplied: false,
8635
+ maintenanceError
8636
+ };
8555
8637
  }
8556
8638
  const mutation = await runWithDaemonWriterLease({
8557
8639
  action: "delete",
@@ -8565,26 +8647,38 @@ async function deletePersistedSessionWithLease(service, sessionId) {
8565
8647
  mutationApplied: false
8566
8648
  };
8567
8649
  }
8568
- await assertOwnedAndUnchanged();
8569
- const removed = await service.removeSession(sessionId);
8650
+ const removed = await service.removeSession(sessionId, {
8651
+ assertStorageUnchanged: assertOwnedAndUnchanged,
8652
+ assertCanMutate
8653
+ });
8570
8654
  return {
8571
8655
  value: removed ? "removed" : "notFound",
8572
8656
  mutationApplied: removed
8573
8657
  };
8574
8658
  }, "mutate"),
8575
8659
  mutationAppliedAfterError: /* @__PURE__ */ __name(async () => await classifySessionLocation(service, sessionId) === void 0, "mutationAppliedAfterError"),
8576
- afterMutationApplied: /* @__PURE__ */ __name(() => updateScheduledTaskForMaintenance(service, sessionId, "delete"), "afterMutationApplied")
8660
+ afterMutationApplied: /* @__PURE__ */ __name(async () => {
8661
+ assertCanMutate?.();
8662
+ await updateScheduledTaskForMaintenance(
8663
+ service,
8664
+ sessionId,
8665
+ "delete",
8666
+ assertCanMutate
8667
+ );
8668
+ }, "afterMutationApplied")
8577
8669
  });
8578
8670
  if (mutation.error !== void 0) {
8579
8671
  return {
8580
8672
  kind: "error",
8581
8673
  error: mutation.error,
8582
- mutationApplied: mutation.mutationApplied
8674
+ mutationApplied: mutation.mutationApplied,
8675
+ maintenanceError: mutation.maintenanceError
8583
8676
  };
8584
8677
  }
8585
8678
  return {
8586
8679
  kind: mutation.value ?? "notFound",
8587
- mutationApplied: mutation.mutationApplied
8680
+ mutationApplied: mutation.mutationApplied,
8681
+ maintenanceError: mutation.maintenanceError
8588
8682
  };
8589
8683
  }
8590
8684
  __name(deletePersistedSessionWithLease, "deletePersistedSessionWithLease");
@@ -8595,6 +8689,7 @@ async function deleteDaemonSessions(params) {
8595
8689
  bridge,
8596
8690
  coordinator,
8597
8691
  coordinatorLockHeld = false,
8692
+ assertCanMutate,
8598
8693
  onError
8599
8694
  } = params;
8600
8695
  const uniqueSessionIds = [
@@ -8609,10 +8704,12 @@ async function deleteDaemonSessions(params) {
8609
8704
  uniqueSessionIds.map(async (sessionId) => {
8610
8705
  try {
8611
8706
  const mutateSession = /* @__PURE__ */ __name(async () => {
8707
+ assertCanMutate?.();
8612
8708
  const removePersistedSession = /* @__PURE__ */ __name(async () => {
8613
8709
  const result = await deletePersistedSessionWithLease(
8614
8710
  service,
8615
- sessionId
8711
+ sessionId,
8712
+ assertCanMutate
8616
8713
  );
8617
8714
  if (result.kind === "error") {
8618
8715
  onError?.({
@@ -8623,7 +8720,13 @@ async function deleteDaemonSessions(params) {
8623
8720
  return result;
8624
8721
  }
8625
8722
  try {
8626
- await bridge.deleteSessionAttachments(sessionId);
8723
+ if (assertCanMutate) {
8724
+ await bridge.deleteSessionAttachments(sessionId, {
8725
+ assertCanCommit: assertCanMutate
8726
+ });
8727
+ } else {
8728
+ await bridge.deleteSessionAttachments(sessionId);
8729
+ }
8627
8730
  return result;
8628
8731
  } catch (error2) {
8629
8732
  onError?.({
@@ -8634,7 +8737,8 @@ async function deleteDaemonSessions(params) {
8634
8737
  return {
8635
8738
  kind: "error",
8636
8739
  error: error2,
8637
- mutationApplied: result.mutationApplied
8740
+ mutationApplied: result.mutationApplied,
8741
+ maintenanceError: result.maintenanceError
8638
8742
  };
8639
8743
  }
8640
8744
  }, "removePersistedSession");
@@ -8688,6 +8792,12 @@ async function deleteDaemonSessions(params) {
8688
8792
  } else {
8689
8793
  errors.push({ sessionId, error: errorMessage(result.error) });
8690
8794
  }
8795
+ if (result.maintenanceError !== void 0) {
8796
+ errors.push({
8797
+ sessionId,
8798
+ error: "Scheduled task lifecycle update failed."
8799
+ });
8800
+ }
8691
8801
  }
8692
8802
  return { removed, notFound, errors };
8693
8803
  }
@@ -8833,7 +8943,9 @@ async function archiveDaemonSessions(params) {
8833
8943
  service,
8834
8944
  bridge,
8835
8945
  coordinator,
8836
- coordinatorLockHeld = false
8946
+ coordinatorLockHeld = false,
8947
+ resolveConflicts = false,
8948
+ assertCanMutate
8837
8949
  } = params;
8838
8950
  const uniqueSessionIds = [
8839
8951
  ...new Set(sessionIds.map(normalizeSessionIdForLookup))
@@ -8847,6 +8959,7 @@ async function archiveDaemonSessions(params) {
8847
8959
  uniqueSessionIds.map(async (sessionId) => {
8848
8960
  try {
8849
8961
  const mutateSession = /* @__PURE__ */ __name(async () => {
8962
+ assertCanMutate?.();
8850
8963
  try {
8851
8964
  await bridge.closeSession(sessionId, void 0, {
8852
8965
  requireAgentClose: true
@@ -8868,12 +8981,31 @@ async function archiveDaemonSessions(params) {
8868
8981
  return { kind: "notFound", mutationApplied: false };
8869
8982
  }
8870
8983
  if (initialLocation === "archived") {
8984
+ let maintenanceError;
8985
+ try {
8986
+ await updateScheduledTaskForMaintenance(
8987
+ service,
8988
+ sessionId,
8989
+ "archive",
8990
+ assertCanMutate
8991
+ );
8992
+ } catch (error2) {
8993
+ maintenanceError = error2;
8994
+ logSessionArchiveWarning(
8995
+ `scheduled task lifecycle update failed action=archive workspace=${safeLogValue(
8996
+ service.getProjectRoot()
8997
+ )} session=${safeLogValue(sessionId)} error=${safeLogValue(
8998
+ errorMessage(error2)
8999
+ )}`
9000
+ );
9001
+ }
8871
9002
  return {
8872
9003
  kind: "alreadyArchived",
8873
- mutationApplied: false
9004
+ mutationApplied: false,
9005
+ maintenanceError
8874
9006
  };
8875
9007
  }
8876
- if (initialLocation === "conflict") {
9008
+ if (initialLocation === "conflict" && !resolveConflicts) {
8877
9009
  return {
8878
9010
  kind: "error",
8879
9011
  error: sessionLocationError(sessionId),
@@ -8901,17 +9033,18 @@ async function archiveDaemonSessions(params) {
8901
9033
  mutationApplied: false
8902
9034
  };
8903
9035
  }
8904
- if (lockedLocation === "conflict") {
9036
+ if (lockedLocation === "conflict" && !resolveConflicts) {
8905
9037
  throw sessionLocationError(sessionId);
8906
9038
  }
8907
- await assertOwnedAndUnchanged();
8908
9039
  const result = await service.archiveSessions([sessionId], {
8909
- knownLocation: "active"
9040
+ resolveConflicts,
9041
+ assertStorageUnchanged: assertOwnedAndUnchanged,
9042
+ assertCanMutate
8910
9043
  });
8911
9044
  if (result.errors[0]) throw result.errors[0].error;
8912
9045
  if (result.archived.length > 0) {
8913
9046
  return {
8914
- value: "archived",
9047
+ value: result.resolvedConflicts.length ? "resolvedConflict" : "archived",
8915
9048
  mutationApplied: true
8916
9049
  };
8917
9050
  }
@@ -8921,18 +9054,28 @@ async function archiveDaemonSessions(params) {
8921
9054
  };
8922
9055
  }, "mutate"),
8923
9056
  mutationAppliedAfterError: /* @__PURE__ */ __name(async () => await classifySessionLocation(service, sessionId) === "archived", "mutationAppliedAfterError"),
8924
- afterMutationApplied: /* @__PURE__ */ __name(() => updateScheduledTaskForMaintenance(service, sessionId, "archive"), "afterMutationApplied")
9057
+ afterMutationApplied: /* @__PURE__ */ __name(async () => {
9058
+ assertCanMutate?.();
9059
+ await updateScheduledTaskForMaintenance(
9060
+ service,
9061
+ sessionId,
9062
+ "archive",
9063
+ assertCanMutate
9064
+ );
9065
+ }, "afterMutationApplied")
8925
9066
  });
8926
9067
  if (mutation.error !== void 0) {
8927
9068
  return {
8928
9069
  kind: "error",
8929
9070
  error: mutation.error,
8930
- mutationApplied: mutation.mutationApplied
9071
+ mutationApplied: mutation.mutationApplied,
9072
+ maintenanceError: mutation.maintenanceError
8931
9073
  };
8932
9074
  }
8933
9075
  return {
8934
9076
  kind: mutation.value ?? "notFound",
8935
- mutationApplied: mutation.mutationApplied
9077
+ mutationApplied: mutation.mutationApplied,
9078
+ maintenanceError: mutation.maintenanceError
8936
9079
  };
8937
9080
  }, "mutateSession");
8938
9081
  return await (coordinatorLockHeld ? mutateSession() : coordinator.runExclusiveMany([sessionId], mutateSession));
@@ -8951,16 +9094,23 @@ async function archiveDaemonSessions(params) {
8951
9094
  );
8952
9095
  const archived = [];
8953
9096
  const alreadyArchived = [];
9097
+ const resolvedConflicts = [];
8954
9098
  const notFound = [];
8955
9099
  const errors = [];
8956
9100
  for (let i = 0; i < results.length; i++) {
8957
9101
  const sessionId = uniqueSessionIds[i];
8958
9102
  const result = results[i];
8959
9103
  if (result.kind === "archived") archived.push(sessionId);
8960
- else if (result.kind === "alreadyArchived") {
9104
+ else if (result.kind === "resolvedConflict") {
9105
+ archived.push(sessionId);
9106
+ resolvedConflicts.push(sessionId);
9107
+ } else if (result.kind === "alreadyArchived") {
8961
9108
  alreadyArchived.push(sessionId);
8962
9109
  } else if (result.kind === "notFound") notFound.push(sessionId);
8963
9110
  else errors.push({ sessionId, error: result.error });
9111
+ if ("maintenanceError" in result && result.maintenanceError !== void 0) {
9112
+ errors.push({ sessionId, error: result.maintenanceError });
9113
+ }
8964
9114
  }
8965
9115
  logSessionArchiveResult("archive", {
8966
9116
  requested: uniqueSessionIds,
@@ -8969,7 +9119,13 @@ async function archiveDaemonSessions(params) {
8969
9119
  notFound,
8970
9120
  errors
8971
9121
  });
8972
- return { archived, alreadyArchived, notFound, errors };
9122
+ return {
9123
+ archived,
9124
+ alreadyArchived,
9125
+ resolvedConflicts,
9126
+ notFound,
9127
+ errors
9128
+ };
8973
9129
  }
8974
9130
  __name(archiveDaemonSessions, "archiveDaemonSessions");
8975
9131
  async function unarchiveDaemonSessions(params) {
@@ -8977,7 +9133,9 @@ async function unarchiveDaemonSessions(params) {
8977
9133
  sessionIds,
8978
9134
  service,
8979
9135
  coordinator,
8980
- coordinatorLockHeld = false
9136
+ coordinatorLockHeld = false,
9137
+ resolveConflicts = false,
9138
+ assertCanMutate
8981
9139
  } = params;
8982
9140
  const uniqueSessionIds = [
8983
9141
  ...new Set(sessionIds.map(normalizeSessionIdForLookup))
@@ -8991,6 +9149,7 @@ async function unarchiveDaemonSessions(params) {
8991
9149
  uniqueSessionIds.map(async (sessionId) => {
8992
9150
  try {
8993
9151
  const mutateSession = /* @__PURE__ */ __name(async () => {
9152
+ assertCanMutate?.();
8994
9153
  const initialLocation = await classifySessionLocation(
8995
9154
  service,
8996
9155
  sessionId
@@ -9004,7 +9163,8 @@ async function unarchiveDaemonSessions(params) {
9004
9163
  await updateScheduledTaskForMaintenance(
9005
9164
  service,
9006
9165
  sessionId,
9007
- "unarchive"
9166
+ "unarchive",
9167
+ assertCanMutate
9008
9168
  );
9009
9169
  } catch (error2) {
9010
9170
  maintenanceError = error2;
@@ -9022,7 +9182,7 @@ async function unarchiveDaemonSessions(params) {
9022
9182
  maintenanceError
9023
9183
  };
9024
9184
  }
9025
- if (initialLocation === "conflict") {
9185
+ if (initialLocation === "conflict" && !resolveConflicts) {
9026
9186
  return {
9027
9187
  kind: "error",
9028
9188
  error: sessionLocationError(sessionId),
@@ -9050,17 +9210,18 @@ async function unarchiveDaemonSessions(params) {
9050
9210
  mutationApplied: false
9051
9211
  };
9052
9212
  }
9053
- if (lockedLocation === "conflict") {
9213
+ if (lockedLocation === "conflict" && !resolveConflicts) {
9054
9214
  throw sessionLocationError(sessionId);
9055
9215
  }
9056
- await assertOwnedAndUnchanged();
9057
9216
  const result = await service.unarchiveSessions([sessionId], {
9058
- knownLocation: "archived"
9217
+ resolveConflicts,
9218
+ assertStorageUnchanged: assertOwnedAndUnchanged,
9219
+ assertCanMutate
9059
9220
  });
9060
9221
  if (result.errors[0]) throw result.errors[0].error;
9061
9222
  if (result.unarchived.length > 0) {
9062
9223
  return {
9063
- value: "unarchived",
9224
+ value: result.resolvedConflicts.length ? "resolvedConflict" : "unarchived",
9064
9225
  mutationApplied: true
9065
9226
  };
9066
9227
  }
@@ -9070,17 +9231,22 @@ async function unarchiveDaemonSessions(params) {
9070
9231
  };
9071
9232
  }, "mutate"),
9072
9233
  mutationAppliedAfterError: /* @__PURE__ */ __name(async () => await classifySessionLocation(service, sessionId) === "active", "mutationAppliedAfterError"),
9073
- afterMutationApplied: /* @__PURE__ */ __name(() => updateScheduledTaskForMaintenance(
9074
- service,
9075
- sessionId,
9076
- "unarchive"
9077
- ), "afterMutationApplied")
9234
+ afterMutationApplied: /* @__PURE__ */ __name(async () => {
9235
+ assertCanMutate?.();
9236
+ await updateScheduledTaskForMaintenance(
9237
+ service,
9238
+ sessionId,
9239
+ "unarchive",
9240
+ assertCanMutate
9241
+ );
9242
+ }, "afterMutationApplied")
9078
9243
  });
9079
9244
  if (mutation.error !== void 0) {
9080
9245
  return {
9081
9246
  kind: "error",
9082
9247
  error: mutation.error,
9083
- mutationApplied: mutation.mutationApplied
9248
+ mutationApplied: mutation.mutationApplied,
9249
+ maintenanceError: mutation.maintenanceError
9084
9250
  };
9085
9251
  }
9086
9252
  return {
@@ -9105,13 +9271,17 @@ async function unarchiveDaemonSessions(params) {
9105
9271
  );
9106
9272
  const unarchived = [];
9107
9273
  const alreadyActive = [];
9274
+ const resolvedConflicts = [];
9108
9275
  const notFound = [];
9109
9276
  const errors = [];
9110
9277
  for (let i = 0; i < results.length; i++) {
9111
9278
  const sessionId = uniqueSessionIds[i];
9112
9279
  const result = results[i];
9113
9280
  if (result.kind === "unarchived") unarchived.push(sessionId);
9114
- else if (result.kind === "alreadyActive") alreadyActive.push(sessionId);
9281
+ else if (result.kind === "resolvedConflict") {
9282
+ unarchived.push(sessionId);
9283
+ resolvedConflicts.push(sessionId);
9284
+ } else if (result.kind === "alreadyActive") alreadyActive.push(sessionId);
9115
9285
  else if (result.kind === "notFound") notFound.push(sessionId);
9116
9286
  else errors.push({ sessionId, error: result.error });
9117
9287
  if (result.maintenanceError !== void 0) {
@@ -9125,7 +9295,13 @@ async function unarchiveDaemonSessions(params) {
9125
9295
  notFound,
9126
9296
  errors
9127
9297
  });
9128
- return { unarchived, alreadyActive, notFound, errors };
9298
+ return {
9299
+ unarchived,
9300
+ alreadyActive,
9301
+ resolvedConflicts,
9302
+ notFound,
9303
+ errors
9304
+ };
9129
9305
  }
9130
9306
  __name(unarchiveDaemonSessions, "unarchiveDaemonSessions");
9131
9307
 
@@ -9357,6 +9533,9 @@ var TRUSTED_WORKSPACE_METHODS = /* @__PURE__ */ new Set([
9357
9533
  `${QWEN_METHOD_NS}workspace/mcp/resources`,
9358
9534
  `${QWEN_METHOD_NS}workspace/mcp/servers/add`,
9359
9535
  `${QWEN_METHOD_NS}workspace/mcp/servers/remove`,
9536
+ `${QWEN_METHOD_NS}sessions/delete`,
9537
+ `${QWEN_METHOD_NS}sessions/archive`,
9538
+ `${QWEN_METHOD_NS}sessions/unarchive`,
9360
9539
  `${QWEN_METHOD_NS}workspace/agents/list`,
9361
9540
  `${QWEN_METHOD_NS}workspace/agents/get`,
9362
9541
  `${QWEN_METHOD_NS}workspace/agents/create`,
@@ -9386,6 +9565,9 @@ var WORKSPACE_GENERATION_MUTATION_METHODS = /* @__PURE__ */ new Set([
9386
9565
  `${QWEN_METHOD_NS}file/edit`,
9387
9566
  `${QWEN_METHOD_NS}workspace/mcp/servers/add`,
9388
9567
  `${QWEN_METHOD_NS}workspace/mcp/servers/remove`,
9568
+ `${QWEN_METHOD_NS}sessions/delete`,
9569
+ `${QWEN_METHOD_NS}sessions/archive`,
9570
+ `${QWEN_METHOD_NS}sessions/unarchive`,
9389
9571
  `${QWEN_METHOD_NS}workspace/agents/create`,
9390
9572
  `${QWEN_METHOD_NS}workspace/agents/update`,
9391
9573
  `${QWEN_METHOD_NS}workspace/agents/delete`,
@@ -10049,6 +10231,14 @@ var AcpDispatcher = class {
10049
10231
  }
10050
10232
  return [...new Set(sessionIds)];
10051
10233
  }
10234
+ parseResolveConflicts(params) {
10235
+ const value = params["resolveConflicts"];
10236
+ if (value === void 0) return false;
10237
+ if (typeof value !== "boolean") {
10238
+ throw new AcpParamError("`resolveConflicts` must be a boolean");
10239
+ }
10240
+ return value;
10241
+ }
10052
10242
  rejectActiveLiveSessionMutation(conn, id, sessionIds) {
10053
10243
  const activeSessionId = sessionIds.find(
10054
10244
  (sessionId) => this.liveSessionIsolation?.isSessionActive?.(sessionId)
@@ -12938,6 +13128,7 @@ var AcpDispatcher = class {
12938
13128
  service: svc,
12939
13129
  bridge: this.bridge,
12940
13130
  coordinator: this.archiveCoordinator,
13131
+ assertCanMutate: assertGenerationOpen,
12941
13132
  onError: /* @__PURE__ */ __name(({ phase, sessionId, error: error2 }) => {
12942
13133
  const safeSessionId = logSafe(sessionId.slice(0, 8));
12943
13134
  const safeMessage = logSafe(error2);
@@ -12947,11 +13138,13 @@ var AcpDispatcher = class {
12947
13138
  }, "onError")
12948
13139
  })
12949
13140
  );
13141
+ assertGenerationOpen?.();
12950
13142
  this.replyConn(conn, id, result);
12951
13143
  return;
12952
13144
  }
12953
13145
  case `${QWEN_METHOD_NS}sessions/archive`: {
12954
13146
  const ids = this.parseSessionIds(params);
13147
+ const resolveConflicts = this.parseResolveConflicts(params);
12955
13148
  if (this.rejectActiveLiveSessionMutation(conn, id, ids)) return;
12956
13149
  const svc = new SessionService(this.boundWorkspace, {
12957
13150
  onWarning: logSessionArchiveWarning
@@ -12962,12 +13155,16 @@ var AcpDispatcher = class {
12962
13155
  sessionIds: ids,
12963
13156
  service: svc,
12964
13157
  bridge: this.bridge,
12965
- coordinator: this.archiveCoordinator
13158
+ coordinator: this.archiveCoordinator,
13159
+ resolveConflicts,
13160
+ assertCanMutate: assertGenerationOpen
12966
13161
  })
12967
13162
  );
13163
+ assertGenerationOpen?.();
12968
13164
  this.replyConn(conn, id, {
12969
13165
  archived: result.archived,
12970
13166
  alreadyArchived: result.alreadyArchived,
13167
+ resolvedConflicts: result.resolvedConflicts,
12971
13168
  notFound: result.notFound,
12972
13169
  errors: this.serializeSessionErrors(result.errors)
12973
13170
  });
@@ -12975,6 +13172,7 @@ var AcpDispatcher = class {
12975
13172
  }
12976
13173
  case `${QWEN_METHOD_NS}sessions/unarchive`: {
12977
13174
  const ids = this.parseSessionIds(params);
13175
+ const resolveConflicts = this.parseResolveConflicts(params);
12978
13176
  const svc = new SessionService(this.boundWorkspace, {
12979
13177
  onWarning: logSessionArchiveWarning
12980
13178
  });
@@ -12983,12 +13181,16 @@ var AcpDispatcher = class {
12983
13181
  () => unarchiveDaemonSessions({
12984
13182
  sessionIds: ids,
12985
13183
  service: svc,
12986
- coordinator: this.archiveCoordinator
13184
+ coordinator: this.archiveCoordinator,
13185
+ resolveConflicts,
13186
+ assertCanMutate: assertGenerationOpen
12987
13187
  })
12988
13188
  );
13189
+ assertGenerationOpen?.();
12989
13190
  this.replyConn(conn, id, {
12990
13191
  unarchived: result.unarchived,
12991
13192
  alreadyActive: result.alreadyActive,
13193
+ resolvedConflicts: result.resolvedConflicts,
12992
13194
  notFound: result.notFound,
12993
13195
  errors: this.serializeSessionErrors(result.errors)
12994
13196
  });
@@ -18025,6 +18227,109 @@ var CdpTunnelRegistry = class {
18025
18227
  }
18026
18228
  };
18027
18229
 
18230
+ // packages/cli/src/serve/mcp-app-sandbox.ts
18231
+ init_esbuild_shims();
18232
+ var MAX_CSP_QUERY_LENGTH = 8192;
18233
+ var CSP_SOURCE_PATTERN = /^(?:https?|wss?):\/\/(?:\*\.)?[a-z0-9.-]+(?::\d+)?$/i;
18234
+ function sanitizeCspDomains(domains) {
18235
+ if (!Array.isArray(domains)) return [];
18236
+ return domains.filter(
18237
+ (domain) => typeof domain === "string" && CSP_SOURCE_PATTERN.test(domain)
18238
+ );
18239
+ }
18240
+ __name(sanitizeCspDomains, "sanitizeCspDomains");
18241
+ function parseMcpAppCsp(value) {
18242
+ if (typeof value !== "string" || value.length > MAX_CSP_QUERY_LENGTH) {
18243
+ return void 0;
18244
+ }
18245
+ try {
18246
+ const parsed = JSON.parse(value);
18247
+ return {
18248
+ connectDomains: sanitizeCspDomains(parsed["connectDomains"]),
18249
+ resourceDomains: sanitizeCspDomains(parsed["resourceDomains"]),
18250
+ frameDomains: sanitizeCspDomains(parsed["frameDomains"]),
18251
+ baseUriDomains: sanitizeCspDomains(parsed["baseUriDomains"])
18252
+ };
18253
+ } catch {
18254
+ return void 0;
18255
+ }
18256
+ }
18257
+ __name(parseMcpAppCsp, "parseMcpAppCsp");
18258
+ function buildMcpAppCsp(csp) {
18259
+ const resources = sanitizeCspDomains(csp?.resourceDomains).join(" ");
18260
+ const connections = sanitizeCspDomains(csp?.connectDomains).join(" ");
18261
+ const frames = sanitizeCspDomains(csp?.frameDomains).join(" ");
18262
+ const baseUris = sanitizeCspDomains(csp?.baseUriDomains).join(" ");
18263
+ return [
18264
+ "default-src 'self' 'unsafe-inline'",
18265
+ `script-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data: ${resources}`.trim(),
18266
+ `style-src 'self' 'unsafe-inline' blob: data: ${resources}`.trim(),
18267
+ `img-src 'self' data: blob: ${resources}`.trim(),
18268
+ `font-src 'self' data: blob: ${resources}`.trim(),
18269
+ `media-src 'self' data: blob: ${resources}`.trim(),
18270
+ `connect-src 'self' ${connections}`.trim(),
18271
+ `worker-src 'self' blob: ${resources}`.trim(),
18272
+ frames ? `frame-src ${frames}` : "frame-src 'none'",
18273
+ "form-action 'none'",
18274
+ "object-src 'none'",
18275
+ baseUris ? `base-uri ${baseUris}` : "base-uri 'none'"
18276
+ ].join("; ");
18277
+ }
18278
+ __name(buildMcpAppCsp, "buildMcpAppCsp");
18279
+ var MCP_APP_SANDBOX_HTML = String.raw`<!doctype html>
18280
+ <html>
18281
+ <head>
18282
+ <meta charset="utf-8" />
18283
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
18284
+ <style>html,body,iframe{box-sizing:border-box;width:100%;height:100%;margin:0;border:0;background:transparent}</style>
18285
+ </head>
18286
+ <body>
18287
+ <script>
18288
+ (() => {
18289
+ if (window.self === window.top) return;
18290
+ const configuredHostOrigin = new URL(window.location.href).searchParams.get('hostOrigin');
18291
+ const hostUrl = new URL(configuredHostOrigin || document.referrer);
18292
+ if (!['localhost', '127.0.0.1', '[::1]'].includes(hostUrl.hostname)) return;
18293
+ const hostOrigin = hostUrl.origin;
18294
+ const inner = document.createElement('iframe');
18295
+ inner.setAttribute('sandbox', 'allow-scripts allow-forms');
18296
+ inner.style.cssText = 'width:100%;height:100%;border:0;background:transparent';
18297
+ document.body.appendChild(inner);
18298
+
18299
+ window.addEventListener('message', (event) => {
18300
+ if (event.source === window.parent) {
18301
+ if (event.origin !== hostOrigin) return;
18302
+ if (event.data?.method === 'ui/notifications/sandbox-resource-ready') {
18303
+ const params = event.data.params || {};
18304
+ if (typeof params.html === 'string') {
18305
+ inner.srcdoc = params.html;
18306
+ }
18307
+ return;
18308
+ }
18309
+ inner.contentWindow?.postMessage(event.data, '*');
18310
+ return;
18311
+ }
18312
+ if (event.source === inner.contentWindow && event.origin === 'null') {
18313
+ window.parent.postMessage(event.data, hostOrigin);
18314
+ }
18315
+ });
18316
+ window.parent.postMessage({
18317
+ jsonrpc: '2.0',
18318
+ method: 'ui/notifications/sandbox-proxy-ready',
18319
+ params: {},
18320
+ }, hostOrigin);
18321
+ })();
18322
+ </script>
18323
+ </body>
18324
+ </html>`;
18325
+ function mountMcpAppSandbox(app) {
18326
+ app.get("/mcp-app-sandbox", (req, res) => {
18327
+ const csp = parseMcpAppCsp(req.query["csp"]);
18328
+ res.status(200).set("Content-Security-Policy", buildMcpAppCsp(csp)).set("Cache-Control", "no-cache, no-store, must-revalidate").set("X-Content-Type-Options", "nosniff").set("Referrer-Policy", "strict-origin-when-cross-origin").type("html").send(MCP_APP_SANDBOX_HTML);
18329
+ });
18330
+ }
18331
+ __name(mountMcpAppSandbox, "mountMcpAppSandbox");
18332
+
18028
18333
  // packages/cli/src/serve/workspace-generation.ts
18029
18334
  init_esbuild_shims();
18030
18335
 
@@ -25963,7 +26268,26 @@ function registerSessionRoutes(app, deps) {
25963
26268
  generation.guard.assertOpen();
25964
26269
  return true;
25965
26270
  }, "assertCurrentInternalGeneration");
25966
- const resolveQualifiedSessionRuntime = /* @__PURE__ */ __name(async (req, res, route, sessionIds, archiveState) => {
26271
+ const hasLifecycleStorageEvidence = /* @__PURE__ */ __name(async (service, sessionId) => {
26272
+ try {
26273
+ return await service.getMaintainableSessionLocation(sessionId) !== void 0;
26274
+ } catch (error2) {
26275
+ if (error2 instanceof SessionStorageEntryError) {
26276
+ return error2.reason !== "foreign_project";
26277
+ }
26278
+ if (error2 instanceof SessionTranscriptIdentityUnavailableError) {
26279
+ return true;
26280
+ }
26281
+ if (error2 instanceof SessionTranscriptChangedError) {
26282
+ return true;
26283
+ }
26284
+ if (error2 !== null && typeof error2 === "object" && typeof error2.code === "string") {
26285
+ return true;
26286
+ }
26287
+ throw error2;
26288
+ }
26289
+ }, "hasLifecycleStorageEvidence");
26290
+ const resolveQualifiedSessionRuntime = /* @__PURE__ */ __name(async (req, res, route, sessionIds, archiveState, options = {}) => {
25967
26291
  const target = resolveQualifiedSessionTarget(req, res);
25968
26292
  if (!target) return void 0;
25969
26293
  if (target.kind === "ordinary") return target.runtime;
@@ -25976,6 +26300,12 @@ function registerSessionRoutes(app, deps) {
25976
26300
  const runtime = generation.runtime;
25977
26301
  const service = createWorkspaceRuntimeSessionService(runtime);
25978
26302
  for (const sessionId of sessionIds) {
26303
+ if (options.lifecycleMaintenance) {
26304
+ if (!await hasLifecycleStorageEvidence(service, sessionId)) {
26305
+ throw new SessionNotFoundError(sessionId);
26306
+ }
26307
+ continue;
26308
+ }
25979
26309
  const location = await service.getSessionLocation(sessionId);
25980
26310
  if (location === "conflict") {
25981
26311
  if (archiveState !== "active") {
@@ -26568,20 +26898,42 @@ function registerSessionRoutes(app, deps) {
26568
26898
  }, "resolveSessionAnyStateRuntime");
26569
26899
  const resolveSessionBatchRuntime = /* @__PURE__ */ __name(async (req, res, route, sessionIds) => {
26570
26900
  if (req) {
26571
- return resolveQualifiedSessionRuntime(req, res, route, sessionIds, "any");
26901
+ return resolveQualifiedSessionRuntime(
26902
+ req,
26903
+ res,
26904
+ route,
26905
+ sessionIds,
26906
+ "any",
26907
+ { lifecycleMaintenance: true }
26908
+ );
26572
26909
  }
26573
26910
  let internalRuntime;
26574
26911
  let hasInternalSession = false;
26575
- const hasOrdinarySession = /* @__PURE__ */ __name(async (sessionId) => {
26576
- for (const runtime of workspaceRegistry.list()) {
26577
- if (await createWorkspaceRuntimeSessionService(
26578
- runtime
26579
- ).sessionExistsInAnyState(sessionId)) {
26580
- return true;
26912
+ let hasOrdinaryLiveSession = false;
26913
+ const findOrdinarySessions = /* @__PURE__ */ __name(async (sessionId) => {
26914
+ const runtimes = /* @__PURE__ */ new Set();
26915
+ for (const entry of workspaceRegistry.listAllEntries()) {
26916
+ const generation2 = entry.current;
26917
+ if (entry.internal || !generation2) continue;
26918
+ if (entry.state !== "active" || entry.current !== generation2 || generation2.guard.closed) {
26919
+ sendWorkspaceRuntimeUnavailable(res);
26920
+ return void 0;
26581
26921
  }
26922
+ generation2.guard.assertOpen();
26923
+ const exists = await hasLifecycleStorageEvidence(
26924
+ createWorkspaceRuntimeSessionService(generation2.runtime),
26925
+ sessionId
26926
+ );
26927
+ if (entry.state !== "active" || entry.current !== generation2 || generation2.guard.closed) {
26928
+ sendWorkspaceRuntimeUnavailable(res);
26929
+ return void 0;
26930
+ }
26931
+ if (!exists) continue;
26932
+ generation2.guard.assertOpen();
26933
+ runtimes.add(generation2.runtime);
26582
26934
  }
26583
- return false;
26584
- }, "hasOrdinarySession");
26935
+ return runtimes;
26936
+ }, "findOrdinarySessions");
26585
26937
  const sendBatchWorkspaceConflict = /* @__PURE__ */ __name(() => {
26586
26938
  res.status(409).json({
26587
26939
  error: "All sessions in this operation must share one workspace.",
@@ -26590,17 +26942,28 @@ function registerSessionRoutes(app, deps) {
26590
26942
  }, "sendBatchWorkspaceConflict");
26591
26943
  for (const sessionId of sessionIds) {
26592
26944
  const candidates = /* @__PURE__ */ new Set();
26945
+ const ordinaryLiveCandidates = /* @__PURE__ */ new Set();
26593
26946
  const owner = workspaceRegistry.resolveLiveSessionOwner(sessionId);
26594
26947
  if (owner.kind === "unavailable") {
26595
26948
  sendWorkspaceRuntimeUnavailable(res);
26596
26949
  return void 0;
26597
26950
  }
26598
- if (owner.kind === "found" && isInternalWorkspaceRuntime(owner.runtime)) {
26599
- candidates.add(owner.runtime);
26951
+ if (owner.kind === "found") {
26952
+ if (isInternalWorkspaceRuntime(owner.runtime)) {
26953
+ candidates.add(owner.runtime);
26954
+ } else {
26955
+ ordinaryLiveCandidates.add(owner.runtime);
26956
+ hasOrdinaryLiveSession = true;
26957
+ }
26600
26958
  }
26601
26959
  if (owner.kind === "ambiguous") {
26602
26960
  for (const runtime of owner.runtimes) {
26603
- if (isInternalWorkspaceRuntime(runtime)) candidates.add(runtime);
26961
+ if (isInternalWorkspaceRuntime(runtime)) {
26962
+ candidates.add(runtime);
26963
+ } else {
26964
+ ordinaryLiveCandidates.add(runtime);
26965
+ hasOrdinaryLiveSession = true;
26966
+ }
26604
26967
  }
26605
26968
  }
26606
26969
  for (const entry of workspaceRegistry.listAllEntries()) {
@@ -26611,32 +26974,32 @@ function registerSessionRoutes(app, deps) {
26611
26974
  }
26612
26975
  const runtime = generation2.runtime;
26613
26976
  const service = createWorkspaceRuntimeSessionService(runtime);
26614
- const exists = await service.sessionExistsInAnyState(sessionId);
26977
+ const exists = await hasLifecycleStorageEvidence(service, sessionId);
26615
26978
  if (!assertCurrentInternalGeneration(entry, generation2, res)) {
26616
26979
  return void 0;
26617
26980
  }
26618
26981
  if (!exists) continue;
26619
- const metadata = await readLoadableLiveConversationMetadata(
26620
- sessionId,
26621
- service
26622
- );
26623
- if (!assertCurrentInternalGeneration(entry, generation2, res)) {
26624
- return void 0;
26625
- }
26626
- if (!metadata) continue;
26627
26982
  candidates.add(runtime);
26628
26983
  }
26629
- if (candidates.size > 0) {
26630
- for (const runtime of workspaceRegistry.list()) {
26631
- const service = createWorkspaceRuntimeSessionService(runtime);
26632
- if (await service.sessionExistsInAnyState(sessionId)) {
26633
- candidates.add(runtime);
26634
- }
26984
+ if (candidates.size > 0 || hasInternalSession) {
26985
+ if (hasOrdinaryLiveSession && ordinaryLiveCandidates.size === 0) {
26986
+ sendBatchWorkspaceConflict();
26987
+ return void 0;
26988
+ }
26989
+ for (const runtime of ordinaryLiveCandidates) {
26990
+ candidates.add(runtime);
26991
+ }
26992
+ const ordinarySessions = await findOrdinarySessions(sessionId);
26993
+ if (!ordinarySessions) return void 0;
26994
+ for (const runtime of ordinarySessions) {
26995
+ candidates.add(runtime);
26635
26996
  }
26636
26997
  }
26637
26998
  if (candidates.size === 0) {
26638
26999
  if (hasInternalSession) {
26639
- if (await hasOrdinarySession(sessionId)) {
27000
+ const ordinarySessions = await findOrdinarySessions(sessionId);
27001
+ if (!ordinarySessions) return void 0;
27002
+ if (ordinarySessions.size > 0) {
26640
27003
  sendBatchWorkspaceConflict();
26641
27004
  return void 0;
26642
27005
  }
@@ -26663,20 +27026,15 @@ function registerSessionRoutes(app, deps) {
26663
27026
  }
26664
27027
  for (const sessionId of sessionIds) {
26665
27028
  const service = createWorkspaceRuntimeSessionService(internalRuntime);
26666
- if (!await service.sessionExistsInAnyState(sessionId)) {
26667
- if (await hasOrdinarySession(sessionId)) {
27029
+ if (!await hasLifecycleStorageEvidence(service, sessionId)) {
27030
+ const ordinarySessions = await findOrdinarySessions(sessionId);
27031
+ if (!ordinarySessions) return void 0;
27032
+ if (ordinarySessions.size > 0) {
26668
27033
  sendBatchWorkspaceConflict();
26669
27034
  return void 0;
26670
27035
  }
26671
27036
  throw new SessionNotFoundError(sessionId);
26672
27037
  }
26673
- const metadata = await readLoadableLiveConversationMetadata(
26674
- sessionId,
26675
- service
26676
- );
26677
- if (!metadata) {
26678
- throw new SessionNotFoundError(sessionId);
26679
- }
26680
27038
  }
26681
27039
  const internalEntry = workspaceRegistry.getManagedEntryByWorkspaceCwd(
26682
27040
  internalRuntime.workspaceCwd
@@ -26709,6 +27067,16 @@ function registerSessionRoutes(app, deps) {
26709
27067
  }
26710
27068
  return [...new Set(sessionIds)];
26711
27069
  }, "parseSessionIdsBody");
27070
+ const parseResolveConflicts = /* @__PURE__ */ __name((req, res) => {
27071
+ const value = safeBody(req)["resolveConflicts"];
27072
+ if (value === void 0) return false;
27073
+ if (typeof value === "boolean") return value;
27074
+ res.status(400).json({
27075
+ error: "`resolveConflicts` must be a boolean",
27076
+ code: "invalid_request"
27077
+ });
27078
+ return void 0;
27079
+ }, "parseResolveConflicts");
26712
27080
  const hasControlCharacter = /* @__PURE__ */ __name((value) => Array.from(value).some((character) => {
26713
27081
  const code = character.charCodeAt(0);
26714
27082
  return code <= 31 || code === 127;
@@ -26733,7 +27101,7 @@ function registerSessionRoutes(app, deps) {
26733
27101
  }, "parseSessionPrBody");
26734
27102
  const serializeSessionErrors = /* @__PURE__ */ __name((errors, redactDetails = false) => errors.map((e) => ({
26735
27103
  sessionId: e.sessionId,
26736
- error: redactDetails ? "Session operation failed." : e.error instanceof Error ? e.error.message : String(e.error)
27104
+ error: redactDetails && !(e.error instanceof SessionConflictError) ? "Session operation failed." : e.error instanceof Error ? e.error.message : String(e.error)
26737
27105
  })), "serializeSessionErrors");
26738
27106
  const runResolvedSessionBatch = /* @__PURE__ */ __name(async (params) => {
26739
27107
  const { req, res, route, sessionIds, run: run2 } = params;
@@ -26759,14 +27127,18 @@ function registerSessionRoutes(app, deps) {
26759
27127
  sendWorkspaceRuntimeUnavailable(res);
26760
27128
  return void 0;
26761
27129
  }
26762
- return { result: await run2(verifiedRuntime, true), internal: true };
27130
+ return {
27131
+ result: await run2(verifiedRuntime, true),
27132
+ internal: isInternalWorkspaceRuntime(verifiedRuntime)
27133
+ };
26763
27134
  });
26764
27135
  }, "runResolvedSessionBatch");
26765
27136
  const deleteSessions = /* @__PURE__ */ __name((req, res, route, sessionIds) => {
26766
27137
  const run2 = /* @__PURE__ */ __name(async (runtime, coordinatorLockHeld) => {
26767
- captureRuntimeGenerationAssertion(runtime)?.();
27138
+ const assertCanMutate = captureRuntimeGenerationAssertion(runtime);
27139
+ assertCanMutate?.();
26768
27140
  const service = createWorkspaceRuntimeSessionService(runtime);
26769
- return runWithSessionListInvalidation(
27141
+ const result = await runWithSessionListInvalidation(
26770
27142
  runtime,
26771
27143
  ["active", "archived"],
26772
27144
  () => runWithWorkspaceRuntimeStorage(
@@ -26777,6 +27149,7 @@ function registerSessionRoutes(app, deps) {
26777
27149
  bridge: runtime.bridge,
26778
27150
  coordinator: archiveCoordinator,
26779
27151
  coordinatorLockHeld,
27152
+ assertCanMutate,
26780
27153
  onError: /* @__PURE__ */ __name(({ phase, sessionId, error: error2 }) => {
26781
27154
  writeStderrLine(
26782
27155
  `qwen serve: ${phase}Session failed for ${safeLogValue(sessionId)}: ${safeLogValue(error2)}`
@@ -26785,16 +27158,19 @@ function registerSessionRoutes(app, deps) {
26785
27158
  })
26786
27159
  )
26787
27160
  );
27161
+ assertCanMutate?.();
27162
+ return result;
26788
27163
  }, "run");
26789
27164
  return runResolvedSessionBatch({ req, res, route, sessionIds, run: run2 });
26790
27165
  }, "deleteSessions");
26791
- const archiveSessions = /* @__PURE__ */ __name((req, res, route, sessionIds) => {
27166
+ const archiveSessions = /* @__PURE__ */ __name((req, res, route, sessionIds, resolveConflicts = false) => {
26792
27167
  const run2 = /* @__PURE__ */ __name(async (runtime, coordinatorLockHeld) => {
26793
- captureRuntimeGenerationAssertion(runtime)?.();
27168
+ const assertCanMutate = captureRuntimeGenerationAssertion(runtime);
27169
+ assertCanMutate?.();
26794
27170
  const service = createWorkspaceRuntimeSessionService(runtime, {
26795
27171
  onWarning: logSessionArchiveWarning
26796
27172
  });
26797
- return runWithSessionListInvalidation(
27173
+ const result = await runWithSessionListInvalidation(
26798
27174
  runtime,
26799
27175
  ["active", "archived"],
26800
27176
  () => runWithWorkspaceRuntimeStorage(
@@ -26804,20 +27180,25 @@ function registerSessionRoutes(app, deps) {
26804
27180
  service,
26805
27181
  bridge: runtime.bridge,
26806
27182
  coordinator: archiveCoordinator,
26807
- coordinatorLockHeld
27183
+ coordinatorLockHeld,
27184
+ resolveConflicts,
27185
+ assertCanMutate
26808
27186
  })
26809
27187
  )
26810
27188
  );
27189
+ assertCanMutate?.();
27190
+ return result;
26811
27191
  }, "run");
26812
27192
  return runResolvedSessionBatch({ req, res, route, sessionIds, run: run2 });
26813
27193
  }, "archiveSessions");
26814
- const unarchiveSessions = /* @__PURE__ */ __name((req, res, route, sessionIds) => {
27194
+ const unarchiveSessions = /* @__PURE__ */ __name((req, res, route, sessionIds, resolveConflicts = false) => {
26815
27195
  const run2 = /* @__PURE__ */ __name(async (runtime, coordinatorLockHeld) => {
26816
- captureRuntimeGenerationAssertion(runtime)?.();
27196
+ const assertCanMutate = captureRuntimeGenerationAssertion(runtime);
27197
+ assertCanMutate?.();
26817
27198
  const service = createWorkspaceRuntimeSessionService(runtime, {
26818
27199
  onWarning: logSessionArchiveWarning
26819
27200
  });
26820
- return runWithSessionListInvalidation(
27201
+ const result = await runWithSessionListInvalidation(
26821
27202
  runtime,
26822
27203
  ["active", "archived"],
26823
27204
  () => runWithWorkspaceRuntimeStorage(
@@ -26826,10 +27207,14 @@ function registerSessionRoutes(app, deps) {
26826
27207
  sessionIds,
26827
27208
  service,
26828
27209
  coordinator: archiveCoordinator,
26829
- coordinatorLockHeld
27210
+ coordinatorLockHeld,
27211
+ resolveConflicts,
27212
+ assertCanMutate
26830
27213
  })
26831
27214
  )
26832
27215
  );
27216
+ assertCanMutate?.();
27217
+ return result;
26833
27218
  }, "run");
26834
27219
  return runResolvedSessionBatch({ req, res, route, sessionIds, run: run2 });
26835
27220
  }, "unarchiveSessions");
@@ -29107,19 +29492,23 @@ function registerSessionRoutes(app, deps) {
29107
29492
  app.post("/sessions/archive", mutate(), async (req, res) => {
29108
29493
  const uniqueIds = parseSessionIdsBody(req, res);
29109
29494
  if (uniqueIds === void 0) return;
29495
+ const resolveConflicts = parseResolveConflicts(req, res);
29496
+ if (resolveConflicts === void 0) return;
29110
29497
  if (rejectActiveLiveSessionMutation(res, uniqueIds)) return;
29111
29498
  try {
29112
29499
  const operation = await archiveSessions(
29113
29500
  void 0,
29114
29501
  res,
29115
29502
  "POST /sessions/archive",
29116
- uniqueIds
29503
+ uniqueIds,
29504
+ resolveConflicts
29117
29505
  );
29118
29506
  if (!operation) return;
29119
29507
  const { result } = operation;
29120
29508
  res.status(200).json({
29121
29509
  archived: result.archived,
29122
29510
  alreadyArchived: result.alreadyArchived,
29511
+ resolvedConflicts: result.resolvedConflicts,
29123
29512
  notFound: result.notFound,
29124
29513
  errors: serializeSessionErrors(result.errors, operation.internal)
29125
29514
  });
@@ -29130,18 +29519,22 @@ function registerSessionRoutes(app, deps) {
29130
29519
  app.post("/sessions/unarchive", mutate(), async (req, res) => {
29131
29520
  const uniqueIds = parseSessionIdsBody(req, res);
29132
29521
  if (uniqueIds === void 0) return;
29522
+ const resolveConflicts = parseResolveConflicts(req, res);
29523
+ if (resolveConflicts === void 0) return;
29133
29524
  try {
29134
29525
  const operation = await unarchiveSessions(
29135
29526
  void 0,
29136
29527
  res,
29137
29528
  "POST /sessions/unarchive",
29138
- uniqueIds
29529
+ uniqueIds,
29530
+ resolveConflicts
29139
29531
  );
29140
29532
  if (!operation) return;
29141
29533
  const { result } = operation;
29142
29534
  res.status(200).json({
29143
29535
  unarchived: result.unarchived,
29144
29536
  alreadyActive: result.alreadyActive,
29537
+ resolvedConflicts: result.resolvedConflicts,
29145
29538
  notFound: result.notFound,
29146
29539
  errors: serializeSessionErrors(result.errors, operation.internal)
29147
29540
  });
@@ -29182,14 +29575,23 @@ function registerSessionRoutes(app, deps) {
29182
29575
  const route = "POST /workspaces/:workspace/sessions/archive";
29183
29576
  const uniqueIds = parseSessionIdsBody(req, res);
29184
29577
  if (uniqueIds === void 0) return;
29578
+ const resolveConflicts = parseResolveConflicts(req, res);
29579
+ if (resolveConflicts === void 0) return;
29185
29580
  if (rejectActiveLiveSessionMutation(res, uniqueIds)) return;
29186
29581
  try {
29187
- const operation = await archiveSessions(req, res, route, uniqueIds);
29582
+ const operation = await archiveSessions(
29583
+ req,
29584
+ res,
29585
+ route,
29586
+ uniqueIds,
29587
+ resolveConflicts
29588
+ );
29188
29589
  if (!operation) return;
29189
29590
  const { result } = operation;
29190
29591
  res.status(200).json({
29191
29592
  archived: result.archived,
29192
29593
  alreadyArchived: result.alreadyArchived,
29594
+ resolvedConflicts: result.resolvedConflicts,
29193
29595
  notFound: result.notFound,
29194
29596
  errors: serializeSessionErrors(result.errors, operation.internal)
29195
29597
  });
@@ -29205,13 +29607,22 @@ function registerSessionRoutes(app, deps) {
29205
29607
  const route = "POST /workspaces/:workspace/sessions/unarchive";
29206
29608
  const uniqueIds = parseSessionIdsBody(req, res);
29207
29609
  if (uniqueIds === void 0) return;
29610
+ const resolveConflicts = parseResolveConflicts(req, res);
29611
+ if (resolveConflicts === void 0) return;
29208
29612
  try {
29209
- const operation = await unarchiveSessions(req, res, route, uniqueIds);
29613
+ const operation = await unarchiveSessions(
29614
+ req,
29615
+ res,
29616
+ route,
29617
+ uniqueIds,
29618
+ resolveConflicts
29619
+ );
29210
29620
  if (!operation) return;
29211
29621
  const { result } = operation;
29212
29622
  res.status(200).json({
29213
29623
  unarchived: result.unarchived,
29214
29624
  alreadyActive: result.alreadyActive,
29625
+ resolvedConflicts: result.resolvedConflicts,
29215
29626
  notFound: result.notFound,
29216
29627
  errors: serializeSessionErrors(result.errors, operation.internal)
29217
29628
  });
@@ -30788,6 +31199,15 @@ function registerScheduledTaskCrudRoutes(app, deps) {
30788
31199
  });
30789
31200
  return;
30790
31201
  }
31202
+ const parsedSessionId = parseCallerSuppliedSessionId(body["sessionId"]);
31203
+ if (parsedSessionId.kind === "invalid") {
31204
+ res.status(400).json({
31205
+ error: '`sessionId` must be an RFC UUID v1-v5 (e.g. "550e8400-e29b-41d4-a716-446655440000")',
31206
+ code: "invalid_session_id"
31207
+ });
31208
+ return;
31209
+ }
31210
+ const providedSessionId = parsedSessionId.kind === "valid" ? parsedSessionId.sessionId : void 0;
30791
31211
  let delivery;
30792
31212
  if (body["delivery"] !== void 0) {
30793
31213
  try {
@@ -30807,12 +31227,82 @@ function registerScheduledTaskCrudRoutes(app, deps) {
30807
31227
  const enabled = body["enabled"] !== false;
30808
31228
  const taskId = generateCronTaskId();
30809
31229
  let boundSessionId;
31230
+ let sessionMintedHere = false;
31231
+ if (providedSessionId !== void 0 && !bridge) {
31232
+ res.status(409).json({
31233
+ error: "Session management is not available for this workspace",
31234
+ code: "session_binding_unavailable"
31235
+ });
31236
+ return;
31237
+ }
30810
31238
  if (bridge) {
31239
+ if (providedSessionId !== void 0) {
31240
+ try {
31241
+ const owner = target.resolveLiveSessionOwner?.(providedSessionId);
31242
+ if (owner?.kind === "unavailable") {
31243
+ sendWorkspaceRuntimeUnavailable(res);
31244
+ return;
31245
+ }
31246
+ if (owner?.kind === "ambiguous") {
31247
+ res.status(500).json({
31248
+ error: `Session owner is ambiguous for "${providedSessionId}"`,
31249
+ code: "ambiguous_session_owner"
31250
+ });
31251
+ return;
31252
+ }
31253
+ if (owner?.kind === "found" && owner.runtime.workspaceCwd !== workspaceCwd) {
31254
+ res.status(400).json({
31255
+ error: "The requested session belongs to a different workspace; use that workspace's scheduled-task endpoint",
31256
+ code: "session_workspace_mismatch"
31257
+ });
31258
+ return;
31259
+ }
31260
+ const summary = bridge.getSessionSummary(providedSessionId);
31261
+ if (summary.workspaceCwd !== workspaceCwd) {
31262
+ res.status(400).json({
31263
+ error: "The requested session belongs to a different workspace; use that workspace's scheduled-task endpoint",
31264
+ code: "session_workspace_mismatch"
31265
+ });
31266
+ return;
31267
+ }
31268
+ if (summary.hasActivePrompt) {
31269
+ res.status(409).json({
31270
+ error: "The requested session is busy; wait for its active prompt to finish before binding it to a task",
31271
+ code: "session_busy"
31272
+ });
31273
+ return;
31274
+ }
31275
+ if (summary.sourceType === "scheduled_task") {
31276
+ res.status(409).json({
31277
+ error: "The requested session is already reserved for a scheduled task",
31278
+ code: "session_already_bound"
31279
+ });
31280
+ return;
31281
+ }
31282
+ } catch (err) {
31283
+ if (err instanceof SessionNotFoundError) {
31284
+ res.status(404).json({
31285
+ error: `Session '${providedSessionId}' was not found`,
31286
+ code: "session_not_found"
31287
+ });
31288
+ return;
31289
+ }
31290
+ writeStderrLine(
31291
+ `qwen serve: POST ${base} failed to look up session '${providedSessionId}': ${err instanceof Error ? err.message : String(err)}`
31292
+ );
31293
+ res.status(500).json({
31294
+ error: "Failed to look up the requested session",
31295
+ code: "scheduled_tasks_session_failed"
31296
+ });
31297
+ return;
31298
+ }
31299
+ }
30811
31300
  try {
30812
- if ((await runWithScheduledTaskTarget(
31301
+ const tasks = await runWithScheduledTaskTarget(
30813
31302
  target,
30814
31303
  () => readCronTasks(workspaceCwd)
30815
- )).length >= MAX_SCHEDULED_TASKS) {
31304
+ );
31305
+ if (tasks.length >= MAX_SCHEDULED_TASKS) {
30816
31306
  res.status(409).json({
30817
31307
  error: `Maximum number of scheduled tasks (${MAX_SCHEDULED_TASKS}) reached`,
30818
31308
  code: "max_tasks_reached"
@@ -30822,43 +31312,48 @@ function registerScheduledTaskCrudRoutes(app, deps) {
30822
31312
  } catch {
30823
31313
  }
30824
31314
  if (!requireOpenGeneration2(target, res)) return;
30825
- try {
30826
- const session = await runWithScheduledTaskTarget(
30827
- target,
30828
- () => bridge.spawnOrAttach({
30829
- workspaceCwd,
30830
- sessionScope: "thread",
30831
- sourceType: "scheduled_task",
30832
- sourceId: taskId
30833
- })
30834
- );
30835
- boundSessionId = session.sessionId;
30836
- if (!requireOpenGeneration2(target, res)) {
30837
- await teardownBoundSession(target, boundSessionId);
30838
- return;
30839
- }
31315
+ if (providedSessionId !== void 0) {
31316
+ boundSessionId = providedSessionId;
31317
+ } else {
30840
31318
  try {
30841
- await runWithScheduledTaskTarget(
31319
+ const session = await runWithScheduledTaskTarget(
30842
31320
  target,
30843
- async () => bridge.updateSessionMetadata(boundSessionId, {
30844
- displayName: scheduledTaskSessionName(
30845
- nameResult.value ?? prompt
30846
- )
31321
+ () => bridge.spawnOrAttach({
31322
+ workspaceCwd,
31323
+ sessionScope: "thread",
31324
+ sourceType: "scheduled_task",
31325
+ sourceId: taskId
30847
31326
  })
30848
31327
  );
30849
- } catch {
31328
+ boundSessionId = session.sessionId;
31329
+ sessionMintedHere = true;
31330
+ if (!requireOpenGeneration2(target, res)) {
31331
+ await teardownBoundSession(target, boundSessionId);
31332
+ return;
31333
+ }
31334
+ try {
31335
+ await runWithScheduledTaskTarget(
31336
+ target,
31337
+ async () => bridge.updateSessionMetadata(boundSessionId, {
31338
+ displayName: scheduledTaskSessionName(
31339
+ nameResult.value ?? prompt
31340
+ )
31341
+ })
31342
+ );
31343
+ } catch {
31344
+ }
31345
+ } catch (err) {
31346
+ if (sendActivityGateError(res, err)) return;
31347
+ if (sendGenerationClosedError(res, err)) return;
31348
+ writeStderrLine(
31349
+ `qwen serve: POST ${base} failed to create the task's session: ${err instanceof Error ? err.message : String(err)}`
31350
+ );
31351
+ res.status(500).json({
31352
+ error: "Failed to create the task's session",
31353
+ code: "scheduled_tasks_session_failed"
31354
+ });
31355
+ return;
30850
31356
  }
30851
- } catch (err) {
30852
- if (sendActivityGateError(res, err)) return;
30853
- if (sendGenerationClosedError(res, err)) return;
30854
- writeStderrLine(
30855
- `qwen serve: POST ${base} failed to create the task's session: ${err instanceof Error ? err.message : String(err)}`
30856
- );
30857
- res.status(500).json({
30858
- error: "Failed to create the task's session",
30859
- code: "scheduled_tasks_session_failed"
30860
- });
30861
- return;
30862
31357
  }
30863
31358
  }
30864
31359
  const now = Date.now();
@@ -30873,15 +31368,20 @@ function registerScheduledTaskCrudRoutes(app, deps) {
30873
31368
  lastFiredAt: now - now % 6e4,
30874
31369
  enabled,
30875
31370
  ...delivery !== void 0 ? { delivery } : {},
30876
- ...boundSessionId !== void 0 ? { sessionId: boundSessionId } : {},
31371
+ ...boundSessionId !== void 0 ? {
31372
+ sessionId: boundSessionId,
31373
+ ...providedSessionId !== void 0 ? { sessionOwnedByTask: false } : {}
31374
+ } : {},
30877
31375
  ...nameResult.value !== void 0 ? { name: nameResult.value } : {}
30878
31376
  };
30879
31377
  const rollbackSession = /* @__PURE__ */ __name(async () => {
30880
- if (boundSessionId !== void 0) {
31378
+ if (boundSessionId !== void 0 && sessionMintedHere) {
30881
31379
  await teardownBoundSession(target, boundSessionId);
30882
31380
  }
30883
31381
  }, "rollbackSession");
30884
31382
  let overCap = false;
31383
+ let alreadyBound = false;
31384
+ let sessionNoLongerLive = false;
30885
31385
  let rollbackBefore;
30886
31386
  let rollbackAfter;
30887
31387
  try {
@@ -30890,6 +31390,24 @@ function registerScheduledTaskCrudRoutes(app, deps) {
30890
31390
  () => updateCronTasks(
30891
31391
  workspaceCwd,
30892
31392
  (tasks) => {
31393
+ if (providedSessionId !== void 0 && tasks.some((task2) => task2.sessionId === providedSessionId)) {
31394
+ alreadyBound = true;
31395
+ return tasks;
31396
+ }
31397
+ if (providedSessionId !== void 0 && bridge) {
31398
+ try {
31399
+ if (bridge.getSessionSummary(providedSessionId).sourceType === "scheduled_task") {
31400
+ alreadyBound = true;
31401
+ return tasks;
31402
+ }
31403
+ } catch (err) {
31404
+ if (err instanceof SessionNotFoundError) {
31405
+ sessionNoLongerLive = true;
31406
+ return tasks;
31407
+ }
31408
+ throw err;
31409
+ }
31410
+ }
30893
31411
  if (tasks.length >= MAX_SCHEDULED_TASKS) {
30894
31412
  overCap = true;
30895
31413
  return tasks;
@@ -30937,6 +31455,20 @@ function registerScheduledTaskCrudRoutes(app, deps) {
30937
31455
  });
30938
31456
  return;
30939
31457
  }
31458
+ if (alreadyBound) {
31459
+ res.status(409).json({
31460
+ error: "The requested session is already bound to another scheduled task",
31461
+ code: "session_already_bound"
31462
+ });
31463
+ return;
31464
+ }
31465
+ if (sessionNoLongerLive) {
31466
+ res.status(404).json({
31467
+ error: `Session '${providedSessionId}' was not found`,
31468
+ code: "session_not_found"
31469
+ });
31470
+ return;
31471
+ }
30940
31472
  if (task.delivery && task.sessionId) {
30941
31473
  channelDeliveryAuthorizations?.registerScheduledTask(workspaceCwd, {
30942
31474
  sessionId: task.sessionId,
@@ -31141,7 +31673,7 @@ function registerScheduledTaskCrudRoutes(app, deps) {
31141
31673
  return;
31142
31674
  }
31143
31675
  const effectiveLabelChanged = patch.name !== void 0 || clearName || patch.prompt !== void 0 && updated.name === void 0;
31144
- if (bridge && updated.sessionId && effectiveLabelChanged) {
31676
+ if (bridge && updated.sessionId && updated.sessionOwnedByTask !== false && effectiveLabelChanged) {
31145
31677
  try {
31146
31678
  bridge.updateSessionMetadata(updated.sessionId, {
31147
31679
  displayName: scheduledTaskSessionName(
@@ -31181,6 +31713,7 @@ function registerScheduledTaskCrudRoutes(app, deps) {
31181
31713
  return;
31182
31714
  }
31183
31715
  let boundSessionId;
31716
+ let sessionOwnedByTask = true;
31184
31717
  let removed = false;
31185
31718
  let rollbackBefore;
31186
31719
  let rollbackAfter;
@@ -31195,6 +31728,7 @@ function registerScheduledTaskCrudRoutes(app, deps) {
31195
31728
  const match = tasks[idx].sessionId;
31196
31729
  if (typeof match === "string" && match.length > 0) {
31197
31730
  boundSessionId = match;
31731
+ sessionOwnedByTask = tasks[idx].sessionOwnedByTask !== false;
31198
31732
  }
31199
31733
  removed = true;
31200
31734
  rollbackBefore = tasks;
@@ -31234,7 +31768,7 @@ function registerScheduledTaskCrudRoutes(app, deps) {
31234
31768
  res.status(404).json({ error: "Task not found", code: "task_not_found" });
31235
31769
  return;
31236
31770
  }
31237
- if (boundSessionId && bridge) {
31771
+ if (boundSessionId && sessionOwnedByTask && bridge) {
31238
31772
  try {
31239
31773
  await runWithScheduledTaskTarget(
31240
31774
  target,
@@ -31394,9 +31928,17 @@ function registerScheduledTasksRoutes(app, deps) {
31394
31928
  cleanupSession: /* @__PURE__ */ __name((sessionId) => deps.cleanupSession(runtime, sessionId), "cleanupSession")
31395
31929
  } : {}
31396
31930
  } : {},
31397
- bridge: runtime?.bridge ?? bridge,
31931
+ // The runtime bridge only refines an ENABLED deps bridge; it must never
31932
+ // re-enable binding when deps `bridge` is undefined. server.ts passes
31933
+ // the bridge only when resident task-session management is on, and a
31934
+ // bound task must always have something to keep it resident + rehydrate
31935
+ // it — the same gate the qualified surface enforces below.
31936
+ bridge: bridge === void 0 ? void 0 : runtime?.bridge ?? bridge,
31398
31937
  ...runtime?.generationGuard ? {
31399
31938
  assertGenerationOpen: /* @__PURE__ */ __name(() => runtime.generationGuard?.assertOpen(), "assertGenerationOpen")
31939
+ } : {},
31940
+ ...deps.workspaceRegistry ? {
31941
+ resolveLiveSessionOwner: /* @__PURE__ */ __name((sessionId) => deps.workspaceRegistry.resolveLiveSessionOwner(sessionId), "resolveLiveSessionOwner")
31400
31942
  } : {}
31401
31943
  };
31402
31944
  }, "resolveTarget"),
@@ -31429,7 +31971,7 @@ function registerWorkspaceQualifiedScheduledTasksRoutes(app, deps) {
31429
31971
  sendConversationRuntimeUnavailable(res);
31430
31972
  return null;
31431
31973
  }
31432
- if (runtime.provenance === "live-conversation" && req.method === "POST" && req.params["id"] === void 0) {
31974
+ if (runtime.provenance === "live-conversation" && req.method === "POST" && req.params["id"] === void 0 && parseCallerSuppliedSessionId(safeBody2(req)["sessionId"]).kind === "absent") {
31433
31975
  res.status(400).json({
31434
31976
  error: "Generic scheduled tasks cannot create sessions in the Conversations workspace.",
31435
31977
  code: "live_session_creation_reserved"
@@ -31448,7 +31990,8 @@ function registerWorkspaceQualifiedScheduledTasksRoutes(app, deps) {
31448
31990
  bridge: manageScheduledTaskSessions ? runtime.bridge : void 0,
31449
31991
  ...runtime.generationGuard ? {
31450
31992
  assertGenerationOpen: /* @__PURE__ */ __name(() => runtime.generationGuard?.assertOpen(), "assertGenerationOpen")
31451
- } : {}
31993
+ } : {},
31994
+ resolveLiveSessionOwner: /* @__PURE__ */ __name((sessionId) => workspaceRegistry.resolveLiveSessionOwner(sessionId), "resolveLiveSessionOwner")
31452
31995
  };
31453
31996
  }, "resolveTarget"),
31454
31997
  mutate,
@@ -31735,7 +32278,7 @@ async function bindAndNameSessions(bridge, boundWorkspace, tasks, renamed, spawn
31735
32278
  (t) => !t.sessionId && t.enabled !== false && !taskHasLegacyCondition(t) && !binding.has(t.id)
31736
32279
  );
31737
32280
  const needsName = tasks.filter(
31738
- (t) => t.sessionId && t.enabled !== false && !taskHasLegacyCondition(t) && !renamed.has(t.sessionId)
32281
+ (t) => t.sessionId && t.sessionOwnedByTask !== false && t.enabled !== false && !taskHasLegacyCondition(t) && !renamed.has(t.sessionId)
31739
32282
  );
31740
32283
  for (const task of unbound) {
31741
32284
  let spawnedSessionId;
@@ -32222,12 +32765,6 @@ function registerWorkspaceStatusRoutes(app, deps) {
32222
32765
  });
32223
32766
  }
32224
32767
  __name(registerWorkspaceStatusRoutes, "registerWorkspaceStatusRoutes");
32225
- function resolveTrustedRuntime(registry, req, res) {
32226
- const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
32227
- if (!runtime) return null;
32228
- return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
32229
- }
32230
- __name(resolveTrustedRuntime, "resolveTrustedRuntime");
32231
32768
  function registerWorkspaceQualifiedStatusRoutes(app, deps) {
32232
32769
  const { workspaceRegistry, sendBridgeError: sendBridgeError2 } = deps;
32233
32770
  app.get("/workspaces/:workspace/mcp", async (req, res) => {
@@ -32900,6 +33437,16 @@ var VALID_WRITE_SCOPES = /* @__PURE__ */ new Set(["workspace", "user"]);
32900
33437
  var QUALIFIED_WRITE_SCOPES = /* @__PURE__ */ new Set(["workspace"]);
32901
33438
  var mcpServerMutationQueues = /* @__PURE__ */ new Map();
32902
33439
  var SECURITY_SENSITIVE_SETTINGS = /* @__PURE__ */ new Set(["tools.approvalMode"]);
33440
+ function rejectWorkspaceRestrictedWrite(res, scope, key) {
33441
+ if (scope !== "workspace" || !WORKSPACE_RESTRICTED_SETTING_KEYS.includes(key))
33442
+ return false;
33443
+ res.status(400).json({
33444
+ error: `Setting "${key}" is not honored from workspace scope; set it at user scope instead`,
33445
+ code: "workspace_restricted_setting"
33446
+ });
33447
+ return true;
33448
+ }
33449
+ __name(rejectWorkspaceRestrictedWrite, "rejectWorkspaceRestrictedWrite");
32903
33450
  function getAllowedKeys(includeLiveVoice = false) {
32904
33451
  const keys = new Set(
32905
33452
  getDialogSettingKeys().filter(
@@ -33116,6 +33663,7 @@ function registerWorkspaceSettingsRoutes(app, deps) {
33116
33663
  });
33117
33664
  return;
33118
33665
  }
33666
+ if (rejectWorkspaceRestrictedWrite(res, scope, key)) return;
33119
33667
  if (LIVE_MANAGED_SETTINGS.has(key)) {
33120
33668
  res.status(400).json({
33121
33669
  error: `Setting "${key}" must be changed through the Live setup API`,
@@ -33298,6 +33846,7 @@ function registerWorkspaceQualifiedSettingsRoutes(app, deps) {
33298
33846
  });
33299
33847
  return;
33300
33848
  }
33849
+ if (rejectWorkspaceRestrictedWrite(res, scope, key)) return;
33301
33850
  if (LIVE_MANAGED_SETTINGS.has(key)) {
33302
33851
  res.status(400).json({
33303
33852
  error: `Setting "${key}" must be changed through the Live setup API`,
@@ -37239,15 +37788,9 @@ function registerWorkspaceGitRoutes(app, deps) {
37239
37788
  });
37240
37789
  }
37241
37790
  __name(registerWorkspaceGitRoutes, "registerWorkspaceGitRoutes");
37242
- function resolveTrustedRuntime2(registry, req, res) {
37243
- const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
37244
- if (!runtime) return null;
37245
- return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
37246
- }
37247
- __name(resolveTrustedRuntime2, "resolveTrustedRuntime");
37248
37791
  function registerWorkspaceQualifiedGitRoutes(app, deps) {
37249
37792
  app.get("/workspaces/:workspace/git", async (req, res) => {
37250
- const runtime = resolveTrustedRuntime2(deps.workspaceRegistry, req, res);
37793
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37251
37794
  if (!runtime) return;
37252
37795
  const route = "GET /workspaces/:workspace/git";
37253
37796
  try {
@@ -37423,15 +37966,9 @@ function registerWorkspaceGitDiffRoutes(app, deps) {
37423
37966
  });
37424
37967
  }
37425
37968
  __name(registerWorkspaceGitDiffRoutes, "registerWorkspaceGitDiffRoutes");
37426
- function resolveTrustedRuntime3(registry, req, res) {
37427
- const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
37428
- if (!runtime) return null;
37429
- return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
37430
- }
37431
- __name(resolveTrustedRuntime3, "resolveTrustedRuntime");
37432
37969
  function registerWorkspaceQualifiedGitDiffRoutes(app, deps) {
37433
37970
  app.get("/workspaces/:workspace/git/diff", (req, res) => {
37434
- const runtime = resolveTrustedRuntime3(deps.workspaceRegistry, req, res);
37971
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37435
37972
  if (!runtime) return;
37436
37973
  void handleDiffList(
37437
37974
  res,
@@ -37442,7 +37979,7 @@ function registerWorkspaceQualifiedGitDiffRoutes(app, deps) {
37442
37979
  );
37443
37980
  });
37444
37981
  app.get("/workspaces/:workspace/git/diff/file", (req, res) => {
37445
- const runtime = resolveTrustedRuntime3(deps.workspaceRegistry, req, res);
37982
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37446
37983
  if (!runtime) return;
37447
37984
  void handleDiffFile(
37448
37985
  req,
@@ -37583,15 +38120,9 @@ function registerWorkspaceGitLogRoutes(app, deps) {
37583
38120
  });
37584
38121
  }
37585
38122
  __name(registerWorkspaceGitLogRoutes, "registerWorkspaceGitLogRoutes");
37586
- function resolveTrustedRuntime4(registry, req, res) {
37587
- const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
37588
- if (!runtime) return null;
37589
- return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
37590
- }
37591
- __name(resolveTrustedRuntime4, "resolveTrustedRuntime");
37592
38123
  function registerWorkspaceQualifiedGitLogRoutes(app, deps) {
37593
38124
  app.get("/workspaces/:workspace/git/log", (req, res) => {
37594
- const runtime = resolveTrustedRuntime4(deps.workspaceRegistry, req, res);
38125
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37595
38126
  if (!runtime) return;
37596
38127
  void handleLogList(
37597
38128
  req,
@@ -37602,7 +38133,7 @@ function registerWorkspaceQualifiedGitLogRoutes(app, deps) {
37602
38133
  );
37603
38134
  });
37604
38135
  app.get("/workspaces/:workspace/git/log/commit", (req, res) => {
37605
- const runtime = resolveTrustedRuntime4(deps.workspaceRegistry, req, res);
38136
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37606
38137
  if (!runtime) return;
37607
38138
  void handleCommitDetail(
37608
38139
  req,
@@ -37618,12 +38149,6 @@ __name(registerWorkspaceQualifiedGitLogRoutes, "registerWorkspaceQualifiedGitLog
37618
38149
  // packages/cli/src/serve/routes/workspace-git-branches.ts
37619
38150
  init_esbuild_shims();
37620
38151
  var GIT_ERROR_MESSAGE_MAX = 512;
37621
- function resolveTrustedRuntime5(registry, req, res) {
37622
- const runtime = resolveWorkspaceRuntimeFromParam(registry, req, res);
37623
- if (!runtime) return null;
37624
- return requireTrustedWorkspaceRuntime(runtime, res) ? runtime : null;
37625
- }
37626
- __name(resolveTrustedRuntime5, "resolveTrustedRuntime");
37627
38152
  function sendGitError(res, err, route, sendBridgeError2, cwd) {
37628
38153
  let detail;
37629
38154
  if (err && typeof err === "object" && ("stdout" in err || "stderr" in err)) {
@@ -37932,7 +38457,7 @@ function registerWorkspaceGitBranchRoutes(app, deps) {
37932
38457
  __name(registerWorkspaceGitBranchRoutes, "registerWorkspaceGitBranchRoutes");
37933
38458
  function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
37934
38459
  app.get("/workspaces/:workspace/git/branches", (req, res) => {
37935
- const runtime = resolveTrustedRuntime5(deps.workspaceRegistry, req, res);
38460
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37936
38461
  if (!runtime) return;
37937
38462
  void handleBranches(
37938
38463
  res,
@@ -37947,7 +38472,7 @@ function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
37947
38472
  "/workspaces/:workspace/git/checkout",
37948
38473
  deps.mutate({ strict: true }),
37949
38474
  (req, res) => {
37950
- const runtime = resolveTrustedRuntime5(deps.workspaceRegistry, req, res);
38475
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37951
38476
  if (!runtime) return;
37952
38477
  try {
37953
38478
  runtime.generationGuard?.assertOpen();
@@ -37980,7 +38505,7 @@ function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
37980
38505
  "/workspaces/:workspace/git/branch",
37981
38506
  deps.mutate({ strict: true }),
37982
38507
  (req, res) => {
37983
- const runtime = resolveTrustedRuntime5(deps.workspaceRegistry, req, res);
38508
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
37984
38509
  if (!runtime) return;
37985
38510
  try {
37986
38511
  runtime.generationGuard?.assertOpen();
@@ -38013,7 +38538,7 @@ function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
38013
38538
  "/workspaces/:workspace/git/push",
38014
38539
  deps.mutate({ strict: true }),
38015
38540
  (req, res) => {
38016
- const runtime = resolveTrustedRuntime5(deps.workspaceRegistry, req, res);
38541
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
38017
38542
  if (!runtime) return;
38018
38543
  try {
38019
38544
  runtime.generationGuard?.assertOpen();
@@ -38046,7 +38571,7 @@ function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
38046
38571
  "/workspaces/:workspace/git/pull",
38047
38572
  deps.mutate({ strict: true }),
38048
38573
  (req, res) => {
38049
- const runtime = resolveTrustedRuntime5(deps.workspaceRegistry, req, res);
38574
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
38050
38575
  if (!runtime) return;
38051
38576
  try {
38052
38577
  runtime.generationGuard?.assertOpen();
@@ -38079,7 +38604,7 @@ function registerWorkspaceQualifiedGitBranchRoutes(app, deps) {
38079
38604
  "/workspaces/:workspace/git/commit",
38080
38605
  deps.mutate({ strict: true }),
38081
38606
  (req, res) => {
38082
- const runtime = resolveTrustedRuntime5(deps.workspaceRegistry, req, res);
38607
+ const runtime = resolveTrustedRuntime(deps.workspaceRegistry, req, res);
38083
38608
  if (!runtime) return;
38084
38609
  try {
38085
38610
  runtime.generationGuard?.assertOpen();
@@ -45651,7 +46176,7 @@ var LiveSessionCoordinator = class {
45651
46176
  if (candidate) {
45652
46177
  try {
45653
46178
  const resumed = await runtime.bridge.resumeSession({
45654
- sessionId: candidate.sessionId,
46179
+ sessionId: normalizeSessionIdForLookup(candidate.sessionId),
45655
46180
  workspaceCwd: runtime.workspaceCwd,
45656
46181
  ...candidate.parentSessionId ? { parentSessionId: candidate.parentSessionId } : {},
45657
46182
  ...candidate.sourceType ? { sourceType: candidate.sourceType } : {},
@@ -46668,9 +47193,9 @@ var LiveTaskService = class {
46668
47193
  }
46669
47194
  async waitForTarget(target, task, signal) {
46670
47195
  const { cursor } = decodeCursor(target.afterCursor, target.threadId);
46671
- const lastEventId = cursor.eventEpoch === task.runtime.bridge.getSessionEventEpoch(target.threadId) ? cursor.eventId : task.runtime.bridge.getSessionLastEventId(target.threadId);
47196
+ const lastEventId = cursor.eventEpoch === task.runtime.bridge.getSessionEventEpoch(task.bridgeSessionId) ? cursor.eventId : task.runtime.bridge.getSessionLastEventId(task.bridgeSessionId);
46672
47197
  for await (const event of task.runtime.bridge.subscribeEvents(
46673
- target.threadId,
47198
+ task.bridgeSessionId,
46674
47199
  { lastEventId, signal }
46675
47200
  )) {
46676
47201
  const reason = eventWakeReason(event);
@@ -46691,9 +47216,11 @@ var LiveTaskService = class {
46691
47216
  threadId: target.threadId,
46692
47217
  ...task.summary.clientCount > 0 ? {
46693
47218
  eventEpoch: task.runtime.bridge.getSessionEventEpoch(
46694
- target.threadId
47219
+ task.bridgeSessionId
46695
47220
  ),
46696
- eventId: task.runtime.bridge.getSessionLastEventId(target.threadId)
47221
+ eventId: task.runtime.bridge.getSessionLastEventId(
47222
+ task.bridgeSessionId
47223
+ )
46697
47224
  } : {},
46698
47225
  updatedAt: laterActivityTimestamp(
46699
47226
  task.summary.updatedAt,
@@ -46711,7 +47238,7 @@ var LiveTaskService = class {
46711
47238
  const startedAt = latestTurnRecords[0]?.timestamp ?? task.persisted?.conversation.startTime;
46712
47239
  const completedAt = latestTurnRecords.at(-1)?.timestamp ?? task.persisted?.conversation.lastUpdated;
46713
47240
  const failed = task.summary.hasTurnError === true;
46714
- const revision = task.summary.clientCount > 0 ? task.runtime.bridge.getSessionLastEventId(target.threadId) : epochSeconds(
47241
+ const revision = task.summary.clientCount > 0 ? task.runtime.bridge.getSessionLastEventId(task.bridgeSessionId) : epochSeconds(
46715
47242
  laterActivityTimestamp(
46716
47243
  task.summary.updatedAt,
46717
47244
  task.persisted?.conversation.lastUpdated
@@ -46760,7 +47287,7 @@ var LiveTaskService = class {
46760
47287
  };
46761
47288
  }
46762
47289
  latestTurnId(task) {
46763
- return [...task.persisted?.conversation.messages ?? []].reverse().find((record) => record.type === "user")?.uuid ?? task.summary.sessionId;
47290
+ return [...task.persisted?.conversation.messages ?? []].reverse().find((record) => record.type === "user")?.uuid ?? task.threadId;
46764
47291
  }
46765
47292
  async sendMessage(args) {
46766
47293
  const threadId = boundedString(args["threadId"], "threadId", 256);
@@ -46768,7 +47295,11 @@ var LiveTaskService = class {
46768
47295
  localHost(args["hostId"]);
46769
47296
  const located = await this.locateTask(threadId);
46770
47297
  await this.ensureResident(located);
46771
- await this.dispatchPrompt(located.runtime.bridge, threadId, prompt);
47298
+ await this.dispatchPrompt(
47299
+ located.runtime.bridge,
47300
+ located.bridgeSessionId,
47301
+ prompt
47302
+ );
46772
47303
  return { threadId };
46773
47304
  }
46774
47305
  async createThread(args) {
@@ -46859,30 +47390,27 @@ var LiveTaskService = class {
46859
47390
  }
46860
47391
  async ensureResident(task) {
46861
47392
  try {
46862
- task.runtime.bridge.getSessionSummary(task.summary.sessionId);
47393
+ task.runtime.bridge.getSessionSummary(task.bridgeSessionId);
46863
47394
  return;
46864
47395
  } catch (error2) {
46865
47396
  if (!(error2 instanceof SessionNotFoundError)) throw error2;
46866
47397
  }
46867
47398
  const service = createWorkspaceRuntimeSessionService(task.runtime);
46868
- const metadata = task.runtime.provenance === "live-conversation" ? await readLoadableLiveConversationMetadata(
46869
- task.summary.sessionId,
46870
- service
46871
- ) : await service.readCreationMetadata(task.summary.sessionId);
47399
+ const metadata = task.runtime.provenance === "live-conversation" ? await readLoadableLiveConversationMetadata(task.threadId, service) : await service.readCreationMetadata(task.threadId);
46872
47400
  if (metadata === void 0) {
46873
- throw new SessionNotFoundError(task.summary.sessionId);
47401
+ throw new SessionNotFoundError(task.bridgeSessionId);
46874
47402
  }
46875
47403
  await task.runtime.bridge.resumeSession({
46876
- sessionId: task.summary.sessionId,
47404
+ sessionId: task.bridgeSessionId,
46877
47405
  workspaceCwd: task.runtime.workspaceCwd,
46878
47406
  ...metadata
46879
47407
  });
46880
47408
  if (task.runtime.provenance === "live-conversation") {
46881
47409
  const directory = await this.options.materializeConversationDirectory(
46882
- task.summary.sessionId
47410
+ task.bridgeSessionId
46883
47411
  );
46884
47412
  const changed = await task.runtime.bridge.changeSessionCwd(
46885
- task.summary.sessionId,
47413
+ task.bridgeSessionId,
46886
47414
  {
46887
47415
  path: directory,
46888
47416
  allowedRoots: [task.runtime.workspaceCwd],
@@ -46924,21 +47452,27 @@ var LiveTaskService = class {
46924
47452
  }
46925
47453
  }
46926
47454
  async locateTask(threadId) {
46927
- const live = this.options.workspaceRegistry.resolveLiveSessionOwner(threadId);
47455
+ const bridgeSessionId = normalizeSessionIdForLookup(threadId);
47456
+ const storedRuntimes = bridgeSessionId === threadId ? void 0 : await this.findStoredTaskRuntimes(threadId);
47457
+ if (storedRuntimes && storedRuntimes.length > 1) {
47458
+ throw new Error(`Task id is ambiguous: ${threadId}`);
47459
+ }
47460
+ const live = this.options.workspaceRegistry.resolveLiveSessionOwner(bridgeSessionId);
46928
47461
  if (live.kind === "ambiguous") {
46929
47462
  throw new Error(`Task id is ambiguous: ${threadId}`);
46930
47463
  }
46931
47464
  if (live.kind === "unavailable") {
46932
47465
  throw conversationRuntimeUnavailableError();
46933
47466
  }
46934
- const runtimes = live.kind === "found" ? [live.runtime] : (await Promise.all(
46935
- (this.options.workspaceRegistry.listAll?.() ?? this.options.workspaceRegistry.list()).map(async (runtime2) => ({
46936
- runtime: runtime2,
46937
- exists: await createWorkspaceRuntimeSessionService(
46938
- runtime2
46939
- ).sessionExists(threadId)
46940
- }))
46941
- )).filter((entry) => entry.exists).map((entry) => entry.runtime);
47467
+ if (storedRuntimes?.length === 1 && live.kind === "found" && storedRuntimes[0] !== live.runtime) {
47468
+ throw new Error(`Task id is ambiguous: ${threadId}`);
47469
+ }
47470
+ let runtimes = storedRuntimes;
47471
+ if (runtimes === void 0) {
47472
+ runtimes = live.kind === "found" ? [live.runtime] : await this.findStoredTaskRuntimes(threadId);
47473
+ } else if (runtimes.length === 0 && live.kind === "found") {
47474
+ runtimes = [live.runtime];
47475
+ }
46942
47476
  if (runtimes.length === 0) throw new SessionNotFoundError(threadId);
46943
47477
  if (runtimes.length > 1)
46944
47478
  throw new Error(`Task id is ambiguous: ${threadId}`);
@@ -46947,7 +47481,7 @@ var LiveTaskService = class {
46947
47481
  const persisted = await service.loadSession(threadId);
46948
47482
  let summary;
46949
47483
  try {
46950
- summary = runtime.bridge.getSessionSummary(threadId);
47484
+ summary = runtime.bridge.getSessionSummary(bridgeSessionId);
46951
47485
  } catch (error2) {
46952
47486
  if (!(error2 instanceof SessionNotFoundError) && !(error2 instanceof SessionArchivedError)) {
46953
47487
  throw error2;
@@ -46970,7 +47504,18 @@ var LiveTaskService = class {
46970
47504
  if (!found) throw new SessionNotFoundError(threadId);
46971
47505
  summary = found;
46972
47506
  }
46973
- return { runtime, persisted, summary };
47507
+ return { runtime, threadId, bridgeSessionId, persisted, summary };
47508
+ }
47509
+ async findStoredTaskRuntimes(threadId) {
47510
+ const entries = await Promise.all(
47511
+ (this.options.workspaceRegistry.listAll?.() ?? this.options.workspaceRegistry.list()).map(async (runtime) => ({
47512
+ runtime,
47513
+ exists: await createWorkspaceRuntimeSessionService(runtime).sessionExists(
47514
+ threadId
47515
+ )
47516
+ }))
47517
+ );
47518
+ return entries.filter((entry) => entry.exists).map((entry) => entry.runtime);
46974
47519
  }
46975
47520
  };
46976
47521
 
@@ -48200,6 +48745,20 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
48200
48745
  if (liveVoiceEnabled) {
48201
48746
  serveAppLifecycle.setBootStarter(startConversationRuntimeBoot);
48202
48747
  }
48748
+ if (deps.manageScheduledTaskSessions && deps.liveConversationWorkspace) {
48749
+ const readTasks = deps.readLiveConversationScheduledTasks ?? (() => readCronTasks(deps.liveConversationWorkspace.rootPath));
48750
+ void readTasks().then((tasks) => {
48751
+ if (collectBoundSessionIds(tasks).length > 0) {
48752
+ return startConversationRuntimeBoot();
48753
+ }
48754
+ return void 0;
48755
+ }).catch((error2) => {
48756
+ process.stderr.write(
48757
+ `qwen serve: failed to restore the Conversations runtime for scheduled tasks: ${error2 instanceof Error ? error2.message : String(error2)}
48758
+ `
48759
+ );
48760
+ });
48761
+ }
48203
48762
  const ensureConversationRuntimeWithLifecycle = /* @__PURE__ */ __name(async () => {
48204
48763
  await serveAppLifecycle.startBoot(startConversationRuntimeBoot);
48205
48764
  if (!liveRuntimeBootResult) {
@@ -48386,6 +48945,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
48386
48945
  ) : [];
48387
48946
  if (webShellDir) {
48388
48947
  mountWebShellAssets(app, webShellDir, webShellFrameAncestors);
48948
+ mountMcpAppSandbox(app);
48389
48949
  }
48390
48950
  if (deps.enqueueChannelWebhookTask) {
48391
48951
  let channelWebhookConfigVersion = -1;
@@ -49076,6 +49636,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
49076
49636
  bridge: deps.manageScheduledTaskSessions ? primaryBridge : void 0,
49077
49637
  getRuntime: /* @__PURE__ */ __name(() => workspaceRegistry.primaryEntry.state === "active" ? workspaceRegistry.primaryEntry.current?.runtime : void 0, "getRuntime"),
49078
49638
  cleanupSession,
49639
+ workspaceRegistry,
49079
49640
  channelDeliveryAuthorizations: deps.channelDeliveryAuthorizations
49080
49641
  });
49081
49642
  registerGoalsRoutes(app, {
@@ -49140,7 +49701,6 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
49140
49701
  }, "rehydrateWorkspace");
49141
49702
  const keepaliveStops = /* @__PURE__ */ new Map();
49142
49703
  const startKeepaliveForWorkspace = /* @__PURE__ */ __name((runtime) => {
49143
- if (runtime.provenance === "live-conversation") return;
49144
49704
  const trusted = runtime.primary ? isPrimaryWorkspaceTrusted() : runtime.trusted;
49145
49705
  if (!trusted) return;
49146
49706
  if (keepaliveStops.has(runtime.workspaceCwd)) return;