@qwen-code/qwen-code 0.23.0 → 0.23.1-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (453) hide show
  1. package/bundled/new-app/SKILL.md +1 -1
  2. package/bundled/qc-helper/docs/configuration/auth.md +84 -12
  3. package/bundled/qc-helper/docs/configuration/settings.md +76 -74
  4. package/bundled/qc-helper/docs/features/arena.md +15 -20
  5. package/bundled/qc-helper/docs/features/channels/overview.md +7 -2
  6. package/bundled/qc-helper/docs/features/code-review.md +22 -19
  7. package/bundled/qc-helper/docs/features/commands.md +51 -10
  8. package/bundled/qc-helper/docs/features/followup-suggestions.md +1 -1
  9. package/bundled/qc-helper/docs/features/goals.md +8 -0
  10. package/bundled/qc-helper/docs/features/headless.md +2 -2
  11. package/bundled/qc-helper/docs/features/hooks.md +19 -19
  12. package/bundled/qc-helper/docs/features/output-styles.md +35 -2
  13. package/bundled/qc-helper/docs/qwen-serve.md +67 -52
  14. package/bundled/qc-helper/docs/reference/keyboard-shortcuts.md +3 -1
  15. package/bundled/qc-helper/docs/support/troubleshooting.md +3 -3
  16. package/bundled/review/SKILL.md +45 -41
  17. package/bundled/review/references/aone.md +1 -1
  18. package/bundled/review/references/posting.md +1 -1
  19. package/bundled/workflow-creator/SKILL.md +48 -0
  20. package/bundled/zvec-grep-install/SKILL.md +57 -0
  21. package/chunks/MaxSizedBox-5ARLO5PR.js +116 -0
  22. package/chunks/{StandaloneSessionPicker-QUMO4LLQ.js → StandaloneSessionPicker-T6B322CB.js} +87 -82
  23. package/chunks/{acp-startup-profiler-M4X5F3VK.js → acp-startup-profiler-6ULXXQMS.js} +2 -2
  24. package/chunks/{acpAgent-2GTFCIEP.js → acpAgent-WTDEY5KD.js} +1041 -364
  25. package/chunks/{agent-XKF5SZWU.js → agent-NXPUXEVZ.js} +46 -43
  26. package/chunks/agent-headless-QQZTWOKO.js +88 -0
  27. package/chunks/{anthropicContentGenerator-L76MR5OR.js → anthropicContentGenerator-6XDHXIII.js} +16 -9
  28. package/chunks/{artifact-tool-MYCL2QCS.js → artifact-tool-DFVVJXL2.js} +3 -3
  29. package/chunks/askUserQuestion-GF7VQ44M.js +14 -0
  30. package/chunks/bridge-OHY5OGOZ.js +123 -0
  31. package/chunks/{ca-BNU7YNDE.js → ca-KC2AISNS.js} +1 -0
  32. package/chunks/{channel-management-service-4MTCEGJB.js → channel-management-service-ZDDG3G5S.js} +4 -4
  33. package/chunks/channel-settings-store-7BJAS2SU.js +126 -0
  34. package/chunks/{channel-worker-group-47F4ISUZ.js → channel-worker-group-2ISMRENV.js} +6 -6
  35. package/chunks/{channel-worker-manager-I5Y44GYR.js → channel-worker-manager-VSRPVPRH.js} +6 -6
  36. package/chunks/{channel-worker-supervisor-6VCLUXFE.js → channel-worker-supervisor-SRJBK72Z.js} +4 -4
  37. package/chunks/{chunk-5RTTI4GE.js → chunk-2RYWGYB3.js} +4 -3
  38. package/chunks/{chunk-FUO5V5KI.js → chunk-2UWQX4FP.js} +2 -2
  39. package/chunks/{chunk-L26ONV2Y.js → chunk-2WGJG2KW.js} +9 -8
  40. package/chunks/{chunk-JHN7UIDW.js → chunk-2XRE4KE4.js} +1 -1
  41. package/chunks/chunk-32CM56LO.js +20 -0
  42. package/chunks/{chunk-SI7WDR3U.js → chunk-32YDNYXP.js} +129 -14
  43. package/chunks/{chunk-ZHO2CW6D.js → chunk-3CZ2BQV6.js} +1 -1
  44. package/chunks/{chunk-FD5SJOWT.js → chunk-3K456UJF.js} +9 -4
  45. package/chunks/{chunk-5M6IDOMF.js → chunk-3K65MUKD.js} +105 -0
  46. package/chunks/chunk-3UMWOKJC.js +78 -0
  47. package/chunks/{chunk-UM2FFKXN.js → chunk-43JNQAHO.js} +3 -3
  48. package/chunks/{chunk-KM3XVTMO.js → chunk-43NOB5NM.js} +112 -12
  49. package/chunks/{chunk-G5PBOQWI.js → chunk-47BZVBTE.js} +3 -3
  50. package/chunks/{chunk-32LU3APX.js → chunk-4F2QRVW6.js} +1 -1
  51. package/chunks/{chunk-KMU3ZHH4.js → chunk-4HC4DYKN.js} +2 -2
  52. package/chunks/{chunk-22UH7VTP.js → chunk-4HOEU2OR.js} +1 -1
  53. package/chunks/{chunk-NXKOVOM5.js → chunk-4IQKBLTQ.js} +15 -9
  54. package/chunks/{chunk-M4KFODIP.js → chunk-4JAGXZR3.js} +1 -1
  55. package/chunks/{chunk-PDAKFU7M.js → chunk-4LIPOIXS.js} +1 -1
  56. package/chunks/{chunk-LEPCWS5A.js → chunk-4MCY33Y2.js} +3 -3
  57. package/chunks/{chunk-U6D2PPMN.js → chunk-4VUVBN3Y.js} +1 -1
  58. package/chunks/{chunk-37JFWFCD.js → chunk-4VZCORNT.js} +1 -1
  59. package/chunks/{daemon-RKDGBFLK.js → chunk-537SQ2AI.js} +2216 -1721
  60. package/chunks/{chunk-VNAYZAFX.js → chunk-54TF2ZIQ.js} +4 -4
  61. package/chunks/{chunk-OKTNXDVO.js → chunk-565U2ANU.js} +1 -1
  62. package/chunks/chunk-5ETULJLP.js +74 -0
  63. package/chunks/{chunk-ADYN7P2Y.js → chunk-5JLQWQK6.js} +8 -6
  64. package/chunks/{chunk-BFY33IB4.js → chunk-5MTARK4Y.js} +7 -7
  65. package/chunks/{chunk-BJXCYUGM.js → chunk-5YY5MZT6.js} +1 -1
  66. package/chunks/{chunk-4PSDSCW3.js → chunk-64MQTIX7.js} +3 -3
  67. package/chunks/{chunk-54C6PIGT.js → chunk-6UIACMGH.js} +3 -3
  68. package/chunks/{chunk-ALUYNJPM.js → chunk-7BZS4ZDV.js} +1362 -1140
  69. package/chunks/{chunk-LB3WQQJK.js → chunk-7OCIQNKX.js} +2 -2
  70. package/chunks/{chunk-QKDNS6FU.js → chunk-7VEYUF3N.js} +13 -2
  71. package/chunks/{chunk-AZJLY2XZ.js → chunk-AHBLRVD5.js} +5 -5
  72. package/chunks/{chunk-VWTSRH6C.js → chunk-AQ5NAGWI.js} +89 -17
  73. package/chunks/{chunk-MOF6VZN2.js → chunk-AXPOOQAW.js} +2 -2
  74. package/chunks/{chunk-CVX63TFJ.js → chunk-B44JBZBB.js} +3 -3
  75. package/chunks/{chunk-AI35S34R.js → chunk-B54PFQS5.js} +3 -3
  76. package/chunks/{chunk-373DQUVA.js → chunk-BF3RUIVP.js} +5 -4
  77. package/chunks/{chunk-RJUVTJEZ.js → chunk-BKNY7PDI.js} +1 -1
  78. package/chunks/{chunk-UKYXYWI2.js → chunk-BUQN5LTI.js} +2 -2
  79. package/chunks/{chunk-O5CD7T4T.js → chunk-BW4333PP.js} +0 -95
  80. package/chunks/{chunk-UPFRILIL.js → chunk-CWNC7M73.js} +2 -2
  81. package/chunks/{chunk-3L724BJ5.js → chunk-CZACBHAW.js} +6 -6
  82. package/chunks/{chunk-EBDGRBZX.js → chunk-D4CU6DKR.js} +6 -6
  83. package/chunks/{chunk-G7HBEEX7.js → chunk-D6PIMKY3.js} +9 -9
  84. package/chunks/{chunk-ENYUKMFK.js → chunk-DJXSOEFB.js} +1 -1
  85. package/chunks/{chunk-C2VWOXHS.js → chunk-DNPHKA72.js} +8 -8
  86. package/chunks/{chunk-UUASLXHW.js → chunk-E4L5BM2B.js} +5 -5
  87. package/chunks/{chunk-HT5S5TRQ.js → chunk-EDIDYZBT.js} +4 -11
  88. package/chunks/{chunk-5H5S4UY5.js → chunk-EFT7OMDN.js} +1 -1
  89. package/chunks/{chunk-GB4UKWY5.js → chunk-EJNYBDYC.js} +2 -2
  90. package/chunks/{chunk-NQ4L2CMD.js → chunk-ER273QE6.js} +53 -9
  91. package/chunks/{chunk-RKW36UWC.js → chunk-EWNKP4V4.js} +1 -1
  92. package/chunks/{chunk-UJ4DUYIH.js → chunk-F53KKZUD.js} +2 -2
  93. package/chunks/{chunk-EFTPIZIC.js → chunk-FDOGGKAA.js} +21 -0
  94. package/chunks/{chunk-AQ37AY7B.js → chunk-FKJM6JKY.js} +5 -0
  95. package/chunks/{chunk-KEVYJSI4.js → chunk-G34YLYCS.js} +13 -13
  96. package/chunks/{chunk-P6UIF2OW.js → chunk-GCFZ2LAX.js} +195 -10
  97. package/chunks/{chunk-VGHZT6JR.js → chunk-GELRJXE2.js} +1 -1
  98. package/chunks/{chunk-ZDFQGHZH.js → chunk-GMNLYQOS.js} +1 -1
  99. package/chunks/{chunk-KOGW3YWJ.js → chunk-GVVCLL2P.js} +12 -12
  100. package/chunks/{chunk-OSSTATJF.js → chunk-GXZHYPHZ.js} +428 -30
  101. package/chunks/{chunk-IPATA3T2.js → chunk-GZWW2QWR.js} +2 -2
  102. package/chunks/{chunk-C4TIXFDZ.js → chunk-H3UDNQLO.js} +6 -4
  103. package/chunks/chunk-HD7O6WLV.js +18 -0
  104. package/chunks/{chunk-4UANMABT.js → chunk-HFTB354P.js} +259 -49
  105. package/chunks/{chunk-LOBDDFYK.js → chunk-HJ34U5J4.js} +5 -5
  106. package/chunks/{chunk-M4LBBSVP.js → chunk-HY3DXYZK.js} +2 -2
  107. package/chunks/{chunk-4F7GQGXB.js → chunk-I72PHOKL.js} +1451 -415
  108. package/chunks/{chunk-YPWZTR7F.js → chunk-IFD3BTEA.js} +3 -3
  109. package/chunks/{chunk-EWRW2WQC.js → chunk-IKLFS6SC.js} +5 -5
  110. package/chunks/{chunk-VPSIC437.js → chunk-IQN2CCIE.js} +66 -6
  111. package/chunks/{chunk-F7NF2IOE.js → chunk-IXSGOSEG.js} +7 -7
  112. package/chunks/{chunk-ODZF64DM.js → chunk-IZ2U57NY.js} +1 -1
  113. package/chunks/{chunk-4BGDFKQE.js → chunk-J3O5I5ZD.js} +24 -7
  114. package/chunks/{chunk-DYTW3QVG.js → chunk-J6MB5ZHZ.js} +1 -1
  115. package/chunks/{chunk-HJBHMANB.js → chunk-JBTZUFR4.js} +11 -8
  116. package/chunks/{chunk-SRF4KTAG.js → chunk-JLWFGYXU.js} +4 -4
  117. package/chunks/{chunk-SX2QIMJV.js → chunk-JOPC3FND.js} +5 -5
  118. package/chunks/chunk-JPEAQJNS.js +2142 -0
  119. package/chunks/{chunk-ZTPGUFQV.js → chunk-JRYL3T2O.js} +24 -5
  120. package/chunks/{chunk-GXUTFQXK.js → chunk-KE3Q4JMY.js} +4 -4
  121. package/chunks/{chunk-LKODFJRD.js → chunk-KFFCDLKV.js} +1 -1
  122. package/chunks/{chunk-4M24B5J5.js → chunk-KJJPJYHI.js} +79 -30
  123. package/chunks/chunk-KK2GZGBK.js +21080 -0
  124. package/chunks/{chunk-64QH2UC6.js → chunk-KPXRFTT7.js} +12 -1
  125. package/chunks/{chunk-JZWOCUZ3.js → chunk-L4R7BCVV.js} +1 -1
  126. package/chunks/{chunk-IG4W5SJR.js → chunk-LDS57224.js} +3 -3
  127. package/chunks/{chunk-UAKRDON5.js → chunk-LK7S2D6V.js} +4 -4
  128. package/chunks/{chunk-4HVH57J3.js → chunk-LMJQSPWB.js} +21 -6
  129. package/chunks/{chunk-ANVG3BVV.js → chunk-LNYV4GXX.js} +13 -3
  130. package/chunks/{chunk-RM4WT2XB.js → chunk-LPBQODMR.js} +4 -4
  131. package/chunks/{chunk-XEAAO654.js → chunk-M3JGHRMQ.js} +1 -1
  132. package/chunks/{chunk-AMDSOFFV.js → chunk-MATEIJZF.js} +1 -0
  133. package/chunks/{chunk-LHBNR6EU.js → chunk-MNEYUNOE.js} +2 -2
  134. package/chunks/{chunk-I4NRYS6A.js → chunk-MUZCSTOO.js} +11 -11
  135. package/chunks/{chunk-I5N4EAS6.js → chunk-MWHY26G3.js} +1 -1
  136. package/chunks/{chunk-7XL4WRXM.js → chunk-N6VQ37ZZ.js} +2 -2
  137. package/chunks/{chunk-AHYTURFB.js → chunk-N7EYO2E7.js} +1 -1
  138. package/chunks/{chunk-LU77UT4D.js → chunk-N7VURC4O.js} +24 -26
  139. package/chunks/{chunk-DSX7KQPM.js → chunk-NAKALAL4.js} +227 -29
  140. package/chunks/{chunk-QQD2GART.js → chunk-NGX4NUNP.js} +3 -3
  141. package/chunks/{chunk-2M3EWQNG.js → chunk-NUQFUXOG.js} +17 -1
  142. package/chunks/{chunk-E4JNFXNI.js → chunk-NXWYCSPL.js} +3 -3
  143. package/chunks/{chunk-6A2D4QSO.js → chunk-O2GG7H4C.js} +4 -4
  144. package/chunks/{chunk-ZKFTS3OV.js → chunk-O45WBTNS.js} +6 -6
  145. package/chunks/{chunk-KGV55H53.js → chunk-OECNP26L.js} +1 -1
  146. package/chunks/{chunk-S6H3ELPG.js → chunk-P4RUUG64.js} +1 -1
  147. package/chunks/{chunk-GH2S4GD5.js → chunk-P5LDR7FI.js} +21 -68
  148. package/chunks/{chunk-RN3YGDCA.js → chunk-P6LATTDG.js} +4 -4
  149. package/chunks/{chunk-WP4AX3XD.js → chunk-PTFFWTTO.js} +3 -3
  150. package/chunks/{chunk-DTVQSSNM.js → chunk-PZUOHCWI.js} +3 -3
  151. package/chunks/{chunk-VYIUNFEA.js → chunk-PZV2FASB.js} +3 -3
  152. package/chunks/{chunk-XLXAZLDR.js → chunk-Q2SAQTEJ.js} +1 -1
  153. package/chunks/{chunk-47RYEQW5.js → chunk-QMFOYPGV.js} +2 -2
  154. package/chunks/{chunk-SULZPKTA.js → chunk-QSC5YOEC.js} +3 -3
  155. package/chunks/{chunk-F33GFWPR.js → chunk-QWZOOIR3.js} +58 -18
  156. package/chunks/{chunk-H43PSPYS.js → chunk-R355CUNQ.js} +4 -4
  157. package/chunks/{chunk-DQCKVAF5.js → chunk-RDKXZ2LS.js} +3 -3
  158. package/chunks/{chunk-7JMGTOH7.js → chunk-RPBMP6BN.js} +21 -1
  159. package/chunks/{chunk-5Q5RC2WE.js → chunk-RVNS7NWN.js} +2 -2
  160. package/chunks/{chunk-7RB56BRJ.js → chunk-SAZS4IWW.js} +6 -4
  161. package/chunks/{chunk-5EIOJGCR.js → chunk-SFMCYMVF.js} +4 -4
  162. package/chunks/{chunk-TMKTOTMQ.js → chunk-SN5FV4FY.js} +5 -5
  163. package/chunks/{chunk-QJGYU5PG.js → chunk-TDP7UULF.js} +1 -1
  164. package/chunks/{chunk-EIJT2PQ6.js → chunk-TIGXX4PA.js} +2 -2
  165. package/chunks/{chunk-PCRBLMIN.js → chunk-TMWB67LS.js} +21 -3
  166. package/chunks/{chunk-JUARRUMA.js → chunk-UEZOXZNI.js} +1358 -646
  167. package/chunks/{chunk-KFN2IZYR.js → chunk-UKADFFL2.js} +3 -3
  168. package/chunks/{chunk-TJYRTS4S.js → chunk-UKKYOIVT.js} +2 -2
  169. package/chunks/{chunk-EVFDRBUM.js → chunk-URSCX7S7.js} +12 -7
  170. package/chunks/{chunk-U4DJ5XB3.js → chunk-VDXYYVCD.js} +269 -70
  171. package/chunks/{chunk-4LIFGNI4.js → chunk-VEFRT7NX.js} +1 -1
  172. package/chunks/chunk-VFFQAOPR.js +18 -0
  173. package/chunks/{chunk-3AKCBZVW.js → chunk-VU7O7CGQ.js} +3 -3
  174. package/chunks/{chunk-RAFQIHN2.js → chunk-VUSSAGKI.js} +76 -5
  175. package/chunks/{chunk-TQHPVKO6.js → chunk-VY6UVU7G.js} +6 -6
  176. package/chunks/{chunk-S2T7H5MI.js → chunk-W4LL5RZO.js} +1 -1
  177. package/chunks/{chunk-ZGCKTAL5.js → chunk-WEXA2DNG.js} +2 -0
  178. package/chunks/{chunk-NVVJTUSL.js → chunk-WR3SH3EY.js} +136 -85
  179. package/chunks/{chunk-JR42V4UY.js → chunk-WTW36TJ3.js} +1 -1
  180. package/chunks/{chunk-TSZSGQ3N.js → chunk-WXC6OAWD.js} +1 -1
  181. package/chunks/{chunk-ZVP4PWBU.js → chunk-X35VIWWJ.js} +1 -1
  182. package/chunks/{chunk-KHP66DFN.js → chunk-XFFRI3WM.js} +1 -1
  183. package/chunks/{chunk-EIY7SUPZ.js → chunk-XHGGYCTA.js} +1 -1
  184. package/chunks/{chunk-BA4WJC4L.js → chunk-XOVVCGZX.js} +1 -1
  185. package/chunks/{chunk-VBWD6C27.js → chunk-XUSOYE2I.js} +1 -1
  186. package/chunks/{chunk-NUHOLAQ6.js → chunk-XWJFDJZK.js} +1 -1
  187. package/chunks/{chunk-65HWLGA7.js → chunk-XY3USGFE.js} +3 -3
  188. package/chunks/{chunk-STCVJXQB.js → chunk-Y3ZKI4RQ.js} +56 -26
  189. package/chunks/{chunk-QAK5475D.js → chunk-Y53DG2HA.js} +1 -1
  190. package/chunks/{chunk-3JQZVCBI.js → chunk-YCDL2SAS.js} +2 -2
  191. package/chunks/{chunk-NSUKQ4DN.js → chunk-YHDGABDC.js} +3 -3
  192. package/chunks/{chunk-FRICLXCZ.js → chunk-Z6WZPXQH.js} +3 -3
  193. package/chunks/{chunk-EAHOJF6V.js → chunk-ZAFYHRVY.js} +12 -0
  194. package/chunks/{chunk-MP6YZ4RK.js → chunk-ZAZ3NFL6.js} +852 -309
  195. package/chunks/{chunk-7TBU7PU2.js → chunk-ZSTCM3MX.js} +1 -1
  196. package/chunks/{chunk-NRL5CUZT.js → chunk-ZTAVGFKA.js} +1 -1
  197. package/chunks/config-utils-QXDOTXEQ.js +119 -0
  198. package/chunks/contextCommand-RN4KARWC.js +112 -0
  199. package/chunks/{core-runtime-B4UKKIAQ.js → core-runtime-NAZCOKHB.js} +63 -58
  200. package/chunks/{create-sub-session-NJ24B4US.js → create-sub-session-BCSM4WKB.js} +61 -56
  201. package/chunks/{create-sub-session-LUPWEUHR.js → create-sub-session-BQ3SE4TX.js} +3 -3
  202. package/chunks/{cron-create-CRSPET3H.js → cron-create-D6HQ7I7I.js} +4 -4
  203. package/chunks/{cron-delete-DB77SZTU.js → cron-delete-KK3D2SQV.js} +4 -4
  204. package/chunks/{cron-list-U2JNYWV6.js → cron-list-VBF3IZMF.js} +4 -4
  205. package/chunks/daemon-LCUELM6E.js +191 -0
  206. package/chunks/{daemon-git-worktree-guard-O2HPOBAB.js → daemon-git-worktree-guard-3K5CAU36.js} +62 -57
  207. package/chunks/daemon-status-provider-4X3ZZQTZ.js +122 -0
  208. package/chunks/daemon-trust-policy-R45CFUJA.js +118 -0
  209. package/chunks/{daemon-trust-policy-monitor-JL7F4Y4Q.js → daemon-trust-policy-monitor-DSSFCO3K.js} +69 -64
  210. package/chunks/{de-T4BLOKEC.js → de-UU2YTO37.js} +1 -0
  211. package/chunks/deferred-core-runtime-UO2M6WYI.js +120 -0
  212. package/chunks/{display-image-73C7XNRK.js → display-image-EVVTBVYE.js} +6 -6
  213. package/chunks/{dist-EDHQIBYD.js → dist-3T5MDUHP.js} +62 -20
  214. package/chunks/{dist-ZCJLKQSP.js → dist-AFH3BMZZ.js} +18 -10
  215. package/chunks/{dist-LXFYIJNG.js → dist-MK5PPBRF.js} +40 -9
  216. package/chunks/{dist-GT64AAUR.js → dist-PH5RSTEA.js} +56 -20
  217. package/chunks/{dist-62OZ7QXB.js → dist-QUU7TVE3.js} +35 -12
  218. package/chunks/{dist-JVXT4VUJ.js → dist-R5Y34V6T.js} +11 -2
  219. package/chunks/{dist-L6URO6CK.js → dist-SB2XRXZA.js} +5 -1
  220. package/chunks/{dist-QAF5DO3Y.js → dist-SIHF5MU2.js} +326 -131
  221. package/chunks/{dist-PDGNRVPY.js → dist-UVHW2U56.js} +20 -1
  222. package/chunks/earlyInputCapture-BXP7V2P3.js +22 -0
  223. package/chunks/{edit-SUGXY63Y.js → edit-VNBCTRWP.js} +48 -44
  224. package/chunks/{en-2RATMNX7.js → en-JMR535HP.js} +3 -1
  225. package/chunks/{enter-worktree-B6USKSIK.js → enter-worktree-CEVK7MQ2.js} +7 -7
  226. package/chunks/{enterPlanMode-MDX4RVVL.js → enterPlanMode-4KMZMUIA.js} +48 -45
  227. package/chunks/environment-S2HYQDON.js +135 -0
  228. package/chunks/errors-DAAN5TL7.js +119 -0
  229. package/chunks/{exit-worktree-DLQ73SJH.js → exit-worktree-D3YE6MUN.js} +7 -7
  230. package/chunks/exitPlanMode-HR36HG3D.js +86 -0
  231. package/chunks/{fast-path-Y73R42LV.js → fast-path-4IWSW3UV.js} +3 -3
  232. package/chunks/{fast-path-settings-MFUR3IWK.js → fast-path-settings-ISEJPRYE.js} +6 -4
  233. package/chunks/{fr-BGHGYX6A.js → fr-HKNWVXRJ.js} +1 -0
  234. package/chunks/{glob-DMGH7EZN.js → glob-IZYB2XH2.js} +46 -43
  235. package/chunks/{goal-tools-3RF3PXCL.js → goal-tools-VGUPKQDJ.js} +46 -43
  236. package/chunks/{grep-AJVLCVXC.js → grep-OUVLNXG7.js} +9 -8
  237. package/chunks/handleAutoUpdate-D56FMDTW.js +115 -0
  238. package/chunks/i18n-BKE5WO6T.js +130 -0
  239. package/chunks/{image-gen-VOIDOHOB.js → image-gen-SHVQ3XID.js} +8 -8
  240. package/chunks/initializer-MS4SGEHF.js +119 -0
  241. package/chunks/installationInfo-542MGC4S.js +113 -0
  242. package/chunks/{ja-G3FTD5XE.js → ja-GJS5RZGU.js} +1 -0
  243. package/chunks/{keychain-token-storage-REZVMJA6.js → keychain-token-storage-NQ5XWIPX.js} +2 -2
  244. package/chunks/list-H6XTKUWL.js +122 -0
  245. package/chunks/{list-agents-SBMONIUK.js → list-agents-ULYBGJXC.js} +6 -6
  246. package/chunks/{llm-K26SUDVK.js → llm-3NUC4EJY.js} +132 -113
  247. package/chunks/{llm-content-generator-TT6EAUD4.js → llm-content-generator-R4NL3OQN.js} +40 -13
  248. package/chunks/loadedSettingsAdapter-3XLKYDVT.js +116 -0
  249. package/chunks/{loggingContentGenerator-EYQBA4M4.js → loggingContentGenerator-ZYSWVNEO.js} +55 -52
  250. package/chunks/{loop-wakeup-QA6SHCZT.js → loop-wakeup-B27BEYRL.js} +5 -5
  251. package/chunks/{lowlight-J2OZNPCA.js → lowlight-BTE423KL.js} +3 -6
  252. package/chunks/{ls-HEJNCEYO.js → ls-3IIMMVKF.js} +5 -4
  253. package/chunks/{lsp-WOQKNZP6.js → lsp-VJAT7XKS.js} +2 -2
  254. package/chunks/{managed-npm-update-HIJTODQT.js → managed-npm-update-L2I53ZAI.js} +62 -57
  255. package/chunks/mcp-4PIXQASW.js +116 -0
  256. package/chunks/{monitor-DKNZQAB2.js → monitor-O2YQTOZZ.js} +50 -46
  257. package/chunks/{node-UETAYMMO.js → node-ISQAFKIS.js} +2 -2
  258. package/chunks/nonInteractiveCli-LV7CDBA2.js +198 -0
  259. package/chunks/{notebook-edit-MGHTRL2D.js → notebook-edit-4RE2ALH4.js} +48 -44
  260. package/chunks/{openaiContentGenerator-ZJIEQ3ZJ.js → openaiContentGenerator-7ND7K5CP.js} +30 -25
  261. package/chunks/pidfile-UFTLQ7NP.js +117 -0
  262. package/chunks/{processUtils-UY3SAJJZ.js → processUtils-3XBB4FYV.js} +2 -2
  263. package/chunks/prompt-terminal-ledger-2QASOGMM.js +111 -0
  264. package/chunks/{pt-D73IFYT7.js → pt-FXMYXEUV.js} +1 -0
  265. package/chunks/{qwenContentGenerator-VI4KATRY.js → qwenContentGenerator-AELTUTH6.js} +52 -49
  266. package/chunks/{qwenOAuth2-7AOCKSOQ.js → qwenOAuth2-BS5D2LYV.js} +7 -7
  267. package/chunks/{read-file-P7F4P7LV.js → read-file-PDWHZPHX.js} +13 -11
  268. package/chunks/{read-mcp-resource-GLAGB6R7.js → read-mcp-resource-YXJZ75UB.js} +2 -2
  269. package/chunks/{record-artifact-SWVR7NSU.js → record-artifact-WJDOV6XU.js} +4 -4
  270. package/chunks/{report-findings-AL5YW3KI.js → report-findings-Q4UACKWR.js} +5 -5
  271. package/chunks/{request-shutdown-5YK4IZ54.js → request-shutdown-2YZ3E3GH.js} +8 -8
  272. package/chunks/resumeHistoryUtils-QRXZEEBA.js +124 -0
  273. package/chunks/ripGrep-KSOOLE6H.js +39 -0
  274. package/chunks/{ru-QMISLKRH.js → ru-RMHURE5U.js} +1 -0
  275. package/chunks/{run-qwen-serve-OGTEEUR2.js → run-qwen-serve-RTAREPT6.js} +84 -70
  276. package/chunks/runtime-ESFSCJRZ.js +154 -0
  277. package/chunks/scheduled-tasks-6ZHRNBH6.js +133 -0
  278. package/chunks/{scheduler-73YXGUGW.js → scheduler-DQI6KV7T.js} +63 -58
  279. package/chunks/{sdk-exporters-http-3JO5TJNU.js → sdk-exporters-http-7R2ARBPV.js} +2 -2
  280. package/chunks/{sdk-impl-HZAUUTHJ.js → sdk-impl-YOLO7LV4.js} +4 -4
  281. package/chunks/{send-message-JC7NJTY6.js → send-message-PQCVSVMN.js} +24 -24
  282. package/chunks/serve-FY7ZEW52.js +124 -0
  283. package/chunks/{server-AOYZVVOM.js → server-KNDY6K5F.js} +1594 -273
  284. package/chunks/{session-UAWFNFGI.js → session-MCEPXAZP.js} +113 -105
  285. package/chunks/session-attachments-root-OLNAE6GF.js +109 -0
  286. package/chunks/{session-pr-refresh-CT2INROL.js → session-pr-refresh-HKJHQQQK.js} +67 -62
  287. package/chunks/{settings-BHRGDASJ.js → settings-VXO4WBMK.js} +68 -63
  288. package/chunks/shell-U263OTES.js +96 -0
  289. package/chunks/{skill-ZGBKNCHQ.js → skill-SDODGBKL.js} +19 -17
  290. package/chunks/skill-settings-YEIA22QJ.js +124 -0
  291. package/chunks/spawnChannel-4WJZVFPP.js +117 -0
  292. package/chunks/standalone-update-ZWVQUO64.js +124 -0
  293. package/chunks/{start-opentui-ui-FZ4USOU7.js → start-opentui-ui-BFYCJQRZ.js} +1199 -190
  294. package/chunks/{startInteractiveUI-E2WQJUOA.js → startInteractiveUI-JYAFCMHL.js} +2977 -2319
  295. package/chunks/{syntheticOutput-HJNZSEHN.js → syntheticOutput-AUAJBNXR.js} +3 -3
  296. package/chunks/{task-create-6RSD54S5.js → task-create-LD5ISM3E.js} +12 -12
  297. package/chunks/{task-list-IQSACPOM.js → task-list-YISJ4RJA.js} +5 -5
  298. package/chunks/{task-stop-HE2LRQNW.js → task-stop-65ZOVATJ.js} +2 -2
  299. package/chunks/{task-update-XAJ2NYOA.js → task-update-AAN4ZVEY.js} +15 -15
  300. package/chunks/{team-create-SOKMYSQU.js → team-create-KU7MABNO.js} +47 -44
  301. package/chunks/{team-delete-NGNNKGMG.js → team-delete-XFRRTJTT.js} +5 -5
  302. package/chunks/{team-plan-approval-U7ZWXYAY.js → team-plan-approval-DPB377A3.js} +46 -43
  303. package/chunks/terminal-image-renderer-WGWRENOF.js +124 -0
  304. package/chunks/theme-manager-GBUFULSO.js +108 -0
  305. package/chunks/{todoWrite-5UTVUXHA.js → todoWrite-G7NT4IFP.js} +5 -5
  306. package/chunks/{tool-search-IAI2RVWT.js → tool-search-6YUXHBPT.js} +19 -17
  307. package/chunks/total-session-admission-54R2JQ5L.js +118 -0
  308. package/chunks/trustedFolders-KAJIDJTH.js +128 -0
  309. package/chunks/{update-relaunch-5RWKZAL3.js → update-relaunch-XM4IWBFD.js} +5 -5
  310. package/chunks/updateCheck-W6UZFURI.js +124 -0
  311. package/chunks/useAutoAcceptIndicator-LAWYHY3U.js +126 -0
  312. package/chunks/{validateNonInterActiveAuth-QPFEKATS.js → validateNonInterActiveAuth-7WCKHRN2.js} +109 -101
  313. package/chunks/{version-JKNG7YDH.js → version-3ZU43RJ6.js} +1 -1
  314. package/chunks/{web-fetch-X3AHIIHW.js → web-fetch-QHI2SQL4.js} +16 -14
  315. package/chunks/{web-search-K2FMOGS5.js → web-search-3KZZKWNY.js} +9 -8
  316. package/chunks/{workflow-TOLPAK5G.js → workflow-HRW7Y2X4.js} +330 -1667
  317. package/chunks/workspace-providers-status-KTGCWCPC.js +120 -0
  318. package/chunks/{workspace-registration-store-KQWVVW4Y.js → workspace-registration-store-LHLPPWNE.js} +1 -1
  319. package/chunks/workspace-registry-X34MLN52.js +127 -0
  320. package/chunks/workspace-runtime-coordinator-U4PW4P7K.js +128 -0
  321. package/chunks/workspace-service-KD7BCGYL.js +132 -0
  322. package/chunks/workspace-skills-status-YJGO6Y3T.js +119 -0
  323. package/chunks/{workspace-trust-reconciler-IBDFQBQS.js → workspace-trust-reconciler-EUYHISCH.js} +74 -69
  324. package/chunks/write-file-EBSB34NJ.js +91 -0
  325. package/chunks/{zh-25DF7OGK.js → zh-DVFYHRK5.js} +3 -1
  326. package/chunks/{zh-TW-5EDMZVGK.js → zh-TW-W2GNP2IU.js} +3 -1
  327. package/chunks/{zoom-image-IFXSN74N.js → zoom-image-UJ5VKWKP.js} +13 -11
  328. package/cli.js +13 -13
  329. package/export-transcript-document.js +617 -0
  330. package/locales/ca.js +1 -0
  331. package/locales/de.js +1 -0
  332. package/locales/en.js +5 -2
  333. package/locales/fr.js +1 -0
  334. package/locales/ja.js +1 -0
  335. package/locales/pt.js +1 -0
  336. package/locales/ru.js +1 -0
  337. package/locales/zh-TW.js +5 -2
  338. package/locales/zh.js +5 -2
  339. package/package.json +5 -4
  340. package/web-shell/assets/{abnfDiagram-VCTEODGH-Cxf7xE_Z.js → abnfDiagram-VCTEODGH-Dur--luQ.js} +1 -1
  341. package/web-shell/assets/{arc-ESi1eNkE.js → arc-tYLobxFi.js} +1 -1
  342. package/web-shell/assets/{architectureDiagram-5GKGNRK7-D9l7-bDo.js → architectureDiagram-5GKGNRK7-IG6aXD03.js} +1 -1
  343. package/web-shell/assets/{blockDiagram-NRAW4CY4-Bc8DEasw.js → blockDiagram-NRAW4CY4-C6eBSkfA.js} +1 -1
  344. package/web-shell/assets/{c4Diagram-UCG6FXSJ-Dimb2Hmh.js → c4Diagram-UCG6FXSJ-BrX3HJqB.js} +1 -1
  345. package/web-shell/assets/channel-uEkvKckd.js +1 -0
  346. package/web-shell/assets/{chunk-2Q5K7J3B-jVDmOpAQ.js → chunk-2Q5K7J3B-B3fcJ8ee.js} +1 -1
  347. package/web-shell/assets/{chunk-5VM5RSS4-DbG_SwdB.js → chunk-5VM5RSS4-CeC90yKM.js} +1 -1
  348. package/web-shell/assets/{chunk-F27PBJKO-QEc4cY1v.js → chunk-F27PBJKO-CW44RVki.js} +1 -1
  349. package/web-shell/assets/{chunk-G27WJ6UU-iJ36lQ3X.js → chunk-G27WJ6UU-D1PAMukD.js} +1 -1
  350. package/web-shell/assets/{chunk-JWPE2WC7-DuArnVtF.js → chunk-JWPE2WC7-Dt3Y2Fvx.js} +1 -1
  351. package/web-shell/assets/{chunk-LCL6LL3I-DxOf1zwL.js → chunk-LCL6LL3I-CZHw2lLI.js} +1 -1
  352. package/web-shell/assets/{chunk-POPQ4Y6H-lVLu9Ild.js → chunk-POPQ4Y6H-ysNAdTGx.js} +1 -1
  353. package/web-shell/assets/{chunk-SVP7TREG-C6XYlIer.js → chunk-SVP7TREG-BdNXW6YQ.js} +1 -1
  354. package/web-shell/assets/{chunk-XXDRQBXY-CiG2j2Ji.js → chunk-XXDRQBXY-DgqQ9UA8.js} +1 -1
  355. package/web-shell/assets/classDiagram-DTDB5LWJ-DuPsnhWS.js +1 -0
  356. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DuPsnhWS.js +1 -0
  357. package/web-shell/assets/{cose-bilkent-JH36ORCC-DGVHMMVm.js → cose-bilkent-JH36ORCC-BILImXzJ.js} +1 -1
  358. package/web-shell/assets/{cynefin-OW5HDTMX-D6cgpCnH.js → cynefin-OW5HDTMX-DR88Pund.js} +1 -1
  359. package/web-shell/assets/{cynefinDiagram-5FMLGOSQ-BKv4Z-UX.js → cynefinDiagram-5FMLGOSQ-BYFbfkA6.js} +1 -1
  360. package/web-shell/assets/{dagre-3AP2YEHR-B4ABMIG-.js → dagre-3AP2YEHR-rfpyc6sX.js} +1 -1
  361. package/web-shell/assets/{diagram-S7CK7UJ4-DgCkp_Lm.js → diagram-S7CK7UJ4-BJxLmEwH.js} +1 -1
  362. package/web-shell/assets/{diagram-UQ7AKVKN-FG0FNokz.js → diagram-UQ7AKVKN-H34xm7k3.js} +1 -1
  363. package/web-shell/assets/{diagram-VSXAHHWV-JgkP9qg-.js → diagram-VSXAHHWV-HYxhwNLx.js} +1 -1
  364. package/web-shell/assets/{diagram-VX7I27RA-ADh2x83l.js → diagram-VX7I27RA-BJazso8F.js} +1 -1
  365. package/web-shell/assets/{diagram-Z3DM3KII-yXqoYF1J.js → diagram-Z3DM3KII-Clje1aNy.js} +1 -1
  366. package/web-shell/assets/{ebnfDiagram-PWID7BFC-Duk83Ek_.js → ebnfDiagram-PWID7BFC-M93YBkFh.js} +1 -1
  367. package/web-shell/assets/{erDiagram-SSCWMZ5O-DMdvxySG.js → erDiagram-SSCWMZ5O-DY8XzSHU.js} +1 -1
  368. package/web-shell/assets/{flowDiagram-A5DVABFB-DHjVgSji.js → flowDiagram-A5DVABFB-CE6Aylcq.js} +1 -1
  369. package/web-shell/assets/{ganttDiagram-EL5Y4UJY-DMM9DkCE.js → ganttDiagram-EL5Y4UJY-DI-5LL22.js} +1 -1
  370. package/web-shell/assets/{gitGraphDiagram-WWUBYQGX-t_ug9vO8.js → gitGraphDiagram-WWUBYQGX-C7BZWElk.js} +1 -1
  371. package/web-shell/assets/index-CVyqwW7y.js +2142 -0
  372. package/web-shell/assets/{index-zqvnpGHv.js → index-DclFHns9.js} +1 -1
  373. package/web-shell/assets/index-FO7JXPnH.css +36 -0
  374. package/web-shell/assets/{infoDiagram-RXCK75RN-eT1fANNm.js → infoDiagram-RXCK75RN-CGUSy4Pc.js} +1 -1
  375. package/web-shell/assets/{ishikawaDiagram-5VMMS53U-k3evzZNn.js → ishikawaDiagram-5VMMS53U-B5BVks9q.js} +1 -1
  376. package/web-shell/assets/{journeyDiagram-EYS64GPL-CGim3EAi.js → journeyDiagram-EYS64GPL-CFh6Tf7h.js} +1 -1
  377. package/web-shell/assets/{kanban-definition-3QL26DDD-WHfJo-22.js → kanban-definition-3QL26DDD-B7TlxP7c.js} +1 -1
  378. package/web-shell/assets/{layout-DkqIaFlJ.js → layout-Br_pZq2Q.js} +1 -1
  379. package/web-shell/assets/{linear-Bdkd3mCz.js → linear-BVlP6fte.js} +1 -1
  380. package/web-shell/assets/{mermaid.core-CGw0LkT_.js → mermaid.core-TrcYWoiF.js} +6 -6
  381. package/web-shell/assets/{mindmap-definition-FBJOCRG2-C9V4rBvo.js → mindmap-definition-FBJOCRG2-BJ4LzqjZ.js} +1 -1
  382. package/web-shell/assets/{pegDiagram-XKGWAZYB-CwoI2T5G.js → pegDiagram-XKGWAZYB-1b_MxlOl.js} +1 -1
  383. package/web-shell/assets/{pieDiagram-E7YTZNPT-DaTmBmPG.js → pieDiagram-E7YTZNPT-B8zl0YhY.js} +1 -1
  384. package/web-shell/assets/{quadrantDiagram-AXDQQJYC-plh6MyGI.js → quadrantDiagram-AXDQQJYC-CIZO8ukl.js} +1 -1
  385. package/web-shell/assets/{railroadDiagram-O6MQD6OU-D_b-S0iK.js → railroadDiagram-O6MQD6OU-CepHSbCj.js} +1 -1
  386. package/web-shell/assets/{requirementDiagram-EFPCY7ZU-zUzTN7VE.js → requirementDiagram-EFPCY7ZU-BCgxkcSW.js} +1 -1
  387. package/web-shell/assets/{sankeyDiagram-P5KCCOFB-m6AhoD0l.js → sankeyDiagram-P5KCCOFB-CE5CcoMM.js} +1 -1
  388. package/web-shell/assets/{sequenceDiagram-WJ2MYXX4-Cwhzsine.js → sequenceDiagram-WJ2MYXX4-DvgHi-d5.js} +1 -1
  389. package/web-shell/assets/{sizeCapture-X5ZJPWSS-CcZuKIae.js → sizeCapture-X5ZJPWSS-T-fAsCPX.js} +1 -1
  390. package/web-shell/assets/{stateDiagram-HBIQ2CUA-CFoiJwD_.js → stateDiagram-HBIQ2CUA-DYHaul-5.js} +1 -1
  391. package/web-shell/assets/stateDiagram-v2-4QOOHH4V-BcYho9a4.js +1 -0
  392. package/web-shell/assets/{swimlanes-XN3QIQJK-CgS9hcaV.js → swimlanes-XN3QIQJK-Dbz3Qiej.js} +1 -1
  393. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-D6HsOIgX.js +8 -0
  394. package/web-shell/assets/{timeline-definition-24CTP7MA-Dzzc05t9.js → timeline-definition-24CTP7MA-9NVRts3N.js} +1 -1
  395. package/web-shell/assets/{vennDiagram-4TSXK5OY-DemK0f7Y.js → vennDiagram-4TSXK5OY-C7cb7vnH.js} +1 -1
  396. package/web-shell/assets/{wardleyDiagram-VM6X3IG4-CquLxtMr.js → wardleyDiagram-VM6X3IG4-CG-8Ddjm.js} +1 -1
  397. package/web-shell/assets/{xychartDiagram-S5SC5T6Z-BTBKTM5g.js → xychartDiagram-S5SC5T6Z-iGeYAcP4.js} +1 -1
  398. package/web-shell/index.html +2 -2
  399. package/chunks/MaxSizedBox-B3D7545A.js +0 -111
  400. package/chunks/agent-headless-OC2IB55D.js +0 -85
  401. package/chunks/askUserQuestion-THQZMG44.js +0 -322
  402. package/chunks/bridge-IHSBI2YJ.js +0 -118
  403. package/chunks/channel-settings-store-BVKWAI2T.js +0 -121
  404. package/chunks/chunk-I2TMJPCV.js +0 -448
  405. package/chunks/chunk-QI27MKNQ.js +0 -4008
  406. package/chunks/config-utils-LVSYDLHZ.js +0 -114
  407. package/chunks/contextCommand-TZD7UAJK.js +0 -107
  408. package/chunks/daemon-status-provider-GRRVCJFW.js +0 -117
  409. package/chunks/daemon-trust-policy-YJL442BK.js +0 -113
  410. package/chunks/deferred-core-runtime-S32AYVZI.js +0 -115
  411. package/chunks/earlyInputCapture-BBPCIVZG.js +0 -108
  412. package/chunks/environment-VN6RXDVN.js +0 -130
  413. package/chunks/errors-UEY36PIT.js +0 -114
  414. package/chunks/exitPlanMode-EPHIEDAA.js +0 -83
  415. package/chunks/handleAutoUpdate-HVWQT2AU.js +0 -110
  416. package/chunks/i18n-5OR7NTRZ.js +0 -125
  417. package/chunks/initializer-JE5RQSOE.js +0 -114
  418. package/chunks/installationInfo-KO3CCSCK.js +0 -108
  419. package/chunks/list-3IORSFIY.js +0 -117
  420. package/chunks/loadedSettingsAdapter-KLLFZF3M.js +0 -111
  421. package/chunks/mcp-A2UEHETW.js +0 -111
  422. package/chunks/nonInteractiveCli-YA47F2F4.js +0 -190
  423. package/chunks/pidfile-ETHAZNMY.js +0 -112
  424. package/chunks/prompt-terminal-ledger-GZ747VYE.js +0 -106
  425. package/chunks/resumeHistoryUtils-DPZKFW24.js +0 -119
  426. package/chunks/ripGrep-C7LJKUPZ.js +0 -37
  427. package/chunks/runtime-LNBLEMZS.js +0 -149
  428. package/chunks/scheduled-tasks-FLDYZQOF.js +0 -128
  429. package/chunks/serve-3UR2H4CV.js +0 -119
  430. package/chunks/session-attachments-root-ZCGXQQTR.js +0 -104
  431. package/chunks/shell-YHOGC7TO.js +0 -93
  432. package/chunks/skill-settings-AKSP665O.js +0 -119
  433. package/chunks/spawnChannel-N25MBB6F.js +0 -112
  434. package/chunks/standalone-update-XGPWJDRN.js +0 -119
  435. package/chunks/terminal-image-renderer-KKM4OBLO.js +0 -117
  436. package/chunks/theme-manager-GQHF3A7T.js +0 -103
  437. package/chunks/total-session-admission-G4CGCSTG.js +0 -113
  438. package/chunks/trustedFolders-D2I3FDPB.js +0 -123
  439. package/chunks/updateCheck-ZXOQDFEI.js +0 -119
  440. package/chunks/useAutoAcceptIndicator-6EK4QGAH.js +0 -121
  441. package/chunks/workspace-providers-status-PCJK3RC7.js +0 -115
  442. package/chunks/workspace-registry-YNIOB6HJ.js +0 -122
  443. package/chunks/workspace-runtime-coordinator-WG2RNEN7.js +0 -123
  444. package/chunks/workspace-service-G4ZNBOFH.js +0 -127
  445. package/chunks/workspace-skills-status-FMTPPMWC.js +0 -114
  446. package/chunks/write-file-YTLFY2S5.js +0 -88
  447. package/web-shell/assets/channel-B7ohGDil.js +0 -1
  448. package/web-shell/assets/classDiagram-DTDB5LWJ-DdFpqpfD.js +0 -1
  449. package/web-shell/assets/classDiagram-v2-JRS7N3AN-DdFpqpfD.js +0 -1
  450. package/web-shell/assets/index-BGZRqbRo.css +0 -36
  451. package/web-shell/assets/index-DRri_6_x.js +0 -2067
  452. package/web-shell/assets/stateDiagram-v2-4QOOHH4V--H8HdEmk.js +0 -1
  453. package/web-shell/assets/swimlanesDiagram-VK2B7HYN-ShE9OIgf.js +0 -8
@@ -5,7 +5,7 @@ import {
5
5
  openQwenAsrRealtimeStream,
6
6
  openVoiceStream,
7
7
  openVoiceStreamWithRetry
8
- } from "./chunk-XLXAZLDR.js";
8
+ } from "./chunk-Q2SAQTEJ.js";
9
9
  import {
10
10
  GENERATION_MAX_PROMPT_BYTES,
11
11
  MAX_REMEMBER_CONTENT_BYTES,
@@ -20,7 +20,7 @@ import {
20
20
  shouldSuppressRememberErrorDetails,
21
21
  workspaceMemoryFailureCode,
22
22
  workspaceMemoryFailureDiagnostics
23
- } from "./chunk-WP4AX3XD.js";
23
+ } from "./chunk-PTFFWTTO.js";
24
24
  import {
25
25
  SetupGithubError,
26
26
  collectSessionData,
@@ -32,12 +32,13 @@ import {
32
32
  toJson,
33
33
  toJsonl,
34
34
  toMarkdown
35
- } from "./chunk-QI27MKNQ.js";
35
+ } from "./chunk-KK2GZGBK.js";
36
36
  import {
37
37
  OBSERVED_CONTACT_MAX_FRESH_WITHIN_SECONDS,
38
38
  ObservedChannelContactStore
39
- } from "./chunk-XEAAO654.js";
40
- import "./chunk-NRL5CUZT.js";
39
+ } from "./chunk-M3JGHRMQ.js";
40
+ import "./chunk-VFFQAOPR.js";
41
+ import "./chunk-ZTAVGFKA.js";
41
42
  import {
42
43
  escapeAnsiCtrlCodes
43
44
  } from "./chunk-47ECGEJC.js";
@@ -113,8 +114,7 @@ import {
113
114
  singleTokenCredentials,
114
115
  tagListener,
115
116
  unsafeRevealSecret
116
- } from "./chunk-SI7WDR3U.js";
117
- import "./chunk-VGHZT6JR.js";
117
+ } from "./chunk-32YDNYXP.js";
118
118
  import {
119
119
  ConversationDirectoryIdentityError,
120
120
  getConversationDirectoryName,
@@ -123,9 +123,12 @@ import {
123
123
  normalizedInode
124
124
  } from "./chunk-PB7JBAHF.js";
125
125
  import "./chunk-UXEO7E3V.js";
126
+ import {
127
+ createTotalSessionAdmissionController
128
+ } from "./chunk-7IKXTGZT.js";
126
129
  import {
127
130
  assertValidChannelSecretUpdates
128
- } from "./chunk-7RB56BRJ.js";
131
+ } from "./chunk-SAZS4IWW.js";
129
132
  import {
130
133
  AONE_MAX_MR_VIEW_CALLS_PER_RUN,
131
134
  DaemonDrainingError,
@@ -153,7 +156,7 @@ import {
153
156
  runWithWorkspaceRuntimeStorage,
154
157
  searchWorkspaceSessionsForResponse,
155
158
  unarchiveDaemonSessions
156
- } from "./chunk-EVFDRBUM.js";
159
+ } from "./chunk-URSCX7S7.js";
157
160
  import {
158
161
  LIVE_SESSION_SOURCE_PREFIX,
159
162
  isCompatibleLiveSessionSource,
@@ -189,15 +192,28 @@ import {
189
192
  STANDALONE_SESSION_SOURCE_TYPE,
190
193
  isReservedStandaloneSessionSourceType
191
194
  } from "./chunk-N4QWUPDM.js";
195
+ import {
196
+ isServeDebugMode,
197
+ mountWebShellAssets,
198
+ mountWebShellSpaFallback
199
+ } from "./chunk-NFIDVZND.js";
200
+ import {
201
+ require_express
202
+ } from "./chunk-IRKQ4YYX.js";
203
+ import "./chunk-FBX2SDQ4.js";
204
+ import {
205
+ formatHostForAuthority,
206
+ isLoopbackBind
207
+ } from "./chunk-DMEUXLSS.js";
192
208
  import {
193
209
  evaluateDaemonWorkspaceTrust,
194
210
  readDaemonTrustPolicySnapshot
195
- } from "./chunk-YPWZTR7F.js";
211
+ } from "./chunk-IFD3BTEA.js";
196
212
  import {
197
213
  readRecentPromptTerminals,
198
214
  reconcileDanglingPromptTerminals,
199
215
  withPromptTerminals
200
- } from "./chunk-UPFRILIL.js";
216
+ } from "./chunk-CWNC7M73.js";
201
217
  import {
202
218
  WorkspaceGenerationClosedError,
203
219
  createSingleWorkspaceRegistry,
@@ -205,7 +221,7 @@ import {
205
221
  } from "./chunk-QJVZLILI.js";
206
222
  import {
207
223
  sessionAttachmentsRoots
208
- } from "./chunk-NUHOLAQ6.js";
224
+ } from "./chunk-XWJFDJZK.js";
209
225
  import {
210
226
  getWorkspaceRouteContext,
211
227
  isGenerationClosedError,
@@ -228,11 +244,11 @@ import {
228
244
  sendUntrustedWorkspaceResponse,
229
245
  sendWorkspaceRuntimeUnavailable,
230
246
  setWorkspaceRouteContext
231
- } from "./chunk-3L724BJ5.js";
247
+ } from "./chunk-CZACBHAW.js";
232
248
  import {
233
249
  normalizeChannelDelivery,
234
250
  parseChannelDelivery
235
- } from "./chunk-DTVQSSNM.js";
251
+ } from "./chunk-PZUOHCWI.js";
236
252
  import {
237
253
  isValidSessionId,
238
254
  normalizeSessionIdForLookup,
@@ -247,7 +263,13 @@ import {
247
263
  getWorkspaceRuntimeCoordinator,
248
264
  getWorkspaceRuntimeCoordinatorIfSupported,
249
265
  supportsWorkspaceRuntimeLifecycle
250
- } from "./chunk-P6UIF2OW.js";
266
+ } from "./chunk-GCFZ2LAX.js";
267
+ import "./chunk-OIBUG24X.js";
268
+ import {
269
+ MAX_SESSION_RESTORE_TIMEOUT_MS,
270
+ resolveSessionRestoreTimeoutMs,
271
+ restoreRetryAfterSeconds
272
+ } from "./chunk-4JRM2BSM.js";
251
273
  import {
252
274
  EMPTY_WORKSPACE_VOICE_UPDATE_ERROR,
253
275
  MAX_WORKSPACE_SKILL_NAME_LENGTH,
@@ -256,19 +278,21 @@ import {
256
278
  buildWorkspaceVoiceSettingsWrites,
257
279
  buildWorkspaceVoiceStatus,
258
280
  createDaemonWorkspaceService,
281
+ deleteWorkspaceSkill,
259
282
  hasConfiguredBatchVoiceTranscriptionModel,
283
+ installWorkspaceSkill,
260
284
  transcribeWorkspaceVoiceAudio,
261
285
  validateWorkspaceSkillName,
262
286
  validateWorkspaceVoiceState,
263
287
  voiceSettingsScopeToWire
264
- } from "./chunk-4M24B5J5.js";
288
+ } from "./chunk-KJJPJYHI.js";
265
289
  import {
266
290
  PermissionRulesValidationError,
267
291
  buildPermissionSettings,
268
292
  isPermissionRuleType,
269
293
  normalizePermissionRules,
270
294
  readPermissionRuleSet
271
- } from "./chunk-I5N4EAS6.js";
295
+ } from "./chunk-MWHY26G3.js";
272
296
  import {
273
297
  assertVoiceBaseUrlNetworkAllowed,
274
298
  isStreamingVoiceModel,
@@ -276,27 +300,18 @@ import {
276
300
  resolveVoiceTranscriptionConfig,
277
301
  sanitizeVoiceErrorMessage,
278
302
  transcribeVoiceAudio
279
- } from "./chunk-LEPCWS5A.js";
303
+ } from "./chunk-4MCY33Y2.js";
280
304
  import {
281
305
  isVoiceEnabled,
282
306
  isVoiceMode,
283
307
  readVoiceModel
284
- } from "./chunk-BA4WJC4L.js";
285
- import "./chunk-QAK5475D.js";
286
- import {
287
- createTotalSessionAdmissionController
288
- } from "./chunk-7IKXTGZT.js";
289
- import "./chunk-OIBUG24X.js";
290
- import {
291
- MAX_SESSION_RESTORE_TIMEOUT_MS,
292
- resolveSessionRestoreTimeoutMs,
293
- restoreRetryAfterSeconds
294
- } from "./chunk-4JRM2BSM.js";
308
+ } from "./chunk-XOVVCGZX.js";
309
+ import "./chunk-Y53DG2HA.js";
295
310
  import {
296
311
  createDaemonStatusProvider
297
- } from "./chunk-RM4WT2XB.js";
298
- import "./chunk-RN3YGDCA.js";
299
- import "./chunk-3JQZVCBI.js";
312
+ } from "./chunk-LPBQODMR.js";
313
+ import "./chunk-P6LATTDG.js";
314
+ import "./chunk-YCDL2SAS.js";
300
315
  import "./chunk-JS73NNWF.js";
301
316
  import {
302
317
  SessionArtifactAuthorizationError,
@@ -305,7 +320,7 @@ import {
305
320
  extractErrorCode,
306
321
  extractErrorMessage,
307
322
  parseSessionSource
308
- } from "./chunk-DSX7KQPM.js";
323
+ } from "./chunk-NAKALAL4.js";
309
324
  import {
310
325
  EVENT_SCHEMA_VERSION,
311
326
  EventBus,
@@ -315,10 +330,10 @@ import "./chunk-WCCLLK7X.js";
315
330
  import "./chunk-OCPBI7J5.js";
316
331
  import {
317
332
  createSpawnChannelFactory
318
- } from "./chunk-4HVH57J3.js";
333
+ } from "./chunk-LMJQSPWB.js";
319
334
  import {
320
335
  createWorkspaceProvidersStatusProvider
321
- } from "./chunk-EBDGRBZX.js";
336
+ } from "./chunk-D4CU6DKR.js";
322
337
  import {
323
338
  PERSIST_REASONING_SELECTION_META_KEY,
324
339
  REASONING_SELECTION_PERSISTED_META_KEY
@@ -326,13 +341,13 @@ import {
326
341
  import {
327
342
  getAuthTypeFromEnv,
328
343
  resolveCliGenerationConfig
329
- } from "./chunk-6A2D4QSO.js";
344
+ } from "./chunk-O2GG7H4C.js";
330
345
  import {
331
346
  snapshotProcessEnv
332
- } from "./chunk-KMU3ZHH4.js";
347
+ } from "./chunk-4HC4DYKN.js";
333
348
  import {
334
349
  createWorkspaceSkillsStatusProvider
335
- } from "./chunk-4BGDFKQE.js";
350
+ } from "./chunk-J3O5I5ZD.js";
336
351
  import "./chunk-BHTYRHJF.js";
337
352
  import {
338
353
  BridgeTimeoutError,
@@ -341,41 +356,30 @@ import {
341
356
  SessionRestoreTimeoutError,
342
357
  createIdleWorkspaceMemoryStatus,
343
358
  mapDomainErrorToErrorKind
344
- } from "./chunk-64QH2UC6.js";
359
+ } from "./chunk-KPXRFTT7.js";
345
360
  import {
346
361
  resolveSkillSettings
347
362
  } from "./chunk-HWVUSYSN.js";
348
363
  import {
349
364
  WorkspacePermissionRulesSessionRequiredError,
350
365
  WorkspaceSettingsPartialPersistError,
366
+ WorkspaceSkillNotFoundError,
351
367
  mapWorkspaceSkillToggleError
352
368
  } from "./chunk-FTJMWDND.js";
353
- import {
354
- isServeDebugMode,
355
- mountWebShellAssets,
356
- mountWebShellSpaFallback
357
- } from "./chunk-NFIDVZND.js";
358
- import {
359
- require_express
360
- } from "./chunk-IRKQ4YYX.js";
361
- import "./chunk-FBX2SDQ4.js";
362
- import {
363
- formatHostForAuthority,
364
- isLoopbackBind
365
- } from "./chunk-DMEUXLSS.js";
369
+ import "./chunk-537SQ2AI.js";
366
370
  import {
367
371
  daemonObservedContactsPath,
368
372
  loadChannelsConfig
369
- } from "./chunk-F7NF2IOE.js";
370
- import "./chunk-AZJLY2XZ.js";
373
+ } from "./chunk-IXSGOSEG.js";
374
+ import "./chunk-AHBLRVD5.js";
371
375
  import "./chunk-57OAHC2Y.js";
372
376
  import {
373
377
  parseChannelWebhookConfigLenient
374
- } from "./chunk-PCRBLMIN.js";
378
+ } from "./chunk-TMWB67LS.js";
375
379
  import {
376
380
  supportedChannelCatalog
377
- } from "./chunk-NXKOVOM5.js";
378
- import "./chunk-TSZSGQ3N.js";
381
+ } from "./chunk-4IQKBLTQ.js";
382
+ import "./chunk-WXC6OAWD.js";
379
383
  import "./chunk-V6WHFGST.js";
380
384
  import {
381
385
  getStableLiveDiscoveryBaseDir
@@ -395,13 +399,13 @@ import {
395
399
  WorkspaceRegistrationStoreLimitError,
396
400
  normalizeWorkspaceDisplayName,
397
401
  workspaceRegistrationId
398
- } from "./chunk-BJXCYUGM.js";
402
+ } from "./chunk-5YY5MZT6.js";
399
403
  import {
400
404
  CHANNEL_PROMPT_META_KEY,
401
405
  DAEMON_PROMPT_DISPLAY_TEXT_META_KEY,
402
406
  REQUESTED_SESSION_ID_META_KEY,
403
407
  gradeActiveWorkCoverage
404
- } from "./chunk-ZGCKTAL5.js";
408
+ } from "./chunk-WEXA2DNG.js";
405
409
  import {
406
410
  BranchWhilePromptActiveError,
407
411
  BridgeChannelQuarantinedError,
@@ -455,12 +459,12 @@ import {
455
459
  MAX_CHANNEL_STARTUP_FAILURE_MESSAGE_LENGTH,
456
460
  isChannelWebhookEnqueueError
457
461
  } from "./chunk-STUJ7IMZ.js";
462
+ import {
463
+ normalizeWorkerDiagnostic
464
+ } from "./chunk-4JAGXZR3.js";
458
465
  import {
459
466
  QWEN_SERVER_TOKEN_ENV
460
467
  } from "./chunk-GYTKQYDB.js";
461
- import {
462
- normalizeWorkerDiagnostic
463
- } from "./chunk-M4KFODIP.js";
464
468
  import {
465
469
  normalizeServeChannelSelection
466
470
  } from "./chunk-ALMR3E6Q.js";
@@ -469,13 +473,13 @@ import {
469
473
  isChannelDeliveryError
470
474
  } from "./chunk-RKFGE7JH.js";
471
475
  import "./chunk-UDG5EZJI.js";
472
- import "./chunk-3VUENPWF.js";
473
476
  import {
474
477
  redactLogCredentials
475
478
  } from "./chunk-M5GB774H.js";
479
+ import "./chunk-3VUENPWF.js";
476
480
  import {
477
481
  sanitizeLogText
478
- } from "./chunk-U4DJ5XB3.js";
482
+ } from "./chunk-VDXYYVCD.js";
479
483
  import "./chunk-IW6RQPQB.js";
480
484
  import "./chunk-5HBA2Z7V.js";
481
485
  import {
@@ -490,28 +494,28 @@ import {
490
494
  resolveOutputLanguageOrPreserveAuto,
491
495
  updateOutputLanguageFile,
492
496
  validateSettingValue
493
- } from "./chunk-VWTSRH6C.js";
494
- import "./chunk-NQ4L2CMD.js";
497
+ } from "./chunk-AQ5NAGWI.js";
498
+ import "./chunk-ER273QE6.js";
495
499
  import "./chunk-RKUWKYED.js";
496
- import "./chunk-O5CD7T4T.js";
500
+ import "./chunk-BW4333PP.js";
497
501
  import "./chunk-IDS7MSUP.js";
498
502
  import {
499
503
  detectSystemLanguage,
500
504
  getCurrentLanguage,
501
505
  resolveLanguageSetting,
502
506
  setLanguageAsync
503
- } from "./chunk-I4NRYS6A.js";
507
+ } from "./chunk-MUZCSTOO.js";
504
508
  import {
505
509
  SUPPORTED_LANGUAGES,
506
510
  resolveSupportedLanguage
507
511
  } from "./chunk-5EJZE3FP.js";
508
- import "./chunk-C4TIXFDZ.js";
509
- import "./chunk-2M3EWQNG.js";
510
- import "./chunk-VBWD6C27.js";
512
+ import "./chunk-H3UDNQLO.js";
513
+ import "./chunk-NUQFUXOG.js";
514
+ import "./chunk-XUSOYE2I.js";
511
515
  import "./chunk-W3N5XAZ6.js";
512
516
  import {
513
517
  getWorkspaceTrustStatus
514
- } from "./chunk-65HWLGA7.js";
518
+ } from "./chunk-XY3USGFE.js";
515
519
  import "./chunk-NPQ5ZKRP.js";
516
520
  import {
517
521
  isWithinRoot as isWithinRoot2
@@ -528,22 +532,25 @@ import {
528
532
  loadIgnoreRules,
529
533
  shouldShowStep,
530
534
  writeWorkspaceContextFile
531
- } from "./chunk-JUARRUMA.js";
532
- import "./chunk-I2TMJPCV.js";
533
- import "./chunk-JR42V4UY.js";
535
+ } from "./chunk-UEZOXZNI.js";
536
+ import "./chunk-GELRJXE2.js";
537
+ import "./chunk-32CM56LO.js";
538
+ import "./chunk-JPEAQJNS.js";
539
+ import "./chunk-WTW36TJ3.js";
534
540
  import "./chunk-LJZSMWOH.js";
535
541
  import {
536
542
  readWorktreeSession,
543
+ readWorktreeSessionStrict,
537
544
  writeWorktreeSession
538
- } from "./chunk-RAFQIHN2.js";
539
- import "./chunk-L26ONV2Y.js";
540
- import "./chunk-47RYEQW5.js";
541
- import "./chunk-IG4W5SJR.js";
545
+ } from "./chunk-VUSSAGKI.js";
546
+ import "./chunk-O45WBTNS.js";
547
+ import "./chunk-DJXSOEFB.js";
548
+ import "./chunk-2WGJG2KW.js";
549
+ import "./chunk-QMFOYPGV.js";
550
+ import "./chunk-LDS57224.js";
542
551
  import "./chunk-ZPJWUGCS.js";
543
- import "./chunk-4UANMABT.js";
544
- import "./chunk-ZKFTS3OV.js";
545
- import "./chunk-ENYUKMFK.js";
546
- import "./chunk-UKYXYWI2.js";
552
+ import "./chunk-HFTB354P.js";
553
+ import "./chunk-BUQN5LTI.js";
547
554
  import {
548
555
  QwenOAuth2Client,
549
556
  QwenOAuthPollError,
@@ -552,8 +559,8 @@ import {
552
559
  isDeviceAuthorizationSuccess,
553
560
  isDeviceTokenPending,
554
561
  isDeviceTokenSuccess
555
- } from "./chunk-3AKCBZVW.js";
556
- import "./chunk-SULZPKTA.js";
562
+ } from "./chunk-VU7O7CGQ.js";
563
+ import "./chunk-QSC5YOEC.js";
557
564
  import "./chunk-VNOVK4I7.js";
558
565
  import {
559
566
  BuiltinAgentRegistry,
@@ -565,6 +572,7 @@ import {
565
572
  GROUP_COLOR_OPTIONS,
566
573
  GitPullFailure,
567
574
  InvalidSessionTranscriptCursorError,
575
+ InvalidSessionTranscriptTurnAnchorError,
568
576
  MAX_LOG_LIMIT,
569
577
  ModelsConfig,
570
578
  RUNTIME_MCP_IF_ABSENT_CONFIG_FLAG,
@@ -636,22 +644,23 @@ import {
636
644
  toSessionPrInfo,
637
645
  upsertSessionPr,
638
646
  watchRepoBranch
639
- } from "./chunk-4F7GQGXB.js";
647
+ } from "./chunk-I72PHOKL.js";
640
648
  import "./chunk-GOFAQQZA.js";
641
- import "./chunk-5M6IDOMF.js";
649
+ import "./chunk-3K65MUKD.js";
642
650
  import "./chunk-6HUXPLB5.js";
643
651
  import "./chunk-TWPJO254.js";
644
652
  import "./chunk-CQ35AJ4Z.js";
645
- import "./chunk-NSUKQ4DN.js";
646
- import "./chunk-DQCKVAF5.js";
647
- import "./chunk-AI35S34R.js";
653
+ import "./chunk-YHDGABDC.js";
654
+ import "./chunk-RDKXZ2LS.js";
655
+ import "./chunk-B54PFQS5.js";
648
656
  import {
649
657
  GitWorktreeService,
650
- writeWorktreeSessionMarker
651
- } from "./chunk-KM3XVTMO.js";
658
+ createWorktreeSessionMarkerExclusive,
659
+ readWorktreeSessionMarkerStrict
660
+ } from "./chunk-43NOB5NM.js";
652
661
  import "./chunk-6PVPNMXU.js";
653
- import "./chunk-OKTNXDVO.js";
654
- import "./chunk-EFTPIZIC.js";
662
+ import "./chunk-565U2ANU.js";
663
+ import "./chunk-FDOGGKAA.js";
655
664
  import "./chunk-IRH27ZC2.js";
656
665
  import "./chunk-QHWCP53L.js";
657
666
  import {
@@ -659,46 +668,47 @@ import {
659
668
  readCronTasks,
660
669
  taskHasLegacyCondition,
661
670
  updateCronTasks
662
- } from "./chunk-UJ4DUYIH.js";
671
+ } from "./chunk-F53KKZUD.js";
672
+ import "./chunk-PZV2FASB.js";
663
673
  import {
664
674
  glob
665
675
  } from "./chunk-QJNDUTOL.js";
676
+ import "./chunk-OECNP26L.js";
666
677
  import "./chunk-O6GEWCJA.js";
667
- import "./chunk-OSSTATJF.js";
678
+ import "./chunk-CHEIIBT3.js";
679
+ import "./chunk-UKKYOIVT.js";
680
+ import "./chunk-B44JBZBB.js";
681
+ import "./chunk-BF3RUIVP.js";
668
682
  import {
669
- findGitRoot
670
- } from "./chunk-ZHO2CW6D.js";
671
- import "./chunk-CVX63TFJ.js";
672
- import "./chunk-373DQUVA.js";
683
+ APPROVAL_MODES
684
+ } from "./chunk-JX6XHPTX.js";
673
685
  import {
674
686
  recordDaemonBridgeError,
675
687
  recordDaemonHttpRequest,
676
688
  validateSkillName
677
- } from "./chunk-H43PSPYS.js";
678
- import "./chunk-U6D2PPMN.js";
679
- import "./chunk-VYIUNFEA.js";
680
- import "./chunk-KGV55H53.js";
681
- import "./chunk-7TBU7PU2.js";
682
- import "./chunk-E4JNFXNI.js";
683
- import "./chunk-CHEIIBT3.js";
684
- import "./chunk-TJYRTS4S.js";
685
- import {
686
- APPROVAL_MODES
687
- } from "./chunk-JX6XHPTX.js";
689
+ } from "./chunk-R355CUNQ.js";
690
+ import "./chunk-4VUVBN3Y.js";
691
+ import "./chunk-ZSTCM3MX.js";
692
+ import "./chunk-NXWYCSPL.js";
688
693
  import "./chunk-MLXTMF7H.js";
694
+ import "./chunk-GXZHYPHZ.js";
695
+ import {
696
+ findGitRoot
697
+ } from "./chunk-3CZ2BQV6.js";
689
698
  import "./chunk-PQEISIKS.js";
690
- import "./chunk-FD5SJOWT.js";
691
- import "./chunk-4LIFGNI4.js";
699
+ import "./chunk-3K456UJF.js";
700
+ import "./chunk-VEFRT7NX.js";
692
701
  import "./chunk-S6LOFUVP.js";
693
702
  import "./chunk-NAVJD2PQ.js";
694
- import "./chunk-KFN2IZYR.js";
695
- import "./chunk-GB4UKWY5.js";
703
+ import "./chunk-UKADFFL2.js";
704
+ import "./chunk-EJNYBDYC.js";
696
705
  import "./chunk-QHMLYMMS.js";
697
706
  import "./chunk-CFKIH3D3.js";
698
707
  import "./chunk-2LD5U7Q3.js";
699
708
  import "./chunk-DJ2GSRLV.js";
700
- import "./chunk-S2T7H5MI.js";
701
- import "./chunk-LKODFJRD.js";
709
+ import "./chunk-W4LL5RZO.js";
710
+ import "./chunk-3UMWOKJC.js";
711
+ import "./chunk-KFFCDLKV.js";
702
712
  import {
703
713
  addDaemonRequestAttribute,
704
714
  captureDaemonTelemetryContext,
@@ -710,12 +720,13 @@ import {
710
720
  recordDaemonHttpResponse,
711
721
  runWithDaemonTelemetryContext,
712
722
  withDaemonRequestSpan
713
- } from "./chunk-LB3WQQJK.js";
723
+ } from "./chunk-7OCIQNKX.js";
714
724
  import "./chunk-XWRJCPHC.js";
715
725
  import {
716
726
  parseLineTolerant,
717
727
  read
718
- } from "./chunk-GH2S4GD5.js";
728
+ } from "./chunk-P5LDR7FI.js";
729
+ import "./chunk-5ETULJLP.js";
719
730
  import "./chunk-XBVNNDPK.js";
720
731
  import "./chunk-VGC4I5JJ.js";
721
732
  import {
@@ -726,39 +737,40 @@ import {
726
737
  getAllMemoryFilenames,
727
738
  isUtf8CompatibleEncoding,
728
739
  isWithinRoot
729
- } from "./chunk-DYTW3QVG.js";
730
- import "./chunk-HT5S5TRQ.js";
740
+ } from "./chunk-J6MB5ZHZ.js";
741
+ import "./chunk-EDIDYZBT.js";
742
+ import "./chunk-HD7O6WLV.js";
731
743
  import "./chunk-WZAD4ZNJ.js";
732
744
  import "./chunk-FPGTNKCP.js";
733
- import "./chunk-EIJT2PQ6.js";
734
- import "./chunk-BFY33IB4.js";
735
- import "./chunk-KHP66DFN.js";
736
- import "./chunk-22UH7VTP.js";
745
+ import "./chunk-TIGXX4PA.js";
746
+ import "./chunk-5MTARK4Y.js";
747
+ import "./chunk-XFFRI3WM.js";
748
+ import "./chunk-4HOEU2OR.js";
737
749
  import "./chunk-HHJLM3WQ.js";
738
750
  import {
739
751
  isTelemetrySdkInitialized,
740
752
  redactUrlCredentials,
741
753
  stripAnsiAndControl
742
- } from "./chunk-QKDNS6FU.js";
754
+ } from "./chunk-7VEYUF3N.js";
743
755
  import "./chunk-74TONY4F.js";
744
- import "./chunk-ZDFQGHZH.js";
756
+ import "./chunk-GMNLYQOS.js";
745
757
  import {
746
758
  SubagentError,
747
759
  SubagentErrorCode
748
- } from "./chunk-G7HBEEX7.js";
749
- import "./chunk-QQD2GART.js";
760
+ } from "./chunk-D6PIMKY3.js";
761
+ import "./chunk-NGX4NUNP.js";
750
762
  import {
751
763
  escapeXml
752
- } from "./chunk-AQ37AY7B.js";
753
- import "./chunk-ODZF64DM.js";
754
- import "./chunk-7JMGTOH7.js";
764
+ } from "./chunk-FKJM6JKY.js";
765
+ import "./chunk-IZ2U57NY.js";
766
+ import "./chunk-RPBMP6BN.js";
755
767
  import {
756
768
  FatalConfigError,
757
769
  Storage,
758
770
  createDebugLogger,
759
771
  getErrorMessage,
760
772
  runWithoutDebugLogSession
761
- } from "./chunk-EAHOJF6V.js";
773
+ } from "./chunk-ZAFYHRVY.js";
762
774
  import {
763
775
  writeStderrLine,
764
776
  writeStderrLineSafe,
@@ -767,7 +779,7 @@ import {
767
779
  import "./chunk-75DOP5OR.js";
768
780
  import "./chunk-DMTGGOSA.js";
769
781
  import "./chunk-YQ3U5MUC.js";
770
- import "./chunk-AMDSOFFV.js";
782
+ import "./chunk-MATEIJZF.js";
771
783
  import {
772
784
  import_websocket,
773
785
  import_websocket_server,
@@ -6268,7 +6280,10 @@ async function exportSessionTranscript(params) {
6268
6280
  format,
6269
6281
  filename: generateExportFilename(format),
6270
6282
  mimeType: formatDefinition.mimeType,
6271
- content: formatDefinition.render(normalized)
6283
+ content: formatDefinition.render(
6284
+ normalized,
6285
+ sessionData.conversation.messages
6286
+ )
6272
6287
  };
6273
6288
  }
6274
6289
  __name(exportSessionTranscript, "exportSessionTranscript");
@@ -8140,7 +8155,7 @@ var StandaloneSessionService = class {
8140
8155
  }
8141
8156
  const leaseOptions = {
8142
8157
  processKind: "daemon",
8143
- reclaimPolicy: "never",
8158
+ reclaimPolicy: "local",
8144
8159
  takeoverPolicy: "certified"
8145
8160
  };
8146
8161
  try {
@@ -8258,6 +8273,9 @@ var StandaloneSessionService = class {
8258
8273
  if (error2 instanceof StandaloneSessionServiceError) {
8259
8274
  return { sessionId, code: error2.code, message: error2.message };
8260
8275
  }
8276
+ if (error2 instanceof SessionWriterError) {
8277
+ return { sessionId, code: error2.errorKind, message: error2.message };
8278
+ }
8261
8279
  const mapped = serviceError(
8262
8280
  "standalone_session_operation_failed",
8263
8281
  sessionId
@@ -8549,7 +8567,7 @@ var StandaloneSessionService = class {
8549
8567
  const transcriptParent = await service.getSessionTranscriptParentIdentityForLifecycle(
8550
8568
  locked.location
8551
8569
  );
8552
- const pinned = this.directoryStates.get(sessionId)?.pinned;
8570
+ const pinned = this.effectiveDirectoryPin(runtime, sessionId);
8553
8571
  const paths = await this.options.workspace.inspectStandaloneDeletionPaths(
8554
8572
  sessionId,
8555
8573
  pinned
@@ -8849,6 +8867,7 @@ var StandaloneSessionService = class {
8849
8867
  throw serviceError("standalone_session_conflict", sessionId);
8850
8868
  }
8851
8869
  const prepared = await this.prepareRestoreDirectory(
8870
+ runtime,
8852
8871
  sessionId,
8853
8872
  async () => {
8854
8873
  if (!existing) return;
@@ -9344,17 +9363,49 @@ var StandaloneSessionService = class {
9344
9363
  }
9345
9364
  return result;
9346
9365
  }
9347
- async prepareRestoreDirectory(sessionId, beforeRecreate) {
9348
- const previous = this.directoryStates.get(sessionId);
9366
+ /**
9367
+ * A pin is authoritative only while its matching local bridge session
9368
+ * generation remains resident. A bare pin left by a terminal close, an
9369
+ * entry whose session an idle reap dropped, or a replaced event epoch is
9370
+ * daemon-local history: discard it rather than condemning a directory
9371
+ * another participant may have legitimately recreated. An indeterminate
9372
+ * bridge probe fails closed by propagating.
9373
+ */
9374
+ effectiveDirectoryPin(runtime, sessionId) {
9375
+ const state = this.directoryStates.get(sessionId);
9376
+ if (!state) return void 0;
9377
+ const bound = state.agentBound;
9378
+ if (!bound) {
9379
+ this.directoryStates.delete(sessionId);
9380
+ return void 0;
9381
+ }
9382
+ let eventEpoch;
9383
+ try {
9384
+ eventEpoch = runtime.bridge.getSessionEventEpoch(sessionId);
9385
+ } catch (error2) {
9386
+ if (error2 instanceof SessionNotFoundError) {
9387
+ this.directoryStates.delete(sessionId);
9388
+ return void 0;
9389
+ }
9390
+ throw error2;
9391
+ }
9392
+ if (eventEpoch !== bound.eventEpoch) {
9393
+ this.directoryStates.delete(sessionId);
9394
+ return void 0;
9395
+ }
9396
+ return state.pinned;
9397
+ }
9398
+ async prepareRestoreDirectory(runtime, sessionId, beforeRecreate) {
9399
+ const expected = this.effectiveDirectoryPin(runtime, sessionId);
9349
9400
  const inspected = await this.options.workspace.inspectStandaloneDirectory(
9350
9401
  sessionId,
9351
- previous?.pinned
9402
+ expected
9352
9403
  );
9353
9404
  if (inspected.status === "compromised") {
9354
9405
  throw serviceError("working_directory_compromised", sessionId);
9355
9406
  }
9356
9407
  if (inspected.status === "ready") {
9357
- if (!previous) {
9408
+ if (!this.directoryStates.get(sessionId)) {
9358
9409
  this.directoryStates.set(sessionId, { pinned: inspected.identity });
9359
9410
  }
9360
9411
  return { identity: inspected.identity, state: "ready" };
@@ -9362,7 +9413,7 @@ var StandaloneSessionService = class {
9362
9413
  await beforeRecreate?.();
9363
9414
  const ensured = await this.options.workspace.ensureStandaloneDirectory(
9364
9415
  sessionId,
9365
- previous?.pinned
9416
+ expected
9366
9417
  );
9367
9418
  if (ensured.status === "compromised") {
9368
9419
  throw serviceError("working_directory_compromised", sessionId);
@@ -11736,9 +11787,13 @@ var ALL_QWEN_VENDOR_METHODS = [
11736
11787
  `${QWEN_METHOD_NS}session/detach`,
11737
11788
  `${QWEN_METHOD_NS}session/context_usage`,
11738
11789
  `${QWEN_METHOD_NS}session/tasks`,
11790
+ `${QWEN_METHOD_NS}session/agents`,
11791
+ `${QWEN_METHOD_NS}session/agent_trace`,
11792
+ `${QWEN_METHOD_NS}session/attachments`,
11739
11793
  `${QWEN_METHOD_NS}session/tasks/cancel`,
11740
11794
  `${QWEN_METHOD_NS}session/tasks/workflow_action`,
11741
11795
  `${QWEN_METHOD_NS}session/lsp`,
11796
+ `${QWEN_METHOD_NS}session/saved_workflow`,
11742
11797
  `${QWEN_METHOD_NS}session/artifacts`,
11743
11798
  `${QWEN_METHOD_NS}session/artifacts/add`,
11744
11799
  `${QWEN_METHOD_NS}session/artifacts/remove`,
@@ -14523,6 +14578,42 @@ var AcpDispatcher = class {
14523
14578
  this.replyConn(conn, id, result);
14524
14579
  return;
14525
14580
  }
14581
+ case `${QWEN_METHOD_NS}session/agents`: {
14582
+ const sessionId = String(params["sessionId"] ?? "");
14583
+ if (!this.requireOwned(conn, sessionId, id)) return;
14584
+ const result = await this.bridge.getSessionAgentsStatus(sessionId);
14585
+ this.replyConn(conn, id, result);
14586
+ return;
14587
+ }
14588
+ case `${QWEN_METHOD_NS}session/agent_trace`: {
14589
+ const sessionId = String(params["sessionId"] ?? "");
14590
+ if (!this.requireOwned(conn, sessionId, id)) return;
14591
+ const rootAgentId = params["rootAgentId"];
14592
+ if (rootAgentId !== void 0 && (typeof rootAgentId !== "string" || rootAgentId.length === 0 || rootAgentId.length > 500)) {
14593
+ if (id !== void 0) {
14594
+ conn.sendConn(
14595
+ error(id, RPC.INVALID_PARAMS, "Invalid rootAgentId")
14596
+ );
14597
+ }
14598
+ return;
14599
+ }
14600
+ const result = await this.bridge.getSessionAgentTrace(
14601
+ sessionId,
14602
+ rootAgentId
14603
+ );
14604
+ this.replyConn(conn, id, result);
14605
+ return;
14606
+ }
14607
+ case `${QWEN_METHOD_NS}session/attachments`: {
14608
+ const sessionId = String(params["sessionId"] ?? "");
14609
+ if (!this.requireOwned(conn, sessionId, id)) return;
14610
+ const attachments = await this.bridge.listSessionAttachments(
14611
+ sessionId,
14612
+ this.sessionCtx(conn, sessionId, loopback)
14613
+ );
14614
+ this.replyConn(conn, id, { attachments });
14615
+ return;
14616
+ }
14526
14617
  case `${QWEN_METHOD_NS}session/tasks/cancel`: {
14527
14618
  const sessionId = String(params["sessionId"] ?? "");
14528
14619
  await this.withMutableOwned(conn, sessionId, id, async () => {
@@ -14611,6 +14702,22 @@ var AcpDispatcher = class {
14611
14702
  this.replyConn(conn, id, result);
14612
14703
  return;
14613
14704
  }
14705
+ case `${QWEN_METHOD_NS}session/saved_workflow`: {
14706
+ const sessionId = String(params["sessionId"] ?? "");
14707
+ if (!this.requireOwned(conn, sessionId, id)) return;
14708
+ const name = String(params["name"] ?? "");
14709
+ if (!name) {
14710
+ if (id !== void 0) {
14711
+ conn.sendConn(
14712
+ error(id, RPC.INVALID_PARAMS, "`name` is required")
14713
+ );
14714
+ }
14715
+ return;
14716
+ }
14717
+ const result = this.isWorkspaceTrusted() ? await this.bridge.getSessionSavedWorkflow(sessionId, name) : { v: 1, sessionId, name, workflow: null };
14718
+ this.replyConn(conn, id, result);
14719
+ return;
14720
+ }
14614
14721
  case `${QWEN_METHOD_NS}session/artifacts`: {
14615
14722
  const sessionId = String(params["sessionId"] ?? "");
14616
14723
  if (!this.requireOwned(conn, sessionId, id)) return;
@@ -17719,6 +17826,18 @@ var ClientMcpWsConnection = class {
17719
17826
  }
17720
17827
  registrar;
17721
17828
  disposed = false;
17829
+ /**
17830
+ * The scope each server was registered with, so unregister / dispose tear
17831
+ * down the SAME registration. A session-scoped server removed without its
17832
+ * session id would either miss the session's copy or hit the workspace path.
17833
+ */
17834
+ serverScopes = /* @__PURE__ */ new Map();
17835
+ /**
17836
+ * Identity of the in-flight register per server name, so a stale late-failing
17837
+ * register cannot roll back the registrar advertisement and scope entry a
17838
+ * newer register of the same name on this connection installed.
17839
+ */
17840
+ registerAttemptIds = /* @__PURE__ */ new Map();
17722
17841
  /**
17723
17842
  * Route a parsed inbound frame. Returns a structured result the WS layer can
17724
17843
  * turn into an ack/error reply (or ignore). Never throws — protocol errors
@@ -17730,7 +17849,7 @@ var ClientMcpWsConnection = class {
17730
17849
  }
17731
17850
  switch (frame.type) {
17732
17851
  case CLIENT_MCP_FRAME_TYPES.register:
17733
- return this.handleRegister(frame.server);
17852
+ return this.handleRegister(frame.server, frame.sessionId);
17734
17853
  case CLIENT_MCP_FRAME_TYPES.unregister:
17735
17854
  return this.handleUnregister(frame.server);
17736
17855
  case CLIENT_MCP_FRAME_TYPES.message:
@@ -17746,7 +17865,7 @@ var ClientMcpWsConnection = class {
17746
17865
  static isClientMcpFrameType(type) {
17747
17866
  return type === CLIENT_MCP_FRAME_TYPES.register || type === CLIENT_MCP_FRAME_TYPES.message || type === CLIENT_MCP_FRAME_TYPES.unregister;
17748
17867
  }
17749
- async handleRegister(server) {
17868
+ async handleRegister(server, sessionId) {
17750
17869
  if (!isValidServerName(server)) {
17751
17870
  return {
17752
17871
  kind: "error",
@@ -17754,6 +17873,17 @@ var ClientMcpWsConnection = class {
17754
17873
  message: "server must be \u2264256 chars, alphanumeric + underscore/hyphen, and not a reserved JS property name"
17755
17874
  };
17756
17875
  }
17876
+ let scope;
17877
+ if (sessionId !== void 0) {
17878
+ if (typeof sessionId !== "string" || sessionId.length === 0) {
17879
+ return {
17880
+ kind: "error",
17881
+ code: "invalid_session_id",
17882
+ message: "`sessionId` must be a non-empty string when provided"
17883
+ };
17884
+ }
17885
+ scope = { sessionId };
17886
+ }
17757
17887
  if (this.registrar.hasServer(server)) {
17758
17888
  return {
17759
17889
  kind: "error",
@@ -17776,23 +17906,43 @@ var ClientMcpWsConnection = class {
17776
17906
  };
17777
17907
  }
17778
17908
  this.registrar.registerServer(server);
17909
+ if (scope) this.serverScopes.set(server, scope);
17910
+ const attempt = {};
17911
+ this.registerAttemptIds.set(server, attempt);
17779
17912
  try {
17780
17913
  const { toolCount } = await this.provider.registerClientMcpServer(
17781
17914
  server,
17782
- this.registrar.sendSdkMcpMessage
17915
+ this.registrar.sendSdkMcpMessage,
17916
+ scope
17783
17917
  );
17784
17918
  if (this.disposed) {
17785
- this.registrar.unregisterServer(server);
17786
- await this.provider.unregisterClientMcpServer(server);
17919
+ if (this.registerAttemptIds.get(server) === attempt) {
17920
+ this.registrar.unregisterServer(server);
17921
+ this.serverScopes.delete(server);
17922
+ this.registerAttemptIds.delete(server);
17923
+ }
17924
+ await this.provider.unregisterClientMcpServer(server, scope);
17787
17925
  return {
17788
17926
  kind: "error",
17789
17927
  code: "closed",
17790
17928
  message: "connection disposed during register"
17791
17929
  };
17792
17930
  }
17931
+ this.registerAttemptIds.delete(server);
17793
17932
  return { kind: "registered", server, toolCount };
17794
17933
  } catch (err) {
17795
- this.registrar.unregisterServer(server);
17934
+ if (this.registerAttemptIds.get(server) === attempt) {
17935
+ this.registrar.unregisterServer(server);
17936
+ this.serverScopes.delete(server);
17937
+ this.registerAttemptIds.delete(server);
17938
+ }
17939
+ if (this.disposed) {
17940
+ return {
17941
+ kind: "error",
17942
+ code: "closed",
17943
+ message: "connection disposed during register"
17944
+ };
17945
+ }
17796
17946
  return {
17797
17947
  kind: "error",
17798
17948
  code: "register_failed",
@@ -17811,10 +17961,12 @@ var ClientMcpWsConnection = class {
17811
17961
  message: "server name is invalid"
17812
17962
  };
17813
17963
  }
17964
+ const scope = this.serverScopes.get(server);
17814
17965
  const existed = this.registrar.unregisterServer(server);
17966
+ this.serverScopes.delete(server);
17815
17967
  if (existed && this.provider) {
17816
17968
  try {
17817
- await this.provider.unregisterClientMcpServer(server);
17969
+ await this.provider.unregisterClientMcpServer(server, scope);
17818
17970
  } catch {
17819
17971
  }
17820
17972
  }
@@ -17861,10 +18013,14 @@ var ClientMcpWsConnection = class {
17861
18013
  if (this.provider) {
17862
18014
  await Promise.allSettled(
17863
18015
  servers.map(
17864
- (server) => this.provider.unregisterClientMcpServer(server)
18016
+ (server) => this.provider.unregisterClientMcpServer(
18017
+ server,
18018
+ this.serverScopes.get(server)
18019
+ )
17865
18020
  )
17866
18021
  );
17867
18022
  }
18023
+ this.serverScopes.clear();
17868
18024
  }
17869
18025
  };
17870
18026
 
@@ -18710,7 +18866,11 @@ var WS_READ_METHODS = /* @__PURE__ */ new Set([
18710
18866
  "_qwen/session/supported_commands",
18711
18867
  "_qwen/session/context_usage",
18712
18868
  "_qwen/session/tasks",
18869
+ "_qwen/session/agents",
18870
+ "_qwen/session/agent_trace",
18871
+ "_qwen/session/attachments",
18713
18872
  "_qwen/session/lsp",
18873
+ "_qwen/session/saved_workflow",
18714
18874
  "_qwen/session/artifacts",
18715
18875
  "_qwen/workspace/mcp",
18716
18876
  "_qwen/workspace/skills",
@@ -25784,6 +25944,12 @@ var legacySessionTelemetryRoutes = [
25784
25944
  attribution: "handler_resolved",
25785
25945
  route: "GET /session/:id/transcript"
25786
25946
  },
25947
+ {
25948
+ method: "GET",
25949
+ path: "/session/:id/turn-index",
25950
+ attribution: "handler_resolved",
25951
+ route: "GET /session/:id/turn-index"
25952
+ },
25787
25953
  {
25788
25954
  method: "GET",
25789
25955
  path: "/session/:id/context",
@@ -25814,6 +25980,18 @@ var legacySessionTelemetryRoutes = [
25814
25980
  attribution: "handler_resolved",
25815
25981
  route: "GET /session/:id/tasks"
25816
25982
  },
25983
+ {
25984
+ method: "GET",
25985
+ path: "/session/:id/agents",
25986
+ attribution: "handler_resolved",
25987
+ route: "GET /session/:id/agents"
25988
+ },
25989
+ {
25990
+ method: "GET",
25991
+ path: "/session/:id/agent-trace",
25992
+ attribution: "handler_resolved",
25993
+ route: "GET /session/:id/agent-trace"
25994
+ },
25817
25995
  {
25818
25996
  method: "GET",
25819
25997
  path: "/session/:id/subagents/:subagentRef",
@@ -25832,6 +26010,12 @@ var legacySessionTelemetryRoutes = [
25832
26010
  attribution: "handler_resolved",
25833
26011
  route: "GET /session/:id/lsp"
25834
26012
  },
26013
+ {
26014
+ method: "GET",
26015
+ path: "/session/:id/resources",
26016
+ attribution: "handler_resolved",
26017
+ route: "GET /session/:id/resources"
26018
+ },
25835
26019
  {
25836
26020
  method: "GET",
25837
26021
  path: "/session/:id/hooks",
@@ -25868,6 +26052,12 @@ var legacySessionTelemetryRoutes = [
25868
26052
  attribution: "handler_resolved",
25869
26053
  route: "POST /session/:id/tasks/:taskId/workflow-action"
25870
26054
  },
26055
+ {
26056
+ method: "GET",
26057
+ path: "/session/:id/saved-workflows/:name",
26058
+ attribution: "handler_resolved",
26059
+ route: "GET /session/:id/saved-workflows/:name"
26060
+ },
25871
26061
  {
25872
26062
  method: "POST",
25873
26063
  path: "/session/:id/goal",
@@ -25898,6 +26088,12 @@ var legacySessionTelemetryRoutes = [
25898
26088
  attribution: "handler_resolved",
25899
26089
  route: "POST /session/:id/attachments"
25900
26090
  },
26091
+ {
26092
+ method: "GET",
26093
+ path: "/session/:id/attachments",
26094
+ attribution: "handler_resolved",
26095
+ route: "GET /session/:id/attachments"
26096
+ },
25901
26097
  {
25902
26098
  method: "GET",
25903
26099
  path: "/session/:id/attachments/:attachmentId",
@@ -26187,6 +26383,15 @@ function resolveDaemonTelemetryRoute(req) {
26187
26383
  sessionId: decodePathSegment(workspaceTranscript[1])
26188
26384
  };
26189
26385
  }
26386
+ const workspaceTurnIndex = path19.match(
26387
+ /^\/workspaces\/[^/]+\/session\/([^/]+)\/turn-index$/
26388
+ );
26389
+ if (workspaceTurnIndex?.[1] && req.method === "GET") {
26390
+ return {
26391
+ route: "GET /workspaces/:workspace/session/:id/turn-index",
26392
+ sessionId: decodePathSegment(workspaceTurnIndex[1])
26393
+ };
26394
+ }
26190
26395
  const workspaceExport = path19.match(
26191
26396
  /^\/workspaces\/[^/]+\/session\/([^/]+)\/export$/
26192
26397
  );
@@ -27712,6 +27917,50 @@ function parseTranscriptCursorQuery(rawCursor, res) {
27712
27917
  return rawCursor;
27713
27918
  }
27714
27919
  __name(parseTranscriptCursorQuery, "parseTranscriptCursorQuery");
27920
+ function parseTranscriptDirectionQuery(rawDirection, res) {
27921
+ if (rawDirection === void 0) return void 0;
27922
+ if (rawDirection !== "backward") {
27923
+ res.status(400).json({
27924
+ error: "`direction` must be `backward`",
27925
+ code: "invalid_transcript_cursor"
27926
+ });
27927
+ return null;
27928
+ }
27929
+ return rawDirection;
27930
+ }
27931
+ __name(parseTranscriptDirectionQuery, "parseTranscriptDirectionQuery");
27932
+ function parseTranscriptSnapshotQuery(rawSnapshot, res) {
27933
+ if (rawSnapshot === void 0) return void 0;
27934
+ if (typeof rawSnapshot !== "string" || rawSnapshot.trim() === "") {
27935
+ res.status(400).json({
27936
+ error: "`snapshot` must be a non-empty string",
27937
+ code: "invalid_transcript_cursor"
27938
+ });
27939
+ return null;
27940
+ }
27941
+ return rawSnapshot;
27942
+ }
27943
+ __name(parseTranscriptSnapshotQuery, "parseTranscriptSnapshotQuery");
27944
+ function parseTranscriptStartQuery(rawStart, res) {
27945
+ if (rawStart === void 0) return void 0;
27946
+ if (typeof rawStart !== "string" || !/^\d+$/.test(rawStart)) {
27947
+ res.status(400).json({
27948
+ error: "`start` must be a non-negative integer",
27949
+ code: "invalid_transcript_cursor"
27950
+ });
27951
+ return null;
27952
+ }
27953
+ const start = Number(rawStart);
27954
+ if (!Number.isSafeInteger(start)) {
27955
+ res.status(400).json({
27956
+ error: "`start` must be a non-negative safe integer",
27957
+ code: "invalid_transcript_cursor"
27958
+ });
27959
+ return null;
27960
+ }
27961
+ return start;
27962
+ }
27963
+ __name(parseTranscriptStartQuery, "parseTranscriptStartQuery");
27715
27964
  function parseTranscriptRecordBoundaryQuery(rawBoundary, res) {
27716
27965
  if (rawBoundary === void 0) return void 0;
27717
27966
  if (typeof rawBoundary !== "string" || rawBoundary.trim() === "" || rawBoundary.length > 200) {
@@ -27724,6 +27973,18 @@ function parseTranscriptRecordBoundaryQuery(rawBoundary, res) {
27724
27973
  return rawBoundary;
27725
27974
  }
27726
27975
  __name(parseTranscriptRecordBoundaryQuery, "parseTranscriptRecordBoundaryQuery");
27976
+ function parseTranscriptTurnAnchorQuery(rawAnchor, res) {
27977
+ if (rawAnchor === void 0) return void 0;
27978
+ if (typeof rawAnchor !== "string" || rawAnchor.trim() === "" || rawAnchor.length > 200) {
27979
+ res.status(400).json({
27980
+ error: "`atRecordId` must be a non-empty record id",
27981
+ code: "invalid_turn_anchor"
27982
+ });
27983
+ return null;
27984
+ }
27985
+ return rawAnchor;
27986
+ }
27987
+ __name(parseTranscriptTurnAnchorQuery, "parseTranscriptTurnAnchorQuery");
27727
27988
  function parseHistoryPageSize(body, res) {
27728
27989
  const value = body["historyPageSize"];
27729
27990
  if (value === void 0) return void 0;
@@ -27874,6 +28135,34 @@ function registerSessionRoutes(app, deps) {
27874
28135
  const LANGUAGE_CODES = deps.languageCodes;
27875
28136
  const transcriptCursorMasterKey = crypto3.randomBytes(32);
27876
28137
  const transcriptCursorCodecs = /* @__PURE__ */ new Map();
28138
+ const worktreeRestoreTails = /* @__PURE__ */ new WeakMap();
28139
+ const acquireWorktreeRestore = /* @__PURE__ */ __name(async (bridge, sessionId) => {
28140
+ let tails = worktreeRestoreTails.get(bridge);
28141
+ if (!tails) {
28142
+ tails = /* @__PURE__ */ new Map();
28143
+ worktreeRestoreTails.set(bridge, tails);
28144
+ }
28145
+ const key = normalizeSessionIdForLookup(sessionId);
28146
+ const previous = tails.get(key);
28147
+ let releaseGate;
28148
+ const gate = new Promise((resolve7) => {
28149
+ releaseGate = resolve7;
28150
+ });
28151
+ const tail = (previous ?? Promise.resolve()).then(() => gate);
28152
+ tails.set(key, tail);
28153
+ if (previous) {
28154
+ await previous;
28155
+ }
28156
+ let released = false;
28157
+ return () => {
28158
+ if (released) return;
28159
+ released = true;
28160
+ releaseGate();
28161
+ if (tails.get(key) === tail) {
28162
+ tails.delete(key);
28163
+ }
28164
+ };
28165
+ }, "acquireWorktreeRestore");
27877
28166
  const activeBranchSessions = /* @__PURE__ */ new Map();
27878
28167
  const inFlightBranchWorkspaces = /* @__PURE__ */ new Set();
27879
28168
  const clearBranchSessionEntry = /* @__PURE__ */ __name((sessionId) => {
@@ -29355,6 +29644,8 @@ function registerSessionRoutes(app, deps) {
29355
29644
  let branchMeta;
29356
29645
  let branchBaseCommit;
29357
29646
  let worktreeMeta;
29647
+ let worktreeDurablyAttached = false;
29648
+ let spawnCompleted = false;
29358
29649
  try {
29359
29650
  assertRuntimeGenerationOpen?.();
29360
29651
  const rawBranch = body["branch"];
@@ -29566,6 +29857,7 @@ function registerSessionRoutes(app, deps) {
29566
29857
  ...branchMeta ? { branch: branchMeta } : {},
29567
29858
  ...requestedSessionId !== void 0 ? { sessionId: requestedSessionId } : {}
29568
29859
  });
29860
+ spawnCompleted = true;
29569
29861
  if (requestedSessionId !== void 0 && session.sessionId !== requestedSessionId) {
29570
29862
  if (daemonLog) {
29571
29863
  daemonLog.warn("session id not honored by agent", {
@@ -29709,29 +30001,21 @@ function registerSessionRoutes(app, deps) {
29709
30001
  path12.join(createRepoTop, ".qwen", "worktrees")
29710
30002
  );
29711
30003
  }
29712
- await runtime.bridge.changeSessionCwd(session.sessionId, {
29713
- path: worktreeMeta.path,
29714
- allowedRoots: createAllowedRoots
29715
- });
29716
- await writeWorktreeSessionMarker(
29717
- worktreeMeta.path,
29718
- session.sessionId
29719
- ).catch(() => {
29720
- });
29721
- await writeWorktreeSession(
29722
- createWorkspaceRuntimeSessionService(
29723
- runtime
29724
- ).getWorktreeSessionPath(session.sessionId),
30004
+ const expectedWorktreePath = fs7.realpathSync(worktreeMeta.path);
30005
+ const changed = await runtime.bridge.changeSessionCwd(
30006
+ session.sessionId,
29725
30007
  {
29726
- slug: worktreeMeta.slug,
29727
- worktreePath: worktreeMeta.path,
29728
- worktreeBranch: worktreeMeta.branch,
29729
- originalCwd: workspaceCwd,
29730
- originalBranch: "",
29731
- originalHeadCommit: ""
30008
+ path: worktreeMeta.path,
30009
+ allowedRoots: createAllowedRoots
29732
30010
  }
29733
- ).catch(() => {
29734
- });
30011
+ );
30012
+ if (changed.newCwd !== expectedWorktreePath) {
30013
+ throw new Error("Worktree relocation returned an unexpected path");
30014
+ }
30015
+ worktreeMeta = { ...worktreeMeta, path: expectedWorktreePath };
30016
+ runtime.bridge.setSessionWorktree(session.sessionId, worktreeMeta);
30017
+ session.worktree = worktreeMeta;
30018
+ session.currentCwd = changed.newCwd;
29735
30019
  } catch (cdErr) {
29736
30020
  if (daemonLog) {
29737
30021
  daemonLog.warn("worktree cd failed, rolling back", {
@@ -29739,7 +30023,7 @@ function registerSessionRoutes(app, deps) {
29739
30023
  error: cdErr instanceof Error ? cdErr.message : String(cdErr)
29740
30024
  });
29741
30025
  }
29742
- await runWithWorkspaceRuntimeStorage(
30026
+ const removedSession = await runWithWorkspaceRuntimeStorage(
29743
30027
  runtime,
29744
30028
  () => deleteDaemonSessionIfOrphan({
29745
30029
  sessionId: session.sessionId,
@@ -29748,14 +30032,76 @@ function registerSessionRoutes(app, deps) {
29748
30032
  coordinator: archiveCoordinator
29749
30033
  })
29750
30034
  ).catch(() => false);
29751
- await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
29752
- });
30035
+ if (removedSession) {
30036
+ await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
30037
+ });
30038
+ }
29753
30039
  res.status(500).json({
29754
30040
  error: "Failed to relocate session into worktree",
29755
30041
  code: "worktree_relocate_failed"
29756
30042
  });
29757
30043
  return;
29758
30044
  }
30045
+ try {
30046
+ await createWorktreeSessionMarkerExclusive(
30047
+ worktreeMeta.path,
30048
+ session.sessionId
30049
+ );
30050
+ await writeWorktreeSession(
30051
+ createWorkspaceRuntimeSessionService(
30052
+ runtime
30053
+ ).getWorktreeSessionPath(session.sessionId),
30054
+ {
30055
+ slug: worktreeMeta.slug,
30056
+ worktreePath: worktreeMeta.path,
30057
+ worktreeBranch: worktreeMeta.branch,
30058
+ originalCwd: workspaceCwd,
30059
+ workspaceCwd,
30060
+ originalBranch: "",
30061
+ originalHeadCommit: ""
30062
+ }
30063
+ );
30064
+ assertRuntimeGenerationOpen?.();
30065
+ session.worktreeState = "persisted-v1";
30066
+ worktreeDurablyAttached = true;
30067
+ } catch (persistErr) {
30068
+ daemonLog?.warn("worktree persistence failed after relocation", {
30069
+ sessionId: session.sessionId,
30070
+ error: persistErr instanceof Error ? persistErr.message : String(persistErr)
30071
+ });
30072
+ let removed = false;
30073
+ try {
30074
+ removed = await runWithWorkspaceRuntimeStorage(
30075
+ runtime,
30076
+ () => deleteDaemonSessionIfOrphan({
30077
+ sessionId: session.sessionId,
30078
+ service: createWorkspaceRuntimeSessionService(runtime),
30079
+ bridge: runtime.bridge,
30080
+ coordinator: archiveCoordinator
30081
+ })
30082
+ );
30083
+ } catch {
30084
+ }
30085
+ if (removed) {
30086
+ await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
30087
+ });
30088
+ } else {
30089
+ daemonLog?.warn(
30090
+ "worktree preserved after persistence cleanup was inconclusive",
30091
+ {
30092
+ sessionId: session.sessionId,
30093
+ slug: worktreeMeta.slug,
30094
+ worktreePath: worktreeMeta.path,
30095
+ branch: worktreeMeta.branch
30096
+ }
30097
+ );
30098
+ }
30099
+ res.status(500).json({
30100
+ error: "Failed to persist worktree session ownership",
30101
+ code: "worktree_persistence_failed"
30102
+ });
30103
+ return;
30104
+ }
29759
30105
  }
29760
30106
  if (branchMeta) {
29761
30107
  activeBranchSessions.set(workspaceCwd, session.sessionId);
@@ -29763,7 +30109,7 @@ function registerSessionRoutes(app, deps) {
29763
30109
  }
29764
30110
  res.status(200).json(session);
29765
30111
  } catch (err) {
29766
- if (worktreeMeta) {
30112
+ if (worktreeMeta && !worktreeDurablyAttached && !spawnCompleted) {
29767
30113
  await new GitWorktreeService(workspaceCwd).removeUserWorktree(worktreeMeta.slug, { deleteBranch: true }).catch(() => {
29768
30114
  });
29769
30115
  }
@@ -29957,6 +30303,9 @@ function registerSessionRoutes(app, deps) {
29957
30303
  }
29958
30304
  }
29959
30305
  let restoredStorageSessionId = sessionId;
30306
+ let suppressWorktreeContextRestore = false;
30307
+ let deferRestoreAskUserQuestionPrompt = false;
30308
+ let releaseWorktreeRestore;
29960
30309
  try {
29961
30310
  const session = await archiveCoordinator.runSharedMany(
29962
30311
  [sessionId],
@@ -30000,6 +30349,24 @@ function registerSessionRoutes(app, deps) {
30000
30349
  ...restoreMetadata,
30001
30350
  ...hasPersistedSource || isInternalWorkspaceRuntime(runtime) ? {} : restoreSource
30002
30351
  };
30352
+ const isChannelRestore = restoreRequestMetadata.sourceType === "channel";
30353
+ let isPart4AWorktreeRestore = false;
30354
+ if (isChannelRestore && runtime.provenance !== "live-conversation") {
30355
+ const sidecarBeforeRestore = await readWorktreeSessionStrict(
30356
+ sessionService.getWorktreeSessionPath(restoredStorageSessionId)
30357
+ );
30358
+ isPart4AWorktreeRestore = sidecarBeforeRestore.state === "valid" && sidecarBeforeRestore.session.workspaceCwd !== void 0;
30359
+ suppressWorktreeContextRestore = !(sidecarBeforeRestore.state === "valid" && sidecarBeforeRestore.session.workspaceCwd === void 0);
30360
+ } else {
30361
+ suppressWorktreeContextRestore = isChannelRestore;
30362
+ }
30363
+ deferRestoreAskUserQuestionPrompt = suppressWorktreeContextRestore && runtime.bridge.fireDeferredRestoreAskUserQuestionPrompt !== void 0 && runtime.bridge.discardDeferredRestoreAskUserQuestionPrompt !== void 0;
30364
+ if (deferRestoreAskUserQuestionPrompt && isPart4AWorktreeRestore) {
30365
+ releaseWorktreeRestore = await acquireWorktreeRestore(
30366
+ runtime.bridge,
30367
+ sessionId
30368
+ );
30369
+ }
30003
30370
  assertRuntimeGenerationOpen?.();
30004
30371
  if (isInternalWorkspaceRuntime(runtime)) {
30005
30372
  sessionIdReservation = requestedSessionIdAdmission.reserveRestore(
@@ -30024,6 +30391,10 @@ function registerSessionRoutes(app, deps) {
30024
30391
  const restored = action === "load" ? await runtime.bridge.loadSession({
30025
30392
  sessionId,
30026
30393
  workspaceCwd,
30394
+ ...suppressWorktreeContextRestore ? {
30395
+ suppressWorktreeContextRestore: true,
30396
+ ...deferRestoreAskUserQuestionPrompt ? { deferRestoreAskUserQuestionPrompt: true } : {}
30397
+ } : {},
30027
30398
  historyReplay: "response",
30028
30399
  ...historyPageSize !== void 0 ? { historyPageSize } : {},
30029
30400
  ...liveReplayMode !== void 0 ? { liveReplayMode } : {},
@@ -30033,6 +30404,10 @@ function registerSessionRoutes(app, deps) {
30033
30404
  }) : await runtime.bridge.resumeSession({
30034
30405
  sessionId,
30035
30406
  workspaceCwd,
30407
+ ...suppressWorktreeContextRestore ? {
30408
+ suppressWorktreeContextRestore: true,
30409
+ ...deferRestoreAskUserQuestionPrompt ? { deferRestoreAskUserQuestionPrompt: true } : {}
30410
+ } : {},
30036
30411
  ...clientId !== void 0 ? { clientId } : {},
30037
30412
  ...approvalMode !== void 0 ? { approvalMode } : {},
30038
30413
  ...restoreRequestMetadata
@@ -30089,7 +30464,7 @@ function registerSessionRoutes(app, deps) {
30089
30464
  throw error2;
30090
30465
  }
30091
30466
  }
30092
- if (action === "load" && !restored.attached && !restored.hasActivePrompt && runtime.provenance !== "live-conversation") {
30467
+ if (action === "load" && !restored.attached && !restored.hasActivePrompt && !deferRestoreAskUserQuestionPrompt && runtime.provenance !== "live-conversation") {
30093
30468
  try {
30094
30469
  await reconcileDanglingPromptTerminals(
30095
30470
  sessionService,
@@ -30098,53 +30473,46 @@ function registerSessionRoutes(app, deps) {
30098
30473
  } catch {
30099
30474
  }
30100
30475
  }
30101
- return withPromptTerminals(
30102
- restored,
30103
- action === "load" ? readRecentPromptTerminals(sessionService, sessionId) : void 0
30104
- );
30476
+ return restored;
30105
30477
  }
30106
30478
  );
30107
- try {
30108
- assertRuntimeGenerationOpen?.();
30109
- } catch (error2) {
30110
- if (!session.attached) {
30111
- await runtime.bridge.killSession(session.sessionId, { requireZeroAttaches: true }).catch(() => {
30479
+ const cleanupRestoredSession = /* @__PURE__ */ __name(async () => {
30480
+ if (deferRestoreAskUserQuestionPrompt) {
30481
+ runtime.bridge.discardDeferredRestoreAskUserQuestionPrompt?.(
30482
+ session.sessionId,
30483
+ session.clientId
30484
+ );
30485
+ }
30486
+ if (session.attached) {
30487
+ await runtime.bridge.detachClient(session.sessionId, session.clientId).catch(() => {
30112
30488
  });
30113
30489
  } else {
30114
- await runtime.bridge.detachClient(session.sessionId, session.clientId).catch(() => {
30490
+ await runtime.bridge.killSession(session.sessionId, { requireZeroAttaches: true }).catch(() => {
30115
30491
  });
30116
30492
  }
30493
+ }, "cleanupRestoredSession");
30494
+ try {
30495
+ assertRuntimeGenerationOpen?.();
30496
+ } catch (error2) {
30497
+ await cleanupRestoredSession();
30117
30498
  throw error2;
30118
30499
  }
30119
- if (daemonLog) {
30120
- daemonLog.info(
30121
- `session ${action}${session.attached ? " (attached)" : ""}`,
30122
- { sessionId: session.sessionId, clientId: session.clientId }
30123
- );
30124
- }
30125
30500
  if (!res.writable) {
30126
- if (!session.attached) {
30127
- runtime.bridge.killSession(session.sessionId, { requireZeroAttaches: true }).catch(() => {
30128
- });
30129
- } else {
30130
- runtime.bridge.detachClient(session.sessionId, session.clientId).catch(() => {
30131
- });
30132
- }
30501
+ void cleanupRestoredSession();
30133
30502
  return;
30134
30503
  }
30135
- if (runtime.provenance !== "live-conversation" && !session.worktree) {
30136
- const sidecar = await readWorktreeSession(
30137
- createWorkspaceRuntimeSessionService(
30138
- runtime
30139
- ).getWorktreeSessionPath(restoredStorageSessionId)
30140
- ).catch(() => null);
30141
- if (sidecar) {
30504
+ if (runtime.provenance !== "live-conversation") {
30505
+ const sidecarPath = createWorkspaceRuntimeSessionService(
30506
+ runtime
30507
+ ).getWorktreeSessionPath(restoredStorageSessionId);
30508
+ const sidecarResult = await readWorktreeSessionStrict(sidecarPath);
30509
+ if (sidecarResult.state === "valid" && sidecarResult.session.workspaceCwd === void 0) {
30510
+ const sidecar = sidecarResult.session;
30142
30511
  let realTarget;
30143
- const candidateRoots = [
30144
- path12.join(workspaceCwd, ".qwen", "worktrees")
30145
- ];
30512
+ let candidateRoots = [];
30513
+ let validationError;
30146
30514
  try {
30147
- realTarget = fs7.realpathSync(sidecar.worktreePath);
30515
+ const workspaceRoots = [fs7.realpathSync(workspaceCwd)];
30148
30516
  let repoTop = null;
30149
30517
  try {
30150
30518
  repoTop = await new GitWorktreeService(
@@ -30152,31 +30520,44 @@ function registerSessionRoutes(app, deps) {
30152
30520
  ).getRepoTopLevel();
30153
30521
  } catch {
30154
30522
  }
30155
- if (repoTop && repoTop !== workspaceCwd) {
30156
- candidateRoots.push(path12.join(repoTop, ".qwen", "worktrees"));
30523
+ if (repoTop) {
30524
+ const realRepoTop = fs7.realpathSync(repoTop);
30525
+ if (!workspaceRoots.includes(realRepoTop)) {
30526
+ workspaceRoots.push(realRepoTop);
30527
+ }
30528
+ }
30529
+ const realOriginalCwd = fs7.realpathSync(sidecar.originalCwd);
30530
+ if (!workspaceRoots.includes(realOriginalCwd)) {
30531
+ throw new Error("legacy sidecar belongs to another workspace");
30157
30532
  }
30533
+ candidateRoots = workspaceRoots.map(
30534
+ (root) => path12.join(root, ".qwen", "worktrees")
30535
+ );
30536
+ realTarget = fs7.realpathSync(sidecar.worktreePath);
30158
30537
  const contained = candidateRoots.some((root) => {
30159
30538
  try {
30160
30539
  const realRoot = fs7.realpathSync(root);
30161
- const rel = path12.relative(realRoot, realTarget);
30162
- return !rel.startsWith("..") && !path12.isAbsolute(rel);
30540
+ const relative5 = path12.relative(realRoot, realTarget);
30541
+ return relative5.length > 0 && !relative5.startsWith("..") && !path12.isAbsolute(relative5);
30163
30542
  } catch {
30164
30543
  return false;
30165
30544
  }
30166
30545
  });
30167
30546
  if (!contained) {
30168
- realTarget = void 0;
30547
+ throw new Error("worktree sidecar path failed containment");
30169
30548
  }
30170
- } catch {
30549
+ } catch (error2) {
30550
+ validationError = error2;
30171
30551
  realTarget = void 0;
30172
30552
  }
30173
30553
  if (!realTarget) {
30174
30554
  daemonLog?.warn("worktree sidecar path failed containment", {
30175
30555
  sessionId,
30176
- path: sidecar.worktreePath
30556
+ path: sidecar.worktreePath,
30557
+ error: validationError instanceof Error ? validationError.message : String(validationError)
30177
30558
  });
30178
30559
  } else {
30179
- const wt = {
30560
+ const worktree = {
30180
30561
  slug: sidecar.slug,
30181
30562
  path: realTarget,
30182
30563
  branch: sidecar.worktreeBranch
@@ -30184,23 +30565,176 @@ function registerSessionRoutes(app, deps) {
30184
30565
  try {
30185
30566
  if (!session.hasActivePrompt) {
30186
30567
  await runtime.bridge.changeSessionCwd(sessionId, {
30187
- path: wt.path,
30568
+ path: worktree.path,
30188
30569
  allowedRoots: candidateRoots
30189
30570
  });
30190
30571
  }
30191
- runtime.bridge.setSessionWorktree(sessionId, wt);
30192
- session.worktree = wt;
30572
+ runtime.bridge.setSessionWorktree(sessionId, worktree);
30573
+ session.worktree = worktree;
30193
30574
  } catch (restoreErr) {
30194
30575
  daemonLog?.warn("worktree restore failed on load/resume", {
30195
30576
  sessionId,
30196
- worktreePath: wt.path,
30577
+ worktreePath: worktree.path,
30197
30578
  error: restoreErr instanceof Error ? restoreErr.message : String(restoreErr)
30198
30579
  });
30199
30580
  }
30200
30581
  }
30582
+ } else if (sidecarResult.state !== "missing") {
30583
+ try {
30584
+ if (sidecarResult.state !== "valid") {
30585
+ throw new Error("Worktree sidecar is missing or invalid");
30586
+ }
30587
+ const sidecar = sidecarResult.session;
30588
+ const realWorkspace = fs7.realpathSync(workspaceCwd);
30589
+ if (sidecar.workspaceCwd !== void 0) {
30590
+ let realSidecarWorkspace;
30591
+ try {
30592
+ realSidecarWorkspace = fs7.realpathSync(sidecar.workspaceCwd);
30593
+ } catch {
30594
+ throw new Error(
30595
+ "Worktree sidecar workspace is missing or inaccessible"
30596
+ );
30597
+ }
30598
+ if (realSidecarWorkspace !== realWorkspace) {
30599
+ throw new Error(
30600
+ "Worktree sidecar belongs to another workspace"
30601
+ );
30602
+ }
30603
+ }
30604
+ const workspaceRoots = [realWorkspace];
30605
+ let repoTop = null;
30606
+ try {
30607
+ repoTop = await new GitWorktreeService(
30608
+ realWorkspace
30609
+ ).getRepoTopLevel();
30610
+ } catch {
30611
+ }
30612
+ if (repoTop && repoTop !== realWorkspace) {
30613
+ workspaceRoots.push(fs7.realpathSync(repoTop));
30614
+ }
30615
+ let realOriginalCwd;
30616
+ try {
30617
+ realOriginalCwd = fs7.realpathSync(sidecar.originalCwd);
30618
+ } catch {
30619
+ throw new Error(
30620
+ "Worktree sidecar workspace is missing or inaccessible"
30621
+ );
30622
+ }
30623
+ if (!workspaceRoots.includes(realOriginalCwd)) {
30624
+ throw new Error(
30625
+ "Worktree sidecar belongs to another workspace"
30626
+ );
30627
+ }
30628
+ const candidateRoots = workspaceRoots.map(
30629
+ (root) => path12.join(root, ".qwen", "worktrees")
30630
+ );
30631
+ let realTarget;
30632
+ try {
30633
+ realTarget = fs7.realpathSync(sidecar.worktreePath);
30634
+ } catch {
30635
+ throw new Error("Worktree checkout is missing or inaccessible");
30636
+ }
30637
+ const contained = candidateRoots.some((root) => {
30638
+ try {
30639
+ const realRoot = fs7.realpathSync(root);
30640
+ const relative5 = path12.relative(realRoot, realTarget);
30641
+ return relative5.length > 0 && !relative5.startsWith("..") && !path12.isAbsolute(relative5);
30642
+ } catch {
30643
+ return false;
30644
+ }
30645
+ });
30646
+ if (!contained) {
30647
+ throw new Error("Worktree sidecar path failed containment");
30648
+ }
30649
+ const marker = await readWorktreeSessionMarkerStrict(realTarget);
30650
+ if (marker.state !== "valid" || marker.sessionId !== restoredStorageSessionId) {
30651
+ throw new Error("Worktree marker ownership is invalid");
30652
+ }
30653
+ const worktree = {
30654
+ slug: sidecar.slug,
30655
+ path: realTarget,
30656
+ branch: sidecar.worktreeBranch
30657
+ };
30658
+ const hasUnlocatedRestoredPrompt = session.hasActivePrompt && !session.attached && session.currentCwd === void 0;
30659
+ if (hasUnlocatedRestoredPrompt) {
30660
+ runtime.bridge.setSessionWorktree(sessionId, worktree);
30661
+ session.worktree = worktree;
30662
+ } else if (session.hasActivePrompt) {
30663
+ if (session.currentCwd !== realTarget) {
30664
+ throw new Error("Active session is outside its worktree");
30665
+ }
30666
+ } else {
30667
+ const changed = await runtime.bridge.changeSessionCwd(
30668
+ sessionId,
30669
+ {
30670
+ path: realTarget,
30671
+ allowedRoots: candidateRoots
30672
+ }
30673
+ );
30674
+ if (changed.newCwd !== realTarget) {
30675
+ throw new Error("Worktree relocation was rejected");
30676
+ }
30677
+ session.currentCwd = changed.newCwd;
30678
+ }
30679
+ if (!hasUnlocatedRestoredPrompt) {
30680
+ runtime.bridge.setSessionWorktree(sessionId, worktree);
30681
+ assertRuntimeGenerationOpen?.();
30682
+ session.worktree = worktree;
30683
+ session.worktreeState = "persisted-v1";
30684
+ }
30685
+ } catch (restoreErr) {
30686
+ daemonLog?.warn("worktree integrity validation failed", {
30687
+ sessionId: session.sessionId,
30688
+ error: restoreErr instanceof Error ? restoreErr.message : String(restoreErr)
30689
+ });
30690
+ await cleanupRestoredSession();
30691
+ throw restoreErr;
30692
+ }
30201
30693
  }
30202
30694
  }
30203
- res.status(200).json(redactSdkSurfaceReplay(session, runtime.trusted));
30695
+ if (!res.writable) {
30696
+ await cleanupRestoredSession();
30697
+ return;
30698
+ }
30699
+ try {
30700
+ assertRuntimeGenerationOpen?.();
30701
+ } catch (error2) {
30702
+ await cleanupRestoredSession();
30703
+ throw error2;
30704
+ }
30705
+ const deferredRestorePromptAdmitted = deferRestoreAskUserQuestionPrompt && (runtime.bridge.fireDeferredRestoreAskUserQuestionPrompt?.(
30706
+ session.sessionId,
30707
+ session.clientId
30708
+ ) ?? false);
30709
+ if (deferredRestorePromptAdmitted) {
30710
+ session.hasActivePrompt = true;
30711
+ } else if (deferRestoreAskUserQuestionPrompt && action === "load" && !session.attached && !session.hasActivePrompt && runtime.provenance !== "live-conversation") {
30712
+ try {
30713
+ await reconcileDanglingPromptTerminals(
30714
+ createWorkspaceRuntimeSessionService(runtime),
30715
+ sessionId
30716
+ );
30717
+ } catch {
30718
+ }
30719
+ }
30720
+ try {
30721
+ assertRuntimeGenerationOpen?.();
30722
+ } catch (error2) {
30723
+ await cleanupRestoredSession();
30724
+ throw error2;
30725
+ }
30726
+ daemonLog?.info(
30727
+ `session ${action}${session.attached ? " (attached)" : ""}`,
30728
+ { sessionId: session.sessionId, clientId: session.clientId }
30729
+ );
30730
+ const responseSession = withPromptTerminals(
30731
+ session,
30732
+ action === "load" ? readRecentPromptTerminals(
30733
+ createWorkspaceRuntimeSessionService(runtime),
30734
+ sessionId
30735
+ ) : void 0
30736
+ );
30737
+ res.status(200).json(redactSdkSurfaceReplay(responseSession, runtime.trusted));
30204
30738
  } catch (err) {
30205
30739
  if (err instanceof RequestedSessionIdAdmissionError) {
30206
30740
  sendRequestedSessionIdAdmissionError(res, err, route);
@@ -30212,6 +30746,7 @@ function registerSessionRoutes(app, deps) {
30212
30746
  });
30213
30747
  } finally {
30214
30748
  sessionIdReservation?.release();
30749
+ releaseWorktreeRestore?.();
30215
30750
  }
30216
30751
  }, "restoreSessionHandler");
30217
30752
  app.post("/session/:id/load", mutate(), restoreSessionHandler("load"));
@@ -30560,14 +31095,33 @@ function registerSessionRoutes(app, deps) {
30560
31095
  if (limit === null) return;
30561
31096
  const cursor = parseTranscriptCursorQuery(req.query["cursor"], res);
30562
31097
  if (cursor === null) return;
31098
+ const direction = parseTranscriptDirectionQuery(
31099
+ req.query["direction"],
31100
+ res
31101
+ );
31102
+ if (direction === null) return;
30563
31103
  const beforeRecordId = parseTranscriptRecordBoundaryQuery(
30564
31104
  req.query["beforeRecordId"],
30565
31105
  res
30566
31106
  );
30567
31107
  if (beforeRecordId === null) return;
30568
- if (cursor !== void 0 && beforeRecordId !== void 0) {
31108
+ const atRecordId = parseTranscriptTurnAnchorQuery(
31109
+ req.query["atRecordId"],
31110
+ res
31111
+ );
31112
+ if (atRecordId === null) return;
31113
+ const snapshot = parseTranscriptSnapshotQuery(req.query["snapshot"], res);
31114
+ if (snapshot === null) return;
31115
+ if (direction !== void 0 && (cursor !== void 0 || beforeRecordId !== void 0 || atRecordId !== void 0 || snapshot !== void 0) || cursor !== void 0 && (beforeRecordId !== void 0 || atRecordId !== void 0 || snapshot !== void 0) || atRecordId !== void 0 && (beforeRecordId !== void 0 || snapshot === void 0) || snapshot !== void 0 && atRecordId === void 0 && beforeRecordId === void 0) {
30569
31116
  res.status(400).json({
30570
- error: "`cursor` and `beforeRecordId` are mutually exclusive",
31117
+ error: "Invalid transcript cursor and anchor combination",
31118
+ code: "invalid_transcript_cursor"
31119
+ });
31120
+ return;
31121
+ }
31122
+ if (cursor !== void 0 && workspaceTranscriptCursorExceedsLimit(cursor) || snapshot !== void 0 && workspaceTranscriptCursorExceedsLimit(snapshot)) {
31123
+ res.status(400).json({
31124
+ error: "Transcript cursor or snapshot exceeds the maximum size",
30571
31125
  code: "invalid_transcript_cursor"
30572
31126
  });
30573
31127
  return;
@@ -30581,26 +31135,36 @@ function registerSessionRoutes(app, deps) {
30581
31135
  res,
30582
31136
  route,
30583
31137
  sessionId,
30584
- cursor !== void 0
31138
+ cursor !== void 0 || snapshot !== void 0
30585
31139
  );
30586
31140
  if (!runtime) return void 0;
30587
31141
  workspaceTrusted = runtime.trusted;
30588
- captureRuntimeGenerationAssertion(runtime)?.();
30589
- return runtime.bridge.getSessionTranscriptPage({
31142
+ const assertRuntimeGenerationOpen = captureRuntimeGenerationAssertion(runtime);
31143
+ assertRuntimeGenerationOpen?.();
31144
+ const page = await runtime.bridge.getSessionTranscriptPage({
30590
31145
  sessionId,
30591
31146
  ...limit !== void 0 ? { limit } : {},
30592
31147
  ...cursor !== void 0 ? { cursor } : {},
30593
- ...beforeRecordId !== void 0 ? { beforeRecordId } : {}
31148
+ ...direction !== void 0 ? { direction } : {},
31149
+ ...beforeRecordId !== void 0 ? { beforeRecordId } : {},
31150
+ ...atRecordId !== void 0 ? { atRecordId } : {},
31151
+ ...snapshot !== void 0 ? { snapshot } : {}
30594
31152
  });
31153
+ assertRuntimeGenerationOpen?.();
31154
+ return page;
30595
31155
  }
30596
31156
  );
30597
31157
  if (result === void 0) return;
30598
- res.status(200).set("Cache-Control", "no-store").json({
30599
- ...result,
30600
- events: (result.events ?? []).map(
30601
- (event) => redactSdkSurfaceEvent(event, workspaceTrusted)
30602
- )
30603
- });
31158
+ const serialized = serializeWorkspaceTranscriptResponse(
31159
+ {
31160
+ ...result,
31161
+ events: (result.events ?? []).map(
31162
+ (event) => redactSdkSurfaceEvent(event, workspaceTrusted)
31163
+ )
31164
+ },
31165
+ sessionId
31166
+ );
31167
+ res.status(200).set("Cache-Control", "no-store").type("application/json").send(serialized);
30604
31168
  } catch (err) {
30605
31169
  sendBridgeError2(res, err, {
30606
31170
  route,
@@ -30621,21 +31185,33 @@ function registerSessionRoutes(app, deps) {
30621
31185
  if (limit === null) return;
30622
31186
  const cursor = parseTranscriptCursorQuery(req.query["cursor"], res);
30623
31187
  if (cursor === null) return;
31188
+ const direction = parseTranscriptDirectionQuery(
31189
+ req.query["direction"],
31190
+ res
31191
+ );
31192
+ if (direction === null) return;
30624
31193
  const beforeRecordId = parseTranscriptRecordBoundaryQuery(
30625
31194
  req.query["beforeRecordId"],
30626
31195
  res
30627
31196
  );
30628
31197
  if (beforeRecordId === null) return;
30629
- if (cursor !== void 0 && beforeRecordId !== void 0) {
31198
+ const atRecordId = parseTranscriptTurnAnchorQuery(
31199
+ req.query["atRecordId"],
31200
+ res
31201
+ );
31202
+ if (atRecordId === null) return;
31203
+ const snapshot = parseTranscriptSnapshotQuery(req.query["snapshot"], res);
31204
+ if (snapshot === null) return;
31205
+ if (direction !== void 0 && (cursor !== void 0 || beforeRecordId !== void 0 || atRecordId !== void 0 || snapshot !== void 0) || cursor !== void 0 && (beforeRecordId !== void 0 || atRecordId !== void 0 || snapshot !== void 0) || atRecordId !== void 0 && (beforeRecordId !== void 0 || snapshot === void 0) || snapshot !== void 0 && atRecordId === void 0 && beforeRecordId === void 0) {
30630
31206
  res.status(400).json({
30631
- error: "`cursor` and `beforeRecordId` are mutually exclusive",
31207
+ error: "Invalid transcript cursor and anchor combination",
30632
31208
  code: "invalid_transcript_cursor"
30633
31209
  });
30634
31210
  return;
30635
31211
  }
30636
- if (cursor !== void 0 && workspaceTranscriptCursorExceedsLimit(cursor)) {
31212
+ if (cursor !== void 0 && workspaceTranscriptCursorExceedsLimit(cursor) || snapshot !== void 0 && workspaceTranscriptCursorExceedsLimit(snapshot)) {
30637
31213
  res.status(400).json({
30638
- error: "`cursor` exceeds the maximum size",
31214
+ error: "Transcript cursor or snapshot exceeds the maximum size",
30639
31215
  code: "invalid_transcript_cursor"
30640
31216
  });
30641
31217
  return;
@@ -30668,28 +31244,51 @@ function registerSessionRoutes(app, deps) {
30668
31244
  runtime.workspaceCwd,
30669
31245
  codec
30670
31246
  );
30671
- const hasActivePrompt = /* @__PURE__ */ __name(() => {
31247
+ const getLivePromptState = /* @__PURE__ */ __name(() => {
30672
31248
  try {
30673
- return runtime.bridge.getSessionSummary(sessionId).hasActivePrompt;
31249
+ return {
31250
+ live: true,
31251
+ activePrompt: runtime.bridge.getSessionSummary(sessionId).hasActivePrompt
31252
+ };
30674
31253
  } catch (error2) {
30675
- if (error2 instanceof SessionNotFoundError) return false;
31254
+ if (error2 instanceof SessionNotFoundError) {
31255
+ return { live: false, activePrompt: false };
31256
+ }
30676
31257
  throw error2;
30677
31258
  }
30678
- }, "hasActivePrompt");
30679
- const activePromptBeforeRead = hasActivePrompt();
31259
+ }, "getLivePromptState");
31260
+ const promptStateBeforeRead = getLivePromptState();
31261
+ if (cursor === void 0 && direction === "backward" && promptStateBeforeRead.live) {
31262
+ try {
31263
+ if (runtime.bridge.flushSessionTranscript) {
31264
+ await runtime.bridge.flushSessionTranscript(sessionId);
31265
+ } else {
31266
+ await runtime.bridge.getSessionTranscriptPage({
31267
+ sessionId,
31268
+ direction,
31269
+ limit: 1
31270
+ });
31271
+ }
31272
+ } catch (error2) {
31273
+ if (!(error2 instanceof SessionNotFoundError)) throw error2;
31274
+ }
31275
+ }
30680
31276
  let page;
30681
31277
  try {
30682
31278
  page = await reader.readPage(sessionId, {
30683
31279
  ...limit !== void 0 ? { limit } : {},
30684
31280
  ...cursor !== void 0 ? { cursor } : {},
31281
+ ...direction !== void 0 ? { direction } : {},
30685
31282
  ...beforeRecordId !== void 0 ? { beforeRecordId } : {},
31283
+ ...atRecordId !== void 0 ? { atRecordId } : {},
31284
+ ...snapshot !== void 0 ? { snapshot } : {},
30686
31285
  maxBytes: SESSION_TRANSCRIPT_MAX_PAGE_BYTES
30687
31286
  });
30688
31287
  } catch (error2) {
30689
31288
  if (error2.code !== "ENOENT") {
30690
31289
  throw error2;
30691
31290
  }
30692
- if (cursor !== void 0) {
31291
+ if (cursor !== void 0 || snapshot !== void 0) {
30693
31292
  throw new SessionTranscriptSnapshotUnavailableError(sessionId);
30694
31293
  }
30695
31294
  const location = await service.getSessionLocation(sessionId);
@@ -30704,11 +31303,11 @@ function registerSessionRoutes(app, deps) {
30704
31303
  if (page.records.some((record) => record.sessionId !== sessionId)) {
30705
31304
  throw new SessionTranscriptSnapshotUnavailableError(sessionId);
30706
31305
  }
30707
- const activePromptAfterRead = hasActivePrompt();
31306
+ const activePromptAfterRead = getLivePromptState().activePrompt;
30708
31307
  const replay = await replayTranscriptRecordPage({
30709
31308
  sessionId,
30710
31309
  page,
30711
- finalizeDangling: !activePromptBeforeRead && !activePromptAfterRead,
31310
+ finalizeDangling: !promptStateBeforeRead.activePrompt && !activePromptAfterRead,
30712
31311
  encodeCursor: /* @__PURE__ */ __name((state) => codec.encode(state), "encodeCursor")
30713
31312
  });
30714
31313
  assertRuntimeGenerationOpen?.();
@@ -30733,7 +31332,9 @@ function registerSessionRoutes(app, deps) {
30733
31332
  ...replay.partial || cursorTooLarge ? {
30734
31333
  partial: true,
30735
31334
  replayError: cursorTooLarge ? TRANSCRIPT_CURSOR_TOO_LARGE_REPLAY_ERROR : replay.replayError
30736
- } : {}
31335
+ } : {},
31336
+ ...page.targetRecordId ? { targetRecordId: page.targetRecordId } : {},
31337
+ ...page.hasOlder !== void 0 ? { hasOlder: page.hasOlder } : {}
30737
31338
  };
30738
31339
  });
30739
31340
  })
@@ -30748,6 +31349,155 @@ function registerSessionRoutes(app, deps) {
30748
31349
  sendBridgeError2(res, err, { route, sessionId });
30749
31350
  }
30750
31351
  });
31352
+ app.get("/session/:id/turn-index", async (req, res) => {
31353
+ const route = "GET /session/:id/turn-index";
31354
+ const sessionId = requireSessionId(req, res);
31355
+ if (sessionId === null) return;
31356
+ const limit = parseTranscriptLimitQuery(req.query["limit"], res);
31357
+ if (limit === null) return;
31358
+ const snapshot = parseTranscriptSnapshotQuery(req.query["snapshot"], res);
31359
+ if (snapshot === null) return;
31360
+ const start = parseTranscriptStartQuery(req.query["start"], res);
31361
+ if (start === null) return;
31362
+ if (start !== void 0 && snapshot === void 0) {
31363
+ res.status(400).json({
31364
+ error: "`start` requires `snapshot`",
31365
+ code: "invalid_transcript_cursor"
31366
+ });
31367
+ return;
31368
+ }
31369
+ if (snapshot !== void 0 && workspaceTranscriptCursorExceedsLimit(snapshot)) {
31370
+ res.status(400).json({
31371
+ error: "`snapshot` exceeds the maximum size",
31372
+ code: "invalid_transcript_cursor"
31373
+ });
31374
+ return;
31375
+ }
31376
+ try {
31377
+ const result = await archiveCoordinator.runSharedMany(
31378
+ [sessionId],
31379
+ async () => {
31380
+ const runtime = await resolveTranscriptSessionRuntime(
31381
+ res,
31382
+ route,
31383
+ sessionId,
31384
+ snapshot !== void 0
31385
+ );
31386
+ if (!runtime) return void 0;
31387
+ const assertRuntimeGenerationOpen = captureRuntimeGenerationAssertion(runtime);
31388
+ assertRuntimeGenerationOpen?.();
31389
+ const page = await runtime.bridge.getSessionTurnIndexPage({
31390
+ sessionId,
31391
+ ...snapshot !== void 0 ? { snapshot } : {},
31392
+ ...start !== void 0 ? { start } : {},
31393
+ ...limit !== void 0 ? { limit } : {}
31394
+ });
31395
+ assertRuntimeGenerationOpen?.();
31396
+ return page;
31397
+ }
31398
+ );
31399
+ if (result === void 0) return;
31400
+ const serialized = serializeWorkspaceTranscriptResponse(
31401
+ result,
31402
+ sessionId
31403
+ );
31404
+ res.status(200).set("Cache-Control", "no-store").type("application/json").send(serialized);
31405
+ } catch (err) {
31406
+ sendBridgeError2(res, err, { route, sessionId });
31407
+ }
31408
+ });
31409
+ app.get("/workspaces/:workspace/session/:id/turn-index", async (req, res) => {
31410
+ const route = "GET /workspaces/:workspace/session/:id/turn-index";
31411
+ const sessionId = requireSessionId(req, res);
31412
+ if (sessionId === null) return;
31413
+ const qualifiedTarget = resolveQualifiedSessionTarget(req, res, {
31414
+ allowUntrustedSecondary: true
31415
+ });
31416
+ if (!qualifiedTarget) return;
31417
+ const preResolvedRuntime = qualifiedTarget.kind === "ordinary" ? qualifiedTarget.runtime : void 0;
31418
+ const limit = parseTranscriptLimitQuery(req.query["limit"], res);
31419
+ if (limit === null) return;
31420
+ const snapshot = parseTranscriptSnapshotQuery(req.query["snapshot"], res);
31421
+ if (snapshot === null) return;
31422
+ const start = parseTranscriptStartQuery(req.query["start"], res);
31423
+ if (start === null) return;
31424
+ if (start !== void 0 && snapshot === void 0) {
31425
+ res.status(400).json({
31426
+ error: "`start` requires `snapshot`",
31427
+ code: "invalid_transcript_cursor"
31428
+ });
31429
+ return;
31430
+ }
31431
+ if (snapshot !== void 0 && workspaceTranscriptCursorExceedsLimit(snapshot)) {
31432
+ res.status(400).json({
31433
+ error: "`snapshot` exceeds the maximum size",
31434
+ code: "invalid_transcript_cursor"
31435
+ });
31436
+ return;
31437
+ }
31438
+ try {
31439
+ const result = await runWithoutDebugLogSession(
31440
+ () => archiveCoordinator.runSharedMany([sessionId], async () => {
31441
+ const runtime = preResolvedRuntime ?? await resolveQualifiedSessionRuntime(
31442
+ req,
31443
+ res,
31444
+ route,
31445
+ [sessionId],
31446
+ "active"
31447
+ );
31448
+ if (!runtime) return void 0;
31449
+ const assertRuntimeGenerationOpen = captureRuntimeGenerationAssertion(runtime);
31450
+ assertRuntimeGenerationOpen?.();
31451
+ return runWithWorkspaceRuntimeStorage(runtime, async () => {
31452
+ if (snapshot === void 0) {
31453
+ await assertSessionLoadable(
31454
+ runtime.workspaceCwd,
31455
+ sessionId,
31456
+ runtime.sessionRuntimeBaseDir,
31457
+ { allowActiveConflict: true }
31458
+ );
31459
+ }
31460
+ try {
31461
+ const page = await new SessionTranscriptReader(
31462
+ runtime.workspaceCwd,
31463
+ getTranscriptCursorCodec(runtime)
31464
+ ).readTurnIndexPage(sessionId, {
31465
+ ...snapshot !== void 0 ? { snapshot } : {},
31466
+ ...start !== void 0 ? { start } : {},
31467
+ ...limit !== void 0 ? { limit } : {}
31468
+ });
31469
+ assertRuntimeGenerationOpen?.();
31470
+ return page;
31471
+ } catch (error2) {
31472
+ if (error2.code !== "ENOENT") {
31473
+ throw error2;
31474
+ }
31475
+ if (snapshot !== void 0) {
31476
+ throw new SessionTranscriptSnapshotUnavailableError(sessionId);
31477
+ }
31478
+ const service = createWorkspaceRuntimeSessionService(runtime);
31479
+ const location = await service.getSessionLocation(sessionId);
31480
+ if (location === "archived") {
31481
+ throw new SessionArchivedError(sessionId);
31482
+ }
31483
+ if (location === "conflict") {
31484
+ throw new SessionConflictError(sessionId);
31485
+ }
31486
+ throw new SessionNotFoundError(sessionId);
31487
+ }
31488
+ });
31489
+ })
31490
+ );
31491
+ if (result === void 0) return;
31492
+ const serialized = serializeWorkspaceTranscriptResponse(
31493
+ result,
31494
+ sessionId
31495
+ );
31496
+ res.status(200).set("Cache-Control", "no-store").type("application/json").send(serialized);
31497
+ } catch (err) {
31498
+ sendBridgeError2(res, err, { route, sessionId });
31499
+ }
31500
+ });
30751
31501
  app.get(
30752
31502
  "/session/:id/context",
30753
31503
  async (req, res, next) => {
@@ -30869,6 +31619,52 @@ function registerSessionRoutes(app, deps) {
30869
31619
  }
30870
31620
  )
30871
31621
  );
31622
+ app.get(
31623
+ "/session/:id/agents",
31624
+ withOwnerReadSession(
31625
+ "GET /session/:id/agents",
31626
+ async (_req, res, sessionId, runtime) => {
31627
+ res.status(200).json(await runtime.bridge.getSessionAgentsStatus(sessionId));
31628
+ }
31629
+ )
31630
+ );
31631
+ app.get(
31632
+ "/session/:id/agent-trace",
31633
+ withOwnerReadSession(
31634
+ "GET /session/:id/agent-trace",
31635
+ async (req, res, sessionId, runtime) => {
31636
+ const rootAgentId = req.query["rootAgentId"];
31637
+ if (rootAgentId !== void 0 && (typeof rootAgentId !== "string" || rootAgentId.length === 0 || rootAgentId.length > MAX_VIRTUAL_SESSION_ID_PART_LENGTH)) {
31638
+ res.status(400).json({
31639
+ error: "`rootAgentId` must be a non-empty agent id",
31640
+ code: "invalid_root_agent_id"
31641
+ });
31642
+ return;
31643
+ }
31644
+ res.status(200).json(
31645
+ await runtime.bridge.getSessionAgentTrace(sessionId, rootAgentId)
31646
+ );
31647
+ }
31648
+ )
31649
+ );
31650
+ app.get(
31651
+ "/session/:id/saved-workflows/:name",
31652
+ withOwnerReadSession(
31653
+ "GET /session/:id/saved-workflows/:name",
31654
+ async (req, res, sessionId, runtime) => {
31655
+ const name = req.params["name"];
31656
+ if (!name) {
31657
+ res.status(400).json({
31658
+ error: "`name` route parameter is required"
31659
+ });
31660
+ return;
31661
+ }
31662
+ res.status(200).json(
31663
+ runtime.trusted ? await runtime.bridge.getSessionSavedWorkflow(sessionId, name) : { v: 1, sessionId, name, workflow: null }
31664
+ );
31665
+ }
31666
+ )
31667
+ );
30872
31668
  app.get(
30873
31669
  "/session/:id/lsp",
30874
31670
  withOwnerReadSession(
@@ -30878,6 +31674,15 @@ function registerSessionRoutes(app, deps) {
30878
31674
  }
30879
31675
  )
30880
31676
  );
31677
+ app.get(
31678
+ "/session/:id/resources",
31679
+ withOwnerReadSession(
31680
+ "GET /session/:id/resources",
31681
+ async (_req, res, sessionId, runtime) => {
31682
+ res.status(200).json(await runtime.bridge.getSessionResourcesStatus(sessionId));
31683
+ }
31684
+ )
31685
+ );
30881
31686
  app.get(
30882
31687
  "/session/:id/hooks",
30883
31688
  withOwnerReadSession(
@@ -31187,6 +31992,21 @@ function registerSessionRoutes(app, deps) {
31187
31992
  }
31188
31993
  )
31189
31994
  );
31995
+ app.get(
31996
+ "/session/:id/attachments",
31997
+ withOwnerReadSession(
31998
+ "GET /session/:id/attachments",
31999
+ async (req, res, sessionId, runtime) => {
32000
+ const clientId = parseClientIdHeader(req, res);
32001
+ if (clientId === null) return;
32002
+ const attachments = await runtime.bridge.listSessionAttachments(
32003
+ sessionId,
32004
+ clientId !== void 0 ? { clientId } : void 0
32005
+ );
32006
+ res.status(200).json({ attachments });
32007
+ }
32008
+ )
32009
+ );
31190
32010
  app.get(
31191
32011
  "/session/:id/attachments/:attachmentId",
31192
32012
  withOwnerReadSession(
@@ -35656,6 +36476,7 @@ var TUI_ONLY_SETTINGS = /* @__PURE__ */ new Set([
35656
36476
  "general.outputLanguage",
35657
36477
  "ide.enabled",
35658
36478
  "ui.showLineNumbers",
36479
+ "ui.showToolCallArgs",
35659
36480
  "ui.renderMode",
35660
36481
  "ui.useTerminalBuffer",
35661
36482
  "ui.mouseTracking",
@@ -35679,13 +36500,15 @@ var QUALIFIED_WRITE_SCOPES = /* @__PURE__ */ new Set(["workspace"]);
35679
36500
  var mcpServerMutationQueues = /* @__PURE__ */ new Map();
35680
36501
  var SECURITY_SENSITIVE_SETTINGS = /* @__PURE__ */ new Set(["tools.approvalMode"]);
35681
36502
  function rejectWorkspaceRestrictedWrite(res, scope, key) {
35682
- if (scope !== "workspace" || !WORKSPACE_RESTRICTED_SETTING_KEYS.includes(key))
35683
- return false;
35684
- res.status(400).json({
35685
- error: `Setting "${key}" is not honored from workspace scope; set it at user scope instead`,
35686
- code: "workspace_restricted_setting"
35687
- });
35688
- return true;
36503
+ if (scope !== "workspace") return false;
36504
+ if (WORKSPACE_RESTRICTED_SETTING_KEYS.includes(key)) {
36505
+ res.status(400).json({
36506
+ error: `Setting "${key}" is not honored from workspace scope; set it at user scope instead`,
36507
+ code: "workspace_restricted_setting"
36508
+ });
36509
+ return true;
36510
+ }
36511
+ return false;
35689
36512
  }
35690
36513
  __name(rejectWorkspaceRestrictedWrite, "rejectWorkspaceRestrictedWrite");
35691
36514
  function getAllowedKeys(includeLiveVoice = false) {
@@ -36678,6 +37501,14 @@ function sendBridgeError(res, err, ctx, daemonLog) {
36678
37501
  });
36679
37502
  return;
36680
37503
  }
37504
+ if (err instanceof InvalidSessionTranscriptTurnAnchorError) {
37505
+ res.status(400).json({
37506
+ error: err.message,
37507
+ code: "invalid_turn_anchor",
37508
+ ...ctx?.sessionId ? { sessionId: ctx.sessionId } : {}
37509
+ });
37510
+ return;
37511
+ }
36681
37512
  if (err instanceof SessionTranscriptSnapshotUnavailableError) {
36682
37513
  res.status(409).json({
36683
37514
  error: err.message,
@@ -37124,6 +37955,13 @@ function sendBridgeError(res, err, ctx, daemonLog) {
37124
37955
  });
37125
37956
  return;
37126
37957
  }
37958
+ if (kind === "invalid_turn_anchor") {
37959
+ res.status(400).json({
37960
+ error: errorMessage(err),
37961
+ code: "invalid_turn_anchor"
37962
+ });
37963
+ return;
37964
+ }
37127
37965
  if (kind === "transcript_snapshot_unavailable") {
37128
37966
  const d = data;
37129
37967
  res.status(409).json({
@@ -39146,6 +39984,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
39146
39984
  }
39147
39985
  try {
39148
39986
  workspaceRegistry.completeDrain(runtime);
39987
+ deps.onWorkspaceRemoved?.(runtime.workspaceCwd);
39149
39988
  } catch (error2) {
39150
39989
  failures.push(error2);
39151
39990
  }
@@ -40078,6 +40917,7 @@ function registerWorkspaceManagementRoutes(app, deps) {
40078
40917
  }
40079
40918
  try {
40080
40919
  workspaceRegistry.completeDrain(runtime);
40920
+ deps.onWorkspaceRemoved?.(runtime.workspaceCwd);
40081
40921
  } catch (err) {
40082
40922
  logCleanupFailure(
40083
40923
  `qwen serve: failed to complete workspace registry drain: ${err instanceof Error ? err.message : String(err)}`
@@ -43759,6 +44599,48 @@ __name(registerWorkspaceQualifiedToolsRoutes, "registerWorkspaceQualifiedToolsRo
43759
44599
  // packages/cli/src/serve/routes/workspace-skills.ts
43760
44600
  init_esbuild_shims();
43761
44601
  var MAX_WORKSPACE_SKILL_BATCH_SIZE = 100;
44602
+ var skillConfigMutationLocks = new PathMutexRegistry();
44603
+ function reconcileSkills(runtimes) {
44604
+ let reconciling = false;
44605
+ for (const runtime of runtimes) {
44606
+ runtime.workspaceService.invalidateWorkspaceSkillsStatus();
44607
+ if (!runtime.trusted) continue;
44608
+ const coordinator = getWorkspaceRuntimeCoordinatorIfSupported(runtime);
44609
+ if (coordinator?.reconcileSkillsConfiguration() === "reconciling") {
44610
+ reconciling = true;
44611
+ }
44612
+ }
44613
+ return reconciling ? "reconciling" : "deferred";
44614
+ }
44615
+ __name(reconcileSkills, "reconcileSkills");
44616
+ function rejectQualifiedGlobalScope(scope, res) {
44617
+ if (scope !== "global") return false;
44618
+ res.status(400).json({
44619
+ error: "Global Skill scope must use /workspace/config/skills",
44620
+ code: "global_scope_requires_singular_owner"
44621
+ });
44622
+ return true;
44623
+ }
44624
+ __name(rejectQualifiedGlobalScope, "rejectQualifiedGlobalScope");
44625
+ function rejectSingularWorkspaceScope(scope, res) {
44626
+ if (scope !== "workspace") return false;
44627
+ res.status(400).json({
44628
+ error: "Workspace Skill scope must use /workspaces/:workspace/config/skills",
44629
+ code: "workspace_scope_requires_qualified_workspace"
44630
+ });
44631
+ return true;
44632
+ }
44633
+ __name(rejectSingularWorkspaceScope, "rejectSingularWorkspaceScope");
44634
+ function requireRuntimeCoordinator3(runtime, res) {
44635
+ const coordinator = getWorkspaceRuntimeCoordinatorIfSupported(runtime);
44636
+ if (coordinator) return coordinator;
44637
+ res.status(501).json({
44638
+ error: "Workspace runtime lifecycle is not supported",
44639
+ code: "workspace_runtime_not_supported"
44640
+ });
44641
+ return null;
44642
+ }
44643
+ __name(requireRuntimeCoordinator3, "requireRuntimeCoordinator");
43762
44644
  function rejectSkillNameTooLong(skillName, res) {
43763
44645
  if (skillName.length <= MAX_WORKSPACE_SKILL_NAME_LENGTH) return false;
43764
44646
  res.status(400).json({
@@ -43891,6 +44773,10 @@ function parseDeleteScope(req, res) {
43891
44773
  }
43892
44774
  __name(parseDeleteScope, "parseDeleteScope");
43893
44775
  function sendSkillManagementError(res, error2) {
44776
+ if (error2 instanceof WorkspaceSkillNotFoundError) {
44777
+ res.status(404).json({ error: error2.message, code: "skill_not_found" });
44778
+ return true;
44779
+ }
43894
44780
  if (!(error2 instanceof WorkspaceSkillManagementError)) return false;
43895
44781
  res.status(error2.statusCode).json({
43896
44782
  error: error2.message,
@@ -43899,10 +44785,179 @@ function sendSkillManagementError(res, error2) {
43899
44785
  return true;
43900
44786
  }
43901
44787
  __name(sendSkillManagementError, "sendSkillManagementError");
44788
+ async function deleteConfiguredSkill(deps, workspaceCwd, trusted, skillName, scope) {
44789
+ deps.invalidateSkillsConfigStatus(workspaceCwd);
44790
+ const status = await deps.getSkillsConfigStatus(workspaceCwd, trusted);
44791
+ if (!status.initialized || status.errors?.length) {
44792
+ throw new WorkspaceSkillManagementError(
44793
+ "skills_config_unavailable",
44794
+ "Skills configuration could not be enumerated",
44795
+ 503
44796
+ );
44797
+ }
44798
+ const normalizedName = skillName.trim().toLowerCase();
44799
+ const matches = status.skills.filter(
44800
+ (candidate) => candidate.name.trim().toLowerCase() === normalizedName
44801
+ );
44802
+ if (matches.length === 0) {
44803
+ throw new WorkspaceSkillManagementError(
44804
+ "skill_not_found",
44805
+ `Skill not found: ${skillName}`,
44806
+ 404
44807
+ );
44808
+ }
44809
+ const expectedLevel = scope === "workspace" ? "project" : "user";
44810
+ const scopedMatches = matches.filter(
44811
+ (candidate) => candidate.level === expectedLevel
44812
+ );
44813
+ const skill = scopedMatches.find((candidate) => candidate.name === skillName.trim()) ?? (scopedMatches.length === 1 ? scopedMatches[0] : void 0);
44814
+ if (!skill?.installedPath) {
44815
+ throw new WorkspaceSkillManagementError(
44816
+ "skill_not_managed",
44817
+ "Skill is not managed in the requested scope",
44818
+ 409
44819
+ );
44820
+ }
44821
+ try {
44822
+ return await deps.deleteSkillConfig(
44823
+ workspaceCwd,
44824
+ scope,
44825
+ skill.name,
44826
+ skill.installedPath
44827
+ );
44828
+ } catch (error2) {
44829
+ if (error2.code === "ENOENT") {
44830
+ throw new WorkspaceSkillManagementError(
44831
+ "skill_not_found",
44832
+ `Skill not found: ${skillName}`,
44833
+ 404
44834
+ );
44835
+ }
44836
+ throw error2;
44837
+ }
44838
+ }
44839
+ __name(deleteConfiguredSkill, "deleteConfiguredSkill");
43902
44840
  function registerWorkspaceSkillsRoutes(app, deps) {
43903
44841
  const buildWorkspaceCtx = createBuildWorkspaceCtx(
43904
44842
  deps.workspaceRuntime.workspaceCwd
43905
44843
  );
44844
+ const globalConfigOwner = /* @__PURE__ */ __name(() => {
44845
+ const entry = deps.workspaceRegistry?.primaryEntry;
44846
+ return {
44847
+ workspaceCwd: entry?.workspaceCwd ?? deps.workspaceRuntime.workspaceCwd,
44848
+ trusted: entry ? entry.state === "active" && entry.current?.runtime.trusted === true : deps.workspaceRuntime.trusted
44849
+ };
44850
+ }, "globalConfigOwner");
44851
+ const invalidateGlobalConfigStatus = /* @__PURE__ */ __name((ownerWorkspaceCwd) => {
44852
+ const entries = deps.workspaceRegistry?.listAllEntries();
44853
+ if (!entries) {
44854
+ deps.invalidateSkillsConfigStatus(ownerWorkspaceCwd);
44855
+ return;
44856
+ }
44857
+ for (const entry of entries) {
44858
+ deps.invalidateSkillsConfigStatus(entry.workspaceCwd);
44859
+ }
44860
+ }, "invalidateGlobalConfigStatus");
44861
+ app.get("/workspace/config/skills", async (_req, res) => {
44862
+ const configRoute = "GET /workspace/config/skills";
44863
+ try {
44864
+ const owner = globalConfigOwner();
44865
+ res.status(200).json(
44866
+ await deps.getSkillsConfigStatus(owner.workspaceCwd, owner.trusted)
44867
+ );
44868
+ } catch (error2) {
44869
+ deps.sendBridgeError(res, error2, { route: configRoute });
44870
+ }
44871
+ });
44872
+ app.get("/workspace/runtime/skills", async (_req, res) => {
44873
+ if (!requireTrustedWorkspaceRuntime(deps.workspaceRuntime, res)) return;
44874
+ const runtimeRoute = "GET /workspace/runtime/skills";
44875
+ try {
44876
+ res.status(200).json(
44877
+ await deps.workspaceRuntime.workspaceService.getWorkspaceSkillsRuntimeStatus(
44878
+ buildWorkspaceCtx(runtimeRoute)
44879
+ )
44880
+ );
44881
+ } catch (error2) {
44882
+ deps.sendBridgeError(res, error2, { route: runtimeRoute });
44883
+ }
44884
+ });
44885
+ app.post(
44886
+ "/workspace/config/skills/install",
44887
+ deps.mutate({ strict: true }),
44888
+ async (req, res) => {
44889
+ const owner = globalConfigOwner();
44890
+ if (!owner.trusted) {
44891
+ sendUntrustedWorkspaceResponse(res);
44892
+ return;
44893
+ }
44894
+ const input = parseSkillInstallRequest(req, res, deps.safeBody);
44895
+ if (!input || rejectSingularWorkspaceScope(input.scope, res)) return;
44896
+ const configRoute = "POST /workspace/config/skills/install";
44897
+ try {
44898
+ const result = await skillConfigMutationLocks.runExclusive(
44899
+ `global\0${input.name.trim().toLowerCase()}`,
44900
+ () => deps.installSkillConfig(owner.workspaceCwd, input)
44901
+ );
44902
+ invalidateGlobalConfigStatus(owner.workspaceCwd);
44903
+ const runtimes = deps.workspaceRegistry?.listManaged() ?? [
44904
+ deps.workspaceRuntime
44905
+ ];
44906
+ res.status(200).json({
44907
+ ...result,
44908
+ activation: reconcileSkills(runtimes)
44909
+ });
44910
+ } catch (error2) {
44911
+ invalidateGlobalConfigStatus(owner.workspaceCwd);
44912
+ if (!sendSkillManagementError(res, error2)) {
44913
+ deps.sendBridgeError(res, error2, { route: configRoute });
44914
+ }
44915
+ }
44916
+ }
44917
+ );
44918
+ app.delete(
44919
+ "/workspace/config/skills/:name",
44920
+ deps.mutate({ strict: true }),
44921
+ async (req, res) => {
44922
+ const owner = globalConfigOwner();
44923
+ if (!owner.trusted) {
44924
+ sendUntrustedWorkspaceResponse(res);
44925
+ return;
44926
+ }
44927
+ const scope = parseDeleteScope(req, res);
44928
+ const rawSkillName = req.params["name"];
44929
+ if (!rawSkillName || !scope || rejectSingularWorkspaceScope(scope, res)) {
44930
+ return;
44931
+ }
44932
+ const configRoute = "DELETE /workspace/config/skills/:name";
44933
+ try {
44934
+ const skillName = validateWorkspaceSkillName(rawSkillName);
44935
+ const result = await skillConfigMutationLocks.runExclusive(
44936
+ `global\0${skillName.toLowerCase()}`,
44937
+ () => deleteConfiguredSkill(
44938
+ deps,
44939
+ owner.workspaceCwd,
44940
+ owner.trusted,
44941
+ skillName,
44942
+ scope
44943
+ )
44944
+ );
44945
+ invalidateGlobalConfigStatus(owner.workspaceCwd);
44946
+ const runtimes = deps.workspaceRegistry?.listManaged() ?? [
44947
+ deps.workspaceRuntime
44948
+ ];
44949
+ res.status(200).json({
44950
+ ...result,
44951
+ activation: reconcileSkills(runtimes)
44952
+ });
44953
+ } catch (error2) {
44954
+ invalidateGlobalConfigStatus(owner.workspaceCwd);
44955
+ if (!sendSkillManagementError(res, error2)) {
44956
+ deps.sendBridgeError(res, error2, { route: configRoute });
44957
+ }
44958
+ }
44959
+ }
44960
+ );
43906
44961
  const route = "POST /workspace/skills/:name/enable";
43907
44962
  const batchRoute = "POST /workspace/skills/enable";
43908
44963
  app.post(
@@ -43916,12 +44971,17 @@ function registerWorkspaceSkillsRoutes(app, deps) {
43916
44971
  if (clientId === null) return;
43917
44972
  const installRoute = "POST /workspace/skills/install";
43918
44973
  try {
43919
- const result = await deps.workspaceRuntime.workspaceService.installWorkspaceSkill(
43920
- buildWorkspaceCtx(installRoute, clientId),
43921
- input
44974
+ const result = await skillConfigMutationLocks.runExclusive(
44975
+ input.scope === "global" ? `global\0${input.name.trim().toLowerCase()}` : `workspace\0${deps.workspaceRuntime.workspaceCwd}\0${input.name.trim().toLowerCase()}`,
44976
+ () => deps.workspaceRuntime.workspaceService.installWorkspaceSkill(
44977
+ buildWorkspaceCtx(installRoute, clientId),
44978
+ input
44979
+ )
43922
44980
  );
44981
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43923
44982
  res.status(200).json(result);
43924
44983
  } catch (err) {
44984
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43925
44985
  if (!sendSkillManagementError(res, err))
43926
44986
  deps.sendBridgeError(res, err, { route: installRoute });
43927
44987
  }
@@ -43946,13 +45006,18 @@ function registerWorkspaceSkillsRoutes(app, deps) {
43946
45006
  if (clientId === null) return;
43947
45007
  const deleteRoute = "DELETE /workspace/skills/:name";
43948
45008
  try {
43949
- const result = await deps.workspaceRuntime.workspaceService.deleteWorkspaceSkill(
43950
- buildWorkspaceCtx(deleteRoute, clientId),
43951
- skillName,
43952
- scope
45009
+ const result = await skillConfigMutationLocks.runExclusive(
45010
+ scope === "global" ? `global\0${skillName.toLowerCase()}` : `workspace\0${deps.workspaceRuntime.workspaceCwd}\0${skillName.toLowerCase()}`,
45011
+ () => deps.workspaceRuntime.workspaceService.deleteWorkspaceSkill(
45012
+ buildWorkspaceCtx(deleteRoute, clientId),
45013
+ skillName,
45014
+ scope
45015
+ )
43953
45016
  );
45017
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43954
45018
  res.status(200).json(result);
43955
45019
  } catch (err) {
45020
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43956
45021
  if (!sendSkillManagementError(res, err))
43957
45022
  deps.sendBridgeError(res, err, { route: deleteRoute });
43958
45023
  }
@@ -43973,8 +45038,10 @@ function registerWorkspaceSkillsRoutes(app, deps) {
43973
45038
  input.skillNames,
43974
45039
  input.enabled
43975
45040
  );
45041
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43976
45042
  res.status(200).json(result);
43977
45043
  } catch (err) {
45044
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43978
45045
  deps.sendBridgeError(res, err, { route: batchRoute });
43979
45046
  }
43980
45047
  }
@@ -43994,8 +45061,10 @@ function registerWorkspaceSkillsRoutes(app, deps) {
43994
45061
  input.skillName,
43995
45062
  input.enabled
43996
45063
  );
45064
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43997
45065
  res.status(200).json(result);
43998
45066
  } catch (err) {
45067
+ invalidateGlobalConfigStatus(deps.workspaceRuntime.workspaceCwd);
43999
45068
  deps.sendBridgeError(res, err, { route });
44000
45069
  }
44001
45070
  }
@@ -44003,6 +45072,179 @@ function registerWorkspaceSkillsRoutes(app, deps) {
44003
45072
  }
44004
45073
  __name(registerWorkspaceSkillsRoutes, "registerWorkspaceSkillsRoutes");
44005
45074
  function registerWorkspaceQualifiedSkillsRoutes(app, deps) {
45075
+ const invalidateConfigStatus = /* @__PURE__ */ __name((runtime, scope = "workspace") => {
45076
+ if (scope === "workspace") {
45077
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45078
+ return;
45079
+ }
45080
+ for (const entry of deps.workspaceRegistry.listAllEntries()) {
45081
+ deps.invalidateSkillsConfigStatus(entry.workspaceCwd);
45082
+ }
45083
+ }, "invalidateConfigStatus");
45084
+ app.get("/workspaces/:workspace/config/skills", async (req, res) => {
45085
+ const entry = resolveWorkspaceEntryFromParam(
45086
+ deps.workspaceRegistry,
45087
+ req,
45088
+ res
45089
+ );
45090
+ if (!entry) return;
45091
+ const configRoute = "GET /workspaces/:workspace/config/skills";
45092
+ try {
45093
+ res.status(200).json(
45094
+ await deps.getSkillsConfigStatus(
45095
+ entry.workspaceCwd,
45096
+ entry.state === "active" && entry.current?.runtime.trusted === true
45097
+ )
45098
+ );
45099
+ } catch (error2) {
45100
+ deps.sendBridgeError(res, error2, { route: configRoute });
45101
+ }
45102
+ });
45103
+ app.get("/workspaces/:workspace/runtime/skills", async (req, res) => {
45104
+ const runtime = resolveWorkspaceRuntimeFromParam(
45105
+ deps.workspaceRegistry,
45106
+ req,
45107
+ res
45108
+ );
45109
+ if (!runtime || !requireTrustedWorkspaceRuntime(runtime, res)) return;
45110
+ const runtimeRoute = "GET /workspaces/:workspace/runtime/skills";
45111
+ try {
45112
+ res.status(200).json(
45113
+ await runtime.workspaceService.getWorkspaceSkillsRuntimeStatus(
45114
+ createBuildWorkspaceCtx(runtime.workspaceCwd)(runtimeRoute)
45115
+ )
45116
+ );
45117
+ } catch (error2) {
45118
+ deps.sendBridgeError(res, error2, { route: runtimeRoute });
45119
+ }
45120
+ });
45121
+ app.post(
45122
+ "/workspaces/:workspace/config/skills/install",
45123
+ deps.mutate({ strict: true }),
45124
+ async (req, res) => {
45125
+ const runtime = resolveWorkspaceRuntimeFromParam(
45126
+ deps.workspaceRegistry,
45127
+ req,
45128
+ res
45129
+ );
45130
+ if (!runtime || !requireTrustedWorkspaceRuntime(runtime, res)) return;
45131
+ const input = parseSkillInstallRequest(req, res, deps.safeBody);
45132
+ if (!input || rejectQualifiedGlobalScope(input.scope, res)) return;
45133
+ const coordinator = requireRuntimeCoordinator3(runtime, res);
45134
+ if (!coordinator) return;
45135
+ const configRoute = "POST /workspaces/:workspace/config/skills/install";
45136
+ try {
45137
+ const result = await skillConfigMutationLocks.runExclusive(
45138
+ `workspace\0${runtime.workspaceCwd}\0${input.name.trim().toLowerCase()}`,
45139
+ () => coordinator.runManagementOperation(
45140
+ () => runtime.workspaceService.installWorkspaceSkill(
45141
+ createBuildWorkspaceCtx(runtime.workspaceCwd)(configRoute),
45142
+ input,
45143
+ { refreshRuntime: false }
45144
+ )
45145
+ )
45146
+ );
45147
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45148
+ res.status(200).json({
45149
+ ...result,
45150
+ activation: reconcileSkills([runtime])
45151
+ });
45152
+ } catch (error2) {
45153
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45154
+ if (!sendSkillManagementError(res, error2)) {
45155
+ deps.sendBridgeError(res, error2, { route: configRoute });
45156
+ }
45157
+ }
45158
+ }
45159
+ );
45160
+ app.delete(
45161
+ "/workspaces/:workspace/config/skills/:name",
45162
+ deps.mutate({ strict: true }),
45163
+ async (req, res) => {
45164
+ const runtime = resolveWorkspaceRuntimeFromParam(
45165
+ deps.workspaceRegistry,
45166
+ req,
45167
+ res
45168
+ );
45169
+ if (!runtime || !requireTrustedWorkspaceRuntime(runtime, res)) return;
45170
+ const scope = parseDeleteScope(req, res);
45171
+ const rawSkillName = req.params["name"];
45172
+ if (!rawSkillName || !scope || rejectQualifiedGlobalScope(scope, res)) {
45173
+ return;
45174
+ }
45175
+ const coordinator = requireRuntimeCoordinator3(runtime, res);
45176
+ if (!coordinator) return;
45177
+ const configRoute = "DELETE /workspaces/:workspace/config/skills/:name";
45178
+ try {
45179
+ const skillName = validateWorkspaceSkillName(rawSkillName);
45180
+ const result = await skillConfigMutationLocks.runExclusive(
45181
+ `workspace\0${runtime.workspaceCwd}\0${skillName.toLowerCase()}`,
45182
+ () => coordinator.runManagementOperation(
45183
+ () => runtime.workspaceService.deleteWorkspaceSkill(
45184
+ createBuildWorkspaceCtx(runtime.workspaceCwd)(configRoute),
45185
+ skillName,
45186
+ scope,
45187
+ { refreshRuntime: false }
45188
+ )
45189
+ )
45190
+ );
45191
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45192
+ res.status(200).json({
45193
+ ...result,
45194
+ activation: reconcileSkills([runtime])
45195
+ });
45196
+ } catch (error2) {
45197
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45198
+ if (!sendSkillManagementError(res, error2)) {
45199
+ deps.sendBridgeError(res, error2, { route: configRoute });
45200
+ }
45201
+ }
45202
+ }
45203
+ );
45204
+ app.post(
45205
+ "/workspaces/:workspace/config/skills/:name/enable",
45206
+ deps.mutate({ strict: true }),
45207
+ async (req, res) => {
45208
+ const runtime = resolveWorkspaceRuntimeFromParam(
45209
+ deps.workspaceRegistry,
45210
+ req,
45211
+ res
45212
+ );
45213
+ if (!runtime || !requireTrustedWorkspaceRuntime(runtime, res)) return;
45214
+ const input = parseSkillToggleRequest(req, res, deps.safeBody);
45215
+ if (!input) return;
45216
+ const clientId = parseAndValidateWorkspaceClientId(
45217
+ req,
45218
+ res,
45219
+ runtime.bridge
45220
+ );
45221
+ if (clientId === null) return;
45222
+ const coordinator = requireRuntimeCoordinator3(runtime, res);
45223
+ if (!coordinator) return;
45224
+ const configRoute = "POST /workspaces/:workspace/config/skills/:name/enable";
45225
+ try {
45226
+ const result = await coordinator.runManagementOperation(
45227
+ () => runtime.workspaceService.setWorkspaceSkillEnabled(
45228
+ createBuildWorkspaceCtx(runtime.workspaceCwd)(
45229
+ configRoute,
45230
+ clientId
45231
+ ),
45232
+ input.skillName,
45233
+ input.enabled,
45234
+ { refreshRuntime: false }
45235
+ )
45236
+ );
45237
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45238
+ res.status(200).json({
45239
+ ...result,
45240
+ activation: result.changed ? reconcileSkills([runtime]) : result.activation
45241
+ });
45242
+ } catch (error2) {
45243
+ deps.invalidateSkillsConfigStatus(runtime.workspaceCwd);
45244
+ deps.sendBridgeError(res, error2, { route: configRoute });
45245
+ }
45246
+ }
45247
+ );
44006
45248
  const route = "POST /workspaces/:workspace/skills/:name/enable";
44007
45249
  const batchRoute = "POST /workspaces/:workspace/skills/enable";
44008
45250
  app.post(
@@ -44025,12 +45267,20 @@ function registerWorkspaceQualifiedSkillsRoutes(app, deps) {
44025
45267
  if (clientId === null) return;
44026
45268
  const installRoute = "POST /workspaces/:workspace/skills/install";
44027
45269
  try {
44028
- const result = await runtime.workspaceService.installWorkspaceSkill(
44029
- createBuildWorkspaceCtx(runtime.workspaceCwd)(installRoute, clientId),
44030
- input
45270
+ const result = await skillConfigMutationLocks.runExclusive(
45271
+ input.scope === "global" ? `global\0${input.name.trim().toLowerCase()}` : `workspace\0${runtime.workspaceCwd}\0${input.name.trim().toLowerCase()}`,
45272
+ () => runtime.workspaceService.installWorkspaceSkill(
45273
+ createBuildWorkspaceCtx(runtime.workspaceCwd)(
45274
+ installRoute,
45275
+ clientId
45276
+ ),
45277
+ input
45278
+ )
44031
45279
  );
45280
+ invalidateConfigStatus(runtime, input.scope);
44032
45281
  res.status(200).json(result);
44033
45282
  } catch (err) {
45283
+ invalidateConfigStatus(runtime, input.scope);
44034
45284
  if (!sendSkillManagementError(res, err))
44035
45285
  deps.sendBridgeError(res, err, { route: installRoute });
44036
45286
  }
@@ -44064,13 +45314,21 @@ function registerWorkspaceQualifiedSkillsRoutes(app, deps) {
44064
45314
  if (clientId === null) return;
44065
45315
  const deleteRoute = "DELETE /workspaces/:workspace/skills/:name";
44066
45316
  try {
44067
- const result = await runtime.workspaceService.deleteWorkspaceSkill(
44068
- createBuildWorkspaceCtx(runtime.workspaceCwd)(deleteRoute, clientId),
44069
- skillName,
44070
- scope
45317
+ const result = await skillConfigMutationLocks.runExclusive(
45318
+ scope === "global" ? `global\0${skillName.toLowerCase()}` : `workspace\0${runtime.workspaceCwd}\0${skillName.toLowerCase()}`,
45319
+ () => runtime.workspaceService.deleteWorkspaceSkill(
45320
+ createBuildWorkspaceCtx(runtime.workspaceCwd)(
45321
+ deleteRoute,
45322
+ clientId
45323
+ ),
45324
+ skillName,
45325
+ scope
45326
+ )
44071
45327
  );
45328
+ invalidateConfigStatus(runtime, scope);
44072
45329
  res.status(200).json(result);
44073
45330
  } catch (err) {
45331
+ invalidateConfigStatus(runtime, scope);
44074
45332
  if (!sendSkillManagementError(res, err))
44075
45333
  deps.sendBridgeError(res, err, { route: deleteRoute });
44076
45334
  }
@@ -44100,8 +45358,10 @@ function registerWorkspaceQualifiedSkillsRoutes(app, deps) {
44100
45358
  input.skillNames,
44101
45359
  input.enabled
44102
45360
  );
45361
+ invalidateConfigStatus(runtime);
44103
45362
  res.status(200).json(result);
44104
45363
  } catch (err) {
45364
+ invalidateConfigStatus(runtime);
44105
45365
  deps.sendBridgeError(res, err, { route: batchRoute });
44106
45366
  }
44107
45367
  }
@@ -44130,8 +45390,10 @@ function registerWorkspaceQualifiedSkillsRoutes(app, deps) {
44130
45390
  input.skillName,
44131
45391
  input.enabled
44132
45392
  );
45393
+ invalidateConfigStatus(runtime);
44133
45394
  res.status(200).json(result);
44134
45395
  } catch (err) {
45396
+ invalidateConfigStatus(runtime);
44135
45397
  deps.sendBridgeError(res, err, { route });
44136
45398
  }
44137
45399
  }
@@ -50860,10 +52122,13 @@ var ConversationRuntimeManager = class {
50860
52122
  runtime;
50861
52123
  pending;
50862
52124
  terminalRuntime;
52125
+ terminalError;
50863
52126
  quarantinePromise;
50864
52127
  ensure() {
50865
52128
  if (this.terminalRuntime) {
50866
- return Promise.reject(conversationRuntimeUnavailableError());
52129
+ return Promise.reject(
52130
+ this.terminalError ?? conversationRuntimeUnavailableError()
52131
+ );
50867
52132
  }
50868
52133
  if (this.pending) return this.pending;
50869
52134
  const pending = this.ensureOnce().finally(() => {
@@ -50884,12 +52149,17 @@ var ConversationRuntimeManager = class {
50884
52149
  if (this.terminalRuntime === expectedRuntime && this.quarantinePromise) {
50885
52150
  return this.quarantinePromise;
50886
52151
  }
50887
- if (this.terminalRuntime) throw conversationRuntimeUnavailableError();
52152
+ if (this.terminalRuntime) {
52153
+ throw this.terminalError ?? conversationRuntimeUnavailableError();
52154
+ }
50888
52155
  if (this.runtime !== expectedRuntime) {
50889
52156
  throw conversationRuntimeUnavailableError();
50890
52157
  }
50891
52158
  this.assertActiveRuntime(expectedRuntime.workspaceCwd, expectedRuntime);
50892
52159
  this.terminalRuntime = expectedRuntime;
52160
+ if (reason === "missing_mandatory_lease_attestation") {
52161
+ this.terminalError = conversationRootCompromisedError();
52162
+ }
50893
52163
  try {
50894
52164
  this.options.onTerminalQuarantine?.(expectedRuntime, reason);
50895
52165
  } catch {
@@ -50930,6 +52200,15 @@ var ConversationRuntimeManager = class {
50930
52200
  await this.assertExactRoot(existing.workspaceCwd);
50931
52201
  this.assertActiveRuntime(root.canonicalRoot, existing);
50932
52202
  this.runtime = existing;
52203
+ try {
52204
+ this.assertMandatoryLeaseAttestation(existing);
52205
+ } catch (error2) {
52206
+ await this.quarantine(
52207
+ existing,
52208
+ "missing_mandatory_lease_attestation"
52209
+ ).catch(() => void 0);
52210
+ throw error2;
52211
+ }
50933
52212
  this.assertNotTerminal();
50934
52213
  return existing;
50935
52214
  }
@@ -50940,6 +52219,7 @@ var ConversationRuntimeManager = class {
50940
52219
  async (candidate) => {
50941
52220
  await this.assertExactRoot(candidate.workspaceCwd);
50942
52221
  this.assertOwnedRuntime(candidate);
52222
+ this.assertMandatoryLeaseAttestation(candidate);
50943
52223
  }
50944
52224
  );
50945
52225
  } catch (error2) {
@@ -50952,7 +52232,9 @@ var ConversationRuntimeManager = class {
50952
52232
  return created;
50953
52233
  }
50954
52234
  assertNotTerminal() {
50955
- if (this.terminalRuntime) throw conversationRuntimeUnavailableError();
52235
+ if (this.terminalRuntime) {
52236
+ throw this.terminalError ?? conversationRuntimeUnavailableError();
52237
+ }
50956
52238
  }
50957
52239
  async revalidateRoot() {
50958
52240
  try {
@@ -50980,6 +52262,11 @@ var ConversationRuntimeManager = class {
50980
52262
  throw conversationRootCompromisedError();
50981
52263
  }
50982
52264
  }
52265
+ assertMandatoryLeaseAttestation(runtime) {
52266
+ if (runtime.bridge.mandatoryLeaseAttested !== true) {
52267
+ throw conversationRootCompromisedError();
52268
+ }
52269
+ }
50983
52270
  };
50984
52271
 
50985
52272
  // packages/cli/src/serve/server.ts
@@ -51180,6 +52467,21 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
51180
52467
  const primaryEffectiveEnv = getRuntimeEffectiveEnv(primaryRuntimeEnvMetadata);
51181
52468
  const daemonEnv = deps.daemonEnv ?? process.env;
51182
52469
  const daemonEnvAtBoot = Object.freeze({ ...daemonEnv });
52470
+ const trustedSkillsConfigStatus = createWorkspaceSkillsStatusProvider({
52471
+ workspaceTrusted: true
52472
+ });
52473
+ const untrustedSkillsConfigStatus = createWorkspaceSkillsStatusProvider({
52474
+ workspaceTrusted: false,
52475
+ includeUntrustedSkills: true
52476
+ });
52477
+ const getSkillsConfigStatus = /* @__PURE__ */ __name((workspaceCwd, trusted) => {
52478
+ const provider = trusted ? trustedSkillsConfigStatus : untrustedSkillsConfigStatus;
52479
+ return provider(workspaceCwd);
52480
+ }, "getSkillsConfigStatus");
52481
+ const invalidateSkillsConfigStatus = /* @__PURE__ */ __name((workspaceCwd) => {
52482
+ trustedSkillsConfigStatus.invalidate?.(workspaceCwd);
52483
+ untrustedSkillsConfigStatus.invalidate?.(workspaceCwd);
52484
+ }, "invalidateSkillsConfigStatus");
51183
52485
  const webTerminalRegistry = new WebTerminalRegistry();
51184
52486
  const webTerminalLocals = app.locals;
51185
52487
  webTerminalLocals.stopWebTerminalRegistry = () => webTerminalRegistry.dispose();
@@ -52439,6 +53741,7 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
52439
53741
  workspaceRegistrationStore: deps.workspaceRegistrationStore,
52440
53742
  getAcpHandle: /* @__PURE__ */ __name(() => acpHandleRef.current, "getAcpHandle"),
52441
53743
  runtimeRemoval: deps.workspaceRuntimeRemoval,
53744
+ onWorkspaceRemoved: invalidateSkillsConfigStatus,
52442
53745
  ...deps.liveConversationWorkspace ? { reservedWorkspaceRoots: [deps.liveConversationWorkspace.rootPath] } : {}
52443
53746
  });
52444
53747
  app.locals.workspaceManagementHandle = workspaceManagementHandle;
@@ -52760,16 +54063,34 @@ function createServeApp(opts, getPort = () => opts.port, deps = {}) {
52760
54063
  });
52761
54064
  registerWorkspaceSkillsRoutes(app, {
52762
54065
  workspaceRuntime: primaryRuntime,
54066
+ workspaceRegistry,
52763
54067
  mutate,
52764
54068
  safeBody,
52765
54069
  sendBridgeError: sendBridgeError2,
54070
+ getSkillsConfigStatus,
54071
+ invalidateSkillsConfigStatus,
54072
+ installSkillConfig: /* @__PURE__ */ __name((workspaceCwd, request2) => installWorkspaceSkill(
54073
+ workspaceCwd,
54074
+ request2,
54075
+ primaryEffectiveEnv?.["GH_TOKEN"] ?? primaryEffectiveEnv?.["GITHUB_TOKEN"] ?? daemonEnvAtBoot["GH_TOKEN"] ?? daemonEnvAtBoot["GITHUB_TOKEN"],
54076
+ capturePrimaryGenerationAssertion()
54077
+ ), "installSkillConfig"),
54078
+ deleteSkillConfig: /* @__PURE__ */ __name((workspaceCwd, scope, skillName, installedPath) => deleteWorkspaceSkill(
54079
+ workspaceCwd,
54080
+ scope,
54081
+ skillName,
54082
+ installedPath,
54083
+ capturePrimaryGenerationAssertion()
54084
+ ), "deleteSkillConfig"),
52766
54085
  parseAndValidateClientId: /* @__PURE__ */ __name((req, res) => parseAndValidateWorkspaceClientId(req, res, primaryBridge), "parseAndValidateClientId")
52767
54086
  });
52768
54087
  registerWorkspaceQualifiedSkillsRoutes(app, {
52769
54088
  workspaceRegistry,
52770
54089
  mutate,
52771
54090
  safeBody,
52772
- sendBridgeError: sendBridgeError2
54091
+ sendBridgeError: sendBridgeError2,
54092
+ getSkillsConfigStatus,
54093
+ invalidateSkillsConfigStatus
52773
54094
  });
52774
54095
  registerScheduledTasksRoutes(app, {
52775
54096
  boundWorkspace: primaryBoundWorkspace,